From 7d5ce836beb9a6c56e110ae86e2a5e65f807f4ef Mon Sep 17 00:00:00 2001 From: John Letey Date: Thu, 27 Apr 2023 11:48:49 +0200 Subject: [PATCH 001/109] feat: initial transition to cSDK Twilight --- app/ante.go | 10 +- app/app.go | 706 ++++++++++-------- app/export.go | 85 ++- app/keepers.go | 38 +- app/modules.go | 35 +- app/test_helpers.go | 94 +-- cmd/kyved/app_creator.go | 93 +-- cmd/kyved/config.go | 2 +- cmd/kyved/root.go | 13 +- docs/swagger.yml | 110 +-- go.mod | 140 ++-- go.sum | 651 ++++++++++++---- proto/Dockerfile | 12 +- proto/buf.lock | 8 +- proto/buf.yaml | 3 +- proto/kyve/query/v1beta1/params.proto | 4 +- testutil/integration/integration.go | 22 +- testutil/keeper/bundles.go | 6 +- testutil/keeper/pool.go | 6 +- testutil/keeper/query.go | 6 +- testutil/keeper/stakers.go | 6 +- x/bundles/keeper/keeper.go | 2 +- .../keeper/msg_server_update_params_test.go | 28 +- x/bundles/module.go | 10 +- x/bundles/types/bundles.pb.go | 2 +- x/bundles/types/events.pb.go | 2 +- x/bundles/types/genesis.pb.go | 2 +- x/bundles/types/params.pb.go | 2 +- x/bundles/types/query.pb.go | 4 +- x/bundles/types/tx.pb.go | 4 +- x/delegation/keeper/keeper.go | 2 +- .../keeper/msg_server_update_params_test.go | 36 +- x/delegation/module.go | 10 +- x/delegation/types/delegation.pb.go | 2 +- x/delegation/types/events.pb.go | 2 +- x/delegation/types/genesis.pb.go | 2 +- x/delegation/types/params.pb.go | 2 +- x/delegation/types/query.pb.go | 4 +- x/delegation/types/tx.pb.go | 4 +- x/global/abci_test.go | 14 +- x/global/ante.go | 4 +- x/global/ante_test.go | 90 +-- x/global/ante_utils_test.go | 13 +- x/global/keeper/keeper.go | 2 +- .../keeper/msg_server_update_params_test.go | 32 +- x/global/module.go | 10 +- x/global/post.go | 8 +- x/global/post_test.go | 28 +- x/global/types/events.pb.go | 2 +- x/global/types/genesis.pb.go | 2 +- x/global/types/global.pb.go | 2 +- x/global/types/query.pb.go | 4 +- x/global/types/tx.pb.go | 4 +- x/pool/keeper/keeper.go | 2 +- x/pool/keeper/keeper_utils_test.go | 4 +- .../msg_server_cancel_runtime_upgrade_test.go | 2 +- x/pool/keeper/msg_server_create_pool_test.go | 2 +- x/pool/keeper/msg_server_disable_pool_test.go | 2 +- x/pool/keeper/msg_server_enable_pool_test.go | 2 +- ...sg_server_schedule_runtime_upgrade_test.go | 2 +- x/pool/keeper/msg_server_update_pool_test.go | 2 +- x/pool/module.go | 10 +- x/pool/types/events.pb.go | 2 +- x/pool/types/genesis.pb.go | 2 +- x/pool/types/pool.pb.go | 2 +- x/pool/types/tx.pb.go | 4 +- x/query/keeper/grpc_params.go | 15 +- x/query/keeper/keeper.go | 2 +- x/query/module.go | 10 +- x/query/types/account.pb.go | 4 +- x/query/types/bundles.pb.go | 4 +- x/query/types/delegation.pb.go | 4 +- x/query/types/params.pb.go | 66 +- x/query/types/pools.pb.go | 4 +- x/query/types/query.pb.go | 2 +- x/query/types/stakers.pb.go | 4 +- x/stakers/keeper/exported_functions_test.go | 4 +- x/stakers/keeper/keeper.go | 2 +- .../keeper/msg_server_update_params_test.go | 20 +- x/stakers/module.go | 10 +- x/stakers/types/events.pb.go | 2 +- x/stakers/types/genesis.pb.go | 2 +- x/stakers/types/params.pb.go | 2 +- x/stakers/types/query.pb.go | 4 +- x/stakers/types/stakers.pb.go | 2 +- x/stakers/types/tx.pb.go | 4 +- x/team/keeper/keeper.go | 2 +- x/team/module.go | 10 +- x/team/types/events.pb.go | 2 +- x/team/types/genesis.pb.go | 2 +- x/team/types/query.pb.go | 4 +- x/team/types/team.pb.go | 2 +- x/team/types/tx.pb.go | 4 +- 93 files changed, 1509 insertions(+), 1107 deletions(-) diff --git a/app/ante.go b/app/ante.go index 3317a707..3d5efad3 100644 --- a/app/ante.go +++ b/app/ante.go @@ -17,8 +17,8 @@ import ( // Gov govKeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" // IBC - ibcAnte "github.com/cosmos/ibc-go/v6/modules/core/ante" - ibcKeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper" + ibcAnte "github.com/cosmos/ibc-go/v7/modules/core/ante" + ibcKeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" // Staking stakingKeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" ) @@ -69,12 +69,12 @@ func NewPostHandler( bankKeeper bankKeeper.Keeper, feeGrantKeeper feeGrantKeeper.Keeper, globalKeeper globalKeeper.Keeper, -) (sdk.AnteHandler, error) { +) (sdk.PostHandler, error) { refundFeeDecorator := global.NewRefundFeeDecorator(bankKeeper, feeGrantKeeper, globalKeeper) - postDecorators := []sdk.AnteDecorator{ + postDecorators := []sdk.PostDecorator{ refundFeeDecorator, } - return sdk.ChainAnteDecorators(postDecorators...), nil + return sdk.ChainPostDecorators(postDecorators...), nil } diff --git a/app/app.go b/app/app.go index b1d79a09..f0f0954d 100644 --- a/app/app.go +++ b/app/app.go @@ -1,125 +1,134 @@ package app import ( + "encoding/json" "fmt" "io" - "net/http" "os" "path/filepath" v12 "github.com/KYVENetwork/chain/app/upgrades/v1_2" - + dbm "github.com/cometbft/cometbft-db" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/libs/log" + cmtOs "github.com/cometbft/cometbft/libs/os" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/grpc/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" + "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" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + serverTypes "github.com/cosmos/cosmos-sdk/server/types" + "github.com/cosmos/cosmos-sdk/store/streaming" + 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/spf13/cast" + + // Auth "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/ante" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + authKeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + 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" + vestingTypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + // Authz authzTypes "github.com/cosmos/cosmos-sdk/x/authz" - authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" + authzKeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" authz "github.com/cosmos/cosmos-sdk/x/authz/module" + // Bank "github.com/cosmos/cosmos-sdk/x/bank" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - "github.com/cosmos/cosmos-sdk/x/crisis" - crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - "github.com/cosmos/cosmos-sdk/x/distribution" - distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client" - 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" - feeGrant "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" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - groupTypes "github.com/cosmos/cosmos-sdk/x/group" - groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" - group "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" - 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/v6/modules/apps/27-interchain-accounts" - icaController "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/controller" - icaControllerKeeper "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/controller/keeper" - icaControllerTypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/controller/types" - icaHost "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host" - icahostkeeper "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/keeper" - icaHostTypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/types" - ibcFee "github.com/cosmos/ibc-go/v6/modules/apps/29-fee" - ibcFeeKeeper "github.com/cosmos/ibc-go/v6/modules/apps/29-fee/keeper" - ibcFeeTypes "github.com/cosmos/ibc-go/v6/modules/apps/29-fee/types" - ibcTransfer "github.com/cosmos/ibc-go/v6/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v6/modules/apps/transfer/keeper" - ibcTransferTypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v6/modules/core" - ibcclient "github.com/cosmos/ibc-go/v6/modules/core/02-client" - ibcclientclient "github.com/cosmos/ibc-go/v6/modules/core/02-client/client" - ibcclienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" - ibcPortTypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types" - ibchost "github.com/cosmos/ibc-go/v6/modules/core/24-host" - ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper" - "github.com/spf13/cast" - abci "github.com/tendermint/tendermint/abci/types" - tmjson "github.com/tendermint/tendermint/libs/json" - "github.com/tendermint/tendermint/libs/log" - tmos "github.com/tendermint/tendermint/libs/os" - dbm "github.com/tendermint/tm-db" - - kyveDocs "github.com/KYVENetwork/chain/docs" - // this line is used by starport scaffolding # stargate/app/moduleImport - + bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + bankTypes "github.com/cosmos/cosmos-sdk/x/bank/types" // Bundles "github.com/KYVENetwork/chain/x/bundles" bundlesKeeper "github.com/KYVENetwork/chain/x/bundles/keeper" bundlesTypes "github.com/KYVENetwork/chain/x/bundles/types" + // Capability + "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" + // Consensus + "github.com/cosmos/cosmos-sdk/x/consensus" + consensusKeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" + consensusTypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + // Crisis + "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" // Delegation "github.com/KYVENetwork/chain/x/delegation" delegationKeeper "github.com/KYVENetwork/chain/x/delegation/keeper" delegationTypes "github.com/KYVENetwork/chain/x/delegation/types" + // Distribution + "github.com/cosmos/cosmos-sdk/x/distribution" + distributionKeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + distributionTypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + // Evidence + "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" + // FeeGrant + feeGrantTypes "github.com/cosmos/cosmos-sdk/x/feegrant" + feeGrantKeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" + feeGrant "github.com/cosmos/cosmos-sdk/x/feegrant/module" + // GenUtil + "github.com/cosmos/cosmos-sdk/x/genutil" + genUtilTypes "github.com/cosmos/cosmos-sdk/x/genutil/types" // Global "github.com/KYVENetwork/chain/x/global" globalKeeper "github.com/KYVENetwork/chain/x/global/keeper" globalTypes "github.com/KYVENetwork/chain/x/global/types" + // Gov + "github.com/cosmos/cosmos-sdk/x/gov" + govKeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + govTypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + // Group + groupTypes "github.com/cosmos/cosmos-sdk/x/group" + groupKeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" + group "github.com/cosmos/cosmos-sdk/x/group/module" + // IBC Core + ibc "github.com/cosmos/ibc-go/v7/modules/core" + ibcClientHandler "github.com/cosmos/ibc-go/v7/modules/core/02-client" // TODO + 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" + // IBC Fee + ibcFee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee" + ibcFeeKeeper "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/keeper" + ibcFeeTypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" + // IBC Transfer + ibcTransfer "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" + // ICA + ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" + icaTypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" + // ICA Controller + icaController "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller" + 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" + // ICA Host + 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" + // Mint + "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" + // Params + "github.com/cosmos/cosmos-sdk/x/params" + paramsTypes "github.com/cosmos/cosmos-sdk/x/params/types" + paramsProposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" // Pool "github.com/KYVENetwork/chain/x/pool" poolKeeper "github.com/KYVENetwork/chain/x/pool/keeper" @@ -128,14 +137,26 @@ import ( "github.com/KYVENetwork/chain/x/query" queryKeeper "github.com/KYVENetwork/chain/x/query/keeper" queryTypes "github.com/KYVENetwork/chain/x/query/types" + // Slashing + "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" // Stakers "github.com/KYVENetwork/chain/x/stakers" stakersKeeper "github.com/KYVENetwork/chain/x/stakers/keeper" stakersTypes "github.com/KYVENetwork/chain/x/stakers/types" + // Staking + "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" // Team "github.com/KYVENetwork/chain/x/team" teamKeeper "github.com/KYVENetwork/chain/x/team/keeper" teamTypes "github.com/KYVENetwork/chain/x/team/types" + // Upgrade + "github.com/cosmos/cosmos-sdk/x/upgrade" + upgradeKeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" + upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) const ( @@ -143,21 +164,6 @@ const ( Name = "kyve" ) -func getGovProposalHandlers() []govclient.ProposalHandler { - var govProposalHandlers []govclient.ProposalHandler - - govProposalHandlers = append(govProposalHandlers, - paramsclient.ProposalHandler, - distrclient.ProposalHandler, - upgradeclient.LegacyProposalHandler, - upgradeclient.LegacyCancelProposalHandler, - ibcclientclient.UpdateClientProposalHandler, - ibcclientclient.UpgradeProposalHandler, - ) - - return govProposalHandlers -} - var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string @@ -166,12 +172,13 @@ var ( // non-dependant module elements, such as codec registration // and genesis verification. ModuleBasics = module.NewBasicManager(appModuleBasics...) - - // module account permissions - maccPerms = moduleAccountPermissions ) -var _ servertypes.Application = (*App)(nil) +var ( + // TODO(@john): Ask if this is needed for a "v1" app. + _ runtime.AppI = (*App)(nil) + _ serverTypes.Application = (*App)(nil) +) func init() { userHomeDir, err := os.UserHomeDir() @@ -187,23 +194,17 @@ func init() { // capabilities aren't needed for testing. type App struct { *baseapp.BaseApp - - Keepers - - cdc *codec.LegacyAmino + legacyAmino *codec.LegacyAmino appCodec codec.Codec + txConfig client.TxConfig interfaceRegistry types.InterfaceRegistry - invCheckPeriod uint - - // keys to access the substores - keys map[string]*storetypes.KVStoreKey - tkeys map[string]*storetypes.TransientStoreKey - memKeys map[string]*storetypes.MemoryStoreKey - - // mm is the module manager - mm *module.Manager + keys map[string]*storeTypes.KVStoreKey + tkeys map[string]*storeTypes.TransientStoreKey + memKeys map[string]*storeTypes.MemoryStoreKey + Keepers + mm *module.Manager configurator module.Configurator } @@ -213,29 +214,71 @@ func NewKYVEApp( db dbm.DB, traceStore io.Writer, loadLatest bool, - skipUpgradeHeights map[int64]bool, - homePath string, - invCheckPeriod uint, - encodingConfig EncodingConfig, - appOpts servertypes.AppOptions, + appOpts serverTypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), ) *App { + encodingConfig := MakeEncodingConfig() + appCodec := encodingConfig.Marshaler - cdc := encodingConfig.Amino + legacyAmino := encodingConfig.Amino interfaceRegistry := encodingConfig.InterfaceRegistry - - bApp := baseapp.NewBaseApp(Name, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...) + txConfig := encodingConfig.TxConfig + + // Below we could construct and set an application specific mempool and + // ABCI 1.0 PrepareProposal and ProcessProposal handlers. These defaults are + // already set in the SDK's BaseApp, this shows an example of how to override + // them. + // + // Example: + // + // bApp := baseapp.NewBaseApp(...) + // nonceMempool := mempool.NewSenderNonceMempool() + // abciPropHandler := NewDefaultProposalHandler(nonceMempool, bApp) + // + // bApp.SetMempool(nonceMempool) + // bApp.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) + // bApp.SetProcessProposal(abciPropHandler.ProcessProposalHandler()) + // + // Alternatively, you can construct BaseApp options, append those to + // baseAppOptions and pass them to NewBaseApp. + // + // Example: + // + // prepareOpt = func(app *baseapp.BaseApp) { + // abciPropHandler := baseapp.NewDefaultProposalHandler(nonceMempool, app) + // app.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) + // } + // baseAppOptions = append(baseAppOptions, prepareOpt) + + bApp := baseapp.NewBaseApp(Name, logger, db, txConfig.TxDecoder(), baseAppOptions...) bApp.SetCommitMultiStoreTracer(traceStore) bApp.SetVersion(version.Version) bApp.SetInterfaceRegistry(interfaceRegistry) + bApp.SetTxEncoder(txConfig.TxEncoder()) keys := sdk.NewKVStoreKeys( - authtypes.StoreKey, authzTypes.ModuleName, banktypes.StoreKey, stakingtypes.StoreKey, - minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, - paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, - evidencetypes.StoreKey, ibcFeeTypes.StoreKey, ibcTransferTypes.StoreKey, - icaControllerTypes.StoreKey, icaHostTypes.StoreKey, capabilitytypes.StoreKey, + authTypes.StoreKey, + authzTypes.ModuleName, + bankTypes.StoreKey, + capabilityTypes.StoreKey, + consensusTypes.StoreKey, + crisisTypes.StoreKey, + distributionTypes.StoreKey, + evidenceTypes.StoreKey, + feeGrantTypes.StoreKey, + govTypes.StoreKey, groupTypes.StoreKey, + mintTypes.StoreKey, + paramsTypes.StoreKey, + slashingTypes.StoreKey, + stakingTypes.StoreKey, + upgradeTypes.StoreKey, + + ibcExported.StoreKey, + ibcFeeTypes.StoreKey, + ibcTransferTypes.StoreKey, + icaControllerTypes.StoreKey, + icaHostTypes.StoreKey, bundlesTypes.StoreKey, delegationTypes.StoreKey, @@ -245,15 +288,25 @@ func NewKYVEApp( stakersTypes.StoreKey, teamTypes.StoreKey, ) - tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) - memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, bundlesTypes.MemStoreKey, delegationTypes.MemStoreKey) + tkeys := sdk.NewTransientStoreKeys(paramsTypes.TStoreKey) + memKeys := sdk.NewMemoryStoreKeys( + capabilityTypes.MemStoreKey, + + bundlesTypes.MemStoreKey, delegationTypes.MemStoreKey, + ) + + // load state streaming if enabled + if _, _, err := streaming.LoadStreamingServices(bApp, appOpts, appCodec, logger, keys); err != nil { + logger.Error("failed to load state streaming", "err", err) + os.Exit(1) + } app := &App{ BaseApp: bApp, - cdc: cdc, + legacyAmino: legacyAmino, appCodec: appCodec, + txConfig: txConfig, interfaceRegistry: interfaceRegistry, - invCheckPeriod: invCheckPeriod, keys: keys, tkeys: tkeys, memKeys: memKeys, @@ -261,132 +314,143 @@ func NewKYVEApp( app.ParamsKeeper = initParamsKeeper( appCodec, - cdc, - keys[paramstypes.StoreKey], - tkeys[paramstypes.TStoreKey], + legacyAmino, + keys[paramsTypes.StoreKey], + tkeys[paramsTypes.TStoreKey], ) // set the BaseApp's parameter store - bApp.SetParamStore(app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable())) + app.ConsensusKeeper = consensusKeeper.NewKeeper( + appCodec, + keys[consensusTypes.StoreKey], + authTypes.NewModuleAddress(govTypes.ModuleName).String(), + ) + bApp.SetParamStore(&app.ConsensusKeeper) // add capability keeper and ScopeToModule for ibc module - app.CapabilityKeeper = capabilitykeeper.NewKeeper( + app.CapabilityKeeper = capabilityKeeper.NewKeeper( appCodec, - keys[capabilitytypes.StoreKey], - memKeys[capabilitytypes.MemStoreKey], + keys[capabilityTypes.StoreKey], + memKeys[capabilityTypes.MemStoreKey], ) - // grant capabilities for the ibc and ibc-transfer modules - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName) + scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcExported.ModuleName) scopedIBCTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibcTransferTypes.ModuleName) scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icaControllerTypes.SubModuleName) scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icaHostTypes.SubModuleName) - // this line is used by starport scaffolding # stargate/app/scopedKeeper + + // TODO(@john): Seal x/capability keeper. // add keepers - app.AccountKeeper = authkeeper.NewAccountKeeper( + app.AccountKeeper = authKeeper.NewAccountKeeper( appCodec, - keys[authtypes.StoreKey], - app.GetSubspace(authtypes.ModuleName), - authtypes.ProtoBaseAccount, - maccPerms, - sdk.Bech32PrefixAccAddr, + keys[authTypes.StoreKey], + authTypes.ProtoBaseAccount, + moduleAccountPermissions, + sdk.Bech32MainPrefix, + authTypes.NewModuleAddress(govTypes.ModuleName).String(), ) - app.AuthzKeeper = authzkeeper.NewKeeper( + app.AuthzKeeper = authzKeeper.NewKeeper( keys[authzTypes.ModuleName], appCodec, app.MsgServiceRouter(), app.AccountKeeper, ) - app.BankKeeper = bankkeeper.NewBaseKeeper( + app.BankKeeper = bankKeeper.NewBaseKeeper( appCodec, - keys[banktypes.StoreKey], + keys[bankTypes.StoreKey], app.AccountKeeper, - app.GetSubspace(banktypes.ModuleName), app.BlockedModuleAccountAddrs(), + authTypes.NewModuleAddress(govTypes.ModuleName).String(), ) - stakingKeeper := stakingkeeper.NewKeeper( + app.StakingKeeper = stakingKeeper.NewKeeper( appCodec, - keys[stakingtypes.StoreKey], + keys[stakingTypes.StoreKey], app.AccountKeeper, app.BankKeeper, - app.GetSubspace(stakingtypes.ModuleName), + authTypes.NewModuleAddress(govTypes.ModuleName).String(), ) - app.MintKeeper = mintkeeper.NewKeeper( + app.MintKeeper = mintKeeper.NewKeeper( appCodec, - keys[minttypes.StoreKey], - app.GetSubspace(minttypes.ModuleName), - &stakingKeeper, - &app.StakersKeeper, + keys[mintTypes.StoreKey], + app.StakingKeeper, + &app.StakersKeeper, // TODO(@john) app.AccountKeeper, app.BankKeeper, - authtypes.FeeCollectorName, + authTypes.FeeCollectorName, + authTypes.NewModuleAddress(govTypes.ModuleName).String(), ) - app.DistributionKeeper = distrkeeper.NewKeeper( + app.DistributionKeeper = distributionKeeper.NewKeeper( appCodec, - keys[distrtypes.StoreKey], - app.GetSubspace(distrtypes.ModuleName), + keys[distributionTypes.StoreKey], app.AccountKeeper, app.BankKeeper, - &stakingKeeper, - authtypes.FeeCollectorName, + app.StakingKeeper, + authTypes.FeeCollectorName, + authTypes.NewModuleAddress(govTypes.ModuleName).String(), ) - app.SlashingKeeper = slashingkeeper.NewKeeper( + app.SlashingKeeper = slashingKeeper.NewKeeper( appCodec, - keys[slashingtypes.StoreKey], - &stakingKeeper, - app.GetSubspace(slashingtypes.ModuleName), + legacyAmino, + keys[slashingTypes.StoreKey], + app.StakingKeeper, + authTypes.NewModuleAddress(govTypes.ModuleName).String(), ) - app.CrisisKeeper = crisiskeeper.NewKeeper( - app.GetSubspace(crisistypes.ModuleName), + invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)) + app.CrisisKeeper = crisisKeeper.NewKeeper( + appCodec, + keys[crisisTypes.StoreKey], invCheckPeriod, app.BankKeeper, - authtypes.FeeCollectorName, + authTypes.FeeCollectorName, + authTypes.NewModuleAddress(govTypes.ModuleName).String(), ) - groupConfig := groupTypes.DefaultConfig() - /* - Example of setting group params: - groupConfig.MaxMetadataLen = 1000 - */ - app.GroupKeeper = groupkeeper.NewKeeper( - keys[groupTypes.StoreKey], + app.FeeGrantKeeper = feeGrantKeeper.NewKeeper( appCodec, - app.MsgServiceRouter(), + keys[feeGrantTypes.StoreKey], app.AccountKeeper, - groupConfig, ) - app.FeeGrantKeeper = feegrantkeeper.NewKeeper( + app.GroupKeeper = groupKeeper.NewKeeper( + keys[groupTypes.StoreKey], appCodec, - keys[feegrant.StoreKey], + app.MsgServiceRouter(), app.AccountKeeper, + groupTypes.DefaultConfig(), ) - app.UpgradeKeeper = upgradekeeper.NewKeeper( + // get skipUpgradeHeights from the app options + skipUpgradeHeights := map[int64]bool{} + for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { + skipUpgradeHeights[int64(h)] = true + } + homePath := cast.ToString(appOpts.Get(flags.FlagHome)) + // set the governance module account as the authority for conducting upgrades + app.UpgradeKeeper = upgradeKeeper.NewKeeper( skipUpgradeHeights, - keys[upgradetypes.StoreKey], + keys[upgradeTypes.StoreKey], appCodec, homePath, app.BaseApp, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), + authTypes.NewModuleAddress(govTypes.ModuleName).String(), ) // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks - app.StakingKeeper = *stakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks(app.DistributionKeeper.Hooks(), app.SlashingKeeper.Hooks()), + app.StakingKeeper.SetHooks( + stakingTypes.NewMultiStakingHooks(app.DistributionKeeper.Hooks(), app.SlashingKeeper.Hooks()), ) // ... other modules keepers - app.GlobalKeeper = *globalKeeper.NewKeeper(appCodec, keys[globalTypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.GlobalKeeper = *globalKeeper.NewKeeper(appCodec, keys[globalTypes.StoreKey], authTypes.NewModuleAddress(govTypes.ModuleName).String()) app.TeamKeeper = *teamKeeper.NewKeeper(appCodec, keys[teamTypes.StoreKey], app.AccountKeeper, app.BankKeeper) @@ -395,7 +459,7 @@ func NewKYVEApp( keys[poolTypes.StoreKey], memKeys[poolTypes.MemStoreKey], - authtypes.NewModuleAddress(govtypes.ModuleName).String(), + authTypes.NewModuleAddress(govTypes.ModuleName).String(), app.AccountKeeper, app.BankKeeper, @@ -408,7 +472,7 @@ func NewKYVEApp( keys[stakersTypes.StoreKey], memKeys[stakersTypes.MemStoreKey], - authtypes.NewModuleAddress(govtypes.ModuleName).String(), + authTypes.NewModuleAddress(govTypes.ModuleName).String(), app.AccountKeeper, app.BankKeeper, @@ -422,7 +486,7 @@ func NewKYVEApp( keys[delegationTypes.StoreKey], memKeys[delegationTypes.MemStoreKey], - authtypes.NewModuleAddress(govtypes.ModuleName).String(), + authTypes.NewModuleAddress(govTypes.ModuleName).String(), app.AccountKeeper, app.BankKeeper, @@ -440,7 +504,7 @@ func NewKYVEApp( keys[bundlesTypes.StoreKey], memKeys[bundlesTypes.MemStoreKey], - authtypes.NewModuleAddress(govtypes.ModuleName).String(), + authTypes.NewModuleAddress(govTypes.ModuleName).String(), app.AccountKeeper, app.BankKeeper, @@ -450,17 +514,18 @@ func NewKYVEApp( app.DelegationKeeper, ) - // Create IBC Keepers - app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, keys[ibchost.StoreKey], - app.GetSubspace(ibchost.ModuleName), + app.IBCKeeper = ibcKeeper.NewKeeper( + appCodec, + keys[ibcExported.StoreKey], + app.GetSubspace(ibcExported.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, ) app.IBCFeeKeeper = ibcFeeKeeper.NewKeeper( - appCodec, keys[ibcFeeTypes.StoreKey], + appCodec, + keys[ibcFeeTypes.StoreKey], app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, @@ -468,8 +533,9 @@ func NewKYVEApp( app.BankKeeper, ) - app.IBCTransferKeeper = ibctransferkeeper.NewKeeper( - appCodec, keys[ibcTransferTypes.StoreKey], + app.IBCTransferKeeper = ibcTransferKeeper.NewKeeper( + appCodec, + keys[ibcTransferTypes.StoreKey], app.GetSubspace(ibcTransferTypes.ModuleName), app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper, @@ -480,7 +546,8 @@ func NewKYVEApp( ) app.ICAControllerKeeper = icaControllerKeeper.NewKeeper( - appCodec, keys[icaControllerTypes.StoreKey], + appCodec, + keys[icaControllerTypes.StoreKey], app.GetSubspace(icaControllerTypes.SubModuleName), app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper, @@ -489,8 +556,9 @@ func NewKYVEApp( app.MsgServiceRouter(), ) - app.ICAHostKeeper = icahostkeeper.NewKeeper( - appCodec, keys[icaHostTypes.StoreKey], + app.ICAHostKeeper = icaHostKeeper.NewKeeper( + appCodec, + keys[icaHostTypes.StoreKey], app.GetSubspace(icaHostTypes.SubModuleName), app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper, @@ -501,35 +569,35 @@ func NewKYVEApp( ) // Create evidence Keeper for to register the IBC light client misbehaviour evidence route - evidenceKeeper := evidencekeeper.NewKeeper( + app.EvidenceKeeper = evidenceKeeper.NewKeeper( appCodec, - keys[evidencetypes.StoreKey], - &app.StakingKeeper, + 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 + // app.EvidenceKeeper = *evidenceKeeper - govRouter := govv1beta1.NewRouter() + govRouter := v1beta1.NewRouter() govRouter. - AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). - AddRoute(distrtypes.RouterKey, distribution.NewCommunityPoolSpendProposalHandler(app.DistributionKeeper)). - AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). - AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) - govConfig := govtypes.DefaultConfig() - app.GovKeeper = govkeeper.NewKeeper( + AddRoute(govTypes.RouterKey, v1beta1.ProposalHandler). + AddRoute(paramsProposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). + // AddRoute(distrtypes.RouterKey, distribution.NewCommunityPoolSpendProposalHandler(app.DistributionKeeper)). + AddRoute(upgradeTypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). + AddRoute(ibcClientTypes.RouterKey, ibcClientHandler.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) + govConfig := govTypes.DefaultConfig() + app.GovKeeper = govKeeper.NewKeeper( appCodec, - keys[govtypes.StoreKey], - app.GetSubspace(govtypes.ModuleName), + keys[govTypes.StoreKey], app.AccountKeeper, app.BankKeeper, - &stakingKeeper, - &app.StakersKeeper, - govRouter, + app.StakingKeeper, + app.StakersKeeper, app.MsgServiceRouter(), govConfig, + authTypes.NewModuleAddress(govTypes.ModuleName).String(), ) + app.GovKeeper.SetLegacyRouter(govRouter) app.QueryKeeper = *queryKeeper.NewKeeper( appCodec, @@ -545,7 +613,7 @@ func NewKYVEApp( app.DelegationKeeper, app.BundlesKeeper, app.GlobalKeeper, - app.GovKeeper, + *app.GovKeeper, app.TeamKeeper, ) // this line is used by starport scaffolding # stargate/app/keeperDefinition @@ -580,24 +648,25 @@ func NewKYVEApp( app.mm = module.NewManager( // Cosmos SDK - auth.NewAppModule(appCodec, app.AccountKeeper, nil), + auth.NewAppModule(appCodec, app.AccountKeeper, nil, app.GetSubspace(authTypes.ModuleName)), authz.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper), - capability.NewAppModule(appCodec, *app.CapabilityKeeper), - crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants), - distribution.NewAppModule(appCodec, app.DistributionKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), - evidence.NewAppModule(app.EvidenceKeeper), + bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(bankTypes.ModuleName)), + capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), + consensus.NewAppModule(appCodec, app.ConsensusKeeper), + crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisisTypes.ModuleName)), + distribution.NewAppModule(appCodec, app.DistributionKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distributionTypes.ModuleName)), + evidence.NewAppModule(*app.EvidenceKeeper), feeGrant.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), genutil.NewAppModule( app.AccountKeeper, app.StakingKeeper, app.BaseApp.DeliverTx, encodingConfig.TxConfig, ), - gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), + gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govTypes.ModuleName)), group.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, minttypes.DefaultInflationCalculationFn), + mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, mintTypes.DefaultInflationCalculationFn, app.GetSubspace(mintTypes.ModuleName)), params.NewAppModule(app.ParamsKeeper), - slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), - staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), + slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingTypes.ModuleName)), + staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingTypes.ModuleName)), upgrade.NewAppModule(app.UpgradeKeeper), vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), @@ -610,11 +679,11 @@ func NewKYVEApp( // KYVE bundles.NewAppModule(appCodec, app.BundlesKeeper, app.AccountKeeper, app.BankKeeper), delegation.NewAppModule(appCodec, app.DelegationKeeper, app.AccountKeeper, app.BankKeeper), - global.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.GlobalKeeper, app.UpgradeKeeper), + global.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.GlobalKeeper, *app.UpgradeKeeper), pool.NewAppModule(appCodec, app.PoolKeeper, app.AccountKeeper, app.BankKeeper), query.NewAppModule(appCodec, app.QueryKeeper, app.AccountKeeper, app.BankKeeper), stakers.NewAppModule(appCodec, app.StakersKeeper, app.AccountKeeper, app.BankKeeper), - team.NewAppModule(appCodec, app.BankKeeper, app.MintKeeper, app.TeamKeeper, app.UpgradeKeeper), + team.NewAppModule(appCodec, app.BankKeeper, app.MintKeeper, app.TeamKeeper, *app.UpgradeKeeper), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -623,29 +692,30 @@ func NewKYVEApp( // NOTE: staking module is required if HistoricalEntries param > 0 app.mm.SetOrderBeginBlockers( // upgrades should be run first - upgradetypes.ModuleName, - capabilitytypes.ModuleName, - minttypes.ModuleName, + upgradeTypes.ModuleName, + capabilityTypes.ModuleName, + mintTypes.ModuleName, // NOTE: x/team must be run before x/distribution and after x/mint. teamTypes.ModuleName, - distrtypes.ModuleName, - slashingtypes.ModuleName, - evidencetypes.ModuleName, - stakingtypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - govtypes.ModuleName, - crisistypes.ModuleName, + distributionTypes.ModuleName, + slashingTypes.ModuleName, + evidenceTypes.ModuleName, + stakingTypes.ModuleName, + authTypes.ModuleName, + bankTypes.ModuleName, + govTypes.ModuleName, + crisisTypes.ModuleName, ibcFeeTypes.ModuleName, ibcTransferTypes.ModuleName, - ibchost.ModuleName, - icatypes.ModuleName, - genutiltypes.ModuleName, + ibcExported.ModuleName, + icaTypes.ModuleName, + genUtilTypes.ModuleName, authzTypes.ModuleName, - feegrant.ModuleName, + feeGrantTypes.ModuleName, groupTypes.ModuleName, - paramstypes.ModuleName, - vestingtypes.ModuleName, + paramsTypes.ModuleName, + vestingTypes.ModuleName, + consensusTypes.ModuleName, // this line is used by starport scaffolding # stargate/app/beginBlockers poolTypes.ModuleName, @@ -657,27 +727,28 @@ func NewKYVEApp( ) app.mm.SetOrderEndBlockers( - crisistypes.ModuleName, - govtypes.ModuleName, - stakingtypes.ModuleName, + crisisTypes.ModuleName, + govTypes.ModuleName, + stakingTypes.ModuleName, ibcFeeTypes.ModuleName, ibcTransferTypes.ModuleName, - ibchost.ModuleName, - icatypes.ModuleName, - capabilitytypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - distrtypes.ModuleName, - slashingtypes.ModuleName, - minttypes.ModuleName, - genutiltypes.ModuleName, - evidencetypes.ModuleName, + ibcExported.ModuleName, + icaTypes.ModuleName, + capabilityTypes.ModuleName, + authTypes.ModuleName, + bankTypes.ModuleName, + distributionTypes.ModuleName, + slashingTypes.ModuleName, + mintTypes.ModuleName, + genUtilTypes.ModuleName, + evidenceTypes.ModuleName, authzTypes.ModuleName, - feegrant.ModuleName, + feeGrantTypes.ModuleName, groupTypes.ModuleName, - paramstypes.ModuleName, - upgradetypes.ModuleName, - vestingtypes.ModuleName, + paramsTypes.ModuleName, + upgradeTypes.ModuleName, + vestingTypes.ModuleName, + consensusTypes.ModuleName, // this line is used by starport scaffolding # stargate/app/endBlockers poolTypes.ModuleName, @@ -695,27 +766,28 @@ func NewKYVEApp( // so that other modules that want to create or claim capabilities afterwards in InitChain // can do so safely. app.mm.SetOrderInitGenesis( - capabilitytypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - distrtypes.ModuleName, - stakingtypes.ModuleName, - slashingtypes.ModuleName, - govtypes.ModuleName, - minttypes.ModuleName, - crisistypes.ModuleName, - genutiltypes.ModuleName, + capabilityTypes.ModuleName, + authTypes.ModuleName, + bankTypes.ModuleName, + distributionTypes.ModuleName, + stakingTypes.ModuleName, + slashingTypes.ModuleName, + govTypes.ModuleName, + mintTypes.ModuleName, + crisisTypes.ModuleName, + genUtilTypes.ModuleName, ibcFeeTypes.ModuleName, ibcTransferTypes.ModuleName, - ibchost.ModuleName, - icatypes.ModuleName, - evidencetypes.ModuleName, + ibcExported.ModuleName, + icaTypes.ModuleName, + evidenceTypes.ModuleName, authzTypes.ModuleName, - feegrant.ModuleName, + feeGrantTypes.ModuleName, groupTypes.ModuleName, - paramstypes.ModuleName, - upgradetypes.ModuleName, - vestingtypes.ModuleName, + paramsTypes.ModuleName, + upgradeTypes.ModuleName, + vestingTypes.ModuleName, + consensusTypes.ModuleName, // this line is used by starport scaffolding # stargate/app/initGenesis poolTypes.ModuleName, @@ -730,9 +802,7 @@ func NewKYVEApp( // Uncomment if you want to set a custom migration order here. // app.mm.SetOrderMigrations(custom order) - app.mm.RegisterInvariants(&app.CrisisKeeper) - app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) - + app.mm.RegisterInvariants(app.CrisisKeeper) app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) app.mm.RegisterServices(app.configurator) @@ -749,9 +819,9 @@ func NewKYVEApp( app.BankKeeper, app.FeeGrantKeeper, app.GlobalKeeper, - app.GovKeeper, + *app.GovKeeper, app.IBCKeeper, - app.StakingKeeper, + *app.StakingKeeper, ante.DefaultSigVerificationGasConsumer, encodingConfig.TxConfig.SignModeHandler(), ) @@ -793,7 +863,7 @@ func NewKYVEApp( if loadLatest { if err := app.LoadLatestVersion(); err != nil { - tmos.Exit(err.Error()) + cmtOs.Exit(err.Error()) } } @@ -808,9 +878,6 @@ func NewKYVEApp( // Name returns the name of the App func (app *App) Name() string { return app.BaseApp.Name() } -// GetBaseApp returns the base app of the application -func (app App) GetBaseApp() *baseapp.BaseApp { return app.BaseApp } - // BeginBlocker application updates every begin block func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { return app.mm.BeginBlock(ctx, req) @@ -821,10 +888,14 @@ func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.Respo return app.mm.EndBlock(ctx, req) } +func (app *App) Configurator() module.Configurator { + return app.configurator +} + // InitChainer application update at chain initialization func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { var genesisState GenesisState - if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil { + if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil { panic(err) } app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()) @@ -841,7 +912,7 @@ func (app *App) LoadHeight(height int64) error { // 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 + return app.legacyAmino } // AppCodec returns an app codec. @@ -857,55 +928,70 @@ func (app *App) InterfaceRegistry() types.InterfaceRegistry { return app.interfaceRegistry } +// TxConfig returns a TxConfig +func (app *App) TxConfig() client.TxConfig { + return app.txConfig +} + +// DefaultGenesis returns a default genesis from the registered AppModuleBasic's. +func (app *App) DefaultGenesis() map[string]json.RawMessage { + return ModuleBasics.DefaultGenesis(app.appCodec) +} + // 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 { +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 { +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 { +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 { +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, _ config.APIConfig) { +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) + 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. + node.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + // Register grpc-gateway routes for all modules. ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - // register swagger API - apiSvr.Router.Handle("/swagger.yml", http.FileServer(http.FS(kyveDocs.Swagger))) - apiSvr.Router.HandleFunc("/", kyveDocs.Handler(Name, "/swagger.yml")) + // register swagger API from root so that other applications can override easily + if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { + panic(err) + } } // RegisterTxService implements the Application.RegisterTxService method. func (app *App) RegisterTxService(clientCtx client.Context) { - authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry) + authTx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry) } // RegisterTendermintService implements the Application.RegisterTendermintService method. @@ -918,6 +1004,10 @@ func (app *App) RegisterTendermintService(clientCtx client.Context) { ) } +func (app *App) RegisterNodeService(clientCtx client.Context) { + node.RegisterNodeService(clientCtx, app.GRPCQueryRouter()) +} + // SimulationManager implements the SimulationApp interface. // NOTE: We simply return nil as we don't use the simulation manager anywhere. func (app *App) SimulationManager() *module.SimulationManager { return nil } diff --git a/app/export.go b/app/export.go index da4565e6..43dbad49 100644 --- a/app/export.go +++ b/app/export.go @@ -2,24 +2,25 @@ package app import ( "encoding/json" + "fmt" "log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - - servertypes "github.com/cosmos/cosmos-sdk/server/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" + + // Slashing + slashingTypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + // Staking "github.com/cosmos/cosmos-sdk/x/staking" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + 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, -) (servertypes.ExportedApp, error) { +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()}) + ctx := app.NewContext(true, cmtProto.Header{Height: app.LastBlockHeight()}) // We export at last height + 1, because that's the height at which // Tendermint will start InitChain. @@ -29,22 +30,19 @@ func (app *App) ExportAppStateAndValidators( app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs) } - genState := app.mm.ExportGenesis(ctx, app.appCodec) + genState := app.mm.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) appState, err := json.MarshalIndent(genState, "", " ") if err != nil { - return servertypes.ExportedApp{}, err + return serverTypes.ExportedApp{}, err } validators, err := staking.WriteValidators(ctx, app.StakingKeeper) - if err != nil { - return servertypes.ExportedApp{}, err - } - return servertypes.ExportedApp{ + return serverTypes.ExportedApp{ AppState: appState, Validators: validators, Height: height, ConsensusParams: app.BaseApp.GetConsensusParams(ctx), - }, nil + }, err } // prepare for fresh start at zero height @@ -75,21 +73,22 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str /* Handle fee distribution state. */ // withdraw all validator commission - app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { - _, err := app.DistributionKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) - if err != nil { - panic(err) - } + app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingTypes.ValidatorI) (stop bool) { + _, _ = app.DistributionKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) return false }) // withdraw all delegator rewards dels := app.StakingKeeper.GetAllDelegations(ctx) for _, delegation := range dels { - _, err := app.DistributionKeeper.WithdrawDelegationRewards(ctx, delegation.GetDelegatorAddr(), delegation.GetValidatorAddr()) + valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) if err != nil { panic(err) } + + delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) + + _, _ = app.DistributionKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr) } // clear validator slash events @@ -103,15 +102,14 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str ctx = ctx.WithBlockHeight(0) // reinitialize all validators - app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingTypes.ValidatorI) (stop bool) { // donate any unwithdrawn outstanding reward fraction tokens to the community pool scraps := app.DistributionKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) feePool := app.DistributionKeeper.GetFeePool(ctx) feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) app.DistributionKeeper.SetFeePool(ctx, feePool) - err := app.DistributionKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()) - if err != nil { + if err := app.DistributionKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()); err != nil { panic(err) } return false @@ -119,13 +117,20 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str // reinitialize all delegations for _, del := range dels { - err := app.DistributionKeeper.Hooks().BeforeDelegationCreated(ctx, del.GetDelegatorAddr(), del.GetValidatorAddr()) + valAddr, err := sdk.ValAddressFromBech32(del.ValidatorAddress) if err != nil { panic(err) } - err = app.DistributionKeeper.Hooks().AfterDelegationModified(ctx, del.GetDelegatorAddr(), del.GetValidatorAddr()) - if err != nil { - panic(err) + delAddr := sdk.MustAccAddressFromBech32(del.DelegatorAddress) + + if err := app.DistributionKeeper.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.DistributionKeeper.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)) } } @@ -135,7 +140,7 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str /* Handle staking state. */ // iterate through redelegations, reset creation height - app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { + app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingTypes.Redelegation) (stop bool) { for i := range red.Entries { red.Entries[i].CreationHeight = 0 } @@ -144,7 +149,7 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str }) // iterate through unbonding delegations, reset creation height - app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { + app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingTypes.UnbondingDelegation) (stop bool) { for i := range ubd.Entries { ubd.Entries[i].CreationHeight = 0 } @@ -154,12 +159,12 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str // Iterate through validators by power descending, reset bond heights, and // update bond intra-tx counters. - store := ctx.KVStore(app.keys[stakingtypes.StoreKey]) - iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) + store := ctx.KVStore(app.GetKey(stakingTypes.StoreKey)) + iter := sdk.KVStoreReversePrefixIterator(store, stakingTypes.ValidatorsKey) counter := int16(0) for ; iter.Valid(); iter.Next() { - addr := sdk.ValAddress(iter.Key()[1:]) + addr := sdk.ValAddress(stakingTypes.AddressFromValidatorsKey(iter.Key())) validator, found := app.StakingKeeper.GetValidator(ctx, addr) if !found { panic("expected validator, not found") @@ -174,10 +179,14 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str counter++ } - iter.Close() + if err := iter.Close(); err != nil { + app.Logger().Error("error while closing the key-value store reverse prefix iterator: ", err) + return + } - if _, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx); err != nil { - panic(err) + _, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + if err != nil { + log.Fatal(err) } /* Handle slashing state. */ @@ -185,7 +194,7 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str // reset start height on signing infos app.SlashingKeeper.IterateValidatorSigningInfos( ctx, - func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) { + func(addr sdk.ConsAddress, info slashingTypes.ValidatorSigningInfo) (stop bool) { info.StartHeight = 0 app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info) return false diff --git a/app/keepers.go b/app/keepers.go index 77d766fa..fdee80c6 100644 --- a/app/keepers.go +++ b/app/keepers.go @@ -16,6 +16,8 @@ import ( bundlesKeeper "github.com/KYVENetwork/chain/x/bundles/keeper" // Capability capabilityKeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" + // Consensus + consensusKeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" // Crisis crisisKeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" crisisTypes "github.com/cosmos/cosmos-sdk/x/crisis/types" @@ -33,23 +35,22 @@ import ( // Governance 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" // Group groupKeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" - // IBC - ibcHost "github.com/cosmos/ibc-go/v6/modules/core/24-host" - ibcKeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper" + // IBC Core + ibcExported "github.com/cosmos/ibc-go/v7/modules/core/exported" + ibcKeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" // IBC Fee - ibcFeeKeeper "github.com/cosmos/ibc-go/v6/modules/apps/29-fee/keeper" + ibcFeeKeeper "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/keeper" // IBC Transfer - ibcTransferKeeper "github.com/cosmos/ibc-go/v6/modules/apps/transfer/keeper" - ibcTransferTypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" + ibcTransferKeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" + ibcTransferTypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" // ICA Controller - icaControllerKeeper "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/controller/keeper" - icaControllerTypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/controller/types" + 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" // ICA Host - icaHostKeeper "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/keeper" - icaHostTypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/types" + 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" // Mint mintKeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" mintTypes "github.com/cosmos/cosmos-sdk/x/mint/types" @@ -79,17 +80,18 @@ type Keepers struct { AuthzKeeper authzKeeper.Keeper BankKeeper bankKeeper.Keeper CapabilityKeeper *capabilityKeeper.Keeper - CrisisKeeper crisisKeeper.Keeper + ConsensusKeeper consensusKeeper.Keeper + CrisisKeeper *crisisKeeper.Keeper DistributionKeeper distributionKeeper.Keeper - EvidenceKeeper evidenceKeeper.Keeper + EvidenceKeeper *evidenceKeeper.Keeper FeeGrantKeeper feeGrantKeeper.Keeper - GovKeeper govKeeper.Keeper + GovKeeper *govKeeper.Keeper GroupKeeper groupKeeper.Keeper MintKeeper mintKeeper.Keeper ParamsKeeper paramsKeeper.Keeper SlashingKeeper slashingKeeper.Keeper - StakingKeeper stakingKeeper.Keeper - UpgradeKeeper upgradeKeeper.Keeper + StakingKeeper *stakingKeeper.Keeper + UpgradeKeeper *upgradeKeeper.Keeper // IBC IBCKeeper *ibcKeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly @@ -125,10 +127,10 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino keeper.Subspace(mintTypes.ModuleName) keeper.Subspace(distributionTypes.ModuleName) keeper.Subspace(slashingTypes.ModuleName) - keeper.Subspace(govTypes.ModuleName).WithKeyTable(govV1.ParamKeyTable()) + keeper.Subspace(govTypes.ModuleName) keeper.Subspace(crisisTypes.ModuleName) keeper.Subspace(ibcTransferTypes.ModuleName) - keeper.Subspace(ibcHost.ModuleName) + keeper.Subspace(ibcExported.ModuleName) keeper.Subspace(icaControllerTypes.SubModuleName) keeper.Subspace(icaHostTypes.SubModuleName) diff --git a/app/modules.go b/app/modules.go index f2bfc976..a2a0d49d 100644 --- a/app/modules.go +++ b/app/modules.go @@ -1,7 +1,6 @@ package app import ( - teamTypes "github.com/KYVENetwork/chain/x/team/types" "github.com/cosmos/cosmos-sdk/types/module" // Auth @@ -17,6 +16,8 @@ import ( bundlesTypes "github.com/KYVENetwork/chain/x/bundles/types" // Capability "github.com/cosmos/cosmos-sdk/x/capability" + // Consensus + "github.com/cosmos/cosmos-sdk/x/consensus" // Crisis "github.com/cosmos/cosmos-sdk/x/crisis" // Delegation @@ -35,25 +36,28 @@ import ( "github.com/KYVENetwork/chain/x/global" // Governance "github.com/cosmos/cosmos-sdk/x/gov" + govClient "github.com/cosmos/cosmos-sdk/x/gov/client" govTypes "github.com/cosmos/cosmos-sdk/x/gov/types" // Group group "github.com/cosmos/cosmos-sdk/x/group/module" - // IBC - ibc "github.com/cosmos/ibc-go/v6/modules/core" + // IBC Core + ibc "github.com/cosmos/ibc-go/v7/modules/core" + ibcClient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" // IBC Fee - ibcFee "github.com/cosmos/ibc-go/v6/modules/apps/29-fee" - ibcFeeTypes "github.com/cosmos/ibc-go/v6/modules/apps/29-fee/types" + ibcFee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee" + ibcFeeTypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" // IBC Transfer - ibcTransfer "github.com/cosmos/ibc-go/v6/modules/apps/transfer" - ibcTransferTypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" + ibcTransfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer" + ibcTransferTypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" // ICA - ica "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts" - icaTypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/types" + ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" + icaTypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" // Mint "github.com/cosmos/cosmos-sdk/x/mint" mintTypes "github.com/cosmos/cosmos-sdk/x/mint/types" // Parameters "github.com/cosmos/cosmos-sdk/x/params" + paramsClient "github.com/cosmos/cosmos-sdk/x/params/client" // Pool "github.com/KYVENetwork/chain/x/pool" poolTypes "github.com/KYVENetwork/chain/x/pool/types" @@ -69,8 +73,10 @@ import ( stakingTypes "github.com/cosmos/cosmos-sdk/x/staking/types" // Team "github.com/KYVENetwork/chain/x/team" + teamTypes "github.com/KYVENetwork/chain/x/team/types" // Upgrade "github.com/cosmos/cosmos-sdk/x/upgrade" + upgradeClient "github.com/cosmos/cosmos-sdk/x/upgrade/client" ) // appModuleBasics returns ModuleBasics for the module BasicManager. @@ -80,12 +86,19 @@ var appModuleBasics = []module.AppModuleBasic{ authz.AppModuleBasic{}, bank.AppModuleBasic{}, capability.AppModuleBasic{}, + consensus.AppModuleBasic{}, crisis.AppModuleBasic{}, distribution.AppModuleBasic{}, evidence.AppModuleBasic{}, feeGrant.AppModuleBasic{}, genutil.AppModuleBasic{}, - gov.NewAppModuleBasic(getGovProposalHandlers()), + gov.NewAppModuleBasic([]govClient.ProposalHandler{ + paramsClient.ProposalHandler, + upgradeClient.LegacyProposalHandler, + upgradeClient.LegacyCancelProposalHandler, + ibcClient.UpdateClientProposalHandler, + ibcClient.UpgradeProposalHandler, + }), group.AppModuleBasic{}, mint.AppModuleBasic{}, params.AppModuleBasic{}, @@ -144,7 +157,7 @@ func (app *App) BlockedModuleAccountAddrs() map[string]bool { // 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 { + for acc := range moduleAccountPermissions { modAccAddrs[authTypes.NewModuleAddress(acc).String()] = true } diff --git a/app/test_helpers.go b/app/test_helpers.go index e5e9a097..b5197829 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -4,81 +4,88 @@ import ( "encoding/json" "time" - globalTypes "github.com/KYVENetwork/chain/x/global/types" - - teamTypes "github.com/KYVENetwork/chain/x/team/types" - "cosmossdk.io/math" + dbm "github.com/cometbft/cometbft-db" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/libs/log" + cmtProto "github.com/cometbft/cometbft/proto/tendermint/types" + cmtTypes "github.com/cometbft/cometbft/types" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + codecTypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptoCodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/testutil/mock" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - dbm "github.com/tendermint/tm-db" - - tmtypes "github.com/tendermint/tendermint/types" + + // Auth + authTypes "github.com/cosmos/cosmos-sdk/x/auth/types" + // Bank + bankTypes "github.com/cosmos/cosmos-sdk/x/bank/types" + // Global + globalTypes "github.com/KYVENetwork/chain/x/global/types" + // Staking + stakingTypes "github.com/cosmos/cosmos-sdk/x/staking/types" + // Team + teamTypes "github.com/KYVENetwork/chain/x/team/types" ) // DefaultConsensusParams ... -var DefaultConsensusParams = &abci.ConsensusParams{ - Block: &abci.BlockParams{ +var DefaultConsensusParams = &cmtProto.ConsensusParams{ + Block: &cmtProto.BlockParams{ MaxBytes: 200000, MaxGas: -1, // no limit }, - Evidence: &tmproto.EvidenceParams{ + Evidence: &cmtProto.EvidenceParams{ MaxAgeNumBlocks: 302400, MaxAgeDuration: 504 * time.Hour, // 3 weeks is the max duration MaxBytes: 10000, }, - Validator: &tmproto.ValidatorParams{ + Validator: &cmtProto.ValidatorParams{ PubKeyTypes: []string{ - tmtypes.ABCIPubKeyTypeEd25519, + cmtTypes.ABCIPubKeyTypeEd25519, }, }, } +type EmptyAppOptions struct{} + +func (ao EmptyAppOptions) Get(_ string) interface{} { return nil } + func DefaultGenesisWithValSet(codec codec.Codec) map[string]json.RawMessage { bondingDenom := globalTypes.Denom // Generate a new validator. key, _ := mock.NewPV().GetPubKey() - validator := tmtypes.NewValidator(key, 1) + validator := cmtTypes.NewValidator(key, 1) - publicKey, _ := cryptocodec.FromTmPubKeyInterface(validator.PubKey) - publicKeyAny, _ := codectypes.NewAnyWithValue(publicKey) + publicKey, _ := cryptoCodec.FromTmPubKeyInterface(validator.PubKey) + publicKeyAny, _ := codecTypes.NewAnyWithValue(publicKey) - validators := []stakingtypes.Validator{ + validators := []stakingTypes.Validator{ { OperatorAddress: sdk.ValAddress(validator.Address).String(), ConsensusPubkey: publicKeyAny, Jailed: false, - Status: stakingtypes.Bonded, + Status: stakingTypes.Bonded, Tokens: sdk.DefaultPowerReduction, DelegatorShares: sdk.OneDec(), - Description: stakingtypes.Description{}, + Description: stakingTypes.Description{}, UnbondingHeight: 0, UnbondingTime: time.Unix(0, 0).UTC(), - Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + Commission: stakingTypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), MinSelfDelegation: math.ZeroInt(), }, } // Generate a new delegator. delegatorKey := secp256k1.GenPrivKey() - delegator := authtypes.NewBaseAccount( + delegator := authTypes.NewBaseAccount( delegatorKey.PubKey().Address().Bytes(), delegatorKey.PubKey(), 0, 0, ) - delegations := []stakingtypes.Delegation{ - stakingtypes.NewDelegation(delegator.GetAddress(), validator.Address.Bytes(), sdk.OneDec()), + delegations := []stakingTypes.Delegation{ + stakingTypes.NewDelegation(delegator.GetAddress(), validator.Address.Bytes(), sdk.OneDec()), } // Default genesis state. @@ -86,32 +93,32 @@ func DefaultGenesisWithValSet(codec codec.Codec) map[string]json.RawMessage { genesisState := ModuleBasics.DefaultGenesis(config.Marshaler) // Update x/auth state. - authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), []authtypes.GenesisAccount{delegator}) - genesisState[authtypes.ModuleName] = codec.MustMarshalJSON(authGenesis) + authGenesis := authTypes.NewGenesisState(authTypes.DefaultParams(), []authTypes.GenesisAccount{delegator}) + genesisState[authTypes.ModuleName] = codec.MustMarshalJSON(authGenesis) // Update x/bank state. bondedCoins := sdk.NewCoins(sdk.NewCoin(bondingDenom, sdk.DefaultPowerReduction)) teamCoins := sdk.NewCoins(sdk.NewInt64Coin(globalTypes.Denom, int64(teamTypes.TEAM_ALLOCATION))) - bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, []banktypes.Balance{ + bankGenesis := bankTypes.NewGenesisState(bankTypes.DefaultGenesisState().Params, []bankTypes.Balance{ { - Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), + Address: authTypes.NewModuleAddress(stakingTypes.BondedPoolName).String(), Coins: bondedCoins, }, { - Address: authtypes.NewModuleAddress(teamTypes.ModuleName).String(), + Address: authTypes.NewModuleAddress(teamTypes.ModuleName).String(), Coins: teamCoins, }, - }, bondedCoins.Add(sdk.NewInt64Coin(globalTypes.Denom, int64(teamTypes.TEAM_ALLOCATION))), []banktypes.Metadata{}) - genesisState[banktypes.ModuleName] = codec.MustMarshalJSON(bankGenesis) + }, bondedCoins.Add(sdk.NewInt64Coin(globalTypes.Denom, int64(teamTypes.TEAM_ALLOCATION))), []bankTypes.Metadata{}, []bankTypes.SendEnabled{}) + genesisState[bankTypes.ModuleName] = codec.MustMarshalJSON(bankGenesis) // Update x/staking state. - stakingParams := stakingtypes.DefaultParams() + stakingParams := stakingTypes.DefaultParams() stakingParams.BondDenom = bondingDenom - stakingGenesis := stakingtypes.NewGenesisState(stakingParams, validators, delegations) - genesisState[stakingtypes.ModuleName] = codec.MustMarshalJSON(stakingGenesis) + stakingGenesis := stakingTypes.NewGenesisState(stakingParams, validators, delegations) + genesisState[stakingTypes.ModuleName] = codec.MustMarshalJSON(stakingGenesis) // Return. return genesisState @@ -121,11 +128,12 @@ func DefaultGenesisWithValSet(codec codec.Codec) map[string]json.RawMessage { func Setup() *App { db := dbm.NewMemDB() - config := MakeEncodingConfig() + // config := MakeEncodingConfig() setPrefixes("kyve") - app := NewKYVEApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 5, config, simapp.EmptyAppOptions{}) + // app := NewKYVEApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 5, config, EmptyAppOptions{}) + app := NewKYVEApp(log.NewNopLogger(), db, nil, true, EmptyAppOptions{}, baseapp.SetChainID("kyve-test")) // init chain must be called to stop deliverState from being nil genesisState := DefaultGenesisWithValSet(app.AppCodec()) diff --git a/cmd/kyved/app_creator.go b/cmd/kyved/app_creator.go index e8820c0c..06cd887d 100644 --- a/cmd/kyved/app_creator.go +++ b/cmd/kyved/app_creator.go @@ -3,20 +3,14 @@ package main import ( "errors" "io" - "path/filepath" kyveApp "github.com/KYVENetwork/chain/app" - "github.com/cosmos/cosmos-sdk/baseapp" + dbm "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" serverTypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/snapshots" - snapshotsTypes "github.com/cosmos/cosmos-sdk/snapshots/types" - "github.com/cosmos/cosmos-sdk/store" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/spf13/cast" - "github.com/tendermint/tendermint/libs/log" - dbm "github.com/tendermint/tm-db" + "github.com/spf13/viper" ) // appCreator is a wrapper for EncodingConfig. @@ -29,55 +23,10 @@ func (ac appCreator) createApp( 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) - } - - 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 := snapshotsTypes.NewSnapshotOptions( - cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval)), - cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)), - ) - return kyveApp.NewKYVEApp( - logger, db, traceStore, true, skipUpgradeHeights, - cast.ToString(appOpts.Get(flags.FlagHome)), - cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)), - ac.encodingConfig, + logger, db, traceStore, true, appOpts, - baseapp.SetPruning(pruningOpts), - baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))), - baseapp.SetMinRetainBlocks(cast.ToUint64(appOpts.Get(server.FlagMinRetainBlocks))), - 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))), + server.DefaultBaseappOptions(appOpts)..., ) } @@ -87,31 +36,37 @@ func (ac appCreator) exportApp( traceStore io.Writer, height int64, forZeroHeight bool, - jailWhiteList []string, + jailAllowedAddrs []string, appOpts serverTypes.AppOptions, + modulesToExport []string, ) (serverTypes.ExportedApp, error) { + var app *kyveApp.App + + // 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") } - app := kyveApp.NewKYVEApp( - logger, - db, - traceStore, - height == -1, // -1 means no height is provided - map[int64]bool{}, - homePath, - uint(1), - ac.encodingConfig, - appOpts, - ) + 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 { + app = kyveApp.NewKYVEApp(logger, db, traceStore, false, appOpts) + if err := app.LoadHeight(height); err != nil { return serverTypes.ExportedApp{}, err } + } else { + app = kyveApp.NewKYVEApp(logger, db, traceStore, true, appOpts) } - return app.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) + return app.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) } diff --git a/cmd/kyved/config.go b/cmd/kyved/config.go index 35df4c1d..032dded0 100644 --- a/cmd/kyved/config.go +++ b/cmd/kyved/config.go @@ -4,9 +4,9 @@ import ( "fmt" globalTypes "github.com/KYVENetwork/chain/x/global/types" + tmCfg "github.com/cometbft/cometbft/config" serverCfg "github.com/cosmos/cosmos-sdk/server/config" sdk "github.com/cosmos/cosmos-sdk/types" - tmCfg "github.com/tendermint/tendermint/config" ) func initAppConfig() (string, *serverCfg.Config) { diff --git a/cmd/kyved/root.go b/cmd/kyved/root.go index 2b1c84f8..57d3c0d5 100644 --- a/cmd/kyved/root.go +++ b/cmd/kyved/root.go @@ -7,8 +7,7 @@ import ( "time" kyveApp "github.com/KYVENetwork/chain/app" - globalTypes "github.com/KYVENetwork/chain/x/global/types" - teamTypes "github.com/KYVENetwork/chain/x/team/types" + tmCli "github.com/cometbft/cometbft/libs/cli" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/client/debug" @@ -19,7 +18,6 @@ import ( "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/version" "github.com/spf13/cobra" - tmCli "github.com/tendermint/tendermint/libs/cli" // Auth authCli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" @@ -30,6 +28,11 @@ import ( "github.com/cosmos/cosmos-sdk/x/crisis" // GenUtil genUtilCli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" + genUtilTypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + // Global + globalTypes "github.com/KYVENetwork/chain/x/global/types" + // Team + teamTypes "github.com/KYVENetwork/chain/x/team/types" ) // NewRootCmd creates a new root command for the KYVE chain daemon. @@ -41,7 +44,6 @@ func NewRootCmd(encodingConfig kyveApp.EncodingConfig) *cobra.Command { WithLegacyAmino(encodingConfig.Amino). WithInput(os.Stdin). WithAccountRetriever(authTypes.AccountRetriever{}). - WithBroadcastMode(flags.BroadcastBlock). WithHomeDir(kyveApp.DefaultNodeHome). WithViper("KYVE") @@ -86,7 +88,8 @@ func NewRootCmd(encodingConfig kyveApp.EncodingConfig) *cobra.Command { rootCmd.AddCommand( genUtilCli.InitCmd(kyveApp.ModuleBasics, kyveApp.DefaultNodeHome), - genUtilCli.CollectGenTxsCmd(bankTypes.GenesisBalancesIterator{}, kyveApp.DefaultNodeHome), + // TODO(@john): Investigate why the one directly from the module is nil. + genUtilCli.CollectGenTxsCmd(bankTypes.GenesisBalancesIterator{}, kyveApp.DefaultNodeHome, genUtilTypes.DefaultMessageValidator), genUtilCli.MigrateGenesisCmd(), genUtilCli.GenTxCmd( kyveApp.ModuleBasics, diff --git a/docs/swagger.yml b/docs/swagger.yml index 97a9c6e4..40a5d7f3 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -4679,63 +4679,65 @@ paths: description: gov_params ... type: object properties: - voting_params: - description: voting_params defines the parameters related to voting. - type: object - properties: - voting_period: - type: string - description: Length 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. + 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 + 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 - 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. + 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 stakers_params: description: stakers_params ... type: object diff --git a/go.mod b/go.mod index a20a2ec5..a3b143e7 100644 --- a/go.mod +++ b/go.mod @@ -4,37 +4,41 @@ go 1.20 require ( cosmossdk.io/errors v1.0.0-beta.7 - cosmossdk.io/math v1.0.0-beta.3 - github.com/cosmos/cosmos-proto v1.0.0-alpha8 - github.com/cosmos/cosmos-sdk v0.46.12 - github.com/cosmos/gogoproto v1.4.2 - github.com/cosmos/ibc-go/v6 v6.1.0 + cosmossdk.io/math v1.0.0 + github.com/cometbft/cometbft v0.37.0 + github.com/cometbft/cometbft-db v0.7.0 + github.com/cosmos/cosmos-proto v1.0.0-beta.2 + github.com/cosmos/cosmos-sdk v0.47.1 + github.com/cosmos/gogoproto v1.4.6 + github.com/cosmos/ibc-go/v7 v7.0.0 github.com/ethereum/go-ethereum v1.10.22 - github.com/gogo/protobuf v1.3.3 - github.com/golang/protobuf v1.5.2 + github.com/golang/protobuf v1.5.3 github.com/golangci/golangci-lint v1.52.2 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/onsi/ginkgo/v2 v2.8.0 github.com/onsi/gomega v1.26.0 github.com/spf13/cast v1.5.0 github.com/spf13/cobra v1.6.1 + github.com/spf13/viper v1.15.0 github.com/stretchr/testify v1.8.2 - github.com/tendermint/tendermint v0.34.27 - github.com/tendermint/tm-db v0.6.7 - google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 - google.golang.org/grpc v1.52.0 + google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44 + google.golang.org/grpc v1.53.0 mvdan.cc/gofumpt v0.5.0 ) require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect - cloud.google.com/go v0.105.0 // indirect - cloud.google.com/go/compute v1.12.1 // indirect - cloud.google.com/go/compute/metadata v0.2.1 // indirect - cloud.google.com/go/iam v0.7.0 // indirect - cloud.google.com/go/storage v1.27.0 // indirect - filippo.io/edwards25519 v1.0.0-rc.1 // indirect + cloud.google.com/go v0.110.0 // indirect + cloud.google.com/go/compute v1.18.0 // indirect + cloud.google.com/go/compute/metadata v0.2.3 // indirect + cloud.google.com/go/iam v0.12.0 // indirect + cloud.google.com/go/storage v1.29.0 // indirect + cosmossdk.io/api v0.3.1 // indirect + cosmossdk.io/core v0.5.1 // indirect + cosmossdk.io/depinject v1.0.0-alpha.3 // 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/Abirdcfly/dupword v0.0.11 // indirect @@ -46,13 +50,12 @@ require ( github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect github.com/Masterminds/semver v1.5.0 // indirect github.com/OpenPeeDeeP/depguard v1.1.1 // indirect - github.com/Workiva/go-datastructures v1.0.53 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect github.com/armon/go-metrics v0.4.1 // indirect github.com/ashanbrown/forbidigo v1.5.1 // indirect github.com/ashanbrown/makezero v1.1.1 // indirect - github.com/aws/aws-sdk-go v1.40.45 // indirect + github.com/aws/aws-sdk-go v1.44.203 // 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 @@ -65,46 +68,47 @@ require ( github.com/butuzov/ireturn v0.1.1 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/charithe/durationcheck v0.0.10 // indirect github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 // indirect - github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect + github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect - github.com/cometbft/cometbft-db v0.7.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect - github.com/cosmos/gorocksdb v1.2.0 // indirect - github.com/cosmos/iavl v0.19.5 // 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.2 // indirect - github.com/creachadair/taskgroup v0.3.2 // indirect + github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect + github.com/creachadair/taskgroup v0.4.2 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect github.com/daixiang0/gci v0.10.1 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect - github.com/dgraph-io/ristretto v0.1.0 // indirect + github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac // indirect + github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/esimonov/ifshort v1.0.4 // indirect github.com/ettle/strcase v0.1.1 // indirect github.com/fatih/color v1.15.0 // indirect github.com/fatih/structtag v1.2.0 // indirect - github.com/felixge/httpsnoop v1.0.1 // indirect + github.com/felixge/httpsnoop v1.0.2 // indirect github.com/firefart/nonamedreturns v1.0.4 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect github.com/go-critic/go-critic v0.7.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect - github.com/go-logfmt/logfmt v0.5.1 // indirect + github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-logr/logr v1.2.3 // indirect - github.com/go-playground/validator/v10 v10.4.1 // indirect + github.com/go-playground/universal-translator v0.18.0 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect github.com/go-toolsmith/astequal v1.1.0 // indirect @@ -116,9 +120,11 @@ require ( github.com/gobwas/glob v0.2.3 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gofrs/flock v0.8.1 // indirect - github.com/gogo/gateway v1.1.0 // indirect - github.com/golang/glog v1.0.0 // indirect + github.com/gogo/googleapis v1.4.1 // indirect + github.com/gogo/protobuf v1.3.3 // indirect + github.com/golang/glog v1.1.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/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect @@ -131,11 +137,10 @@ require ( github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/google/btree v1.1.2 // indirect github.com/google/go-cmp v0.5.9 // indirect - github.com/google/gofuzz v1.2.0 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/google/uuid v1.3.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect - github.com/googleapis/gax-go/v2 v2.6.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect + github.com/googleapis/gax-go/v2 v2.7.0 // indirect github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/mux v1.8.0 // indirect @@ -150,38 +155,41 @@ require ( 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.6.1 // indirect + github.com/hashicorp/go-getter v1.7.0 // 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/hcl v1.0.0 // indirect - github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 // indirect + github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect + github.com/huandu/skiplist v1.2.0 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect - github.com/inconshreveable/mousetrap v1.0.1 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jgautheron/goconst v1.5.1 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect github.com/julz/importas v0.1.0 // indirect github.com/junk1tm/musttag v0.5.0 // indirect github.com/kisielk/errcheck v1.6.3 // indirect github.com/kisielk/gotool v1.0.0 // indirect github.com/kkHAIKE/contextcheck v1.1.4 // indirect - github.com/klauspost/compress v1.15.11 // indirect + github.com/klauspost/compress v1.16.3 // indirect github.com/kulti/thelper v0.6.3 // indirect github.com/kunwardeep/paralleltest v1.0.6 // indirect github.com/kyoh86/exportloopref v0.1.11 // indirect github.com/ldez/gomoddirectives v0.2.3 // indirect github.com/ldez/tagliatelle v0.4.0 // indirect + github.com/leodido/go-urn v1.2.1 // indirect github.com/leonklingele/grouper v1.1.1 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/lufeee/execinquery v1.2.1 // indirect - github.com/magiconair/properties v1.8.6 // indirect + github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/maratori/testableexamples v1.0.0 // indirect github.com/maratori/testpackage v1.1.1 // indirect @@ -189,14 +197,16 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-runewidth v0.0.10 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect github.com/mgechev/revive v1.3.1 // indirect github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect github.com/minio/highwayhash v1.0.2 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect - github.com/mitchellh/go-testing-interface v1.0.0 // indirect + github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect github.com/moricho/tparallel v0.3.1 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/nakabonne/nestif v0.3.1 // indirect @@ -206,26 +216,23 @@ require ( github.com/nunnatsa/ginkgolinter v0.9.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/otiai10/copy v1.6.0 // indirect - github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pelletier/go-toml/v2 v2.0.5 // indirect - github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect + github.com/pelletier/go-toml/v2 v2.0.6 // indirect + github.com/petermattis/goid v0.0.0-20221215004737-a150e88a970d // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polyfloyd/go-errorlint v1.4.0 // indirect github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.37.0 // indirect - github.com/prometheus/procfs v0.8.0 // indirect + github.com/prometheus/common v0.40.0 // indirect + github.com/prometheus/procfs v0.9.0 // indirect github.com/quasilyte/go-ruleguard v0.3.19 // indirect github.com/quasilyte/gogrep v0.5.0 // indirect github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect github.com/rakyll/statik v0.1.7 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - github.com/regen-network/cosmos-proto v0.3.1 // indirect github.com/rivo/uniseg v0.2.0 // indirect - github.com/rs/cors v1.8.2 // indirect - github.com/rs/zerolog v1.27.0 // indirect + github.com/rs/cors v1.8.3 // indirect github.com/ryancurrah/gomodguard v1.3.0 // indirect github.com/ryanrolds/sqlclosecheck v0.4.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect @@ -240,26 +247,25 @@ require ( github.com/sivchari/tenv v1.7.1 // indirect github.com/sonatard/noctx v0.0.2 // indirect github.com/sourcegraph/go-diff v0.7.0 // indirect - github.com/spf13/afero v1.9.2 // indirect + github.com/spf13/afero v1.9.3 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.14.0 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect github.com/stretchr/objx v0.5.0 // indirect - github.com/subosito/gotenv v1.4.1 // indirect - github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect + github.com/subosito/gotenv v1.4.2 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tetafro/godot v1.4.11 // indirect - github.com/tidwall/btree v1.5.0 // indirect + github.com/tidwall/btree v1.6.0 // indirect github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e // indirect github.com/timonwong/loggercheck v0.9.4 // indirect github.com/tomarrell/wrapcheck/v2 v2.8.1 // indirect github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect - github.com/ulikunitz/xz v0.5.8 // indirect + github.com/ulikunitz/xz v0.5.11 // indirect github.com/ultraware/funlen v0.0.3 // indirect github.com/ultraware/whitespace v0.0.5 // indirect github.com/uudashr/gocognit v1.0.6 // indirect @@ -268,27 +274,27 @@ require ( github.com/zondax/hid v0.9.1 // indirect github.com/zondax/ledger-go v0.14.1 // indirect gitlab.com/bosi/decorder v0.2.3 // indirect - go.etcd.io/bbolt v1.3.6 // indirect - go.opencensus.io v0.23.0 // indirect + go.etcd.io/bbolt v1.3.7 // indirect + go.opencensus.io v0.24.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/goleak v1.1.12 // indirect go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.5.0 // indirect - golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect + golang.org/x/crypto v0.7.0 // indirect + golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect golang.org/x/mod v0.10.0 // indirect golang.org/x/net v0.9.0 // indirect - golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect + golang.org/x/oauth2 v0.5.0 // indirect golang.org/x/sync v0.1.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/term v0.7.0 // indirect golang.org/x/text v0.9.0 // indirect golang.org/x/tools v0.8.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/api v0.102.0 // indirect + google.golang.org/api v0.110.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8 // indirect + google.golang.org/protobuf v1.29.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 @@ -297,17 +303,15 @@ require ( mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d // indirect nhooyr.io/websocket v1.8.6 // indirect + pgregory.net/rapid v0.5.5 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) replace ( // use kyve flavored cosmos/cosmos-sdk - github.com/cosmos/cosmos-sdk => github.com/KYVENetwork/cosmos-sdk v0.46.12-kyve + github.com/cosmos/cosmos-sdk => github.com/KYVENetwork/cosmos-sdk v0.47.1-kyve-rc0 // use cosmos flavored gogo/protobuf // https://github.com/cosmos/cosmos-sdk/issues/8469 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - - // use cometbft - github.com/tendermint/tendermint => github.com/cometbft/cometbft v0.34.27 ) diff --git a/go.sum b/go.sum index 1e6a6a89..bb94b1e9 100644 --- a/go.sum +++ b/go.sum @@ -23,44 +23,195 @@ cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHOb 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.105.0 h1:DNtEKRBAAzeS4KyIory52wWHuClNaXJ5x1F7xa4q+5Y= -cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFOKM= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= +cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= +cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= +cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= +cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= +cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= +cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= +cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= +cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= +cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= +cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= +cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= +cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= +cloud.google.com/go v0.110.0 h1:Zc8gqp3+a9/Eyph2KDmcGaPtbKRIoqq4YTlL4NMD0Ys= +cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= +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/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= -cloud.google.com/go/compute v1.12.1 h1:gKVJMEyqV5c/UnpzjjQbo3Rjvvqpr9B1DFSbJC4OXr0= -cloud.google.com/go/compute v1.12.1/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU= -cloud.google.com/go/compute/metadata v0.2.1 h1:efOwf5ymceDhK6PKMnnrTHP4pppY5L22mle96M1yP48= -cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= +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.18.0 h1:FEigFqoDbys2cvFkZ9Fjq4gnHBP55anJ0yQyau2f9oY= +cloud.google.com/go/compute v1.18.0/go.mod h1:1X7yHxec2Ga+Ss6jPyjxRxpu2uu7PLgsOVXvgU0yacs= +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/iam v0.7.0 h1:k4MuwOsS7zGJJ+QfZ5vBK8SgHBAvYN/23BWsiihJ1vs= -cloud.google.com/go/iam v0.7.0/go.mod h1:H5Br8wRaDGNc8XP3keLc4unfUUZeyH3Sfl9XpQEYOeg= +cloud.google.com/go/datastream v1.2.0/go.mod h1:i/uTP8/fZwgATHS/XFu0TcNUhuA0twZxxQ3EyCUQMwo= +cloud.google.com/go/datastream v1.3.0/go.mod h1:cqlOX8xlyYF/uxhiKn6Hbv6WjwPPuI9W2M9SAXwaLLQ= +cloud.google.com/go/dialogflow v1.15.0/go.mod h1:HbHDWs33WOGJgn6rfzBW1Kv807BE3O1+xGbn59zZWI4= +cloud.google.com/go/dialogflow v1.16.1/go.mod h1:po6LlzGfK+smoSmTBnbkIZY2w8ffjz/RcGSS+sh1el0= +cloud.google.com/go/dialogflow v1.17.0/go.mod h1:YNP09C/kXA1aZdBgC/VtXX74G/TKn7XVCcVumTflA+8= +cloud.google.com/go/documentai v1.7.0/go.mod h1:lJvftZB5NRiFSX4moiye1SMxHx0Bc3x1+p9e/RfXYiU= +cloud.google.com/go/documentai v1.8.0/go.mod h1:xGHNEB7CtsnySCNrCFdCyyMz44RhFEEX2Q7UD0c5IhU= +cloud.google.com/go/domains v0.6.0/go.mod h1:T9Rz3GasrpYk6mEGHh4rymIhjlnIuB4ofT1wTxDeT4Y= +cloud.google.com/go/domains v0.7.0/go.mod h1:PtZeqS1xjnXuRPKE/88Iru/LdfoRyEHYA9nFQf4UKpg= +cloud.google.com/go/edgecontainer v0.1.0/go.mod h1:WgkZ9tp10bFxqO8BLPqv2LlfmQF1X8lZqwW4r1BTajk= +cloud.google.com/go/edgecontainer v0.2.0/go.mod h1:RTmLijy+lGpQ7BXuTDa4C4ssxyXT34NIuHIgKuP4s5w= +cloud.google.com/go/functions v1.6.0/go.mod h1:3H1UA3qiIPRWD7PeZKLvHZ9SaQhR26XIJcC0A5GbvAk= +cloud.google.com/go/functions v1.7.0/go.mod h1:+d+QBcWM+RsrgZfV9xo6KfA1GlzJfxcfZcRPEhDDfzg= +cloud.google.com/go/gaming v1.5.0/go.mod h1:ol7rGcxP/qHTRQE/RO4bxkXq+Fix0j6D4LFPzYTIrDM= +cloud.google.com/go/gaming v1.6.0/go.mod h1:YMU1GEvA39Qt3zWGyAVA9bpYz/yAhTvaQ1t2sK4KPUA= +cloud.google.com/go/gkeconnect v0.5.0/go.mod h1:c5lsNAg5EwAy7fkqX/+goqFsU1Da/jQFqArp+wGNr/o= +cloud.google.com/go/gkeconnect v0.6.0/go.mod h1:Mln67KyU/sHJEBY8kFZ0xTeyPtzbq9StAVvEULYK16A= +cloud.google.com/go/gkehub v0.9.0/go.mod h1:WYHN6WG8w9bXU0hqNxt8rm5uxnk8IH+lPY9J2TV7BK0= +cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y977wO+hBH0= +cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= +cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= +cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= +cloud.google.com/go/iam v0.12.0 h1:DRtTY29b75ciH6Ov1PHb4/iat2CLCvrOm40Q0a6DFpE= +cloud.google.com/go/iam v0.12.0/go.mod h1:knyHGviacl11zrtZUoDuYpDgLjvr28sLQaG0YB2GYAY= +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/longrunning v0.3.0 h1:NjljC+FYPV3uh5/OwWT6pVU+doBqMg2x/rZlE+CamDs= +cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= +cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= +cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= +cloud.google.com/go/memcache v1.5.0/go.mod h1:dk3fCK7dVo0cUU2c36jKb4VqKPS22BTkf81Xq617aWM= +cloud.google.com/go/metastore v1.5.0/go.mod h1:2ZNrDcQwghfdtCwJ33nM0+GrBGlVuh8rakL3vdPY3XY= +cloud.google.com/go/metastore v1.6.0/go.mod h1:6cyQTls8CWXzk45G55x57DVQ9gWg7RiH65+YgPsNh9s= +cloud.google.com/go/networkconnectivity v1.4.0/go.mod h1:nOl7YL8odKyAOtzNX73/M5/mGZgqqMeryi6UPZTk/rA= +cloud.google.com/go/networkconnectivity v1.5.0/go.mod h1:3GzqJx7uhtlM3kln0+x5wyFvuVH1pIBJjhCpjzSt75o= +cloud.google.com/go/networksecurity v0.5.0/go.mod h1:xS6fOCoqpVC5zx15Z/MqkfDwH4+m/61A3ODiDV1xmiQ= +cloud.google.com/go/networksecurity v0.6.0/go.mod h1:Q5fjhTr9WMI5mbpRYEbiexTzROf7ZbDzvzCrNl14nyU= +cloud.google.com/go/notebooks v1.2.0/go.mod h1:9+wtppMfVPUeJ8fIWPOq1UnATHISkGXGqTkxeieQ6UY= +cloud.google.com/go/notebooks v1.3.0/go.mod h1:bFR5lj07DtCPC7YAAJ//vHskFBxA5JzYlH68kXVdk34= +cloud.google.com/go/osconfig v1.7.0/go.mod h1:oVHeCeZELfJP7XLxcBGTMBvRO+1nQ5tFG9VQTmYS2Fs= +cloud.google.com/go/osconfig v1.8.0/go.mod h1:EQqZLu5w5XA7eKizepumcvWx+m8mJUhEwiPqWiZeEdg= +cloud.google.com/go/oslogin v1.4.0/go.mod h1:YdgMXWRaElXz/lDk1Na6Fh5orF7gvmJ0FGLIs9LId4E= +cloud.google.com/go/oslogin v1.5.0/go.mod h1:D260Qj11W2qx/HVF29zBg+0fd6YCSjSqLUkY/qEenQU= +cloud.google.com/go/phishingprotection v0.5.0/go.mod h1:Y3HZknsK9bc9dMi+oE8Bim0lczMU6hrX0UpADuMefr0= +cloud.google.com/go/phishingprotection v0.6.0/go.mod h1:9Y3LBLgy0kDTcYET8ZH3bq/7qni15yVUoAxiFxnlSUA= +cloud.google.com/go/privatecatalog v0.5.0/go.mod h1:XgosMUvvPyxDjAVNDYxJ7wBW8//hLDDYmnsNcMGq1K0= +cloud.google.com/go/privatecatalog v0.6.0/go.mod h1:i/fbkZR0hLN29eEWiiwue8Pb+GforiEIBnV9yrRUOKI= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/recaptchaenterprise v1.3.1/go.mod h1:OdD+q+y4XGeAlxRaMn1Y7/GveP6zmq76byL6tjPE7d4= +cloud.google.com/go/recaptchaenterprise/v2 v2.1.0/go.mod h1:w9yVqajwroDNTfGuhmOjPDN//rZGySaf6PtFVcSCa7o= +cloud.google.com/go/recaptchaenterprise/v2 v2.2.0/go.mod h1:/Zu5jisWGeERrd5HnlS3EUGb/D335f9k51B/FVil0jk= +cloud.google.com/go/recaptchaenterprise/v2 v2.3.0/go.mod h1:O9LwGCjrhGHBQET5CA7dd5NwwNQUErSgEDit1DLNTdo= +cloud.google.com/go/recommendationengine v0.5.0/go.mod h1:E5756pJcVFeVgaQv3WNpImkFP8a+RptV6dDLGPILjvg= +cloud.google.com/go/recommendationengine v0.6.0/go.mod h1:08mq2umu9oIqc7tDy8sx+MNJdLG0fUi3vaSVbztHgJ4= +cloud.google.com/go/recommender v1.5.0/go.mod h1:jdoeiBIVrJe9gQjwd759ecLJbxCDED4A6p+mqoqDvTg= +cloud.google.com/go/recommender v1.6.0/go.mod h1:+yETpm25mcoiECKh9DEScGzIRyDKpZ0cEhWGo+8bo+c= +cloud.google.com/go/redis v1.7.0/go.mod h1:V3x5Jq1jzUcg+UNsRvdmsfuFnit1cfe3Z/PGyq/lm4Y= +cloud.google.com/go/redis v1.8.0/go.mod h1:Fm2szCDavWzBk2cDKxrkmWBqoCiL1+Ctwq7EyqBCA/A= +cloud.google.com/go/retail v1.8.0/go.mod h1:QblKS8waDmNUhghY2TI9O3JLlFk8jybHeV4BF19FrE4= +cloud.google.com/go/retail v1.9.0/go.mod h1:g6jb6mKuCS1QKnH/dpu7isX253absFl6iE92nHwlBUY= +cloud.google.com/go/scheduler v1.4.0/go.mod h1:drcJBmxF3aqZJRhmkHQ9b3uSSpQoltBPGPxGAWROx6s= +cloud.google.com/go/scheduler v1.5.0/go.mod h1:ri073ym49NW3AfT6DZi21vLZrG07GXr5p3H1KxN5QlI= +cloud.google.com/go/secretmanager v1.6.0/go.mod h1:awVa/OXF6IiyaU1wQ34inzQNc4ISIDIrId8qE5QGgKA= +cloud.google.com/go/security v1.5.0/go.mod h1:lgxGdyOKKjHL4YG3/YwIL2zLqMFCKs0UbQwgyZmfJl4= +cloud.google.com/go/security v1.7.0/go.mod h1:mZklORHl6Bg7CNnnjLH//0UlAlaXqiG7Lb9PsPXLfD0= +cloud.google.com/go/security v1.8.0/go.mod h1:hAQOwgmaHhztFhiQ41CjDODdWP0+AE1B3sX4OFlq+GU= +cloud.google.com/go/securitycenter v1.13.0/go.mod h1:cv5qNAqjY84FCN6Y9z28WlkKXyWsgLO832YiWwkCWcU= +cloud.google.com/go/securitycenter v1.14.0/go.mod h1:gZLAhtyKv85n52XYWt6RmeBdydyxfPeTrpToDPw4Auc= +cloud.google.com/go/servicedirectory v1.4.0/go.mod h1:gH1MUaZCgtP7qQiI+F+A+OpeKF/HQWgtAddhTbhL2bs= +cloud.google.com/go/servicedirectory v1.5.0/go.mod h1:QMKFL0NUySbpZJ1UZs3oFAmdvVxhhxB6eJ/Vlp73dfg= +cloud.google.com/go/speech v1.6.0/go.mod h1:79tcr4FHCimOp56lwC01xnt/WPJZc4v3gzyT7FoBkCM= +cloud.google.com/go/speech v1.7.0/go.mod h1:KptqL+BAQIhMsj1kOP2la5DSEEerPDuOP/2mmkhHhZQ= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cloud.google.com/go/storage v1.27.0 h1:YOO045NZI9RKfCj1c5A/ZtuuENUc8OAW+gHdGnDgyMQ= +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.29.0 h1:6weCgzRvMg7lzuUurI4697AqIRPU1SvzHhynwpW31jI= +cloud.google.com/go/storage v1.29.0/go.mod h1:4puEjyTKnku6gfKoTfNOU/W+a9JyuVNxjpS5GBrB8h4= +cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= +cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= +cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= +cloud.google.com/go/videointelligence v1.7.0/go.mod h1:k8pI/1wAhjznARtVT9U1llUaFNPh7muw8QyOUpavru4= +cloud.google.com/go/vision v1.2.0/go.mod h1:SmNwgObm5DpFBme2xpyOyasvBc1aPdjvMk2bBk0tKD0= +cloud.google.com/go/vision/v2 v2.2.0/go.mod h1:uCdV4PpN1S0jyCyq8sIM42v2Y6zOLkZs+4R9LrGYwFo= +cloud.google.com/go/vision/v2 v2.3.0/go.mod h1:UO61abBx9QRMFkNBbf1D8B1LXdS2cGiiCRx0vSpZoUo= +cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xXZmFiHmGE= +cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= +cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= +cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= +cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= +cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= +cosmossdk.io/core v0.5.1 h1:vQVtFrIYOQJDV3f7rw4pjjVqc1id4+mE0L9hHP66pyI= +cosmossdk.io/core v0.5.1/go.mod h1:KZtwHCLjcFuo0nmDc24Xy6CRNEL9Vl/MeimQ2aC7NLE= +cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= +cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE= -cosmossdk.io/math v1.0.0-beta.3 h1:TbZxSopz2LqjJ7aXYfn7nJSb8vNaBklW6BLpcei1qwM= -cosmossdk.io/math v1.0.0-beta.3/go.mod h1:3LYasri3Zna4XpbrTNdKsWmD5fHHkaNAod/mNT9XdE4= +cosmossdk.io/math v1.0.0 h1:ro9w7eKx23om2tZz/VM2Pf+z2WAbGX1yDQQOJ6iGeJw= +cosmossdk.io/math v1.0.0/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= +cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= +cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= +filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= +filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw= git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= @@ -90,8 +241,8 @@ github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rW github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 h1:+r1rSv4gvYn0wmRjC8X7IAzX8QezqtFV9m0MUHFJgts= github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0/go.mod h1:b3g59n2Y+T5xmcxJL+UEG2f8cQploZm1mR/v6BW0mU0= -github.com/KYVENetwork/cosmos-sdk v0.46.12-kyve h1:bzM7dCbZ3Z3fNZa1b95ib6q1qxesyT3FCSCDSJNdUHg= -github.com/KYVENetwork/cosmos-sdk v0.46.12-kyve/go.mod h1:bG4AkW9bqc8ycrryyKGQEl3YV9BY2wr6HggGq8kvcgM= +github.com/KYVENetwork/cosmos-sdk v0.47.1-kyve-rc0 h1:goRWhqgQQS6yqssXk3YLDkJu74sfPtOGBLpBP4LZ0sE= +github.com/KYVENetwork/cosmos-sdk v0.47.1-kyve-rc0/go.mod h1:14tO5KQaTrl2q3OxBnDRfue7TRN9zkXS0cLutrSqkOo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= @@ -107,13 +258,12 @@ github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrU github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/Workiva/go-datastructures v1.0.53 h1:J6Y/52yX10Xc5JjXmGtWoSSxs3mZnGSaq37xZZh7Yig= -github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM= github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= github.com/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/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= @@ -141,10 +291,10 @@ github.com/ashanbrown/forbidigo v1.5.1/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1 github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= 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.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.40.45 h1:QN1nsY27ssD/JmW4s83qmSb+uL6DG4GmCDzjmJB4xUI= -github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= +github.com/aws/aws-sdk-go 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.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= @@ -216,19 +366,23 @@ github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/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.10 h1:wgw73BiocdBDQPik+zcEoBG/ob8uyBHf2iyoHGPf5w4= github.com/charithe/durationcheck v0.0.10/go.mod h1:bCWXb7gYRysD1CU3C+u4ceO49LoGOY1C1L6uouGNreQ= github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 h1:W9o46d2kbNL06lq7UNDPV0zYLzkrde/bjIqO02eoll0= github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8/go.mod h1:gakxgyXaaPkxvLw1XQxNGK4I37ys9iBRzNUx/B7pUCo= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= -github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= +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/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8= +github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= +github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= +github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= @@ -237,15 +391,22 @@ github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3h github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= +github.com/cockroachdb/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coinbase/kryptology v1.8.0/go.mod h1:RYXOAPdzOGUe3qlSFkMGn58i3xUA8hmxYHksuq+8ciI= github.com/coinbase/rosetta-sdk-go v0.7.9 h1:lqllBjMnazTjIqYrOGv8h8jxjg9+hJazIGZr9ZvoCcA= github.com/coinbase/rosetta-sdk-go v0.7.9/go.mod h1:0/knutI7XGVqXmmH4OQD8OckFrbQ8yMsUZTG7FXCR2M= -github.com/cometbft/cometbft v0.34.27 h1:ri6BvmwjWR0gurYjywcBqRe4bbwc3QVs9KRcCzgh/J0= -github.com/cometbft/cometbft v0.34.27/go.mod h1:BcCbhKv7ieM0KEddnYXvQZR+pZykTKReJJYf7YC7qhw= +github.com/cometbft/cometbft v0.37.0 h1:M005vBaSaugvYYmNZwJOopynQSjwLoDTwflnQ/I/eYk= +github.com/cometbft/cometbft v0.37.0/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= github.com/cometbft/cometbft-db v0.7.0 h1:uBjbrBx4QzU0zOEnU8KxoDl18dMNgDh+zZRUE0ucsbo= github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= @@ -259,32 +420,38 @@ github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/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-alpha8 h1:d3pCRuMYYvGA5bM0ZbbjKn+AoQD4A7dyNG2wzwWalUw= -github.com/cosmos/cosmos-proto v1.0.0-alpha8/go.mod h1:6/p+Bc4O8JKeZqe0VqUGTX31eoYqemTT4C1hLCWsO7I= +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/gogoproto v1.4.2 h1:UeGRcmFW41l0G0MiefWhkPEVEwvu78SZsHBvI78dAYw= +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/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= -github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= -github.com/cosmos/iavl v0.19.5 h1:rGA3hOrgNxgRM5wYcSCxgQBap7fW82WZgY78V9po/iY= -github.com/cosmos/iavl v0.19.5/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= -github.com/cosmos/ibc-go/v6 v6.1.0 h1:o7oXws2vKkKfOFzJI+oNylRn44PCNt5wzHd/zKQKbvQ= -github.com/cosmos/ibc-go/v6 v6.1.0/go.mod h1:CY3zh2HLfetRiW8LY6kVHMATe90Wj/UOoY8T6cuB0is= +github.com/cosmos/gogoproto v1.4.6 h1:Ee7z15dWJaGlgM2rWrK8N2IX7PQcuccu8oG68jp5RL4= +github.com/cosmos/gogoproto v1.4.6/go.mod h1:VS/ASYmPgv6zkPKLjR9EB91lwbLHOzaGCirmKKhncfI= +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.0.0 h1:j4kyywlG0hhDmT9FmSaR5iCIka7Pz7kJTxGWY1nlV9Q= +github.com/cosmos/ibc-go/v7 v7.0.0/go.mod h1:BFh8nKWjr5zeR2OZfhkzdgDzj1+KjRn3aJLpwapStj8= +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.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA= github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI= +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.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creachadair/taskgroup v0.3.2 h1:zlfutDS+5XG40AOxcHDSThxKzns8Tnr9jnr6VqkYlkM= -github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk= +github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8= +github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cucumber/common/gherkin/go/v22 v22.0.0 h1:4K8NqptbvdOrjL9DEea6HFjSpbdT9+Q5kgLpmmsHYl0= +github.com/cucumber/common/messages/go/v17 v17.1.1 h1:RNqopvIFyLWnKv0LfATh34SWBhXeoFTJnSrgm9cT/Ts= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= @@ -300,8 +467,9 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= @@ -313,8 +481,8 @@ github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdw github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgraph-io/ristretto v0.1.0 h1:Jv3CGQHp9OjuMBSne1485aDpUkTKEcUqF+jm/LuerPI= -github.com/dgraph-io/ristretto v0.1.0/go.mod h1:fux0lOrBhrVCJd3lcTHsIJhq1T2rokOu6v9Vcb3Q9ug= +github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= +github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= @@ -331,8 +499,8 @@ github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRP github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac h1:opbrjaN/L8gg6Xh5D04Tem+8xVcz6ajZlGCs49mQgyg= -github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac/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= @@ -346,6 +514,10 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA= github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= @@ -363,8 +535,9 @@ 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 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= -github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= 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/firefart/nonamedreturns v1.0.4 h1:abzI1p7mAEPYuR4A+VLKn4eNDOycjYo2phmY9sfv40Y= github.com/firefart/nonamedreturns v1.0.4/go.mod h1:TDhe/tjI1BXo48CmYbUduTV7BdIga8MAO/xbKdcVsGI= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= @@ -375,6 +548,7 @@ github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2 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.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/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= @@ -386,7 +560,7 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME 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.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU= +github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= @@ -401,31 +575,32 @@ github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgO github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-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.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= -github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= -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-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-toolsmith/astcast v1.1.0 h1:+JN9xZV1A+Re+95pgnMgDboWNVnIMMQXwfBwLRPgSC8= github.com/go-toolsmith/astcast v1.1.0/go.mod h1:qdcuFWeGGS2xX5bLM/c3U9lewg7+Zu4mr+xPwZIB4ZU= github.com/go-toolsmith/astcopy v1.1.0 h1:YGwBN0WM+ekI/6SS6+52zLDEf8Yvp3n2seZITCUBt5s= @@ -453,21 +628,23 @@ github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= +github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gogo/gateway v1.1.0 h1:u0SuhL9+Il+UbjM9VIE3ntfRujKbvVpFvNB4HbjeVQ0= -github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= +github.com/gofrs/uuid v4.3.0+incompatible h1:CaSVZxm5B+7o45rtab4jC2G37WGYX1zQfuU2i6DSvnc= 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/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= +github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= 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= @@ -481,7 +658,9 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -498,8 +677,10 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -542,6 +723,7 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7/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= @@ -549,12 +731,12 @@ github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= -github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.2.1 h1:d8MncMlErDFTwQGBK1xhv026j9kqhvw1Qv9IbWT1VLQ= +github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/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= @@ -567,6 +749,12 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf 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/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= 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= @@ -574,12 +762,23 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.2.0 h1:y8Yozv7SZtlU//QXbezB6QkpuE6jMD2/gfzk4AftXjs= +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.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= +github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= 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.6.0 h1:SXk3ABtQYDT/OH8jAyvEOQ58mgawq5C4o/4/89qN2ZU= +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.7.0 h1:IcsPKeInNvYi7eqSaDjiZqDDKu5rsmunY0Y1YupQSSQ= +github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= +github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 h1:9alfqbrhuD+9fLZ4iaAVwhlp5PEhmnBt7yvK2Oy5C1U= @@ -613,7 +812,6 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaD github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= @@ -634,8 +832,8 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng 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.6.1 h1:NASsgP4q6tL94WH6nJxKWj8As2H/2kop/bB1d8JMyRY= -github.com/hashicorp/go-getter v1.6.1/go.mod h1:IZCrswsZPeWv9IkVnLElzRU/gz/QPi6pZHn4tv6vbwA= +github.com/hashicorp/go-getter v1.7.0 h1:bzrYP+qu/gMrL1au7/aDvkoOVGUJpeKBgbqRHACAFDY= +github.com/hashicorp/go-getter v1.7.0/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -652,7 +850,6 @@ github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdv github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= @@ -668,13 +865,17 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 h1:aSVUgRRRtOrZOC1fYmY9gV0e9z/Iu+xNVSASWjsuyGU= -github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3/go.mod h1:5PC6ZNPde8bBqU/ewGZig35+UIZtw9Ytxez8/q5ZyFE= +github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= +github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= +github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= +github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= +github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/huin/goupnp v1.0.3-0.20220313090229-ca81a64b4204/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= @@ -683,8 +884,9 @@ github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1: 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.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +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/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= @@ -708,7 +910,6 @@ github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjz 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 h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= 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-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= @@ -750,11 +951,11 @@ github.com/kkHAIKE/contextcheck v1.1.4/go.mod h1:1+i/gWqokIa+dm31mqGLZhZJ7Uh44DJ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.11.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.15.11 h1:Lcadnb3RKGin4FYM/orgq0qde+nc15E5Cbqg4B9Sx9c= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= +github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY= +github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= @@ -783,8 +984,9 @@ github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdB github.com/ldez/tagliatelle v0.4.0 h1:sylp7d9kh6AdXN2DpVGHBRb5guTVAgOxqNGhbqc4b1c= github.com/ldez/tagliatelle v0.4.0/go.mod h1:mNtTfrHy2haaBAw+VT7IBV6VXBThS7TCreYWbBcJ87I= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= -github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/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.1 h1:suWXRU57D4/Enn6pXR0QVqqWWrnJ9Osrz+5rjt8ivzU= github.com/leonklingele/grouper v1.1.1/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -799,8 +1001,8 @@ github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCE github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= 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.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= -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-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= @@ -819,7 +1021,6 @@ github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12/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= @@ -840,8 +1041,8 @@ github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRC github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= -github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= github.com/mgechev/revive v1.3.1 h1:OlQkcH40IB2cGuprTPcjB0iIUddgVZgGmDX3IAMR8D4= @@ -856,8 +1057,9 @@ github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceT github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/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= @@ -905,8 +1107,9 @@ github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= github.com/nunnatsa/ginkgolinter v0.9.0 h1:Sm0zX5QfjJzkeCjEp+t6d3Ha0jwvoDjleP9XCsrEzOA= github.com/nunnatsa/ginkgolinter v0.9.0/go.mod h1:FHaMLURXP7qImeH6bvxWJUpyH+2tuqe5j4rW1gxJRmI= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= @@ -916,14 +1119,19 @@ github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6 github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.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.8.0 h1:pAM+oBNPrpXRs+E/8spkeGx9QgekbRVyr74EUvRVOUI= github.com/onsi/ginkgo/v2 v2.8.0/go.mod h1:6JsQiECmxCa3V5st74AL/AmsV482EDdVrGaVW6z3oYU= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= @@ -955,17 +1163,15 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= -github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= -github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= +github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= +github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/petermattis/goid v0.0.0-20221215004737-a150e88a970d h1:htwtWgtQo8YS6JFWWi2DNgY0RwSGJ1ruMoxY6CUUclk= +github.com/petermattis/goid v0.0.0-20221215004737-a150e88a970d/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= -github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -1008,8 +1214,8 @@ github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB8 github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= -github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= +github.com/prometheus/common v0.40.0 h1:Afz7EVRqGg2Mqqf4JuF9vdvp1pi220m55Pi9T2JnO4Q= +github.com/prometheus/common v0.40.0/go.mod h1:L65ZJPSmfn/UBWLQIHV7dBrKFidB/wPlF1y5TlSt9OE= 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= @@ -1018,8 +1224,8 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O 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.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= -github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= +github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= +github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/quasilyte/go-ruleguard v0.3.19 h1:tfMnabXle/HzOb5Xe9CUZYWXKfkS1KwRmZyPmD9nVcc= github.com/quasilyte/go-ruleguard v0.3.19/go.mod h1:lHSn69Scl48I7Gt9cX3VrbsZYvYiBYszZOZW4A+oTEw= @@ -1034,8 +1240,7 @@ github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Ung github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg= -github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= +github.com/regen-network/gocuke v0.6.2 h1:pHviZ0kKAq2U2hN2q3smKNxct6hS0mGByFMHGnWA97M= github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= @@ -1048,11 +1253,8 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= -github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.27.0 h1:1T7qCieN22GVc8S4Q2yuexzBb1EqjbgjSH9RohbMjKs= -github.com/rs/zerolog v1.27.0/go.mod h1:7frBqO0oezxmnO7GF86FY++uy8I0Tk/If5ni1G9Qc0U= +github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= +github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/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= @@ -1107,8 +1309,8 @@ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasO github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw= -github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= +github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= +github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= @@ -1124,8 +1326,8 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.14.0 h1:Rg7d3Lo706X9tHsJMUjdiwMpHB7W8WnSVOssIY+JElU= -github.com/spf13/viper v1.14.0/go.mod h1:WT//axPky3FdvXHzGw33dNdXXXfFQqmEalje+egj8As= +github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= +github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= @@ -1148,13 +1350,16 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= -github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= -github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= +github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= +github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= +github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c/go.mod h1:SbErYREK7xXdsRiigaQiQkI9McGRzYMvlKYaP3Nimdk= github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= @@ -1163,16 +1368,14 @@ github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzH 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/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8= -github.com/tendermint/tm-db v0.6.7/go.mod h1:byQDzFkZV1syXr/ReXS808NxA2xvyuuVgXOJ/088L6I= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpRQGxTSkNYKJ51yaw6ChIqO+Je8UqsTKN/cDag= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= github.com/tetafro/godot v1.4.11 h1:BVoBIqAf/2QdbFmSwAWnaIqDivZdOV0ZRwEm6jivLKw= github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= -github.com/tidwall/btree v1.5.0 h1:iV0yVY/frd7r6qGBXfEYs7DH0gTDgrKTrDjS7xt/IyQ= -github.com/tidwall/btree v1.5.0/go.mod h1:LGm8L/DZjPLmeWGjv5kFrY8dL4uVhMmzmmLYmsObdKE= +github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg= +github.com/tidwall/btree v1.6.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/tidwall/gjson v1.12.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.14.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= @@ -1183,7 +1386,6 @@ github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e/go.mod h1:27bSVN github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= github.com/timonwong/loggercheck v0.9.4/go.mod h1:caz4zlPcgvpEkXgVnAJGowHAMW2NwHaNlpS8xDbVhTg= github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= -github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -1191,7 +1393,6 @@ github.com/tomarrell/wrapcheck/v2 v2.8.1 h1:HxSqDSN0sAt0yJYsrcYVoEeyM4aI9yAm3KQp github.com/tomarrell/wrapcheck/v2 v2.8.1/go.mod h1:/n2Q3NZ4XFT50ho6Hbxg+RV1uyo2Uow/Vdm9NQcl5SE= github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= github.com/tommy-muehle/go-mnd/v2 v2.5.1/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/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= @@ -1200,8 +1401,9 @@ github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVM github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ= -github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +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 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iLA= github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqzi/CzI= @@ -1239,8 +1441,8 @@ github.com/zondax/ledger-go v0.14.1/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2f gitlab.com/bosi/decorder v0.2.3 h1:gX4/RgK16ijY8V+BRQHAySfQAb354T7/xQpDB2n10P0= gitlab.com/bosi/decorder v0.2.3/go.mod h1:9K1RB5+VPNQYtXtTDAzd2OEftsZb1oV0IrJrzChSdGE= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= -go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= +go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= +go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1250,8 +1452,10 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -1294,8 +1498,8 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y 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.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= -golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= 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= @@ -1310,8 +1514,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= -golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 h1:J74nGeMgeFnYQJN59eFwh06jX/V8g0lB7LWpjSLxtgU= @@ -1330,6 +1534,7 @@ golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRu 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= @@ -1396,15 +1601,25 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= @@ -1421,10 +1636,24 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 h1:nt+Q6cXKz4MosCSpnbMtqiQ8Oz0pxTef2B4Vca2lvfk= +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.5.0 h1:HuArIo48skDwlrvM3sEdHXElYslAMsf3KwRkkW4MC4s= +golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= 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= @@ -1436,7 +1665,9 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-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.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1493,39 +1724,63 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-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-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-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-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.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1622,11 +1877,11 @@ golang.org/x/tools v0.0.0-20200820010801-b793a1359eac/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201001104356-43ebab892c4c/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-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -1634,6 +1889,9 @@ 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.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= @@ -1650,6 +1908,9 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T 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= @@ -1678,8 +1939,37 @@ google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz513 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.102.0 h1:JxJl2qQ85fRMPNvlZY/enexbxpCjLwGhZUtgfGeQ51I= -google.golang.org/api v0.102.0/go.mod h1:3VFl6/fzoA+qNuS1N1/VfXY4LjoXN/wzeIp7TweWwGo= +google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= +google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= +google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= +google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= +google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= +google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= +google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= +google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= +google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= +google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= +google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= +google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= +google.golang.org/api v0.77.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= +google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= +google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg= +google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= +google.golang.org/api v0.85.0/go.mod h1:AqZf8Ep9uZ2pyTvgL+x0D3Zt0eoT9b5E8fmzfu6FO2g= +google.golang.org/api v0.90.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= +google.golang.org/api v0.93.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= +google.golang.org/api v0.95.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI= +google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= +google.golang.org/api v0.110.0 h1:l+rh0KYUooe9JGbGVx71tbFo4SMbMTXK3I3ia2QSEeU= +google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1732,12 +2022,78 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D 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-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210329143202-679c6ae281ee/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= +google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220722212130-b98a9ff5e252/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE= +google.golang.org/genproto v0.0.0-20220801145646-83ce21fca29f/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc= +google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220817144833-d7fd3f11b9b1/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220829144015-23454907ede3/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220829175752-36a9c930ecbf/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220913154956-18f8339a66a5/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220914142337-ca0e39ece12f/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220916172020-2692e8806bfa/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220919141832-68c03719ef51/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006/go.mod h1:ht8XFiar2npT/g4vkk7O0WYS1sHOHbdujxbEp7CJWbw= +google.golang.org/genproto v0.0.0-20220926165614-551eb538f295/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= +google.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= +google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U= +google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= +google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= +google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= +google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44 h1:EfLuoKW5WfkgVdDy7dTK8qSbH37AX5mj/MFh+bGPz14= +google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44/go.mod h1:8B0gmkoRebU8ukX6HP+4wrVQUY1+6PkQ44BSyIlflHA= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1759,8 +2115,27 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp 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.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= -google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= +google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +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= @@ -1773,8 +2148,11 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8 h1:KR8+MyP7/qOlV+8Af01LtjL04bu7on42eVsxT4EyBQk= -google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +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.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= +google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1810,7 +2188,9 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= 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= @@ -1832,7 +2212,8 @@ mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d h1:3rvTIIM22r9pvXk+q3swxUQAQ mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d/go.mod h1:IeHQjmn6TOD+e4Z3RFiZMMsLVL+A96Nvptar8Fj71is= nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -pgregory.net/rapid v0.5.3 h1:163N50IHFqr1phZens4FQOdPgfJscR7a562mjQqeo4M= +pgregory.net/rapid v0.5.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= diff --git a/proto/Dockerfile b/proto/Dockerfile index 8c398454..ea2150dc 100644 --- a/proto/Dockerfile +++ b/proto/Dockerfile @@ -10,16 +10,10 @@ RUN apk add --no-cache \ RUN go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@latest RUN go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@latest -RUN git clone https://github.com/regen-network/protobuf.git; \ - cd protobuf; \ +RUN git clone https://github.com/cosmos/gogoproto.git; \ + cd gogoproto; \ go mod download; \ - make install; \ - cd .. - -RUN git clone https://github.com/regen-network/cosmos-proto.git; \ - cd cosmos-proto/protoc-gen-gocosmos; \ - go install .; \ - cd .. + make install RUN npm install -g swagger-combine diff --git a/proto/buf.lock b/proto/buf.lock index ecb58968..c66ec1a0 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -5,15 +5,19 @@ deps: owner: cosmos repository: cosmos-proto commit: 1935555c206d4afb9e94615dfd0fad31 + digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377 - remote: buf.build owner: cosmos repository: cosmos-sdk - commit: 8cb30a2c4de74dc9bd8d260b1e75e176 + commit: 954f7b05f38440fc8250134b15adec47 + digest: shake256:2ab4404fd04a7d1d52df0e2d0f2d477a3d83ffd88d876957bf3fedfd702c8e52833d65b3ce1d89a3c5adf2aab512616b0e4f51d8463f07eda9a8a3317ee3ac54 - remote: buf.build owner: cosmos repository: gogo-proto commit: 34d970b699f84aa382f3c29773a60836 + digest: shake256:3d3bee5229ba579e7d19ffe6e140986a228b48a8c7fe74348f308537ab95e9135210e81812489d42cd8941d33ff71f11583174ccc5972e86e6112924b6ce9f04 - remote: buf.build owner: googleapis repository: googleapis - commit: 783e4b5374fa488ab068d08af9658438 + commit: 5ae7f88519b04fe1965da0f8a375a088 + digest: shake256:27d9fcdc0e3eb957449dc3d17e2d24c7ce59c3c483ecf128818183c336dfd28595ecd13771fb3172247775caf7707c4076dd8e70c5ac2cbcac170df35e4d0028 diff --git a/proto/buf.yaml b/proto/buf.yaml index 24561cc0..cdce0fae 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -1,8 +1,7 @@ version: v1 name: buf.build/kyve/chain deps: - # Cosmos SDK v0.46 (https://github.com/cosmos/cosmos-sdk/tree/main/proto#sdk-x-buf) - - buf.build/cosmos/cosmos-sdk:8cb30a2c4de74dc9bd8d260b1e75e176 + - buf.build/cosmos/cosmos-sdk:v0.47.0 - buf.build/cosmos/gogo-proto - buf.build/googleapis/googleapis breaking: diff --git a/proto/kyve/query/v1beta1/params.proto b/proto/kyve/query/v1beta1/params.proto index 69a0133d..83bdd7b7 100644 --- a/proto/kyve/query/v1beta1/params.proto +++ b/proto/kyve/query/v1beta1/params.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package kyve.query.v1beta1; -import "cosmos/gov/v1/query.proto"; +import "cosmos/gov/v1/gov.proto"; import "google/api/annotations.proto"; import "kyve/bundles/v1beta1/params.proto"; import "kyve/delegation/v1beta1/params.proto"; @@ -35,7 +35,7 @@ message QueryParamsResponse { // global_params ... kyve.global.v1beta1.Params global_params = 3; // gov_params ... - cosmos.gov.v1.QueryParamsResponse gov_params = 4; + cosmos.gov.v1.Params gov_params = 4; // stakers_params ... kyve.stakers.v1beta1.Params stakers_params = 5; } diff --git a/testutil/integration/integration.go b/testutil/integration/integration.go index ecc92509..5656dbee 100644 --- a/testutil/integration/integration.go +++ b/testutil/integration/integration.go @@ -8,6 +8,11 @@ import ( "github.com/KYVENetwork/chain/app" stakerstypes "github.com/KYVENetwork/chain/x/stakers/types" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/crypto/tmhash" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmversion "github.com/cometbft/cometbft/proto/tendermint/version" + "github.com/cometbft/cometbft/version" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" @@ -16,11 +21,6 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/suite" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/tmhash" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmversion "github.com/tendermint/tendermint/proto/tendermint/version" - "github.com/tendermint/tendermint/version" ) const ( @@ -203,21 +203,21 @@ func (suite *KeeperTestSuite) SetupApp(startTime int64) { mintParams := suite.app.MintKeeper.GetParams(suite.ctx) mintParams.MintDenom = suite.denom - suite.app.MintKeeper.SetParams(suite.ctx, mintParams) + _ = suite.app.MintKeeper.SetParams(suite.ctx, mintParams) stakingParams := suite.app.StakingKeeper.GetParams(suite.ctx) stakingParams.BondDenom = suite.denom - suite.app.StakingKeeper.SetParams(suite.ctx, stakingParams) + _ = suite.app.StakingKeeper.SetParams(suite.ctx, stakingParams) - depositParams := suite.app.GovKeeper.GetDepositParams(suite.ctx) - depositParams.MinDeposit = sdk.NewCoins(sdk.NewInt64Coin(KYVE_DENOM, int64(100_000_000_000))) // set min deposit to 100 KYVE - suite.app.GovKeeper.SetDepositParams(suite.ctx, depositParams) + govParams := suite.app.GovKeeper.GetParams(suite.ctx) + govParams.MinDeposit = sdk.NewCoins(sdk.NewInt64Coin(KYVE_DENOM, int64(100_000_000_000))) // set min deposit to 100 KYVE + _ = suite.app.GovKeeper.SetParams(suite.ctx, govParams) // Set Validator valAddr := sdk.ValAddress(suite.address.Bytes()) validator, _ := stakingtypes.NewValidator(valAddr, ePriv.PubKey(), stakingtypes.Description{}) validator = stakingkeeper.TestingUpdateValidator(suite.app.StakingKeeper, suite.ctx, validator, true) - _ = suite.app.StakingKeeper.AfterValidatorCreated(suite.ctx, validator.GetOperator()) + //_ = suite.app.StakingKeeper.AfterValidatorCreated(suite.ctx, validator.GetOperator()) _ = suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator) validators := suite.app.StakingKeeper.GetValidators(suite.ctx, 1) suite.validator = validators[0] diff --git a/testutil/keeper/bundles.go b/testutil/keeper/bundles.go index adf1c556..cef79495 100644 --- a/testutil/keeper/bundles.go +++ b/testutil/keeper/bundles.go @@ -5,6 +5,9 @@ import ( "github.com/KYVENetwork/chain/x/bundles/keeper" "github.com/KYVENetwork/chain/x/bundles/types" + 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" @@ -12,9 +15,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" typesparams "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmdb "github.com/tendermint/tm-db" ) func BundlesKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { diff --git a/testutil/keeper/pool.go b/testutil/keeper/pool.go index 75efcdd8..07fab988 100644 --- a/testutil/keeper/pool.go +++ b/testutil/keeper/pool.go @@ -5,6 +5,9 @@ import ( "github.com/KYVENetwork/chain/x/pool/keeper" "github.com/KYVENetwork/chain/x/pool/types" + 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" @@ -12,9 +15,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" typesparams "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmdb "github.com/tendermint/tm-db" ) func PoolKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { diff --git a/testutil/keeper/query.go b/testutil/keeper/query.go index 8322af24..59ec7936 100644 --- a/testutil/keeper/query.go +++ b/testutil/keeper/query.go @@ -5,6 +5,9 @@ import ( "github.com/KYVENetwork/chain/x/query/keeper" "github.com/KYVENetwork/chain/x/query/types" + 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" @@ -12,9 +15,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" typesparams "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmdb "github.com/tendermint/tm-db" ) func QueryKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { diff --git a/testutil/keeper/stakers.go b/testutil/keeper/stakers.go index b2f8e263..d6eb5403 100644 --- a/testutil/keeper/stakers.go +++ b/testutil/keeper/stakers.go @@ -5,6 +5,9 @@ import ( "github.com/KYVENetwork/chain/x/stakers/keeper" "github.com/KYVENetwork/chain/x/stakers/types" + 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" @@ -12,9 +15,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" typesparams "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmdb "github.com/tendermint/tm-db" ) func StakersKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { diff --git a/x/bundles/keeper/keeper.go b/x/bundles/keeper/keeper.go index 69d0b6cb..35811cd4 100644 --- a/x/bundles/keeper/keeper.go +++ b/x/bundles/keeper/keeper.go @@ -3,7 +3,7 @@ package keeper import ( "fmt" - "github.com/tendermint/tendermint/libs/log" + "github.com/cometbft/cometbft/libs/log" "github.com/KYVENetwork/chain/x/bundles/types" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/bundles/keeper/msg_server_update_params_test.go b/x/bundles/keeper/msg_server_update_params_test.go index 9940ebf8..077820d4 100644 --- a/x/bundles/keeper/msg_server_update_params_test.go +++ b/x/bundles/keeper/msg_server_update_params_test.go @@ -43,8 +43,8 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() - minDeposit := s.App().GovKeeper.GetDepositParams(s.Ctx()).MinDeposit - votingPeriod := s.App().GovKeeper.GetVotingParams(s.Ctx()).VotingPeriod + minDeposit := s.App().GovKeeper.GetParams(s.Ctx()).MinDeposit + votingPeriod := s.App().GovKeeper.GetParams(s.Ctx()).VotingPeriod delegations := s.App().StakingKeeper.GetAllDelegations(s.Ctx()) voter := sdk.MustAccAddressFromBech32(delegations[0].DelegatorAddress) @@ -92,7 +92,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -117,7 +117,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -153,7 +153,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -191,7 +191,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -223,7 +223,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -261,7 +261,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -293,7 +293,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -331,7 +331,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -363,7 +363,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -401,7 +401,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -433,7 +433,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -471,7 +471,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT diff --git a/x/bundles/module.go b/x/bundles/module.go index 13b211ca..1bfa5697 100644 --- a/x/bundles/module.go +++ b/x/bundles/module.go @@ -9,7 +9,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/KYVENetwork/chain/x/bundles/client/cli" "github.com/KYVENetwork/chain/x/bundles/keeper" @@ -110,17 +110,9 @@ func NewAppModule( } } -// Deprecated: use RegisterServices -func (am AppModule) Route() sdk.Route { return sdk.Route{} } - // Deprecated: use RegisterServices func (AppModule) QuerierRoute() string { return types.RouterKey } -// Deprecated: use RegisterServices -func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { - return nil -} - // 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)) diff --git a/x/bundles/types/bundles.pb.go b/x/bundles/types/bundles.pb.go index 9343757f..92d1628d 100644 --- a/x/bundles/types/bundles.pb.go +++ b/x/bundles/types/bundles.pb.go @@ -6,7 +6,7 @@ package types import ( fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/bundles/types/events.pb.go b/x/bundles/types/events.pb.go index a154c821..fe617c53 100644 --- a/x/bundles/types/events.pb.go +++ b/x/bundles/types/events.pb.go @@ -6,7 +6,7 @@ package types import ( fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/bundles/types/genesis.pb.go b/x/bundles/types/genesis.pb.go index abd26aa3..a65bb607 100644 --- a/x/bundles/types/genesis.pb.go +++ b/x/bundles/types/genesis.pb.go @@ -6,7 +6,7 @@ package types import ( fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/bundles/types/params.pb.go b/x/bundles/types/params.pb.go index 7cff9951..a82120cc 100644 --- a/x/bundles/types/params.pb.go +++ b/x/bundles/types/params.pb.go @@ -7,7 +7,7 @@ import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/bundles/types/query.pb.go b/x/bundles/types/query.pb.go index f0dcd232..900e380e 100644 --- a/x/bundles/types/query.pb.go +++ b/x/bundles/types/query.pb.go @@ -7,8 +7,8 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" diff --git a/x/bundles/types/tx.pb.go b/x/bundles/types/tx.pb.go index 65e519aa..2a855598 100644 --- a/x/bundles/types/tx.pb.go +++ b/x/bundles/types/tx.pb.go @@ -8,8 +8,8 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/x/delegation/keeper/keeper.go b/x/delegation/keeper/keeper.go index 8e2e3d4b..20412225 100644 --- a/x/delegation/keeper/keeper.go +++ b/x/delegation/keeper/keeper.go @@ -3,7 +3,7 @@ package keeper import ( "fmt" - "github.com/tendermint/tendermint/libs/log" + "github.com/cometbft/cometbft/libs/log" "github.com/KYVENetwork/chain/x/delegation/types" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/delegation/keeper/msg_server_update_params_test.go b/x/delegation/keeper/msg_server_update_params_test.go index f6a2f702..eed576c7 100644 --- a/x/delegation/keeper/msg_server_update_params_test.go +++ b/x/delegation/keeper/msg_server_update_params_test.go @@ -51,8 +51,8 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() - minDeposit := s.App().GovKeeper.GetDepositParams(s.Ctx()).MinDeposit - votingPeriod := s.App().GovKeeper.GetVotingParams(s.Ctx()).VotingPeriod + minDeposit := s.App().GovKeeper.GetParams(s.Ctx()).MinDeposit + votingPeriod := s.App().GovKeeper.GetParams(s.Ctx()).VotingPeriod delegations := s.App().StakingKeeper.GetAllDelegations(s.Ctx()) voter := sdk.MustAccAddressFromBech32(delegations[0].DelegatorAddress) @@ -102,7 +102,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -129,7 +129,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -167,7 +167,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -207,7 +207,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -241,7 +241,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -281,7 +281,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -315,7 +315,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -355,7 +355,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -389,7 +389,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -429,7 +429,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -463,7 +463,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -503,7 +503,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -538,7 +538,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -578,7 +578,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -612,7 +612,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -652,7 +652,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT diff --git a/x/delegation/module.go b/x/delegation/module.go index d9a9be8e..4bbc1d2c 100644 --- a/x/delegation/module.go +++ b/x/delegation/module.go @@ -8,7 +8,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/KYVENetwork/chain/x/delegation/client/cli" "github.com/KYVENetwork/chain/x/delegation/keeper" @@ -109,17 +109,9 @@ func NewAppModule( } } -// Deprecated: use RegisterServices -func (am AppModule) Route() sdk.Route { return sdk.Route{} } - // Deprecated: use RegisterServices func (AppModule) QuerierRoute() string { return types.RouterKey } -// Deprecated: use RegisterServices -func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { - return nil -} - // 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)) diff --git a/x/delegation/types/delegation.pb.go b/x/delegation/types/delegation.pb.go index 610bbb00..c9186e46 100644 --- a/x/delegation/types/delegation.pb.go +++ b/x/delegation/types/delegation.pb.go @@ -7,7 +7,7 @@ import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/delegation/types/events.pb.go b/x/delegation/types/events.pb.go index 5f45f54a..b2763a80 100644 --- a/x/delegation/types/events.pb.go +++ b/x/delegation/types/events.pb.go @@ -6,7 +6,7 @@ package types import ( fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/delegation/types/genesis.pb.go b/x/delegation/types/genesis.pb.go index 7951a355..ba1deb97 100644 --- a/x/delegation/types/genesis.pb.go +++ b/x/delegation/types/genesis.pb.go @@ -6,7 +6,7 @@ package types import ( fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/delegation/types/params.pb.go b/x/delegation/types/params.pb.go index fffc1de2..2ba07360 100644 --- a/x/delegation/types/params.pb.go +++ b/x/delegation/types/params.pb.go @@ -7,7 +7,7 @@ import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/delegation/types/query.pb.go b/x/delegation/types/query.pb.go index 986184c6..f7f53b58 100644 --- a/x/delegation/types/query.pb.go +++ b/x/delegation/types/query.pb.go @@ -7,8 +7,8 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" diff --git a/x/delegation/types/tx.pb.go b/x/delegation/types/tx.pb.go index a72c1c79..a2d81473 100644 --- a/x/delegation/types/tx.pb.go +++ b/x/delegation/types/tx.pb.go @@ -7,8 +7,8 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/x/global/abci_test.go b/x/global/abci_test.go index 0985b930..54725ae9 100644 --- a/x/global/abci_test.go +++ b/x/global/abci_test.go @@ -28,7 +28,7 @@ TEST CASES - DeductFeeDecorator var _ = Describe("AbciEndBlocker", Ordered, func() { s := i.NewCleanChain() encodingConfig := BuildEncodingConfig() - dfd := global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, s.App().StakingKeeper) + dfd := global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, *s.App().StakingKeeper) accountBalanceBefore := s.GetBalanceFromAddress(i.DUMMY[0]) totalSupplyBefore := s.App().BankKeeper.GetSupply(s.Ctx(), types.Denom).Amount.Uint64() @@ -39,11 +39,11 @@ var _ = Describe("AbciEndBlocker", Ordered, func() { mintParams := s.App().MintKeeper.GetParams(s.Ctx()) mintParams.InflationMax = sdk.ZeroDec() mintParams.InflationMin = sdk.ZeroDec() - s.App().MintKeeper.SetParams(s.Ctx(), mintParams) + _ = s.App().MintKeeper.SetParams(s.Ctx(), mintParams) accountBalanceBefore = s.GetBalanceFromAddress(i.DUMMY[0]) totalSupplyBefore = s.App().BankKeeper.GetSupply(s.Ctx(), types.Denom).Amount.Uint64() - dfd = global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, s.App().StakingKeeper) + dfd = global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, *s.App().StakingKeeper) }) AfterEach(func() { @@ -57,7 +57,7 @@ var _ = Describe("AbciEndBlocker", Ordered, func() { tx := BuildTestTx(math.NewInt(1), denom, i.DUMMY[0], encodingConfig) // ACT - _, err := dfd.AnteHandle(s.Ctx(), tx, false, NextFn) + _, err := dfd.AnteHandle(s.Ctx(), tx, false, AnteNextFn) s.CommitAfterSeconds(1) // ASSERT @@ -84,7 +84,7 @@ var _ = Describe("AbciEndBlocker", Ordered, func() { tx := BuildTestTx(math.NewInt(1), denom, i.DUMMY[0], encodingConfig) // ACT - _, err := dfd.AnteHandle(s.Ctx(), tx, false, NextFn) + _, err := dfd.AnteHandle(s.Ctx(), tx, false, AnteNextFn) s.CommitAfterSeconds(1) // ASSERT @@ -111,7 +111,7 @@ var _ = Describe("AbciEndBlocker", Ordered, func() { tx := BuildTestTx(math.NewInt(1), denom, i.DUMMY[0], encodingConfig) // ACT - _, err := dfd.AnteHandle(s.Ctx(), tx, false, NextFn) + _, err := dfd.AnteHandle(s.Ctx(), tx, false, AnteNextFn) s.CommitAfterSeconds(1) // ASSERT @@ -137,7 +137,7 @@ var _ = Describe("AbciEndBlocker", Ordered, func() { tx := BuildTestTx(math.NewInt(1), denom, i.DUMMY[0], encodingConfig) // ACT - _, err := dfd.AnteHandle(s.Ctx(), tx, false, NextFn) + _, err := dfd.AnteHandle(s.Ctx(), tx, false, AnteNextFn) s.CommitAfterSeconds(1) // ASSERT diff --git a/x/global/ante.go b/x/global/ante.go index e7618d8d..c3b181ce 100644 --- a/x/global/ante.go +++ b/x/global/ante.go @@ -111,10 +111,10 @@ func (idd InitialDepositDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula } minInitialDepositRatio := idd.globalKeeper.GetMinInitialDepositRatio(ctx) - depositParams := idd.govKeeper.GetDepositParams(ctx) + govParams := idd.govKeeper.GetParams(ctx) requiredDeposit := sdk.NewCoins() - for _, coin := range depositParams.MinDeposit { + for _, coin := range govParams.MinDeposit { amount := sdk.NewDecFromInt(coin.Amount).Mul(minInitialDepositRatio).TruncateInt() requiredDeposit = requiredDeposit.Add(sdk.NewCoin(coin.Denom, amount)) } diff --git a/x/global/ante_test.go b/x/global/ante_test.go index 7a7247f6..07e1f818 100644 --- a/x/global/ante_test.go +++ b/x/global/ante_test.go @@ -43,7 +43,7 @@ TEST CASES - DeductFeeDecorator var _ = Describe("DeductFeeDecorator", Ordered, func() { s := i.NewCleanChain() encodingConfig := BuildEncodingConfig() - dfd := global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, s.App().StakingKeeper) + dfd := global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, *s.App().StakingKeeper) denom := s.App().StakingKeeper.BondDenom(s.Ctx()) accountBalanceBefore := s.GetBalanceFromAddress(i.DUMMY[0]) @@ -53,7 +53,7 @@ var _ = Describe("DeductFeeDecorator", Ordered, func() { s = i.NewCleanChain() encodingConfig = BuildEncodingConfig() denom = s.App().StakingKeeper.BondDenom(s.Ctx()) - dfd = global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, s.App().StakingKeeper) + dfd = global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, *s.App().StakingKeeper) }) AfterEach(func() { @@ -62,10 +62,10 @@ var _ = Describe("DeductFeeDecorator", Ordered, func() { It("Invalid transaction.", func() { // ARRANGE - dfd := global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, s.App().StakingKeeper) + dfd := global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, *s.App().StakingKeeper) // ACT - _, err := dfd.AnteHandle(s.Ctx(), &InvalidTx{}, false, NextFn) + _, err := dfd.AnteHandle(s.Ctx(), &InvalidTx{}, false, AnteNextFn) // ASSERT Expect(err).Should(HaveOccurred()) @@ -73,13 +73,13 @@ var _ = Describe("DeductFeeDecorator", Ordered, func() { It("consensusGasPrice = 0.0; validatorGasPrice = 0.0 - deliverTX", func() { // ARRANGE - dfd := global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, s.App().StakingKeeper) + dfd := global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, *s.App().StakingKeeper) denom := s.App().StakingKeeper.BondDenom(s.Ctx()) tx := BuildTestTx(math.ZeroInt(), denom, i.DUMMY[0], encodingConfig) // ACT - _, err := dfd.AnteHandle(s.Ctx().WithIsCheckTx(false), tx, false, NextFn) + _, err := dfd.AnteHandle(s.Ctx().WithIsCheckTx(false), tx, false, AnteNextFn) // ASSERT accountBalanceAfter := s.GetBalanceFromAddress(i.DUMMY[0]) @@ -92,13 +92,13 @@ var _ = Describe("DeductFeeDecorator", Ordered, func() { It("consensusGasPrice = 0.0; validatorGasPrice = 0.0 - checkTX", func() { // ARRANGE - dfd := global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, s.App().StakingKeeper) + dfd := global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, *s.App().StakingKeeper) denom := s.App().StakingKeeper.BondDenom(s.Ctx()) tx := BuildTestTx(math.ZeroInt(), denom, i.DUMMY[0], encodingConfig) // ACT - _, err := dfd.AnteHandle(s.Ctx().WithIsCheckTx(true), tx, false, NextFn) + _, err := dfd.AnteHandle(s.Ctx().WithIsCheckTx(true), tx, false, AnteNextFn) // ASSERT accountBalanceAfter := s.GetBalanceFromAddress(i.DUMMY[0]) @@ -117,7 +117,7 @@ var _ = Describe("DeductFeeDecorator", Ordered, func() { tx := BuildTestTx(math.ZeroInt(), denom, i.DUMMY[0], encodingConfig) // ACT - _, err := dfd.AnteHandle(s.Ctx().WithIsCheckTx(false), tx, false, NextFn) + _, err := dfd.AnteHandle(s.Ctx().WithIsCheckTx(false), tx, false, AnteNextFn) // ASSERT accountBalanceAfter := s.GetBalanceFromAddress(i.DUMMY[0]) @@ -136,7 +136,7 @@ var _ = Describe("DeductFeeDecorator", Ordered, func() { tx := BuildTestTx(math.NewInt(1), denom, i.DUMMY[0], encodingConfig) // ACT - _, err := dfd.AnteHandle(s.Ctx().WithIsCheckTx(false), tx, false, NextFn) + _, err := dfd.AnteHandle(s.Ctx().WithIsCheckTx(false), tx, false, AnteNextFn) // ASSERT accountBalanceAfter := s.GetBalanceFromAddress(i.DUMMY[0]) @@ -155,7 +155,7 @@ var _ = Describe("DeductFeeDecorator", Ordered, func() { tx := BuildTestTx(math.ZeroInt(), denom, i.DUMMY[0], encodingConfig) // ACT - _, err := dfd.AnteHandle(s.Ctx().WithIsCheckTx(true), tx, false, NextFn) + _, err := dfd.AnteHandle(s.Ctx().WithIsCheckTx(true), tx, false, AnteNextFn) // ASSERT accountBalanceAfter := s.GetBalanceFromAddress(i.DUMMY[0]) @@ -174,7 +174,7 @@ var _ = Describe("DeductFeeDecorator", Ordered, func() { tx := BuildTestTx(math.NewInt(1), denom, i.DUMMY[0], encodingConfig) // ACT - _, err := dfd.AnteHandle(s.Ctx().WithIsCheckTx(true), tx, false, NextFn) + _, err := dfd.AnteHandle(s.Ctx().WithIsCheckTx(true), tx, false, AnteNextFn) // ASSERT accountBalanceAfter := s.GetBalanceFromAddress(i.DUMMY[0]) @@ -196,7 +196,7 @@ var _ = Describe("DeductFeeDecorator", Ordered, func() { tx := BuildTestTx(math.ZeroInt(), denom, i.DUMMY[0], encodingConfig) // ACT - _, err := dfd.AnteHandle(ctx.WithIsCheckTx(false), tx, false, NextFn) + _, err := dfd.AnteHandle(ctx.WithIsCheckTx(false), tx, false, AnteNextFn) // ASSERT accountBalanceAfter := s.GetBalanceFromAddress(i.DUMMY[0]) @@ -218,7 +218,7 @@ var _ = Describe("DeductFeeDecorator", Ordered, func() { tx := BuildTestTx(math.NewInt(1), denom, i.DUMMY[0], encodingConfig) // ACT - _, err := dfd.AnteHandle(ctx.WithIsCheckTx(false), tx, false, NextFn) + _, err := dfd.AnteHandle(ctx.WithIsCheckTx(false), tx, false, AnteNextFn) // ASSERT accountBalanceAfter := s.GetBalanceFromAddress(i.DUMMY[0]) @@ -240,7 +240,7 @@ var _ = Describe("DeductFeeDecorator", Ordered, func() { tx := BuildTestTx(math.ZeroInt(), denom, i.DUMMY[0], encodingConfig) // ACT - _, err := dfd.AnteHandle(ctx.WithIsCheckTx(true), tx, false, NextFn) + _, err := dfd.AnteHandle(ctx.WithIsCheckTx(true), tx, false, AnteNextFn) // ASSERT accountBalanceAfter := s.GetBalanceFromAddress(i.DUMMY[0]) @@ -262,7 +262,7 @@ var _ = Describe("DeductFeeDecorator", Ordered, func() { tx := BuildTestTx(math.NewInt(1), denom, i.DUMMY[0], encodingConfig) // ACT - _, err := dfd.AnteHandle(ctx.WithIsCheckTx(true), tx, false, NextFn) + _, err := dfd.AnteHandle(ctx.WithIsCheckTx(true), tx, false, AnteNextFn) // ASSERT accountBalanceAfter := s.GetBalanceFromAddress(i.DUMMY[0]) @@ -322,7 +322,7 @@ var _ = Describe("GasAdjustmentDecorator", Ordered, func() { gad := global.NewGasAdjustmentDecorator(s.App().GlobalKeeper) // ACT - _, err := gad.AnteHandle(s.Ctx(), tx, false, NextFn) + _, err := gad.AnteHandle(s.Ctx(), tx, false, AnteNextFn) // ASSERT Expect(err).ToNot(HaveOccurred()) @@ -340,7 +340,7 @@ var _ = Describe("GasAdjustmentDecorator", Ordered, func() { gad := global.NewGasAdjustmentDecorator(s.App().GlobalKeeper) // ACT - _, err := gad.AnteHandle(s.Ctx(), tx, false, NextFn) + _, err := gad.AnteHandle(s.Ctx(), tx, false, AnteNextFn) // ASSERT Expect(err).ToNot(HaveOccurred()) @@ -358,7 +358,7 @@ var _ = Describe("GasAdjustmentDecorator", Ordered, func() { gad := global.NewGasAdjustmentDecorator(s.App().GlobalKeeper) // ACT - _, err := gad.AnteHandle(s.Ctx(), tx, false, NextFn) + _, err := gad.AnteHandle(s.Ctx(), tx, false, AnteNextFn) // ASSERT Expect(err).ToNot(HaveOccurred()) @@ -377,7 +377,7 @@ var _ = Describe("GasAdjustmentDecorator", Ordered, func() { gad := global.NewGasAdjustmentDecorator(s.App().GlobalKeeper) // ACT - _, err := gad.AnteHandle(s.Ctx(), tx, false, NextFn) + _, err := gad.AnteHandle(s.Ctx(), tx, false, AnteNextFn) // ASSERT Expect(err).ToNot(HaveOccurred()) @@ -397,7 +397,7 @@ var _ = Describe("GasAdjustmentDecorator", Ordered, func() { gad := global.NewGasAdjustmentDecorator(s.App().GlobalKeeper) // ACT - _, err := gad.AnteHandle(s.Ctx(), tx, false, NextFn) + _, err := gad.AnteHandle(s.Ctx(), tx, false, AnteNextFn) // ASSERT Expect(err).ToNot(HaveOccurred()) @@ -434,15 +434,15 @@ var _ = Describe("InitialDepositDecorator", Ordered, func() { It("No Deposit, no min-deposit - v1", func() { // ARRANGE txBuilder := encodingConfig.TxConfig.NewTxBuilder() - submitMsg, govErr := govV1Types.NewMsgSubmitProposal(emptyMsg, zeroCoins, i.ALICE, "metadata") + submitMsg, govErr := govV1Types.NewMsgSubmitProposal(emptyMsg, zeroCoins, i.ALICE, "metadata", "title", "summary") Expect(govErr).ToNot(HaveOccurred()) _ = txBuilder.SetMsgs(submitMsg) tx := txBuilder.GetTx() - gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, s.App().GovKeeper) + gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, *s.App().GovKeeper) // ACT - _, err := gid.AnteHandle(s.Ctx(), tx, false, NextFn) + _, err := gid.AnteHandle(s.Ctx(), tx, false, AnteNextFn) // ASSERT Expect(err).ToNot(HaveOccurred()) @@ -452,7 +452,7 @@ var _ = Describe("InitialDepositDecorator", Ordered, func() { // ARRANGE txBuilder := encodingConfig.TxConfig.NewTxBuilder() - content, created := govLegacyTypes.ContentFromProposalType("Text-test", "Descirption", "Text") + content, created := govLegacyTypes.ContentFromProposalType("Text-test", "Description", "Text") Expect(created).To(BeTrue()) submitMsg, govErr := govLegacyTypes.NewMsgSubmitProposal(content, zeroCoins, sdk.MustAccAddressFromBech32(i.ALICE)) @@ -460,10 +460,10 @@ var _ = Describe("InitialDepositDecorator", Ordered, func() { _ = txBuilder.SetMsgs(submitMsg) tx := txBuilder.GetTx() - gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, s.App().GovKeeper) + gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, *s.App().GovKeeper) // ACT - _, err := gid.AnteHandle(s.Ctx(), tx, false, NextFn) + _, err := gid.AnteHandle(s.Ctx(), tx, false, AnteNextFn) // ASSERT Expect(err).ToNot(HaveOccurred()) @@ -473,15 +473,15 @@ var _ = Describe("InitialDepositDecorator", Ordered, func() { // ARRANGE txBuilder := encodingConfig.TxConfig.NewTxBuilder() hundredKyveCoins := sdk.NewCoins(sdk.NewCoin(types.Denom, math.NewInt(100_000_000_000))) - submitMsg, govErr := govV1Types.NewMsgSubmitProposal(emptyMsg, hundredKyveCoins, i.ALICE, "metadata") + submitMsg, govErr := govV1Types.NewMsgSubmitProposal(emptyMsg, hundredKyveCoins, i.ALICE, "metadata", "title", "summary") Expect(govErr).ToNot(HaveOccurred()) _ = txBuilder.SetMsgs(submitMsg) tx := txBuilder.GetTx() - gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, s.App().GovKeeper) + gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, *s.App().GovKeeper) // ACT - _, err := gid.AnteHandle(s.Ctx(), tx, false, NextFn) + _, err := gid.AnteHandle(s.Ctx(), tx, false, AnteNextFn) // ASSERT Expect(err).ToNot(HaveOccurred()) @@ -491,7 +491,7 @@ var _ = Describe("InitialDepositDecorator", Ordered, func() { // ARRANGE txBuilder := encodingConfig.TxConfig.NewTxBuilder() - content, created := govLegacyTypes.ContentFromProposalType("Text-test", "Descirption", "Text") + content, created := govLegacyTypes.ContentFromProposalType("Text-test", "Description", "Text") Expect(created).To(BeTrue()) hundredKyveCoins := sdk.NewCoins(sdk.NewCoin(types.Denom, math.NewInt(100_000_000_000))) @@ -501,10 +501,10 @@ var _ = Describe("InitialDepositDecorator", Ordered, func() { _ = txBuilder.SetMsgs(submitMsg) tx := txBuilder.GetTx() - gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, s.App().GovKeeper) + gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, *s.App().GovKeeper) // ACT - _, err := gid.AnteHandle(s.Ctx(), tx, false, NextFn) + _, err := gid.AnteHandle(s.Ctx(), tx, false, AnteNextFn) // ASSERT Expect(err).ToNot(HaveOccurred()) @@ -517,15 +517,15 @@ var _ = Describe("InitialDepositDecorator", Ordered, func() { s.App().GlobalKeeper.SetParams(s.Ctx(), params) txBuilder := encodingConfig.TxConfig.NewTxBuilder() - submitMsg, govErr := govV1Types.NewMsgSubmitProposal(emptyMsg, zeroCoins, i.ALICE, "metadata") + submitMsg, govErr := govV1Types.NewMsgSubmitProposal(emptyMsg, zeroCoins, i.ALICE, "metadata", "title", "summary") Expect(govErr).ToNot(HaveOccurred()) _ = txBuilder.SetMsgs(submitMsg) tx := txBuilder.GetTx() - gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, s.App().GovKeeper) + gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, *s.App().GovKeeper) // ACT - _, err := gid.AnteHandle(s.Ctx(), tx, false, NextFn) + _, err := gid.AnteHandle(s.Ctx(), tx, false, AnteNextFn) // ASSERT Expect(err).To(HaveOccurred()) @@ -539,7 +539,7 @@ var _ = Describe("InitialDepositDecorator", Ordered, func() { txBuilder := encodingConfig.TxConfig.NewTxBuilder() - content, created := govLegacyTypes.ContentFromProposalType("Text-test", "Descirption", "Text") + content, created := govLegacyTypes.ContentFromProposalType("Text-test", "Description", "Text") Expect(created).To(BeTrue()) submitMsg, govErr := govLegacyTypes.NewMsgSubmitProposal(content, zeroCoins, sdk.MustAccAddressFromBech32(i.ALICE)) @@ -548,10 +548,10 @@ var _ = Describe("InitialDepositDecorator", Ordered, func() { _ = txBuilder.SetMsgs(submitMsg) tx := txBuilder.GetTx() - gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, s.App().GovKeeper) + gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, *s.App().GovKeeper) // ACT - _, err := gid.AnteHandle(s.Ctx(), tx, false, NextFn) + _, err := gid.AnteHandle(s.Ctx(), tx, false, AnteNextFn) // ASSERT Expect(err).To(HaveOccurred()) @@ -566,15 +566,15 @@ var _ = Describe("InitialDepositDecorator", Ordered, func() { txBuilder := encodingConfig.TxConfig.NewTxBuilder() twentyFiveKyveCoins := sdk.NewCoins(sdk.NewCoin(types.Denom, math.NewInt(25_000_000_000))) - submitMsg, govErr := govV1Types.NewMsgSubmitProposal(emptyMsg, twentyFiveKyveCoins, i.ALICE, "metadata") + submitMsg, govErr := govV1Types.NewMsgSubmitProposal(emptyMsg, twentyFiveKyveCoins, i.ALICE, "metadata", "title", "summary") Expect(govErr).ToNot(HaveOccurred()) _ = txBuilder.SetMsgs(submitMsg) tx := txBuilder.GetTx() - gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, s.App().GovKeeper) + gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, *s.App().GovKeeper) // ACT - _, err := gid.AnteHandle(s.Ctx(), tx, false, NextFn) + _, err := gid.AnteHandle(s.Ctx(), tx, false, AnteNextFn) // ASSERT Expect(err).ToNot(HaveOccurred()) @@ -588,7 +588,7 @@ var _ = Describe("InitialDepositDecorator", Ordered, func() { txBuilder := encodingConfig.TxConfig.NewTxBuilder() - content, created := govLegacyTypes.ContentFromProposalType("Text-test", "Descirption", "Text") + content, created := govLegacyTypes.ContentFromProposalType("Text-test", "Description", "Text") Expect(created).To(BeTrue()) twentyFiveKyveCoins := sdk.NewCoins(sdk.NewCoin(types.Denom, math.NewInt(25_000_000_000))) @@ -598,10 +598,10 @@ var _ = Describe("InitialDepositDecorator", Ordered, func() { _ = txBuilder.SetMsgs(submitMsg) tx := txBuilder.GetTx() - gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, s.App().GovKeeper) + gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, *s.App().GovKeeper) // ACT - _, err := gid.AnteHandle(s.Ctx(), tx, false, NextFn) + _, err := gid.AnteHandle(s.Ctx(), tx, false, AnteNextFn) // ASSERT Expect(err).ToNot(HaveOccurred()) diff --git a/x/global/ante_utils_test.go b/x/global/ante_utils_test.go index 3f562d1d..677c0324 100644 --- a/x/global/ante_utils_test.go +++ b/x/global/ante_utils_test.go @@ -4,9 +4,9 @@ import ( "cosmossdk.io/math" amino "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/simapp/params" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/tx" + "github.com/cosmos/ibc-go/v7/testing/simapp/params" ) // BuildEncodingConfig ... @@ -17,7 +17,7 @@ func BuildEncodingConfig() params.EncodingConfig { encodingConfig := params.EncodingConfig{ InterfaceRegistry: interfaceRegistry, - Codec: codec, + Marshaler: codec, TxConfig: tx.NewTxConfig(codec, tx.DefaultSignModes), Amino: cdc, } @@ -49,8 +49,13 @@ type InvalidTx struct{} func (InvalidTx) GetMsgs() []sdk.Msg { return []sdk.Msg{nil} } func (InvalidTx) ValidateBasic() error { return nil } -// NextFn ... -func NextFn(ctx sdk.Context, _ sdk.Tx, _ bool) (sdk.Context, error) { +// AnteNextFn ... +func AnteNextFn(ctx sdk.Context, _ sdk.Tx, _ bool) (sdk.Context, error) { + return ctx, nil +} + +// PostNextFn ... +func PostNextFn(ctx sdk.Context, _ sdk.Tx, _ bool, _ bool) (sdk.Context, error) { return ctx, nil } diff --git a/x/global/keeper/keeper.go b/x/global/keeper/keeper.go index 31427bba..3db2f6cd 100644 --- a/x/global/keeper/keeper.go +++ b/x/global/keeper/keeper.go @@ -4,10 +4,10 @@ import ( "fmt" "github.com/KYVENetwork/chain/x/global/types" + "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" - "github.com/tendermint/tendermint/libs/log" ) type ( diff --git a/x/global/keeper/msg_server_update_params_test.go b/x/global/keeper/msg_server_update_params_test.go index c007c60e..5bc3e1b0 100644 --- a/x/global/keeper/msg_server_update_params_test.go +++ b/x/global/keeper/msg_server_update_params_test.go @@ -48,8 +48,8 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() - minDeposit := s.App().GovKeeper.GetDepositParams(s.Ctx()).MinDeposit - votingPeriod := s.App().GovKeeper.GetVotingParams(s.Ctx()).VotingPeriod + minDeposit := s.App().GovKeeper.GetParams(s.Ctx()).MinDeposit + votingPeriod := s.App().GovKeeper.GetParams(s.Ctx()).VotingPeriod delegations := s.App().StakingKeeper.GetAllDelegations(s.Ctx()) voter := sdk.MustAccAddressFromBech32(delegations[0].DelegatorAddress) @@ -104,7 +104,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -138,7 +138,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -185,7 +185,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -224,7 +224,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -257,7 +257,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -296,7 +296,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -329,7 +329,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -368,7 +368,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -404,7 +404,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -451,7 +451,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -487,7 +487,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -534,7 +534,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -567,7 +567,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -606,7 +606,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT diff --git a/x/global/module.go b/x/global/module.go index 0e633ec3..2c06fd37 100644 --- a/x/global/module.go +++ b/x/global/module.go @@ -5,6 +5,7 @@ import ( "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" @@ -12,7 +13,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" // Auth authKeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" @@ -118,17 +118,9 @@ func NewAppModule( } } -// Deprecated: use RegisterServices -func (am AppModule) Route() sdk.Route { return sdk.Route{} } - // Deprecated: use RegisterServices func (AppModule) QuerierRoute() string { return types.RouterKey } -// Deprecated: use RegisterServices -func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { - return nil -} - // 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)) diff --git a/x/global/post.go b/x/global/post.go index efc83027..3754caa5 100644 --- a/x/global/post.go +++ b/x/global/post.go @@ -31,7 +31,7 @@ func NewRefundFeeDecorator(bk bankKeeper.Keeper, fk feeGrantKeeper.Keeper, gk ke } } -func (rfd RefundFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { +func (rfd RefundFeeDecorator) PostHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, success bool, next sdk.PostHandler) (newCtx sdk.Context, err error) { // Ensure that this is a fee transaction. feeTx, ok := tx.(sdk.FeeTx) if !ok { @@ -43,7 +43,7 @@ func (rfd RefundFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bo fee := feeTx.GetFee() msgs := feeTx.GetMsgs() if fee.IsZero() || len(msgs) != 1 { - return next(ctx, tx, simulate) + return next(ctx, tx, simulate, success) } // Find the refund percentage based on the transaction message type. @@ -58,7 +58,7 @@ func (rfd RefundFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bo // Return early if the refund percentage is zero. if refundPercentage.IsZero() { - return next(ctx, tx, simulate) + return next(ctx, tx, simulate, success) } // Calculate the refund amount. @@ -78,5 +78,5 @@ func (rfd RefundFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bo return ctx, err } - return next(ctx, tx, simulate) + return next(ctx, tx, simulate, success) } diff --git a/x/global/post_test.go b/x/global/post_test.go index 59932b93..09c51ab8 100644 --- a/x/global/post_test.go +++ b/x/global/post_test.go @@ -32,7 +32,7 @@ var _ = Describe("RefundFeeDecorator", Ordered, func() { s := i.NewCleanChain() encodingConfig := BuildEncodingConfig() rfd := global.NewRefundFeeDecorator(s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper) - dfd := global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, s.App().StakingKeeper) + dfd := global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, *s.App().StakingKeeper) denom := s.App().StakingKeeper.BondDenom(s.Ctx()) accountBalanceBefore := s.GetBalanceFromAddress(i.DUMMY[0]) @@ -42,7 +42,7 @@ var _ = Describe("RefundFeeDecorator", Ordered, func() { accountBalanceBefore = s.GetBalanceFromAddress(i.DUMMY[0]) rfd = global.NewRefundFeeDecorator(s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper) - dfd = global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, s.App().StakingKeeper) + dfd = global.NewDeductFeeDecorator(s.App().AccountKeeper, s.App().BankKeeper, s.App().FeeGrantKeeper, s.App().GlobalKeeper, *s.App().StakingKeeper) denom = s.App().StakingKeeper.BondDenom(s.Ctx()) @@ -84,8 +84,8 @@ var _ = Describe("RefundFeeDecorator", Ordered, func() { tx := txBuilder.GetTx() // ACT - _, errAnte := dfd.AnteHandle(s.Ctx(), tx, false, NextFn) - _, errPost := rfd.AnteHandle(s.Ctx(), tx, false, NextFn) + _, errAnte := dfd.AnteHandle(s.Ctx(), tx, false, AnteNextFn) + _, errPost := rfd.PostHandle(s.Ctx(), tx, false, true, PostNextFn) // ASSERT accountBalanceAfter := s.GetBalanceFromAddress(i.ALICE) @@ -109,8 +109,8 @@ var _ = Describe("RefundFeeDecorator", Ordered, func() { tx := txBuilder.GetTx() // ACT - _, errAnte := dfd.AnteHandle(s.Ctx(), tx, false, NextFn) - _, errPost := rfd.AnteHandle(s.Ctx(), tx, false, NextFn) + _, errAnte := dfd.AnteHandle(s.Ctx(), tx, false, AnteNextFn) + _, errPost := rfd.PostHandle(s.Ctx(), tx, false, true, PostNextFn) // ASSERT accountBalanceAfter := s.GetBalanceFromAddress(i.ALICE) @@ -134,8 +134,8 @@ var _ = Describe("RefundFeeDecorator", Ordered, func() { tx := txBuilder.GetTx() // ACT - _, errAnte := dfd.AnteHandle(s.Ctx(), tx, false, NextFn) - _, errPost := rfd.AnteHandle(s.Ctx(), tx, false, NextFn) + _, errAnte := dfd.AnteHandle(s.Ctx(), tx, false, AnteNextFn) + _, errPost := rfd.PostHandle(s.Ctx(), tx, false, true, PostNextFn) // ASSERT accountBalanceAfter := s.GetBalanceFromAddress(i.ALICE) @@ -159,8 +159,8 @@ var _ = Describe("RefundFeeDecorator", Ordered, func() { tx := txBuilder.GetTx() // ACT - _, errAnte := dfd.AnteHandle(s.Ctx(), tx, false, NextFn) - _, errPost := rfd.AnteHandle(s.Ctx(), tx, false, NextFn) + _, errAnte := dfd.AnteHandle(s.Ctx(), tx, false, AnteNextFn) + _, errPost := rfd.PostHandle(s.Ctx(), tx, false, true, PostNextFn) // ASSERT accountBalanceAfter := s.GetBalanceFromAddress(i.ALICE) @@ -184,8 +184,8 @@ var _ = Describe("RefundFeeDecorator", Ordered, func() { tx := txBuilder.GetTx() // ACT - _, errAnte := dfd.AnteHandle(s.Ctx(), tx, false, NextFn) - _, errPost := rfd.AnteHandle(s.Ctx(), tx, false, NextFn) + _, errAnte := dfd.AnteHandle(s.Ctx(), tx, false, AnteNextFn) + _, errPost := rfd.PostHandle(s.Ctx(), tx, false, true, PostNextFn) // ASSERT accountBalanceAfter := s.GetBalanceFromAddress(i.ALICE) @@ -211,8 +211,8 @@ var _ = Describe("RefundFeeDecorator", Ordered, func() { tx := txBuilder.GetTx() // ACT - _, errAnte := dfd.AnteHandle(s.Ctx(), tx, false, NextFn) - _, errPost := rfd.AnteHandle(s.Ctx(), tx, false, NextFn) + _, errAnte := dfd.AnteHandle(s.Ctx(), tx, false, AnteNextFn) + _, errPost := rfd.PostHandle(s.Ctx(), tx, false, true, PostNextFn) // ASSERT accountBalanceAfter := s.GetBalanceFromAddress(i.ALICE) diff --git a/x/global/types/events.pb.go b/x/global/types/events.pb.go index 3c6b587a..d2fe1d4a 100644 --- a/x/global/types/events.pb.go +++ b/x/global/types/events.pb.go @@ -6,7 +6,7 @@ package types import ( fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/global/types/genesis.pb.go b/x/global/types/genesis.pb.go index dbb03001..c18eaff3 100644 --- a/x/global/types/genesis.pb.go +++ b/x/global/types/genesis.pb.go @@ -6,7 +6,7 @@ package types import ( fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/global/types/global.pb.go b/x/global/types/global.pb.go index 7d68e674..f992a53c 100644 --- a/x/global/types/global.pb.go +++ b/x/global/types/global.pb.go @@ -7,7 +7,7 @@ import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/global/types/query.pb.go b/x/global/types/query.pb.go index 145c8c8a..98d63b63 100644 --- a/x/global/types/query.pb.go +++ b/x/global/types/query.pb.go @@ -7,8 +7,8 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" diff --git a/x/global/types/tx.pb.go b/x/global/types/tx.pb.go index f7f9c33b..6b2fe20f 100644 --- a/x/global/types/tx.pb.go +++ b/x/global/types/tx.pb.go @@ -7,8 +7,8 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/x/pool/keeper/keeper.go b/x/pool/keeper/keeper.go index cd9a4dc3..a3a4200b 100644 --- a/x/pool/keeper/keeper.go +++ b/x/pool/keeper/keeper.go @@ -7,7 +7,7 @@ import ( bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" - "github.com/tendermint/tendermint/libs/log" + "github.com/cometbft/cometbft/libs/log" "github.com/KYVENetwork/chain/x/pool/types" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/pool/keeper/keeper_utils_test.go b/x/pool/keeper/keeper_utils_test.go index a053ca10..f13f8866 100644 --- a/x/pool/keeper/keeper_utils_test.go +++ b/x/pool/keeper/keeper_utils_test.go @@ -7,12 +7,12 @@ import ( ) func BuildGovernanceTxs(s *i.KeeperTestSuite, msgs []sdk.Msg) (govV1Types.MsgSubmitProposal, govV1Types.MsgVote) { - minDeposit := s.App().GovKeeper.GetDepositParams(s.Ctx()).MinDeposit + minDeposit := s.App().GovKeeper.GetParams(s.Ctx()).MinDeposit delegations := s.App().StakingKeeper.GetAllDelegations(s.Ctx()) voter := sdk.MustAccAddressFromBech32(delegations[0].DelegatorAddress) proposal, _ := govV1Types.NewMsgSubmitProposal( - msgs, minDeposit, i.DUMMY[0], "", + msgs, minDeposit, i.DUMMY[0], "", "title", "summary", ) proposalId, _ := s.App().GovKeeper.GetProposalID(s.Ctx()) diff --git a/x/pool/keeper/msg_server_cancel_runtime_upgrade_test.go b/x/pool/keeper/msg_server_cancel_runtime_upgrade_test.go index 71d566fa..2924ccfe 100644 --- a/x/pool/keeper/msg_server_cancel_runtime_upgrade_test.go +++ b/x/pool/keeper/msg_server_cancel_runtime_upgrade_test.go @@ -28,7 +28,7 @@ var _ = Describe("msg_server_cancel_runtime_upgrade.go", Ordered, func() { s := i.NewCleanChain() gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() - votingPeriod := s.App().GovKeeper.GetVotingParams(s.Ctx()).VotingPeriod + votingPeriod := s.App().GovKeeper.GetParams(s.Ctx()).VotingPeriod BeforeEach(func() { s = i.NewCleanChain() diff --git a/x/pool/keeper/msg_server_create_pool_test.go b/x/pool/keeper/msg_server_create_pool_test.go index 48ca0692..ae9230aa 100644 --- a/x/pool/keeper/msg_server_create_pool_test.go +++ b/x/pool/keeper/msg_server_create_pool_test.go @@ -27,7 +27,7 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { s := i.NewCleanChain() gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() - votingPeriod := s.App().GovKeeper.GetVotingParams(s.Ctx()).VotingPeriod + votingPeriod := s.App().GovKeeper.GetParams(s.Ctx()).VotingPeriod BeforeEach(func() { s = i.NewCleanChain() diff --git a/x/pool/keeper/msg_server_disable_pool_test.go b/x/pool/keeper/msg_server_disable_pool_test.go index 13fdde32..4ed81bf6 100644 --- a/x/pool/keeper/msg_server_disable_pool_test.go +++ b/x/pool/keeper/msg_server_disable_pool_test.go @@ -35,7 +35,7 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { s := i.NewCleanChain() gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() - votingPeriod := s.App().GovKeeper.GetVotingParams(s.Ctx()).VotingPeriod + votingPeriod := s.App().GovKeeper.GetParams(s.Ctx()).VotingPeriod BeforeEach(func() { s = i.NewCleanChain() diff --git a/x/pool/keeper/msg_server_enable_pool_test.go b/x/pool/keeper/msg_server_enable_pool_test.go index ab0fbc73..27dffc78 100644 --- a/x/pool/keeper/msg_server_enable_pool_test.go +++ b/x/pool/keeper/msg_server_enable_pool_test.go @@ -30,7 +30,7 @@ var _ = Describe("msg_server_enable_pool.go", Ordered, func() { s := i.NewCleanChain() gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() - votingPeriod := s.App().GovKeeper.GetVotingParams(s.Ctx()).VotingPeriod + votingPeriod := s.App().GovKeeper.GetParams(s.Ctx()).VotingPeriod BeforeEach(func() { s = i.NewCleanChain() diff --git a/x/pool/keeper/msg_server_schedule_runtime_upgrade_test.go b/x/pool/keeper/msg_server_schedule_runtime_upgrade_test.go index cd3f0386..32caece2 100644 --- a/x/pool/keeper/msg_server_schedule_runtime_upgrade_test.go +++ b/x/pool/keeper/msg_server_schedule_runtime_upgrade_test.go @@ -31,7 +31,7 @@ var _ = Describe("msg_server_schedule_runtime_upgrade.go", Ordered, func() { s := i.NewCleanChain() gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() - votingPeriod := s.App().GovKeeper.GetVotingParams(s.Ctx()).VotingPeriod + votingPeriod := s.App().GovKeeper.GetParams(s.Ctx()).VotingPeriod BeforeEach(func() { s = i.NewCleanChain() diff --git a/x/pool/keeper/msg_server_update_pool_test.go b/x/pool/keeper/msg_server_update_pool_test.go index c212e292..27a9cf3b 100644 --- a/x/pool/keeper/msg_server_update_pool_test.go +++ b/x/pool/keeper/msg_server_update_pool_test.go @@ -28,7 +28,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { s := i.NewCleanChain() gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() - votingPeriod := s.App().GovKeeper.GetVotingParams(s.Ctx()).VotingPeriod + votingPeriod := s.App().GovKeeper.GetParams(s.Ctx()).VotingPeriod BeforeEach(func() { s = i.NewCleanChain() diff --git a/x/pool/module.go b/x/pool/module.go index bb003ede..02d06817 100644 --- a/x/pool/module.go +++ b/x/pool/module.go @@ -8,7 +8,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/KYVENetwork/chain/x/pool/client/cli" "github.com/KYVENetwork/chain/x/pool/keeper" @@ -108,17 +108,9 @@ func NewAppModule( } } -// Deprecated: use RegisterServices -func (am AppModule) Route() sdk.Route { return sdk.Route{} } - // Deprecated: use RegisterServices func (AppModule) QuerierRoute() string { return types.RouterKey } -// Deprecated: use RegisterServices -func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { - return nil -} - // 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)) diff --git a/x/pool/types/events.pb.go b/x/pool/types/events.pb.go index 6a5908c1..dc1213d8 100644 --- a/x/pool/types/events.pb.go +++ b/x/pool/types/events.pb.go @@ -5,7 +5,7 @@ package types import ( fmt "fmt" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/pool/types/genesis.pb.go b/x/pool/types/genesis.pb.go index 74c70044..a79e1bfb 100644 --- a/x/pool/types/genesis.pb.go +++ b/x/pool/types/genesis.pb.go @@ -6,7 +6,7 @@ package types import ( fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/pool/types/pool.pb.go b/x/pool/types/pool.pb.go index d4bda31d..27ae02e5 100644 --- a/x/pool/types/pool.pb.go +++ b/x/pool/types/pool.pb.go @@ -6,7 +6,7 @@ package types import ( fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/pool/types/tx.pb.go b/x/pool/types/tx.pb.go index 161f9336..9f03faf0 100644 --- a/x/pool/types/tx.pb.go +++ b/x/pool/types/tx.pb.go @@ -7,8 +7,8 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/x/query/keeper/grpc_params.go b/x/query/keeper/grpc_params.go index cec84da6..00a20994 100644 --- a/x/query/keeper/grpc_params.go +++ b/x/query/keeper/grpc_params.go @@ -3,14 +3,10 @@ package keeper import ( "context" + "github.com/KYVENetwork/chain/x/query/types" sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - - // Gov - govTypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - // Query - "github.com/KYVENetwork/chain/x/query/types" ) func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { @@ -22,15 +18,8 @@ func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*t bp := k.bundleKeeper.GetParams(ctx) dp := k.delegationKeeper.GetParams(ctx) globalParams := k.globalKeeper.GetParams(ctx) - govParams := govTypes.QueryParamsResponse{} + govParams := k.govKeeper.GetParams(ctx) sp := k.stakerKeeper.GetParams(ctx) - govVotingParams := k.govKeeper.GetVotingParams(ctx) - govParams.VotingParams = &govVotingParams - govDepositParams := k.govKeeper.GetDepositParams(ctx) - govParams.DepositParams = &govDepositParams - govTallyParams := k.govKeeper.GetTallyParams(ctx) - govParams.TallyParams = &govTallyParams - return &types.QueryParamsResponse{BundlesParams: &bp, DelegationParams: &dp, GlobalParams: &globalParams, GovParams: &govParams, StakersParams: &sp}, nil } diff --git a/x/query/keeper/keeper.go b/x/query/keeper/keeper.go index 3facf8f2..570911f4 100644 --- a/x/query/keeper/keeper.go +++ b/x/query/keeper/keeper.go @@ -15,7 +15,7 @@ import ( bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" - "github.com/tendermint/tendermint/libs/log" + "github.com/cometbft/cometbft/libs/log" "github.com/KYVENetwork/chain/x/query/types" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/query/module.go b/x/query/module.go index df0d0bd5..6997f108 100644 --- a/x/query/module.go +++ b/x/query/module.go @@ -8,7 +8,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/KYVENetwork/chain/x/query/client/cli" "github.com/KYVENetwork/chain/x/query/keeper" @@ -106,17 +106,9 @@ func NewAppModule( } } -// Deprecated: use RegisterServices -func (am AppModule) Route() sdk.Route { return sdk.Route{} } - // Deprecated: use RegisterServices func (AppModule) QuerierRoute() string { return types.RouterKey } -// Deprecated: use RegisterServices -func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { - return nil -} - // RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryAccountServer(cfg.QueryServer(), am.keeper) diff --git a/x/query/types/account.pb.go b/x/query/types/account.pb.go index 369268b8..89fcd5d2 100644 --- a/x/query/types/account.pb.go +++ b/x/query/types/account.pb.go @@ -8,8 +8,8 @@ import ( fmt "fmt" query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" diff --git a/x/query/types/bundles.pb.go b/x/query/types/bundles.pb.go index 94991af3..b135c24a 100644 --- a/x/query/types/bundles.pb.go +++ b/x/query/types/bundles.pb.go @@ -9,8 +9,8 @@ import ( types "github.com/KYVENetwork/chain/x/bundles/types" query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" diff --git a/x/query/types/delegation.pb.go b/x/query/types/delegation.pb.go index 8873c1b4..0a35418a 100644 --- a/x/query/types/delegation.pb.go +++ b/x/query/types/delegation.pb.go @@ -8,8 +8,8 @@ import ( fmt "fmt" query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" diff --git a/x/query/types/params.pb.go b/x/query/types/params.pb.go index 875a8a42..99c68870 100644 --- a/x/query/types/params.pb.go +++ b/x/query/types/params.pb.go @@ -11,8 +11,8 @@ import ( types2 "github.com/KYVENetwork/chain/x/global/types" types3 "github.com/KYVENetwork/chain/x/stakers/types" v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -79,7 +79,7 @@ type QueryParamsResponse struct { // global_params ... GlobalParams *types2.Params `protobuf:"bytes,3,opt,name=global_params,json=globalParams,proto3" json:"global_params,omitempty"` // gov_params ... - GovParams *v1.QueryParamsResponse `protobuf:"bytes,4,opt,name=gov_params,json=govParams,proto3" json:"gov_params,omitempty"` + GovParams *v1.Params `protobuf:"bytes,4,opt,name=gov_params,json=govParams,proto3" json:"gov_params,omitempty"` // stakers_params ... StakersParams *types3.Params `protobuf:"bytes,5,opt,name=stakers_params,json=stakersParams,proto3" json:"stakers_params,omitempty"` } @@ -138,7 +138,7 @@ func (m *QueryParamsResponse) GetGlobalParams() *types2.Params { return nil } -func (m *QueryParamsResponse) GetGovParams() *v1.QueryParamsResponse { +func (m *QueryParamsResponse) GetGovParams() *v1.Params { if m != nil { return m.GovParams } @@ -160,34 +160,34 @@ func init() { func init() { proto.RegisterFile("kyve/query/v1beta1/params.proto", fileDescriptor_b5269c0a69f1d3d4) } var fileDescriptor_b5269c0a69f1d3d4 = []byte{ - // 427 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xbf, 0x8e, 0xd3, 0x40, - 0x10, 0xc6, 0xe3, 0x00, 0x91, 0xd8, 0x90, 0x08, 0x0c, 0x05, 0x98, 0xc8, 0x09, 0x16, 0x02, 0x44, - 0xb1, 0x2b, 0x87, 0x17, 0x00, 0x02, 0x15, 0x08, 0x41, 0x0a, 0x24, 0x68, 0xd0, 0x3a, 0x59, 0x6d, - 0xac, 0x38, 0x1e, 0xc7, 0xbb, 0x5e, 0x48, 0x41, 0x43, 0x4d, 0x81, 0xc4, 0x4b, 0x51, 0x46, 0xa2, - 0xa1, 0x44, 0xc9, 0x3d, 0xc1, 0x3d, 0xc1, 0x29, 0xbb, 0xeb, 0xcb, 0x3f, 0x9f, 0xae, 0xf3, 0xcc, - 0x7c, 0xf3, 0x9b, 0xf1, 0xb7, 0x83, 0xba, 0xd3, 0x85, 0x62, 0x64, 0x5e, 0xb0, 0x7c, 0x41, 0x54, - 0x18, 0x31, 0x49, 0x43, 0x92, 0xd1, 0x9c, 0xce, 0x04, 0xce, 0x72, 0x90, 0xe0, 0xba, 0x1b, 0x01, - 0xd6, 0x02, 0x6c, 0x05, 0xde, 0xbd, 0x11, 0x88, 0x19, 0x08, 0xc2, 0x41, 0x11, 0x15, 0x9a, 0x6e, - 0x23, 0xf7, 0x3a, 0x1c, 0x80, 0x27, 0x8c, 0xd0, 0x2c, 0x26, 0x34, 0x4d, 0x41, 0x52, 0x19, 0x43, - 0x6a, 0x61, 0xde, 0x03, 0x3d, 0x2d, 0x2a, 0xd2, 0x71, 0xc2, 0x44, 0xe5, 0x3c, 0xef, 0xa1, 0x96, - 0x8c, 0x59, 0xc2, 0xb8, 0x6e, 0xad, 0x56, 0xf5, 0xb4, 0x8a, 0x27, 0x10, 0xd1, 0xe4, 0x5c, 0x61, - 0xc2, 0xbd, 0x51, 0x42, 0xd2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, 0x9d, 0xff, 0x2b, 0xdf, 0xf9, 0xb5, - 0xf6, 0x6b, 0xcb, 0xb5, 0x5f, 0xfb, 0xb7, 0xf6, 0x6b, 0x9f, 0x9f, 0xf2, 0x58, 0x4e, 0x8a, 0x08, - 0x8f, 0x60, 0x46, 0xde, 0x7c, 0xfa, 0xf8, 0xfa, 0x1d, 0x93, 0x5f, 0x21, 0x9f, 0x92, 0xd1, 0x84, - 0xc6, 0x29, 0xf9, 0x66, 0x71, 0x72, 0x91, 0x31, 0x11, 0x35, 0xf4, 0x99, 0x3d, 0x3b, 0x0b, 0x00, - 0x00, 0xff, 0xff, 0x49, 0x98, 0xf2, 0x4c, 0x64, 0x03, 0x00, 0x00, + // 426 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x4f, 0x4f, 0xdb, 0x30, + 0x18, 0xc6, 0x9b, 0x6e, 0xab, 0x34, 0x77, 0xad, 0xb6, 0x6c, 0xd3, 0xa6, 0xac, 0x4a, 0xbb, 0x68, + 0xda, 0x26, 0x0e, 0xb6, 0x5a, 0xf8, 0x00, 0x88, 0xc2, 0x09, 0x84, 0x80, 0x03, 0x12, 0x5c, 0x90, + 0xd3, 0x5a, 0x6e, 0xd4, 0x34, 0x4e, 0x63, 0x27, 0xd0, 0x03, 0x17, 0xce, 0x1c, 0x90, 0xf8, 0x52, + 0x1c, 0x2b, 0x71, 0xe1, 0x88, 0x5a, 0xf8, 0x1e, 0x28, 0xb6, 0xd3, 0xff, 0x88, 0x53, 0xeb, 0xf7, + 0x7d, 0x9e, 0xdf, 0x1b, 0x3f, 0xaf, 0x41, 0xb5, 0x3b, 0x48, 0x08, 0xea, 0xc7, 0x24, 0x1a, 0xa0, + 0xa4, 0xee, 0x12, 0x81, 0xeb, 0x28, 0xc4, 0x11, 0xee, 0x71, 0x18, 0x46, 0x4c, 0x30, 0xd3, 0x4c, + 0x05, 0x50, 0x0a, 0xa0, 0x16, 0x58, 0x3f, 0x5a, 0x8c, 0xf7, 0x18, 0x47, 0x94, 0x25, 0x28, 0xa9, + 0xa7, 0x3f, 0x4a, 0x6c, 0x55, 0x28, 0x63, 0xd4, 0x27, 0x08, 0x87, 0x1e, 0xc2, 0x41, 0xc0, 0x04, + 0x16, 0x1e, 0x0b, 0x34, 0xca, 0xfa, 0x2d, 0x67, 0xb9, 0x71, 0xd0, 0xf6, 0x09, 0x5f, 0x39, 0xcd, + 0xfa, 0x23, 0x25, 0x6d, 0xe2, 0x13, 0x2a, 0xad, 0xab, 0x55, 0x35, 0xa9, 0xa2, 0x3e, 0x73, 0xb1, + 0x3f, 0x51, 0xa8, 0xe3, 0xdc, 0x28, 0x2e, 0x70, 0x97, 0x44, 0xab, 0x47, 0x39, 0xdf, 0x80, 0x79, + 0x98, 0xde, 0xea, 0x40, 0x16, 0x8f, 0x48, 0x3f, 0x26, 0x5c, 0x38, 0xcf, 0x79, 0xf0, 0x75, 0xae, + 0xcc, 0x43, 0x16, 0x70, 0x62, 0x36, 0x41, 0x59, 0x7f, 0xf8, 0x99, 0xa2, 0xfc, 0x34, 0x6a, 0xc6, + 0xff, 0x62, 0xa3, 0x02, 0x65, 0x3e, 0xba, 0x97, 0x25, 0x04, 0xb5, 0xbb, 0xa4, 0xeb, 0xea, 0x68, + 0xee, 0x81, 0x2f, 0xd3, 0xab, 0x65, 0x9c, 0xbc, 0xe4, 0x54, 0x15, 0x67, 0xda, 0x5e, 0x44, 0x7d, + 0x9e, 0xb6, 0x34, 0x6d, 0x13, 0x94, 0xd4, 0x9d, 0x33, 0xd2, 0x3b, 0x49, 0xfa, 0xa5, 0x48, 0x3a, + 0x8e, 0x05, 0xca, 0x27, 0x55, 0xd6, 0x84, 0x0d, 0x00, 0x28, 0x4b, 0x32, 0xfb, 0x7b, 0x69, 0xff, + 0x0e, 0xd5, 0x72, 0x61, 0xba, 0xd5, 0x64, 0x62, 0xfc, 0x48, 0x59, 0xa2, 0x5d, 0x4d, 0x50, 0xd6, + 0xc1, 0x66, 0xce, 0x0f, 0xb3, 0x51, 0xe8, 0xde, 0x52, 0x14, 0xba, 0xae, 0x8e, 0x8d, 0x6b, 0x03, + 0x14, 0x67, 0x72, 0x36, 0x2f, 0x41, 0x41, 0xff, 0xfb, 0x0b, 0x97, 0x5f, 0x1c, 0x5c, 0xde, 0x94, + 0xf5, 0xef, 0x4d, 0x9d, 0x5a, 0x9d, 0xe3, 0x5c, 0xdd, 0x3f, 0xdd, 0xe6, 0x2b, 0xa6, 0x85, 0x5e, + 0x7d, 0xeb, 0x5b, 0xdb, 0x77, 0x23, 0xdb, 0x18, 0x8e, 0x6c, 0xe3, 0x71, 0x64, 0x1b, 0x37, 0x63, + 0x3b, 0x37, 0x1c, 0xdb, 0xb9, 0x87, 0xb1, 0x9d, 0x3b, 0x5d, 0xa3, 0x9e, 0xe8, 0xc4, 0x2e, 0x6c, + 0xb1, 0x1e, 0xda, 0x3d, 0x39, 0xde, 0xd9, 0x27, 0xe2, 0x9c, 0x45, 0x5d, 0xd4, 0xea, 0x60, 0x2f, + 0x40, 0x17, 0x1a, 0x27, 0x06, 0x21, 0xe1, 0x6e, 0x41, 0xbe, 0xac, 0xf5, 0x97, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xdb, 0x64, 0x66, 0xff, 0x55, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -650,7 +650,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.GovParams == nil { - m.GovParams = &v1.QueryParamsResponse{} + m.GovParams = &v1.Params{} } if err := m.GovParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/x/query/types/pools.pb.go b/x/query/types/pools.pb.go index 636be4ad..938e6be3 100644 --- a/x/query/types/pools.pb.go +++ b/x/query/types/pools.pb.go @@ -10,8 +10,8 @@ import ( types "github.com/KYVENetwork/chain/x/pool/types" query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" diff --git a/x/query/types/query.pb.go b/x/query/types/query.pb.go index 67a036dd..b30446d7 100644 --- a/x/query/types/query.pb.go +++ b/x/query/types/query.pb.go @@ -8,7 +8,7 @@ import ( types "github.com/KYVENetwork/chain/x/pool/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/query/types/stakers.pb.go b/x/query/types/stakers.pb.go index 19a91220..b3fe0f79 100644 --- a/x/query/types/stakers.pb.go +++ b/x/query/types/stakers.pb.go @@ -9,8 +9,8 @@ import ( types "github.com/KYVENetwork/chain/x/stakers/types" query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" diff --git a/x/stakers/keeper/exported_functions_test.go b/x/stakers/keeper/exported_functions_test.go index 62e97845..3bb9fa44 100644 --- a/x/stakers/keeper/exported_functions_test.go +++ b/x/stakers/keeper/exported_functions_test.go @@ -166,10 +166,10 @@ var _ = Describe("Protocol Governance Voting", Ordered, func() { }) func CreateTestProposal(ctx sdk.Context, keepers kyveApp.Keepers) sdk.Msg { - minDeposit := keepers.GovKeeper.GetDepositParams(ctx).MinDeposit + minDeposit := keepers.GovKeeper.GetParams(ctx).MinDeposit proposal, _ := govTypes.NewMsgSubmitProposal( - []sdk.Msg{}, minDeposit, i.DUMMY[0], "ipfs://CID", + []sdk.Msg{}, minDeposit, i.DUMMY[0], "metadata", "title", "summary", ) return proposal diff --git a/x/stakers/keeper/keeper.go b/x/stakers/keeper/keeper.go index 7e8dabe9..48d46728 100644 --- a/x/stakers/keeper/keeper.go +++ b/x/stakers/keeper/keeper.go @@ -4,7 +4,7 @@ import ( "fmt" delegationKeeper "github.com/KYVENetwork/chain/x/delegation/keeper" - "github.com/tendermint/tendermint/libs/log" + "github.com/cometbft/cometbft/libs/log" "github.com/KYVENetwork/chain/x/stakers/types" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/stakers/keeper/msg_server_update_params_test.go b/x/stakers/keeper/msg_server_update_params_test.go index c4ee172f..7108b2af 100644 --- a/x/stakers/keeper/msg_server_update_params_test.go +++ b/x/stakers/keeper/msg_server_update_params_test.go @@ -40,8 +40,8 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() - minDeposit := s.App().GovKeeper.GetDepositParams(s.Ctx()).MinDeposit - votingPeriod := s.App().GovKeeper.GetVotingParams(s.Ctx()).VotingPeriod + minDeposit := s.App().GovKeeper.GetParams(s.Ctx()).MinDeposit + votingPeriod := s.App().GovKeeper.GetParams(s.Ctx()).VotingPeriod delegations := s.App().StakingKeeper.GetAllDelegations(s.Ctx()) voter := sdk.MustAccAddressFromBech32(delegations[0].DelegatorAddress) @@ -87,7 +87,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -111,7 +111,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -145,7 +145,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -181,7 +181,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -211,7 +211,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -247,7 +247,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT @@ -277,7 +277,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) vote := govV1Types.NewMsgVote( @@ -313,7 +313,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { } proposal, _ := govV1Types.NewMsgSubmitProposal( - []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", ) // ACT diff --git a/x/stakers/module.go b/x/stakers/module.go index 655bc218..e97868fe 100644 --- a/x/stakers/module.go +++ b/x/stakers/module.go @@ -9,7 +9,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/KYVENetwork/chain/x/stakers/client/cli" "github.com/KYVENetwork/chain/x/stakers/keeper" @@ -110,17 +110,9 @@ func NewAppModule( } } -// Deprecated: use RegisterServices -func (am AppModule) Route() sdk.Route { return sdk.Route{} } - // Deprecated: use RegisterServices func (AppModule) QuerierRoute() string { return types.RouterKey } -// Deprecated: use RegisterServices -func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { - return nil -} - // 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)) diff --git a/x/stakers/types/events.pb.go b/x/stakers/types/events.pb.go index 757b8f7e..0516f257 100644 --- a/x/stakers/types/events.pb.go +++ b/x/stakers/types/events.pb.go @@ -7,7 +7,7 @@ import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/stakers/types/genesis.pb.go b/x/stakers/types/genesis.pb.go index 4b6b0473..4786bc8f 100644 --- a/x/stakers/types/genesis.pb.go +++ b/x/stakers/types/genesis.pb.go @@ -6,7 +6,7 @@ package types import ( fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/stakers/types/params.pb.go b/x/stakers/types/params.pb.go index d765da61..44ba4821 100644 --- a/x/stakers/types/params.pb.go +++ b/x/stakers/types/params.pb.go @@ -5,7 +5,7 @@ package types import ( fmt "fmt" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/stakers/types/query.pb.go b/x/stakers/types/query.pb.go index f7b98254..68540d38 100644 --- a/x/stakers/types/query.pb.go +++ b/x/stakers/types/query.pb.go @@ -7,8 +7,8 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" diff --git a/x/stakers/types/stakers.pb.go b/x/stakers/types/stakers.pb.go index ae6ac79c..a42bb643 100644 --- a/x/stakers/types/stakers.pb.go +++ b/x/stakers/types/stakers.pb.go @@ -7,7 +7,7 @@ import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/stakers/types/tx.pb.go b/x/stakers/types/tx.pb.go index 4a5d5aaa..d0e80717 100644 --- a/x/stakers/types/tx.pb.go +++ b/x/stakers/types/tx.pb.go @@ -9,8 +9,8 @@ import ( _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/x/team/keeper/keeper.go b/x/team/keeper/keeper.go index 86bf8874..00cfba81 100644 --- a/x/team/keeper/keeper.go +++ b/x/team/keeper/keeper.go @@ -3,10 +3,10 @@ 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" - "github.com/tendermint/tendermint/libs/log" // Auth authKeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" diff --git a/x/team/module.go b/x/team/module.go index 4266c8db..b41e3ea6 100644 --- a/x/team/module.go +++ b/x/team/module.go @@ -5,6 +5,7 @@ import ( "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" @@ -12,7 +13,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" // Bank bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -118,17 +118,9 @@ func NewAppModule( } } -// Deprecated: use RegisterServices -func (am AppModule) Route() sdk.Route { return sdk.Route{} } - // Deprecated: use RegisterServices func (AppModule) QuerierRoute() string { return types.RouterKey } -// Deprecated: use RegisterServices -func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { - return nil -} - // 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)) diff --git a/x/team/types/events.pb.go b/x/team/types/events.pb.go index 75c5b521..94664cc4 100644 --- a/x/team/types/events.pb.go +++ b/x/team/types/events.pb.go @@ -5,7 +5,7 @@ package types import ( fmt "fmt" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/team/types/genesis.pb.go b/x/team/types/genesis.pb.go index 0fcb0f15..2f99c3c7 100644 --- a/x/team/types/genesis.pb.go +++ b/x/team/types/genesis.pb.go @@ -6,7 +6,7 @@ package types import ( fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/team/types/query.pb.go b/x/team/types/query.pb.go index 3a078003..69ad0984 100644 --- a/x/team/types/query.pb.go +++ b/x/team/types/query.pb.go @@ -7,8 +7,8 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" diff --git a/x/team/types/team.pb.go b/x/team/types/team.pb.go index e2b7a217..c2493a0b 100644 --- a/x/team/types/team.pb.go +++ b/x/team/types/team.pb.go @@ -5,7 +5,7 @@ package types import ( fmt "fmt" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/team/types/tx.pb.go b/x/team/types/tx.pb.go index ff1e7f87..56835c0b 100644 --- a/x/team/types/tx.pb.go +++ b/x/team/types/tx.pb.go @@ -7,8 +7,8 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" From b8f8ab1535c2ae3c96c634f2c2eeb8d3bf5a847e Mon Sep 17 00:00:00 2001 From: John Letey Date: Thu, 27 Apr 2023 19:47:59 +0200 Subject: [PATCH 002/109] chore: work on upgrade logic --- CHANGELOG.md | 4 + app/ante.go | 9 +- app/app.go | 13 +- app/upgrades/v1_2/constants.go | 16 +++ app/upgrades/v1_2/store.go | 12 +- app/upgrades/v1_2/upgrade.go | 17 +++ go.mod | 14 +-- go.sum | 24 ++-- x/global/ante.go | 67 ---------- x/global/ante_test.go | 216 +-------------------------------- 10 files changed, 82 insertions(+), 310 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d22e6850..6a9cf899 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ ## [Unreleased] +### Features + +- [#33](https://github.com/KYVENetwork/chain/pull/33) Upgrade Cosmos SDK to [v0.47.2](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.2) ([`v0.47.2-kyve-rc0`](https://github.com/KYVENetwork/cosmos-sdk/releases/tag/v0.47.2-kyve-rc0)). + ## [v1.1.0](https://github.com/KYVENetwork/chain/releases/tag/v1.1.0) - 2023-04-18 ### Improvements diff --git a/app/ante.go b/app/ante.go index 3d5efad3..65c243a0 100644 --- a/app/ante.go +++ b/app/ante.go @@ -14,8 +14,7 @@ import ( // Global "github.com/KYVENetwork/chain/x/global" globalKeeper "github.com/KYVENetwork/chain/x/global/keeper" - // Gov - govKeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + // IBC ibcAnte "github.com/cosmos/ibc-go/v7/modules/core/ante" ibcKeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" @@ -23,14 +22,13 @@ import ( stakingKeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" ) -// https://github.com/cosmos/cosmos-sdk/blob/release/v0.46.x/x/auth/ante/ante.go#L25 +// https://github.com/cosmos/cosmos-sdk/blob/release/v0.47.x/x/auth/ante/ante.go#L25 func NewAnteHandler( accountKeeper authKeeper.AccountKeeper, bankKeeper bankKeeper.Keeper, feeGrantKeeper feeGrantKeeper.Keeper, globalKeeper globalKeeper.Keeper, - govKeeper govKeeper.Keeper, ibcKeeper *ibcKeeper.Keeper, stakingKeeper stakingKeeper.Keeper, sigGasConsumer ante.SignatureVerificationGasConsumer, @@ -40,8 +38,6 @@ func NewAnteHandler( gasAdjustmentDecorator := global.NewGasAdjustmentDecorator(globalKeeper) - initialDepositDecorator := global.NewInitialDepositDecorator(globalKeeper, govKeeper) - anteDecorators := []sdk.AnteDecorator{ ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first gasAdjustmentDecorator, @@ -57,7 +53,6 @@ func NewAnteHandler( ante.NewSigVerificationDecorator(accountKeeper, signModeHandler), ante.NewIncrementSequenceDecorator(accountKeeper), ibcAnte.NewRedundantRelayDecorator(ibcKeeper), - initialDepositDecorator, } return sdk.ChainAnteDecorators(anteDecorators...), nil diff --git a/app/app.go b/app/app.go index f0f0954d..aadf7b04 100644 --- a/app/app.go +++ b/app/app.go @@ -7,7 +7,7 @@ import ( "os" "path/filepath" - v12 "github.com/KYVENetwork/chain/app/upgrades/v1_2" + v1p2 "github.com/KYVENetwork/chain/app/upgrades/v1_2" dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/log" @@ -819,7 +819,6 @@ func NewKYVEApp( app.BankKeeper, app.FeeGrantKeeper, app.GlobalKeeper, - *app.GovKeeper, app.IBCKeeper, *app.StakingKeeper, ante.DefaultSigVerificationGasConsumer, @@ -845,10 +844,12 @@ func NewKYVEApp( app.SetEndBlocker(app.EndBlocker) app.UpgradeKeeper.SetUpgradeHandler( - v12.UpgradeName, - v12.CreateUpgradeHandler( + v1p2.UpgradeName, + v1p2.CreateUpgradeHandler( app.mm, app.configurator, + app.ConsensusKeeper, + app.ParamsKeeper, ), ) @@ -857,8 +858,8 @@ func NewKYVEApp( panic(err) } - if upgradeInfo.Name == v12.UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - app.SetStoreLoader(v12.CreateStoreLoader(upgradeInfo.Height)) + if upgradeInfo.Name == v1p2.UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + app.SetStoreLoader(v1p2.CreateStoreLoader(upgradeInfo.Height)) } if loadLatest { diff --git a/app/upgrades/v1_2/constants.go b/app/upgrades/v1_2/constants.go index e6d65b86..a3ce0b2d 100644 --- a/app/upgrades/v1_2/constants.go +++ b/app/upgrades/v1_2/constants.go @@ -8,3 +8,19 @@ const TestnetChainID = "kaon-1" // MainnetChainID is the Chain ID of the KYVE mainnet. const MainnetChainID = "kyve-1" + +// TestnetProposers is a mapping between Proposal ID and Proposer Address for +// the KYVE testnet (Kaon). +var TestnetProposers = map[uint64]string{ + 1: "kyve1qfnu3k5vwgfyzsaqe0w4ssqp99delgtg2qz0jc", + 2: "kyve1qfnu3k5vwgfyzsaqe0w4ssqp99delgtg2qz0jc", + 3: "kyve1qfnu3k5vwgfyzsaqe0w4ssqp99delgtg2qz0jc", + 4: "kyve1qfnu3k5vwgfyzsaqe0w4ssqp99delgtg2qz0jc", +} + +// MainnetProposers is a mapping between Proposal ID and Proposer Address for +// the KYVE mainnet. +var MainnetProposers = map[uint64]string{ + 1: "kyve1afu42029ujjcja4yry3rx6x43k33k88ep5wvjz", + 2: "kyve1afu42029ujjcja4yry3rx6x43k33k88ep5wvjz", +} diff --git a/app/upgrades/v1_2/store.go b/app/upgrades/v1_2/store.go index 92e0836e..8e8d710f 100644 --- a/app/upgrades/v1_2/store.go +++ b/app/upgrades/v1_2/store.go @@ -3,11 +3,21 @@ package v1_2 import ( "github.com/cosmos/cosmos-sdk/baseapp" storeTypes "github.com/cosmos/cosmos-sdk/store/types" + + // Consensus + consensusTypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + // Crisis + crisisTypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + // Upgrade upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) func CreateStoreLoader(upgradeHeight int64) baseapp.StoreLoader { - storeUpgrades := storeTypes.StoreUpgrades{} + storeUpgrades := storeTypes.StoreUpgrades{ + Added: []string{ + consensusTypes.StoreKey, crisisTypes.StoreKey, + }, + } return upgradeTypes.UpgradeStoreLoader(upgradeHeight, &storeUpgrades) } diff --git a/app/upgrades/v1_2/upgrade.go b/app/upgrades/v1_2/upgrade.go index a7d45921..95f6476e 100644 --- a/app/upgrades/v1_2/upgrade.go +++ b/app/upgrades/v1_2/upgrade.go @@ -1,16 +1,33 @@ package v1_2 import ( + "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + + // Consensus + consensusKeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" + // Params + paramsKeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + paramsTypes "github.com/cosmos/cosmos-sdk/x/params/types" + // Upgrade upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) func CreateUpgradeHandler( mm *module.Manager, configurator module.Configurator, + consensusKeeper consensusKeeper.Keeper, + paramsKeeper paramsKeeper.Keeper, ) upgradeTypes.UpgradeHandler { return func(ctx sdk.Context, _ upgradeTypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + // Migrate consensus parameters from x/params to dedicated x/consensus module. + baseAppSubspace := paramsKeeper.Subspace(baseapp.Paramspace). + WithKeyTable(paramsTypes.ConsensusParamsKeyTable()) + baseapp.MigrateParams(ctx, baseAppSubspace, &consensusKeeper) + + // TODO: Migrate MinInitialDepositRatio from x/global to x/gov. + return mm.RunMigrations(ctx, configurator, vm) } } diff --git a/go.mod b/go.mod index a3b143e7..93634afa 100644 --- a/go.mod +++ b/go.mod @@ -5,11 +5,11 @@ go 1.20 require ( cosmossdk.io/errors v1.0.0-beta.7 cosmossdk.io/math v1.0.0 - github.com/cometbft/cometbft v0.37.0 + github.com/cometbft/cometbft v0.37.1 github.com/cometbft/cometbft-db v0.7.0 github.com/cosmos/cosmos-proto v1.0.0-beta.2 - github.com/cosmos/cosmos-sdk v0.47.1 - github.com/cosmos/gogoproto v1.4.6 + github.com/cosmos/cosmos-sdk v0.47.2 + github.com/cosmos/gogoproto v1.4.8 github.com/cosmos/ibc-go/v7 v7.0.0 github.com/ethereum/go-ethereum v1.10.22 github.com/golang/protobuf v1.5.3 @@ -22,7 +22,7 @@ require ( github.com/spf13/viper v1.15.0 github.com/stretchr/testify v1.8.2 google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44 - google.golang.org/grpc v1.53.0 + google.golang.org/grpc v1.54.0 mvdan.cc/gofumpt v0.5.0 ) @@ -155,7 +155,7 @@ require ( 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.0 // 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 @@ -294,7 +294,7 @@ require ( golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.110.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/protobuf v1.29.1 // indirect + google.golang.org/protobuf v1.30.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -309,7 +309,7 @@ require ( replace ( // use kyve flavored cosmos/cosmos-sdk - github.com/cosmos/cosmos-sdk => github.com/KYVENetwork/cosmos-sdk v0.47.1-kyve-rc0 + github.com/cosmos/cosmos-sdk => github.com/KYVENetwork/cosmos-sdk v0.47.2-kyve-rc0 // use cosmos flavored gogo/protobuf // https://github.com/cosmos/cosmos-sdk/issues/8469 diff --git a/go.sum b/go.sum index bb94b1e9..c5262e5d 100644 --- a/go.sum +++ b/go.sum @@ -241,8 +241,8 @@ github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rW github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 h1:+r1rSv4gvYn0wmRjC8X7IAzX8QezqtFV9m0MUHFJgts= github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0/go.mod h1:b3g59n2Y+T5xmcxJL+UEG2f8cQploZm1mR/v6BW0mU0= -github.com/KYVENetwork/cosmos-sdk v0.47.1-kyve-rc0 h1:goRWhqgQQS6yqssXk3YLDkJu74sfPtOGBLpBP4LZ0sE= -github.com/KYVENetwork/cosmos-sdk v0.47.1-kyve-rc0/go.mod h1:14tO5KQaTrl2q3OxBnDRfue7TRN9zkXS0cLutrSqkOo= +github.com/KYVENetwork/cosmos-sdk v0.47.2-kyve-rc0 h1:nBpV+Jh5PqjhYnzxSWEVhGm7Af7OBiriGtV8QAcHAYs= +github.com/KYVENetwork/cosmos-sdk v0.47.2-kyve-rc0/go.mod h1:zYzgI8w8hhotXTSoGbbSOAKfpJTx4wOy4XgbaKhtRtc= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= @@ -405,8 +405,8 @@ github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE github.com/coinbase/kryptology v1.8.0/go.mod h1:RYXOAPdzOGUe3qlSFkMGn58i3xUA8hmxYHksuq+8ciI= github.com/coinbase/rosetta-sdk-go v0.7.9 h1:lqllBjMnazTjIqYrOGv8h8jxjg9+hJazIGZr9ZvoCcA= github.com/coinbase/rosetta-sdk-go v0.7.9/go.mod h1:0/knutI7XGVqXmmH4OQD8OckFrbQ8yMsUZTG7FXCR2M= -github.com/cometbft/cometbft v0.37.0 h1:M005vBaSaugvYYmNZwJOopynQSjwLoDTwflnQ/I/eYk= -github.com/cometbft/cometbft v0.37.0/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= +github.com/cometbft/cometbft v0.37.1 h1:KLxkQTK2hICXYq21U2hn1W5hOVYUdQgDQ1uB+90xPIg= +github.com/cometbft/cometbft v0.37.1/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= github.com/cometbft/cometbft-db v0.7.0 h1:uBjbrBx4QzU0zOEnU8KxoDl18dMNgDh+zZRUE0ucsbo= github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= @@ -431,8 +431,8 @@ github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4x 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.6 h1:Ee7z15dWJaGlgM2rWrK8N2IX7PQcuccu8oG68jp5RL4= -github.com/cosmos/gogoproto v1.4.6/go.mod h1:VS/ASYmPgv6zkPKLjR9EB91lwbLHOzaGCirmKKhncfI= +github.com/cosmos/gogoproto v1.4.8 h1:BrHKc6WFZt8+jRV71vKSQE+JrfF+JAnzrKo2VP7wIZ4= +github.com/cosmos/gogoproto v1.4.8/go.mod h1:hnb0DIEWTv+wdNzNcqus5xCQXq5+CXauq1FJuurRfVY= 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.0.0 h1:j4kyywlG0hhDmT9FmSaR5iCIka7Pz7kJTxGWY1nlV9Q= @@ -832,8 +832,8 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng 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.0 h1:bzrYP+qu/gMrL1au7/aDvkoOVGUJpeKBgbqRHACAFDY= -github.com/hashicorp/go-getter v1.7.0/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-getter v1.7.1 h1:SWiSWN/42qdpR0MdhaOc/bLR48PLuP1ZQtYLRlM69uY= +github.com/hashicorp/go-getter v1.7.1/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -2133,8 +2133,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu 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.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= +google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= 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= @@ -2151,8 +2151,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ 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.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.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= diff --git a/x/global/ante.go b/x/global/ante.go index c3b181ce..8097a7cf 100644 --- a/x/global/ante.go +++ b/x/global/ante.go @@ -1,9 +1,7 @@ package global import ( - "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" // Auth "github.com/cosmos/cosmos-sdk/x/auth/ante" @@ -14,10 +12,6 @@ import ( feeGrantKeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" // Global "github.com/KYVENetwork/chain/x/global/keeper" - // Gov - govKeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" - govTypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - legacyGovTypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" // Staking stakingKeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" ) @@ -86,64 +80,3 @@ func (gad GasAdjustmentDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulat return next(ctx, tx, simulate) } - -// InitialDepositDecorator - -// The InitialDepositDecorator is responsible for checking -// if the submit-proposal message also provides the required -// minimum deposit. Otherwise, the message is rejected. -type InitialDepositDecorator struct { - globalKeeper keeper.Keeper - govKeeper govKeeper.Keeper -} - -func NewInitialDepositDecorator(globalKeeper keeper.Keeper, govKeeper govKeeper.Keeper) InitialDepositDecorator { - return InitialDepositDecorator{ - globalKeeper: globalKeeper, - govKeeper: govKeeper, - } -} - -func (idd InitialDepositDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { - // NOTE: This is Tendermint specific. - if ctx.BlockHeight() <= 1 { - return next(ctx, tx, simulate) - } - - minInitialDepositRatio := idd.globalKeeper.GetMinInitialDepositRatio(ctx) - govParams := idd.govKeeper.GetParams(ctx) - - requiredDeposit := sdk.NewCoins() - for _, coin := range govParams.MinDeposit { - amount := sdk.NewDecFromInt(coin.Amount).Mul(minInitialDepositRatio).TruncateInt() - requiredDeposit = requiredDeposit.Add(sdk.NewCoin(coin.Denom, amount)) - } - - for _, rawMsg := range tx.GetMsgs() { - initialDeposit := sdk.NewCoins() - throwError := false - - if sdk.MsgTypeURL(rawMsg) == sdk.MsgTypeURL(&legacyGovTypes.MsgSubmitProposal{}) { - // cosmos.gov.v1beta1.MsgSubmitProposal - if legacyMsg, ok := rawMsg.(*legacyGovTypes.MsgSubmitProposal); ok { - initialDeposit = legacyMsg.GetInitialDeposit() - throwError = !initialDeposit.IsAllGTE(requiredDeposit) - } - } else if sdk.MsgTypeURL(rawMsg) == sdk.MsgTypeURL(&govTypes.MsgSubmitProposal{}) { - // cosmos.gov.v1.MsgSubmitProposal - if msg, ok := rawMsg.(*govTypes.MsgSubmitProposal); ok { - initialDeposit = msg.GetInitialDeposit() - throwError = !initialDeposit.IsAllGTE(requiredDeposit) - } - } - - if throwError { - return ctx, errors.Wrapf( - errorsTypes.ErrLogic, "minimum deposit is too small - was (%s), need (%s)", - initialDeposit, requiredDeposit, - ) - } - } - - return next(ctx, tx, simulate) -} diff --git a/x/global/ante_test.go b/x/global/ante_test.go index 07e1f818..785407e7 100644 --- a/x/global/ante_test.go +++ b/x/global/ante_test.go @@ -3,23 +3,22 @@ package global_test import ( "cosmossdk.io/math" i "github.com/KYVENetwork/chain/testutil/integration" - stakersTypes "github.com/KYVENetwork/chain/x/stakers/types" sdk "github.com/cosmos/cosmos-sdk/types" - bankTypes "github.com/cosmos/cosmos-sdk/x/bank/types" - stakingTypes "github.com/cosmos/cosmos-sdk/x/staking/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" // Auth authTypes "github.com/cosmos/cosmos-sdk/x/auth/types" - + // Bank + bankTypes "github.com/cosmos/cosmos-sdk/x/bank/types" // Global "github.com/KYVENetwork/chain/x/global" "github.com/KYVENetwork/chain/x/global/types" - - govV1Types "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - govLegacyTypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + // Stakers + stakersTypes "github.com/KYVENetwork/chain/x/stakers/types" + // Staking + stakingTypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) /* @@ -404,206 +403,3 @@ var _ = Describe("GasAdjustmentDecorator", Ordered, func() { Expect(s.Ctx().GasMeter().GasConsumed()).To(BeEquivalentTo(BaseCost + 3000)) }) }) - -/* -TEST CASES - InitialDepositDecorator - -* No Deposit, no min-deposit - v1 -* No Deposit, no min-deposit - legacy -* Deposit, no min-deposit - v1 -* Deposit, no min-deposit - legacy -* No Deposit, min-deposit - v1 -* No Deposit, min-deposit - legacy -* Deposit, min-deposit - v1 -* Deposit, min-deposit - legacy -*/ -var _ = Describe("InitialDepositDecorator", Ordered, func() { - s := i.NewCleanChain() - encodingConfig := BuildEncodingConfig() - zeroCoins := sdk.NewCoins(sdk.NewCoin(types.Denom, math.ZeroInt())) - var emptyMsg []sdk.Msg - - BeforeEach(func() { - s = i.NewCleanChain() - }) - - AfterEach(func() { - s.PerformValidityChecks() - }) - - It("No Deposit, no min-deposit - v1", func() { - // ARRANGE - txBuilder := encodingConfig.TxConfig.NewTxBuilder() - submitMsg, govErr := govV1Types.NewMsgSubmitProposal(emptyMsg, zeroCoins, i.ALICE, "metadata", "title", "summary") - Expect(govErr).ToNot(HaveOccurred()) - _ = txBuilder.SetMsgs(submitMsg) - tx := txBuilder.GetTx() - - gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, *s.App().GovKeeper) - - // ACT - _, err := gid.AnteHandle(s.Ctx(), tx, false, AnteNextFn) - - // ASSERT - Expect(err).ToNot(HaveOccurred()) - }) - - It("No Deposit, no min-deposit - legacy", func() { - // ARRANGE - txBuilder := encodingConfig.TxConfig.NewTxBuilder() - - content, created := govLegacyTypes.ContentFromProposalType("Text-test", "Description", "Text") - Expect(created).To(BeTrue()) - - submitMsg, govErr := govLegacyTypes.NewMsgSubmitProposal(content, zeroCoins, sdk.MustAccAddressFromBech32(i.ALICE)) - Expect(govErr).ToNot(HaveOccurred()) - _ = txBuilder.SetMsgs(submitMsg) - tx := txBuilder.GetTx() - - gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, *s.App().GovKeeper) - - // ACT - _, err := gid.AnteHandle(s.Ctx(), tx, false, AnteNextFn) - - // ASSERT - Expect(err).ToNot(HaveOccurred()) - }) - - It("Deposit, no min-deposit - v1", func() { - // ARRANGE - txBuilder := encodingConfig.TxConfig.NewTxBuilder() - hundredKyveCoins := sdk.NewCoins(sdk.NewCoin(types.Denom, math.NewInt(100_000_000_000))) - submitMsg, govErr := govV1Types.NewMsgSubmitProposal(emptyMsg, hundredKyveCoins, i.ALICE, "metadata", "title", "summary") - Expect(govErr).ToNot(HaveOccurred()) - _ = txBuilder.SetMsgs(submitMsg) - tx := txBuilder.GetTx() - - gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, *s.App().GovKeeper) - - // ACT - _, err := gid.AnteHandle(s.Ctx(), tx, false, AnteNextFn) - - // ASSERT - Expect(err).ToNot(HaveOccurred()) - }) - - It("Deposit, no min-deposit - legacy", func() { - // ARRANGE - txBuilder := encodingConfig.TxConfig.NewTxBuilder() - - content, created := govLegacyTypes.ContentFromProposalType("Text-test", "Description", "Text") - Expect(created).To(BeTrue()) - - hundredKyveCoins := sdk.NewCoins(sdk.NewCoin(types.Denom, math.NewInt(100_000_000_000))) - submitMsg, govErr := govLegacyTypes.NewMsgSubmitProposal(content, hundredKyveCoins, sdk.MustAccAddressFromBech32(i.ALICE)) - Expect(govErr).ToNot(HaveOccurred()) - - _ = txBuilder.SetMsgs(submitMsg) - tx := txBuilder.GetTx() - - gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, *s.App().GovKeeper) - - // ACT - _, err := gid.AnteHandle(s.Ctx(), tx, false, AnteNextFn) - - // ASSERT - Expect(err).ToNot(HaveOccurred()) - }) - - It("No Deposit, min-deposit - v1", func() { - // ARRANGE - params := types.DefaultParams() - params.MinInitialDepositRatio = sdk.NewDec(1).QuoInt64(4) - s.App().GlobalKeeper.SetParams(s.Ctx(), params) - - txBuilder := encodingConfig.TxConfig.NewTxBuilder() - submitMsg, govErr := govV1Types.NewMsgSubmitProposal(emptyMsg, zeroCoins, i.ALICE, "metadata", "title", "summary") - Expect(govErr).ToNot(HaveOccurred()) - _ = txBuilder.SetMsgs(submitMsg) - tx := txBuilder.GetTx() - - gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, *s.App().GovKeeper) - - // ACT - _, err := gid.AnteHandle(s.Ctx(), tx, false, AnteNextFn) - - // ASSERT - Expect(err).To(HaveOccurred()) - }) - - It("No Deposit, min-deposit - legacy", func() { - // ARRANGE - params := types.DefaultParams() - params.MinInitialDepositRatio = sdk.NewDec(1).QuoInt64(4) - s.App().GlobalKeeper.SetParams(s.Ctx(), params) - - txBuilder := encodingConfig.TxConfig.NewTxBuilder() - - content, created := govLegacyTypes.ContentFromProposalType("Text-test", "Description", "Text") - Expect(created).To(BeTrue()) - - submitMsg, govErr := govLegacyTypes.NewMsgSubmitProposal(content, zeroCoins, sdk.MustAccAddressFromBech32(i.ALICE)) - Expect(govErr).ToNot(HaveOccurred()) - - _ = txBuilder.SetMsgs(submitMsg) - tx := txBuilder.GetTx() - - gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, *s.App().GovKeeper) - - // ACT - _, err := gid.AnteHandle(s.Ctx(), tx, false, AnteNextFn) - - // ASSERT - Expect(err).To(HaveOccurred()) - }) - - It("Deposit, min-deposit - v1", func() { - // ARRANGE - params := types.DefaultParams() - params.MinInitialDepositRatio = sdk.NewDec(1).QuoInt64(4) - s.App().GlobalKeeper.SetParams(s.Ctx(), params) - - txBuilder := encodingConfig.TxConfig.NewTxBuilder() - twentyFiveKyveCoins := sdk.NewCoins(sdk.NewCoin(types.Denom, math.NewInt(25_000_000_000))) - - submitMsg, govErr := govV1Types.NewMsgSubmitProposal(emptyMsg, twentyFiveKyveCoins, i.ALICE, "metadata", "title", "summary") - Expect(govErr).ToNot(HaveOccurred()) - _ = txBuilder.SetMsgs(submitMsg) - tx := txBuilder.GetTx() - - gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, *s.App().GovKeeper) - - // ACT - _, err := gid.AnteHandle(s.Ctx(), tx, false, AnteNextFn) - - // ASSERT - Expect(err).ToNot(HaveOccurred()) - }) - - It("Deposit, min-deposit - legacy", func() { - // ARRANGE - params := types.DefaultParams() - params.MinInitialDepositRatio = sdk.NewDec(1).QuoInt64(4) - s.App().GlobalKeeper.SetParams(s.Ctx(), params) - - txBuilder := encodingConfig.TxConfig.NewTxBuilder() - - content, created := govLegacyTypes.ContentFromProposalType("Text-test", "Description", "Text") - Expect(created).To(BeTrue()) - - twentyFiveKyveCoins := sdk.NewCoins(sdk.NewCoin(types.Denom, math.NewInt(25_000_000_000))) - submitMsg, govErr := govLegacyTypes.NewMsgSubmitProposal(content, twentyFiveKyveCoins, sdk.MustAccAddressFromBech32(i.ALICE)) - Expect(govErr).ToNot(HaveOccurred()) - - _ = txBuilder.SetMsgs(submitMsg) - tx := txBuilder.GetTx() - - gid := global.NewInitialDepositDecorator(s.App().GlobalKeeper, *s.App().GovKeeper) - - // ACT - _, err := gid.AnteHandle(s.Ctx(), tx, false, AnteNextFn) - - // ASSERT - Expect(err).ToNot(HaveOccurred()) - }) -}) From cfd5ee2ccdd1f3d534b4e6b266fe5296c065d759 Mon Sep 17 00:00:00 2001 From: John Letey Date: Thu, 27 Apr 2023 19:49:35 +0200 Subject: [PATCH 003/109] chore: small nits --- app/ante.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/ante.go b/app/ante.go index 65c243a0..31e11ab1 100644 --- a/app/ante.go +++ b/app/ante.go @@ -14,8 +14,7 @@ import ( // Global "github.com/KYVENetwork/chain/x/global" globalKeeper "github.com/KYVENetwork/chain/x/global/keeper" - - // IBC + // IBC Core ibcAnte "github.com/cosmos/ibc-go/v7/modules/core/ante" ibcKeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" // Staking From 9479c98d71ecfd7ad80585527fb352fea3deaacb Mon Sep 17 00:00:00 2001 From: John Letey Date: Fri, 28 Apr 2023 17:32:51 +0200 Subject: [PATCH 004/109] chore: small fixes --- app/app.go | 2 ++ app/modules.go | 5 +++++ app/upgrades/v1_2/upgrade.go | 19 +++++++++++++++++++ go.mod | 3 +++ go.sum | 18 ++---------------- 5 files changed, 31 insertions(+), 16 deletions(-) diff --git a/app/app.go b/app/app.go index aadf7b04..e86da079 100644 --- a/app/app.go +++ b/app/app.go @@ -848,7 +848,9 @@ func NewKYVEApp( v1p2.CreateUpgradeHandler( app.mm, app.configurator, + appCodec, app.ConsensusKeeper, + *app.IBCKeeper, app.ParamsKeeper, ), ) diff --git a/app/modules.go b/app/modules.go index a2a0d49d..98225eb8 100644 --- a/app/modules.go +++ b/app/modules.go @@ -43,6 +43,9 @@ import ( // IBC Core ibc "github.com/cosmos/ibc-go/v7/modules/core" ibcClient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" + // IBC Light Clients + ibcSm "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" + ibcTm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" // IBC Fee ibcFee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee" ibcFeeTypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" @@ -109,6 +112,8 @@ var appModuleBasics = []module.AppModuleBasic{ // IBC ibc.AppModuleBasic{}, + ibcSm.AppModuleBasic{}, + ibcTm.AppModuleBasic{}, ibcFee.AppModuleBasic{}, ibcTransfer.AppModuleBasic{}, ica.AppModuleBasic{}, diff --git a/app/upgrades/v1_2/upgrade.go b/app/upgrades/v1_2/upgrade.go index 95f6476e..ad133b34 100644 --- a/app/upgrades/v1_2/upgrade.go +++ b/app/upgrades/v1_2/upgrade.go @@ -1,12 +1,19 @@ package v1_2 import ( + "fmt" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" // Consensus consensusKeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" + // IBC Core + ibcKeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + // IBC Light Clients + ibcTmMigrations "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint/migrations" // Params paramsKeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramsTypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -17,15 +24,27 @@ import ( func CreateUpgradeHandler( mm *module.Manager, configurator module.Configurator, + cdc codec.BinaryCodec, consensusKeeper consensusKeeper.Keeper, + ibcKeeper ibcKeeper.Keeper, paramsKeeper paramsKeeper.Keeper, ) upgradeTypes.UpgradeHandler { return func(ctx sdk.Context, _ upgradeTypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + logger := ctx.Logger().With("upgrade", UpgradeName) + // Migrate consensus parameters from x/params to dedicated x/consensus module. baseAppSubspace := paramsKeeper.Subspace(baseapp.Paramspace). WithKeyTable(paramsTypes.ConsensusParamsKeyTable()) baseapp.MigrateParams(ctx, baseAppSubspace, &consensusKeeper) + // Prune expired Tendermint consensus states. + pruned, err := ibcTmMigrations.PruneExpiredConsensusStates(ctx, cdc, ibcKeeper.ClientKeeper) + if err != nil { + return vm, err + } + + logger.Info(fmt.Sprintf("pruned %d consensus states from storage", pruned)) + // TODO: Migrate MinInitialDepositRatio from x/global to x/gov. return mm.RunMigrations(ctx, configurator, vm) diff --git a/go.mod b/go.mod index 93634afa..e585f3e6 100644 --- a/go.mod +++ b/go.mod @@ -314,4 +314,7 @@ replace ( // use cosmos flavored gogo/protobuf // https://github.com/cosmos/cosmos-sdk/issues/8469 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + + // downgrade goleveldb + github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 ) diff --git a/go.sum b/go.sum index c5262e5d..7ba9366b 100644 --- a/go.sum +++ b/go.sum @@ -548,7 +548,6 @@ github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2 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.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/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= @@ -600,7 +599,6 @@ github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5Nq github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-toolsmith/astcast v1.1.0 h1:+JN9xZV1A+Re+95pgnMgDboWNVnIMMQXwfBwLRPgSC8= github.com/go-toolsmith/astcast v1.1.0/go.mod h1:qdcuFWeGGS2xX5bLM/c3U9lewg7+Zu4mr+xPwZIB4ZU= github.com/go-toolsmith/astcopy v1.1.0 h1:YGwBN0WM+ekI/6SS6+52zLDEf8Yvp3n2seZITCUBt5s= @@ -751,7 +749,6 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe 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= @@ -1109,7 +1106,6 @@ github.com/nunnatsa/ginkgolinter v0.9.0 h1:Sm0zX5QfjJzkeCjEp+t6d3Ha0jwvoDjleP9XC github.com/nunnatsa/ginkgolinter v0.9.0/go.mod h1:FHaMLURXP7qImeH6bvxWJUpyH+2tuqe5j4rW1gxJRmI= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= @@ -1120,18 +1116,13 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo v1.16.4/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 v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo/v2 v2.8.0 h1:pAM+oBNPrpXRs+E/8spkeGx9QgekbRVyr74EUvRVOUI= github.com/onsi/ginkgo/v2 v2.8.0/go.mod h1:6JsQiECmxCa3V5st74AL/AmsV482EDdVrGaVW6z3oYU= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= @@ -1350,16 +1341,14 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= -github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= -github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c/go.mod h1:SbErYREK7xXdsRiigaQiQkI9McGRzYMvlKYaP3Nimdk= github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= @@ -1603,7 +1592,6 @@ golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -1728,7 +1716,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1881,7 +1868,6 @@ golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= From f607e9351699e61263df47fcf205c40ebbc36bae Mon Sep 17 00:00:00 2001 From: John Letey Date: Sat, 6 May 2023 10:39:14 +0200 Subject: [PATCH 005/109] chore: migrate `MinInitialDepositRatio` param --- app/app.go | 2 + app/upgrades/v1_2/upgrade.go | 41 +++++++++++++++---- proto/kyve/global/v1beta1/global.proto | 1 + x/global/types/global.pb.go | 56 +++++++++++++------------- 4 files changed, 65 insertions(+), 35 deletions(-) diff --git a/app/app.go b/app/app.go index e86da079..6a203210 100644 --- a/app/app.go +++ b/app/app.go @@ -850,6 +850,8 @@ func NewKYVEApp( app.configurator, appCodec, app.ConsensusKeeper, + app.GlobalKeeper, + *app.GovKeeper, *app.IBCKeeper, app.ParamsKeeper, ), diff --git a/app/upgrades/v1_2/upgrade.go b/app/upgrades/v1_2/upgrade.go index ad133b34..36ec4e2f 100644 --- a/app/upgrades/v1_2/upgrade.go +++ b/app/upgrades/v1_2/upgrade.go @@ -1,8 +1,6 @@ package v1_2 import ( - "fmt" - "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -10,6 +8,10 @@ import ( // Consensus consensusKeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" + // Global + globalKeeper "github.com/KYVENetwork/chain/x/global/keeper" + // Governance + govKeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" // IBC Core ibcKeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" // IBC Light Clients @@ -26,11 +28,13 @@ func CreateUpgradeHandler( configurator module.Configurator, cdc codec.BinaryCodec, consensusKeeper consensusKeeper.Keeper, + globalKeeper globalKeeper.Keeper, + govKeeper govKeeper.Keeper, ibcKeeper ibcKeeper.Keeper, paramsKeeper paramsKeeper.Keeper, ) upgradeTypes.UpgradeHandler { return func(ctx sdk.Context, _ upgradeTypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - logger := ctx.Logger().With("upgrade", UpgradeName) + var err error // Migrate consensus parameters from x/params to dedicated x/consensus module. baseAppSubspace := paramsKeeper.Subspace(baseapp.Paramspace). @@ -38,15 +42,38 @@ func CreateUpgradeHandler( baseapp.MigrateParams(ctx, baseAppSubspace, &consensusKeeper) // Prune expired Tendermint consensus states. - pruned, err := ibcTmMigrations.PruneExpiredConsensusStates(ctx, cdc, ibcKeeper.ClientKeeper) + _, err = ibcTmMigrations.PruneExpiredConsensusStates(ctx, cdc, ibcKeeper.ClientKeeper) if err != nil { return vm, err } - logger.Info(fmt.Sprintf("pruned %d consensus states from storage", pruned)) + // Run module migrations. + vm, err = mm.RunMigrations(ctx, configurator, vm) + if err != nil { + return vm, err + } - // TODO: Migrate MinInitialDepositRatio from x/global to x/gov. + // Migrate initial deposit ratio. + err = MigrateInitialDepositRatio(ctx, globalKeeper, govKeeper) + if err != nil { + return vm, err + } - return mm.RunMigrations(ctx, configurator, vm) + return vm, nil } } + +// MigrateInitialDepositRatio migrates the MinInitialDepositRatio parameter from +// our custom x/global module to the x/gov module. +func MigrateInitialDepositRatio( + ctx sdk.Context, + globalKeeper globalKeeper.Keeper, + govKeeper govKeeper.Keeper, +) error { + minInitialDepositRatio := globalKeeper.GetMinInitialDepositRatio(ctx) + + params := govKeeper.GetParams(ctx) + params.MinInitialDepositRatio = minInitialDepositRatio.String() + + return govKeeper.SetParams(ctx, params) +} diff --git a/proto/kyve/global/v1beta1/global.proto b/proto/kyve/global/v1beta1/global.proto index 91b567ab..a6ffbe4d 100644 --- a/proto/kyve/global/v1beta1/global.proto +++ b/proto/kyve/global/v1beta1/global.proto @@ -34,6 +34,7 @@ message Params { // governance proposal. This is used to avoid spamming of proposals and // polluting the proposals page. string min_initial_deposit_ratio = 5 [ + deprecated = true, (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; diff --git a/x/global/types/global.pb.go b/x/global/types/global.pb.go index f992a53c..3813b121 100644 --- a/x/global/types/global.pb.go +++ b/x/global/types/global.pb.go @@ -42,7 +42,7 @@ type Params struct { // min_initial_deposit_ratio sets a minimum fraction of initial deposit for a // governance proposal. This is used to avoid spamming of proposals and // polluting the proposals page. - MinInitialDepositRatio github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=min_initial_deposit_ratio,json=minInitialDepositRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_initial_deposit_ratio"` + MinInitialDepositRatio github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=min_initial_deposit_ratio,json=minInitialDepositRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_initial_deposit_ratio"` // Deprecated: Do not use. } func (m *Params) Reset() { *m = Params{} } @@ -207,33 +207,33 @@ func init() { func init() { proto.RegisterFile("kyve/global/v1beta1/global.proto", fileDescriptor_d1b5d4c0bbdf8bfb) } var fileDescriptor_d1b5d4c0bbdf8bfb = []byte{ - // 408 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xc1, 0xce, 0xd2, 0x40, - 0x10, 0xc7, 0x5b, 0xa9, 0x44, 0x96, 0x7c, 0x9a, 0xac, 0xe6, 0x4b, 0xf5, 0x50, 0x48, 0x0f, 0x86, - 0xc4, 0xd8, 0x06, 0x3d, 0x7a, 0x92, 0x40, 0x88, 0x1a, 0x0d, 0xf6, 0x60, 0xa2, 0x97, 0x66, 0xdb, - 0x2e, 0x65, 0x2d, 0xbb, 0xdb, 0xec, 0x6e, 0x51, 0xde, 0xc2, 0x47, 0xf1, 0x31, 0x38, 0x72, 0x34, -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 0x5d, 0x8d, 0x14, 0x78, 0x5e, 0xb1, 0x4c, 0xba, 0x8e, 0xc1, - 0x79, 0xff, 0xc3, 0x45, 0x46, 0xd6, 0xa0, 0x40, 0x7e, 0x2c, 0x48, 0x48, 0xc0, 0x63, 0x3d, 0x3c, - 0xc2, 0x88, 0x22, 0x68, 0x19, 0x67, 0xb8, 0xe4, 0x92, 0xa8, 0xc6, 0xf7, 0xdd, 0xab, 0x7c, 0xdf, - 0x52, 0xc2, 0xde, 0xd4, 0xbc, 0x71, 0x8d, 0x33, 0x43, 0xf0, 0x5f, 0x81, 0x9b, 0x7f, 0x8c, 0x41, - 0x08, 0x1c, 0xdd, 0x55, 0xef, 0x2b, 0x32, 0x31, 0xbc, 0x05, 0x6d, 0x44, 0x79, 0xc5, 0x94, 0x19, - 0xba, 0x13, 0x35, 0x99, 0x5f, 0x80, 0xce, 0xc9, 0xc6, 0xc5, 0xc6, 0xb7, 0xe0, 0xde, 0x5c, 0xa0, - 0x54, 0x11, 0xce, 0xae, 0xdc, 0xd7, 0xa9, 0x7f, 0x34, 0xd9, 0xec, 0x3d, 0x7b, 0xbb, 0xf7, 0xec, - 0x3f, 0x7b, 0xcf, 0xfe, 0x71, 0xf0, 0xac, 0xed, 0xc1, 0xb3, 0x7e, 0x1d, 0x3c, 0xeb, 0xcb, 0xb3, - 0x33, 0xd6, 0xbb, 0xcf, 0x9f, 0x26, 0x1f, 0xb0, 0xfa, 0xc6, 0x45, 0x11, 0xa6, 0x0b, 0x44, 0x58, - 0xf8, 0xfd, 0x78, 0xdd, 0x06, 0x9a, 0xb4, 0xcd, 0xa9, 0xbe, 0xfc, 0x1b, 0x00, 0x00, 0xff, 0xff, - 0x49, 0xa4, 0x7a, 0xa9, 0xf9, 0x02, 0x00, 0x00, + // 416 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xc1, 0x8e, 0xd3, 0x30,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 0x9e, 0xe8, + 0xaf, 0x42, 0x96, 0x71, 0x36, 0xc5, 0x94, 0xc7, 0xdf, 0x76, 0xf7, 0x6d, 0xa1, 0x69, 0xd7, 0x1e, + 0xeb, 0x8b, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3c, 0x19, 0x16, 0xca, 0xfb, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { From 1fdcb611ca96bba608ed109df871dd291d823bf3 Mon Sep 17 00:00:00 2001 From: John Letey Date: Fri, 9 Jun 2023 19:21:10 +0200 Subject: [PATCH 006/109] chore: include barberry resolution --- CHANGELOG.md | 2 +- go.mod | 29 +++++++++++++------------- go.sum | 59 +++++++++++++++++++++++++++++++--------------------- 3 files changed, 50 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d62606e..d19514d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ ### Features -- [#33](https://github.com/KYVENetwork/chain/pull/33) Upgrade Cosmos SDK to [v0.47.2](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.2) ([`v0.47.2-kyve-rc0`](https://github.com/KYVENetwork/cosmos-sdk/releases/tag/v0.47.2-kyve-rc0)). +- [#33](https://github.com/KYVENetwork/chain/pull/33) Upgrade Cosmos SDK to [v0.47.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.3) ([`v0.47.3-kyve`](https://github.com/KYVENetwork/cosmos-sdk/releases/tag/v0.47.3-kyve)). - (ibc) [#30](https://github.com/KYVENetwork/chain/pull/30) Integrate [Packet Forward Middleware](https://github.com/strangelove-ventures/packet-forward-middleware). ### Improvements diff --git a/go.mod b/go.mod index 10f2659c..dc2d996e 100644 --- a/go.mod +++ b/go.mod @@ -4,12 +4,12 @@ go 1.20 require ( cosmossdk.io/errors v1.0.0-beta.7 - cosmossdk.io/math v1.0.0 + cosmossdk.io/math v1.0.1 github.com/cometbft/cometbft v0.37.1 github.com/cometbft/cometbft-db v0.7.0 github.com/cosmos/cosmos-proto v1.0.0-beta.2 - github.com/cosmos/cosmos-sdk v0.47.2 - github.com/cosmos/gogoproto v1.4.8 + github.com/cosmos/cosmos-sdk v0.47.3 + github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-go/v7 v7.0.0 github.com/ethereum/go-ethereum v1.10.22 github.com/golang/protobuf v1.5.3 @@ -22,8 +22,8 @@ require ( github.com/spf13/viper v1.15.0 github.com/strangelove-ventures/packet-forward-middleware/v7 v7.0.0-20230523193151-73dea436e53f github.com/stretchr/testify v1.8.2 - google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44 - google.golang.org/grpc v1.54.0 + google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 + google.golang.org/grpc v1.55.0 mvdan.cc/gofumpt v0.5.0 ) @@ -38,6 +38,7 @@ require ( cosmossdk.io/api v0.3.1 // indirect cosmossdk.io/core v0.5.1 // indirect cosmossdk.io/depinject v1.0.0-alpha.3 // indirect + cosmossdk.io/log v1.1.0 // 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 @@ -174,7 +175,6 @@ require ( github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/json-iterator/go v1.1.12 // indirect github.com/julz/importas v0.1.0 // indirect github.com/junk1tm/musttag v0.5.0 // indirect github.com/kisielk/errcheck v1.6.3 // indirect @@ -197,7 +197,7 @@ require ( github.com/maratori/testpackage v1.1.1 // indirect github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mattn/go-isatty v0.0.18 // indirect github.com/mattn/go-runewidth v0.0.10 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect @@ -207,8 +207,6 @@ require ( github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect github.com/moricho/tparallel v0.3.1 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/nakabonne/nestif v0.3.1 // indirect @@ -218,14 +216,14 @@ require ( github.com/nunnatsa/ginkgolinter v0.9.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/otiai10/copy v1.6.0 // indirect - github.com/pelletier/go-toml/v2 v2.0.6 // indirect - github.com/petermattis/goid v0.0.0-20221215004737-a150e88a970d // indirect + github.com/pelletier/go-toml/v2 v2.0.7 // 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.0 // indirect github.com/polyfloyd/go-errorlint v1.4.0 // indirect github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.40.0 // indirect + github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/quasilyte/go-ruleguard v0.3.19 // indirect github.com/quasilyte/gogrep v0.5.0 // indirect @@ -235,6 +233,7 @@ require ( github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/rs/cors v1.8.3 // indirect + github.com/rs/zerolog v1.29.1 // indirect github.com/ryancurrah/gomodguard v1.3.0 // indirect github.com/ryanrolds/sqlclosecheck v0.4.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect @@ -283,11 +282,11 @@ require ( go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.7.0 // indirect - golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect + golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect golang.org/x/mod v0.10.0 // indirect golang.org/x/net v0.9.0 // indirect - golang.org/x/oauth2 v0.5.0 // indirect + golang.org/x/oauth2 v0.6.0 // indirect golang.org/x/sync v0.1.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/term v0.7.0 // indirect @@ -311,7 +310,7 @@ require ( replace ( // use kyve flavored cosmos/cosmos-sdk - github.com/cosmos/cosmos-sdk => github.com/KYVENetwork/cosmos-sdk v0.47.2-kyve-rc0 + github.com/cosmos/cosmos-sdk => github.com/KYVENetwork/cosmos-sdk v0.47.4-0.20230609171504-c8796a233d29 // use cosmos flavored gogo/protobuf // https://github.com/cosmos/cosmos-sdk/issues/8469 diff --git a/go.sum b/go.sum index 741dd366..10038d0c 100644 --- a/go.sum +++ b/go.sum @@ -124,7 +124,7 @@ cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx 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/longrunning v0.3.0 h1:NjljC+FYPV3uh5/OwWT6pVU+doBqMg2x/rZlE+CamDs= +cloud.google.com/go/longrunning v0.4.1 h1:v+yFJOfKC3yZdY6ZUI933pIYdhyhV8S3NpWrXWmg7jM= 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= @@ -204,8 +204,10 @@ cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE= -cosmossdk.io/math v1.0.0 h1:ro9w7eKx23om2tZz/VM2Pf+z2WAbGX1yDQQOJ6iGeJw= -cosmossdk.io/math v1.0.0/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= +cosmossdk.io/log v1.1.0 h1:v0ogPHYeTzPcBTcPR1A3j1hkei4pZama8kz8LKlCMv0= +cosmossdk.io/log v1.1.0/go.mod h1:6zjroETlcDs+mm62gd8Ig7mZ+N+fVOZS91V17H+M4N4= +cosmossdk.io/math v1.0.1 h1:Qx3ifyOPaMLNH/89WeZFH268yCvU4xEcnPLu3sJqPPg= +cosmossdk.io/math v1.0.1/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -241,8 +243,8 @@ github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rW github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 h1:+r1rSv4gvYn0wmRjC8X7IAzX8QezqtFV9m0MUHFJgts= github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0/go.mod h1:b3g59n2Y+T5xmcxJL+UEG2f8cQploZm1mR/v6BW0mU0= -github.com/KYVENetwork/cosmos-sdk v0.47.2-kyve-rc0 h1:nBpV+Jh5PqjhYnzxSWEVhGm7Af7OBiriGtV8QAcHAYs= -github.com/KYVENetwork/cosmos-sdk v0.47.2-kyve-rc0/go.mod h1:zYzgI8w8hhotXTSoGbbSOAKfpJTx4wOy4XgbaKhtRtc= +github.com/KYVENetwork/cosmos-sdk v0.47.4-0.20230609171504-c8796a233d29 h1:yFmFjaJaMzRDEfYIYTFAw1z34JHaR9rTbaOrsUxXwH4= +github.com/KYVENetwork/cosmos-sdk v0.47.4-0.20230609171504-c8796a233d29/go.mod h1:c4OfLdAykA9zsj1CqrxBRqXzVz48I++JSvIMPSPcEmk= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= @@ -351,6 +353,7 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= +github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/butuzov/ireturn v0.1.1 h1:QvrO2QF2+/Cx1WA/vETCIYBKtRjc30vesdoPUNo1EbY= github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= @@ -420,6 +423,7 @@ github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= @@ -431,8 +435,8 @@ github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4x 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.8 h1:BrHKc6WFZt8+jRV71vKSQE+JrfF+JAnzrKo2VP7wIZ4= -github.com/cosmos/gogoproto v1.4.8/go.mod h1:hnb0DIEWTv+wdNzNcqus5xCQXq5+CXauq1FJuurRfVY= +github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoKuI= +github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek= 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.0.0 h1:j4kyywlG0hhDmT9FmSaR5iCIka7Pz7kJTxGWY1nlV9Q= @@ -629,6 +633,7 @@ github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/E github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= @@ -904,7 +909,7 @@ github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jgautheron/goconst v1.5.1 h1:HxVbL1MhydKs8R8n/HE5NPvzfaYmQJA3o879lE4+WcM= github.com/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= -github.com/jhump/protoreflect v1.12.1-0.20220721211354-060cc04fc18b h1:izTof8BKh/nE1wrKOrloNA5q4odOarjf+Xpe+4qow98= +github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs= 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 h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= @@ -1020,6 +1025,7 @@ github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/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= @@ -1029,8 +1035,8 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= +github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -1156,14 +1162,14 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= -github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= +github.com/pelletier/go-toml/v2 v2.0.7 h1:muncTPStnKRos5dpVKULv2FVd4bMOhNePj9CjgDb8Us= +github.com/pelletier/go-toml/v2 v2.0.7/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20221215004737-a150e88a970d h1:htwtWgtQo8YS6JFWWi2DNgY0RwSGJ1ruMoxY6CUUclk= -github.com/petermattis/goid v0.0.0-20221215004737-a150e88a970d/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 h1:hDSdbBuw3Lefr6R18ax0tZ2BJeNB3NehB3trOwYBsdU= +github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/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= @@ -1207,8 +1213,8 @@ github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB8 github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.40.0 h1:Afz7EVRqGg2Mqqf4JuF9vdvp1pi220m55Pi9T2JnO4Q= -github.com/prometheus/common v0.40.0/go.mod h1:L65ZJPSmfn/UBWLQIHV7dBrKFidB/wPlF1y5TlSt9OE= +github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= +github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= 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= @@ -1248,6 +1254,9 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= +github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU= 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= @@ -1507,8 +1516,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= -golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU= +golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 h1:J74nGeMgeFnYQJN59eFwh06jX/V8g0lB7LWpjSLxtgU= @@ -1644,8 +1653,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.5.0 h1:HuArIo48skDwlrvM3sEdHXElYslAMsf3KwRkkW4MC4s= -golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= +golang.org/x/oauth2 v0.6.0 h1:Lh8GPgSKBfWSwFvtuWOfeI3aAAnbXTSutYxJiOJFgIw= +golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= 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= @@ -1746,6 +1755,7 @@ golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/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-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1777,6 +1787,7 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.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.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= @@ -2080,8 +2091,8 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw 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-20230216225411-c8e22ba71e44 h1:EfLuoKW5WfkgVdDy7dTK8qSbH37AX5mj/MFh+bGPz14= -google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44/go.mod h1:8B0gmkoRebU8ukX6HP+4wrVQUY1+6PkQ44BSyIlflHA= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= 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= @@ -2123,8 +2134,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu 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.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= -google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= +google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= 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= From b449d0b268bbdfa715a7b8d86a3c7817d137ea7f Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 11 Sep 2023 17:06:33 +0200 Subject: [PATCH 007/109] chore: remove pfm store upgrade --- app/upgrades/v1_4/store.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/upgrades/v1_4/store.go b/app/upgrades/v1_4/store.go index aba15aec..95ef9d11 100644 --- a/app/upgrades/v1_4/store.go +++ b/app/upgrades/v1_4/store.go @@ -8,8 +8,7 @@ import ( consensusTypes "github.com/cosmos/cosmos-sdk/x/consensus/types" // Crisis crisisTypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - // PFM - pfmTypes "github.com/strangelove-ventures/packet-forward-middleware/v7/router/types" + // Upgrade upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) @@ -18,7 +17,6 @@ func CreateStoreLoader(upgradeHeight int64) baseapp.StoreLoader { storeUpgrades := storeTypes.StoreUpgrades{ Added: []string{ consensusTypes.StoreKey, crisisTypes.StoreKey, - pfmTypes.StoreKey, }, } From 1a8bf75d136a53b3ce2a9f412648ba5c1cd5121d Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 11 Sep 2023 17:40:21 +0200 Subject: [PATCH 008/109] chore: update release version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ad3ee575..054d00b6 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ COMMIT := $(shell git log -1 --format='%H') GO_VERSION := $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1,2) -VERSION := v1.3.1 # $(shell echo $(shell git describe --tags) | sed 's/^v//') +VERSION := v1.4.0 # $(shell echo $(shell git describe --tags) | sed 's/^v//') TEAM_ALLOCATION := 165000000000000 ifeq ($(ENV),kaon) From c6d767453836f6014d361ca6a3af9cd7b391d66b Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 12 Sep 2023 11:53:29 +0200 Subject: [PATCH 009/109] chore: update to cosmos-sdk v0.47.5 --- go.mod | 66 ++++++++++++++------------ go.sum | 147 +++++++++++++++++++++++++++++++-------------------------- 2 files changed, 118 insertions(+), 95 deletions(-) diff --git a/go.mod b/go.mod index dc2d996e..e7b0184f 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,9 @@ module github.com/KYVENetwork/chain go 1.20 require ( - cosmossdk.io/errors v1.0.0-beta.7 - cosmossdk.io/math v1.0.1 - github.com/cometbft/cometbft v0.37.1 + cosmossdk.io/errors v1.0.0 + cosmossdk.io/math v1.1.2 + github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.7.0 github.com/cosmos/cosmos-proto v1.0.0-beta.2 github.com/cosmos/cosmos-sdk v0.47.3 @@ -21,24 +21,24 @@ require ( github.com/spf13/cobra v1.6.1 github.com/spf13/viper v1.15.0 github.com/strangelove-ventures/packet-forward-middleware/v7 v7.0.0-20230523193151-73dea436e53f - github.com/stretchr/testify v1.8.2 - google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 - google.golang.org/grpc v1.55.0 + github.com/stretchr/testify v1.8.4 + google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 + google.golang.org/grpc v1.56.2 mvdan.cc/gofumpt v0.5.0 ) require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect - cloud.google.com/go v0.110.0 // indirect - cloud.google.com/go/compute v1.18.0 // indirect + cloud.google.com/go v0.110.4 // indirect + cloud.google.com/go/compute v1.20.1 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v0.12.0 // indirect - cloud.google.com/go/storage v1.29.0 // indirect + cloud.google.com/go/iam v1.1.0 // indirect + cloud.google.com/go/storage v1.30.1 // indirect cosmossdk.io/api v0.3.1 // indirect cosmossdk.io/core v0.5.1 // indirect - cosmossdk.io/depinject v1.0.0-alpha.3 // indirect - cosmossdk.io/log v1.1.0 // indirect + cosmossdk.io/depinject v1.0.0-alpha.4 // 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 @@ -75,6 +75,9 @@ require ( github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // 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 v0.7.9 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect @@ -105,12 +108,12 @@ require ( github.com/firefart/nonamedreturns v1.0.4 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect + github.com/getsentry/sentry-go v0.23.0 // indirect github.com/go-critic/go-critic v0.7.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-logr/logr v1.2.3 // indirect - github.com/go-playground/universal-translator v0.18.0 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect github.com/go-toolsmith/astequal v1.1.0 // indirect @@ -140,9 +143,10 @@ require ( github.com/google/btree v1.1.2 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/orderedcode v0.0.1 // indirect + github.com/google/s2a-go v0.1.4 // indirect github.com/google/uuid v1.3.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect - github.com/googleapis/gax-go/v2 v2.7.0 // indirect + github.com/googleapis/gax-go/v2 v2.11.0 // indirect github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/mux v1.8.0 // indirect @@ -181,12 +185,13 @@ require ( github.com/kisielk/gotool v1.0.0 // indirect github.com/kkHAIKE/contextcheck v1.1.4 // indirect github.com/klauspost/compress v1.16.3 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect github.com/kulti/thelper v0.6.3 // indirect github.com/kunwardeep/paralleltest v1.0.6 // indirect github.com/kyoh86/exportloopref v0.1.11 // indirect github.com/ldez/gomoddirectives v0.2.3 // indirect github.com/ldez/tagliatelle v0.4.0 // indirect - github.com/leodido/go-urn v1.2.1 // indirect github.com/leonklingele/grouper v1.1.1 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect @@ -197,7 +202,7 @@ require ( github.com/maratori/testpackage v1.1.1 // indirect github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.18 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect github.com/mattn/go-runewidth v0.0.10 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect @@ -232,8 +237,9 @@ require ( github.com/rakyll/statik v0.1.7 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rivo/uniseg v0.2.0 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/rs/cors v1.8.3 // indirect - github.com/rs/zerolog v1.29.1 // indirect + github.com/rs/zerolog v1.30.0 // indirect github.com/ryancurrah/gomodguard v1.3.0 // indirect github.com/ryanrolds/sqlclosecheck v0.4.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect @@ -281,21 +287,23 @@ require ( go.uber.org/goleak v1.1.12 // indirect go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.7.0 // indirect - golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect + golang.org/x/crypto v0.11.0 // indirect + golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // indirect golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect - golang.org/x/mod v0.10.0 // indirect - golang.org/x/net v0.9.0 // indirect - golang.org/x/oauth2 v0.6.0 // indirect - golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.7.0 // indirect - golang.org/x/term v0.7.0 // indirect - golang.org/x/text v0.9.0 // indirect + golang.org/x/mod v0.11.0 // indirect + golang.org/x/net v0.12.0 // indirect + golang.org/x/oauth2 v0.8.0 // indirect + golang.org/x/sync v0.2.0 // indirect + golang.org/x/sys v0.11.0 // indirect + golang.org/x/term v0.10.0 // indirect + golang.org/x/text v0.12.0 // indirect golang.org/x/tools v0.8.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/api v0.110.0 // indirect + google.golang.org/api v0.126.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/protobuf v1.30.0 // indirect + google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -310,7 +318,7 @@ require ( replace ( // use kyve flavored cosmos/cosmos-sdk - github.com/cosmos/cosmos-sdk => github.com/KYVENetwork/cosmos-sdk v0.47.4-0.20230609171504-c8796a233d29 + github.com/cosmos/cosmos-sdk => github.com/KYVENetwork/cosmos-sdk v0.47.4-0.20230912091353-d2c627552db3 // use cosmos flavored gogo/protobuf // https://github.com/cosmos/cosmos-sdk/issues/8469 diff --git a/go.sum b/go.sum index 10038d0c..ecf397fc 100644 --- a/go.sum +++ b/go.sum @@ -38,8 +38,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 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.0 h1:Zc8gqp3+a9/Eyph2KDmcGaPtbKRIoqq4YTlL4NMD0Ys= -cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= +cloud.google.com/go v0.110.4 h1:1JYyxKMN9hd5dR2MYTPWkGUgcoxVVhg0LKNKEo0qvmk= +cloud.google.com/go v0.110.4/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= @@ -77,8 +77,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz 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.18.0 h1:FEigFqoDbys2cvFkZ9Fjq4gnHBP55anJ0yQyau2f9oY= -cloud.google.com/go/compute v1.18.0/go.mod h1:1X7yHxec2Ga+Ss6jPyjxRxpu2uu7PLgsOVXvgU0yacs= +cloud.google.com/go/compute v1.20.1 h1:6aKEtlUiwEpJzM001l0yFkpXmUVXaN8W+fbkb2AZNbg= +cloud.google.com/go/compute v1.20.1/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= @@ -118,13 +118,12 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 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 v0.12.0 h1:DRtTY29b75ciH6Ov1PHb4/iat2CLCvrOm40Q0a6DFpE= -cloud.google.com/go/iam v0.12.0/go.mod h1:knyHGviacl11zrtZUoDuYpDgLjvr28sLQaG0YB2GYAY= +cloud.google.com/go/iam v1.1.0 h1:67gSqaPukx7O8WLLHMa0PNs3EBGd2eE4d+psbO/CO94= +cloud.google.com/go/iam v1.1.0/go.mod h1:nxdHjaKfCr7fNYx/HJMM8LgiMugmveWlkatear5gVyk= 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/longrunning v0.4.1 h1:v+yFJOfKC3yZdY6ZUI933pIYdhyhV8S3NpWrXWmg7jM= 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= @@ -182,8 +181,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.29.0 h1:6weCgzRvMg7lzuUurI4697AqIRPU1SvzHhynwpW31jI= -cloud.google.com/go/storage v1.29.0/go.mod h1:4puEjyTKnku6gfKoTfNOU/W+a9JyuVNxjpS5GBrB8h4= +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= @@ -200,14 +199,14 @@ cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= cosmossdk.io/core v0.5.1 h1:vQVtFrIYOQJDV3f7rw4pjjVqc1id4+mE0L9hHP66pyI= cosmossdk.io/core v0.5.1/go.mod h1:KZtwHCLjcFuo0nmDc24Xy6CRNEL9Vl/MeimQ2aC7NLE= -cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= -cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= -cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= -cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE= -cosmossdk.io/log v1.1.0 h1:v0ogPHYeTzPcBTcPR1A3j1hkei4pZama8kz8LKlCMv0= -cosmossdk.io/log v1.1.0/go.mod h1:6zjroETlcDs+mm62gd8Ig7mZ+N+fVOZS91V17H+M4N4= -cosmossdk.io/math v1.0.1 h1:Qx3ifyOPaMLNH/89WeZFH268yCvU4xEcnPLu3sJqPPg= -cosmossdk.io/math v1.0.1/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= +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/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -243,8 +242,8 @@ github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rW github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 h1:+r1rSv4gvYn0wmRjC8X7IAzX8QezqtFV9m0MUHFJgts= github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0/go.mod h1:b3g59n2Y+T5xmcxJL+UEG2f8cQploZm1mR/v6BW0mU0= -github.com/KYVENetwork/cosmos-sdk v0.47.4-0.20230609171504-c8796a233d29 h1:yFmFjaJaMzRDEfYIYTFAw1z34JHaR9rTbaOrsUxXwH4= -github.com/KYVENetwork/cosmos-sdk v0.47.4-0.20230609171504-c8796a233d29/go.mod h1:c4OfLdAykA9zsj1CqrxBRqXzVz48I++JSvIMPSPcEmk= +github.com/KYVENetwork/cosmos-sdk v0.47.4-0.20230912091353-d2c627552db3 h1:yAUoqAFdx2Hw6OFiUXiisE/vNSNmVYzBrgbNAmkYO8A= +github.com/KYVENetwork/cosmos-sdk v0.47.4-0.20230912091353-d2c627552db3/go.mod h1:EHwCeN9IXonsjKcjpS12MqeStdZvIdxt3VYXhus3G3c= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= @@ -265,7 +264,6 @@ github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= -github.com/alecthomas/participle/v2 v2.0.0-alpha7 h1:cK4vjj0VSgb3lN1nuKA5F7dw+1s1pWBe5bx7nNCnN+c= 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= @@ -402,14 +400,19 @@ github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= -github.com/cockroachdb/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w= 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/kryptology v1.8.0/go.mod h1:RYXOAPdzOGUe3qlSFkMGn58i3xUA8hmxYHksuq+8ciI= github.com/coinbase/rosetta-sdk-go v0.7.9 h1:lqllBjMnazTjIqYrOGv8h8jxjg9+hJazIGZr9ZvoCcA= github.com/coinbase/rosetta-sdk-go v0.7.9/go.mod h1:0/knutI7XGVqXmmH4OQD8OckFrbQ8yMsUZTG7FXCR2M= -github.com/cometbft/cometbft v0.37.1 h1:KLxkQTK2hICXYq21U2hn1W5hOVYUdQgDQ1uB+90xPIg= -github.com/cometbft/cometbft v0.37.1/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= +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.7.0 h1:uBjbrBx4QzU0zOEnU8KxoDl18dMNgDh+zZRUE0ucsbo= github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= @@ -454,8 +457,6 @@ github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJF github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cucumber/common/gherkin/go/v22 v22.0.0 h1:4K8NqptbvdOrjL9DEea6HFjSpbdT9+Q5kgLpmmsHYl0= -github.com/cucumber/common/messages/go/v17 v17.1.1 h1:RNqopvIFyLWnKv0LfATh34SWBhXeoFTJnSrgm9cT/Ts= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= @@ -559,6 +560,8 @@ github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlya github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= +github.com/getsentry/sentry-go v0.23.0 h1:dn+QRCeJv4pPt9OjVXiMcGIBIefaTJPw/h0bZWO05nE= +github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= @@ -569,6 +572,7 @@ github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1T github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= github.com/go-critic/go-critic v0.7.0 h1:tqbKzB8pqi0NsRZ+1pyU4aweAF7A7QN0Pi4Q02+rYnQ= github.com/go-critic/go-critic v0.7.0/go.mod h1:moYzd7GdVXE2C2hYTwd7h0CPcqlUeclsyBRwMa38v64= +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= @@ -593,10 +597,8 @@ github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= -github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= -github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= @@ -637,7 +639,6 @@ github.com/godbus/dbus/v5 v5.0.4/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 v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gofrs/uuid v4.3.0+incompatible h1:CaSVZxm5B+7o45rtab4jC2G37WGYX1zQfuU2i6DSvnc= 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= @@ -758,6 +759,8 @@ github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= +github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= 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= @@ -778,8 +781,8 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 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.7.0 h1:IcsPKeInNvYi7eqSaDjiZqDDKu5rsmunY0Y1YupQSSQ= -github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= +github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cUUI8Ki4= +github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -970,6 +973,7 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -990,7 +994,6 @@ github.com/ldez/tagliatelle v0.4.0/go.mod h1:mNtTfrHy2haaBAw+VT7IBV6VXBThS7TCreY github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= 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.1 h1:suWXRU57D4/Enn6pXR0QVqqWWrnJ9Osrz+5rjt8ivzU= github.com/leonklingele/grouper v1.1.1/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -1035,8 +1038,8 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= -github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -1173,6 +1176,8 @@ github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08/go.mod h1:pxMtw7c github.com/philhofer/fwd v1.0.0/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/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= @@ -1239,7 +1244,6 @@ github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Ung github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/regen-network/gocuke v0.6.2 h1:pHviZ0kKAq2U2hN2q3smKNxct6hS0mGByFMHGnWA97M= github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= @@ -1250,13 +1254,15 @@ github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRr 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.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= -github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +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= @@ -1356,8 +1362,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 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 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= 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.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= @@ -1401,8 +1408,8 @@ github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2 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 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= github.com/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= @@ -1499,9 +1506,10 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/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-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= +golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= 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= @@ -1516,8 +1524,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU= -golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= +golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= +golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 h1:J74nGeMgeFnYQJN59eFwh06jX/V8g0lB7LWpjSLxtgU= @@ -1554,8 +1562,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= -golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= +golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= 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= @@ -1610,6 +1618,7 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-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= @@ -1626,8 +1635,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= -golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1653,8 +1662,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.6.0 h1:Lh8GPgSKBfWSwFvtuWOfeI3aAAnbXTSutYxJiOJFgIw= -golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= +golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= +golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= 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= @@ -1669,8 +1678,9 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ 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.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1788,8 +1798,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.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.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1798,8 +1808,8 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ= -golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= +golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= +golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= 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= @@ -1809,12 +1819,13 @@ 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.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1969,8 +1980,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.110.0 h1:l+rh0KYUooe9JGbGVx71tbFo4SMbMTXK3I3ia2QSEeU= -google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI= +google.golang.org/api v0.126.0 h1:q4GJq+cAdMAC7XP7njvQ4tvohGLiSlytuL4BQxbIZ+o= +google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -2091,8 +2102,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw 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-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= +google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 h1:Au6te5hbKUV8pIYWHqOUZ1pva5qK/rwbIhoXEUB9Lu8= +google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:O9kGHb51iE/nOGvQaDUuadVYqovW56s5emA88lQnj6Y= +google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 h1:s5YSX+ZH5b5vS9rnpGymvIyMpLRJizowqDlOuyjXnTk= +google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= 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= @@ -2134,8 +2149,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu 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.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= +google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= 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= @@ -2152,8 +2167,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ 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.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= 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= @@ -2191,7 +2206,7 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= +gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= 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= From d14236647e584d38f7b4f07718a6c9b28e60a6df Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 12 Sep 2023 12:16:08 +0200 Subject: [PATCH 010/109] chore: update to ibc-go to v7.3.0 --- go.mod | 18 +++++++++--------- go.sum | 39 ++++++++++++++++++--------------------- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/go.mod b/go.mod index e7b0184f..83b559a6 100644 --- a/go.mod +++ b/go.mod @@ -6,20 +6,20 @@ require ( cosmossdk.io/errors v1.0.0 cosmossdk.io/math v1.1.2 github.com/cometbft/cometbft v0.37.2 - github.com/cometbft/cometbft-db v0.7.0 + github.com/cometbft/cometbft-db v0.8.0 github.com/cosmos/cosmos-proto v1.0.0-beta.2 - github.com/cosmos/cosmos-sdk v0.47.3 + github.com/cosmos/cosmos-sdk v0.47.5 github.com/cosmos/gogoproto v1.4.10 - github.com/cosmos/ibc-go/v7 v7.0.0 + github.com/cosmos/ibc-go/v7 v7.3.0 github.com/ethereum/go-ethereum v1.10.22 github.com/golang/protobuf v1.5.3 github.com/golangci/golangci-lint v1.52.2 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/onsi/ginkgo/v2 v2.8.0 github.com/onsi/gomega v1.26.0 - github.com/spf13/cast v1.5.0 - github.com/spf13/cobra v1.6.1 - github.com/spf13/viper v1.15.0 + github.com/spf13/cast v1.5.1 + github.com/spf13/cobra v1.7.0 + github.com/spf13/viper v1.16.0 github.com/strangelove-ventures/packet-forward-middleware/v7 v7.0.0-20230523193151-73dea436e53f github.com/stretchr/testify v1.8.4 google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 @@ -195,6 +195,7 @@ require ( github.com/leonklingele/grouper v1.1.1 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect + github.com/linxGnu/grocksdb v1.7.16 // indirect github.com/lufeee/execinquery v1.2.1 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect @@ -221,7 +222,7 @@ require ( github.com/nunnatsa/ginkgolinter v0.9.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/otiai10/copy v1.6.0 // indirect - github.com/pelletier/go-toml/v2 v2.0.7 // indirect + github.com/pelletier/go-toml/v2 v2.0.8 // 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.0 // indirect @@ -254,7 +255,7 @@ require ( github.com/sivchari/tenv v1.7.1 // indirect github.com/sonatard/noctx v0.0.2 // indirect github.com/sourcegraph/go-diff v0.7.0 // indirect - github.com/spf13/afero v1.9.3 // indirect + github.com/spf13/afero v1.9.5 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect @@ -264,7 +265,6 @@ require ( github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect - github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tetafro/godot v1.4.11 // indirect github.com/tidwall/btree v1.6.0 // indirect diff --git a/go.sum b/go.sum index ecf397fc..4e024564 100644 --- a/go.sum +++ b/go.sum @@ -413,8 +413,8 @@ github.com/coinbase/rosetta-sdk-go v0.7.9 h1:lqllBjMnazTjIqYrOGv8h8jxjg9+hJazIGZ github.com/coinbase/rosetta-sdk-go v0.7.9/go.mod h1:0/knutI7XGVqXmmH4OQD8OckFrbQ8yMsUZTG7FXCR2M= 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.7.0 h1:uBjbrBx4QzU0zOEnU8KxoDl18dMNgDh+zZRUE0ucsbo= -github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= +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/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= @@ -442,8 +442,8 @@ github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoK github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek= 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.0.0 h1:j4kyywlG0hhDmT9FmSaR5iCIka7Pz7kJTxGWY1nlV9Q= -github.com/cosmos/ibc-go/v7 v7.0.0/go.mod h1:BFh8nKWjr5zeR2OZfhkzdgDzj1+KjRn3aJLpwapStj8= +github.com/cosmos/ibc-go/v7 v7.3.0 h1:QtGeVMi/3JeLWuvEuC60sBHpAF40Oenx/y+bP8+wRRw= +github.com/cosmos/ibc-go/v7 v7.3.0/go.mod h1:mUmaHFXpXrEdcxfdXyau+utZf14pGKVUiXwYftRZZfQ= 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.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA= @@ -531,9 +531,6 @@ github.com/ethereum/go-ethereum v1.10.22 h1:HbEgsDo1YTGIf4KB/NNpn+XH+PiNJXUZ9ksR github.com/ethereum/go-ethereum v1.10.22/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= @@ -891,7 +888,6 @@ github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1: 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.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 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/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= @@ -1003,6 +999,8 @@ github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6 github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/linxGnu/grocksdb v1.7.16 h1:Q2co1xrpdkr5Hx3Fp+f+f7fRGhQFQhvi/+226dtLmA8= +github.com/linxGnu/grocksdb v1.7.16/go.mod h1:JkS7pl5qWpGpuVb3bPqTz8nC12X3YtPZT+Xq7+QfQo4= github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= @@ -1165,8 +1163,8 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml/v2 v2.0.7 h1:muncTPStnKRos5dpVKULv2FVd4bMOhNePj9CjgDb8Us= -github.com/pelletier/go-toml/v2 v2.0.7/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= +github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= +github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= @@ -1317,15 +1315,15 @@ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasO github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= -github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= +github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM= +github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= -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.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= -github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= +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 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= @@ -1334,8 +1332,8 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= -github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= +github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= +github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= @@ -1363,6 +1361,7 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ 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.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= 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.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= @@ -1373,8 +1372,6 @@ github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplB github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c/go.mod h1:SbErYREK7xXdsRiigaQiQkI9McGRzYMvlKYaP3Nimdk= github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= github.com/tdakkota/asciicheck v0.2.0/go.mod h1:Qb7Y9EgjCLJGup51gDHFzbI08/gbGhL/UVhYIPWG2rg= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/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/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= @@ -1505,8 +1502,8 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/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-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= From fb1c0535d8574fbf3fccc9df867c2a113b865987 Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 12 Sep 2023 12:16:25 +0200 Subject: [PATCH 011/109] chore: add ibc-go upgrade --- app/upgrades/v1_4/upgrade.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/upgrades/v1_4/upgrade.go b/app/upgrades/v1_4/upgrade.go index b037723d..7424abd8 100644 --- a/app/upgrades/v1_4/upgrade.go +++ b/app/upgrades/v1_4/upgrade.go @@ -5,6 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/ibc-go/v7/modules/core/exported" // Consensus consensusKeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" @@ -50,6 +51,12 @@ func CreateUpgradeHandler( return vm, err } + // ibc-go v7.0 to v7.1 upgrade + // explicitly update the IBC 02-client params, adding the localhost client type + params := ibcKeeper.ClientKeeper.GetParams(ctx) + params.AllowedClients = append(params.AllowedClients, exported.Localhost) + ibcKeeper.ClientKeeper.SetParams(ctx, params) + // Run module migrations. vm, err = mm.RunMigrations(ctx, configurator, vm) if err != nil { @@ -57,7 +64,7 @@ func CreateUpgradeHandler( } // Migrate initial deposit ratio. - err = MigrateInitialDepositRatio(ctx, globalKeeper, govKeeper) + err = migrateInitialDepositRatio(ctx, globalKeeper, govKeeper) if err != nil { return vm, err } @@ -66,9 +73,9 @@ func CreateUpgradeHandler( } } -// MigrateInitialDepositRatio migrates the MinInitialDepositRatio parameter from +// migrateInitialDepositRatio migrates the MinInitialDepositRatio parameter from // our custom x/global module to the x/gov module. -func MigrateInitialDepositRatio( +func migrateInitialDepositRatio( ctx sdk.Context, globalKeeper globalKeeper.Keeper, govKeeper govKeeper.Keeper, From b28e024c64725ff4ee720e9b9f4e31cbe7c581bb Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 12 Sep 2023 14:27:32 +0200 Subject: [PATCH 012/109] chore: change upgrade order --- app/upgrades/v1_4/upgrade.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/upgrades/v1_4/upgrade.go b/app/upgrades/v1_4/upgrade.go index 7424abd8..0568535e 100644 --- a/app/upgrades/v1_4/upgrade.go +++ b/app/upgrades/v1_4/upgrade.go @@ -6,6 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/ibc-go/v7/modules/core/exported" + ibcTmMigrations "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint/migrations" // Consensus consensusKeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" @@ -15,8 +16,7 @@ import ( govKeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" // IBC Core ibcKeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - // IBC Light Clients - ibcTmMigrations "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint/migrations" + // Params paramsKeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramsTypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -45,12 +45,6 @@ func CreateUpgradeHandler( WithKeyTable(paramsTypes.ConsensusParamsKeyTable()) baseapp.MigrateParams(ctx, baseAppSubspace, &consensusKeeper) - // Prune expired Tendermint consensus states. - _, err = ibcTmMigrations.PruneExpiredConsensusStates(ctx, cdc, ibcKeeper.ClientKeeper) - if err != nil { - return vm, err - } - // ibc-go v7.0 to v7.1 upgrade // explicitly update the IBC 02-client params, adding the localhost client type params := ibcKeeper.ClientKeeper.GetParams(ctx) @@ -63,6 +57,12 @@ func CreateUpgradeHandler( return vm, err } + // Prune expired Tendermint consensus states. + _, err = ibcTmMigrations.PruneExpiredConsensusStates(ctx, cdc, ibcKeeper.ClientKeeper) + if err != nil { + return vm, err + } + // Migrate initial deposit ratio. err = migrateInitialDepositRatio(ctx, globalKeeper, govKeeper) if err != nil { From 097006235211f9800f9d789c66a4930c22d92bf2 Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 12 Sep 2023 14:48:47 +0200 Subject: [PATCH 013/109] chore: update CHANGELOG.md --- CHANGELOG.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf73da6c..542ddc98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,9 +14,12 @@ An '!' indicates a state machine breaking change. -## [v1.4.0](https://github.com/KYVENetwork/chain/releases/tag/v1.4.0) - 2023-09-04 +## [v1.4.0](https://github.com/KYVENetwork/chain/releases/tag/v1.4.0) - 2023-09-12 -- [#33](https://github.com/KYVENetwork/chain/pull/33) Upgrade Cosmos SDK to [v0.47.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.3) ([`v0.47.3-kyve`](https://github.com/KYVENetwork/cosmos-sdk/releases/tag/v0.47.3-kyve)). +### Improvements + +- (deps) [#33](https://github.com/KYVENetwork/chain/pull/33) Upgrade Cosmos SDK to [v0.47.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.5) ([`v0.47.5-kyve`](https://github.com/KYVENetwork/cosmos-sdk/releases/tag/v0.47.5-kyve)). +- [#35](https://github.com/KYVENetwork/chain/pull/35) Use [interchaintest](https://github.com/strangelove-ventures/interchaintest) to test chain upgrades. ## [v1.3.1](https://github.com/KYVENetwork/chain/releases/tag/v1.3.1) - 2023-08-02 From cbb5eac3b218f84532e89486150028d274a7e789 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 21 Sep 2023 11:23:20 +0200 Subject: [PATCH 014/109] update tools.go --- tools/tools.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/tools.go b/tools/tools.go index 4e24981a..dc64365b 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -1,5 +1,4 @@ //go:build tools -// +build tools // This file uses the recommended method for tracking developer tools in a Go module. // @@ -7,6 +6,11 @@ package tools import ( + _ "github.com/cosmos/gogoproto/protoc-gen-gocosmos" + _ "github.com/golang/protobuf/protoc-gen-go" _ "github.com/golangci/golangci-lint/cmd/golangci-lint" + _ "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" _ "mvdan.cc/gofumpt" ) From c04fdf3044f8b8d20ecedaee7238b903973b90fd Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 21 Sep 2023 11:47:23 +0200 Subject: [PATCH 015/109] chore: go mod tidy --- go.mod | 28 ++++++++++++------------- go.sum | 56 +++++++++++++++++++++++++------------------------- tools/tools.go | 5 ----- 3 files changed, 42 insertions(+), 47 deletions(-) diff --git a/go.mod b/go.mod index 83b559a6..2786bea7 100644 --- a/go.mod +++ b/go.mod @@ -22,18 +22,18 @@ require ( github.com/spf13/viper v1.16.0 github.com/strangelove-ventures/packet-forward-middleware/v7 v7.0.0-20230523193151-73dea436e53f github.com/stretchr/testify v1.8.4 - google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 - google.golang.org/grpc v1.56.2 + google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d + google.golang.org/grpc v1.58.0 mvdan.cc/gofumpt v0.5.0 ) require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect - cloud.google.com/go v0.110.4 // indirect - cloud.google.com/go/compute v1.20.1 // indirect + cloud.google.com/go v0.110.6 // 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.0 // indirect + cloud.google.com/go/iam v1.1.1 // indirect cloud.google.com/go/storage v1.30.1 // indirect cosmossdk.io/api v0.3.1 // indirect cosmossdk.io/core v0.5.1 // indirect @@ -287,22 +287,22 @@ require ( go.uber.org/goleak v1.1.12 // indirect go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.11.0 // indirect + golang.org/x/crypto v0.13.0 // indirect golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // indirect golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.12.0 // indirect - golang.org/x/oauth2 v0.8.0 // indirect - golang.org/x/sync v0.2.0 // indirect - golang.org/x/sys v0.11.0 // indirect - golang.org/x/term v0.10.0 // indirect - golang.org/x/text v0.12.0 // indirect + golang.org/x/net v0.15.0 // indirect + golang.org/x/oauth2 v0.12.0 // indirect + golang.org/x/sync v0.3.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/term v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect golang.org/x/tools v0.8.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.126.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index 4e024564..33efaa78 100644 --- a/go.sum +++ b/go.sum @@ -38,8 +38,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 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.4 h1:1JYyxKMN9hd5dR2MYTPWkGUgcoxVVhg0LKNKEo0qvmk= -cloud.google.com/go v0.110.4/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= +cloud.google.com/go v0.110.6 h1:8uYAkj3YHTP/1iwReuHPxLSbdcyc+dSBbzFMrVwDR6Q= +cloud.google.com/go v0.110.6/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= @@ -77,8 +77,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz 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.20.1 h1:6aKEtlUiwEpJzM001l0yFkpXmUVXaN8W+fbkb2AZNbg= -cloud.google.com/go/compute v1.20.1/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +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= @@ -118,8 +118,8 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 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.0 h1:67gSqaPukx7O8WLLHMa0PNs3EBGd2eE4d+psbO/CO94= -cloud.google.com/go/iam v1.1.0/go.mod h1:nxdHjaKfCr7fNYx/HJMM8LgiMugmveWlkatear5gVyk= +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= @@ -1505,8 +1505,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= 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= @@ -1632,8 +1632,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1659,8 +1659,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.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= -golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= +golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= +golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1676,8 +1676,8 @@ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJ 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.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= 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= @@ -1795,8 +1795,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.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.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1805,8 +1805,8 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= 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= @@ -1821,8 +1821,8 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -2099,12 +2099,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw 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-20230706204954-ccb25ca9f130 h1:Au6te5hbKUV8pIYWHqOUZ1pva5qK/rwbIhoXEUB9Lu8= -google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:O9kGHb51iE/nOGvQaDUuadVYqovW56s5emA88lQnj6Y= -google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 h1:s5YSX+ZH5b5vS9rnpGymvIyMpLRJizowqDlOuyjXnTk= -google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= +google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g= +google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= google.golang.org/grpc v1.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= @@ -2146,8 +2146,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu 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.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o= +google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= 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= diff --git a/tools/tools.go b/tools/tools.go index dc64365b..26ec7364 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -6,11 +6,6 @@ package tools import ( - _ "github.com/cosmos/gogoproto/protoc-gen-gocosmos" - _ "github.com/golang/protobuf/protoc-gen-go" _ "github.com/golangci/golangci-lint/cmd/golangci-lint" - _ "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" _ "mvdan.cc/gofumpt" ) From ff87089fdca692f80221d5d4eb48362ed3103714 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 21 Sep 2023 13:28:20 +0200 Subject: [PATCH 016/109] feat: add funders module --- app/app.go | 17 + app/keepers.go | 2 + app/modules.go | 2 + go.mod | 2 +- go.sum | 4 +- proto/kyve/funders/v1beta1/events.proto | 8 + proto/kyve/funders/v1beta1/funders.proto | 7 + proto/kyve/funders/v1beta1/genesis.proto | 15 + proto/kyve/funders/v1beta1/params.proto | 11 + proto/kyve/funders/v1beta1/query.proto | 26 ++ proto/kyve/funders/v1beta1/tx.proto | 11 + testutil/keeper/funders.go | 52 +++ x/funders/client/cli/query.go | 31 ++ x/funders/client/cli/query_params.go | 36 ++ x/funders/client/cli/tx.go | 36 ++ x/funders/genesis.go | 23 + x/funders/genesis_test.go | 29 ++ x/funders/keeper/keeper.go | 42 ++ x/funders/keeper/msg_server.go | 17 + x/funders/keeper/msg_server_test.go | 23 + x/funders/keeper/params.go | 26 ++ x/funders/keeper/params_test.go | 18 + x/funders/keeper/query.go | 7 + x/funders/keeper/query_params.go | 19 + x/funders/keeper/query_params_test.go | 21 + x/funders/module.go | 148 +++++++ x/funders/types/codec.go | 23 + x/funders/types/errors.go | 12 + x/funders/types/events.pb.go | 36 ++ x/funders/types/expected_keepers.go | 18 + x/funders/types/funders.pb.go | 38 ++ x/funders/types/genesis.go | 17 + x/funders/types/genesis.pb.go | 325 ++++++++++++++ x/funders/types/genesis_test.go | 41 ++ x/funders/types/keys.go | 20 + x/funders/types/params.go | 32 ++ x/funders/types/params.pb.go | 301 +++++++++++++ x/funders/types/query.pb.go | 536 +++++++++++++++++++++++ x/funders/types/query.pb.gw.go | 153 +++++++ x/funders/types/tx.pb.go | 81 ++++ x/funders/types/types.go | 1 + 41 files changed, 2264 insertions(+), 3 deletions(-) create mode 100644 proto/kyve/funders/v1beta1/events.proto create mode 100644 proto/kyve/funders/v1beta1/funders.proto create mode 100644 proto/kyve/funders/v1beta1/genesis.proto create mode 100644 proto/kyve/funders/v1beta1/params.proto create mode 100644 proto/kyve/funders/v1beta1/query.proto create mode 100644 proto/kyve/funders/v1beta1/tx.proto create mode 100644 testutil/keeper/funders.go create mode 100644 x/funders/client/cli/query.go create mode 100644 x/funders/client/cli/query_params.go create mode 100644 x/funders/client/cli/tx.go create mode 100644 x/funders/genesis.go create mode 100644 x/funders/genesis_test.go create mode 100644 x/funders/keeper/keeper.go create mode 100644 x/funders/keeper/msg_server.go create mode 100644 x/funders/keeper/msg_server_test.go create mode 100644 x/funders/keeper/params.go create mode 100644 x/funders/keeper/params_test.go create mode 100644 x/funders/keeper/query.go create mode 100644 x/funders/keeper/query_params.go create mode 100644 x/funders/keeper/query_params_test.go create mode 100644 x/funders/module.go create mode 100644 x/funders/types/codec.go create mode 100644 x/funders/types/errors.go create mode 100644 x/funders/types/events.pb.go create mode 100644 x/funders/types/expected_keepers.go create mode 100644 x/funders/types/funders.pb.go create mode 100644 x/funders/types/genesis.go create mode 100644 x/funders/types/genesis.pb.go create mode 100644 x/funders/types/genesis_test.go create mode 100644 x/funders/types/keys.go create mode 100644 x/funders/types/params.go create mode 100644 x/funders/types/params.pb.go create mode 100644 x/funders/types/query.pb.go create mode 100644 x/funders/types/query.pb.gw.go create mode 100644 x/funders/types/tx.pb.go create mode 100644 x/funders/types/types.go diff --git a/app/app.go b/app/app.go index 2e9027f5..1ba5e498 100644 --- a/app/app.go +++ b/app/app.go @@ -162,6 +162,10 @@ import ( "github.com/cosmos/cosmos-sdk/x/upgrade" upgradeKeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + // Funders + "github.com/KYVENetwork/chain/x/funders" + fundersKeeper "github.com/KYVENetwork/chain/x/funders/keeper" + fundersTypes "github.com/KYVENetwork/chain/x/funders/types" ) const ( @@ -293,6 +297,7 @@ func NewKYVEApp( queryTypes.StoreKey, stakersTypes.StoreKey, teamTypes.StoreKey, + fundersTypes.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramsTypes.TStoreKey) memKeys := sdk.NewMemoryStoreKeys( @@ -522,6 +527,14 @@ func NewKYVEApp( app.DelegationKeeper, ) + app.FundersKeeper = *fundersKeeper.NewKeeper( + appCodec, + keys[fundersTypes.StoreKey], + memKeys[fundersTypes.MemStoreKey], + + authTypes.NewModuleAddress(govTypes.ModuleName).String(), + ) + app.IBCKeeper = ibcKeeper.NewKeeper( appCodec, keys[ibcExported.StoreKey], @@ -709,6 +722,7 @@ func NewKYVEApp( query.NewAppModule(appCodec, app.QueryKeeper, app.AccountKeeper, app.BankKeeper), stakers.NewAppModule(appCodec, app.StakersKeeper, app.AccountKeeper, app.BankKeeper), team.NewAppModule(appCodec, app.BankKeeper, app.MintKeeper, app.TeamKeeper, *app.UpgradeKeeper), + funders.NewAppModule(appCodec, app.FundersKeeper, app.AccountKeeper, app.BankKeeper), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -750,6 +764,7 @@ func NewKYVEApp( delegationTypes.ModuleName, queryTypes.ModuleName, globalTypes.ModuleName, + fundersTypes.ModuleName, ) app.mm.SetOrderEndBlockers( @@ -784,6 +799,7 @@ func NewKYVEApp( queryTypes.ModuleName, globalTypes.ModuleName, teamTypes.ModuleName, + fundersTypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -823,6 +839,7 @@ func NewKYVEApp( queryTypes.ModuleName, globalTypes.ModuleName, teamTypes.ModuleName, + fundersTypes.ModuleName, ) // Uncomment if you want to set a custom migration order here. diff --git a/app/keepers.go b/app/keepers.go index 3959e0bb..e265ce64 100644 --- a/app/keepers.go +++ b/app/keepers.go @@ -1,6 +1,7 @@ package app import ( + fundersKeeper "github.com/KYVENetwork/chain/x/funders/keeper" "github.com/cosmos/cosmos-sdk/codec" storeTypes "github.com/cosmos/cosmos-sdk/store/types" @@ -112,6 +113,7 @@ type Keepers struct { QueryKeeper queryKeeper.Keeper StakersKeeper stakersKeeper.Keeper TeamKeeper teamKeeper.Keeper + FundersKeeper fundersKeeper.Keeper // ----- Scoped Keepers ----- // make scoped keepers public for test purposes diff --git a/app/modules.go b/app/modules.go index a94366f3..5a1a349f 100644 --- a/app/modules.go +++ b/app/modules.go @@ -1,6 +1,7 @@ package app import ( + "github.com/KYVENetwork/chain/x/funders" "github.com/cosmos/cosmos-sdk/types/module" // Auth @@ -129,6 +130,7 @@ var appModuleBasics = []module.AppModuleBasic{ query.AppModuleBasic{}, stakers.AppModuleBasic{}, team.AppModuleBasic{}, + funders.AppModuleBasic{}, } // moduleAccountPermissions ... diff --git a/go.mod b/go.mod index 2786bea7..5a316e96 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/strangelove-ventures/packet-forward-middleware/v7 v7.0.0-20230523193151-73dea436e53f github.com/stretchr/testify v1.8.4 google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d - google.golang.org/grpc v1.58.0 + google.golang.org/grpc v1.58.1 mvdan.cc/gofumpt v0.5.0 ) diff --git a/go.sum b/go.sum index 33efaa78..d0e68c6c 100644 --- a/go.sum +++ b/go.sum @@ -2146,8 +2146,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu 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.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o= -google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.1 h1:OL+Vz23DTtrrldqHK49FUOPHyY75rvFqJfXC84NYW58= +google.golang.org/grpc v1.58.1/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= 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= diff --git a/proto/kyve/funders/v1beta1/events.proto b/proto/kyve/funders/v1beta1/events.proto new file mode 100644 index 00000000..96ca7255 --- /dev/null +++ b/proto/kyve/funders/v1beta1/events.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; + +package kyve.funders.v1beta1; + +//import "gogoproto/gogo.proto"; +//import "kyve/funders/v1beta1/params.proto"; + +option go_package = "github.com/KYVENetwork/chain/x/funders/types"; diff --git a/proto/kyve/funders/v1beta1/funders.proto b/proto/kyve/funders/v1beta1/funders.proto new file mode 100644 index 00000000..816b5d1b --- /dev/null +++ b/proto/kyve/funders/v1beta1/funders.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +package kyve.funders.v1beta1; + +//import "gogoproto/gogo.proto"; + +option go_package = "github.com/KYVENetwork/chain/x/funders/types"; diff --git a/proto/kyve/funders/v1beta1/genesis.proto b/proto/kyve/funders/v1beta1/genesis.proto new file mode 100644 index 00000000..b62f7b34 --- /dev/null +++ b/proto/kyve/funders/v1beta1/genesis.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package kyve.funders.v1beta1; + +import "gogoproto/gogo.proto"; +//import "kyve/funders/v1beta1/funders.proto"; +import "kyve/funders/v1beta1/params.proto"; + +option go_package = "github.com/KYVENetwork/chain/x/funders/types"; + +// GenesisState defines the funders module's genesis state. +message GenesisState { + // params defines all the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false]; +} diff --git a/proto/kyve/funders/v1beta1/params.proto b/proto/kyve/funders/v1beta1/params.proto new file mode 100644 index 00000000..54e518ef --- /dev/null +++ b/proto/kyve/funders/v1beta1/params.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +package kyve.funders.v1beta1; + +option go_package = "github.com/KYVENetwork/chain/x/funders/types"; + +// Params defines the funders module parameters. +message Params { + // //TODO: change param + uint64 random_param = 1; +} diff --git a/proto/kyve/funders/v1beta1/query.proto b/proto/kyve/funders/v1beta1/query.proto new file mode 100644 index 00000000..58d13403 --- /dev/null +++ b/proto/kyve/funders/v1beta1/query.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package kyve.funders.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "kyve/funders/v1beta1/params.proto"; + +option go_package = "github.com/KYVENetwork/chain/x/funders/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 = "/kyve/funders/v1beta1/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/kyve/funders/v1beta1/tx.proto b/proto/kyve/funders/v1beta1/tx.proto new file mode 100644 index 00000000..1fac7012 --- /dev/null +++ b/proto/kyve/funders/v1beta1/tx.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +package kyve.funders.v1beta1; + +//import "cosmos_proto/cosmos.proto"; +//import "gogoproto/gogo.proto"; + +option go_package = "github.com/KYVENetwork/chain/x/funders/types"; + +// Msg defines the Msg service. +service Msg {} diff --git a/testutil/keeper/funders.go b/testutil/keeper/funders.go new file mode 100644 index 00000000..b64096eb --- /dev/null +++ b/testutil/keeper/funders.go @@ -0,0 +1,52 @@ +package keeper + +import ( + "testing" + + "github.com/KYVENetwork/chain/x/funders/keeper" + "github.com/KYVENetwork/chain/x/funders/types" + 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" +) + +func FundersKeeper(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, + "FundersParams", + ) + 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/x/funders/client/cli/query.go b/x/funders/client/cli/query.go new file mode 100644 index 00000000..6378890d --- /dev/null +++ b/x/funders/client/cli/query.go @@ -0,0 +1,31 @@ +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/KYVENetwork/chain/x/funders/types" +) + +// GetQueryCmd returns the cli query commands for this module +func GetQueryCmd(queryRoute string) *cobra.Command { + // Group funders 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/funders/client/cli/query_params.go b/x/funders/client/cli/query_params.go new file mode 100644 index 00000000..782568e8 --- /dev/null +++ b/x/funders/client/cli/query_params.go @@ -0,0 +1,36 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/KYVENetwork/chain/x/funders/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/funders/client/cli/tx.go b/x/funders/client/cli/tx.go new file mode 100644 index 00000000..7a54fc35 --- /dev/null +++ b/x/funders/client/cli/tx.go @@ -0,0 +1,36 @@ +package cli + +import ( + "fmt" + "time" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + // "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/KYVENetwork/chain/x/funders/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/funders/genesis.go b/x/funders/genesis.go new file mode 100644 index 00000000..6b6b7b34 --- /dev/null +++ b/x/funders/genesis.go @@ -0,0 +1,23 @@ +package funders + +import ( + "github.com/KYVENetwork/chain/x/funders/keeper" + "github.com/KYVENetwork/chain/x/funders/types" + sdk "github.com/cosmos/cosmos-sdk/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/funders/genesis_test.go b/x/funders/genesis_test.go new file mode 100644 index 00000000..19cd91b1 --- /dev/null +++ b/x/funders/genesis_test.go @@ -0,0 +1,29 @@ +package funders_test + +import ( + "testing" + + keepertest "github.com/KYVENetwork/chain/testutil/keeper" + "github.com/KYVENetwork/chain/testutil/nullify" + "github.com/KYVENetwork/chain/x/funders" + "github.com/KYVENetwork/chain/x/funders/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.FundersKeeper(t) + funders.InitGenesis(ctx, *k, genesisState) + got := funders.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/funders/keeper/keeper.go b/x/funders/keeper/keeper.go new file mode 100644 index 00000000..99f71ced --- /dev/null +++ b/x/funders/keeper/keeper.go @@ -0,0 +1,42 @@ +package keeper + +import ( + "fmt" + + "github.com/KYVENetwork/chain/x/funders/types" + "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" +) + +type ( + Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + memKey storetypes.StoreKey + + authority string + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + storeKey, + memKey storetypes.StoreKey, + + authority string, + +) *Keeper { + return &Keeper{ + cdc: cdc, + storeKey: storeKey, + memKey: memKey, + + authority: authority, + } +} + +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/funders/keeper/msg_server.go b/x/funders/keeper/msg_server.go new file mode 100644 index 00000000..66990305 --- /dev/null +++ b/x/funders/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/KYVENetwork/chain/x/funders/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/funders/keeper/msg_server_test.go b/x/funders/keeper/msg_server_test.go new file mode 100644 index 00000000..b67f11c0 --- /dev/null +++ b/x/funders/keeper/msg_server_test.go @@ -0,0 +1,23 @@ +package keeper_test + +import ( + "context" + "testing" + + keepertest "github.com/KYVENetwork/chain/testutil/keeper" + "github.com/KYVENetwork/chain/x/funders/keeper" + "github.com/KYVENetwork/chain/x/funders/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" +) + +func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { + k, ctx := keepertest.FundersKeeper(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/funders/keeper/params.go b/x/funders/keeper/params.go new file mode 100644 index 00000000..5d95604c --- /dev/null +++ b/x/funders/keeper/params.go @@ -0,0 +1,26 @@ +package keeper + +import ( + "github.com/KYVENetwork/chain/x/funders/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + store := ctx.KVStore(k.storeKey) + + 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 sdk.Context, params types.Params) { + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(¶ms) + store.Set(types.ParamsKey, bz) +} diff --git a/x/funders/keeper/params_test.go b/x/funders/keeper/params_test.go new file mode 100644 index 00000000..5ce8fda1 --- /dev/null +++ b/x/funders/keeper/params_test.go @@ -0,0 +1,18 @@ +package keeper_test + +import ( + "testing" + + testkeeper "github.com/KYVENetwork/chain/testutil/keeper" + "github.com/KYVENetwork/chain/x/funders/types" + "github.com/stretchr/testify/require" +) + +func TestGetParams(t *testing.T) { + k, ctx := testkeeper.FundersKeeper(t) + params := types.DefaultParams() + + k.SetParams(ctx, params) + + require.EqualValues(t, params, k.GetParams(ctx)) +} diff --git a/x/funders/keeper/query.go b/x/funders/keeper/query.go new file mode 100644 index 00000000..e031fbbe --- /dev/null +++ b/x/funders/keeper/query.go @@ -0,0 +1,7 @@ +package keeper + +import ( + "github.com/KYVENetwork/chain/x/funders/types" +) + +var _ types.QueryServer = Keeper{} diff --git a/x/funders/keeper/query_params.go b/x/funders/keeper/query_params.go new file mode 100644 index 00000000..3a937d2d --- /dev/null +++ b/x/funders/keeper/query_params.go @@ -0,0 +1,19 @@ +package keeper + +import ( + "context" + + "github.com/KYVENetwork/chain/x/funders/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +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/funders/keeper/query_params_test.go b/x/funders/keeper/query_params_test.go new file mode 100644 index 00000000..956d0d37 --- /dev/null +++ b/x/funders/keeper/query_params_test.go @@ -0,0 +1,21 @@ +package keeper_test + +import ( + "testing" + + testkeeper "github.com/KYVENetwork/chain/testutil/keeper" + "github.com/KYVENetwork/chain/x/funders/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" +) + +func TestParamsQuery(t *testing.T) { + keeper, ctx := testkeeper.FundersKeeper(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/funders/module.go b/x/funders/module.go new file mode 100644 index 00000000..0fc0cccd --- /dev/null +++ b/x/funders/module.go @@ -0,0 +1,148 @@ +package funders + +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/KYVENetwork/chain/x/funders/client/cli" + "github.com/KYVENetwork/chain/x/funders/keeper" + "github.com/KYVENetwork/chain/x/funders/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" +) + +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/funders/types/codec.go b/x/funders/types/codec.go new file mode 100644 index 00000000..844157a8 --- /dev/null +++ b/x/funders/types/codec.go @@ -0,0 +1,23 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + // this line is used by starport scaffolding # 1 + "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/funders/types/errors.go b/x/funders/types/errors.go new file mode 100644 index 00000000..50c80d4e --- /dev/null +++ b/x/funders/types/errors.go @@ -0,0 +1,12 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// x/funders module sentinel errors +var ( + ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") +) diff --git a/x/funders/types/events.pb.go b/x/funders/types/events.pb.go new file mode 100644 index 00000000..a6a5a55e --- /dev/null +++ b/x/funders/types/events.pb.go @@ -0,0 +1,36 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/funders/v1beta1/events.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +func init() { proto.RegisterFile("kyve/funders/v1beta1/events.proto", fileDescriptor_1cf957abd56bbcb0) } + +var fileDescriptor_1cf957abd56bbcb0 = []byte{ + // 141 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcc, 0xae, 0x2c, 0x4b, + 0xd5, 0x4f, 0x2b, 0xcd, 0x4b, 0x49, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, + 0xd4, 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, + 0x29, 0xd1, 0x83, 0x2a, 0xd1, 0x83, 0x2a, 0x71, 0x72, 0x3b, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, + 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, + 0x63, 0x39, 0x86, 0x28, 0x9d, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, + 0xef, 0xc8, 0x30, 0x57, 0xbf, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0xfd, 0xe4, 0x8c, 0xc4, 0xcc, + 0x3c, 0xfd, 0x0a, 0xb8, 0x65, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x4b, 0x8c, 0x01, + 0x01, 0x00, 0x00, 0xff, 0xff, 0x9b, 0xdc, 0x97, 0x93, 0x89, 0x00, 0x00, 0x00, +} diff --git a/x/funders/types/expected_keepers.go b/x/funders/types/expected_keepers.go new file mode 100644 index 00000000..6aa6e977 --- /dev/null +++ b/x/funders/types/expected_keepers.go @@ -0,0 +1,18 @@ +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/funders/types/funders.pb.go b/x/funders/types/funders.pb.go new file mode 100644 index 00000000..cf0d4b32 --- /dev/null +++ b/x/funders/types/funders.pb.go @@ -0,0 +1,38 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/funders/v1beta1/funders.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +func init() { + proto.RegisterFile("kyve/funders/v1beta1/funders.proto", fileDescriptor_252d80f89b0fa299) +} + +var fileDescriptor_252d80f89b0fa299 = []byte{ + // 134 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xca, 0xae, 0x2c, 0x4b, + 0xd5, 0x4f, 0x2b, 0xcd, 0x4b, 0x49, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, + 0x84, 0xf1, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x44, 0x40, 0x6a, 0xf4, 0x60, 0x62, 0x50, + 0x35, 0x4e, 0x6e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, + 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x93, 0x9e, + 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0xef, 0x1d, 0x19, 0xe6, 0xea, 0x97, 0x5a, + 0x52, 0x9e, 0x5f, 0x94, 0xad, 0x9f, 0x9c, 0x91, 0x98, 0x99, 0xa7, 0x5f, 0x01, 0xb7, 0xad, 0xa4, + 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x6c, 0x89, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x49, 0x82, + 0xff, 0xea, 0x8a, 0x00, 0x00, 0x00, +} diff --git a/x/funders/types/genesis.go b/x/funders/types/genesis.go new file mode 100644 index 00000000..b89c5f17 --- /dev/null +++ b/x/funders/types/genesis.go @@ -0,0 +1,17 @@ +package types + +// 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/funders/types/genesis.pb.go b/x/funders/types/genesis.pb.go new file mode 100644 index 00000000..df56bdc0 --- /dev/null +++ b/x/funders/types/genesis.pb.go @@ -0,0 +1,325 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/funders/v1beta1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the funders module's genesis state. +type GenesisState struct { + // params defines all the parameters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_d339226ca8e2c929, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "kyve.funders.v1beta1.GenesisState") +} + +func init() { + proto.RegisterFile("kyve/funders/v1beta1/genesis.proto", fileDescriptor_d339226ca8e2c929) +} + +var fileDescriptor_d339226ca8e2c929 = []byte{ + // 209 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xca, 0xae, 0x2c, 0x4b, + 0xd5, 0x4f, 0x2b, 0xcd, 0x4b, 0x49, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, + 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, + 0x01, 0xa9, 0xd1, 0x83, 0xaa, 0xd1, 0x83, 0xaa, 0x91, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, + 0xd0, 0x07, 0xb1, 0x20, 0x6a, 0xa5, 0x14, 0xb1, 0x9a, 0x57, 0x90, 0x58, 0x94, 0x98, 0x0b, 0x35, + 0x4e, 0xc9, 0x8b, 0x8b, 0xc7, 0x1d, 0x62, 0x7e, 0x70, 0x49, 0x62, 0x49, 0xaa, 0x90, 0x15, 0x17, + 0x1b, 0x44, 0x5e, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x46, 0x0f, 0x9b, 0x7d, 0x7a, 0x01, + 0x60, 0x35, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x41, 0x75, 0x38, 0xb9, 0x9d, 0x78, 0x24, + 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, + 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x4e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, + 0x72, 0x7e, 0xae, 0xbe, 0x77, 0x64, 0x98, 0xab, 0x5f, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0xb6, 0x7e, + 0x72, 0x46, 0x62, 0x66, 0x9e, 0x7e, 0x05, 0xdc, 0x89, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, + 0x60, 0xa7, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x8a, 0xb6, 0xa8, 0x14, 0x0f, 0x01, 0x00, + 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/funders/types/genesis_test.go b/x/funders/types/genesis_test.go new file mode 100644 index 00000000..ddea9f14 --- /dev/null +++ b/x/funders/types/genesis_test.go @@ -0,0 +1,41 @@ +package types_test + +import ( + "testing" + + "github.com/KYVENetwork/chain/x/funders/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{ + + // 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/funders/types/keys.go b/x/funders/types/keys.go new file mode 100644 index 00000000..8123d1a7 --- /dev/null +++ b/x/funders/types/keys.go @@ -0,0 +1,20 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "funders" + + // 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_funders" +) + +var ( + // ParamsKey is the prefix for all module params defined in params.proto + ParamsKey = []byte{0x00} +) diff --git a/x/funders/types/params.go b/x/funders/types/params.go new file mode 100644 index 00000000..4f3215e3 --- /dev/null +++ b/x/funders/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/funders/types/params.pb.go b/x/funders/types/params.pb.go new file mode 100644 index 00000000..1a937ee8 --- /dev/null +++ b/x/funders/types/params.pb.go @@ -0,0 +1,301 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/funders/v1beta1/params.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the funders module parameters. +type Params struct { + // //TODO: change param + RandomParam uint64 `protobuf:"varint,1,opt,name=random_param,json=randomParam,proto3" json:"random_param,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_906a9a55094dc984, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetRandomParam() uint64 { + if m != nil { + return m.RandomParam + } + return 0 +} + +func init() { + proto.RegisterType((*Params)(nil), "kyve.funders.v1beta1.Params") +} + +func init() { proto.RegisterFile("kyve/funders/v1beta1/params.proto", fileDescriptor_906a9a55094dc984) } + +var fileDescriptor_906a9a55094dc984 = []byte{ + // 173 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcc, 0xae, 0x2c, 0x4b, + 0xd5, 0x4f, 0x2b, 0xcd, 0x4b, 0x49, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, + 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, + 0x29, 0xd1, 0x83, 0x2a, 0xd1, 0x83, 0x2a, 0x51, 0xd2, 0xe6, 0x62, 0x0b, 0x00, 0xab, 0x12, 0x52, + 0xe4, 0xe2, 0x29, 0x4a, 0xcc, 0x4b, 0xc9, 0xcf, 0x8d, 0x07, 0x6b, 0x93, 0x60, 0x54, 0x60, 0xd4, + 0x60, 0x09, 0xe2, 0x86, 0x88, 0x81, 0xd5, 0x38, 0xb9, 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, + 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, + 0xb1, 0x1c, 0x43, 0x94, 0x4e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0xbe, + 0x77, 0x64, 0x98, 0xab, 0x5f, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0xb6, 0x7e, 0x72, 0x46, 0x62, 0x66, + 0x9e, 0x7e, 0x05, 0xdc, 0x65, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x17, 0x19, 0x03, + 0x02, 0x00, 0x00, 0xff, 0xff, 0x27, 0x35, 0xef, 0x63, 0xb6, 0x00, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RandomParam != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.RandomParam)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RandomParam != 0 { + n += 1 + sovParams(uint64(m.RandomParam)) + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RandomParam", wireType) + } + m.RandomParam = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RandomParam |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/funders/types/query.pb.go b/x/funders/types/query.pb.go new file mode 100644 index 00000000..83ed0025 --- /dev/null +++ b/x/funders/types/query.pb.go @@ -0,0 +1,536 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/funders/v1beta1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_6f21e7f51590fda7, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_6f21e7f51590fda7, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "kyve.funders.v1beta1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "kyve.funders.v1beta1.QueryParamsResponse") +} + +func init() { proto.RegisterFile("kyve/funders/v1beta1/query.proto", fileDescriptor_6f21e7f51590fda7) } + +var fileDescriptor_6f21e7f51590fda7 = []byte{ + // 289 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc8, 0xae, 0x2c, 0x4b, + 0xd5, 0x4f, 0x2b, 0xcd, 0x4b, 0x49, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, + 0xd4, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, 0xa9, + 0xd0, 0x83, 0xaa, 0xd0, 0x83, 0xaa, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd0, 0x07, + 0xb1, 0x20, 0x6a, 0xa5, 0x64, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, + 0x13, 0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0xa1, 0xb2, 0x8a, 0x58, 0xed, + 0x2a, 0x48, 0x2c, 0x4a, 0xcc, 0x85, 0x2a, 0x51, 0x12, 0xe1, 0x12, 0x0a, 0x04, 0xd9, 0x1d, 0x00, + 0x16, 0x0c, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x51, 0x0a, 0xe4, 0x12, 0x46, 0x11, 0x2d, 0x2e, + 0xc8, 0xcf, 0x2b, 0x4e, 0x15, 0xb2, 0xe2, 0x62, 0x83, 0x68, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0, + 0x36, 0x92, 0xd1, 0xc3, 0xe6, 0x54, 0x3d, 0x88, 0x2e, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, + 0xa0, 0x3a, 0x8c, 0x7a, 0x19, 0xb9, 0x58, 0xc1, 0x66, 0x0a, 0x35, 0x33, 0x72, 0xb1, 0x41, 0x94, + 0x08, 0x69, 0x60, 0x37, 0x00, 0xd3, 0x45, 0x52, 0x9a, 0x44, 0xa8, 0x84, 0xb8, 0x52, 0x49, 0xa5, + 0xe9, 0xf2, 0x93, 0xc9, 0x4c, 0x72, 0x42, 0x32, 0xfa, 0x78, 0xbc, 0xef, 0xe4, 0x76, 0xe2, 0x91, + 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, + 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x3a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, + 0xc9, 0xf9, 0xb9, 0xfa, 0xde, 0x91, 0x61, 0xae, 0x7e, 0xa9, 0x25, 0xe5, 0xf9, 0x45, 0xd9, 0xfa, + 0xc9, 0x19, 0x89, 0x99, 0x79, 0xfa, 0x15, 0x70, 0x03, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, + 0xc0, 0xe1, 0x68, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x17, 0x4e, 0xe8, 0x7b, 0xd8, 0x01, 0x00, + 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/kyve.funders.v1beta1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kyve.funders.v1beta1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "kyve.funders.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "kyve/funders/v1beta1/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/funders/types/query.pb.gw.go b/x/funders/types/query.pb.gw.go new file mode 100644 index 00000000..ac6feae2 --- /dev/null +++ b/x/funders/types/query.pb.gw.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: kyve/funders/v1beta1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kyve", "funders", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage +) diff --git a/x/funders/types/tx.pb.go b/x/funders/types/tx.pb.go new file mode 100644 index 00000000..af8fa694 --- /dev/null +++ b/x/funders/types/tx.pb.go @@ -0,0 +1,81 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/funders/v1beta1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +func init() { proto.RegisterFile("kyve/funders/v1beta1/tx.proto", fileDescriptor_5145d80c2db97f3d) } + +var fileDescriptor_5145d80c2db97f3d = []byte{ + // 143 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcd, 0xae, 0x2c, 0x4b, + 0xd5, 0x4f, 0x2b, 0xcd, 0x4b, 0x49, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, + 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, 0x49, 0xeb, 0x41, 0xa5, + 0xf5, 0xa0, 0xd2, 0x46, 0xac, 0x5c, 0xcc, 0xbe, 0xc5, 0xe9, 0x4e, 0x6e, 0x27, 0x1e, 0xc9, 0x31, + 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, + 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x93, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, + 0x9f, 0xab, 0xef, 0x1d, 0x19, 0xe6, 0xea, 0x97, 0x5a, 0x52, 0x9e, 0x5f, 0x94, 0xad, 0x9f, 0x9c, + 0x91, 0x98, 0x99, 0xa7, 0x5f, 0x01, 0xb7, 0xaf, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x6c, + 0x97, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x39, 0x2f, 0x59, 0x7f, 0x8c, 0x00, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "kyve.funders.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{}, + Metadata: "kyve/funders/v1beta1/tx.proto", +} diff --git a/x/funders/types/types.go b/x/funders/types/types.go new file mode 100644 index 00000000..ab1254f4 --- /dev/null +++ b/x/funders/types/types.go @@ -0,0 +1 @@ +package types From d188ed3d522eb3efdf18dae02f2ea09544188ae2 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 21 Sep 2023 20:29:40 +0200 Subject: [PATCH 017/109] feat: implement FundPool --- docs/swagger.yml | 48 - proto/kyve/funders/v1beta1/events.proto | 62 + proto/kyve/funders/v1beta1/funders.proto | 47 + proto/kyve/funders/v1beta1/tx.proto | 84 +- proto/kyve/pool/v1beta1/events.proto | 22 - proto/kyve/pool/v1beta1/pool.proto | 15 +- proto/kyve/pool/v1beta1/tx.proto | 31 - x/bundles/types/expected_keepers.go | 2 +- x/funders/keeper/getters_funder.go | 37 + x/funders/keeper/getters_funding.go | 46 + x/funders/keeper/getters_funding_state.go | 37 + x/funders/keeper/keeper.go | 12 + x/{pool => funders}/keeper/logic_funders.go | 4 +- .../keeper/logic_funders_test.go | 0 x/funders/keeper/msg_server_create_funder.go | 45 + .../keeper/msg_server_create_funder_test.go} | 0 .../keeper/msg_server_defund_pool.go | 10 +- .../keeper/msg_server_defund_pool_test.go | 149 ++ x/funders/keeper/msg_server_fund_pool.go | 139 + .../keeper/msg_server_fund_pool_test.go | 0 x/funders/keeper/msg_server_update_funder.go | 44 + x/funders/types/errors.go | 11 +- x/funders/types/events.pb.go | 1637 +++++++++++- x/funders/types/expected_keepers.go | 14 +- x/funders/types/funders.go | 72 + x/funders/types/funders.pb.go | 1266 +++++++++- x/funders/types/keys.go | 46 + x/funders/types/message_create_funder.go | 41 + x/funders/types/message_fund_pool.go | 54 + x/funders/types/tx.pb.go | 2247 ++++++++++++++++- x/pool/keeper/msg_server_fund_pool.go | 71 - x/pool/types/errors.go | 9 +- x/pool/types/events.pb.go | 591 +---- x/pool/types/genesis.go | 7 +- x/pool/types/keys.go | 4 - x/pool/types/pool.pb.go | 416 +-- x/pool/types/tx.pb.go | 978 +------ 37 files changed, 6240 insertions(+), 2058 deletions(-) create mode 100644 x/funders/keeper/getters_funder.go create mode 100644 x/funders/keeper/getters_funding.go create mode 100644 x/funders/keeper/getters_funding_state.go rename x/{pool => funders}/keeper/logic_funders.go (92%) rename x/{pool => funders}/keeper/logic_funders_test.go (100%) create mode 100644 x/funders/keeper/msg_server_create_funder.go rename x/{pool/keeper/msg_server_defund_pool_test.go => funders/keeper/msg_server_create_funder_test.go} (100%) rename x/{pool => funders}/keeper/msg_server_defund_pool.go (87%) create mode 100644 x/funders/keeper/msg_server_defund_pool_test.go create mode 100644 x/funders/keeper/msg_server_fund_pool.go rename x/{pool => funders}/keeper/msg_server_fund_pool_test.go (100%) create mode 100644 x/funders/keeper/msg_server_update_funder.go create mode 100644 x/funders/types/funders.go create mode 100644 x/funders/types/message_create_funder.go create mode 100644 x/funders/types/message_fund_pool.go delete mode 100644 x/pool/keeper/msg_server_fund_pool.go diff --git a/docs/swagger.yml b/docs/swagger.yml index ad6f0ddf..c6b863c2 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -4785,30 +4785,6 @@ paths: description: |- disabled is true when the pool is disabled. Can only be done via governance. - funders: - type: array - items: - type: object - properties: - address: - type: string - title: address is the address of the funder - amount: - type: string - format: uint64 - title: >- - amount is the current amount of funds in ukyve - the funder has - - still funded the pool with - title: >- - Funder is the object which holds info about a single - pool funder - description: funders ... - total_funds: - type: string - format: uint64 - description: total_funds ... protocol: description: protocol ... type: object @@ -5301,30 +5277,6 @@ paths: description: |- disabled is true when the pool is disabled. Can only be done via governance. - funders: - type: array - items: - type: object - properties: - address: - type: string - title: address is the address of the funder - amount: - type: string - format: uint64 - title: >- - amount is the current amount of funds in ukyve - the funder has - - still funded the pool with - title: >- - Funder is the object which holds info about a - single pool funder - description: funders ... - total_funds: - type: string - format: uint64 - description: total_funds ... protocol: description: protocol ... type: object diff --git a/proto/kyve/funders/v1beta1/events.proto b/proto/kyve/funders/v1beta1/events.proto index 96ca7255..b461528a 100644 --- a/proto/kyve/funders/v1beta1/events.proto +++ b/proto/kyve/funders/v1beta1/events.proto @@ -6,3 +6,65 @@ package kyve.funders.v1beta1; //import "kyve/funders/v1beta1/params.proto"; option go_package = "github.com/KYVENetwork/chain/x/funders/types"; + +// EventCreateFunder is an event emitted when a funder is created. +// emitted_by: MsgCreateFunder +message EventCreateFunder { + // address is the account address of the funder. + string address = 1; + // moniker ... + string moniker = 2; + // identity is the 64 bit keybase.io identity string + string identity = 3; + // logo ... + string logo = 4; + // website ... + string website = 5; + // contact ... + string contact = 6; + // details are some additional notes the funder finds important + string details = 7; +} + +// EventUpdateFunder is an event emitted when a funder is created. +// emitted_by: MsgCreateFunder +message EventUpdateFunder { + // address is the account address of the funder. + string address = 1; + // moniker ... + string moniker = 2; + // identity is the 64 bit keybase.io identity string + string identity = 3; + // logo ... + string logo = 4; + // website ... + string website = 5; + // contact ... + string contact = 6; + // details are some additional notes the funder finds important + string details = 7; +} + +// EventFundPool is an event emitted when a pool is funded. +// emitted_by: MsgFundPool +message EventFundPool { + // pool_id is the unique ID of the pool. + uint64 pool_id = 1; + // address is the account address of the pool funder. + string address = 2; + // amount is the amount in ukyve the funder has funded + uint64 amount = 3; + // amount_per_bundle is the amount in ukyve the funder has funded per bundle + uint64 amount_per_bundle = 4; +} + +// EventDefundPool is an event emitted when a pool is defunded. +// emitted_by: MsgDefundPool +message EventDefundPool { + // pool_id is the unique ID of the pool. + uint64 pool_id = 1; + // address is the account address of the pool funder. + string address = 2; + // amount is the amount in ukyve the funder has defunded + uint64 amount = 3; +} diff --git a/proto/kyve/funders/v1beta1/funders.proto b/proto/kyve/funders/v1beta1/funders.proto index 816b5d1b..1273a5fa 100644 --- a/proto/kyve/funders/v1beta1/funders.proto +++ b/proto/kyve/funders/v1beta1/funders.proto @@ -5,3 +5,50 @@ package kyve.funders.v1beta1; //import "gogoproto/gogo.proto"; option go_package = "github.com/KYVENetwork/chain/x/funders/types"; + +// Funder is the object which holds info about a single pool funder +message Funder { + // address ... + string address = 1; + // moniker ... + string moniker = 2; + // identity is the 64 bit keybase.io identity string + string identity = 3; + // logo ... + string logo = 4; + // website ... + string website = 5; + // contact ... + string contact = 6; + // details are some additional notes the funder finds important + string details = 7; +} + +// Funding is the object which holds info about the current funding +// funder_address and pool_id (m2m) are unique together which means that +// a funder can only fund each pool once and a pool can only be funded +// by each funder once. However, a funder can update the amount of funds. +message Funding { + // funder_id is the id of the funder + string funder_address = 1; + // pool_id is the id of the pool this funding is for + uint64 pool_id = 2; + // amount is the amount of funds in ukyve the funder has left + uint64 amount = 3; + // amount_per_bundle is the amount of funds in ukyve the funder pays per bundle + uint64 amount_per_bundle = 4; + // total_funded is the total amount of funds in ukyve the funder has funded + uint64 total_funded = 5; +} + +// FundingState is the object which holds info about the funding state +message FundingState { + // pool_id is the id of the pool this funding is for + uint64 pool_id = 1; + // active_fundings is the list of all active fundings + repeated Funding active_fundings = 2; + // inactive_fundings is the list of all inactive fundings that have been used up + repeated Funding inactive_fundings = 3; + // total_amount is the total amount of funds in ukyve the pool has from all fundings + uint64 total_amount = 4; +} diff --git a/proto/kyve/funders/v1beta1/tx.proto b/proto/kyve/funders/v1beta1/tx.proto index 1fac7012..598ea7e2 100644 --- a/proto/kyve/funders/v1beta1/tx.proto +++ b/proto/kyve/funders/v1beta1/tx.proto @@ -2,10 +2,86 @@ syntax = "proto3"; package kyve.funders.v1beta1; -//import "cosmos_proto/cosmos.proto"; -//import "gogoproto/gogo.proto"; - option go_package = "github.com/KYVENetwork/chain/x/funders/types"; // Msg defines the Msg service. -service Msg {} +service Msg { + // CreateFunder ... + rpc CreateFunder(MsgCreateFunder) returns (MsgCreateFunderResponse); + // UpdateFunder ... + // rpc UpdateFunder(MsgUpdateFunder) returns (MsgUpdateFunderResponse); + // FundPool ... + rpc FundPool(MsgFundPool) returns (MsgFundPoolResponse); + // DefundPool ... + rpc DefundPool(MsgDefundPool) returns (MsgDefundPoolResponse); +} + +// MsgCreateFunder defines a SDK message for creating a funder. +message MsgCreateFunder { + // creator ... + string creator = 1; + // moniker + string moniker = 2; + // identity is the 64 bit keybase.io identity string + string identity = 3; + // logo + string logo = 4; + // website + string website = 5; + // contact + string contact = 6; + // details are some additional notes the funder finds important + string details = 7; +} + +// MsgCreateFunderResponse defines the Msg/CreateFunder response type. +message MsgCreateFunderResponse {} + +// MsgUpdateFunder defines a SDK message for updating a funder. +message MsgUpdateFunder { + // creator ... + string creator = 1; + // moniker + string moniker = 2; + // identity is the 64 bit keybase.io identity string + string identity = 3; + // logo + string logo = 4; + // website + string website = 5; + // contact + string contact = 6; + // details are some additional notes the funder finds important + string details = 7; +} + +// MsgUpdateFunderResponse defines the Msg/UpdateFunder response type. +message MsgUpdateFunderResponse {} + +// MsgFundPool defines a SDK message for funding a pool. +message MsgFundPool { + // creator ... + string creator = 1; + // id ... + uint64 pool_id = 2; + // amount is the total amount available for distribution + uint64 amount = 3; + // amount_per_bundle defines the amount of tokens that are distributed per submitted bundle + uint64 amount_per_bundle = 4; +} + +// MsgFundPoolResponse defines the Msg/DefundPool response type. +message MsgFundPoolResponse {} + +// MsgDefundPool defines a SDK message for defunding a pool. +message MsgDefundPool { + // creator ... + string creator = 1; + // id ... + uint64 pool_id = 2; + // amount ... + uint64 amount = 3; +} + +// MsgDefundPoolResponse defines the Msg/DefundPool response type. +message MsgDefundPoolResponse {} diff --git a/proto/kyve/pool/v1beta1/events.proto b/proto/kyve/pool/v1beta1/events.proto index 2e23ad92..79b528d4 100644 --- a/proto/kyve/pool/v1beta1/events.proto +++ b/proto/kyve/pool/v1beta1/events.proto @@ -138,28 +138,6 @@ message EventPoolUpdated { uint32 compression_id = 12; } -// EventFundPool is an event emitted when a pool is funded. -// emitted_by: MsgFundPool -message EventFundPool { - // pool_id is the unique ID of the pool. - uint64 pool_id = 1; - // address is the account address of the pool funder. - string address = 2; - // amount is the amount in ukyve the funder has funded - uint64 amount = 3; -} - -// EventDefundPool is an event emitted when a pool is defunded. -// emitted_by: MsgDefundPool -message EventDefundPool { - // pool_id is the unique ID of the pool. - uint64 pool_id = 1; - // address is the account address of the pool funder. - string address = 2; - // amount is the amount in ukyve the funder has defunded - uint64 amount = 3; -} - // EventDefundPool is an event emitted when a pool is defunded. // emitted_by: MsgSubmitBundleProposal message EventPoolFundsSlashed { diff --git a/proto/kyve/pool/v1beta1/pool.proto b/proto/kyve/pool/v1beta1/pool.proto index 77541e34..3014efc2 100644 --- a/proto/kyve/pool/v1beta1/pool.proto +++ b/proto/kyve/pool/v1beta1/pool.proto @@ -51,15 +51,6 @@ message UpgradePlan { uint64 duration = 4; } -// Funder is the object which holds info about a single pool funder -message Funder { - // address is the address of the funder - string address = 1; - // amount is the current amount of funds in ukyve the funder has - // still funded the pool with - uint64 amount = 2; -} - // Pool ... message Pool { // id - unique identifier of the pool, can not be changed @@ -99,10 +90,8 @@ message Pool { // Can only be done via governance. bool disabled = 15; - // funders ... - repeated Funder funders = 16; - // total_funds ... - uint64 total_funds = 17; + // old funders and total_funds fields + reserved 16, 17; // protocol ... Protocol protocol = 18; diff --git a/proto/kyve/pool/v1beta1/tx.proto b/proto/kyve/pool/v1beta1/tx.proto index c7efa075..ff26fcc3 100644 --- a/proto/kyve/pool/v1beta1/tx.proto +++ b/proto/kyve/pool/v1beta1/tx.proto @@ -8,11 +8,6 @@ option go_package = "github.com/KYVENetwork/chain/x/pool/types"; // Msg defines the Msg service. service Msg { - // FundPool ... - rpc FundPool(MsgFundPool) returns (MsgFundPoolResponse); - // DefundPool ... - rpc DefundPool(MsgDefundPool) returns (MsgDefundPoolResponse); - // CreatePool defines a governance operation for creating a new pool. // The authority is hard-coded to the x/gov module account. rpc CreatePool(MsgCreatePool) returns (MsgCreatePoolResponse); @@ -36,32 +31,6 @@ service Msg { rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } -// MsgFundPool defines a SDK message for funding a pool. -message MsgFundPool { - // creator ... - string creator = 1; - // id ... - uint64 id = 2; - // amount ... - uint64 amount = 3; -} - -// MsgFundPoolResponse defines the Msg/DefundPool response type. -message MsgFundPoolResponse {} - -// MsgDefundPool defines a SDK message for defunding a pool. -message MsgDefundPool { - // creator ... - string creator = 1; - // id ... - uint64 id = 2; - // amount ... - uint64 amount = 3; -} - -// MsgDefundPoolResponse defines the Msg/DefundPool response type. -message MsgDefundPoolResponse {} - // MsgCreatePool defines a SDK message for creating a new pool. message MsgCreatePool { // authority is the address of the governance account. diff --git a/x/bundles/types/expected_keepers.go b/x/bundles/types/expected_keepers.go index cec3a1c1..7bf1a5c1 100644 --- a/x/bundles/types/expected_keepers.go +++ b/x/bundles/types/expected_keepers.go @@ -36,7 +36,7 @@ type PoolKeeper interface { IncrementBundleInformation(ctx sdk.Context, poolId uint64, currentHeight uint64, currentKey string, currentValue string) GetAllPools(ctx sdk.Context) (list []pooltypes.Pool) - ChargeFundersOfPool(ctx sdk.Context, poolId uint64, amount uint64) (payout uint64, err error) + //ChargeFundersOfPool(ctx sdk.Context, poolId uint64, amount uint64) (payout uint64, err error) //TODO(rapha): remove ChargeInflationPool(ctx sdk.Context, poolId uint64) (payout uint64, err error) } diff --git a/x/funders/keeper/getters_funder.go b/x/funders/keeper/getters_funder.go new file mode 100644 index 00000000..342e9972 --- /dev/null +++ b/x/funders/keeper/getters_funder.go @@ -0,0 +1,37 @@ +package keeper + +import ( + "github.com/KYVENetwork/chain/x/funders/types" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// DoesFundingExist checks if the funding exists +func (k Keeper) doesFunderExist(ctx sdk.Context, funderAddress string) bool { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FunderKeyPrefix) + return store.Has(types.FunderKey(funderAddress)) +} + +// GetFunder returns the funder +func (k Keeper) getFunder(ctx sdk.Context, funderAddress string) (funder types.Funder, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FunderKeyPrefix) + + b := store.Get(types.FunderKey( + funderAddress, + )) + if b == nil { + return funder, false + } + + k.cdc.MustUnmarshal(b, &funder) + return funder, true +} + +// SetFunder sets a specific funder in the store from its index +func (k Keeper) setFunder(ctx sdk.Context, funder types.Funder) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FunderKeyPrefix) + b := k.cdc.MustMarshal(&funder) + store.Set(types.FunderKey( + funder.Address, + ), b) +} diff --git a/x/funders/keeper/getters_funding.go b/x/funders/keeper/getters_funding.go new file mode 100644 index 00000000..5b11e49c --- /dev/null +++ b/x/funders/keeper/getters_funding.go @@ -0,0 +1,46 @@ +package keeper + +import ( + "github.com/KYVENetwork/chain/x/funders/types" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// DoesFundingExist checks if the funding exists +func (k Keeper) doesFundingExist(ctx sdk.Context, funderAddress string, poolId uint64) bool { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingKeyPrefixByFunder) + return store.Has(types.FundingKeyByFunder(funderAddress, poolId)) +} + +// GetFunding returns the funding +func (k Keeper) getFunding(ctx sdk.Context, funderAddress string, poolId uint64) (funding *types.Funding, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingKeyPrefixByFunder) + + b := store.Get(types.FundingKeyByFunder( + funderAddress, + poolId, + )) + if b == nil { + return funding, false + } + + k.cdc.MustUnmarshal(b, funding) + return funding, true +} + +// SetFunding sets a specific funding in the store from its index +func (k Keeper) setFunding(ctx sdk.Context, funding *types.Funding) { + b := k.cdc.MustMarshal(funding) + + storeByFunder := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingKeyPrefixByFunder) + storeByFunder.Set(types.FundingKeyByFunder( + funding.FunderAddress, + funding.PoolId, + ), b) + + storeByPool := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingKeyPrefixByPool) + storeByPool.Set(types.FundingKeyByPool( + funding.FunderAddress, + funding.PoolId, + ), b) +} diff --git a/x/funders/keeper/getters_funding_state.go b/x/funders/keeper/getters_funding_state.go new file mode 100644 index 00000000..cf77c6a9 --- /dev/null +++ b/x/funders/keeper/getters_funding_state.go @@ -0,0 +1,37 @@ +package keeper + +import ( + "github.com/KYVENetwork/chain/x/funders/types" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// DoesFundingStateExist checks if the FundingState exists +func (k Keeper) doesFundingStateExist(ctx sdk.Context, poolId uint64) bool { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingStateKeyPrefix) + return store.Has(types.FundingStateKey(poolId)) +} + +// GetFundingState returns the FundingState +func (k Keeper) getFundingState(ctx sdk.Context, poolId uint64) (fundingState types.FundingState, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingStateKeyPrefix) + + b := store.Get(types.FundingStateKey( + poolId, + )) + if b == nil { + return fundingState, false + } + + k.cdc.MustUnmarshal(b, &fundingState) + return fundingState, true +} + +// SetFundingState sets a specific FundingState in the store from its index +func (k Keeper) setFundingState(ctx sdk.Context, fundingState types.FundingState) { + b := k.cdc.MustMarshal(&fundingState) + storeByFunder := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingStateKeyPrefix) + storeByFunder.Set(types.FundingStateKey( + fundingState.PoolId, + ), b) +} diff --git a/x/funders/keeper/keeper.go b/x/funders/keeper/keeper.go index 99f71ced..13a79bec 100644 --- a/x/funders/keeper/keeper.go +++ b/x/funders/keeper/keeper.go @@ -2,6 +2,7 @@ package keeper import ( "fmt" + "github.com/KYVENetwork/chain/util" "github.com/KYVENetwork/chain/x/funders/types" "github.com/cometbft/cometbft/libs/log" @@ -17,6 +18,10 @@ type ( memKey storetypes.StoreKey authority string + + bankKeeper util.BankKeeper + pookKeeper types.PoolKeeper + upgradeKeeper util.UpgradeKeeper } ) @@ -27,6 +32,9 @@ func NewKeeper( authority string, + bankKeeper util.BankKeeper, + pookKeeper types.PoolKeeper, + upgradeKeeper util.UpgradeKeeper, ) *Keeper { return &Keeper{ cdc: cdc, @@ -34,6 +42,10 @@ func NewKeeper( memKey: memKey, authority: authority, + + bankKeeper: bankKeeper, + pookKeeper: pookKeeper, + upgradeKeeper: upgradeKeeper, } } diff --git a/x/pool/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go similarity index 92% rename from x/pool/keeper/logic_funders.go rename to x/funders/keeper/logic_funders.go index d5ad55d1..ac740bbd 100644 --- a/x/pool/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -12,7 +12,7 @@ import ( // This method does not transfer any funds. The bundles-module // is responsible for transferring the rewards out of the module. func (k Keeper) ChargeFundersOfPool(ctx sdk.Context, poolId uint64, amount uint64) (payout uint64, err error) { - pool, poolErr := k.GetPoolWithError(ctx, poolId) + pool, poolErr := k.pookKeeper.GetPoolWithError(ctx, poolId) if poolErr != nil { return 0, poolErr } @@ -25,7 +25,7 @@ func (k Keeper) ChargeFundersOfPool(ctx sdk.Context, poolId uint64, amount uint6 // This is the amount every funder will be charged amountPerFunder := amount / uint64(len(pool.Funders)) - // Due to discrete division there will be a reminder which can not be split + // Due to discrete division there will be a remainder which can not be split // equally among all funders. This amount is charged to the lowest funder amountRemainder := amount - amountPerFunder*uint64(len(pool.Funders)) diff --git a/x/pool/keeper/logic_funders_test.go b/x/funders/keeper/logic_funders_test.go similarity index 100% rename from x/pool/keeper/logic_funders_test.go rename to x/funders/keeper/logic_funders_test.go diff --git a/x/funders/keeper/msg_server_create_funder.go b/x/funders/keeper/msg_server_create_funder.go new file mode 100644 index 00000000..00c75546 --- /dev/null +++ b/x/funders/keeper/msg_server_create_funder.go @@ -0,0 +1,45 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/errors" + "github.com/KYVENetwork/chain/x/funders/types" + sdk "github.com/cosmos/cosmos-sdk/types" + errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" +) + +// CreateFunder creates a new funder object and stores it in the store. +// If the funder already exists, an error is returned. +func (k msgServer) CreateFunder(goCtx context.Context, msg *types.MsgCreateFunder) (*types.MsgCreateFunderResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // Check if funder already exists + if k.doesFunderExist(ctx, msg.Creator) { + return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrFunderAlreadyExists.Error(), msg.Creator) + } + + // Create new funder + k.setFunder(ctx, types.Funder{ + Address: msg.Creator, + Moniker: msg.Moniker, + Identity: msg.Identity, + Logo: msg.Logo, + Website: msg.Website, + Contact: msg.Contact, + Details: msg.Details, + }) + + // Emit a create funder event + _ = ctx.EventManager().EmitTypedEvent(&types.EventCreateFunder{ + Address: msg.Creator, + Moniker: msg.Moniker, + Identity: msg.Identity, + Logo: msg.Logo, + Website: msg.Website, + Contact: msg.Contact, + Details: msg.Details, + }) + + return &types.MsgCreateFunderResponse{}, nil +} diff --git a/x/pool/keeper/msg_server_defund_pool_test.go b/x/funders/keeper/msg_server_create_funder_test.go similarity index 100% rename from x/pool/keeper/msg_server_defund_pool_test.go rename to x/funders/keeper/msg_server_create_funder_test.go diff --git a/x/pool/keeper/msg_server_defund_pool.go b/x/funders/keeper/msg_server_defund_pool.go similarity index 87% rename from x/pool/keeper/msg_server_defund_pool.go rename to x/funders/keeper/msg_server_defund_pool.go index 14dcc8c5..06c85f6c 100644 --- a/x/pool/keeper/msg_server_defund_pool.go +++ b/x/funders/keeper/msg_server_defund_pool.go @@ -2,10 +2,10 @@ package keeper import ( "context" + "github.com/KYVENetwork/chain/x/funders/types" "cosmossdk.io/errors" "github.com/KYVENetwork/chain/util" - "github.com/KYVENetwork/chain/x/pool/types" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -16,11 +16,11 @@ import ( // the funder is removed completely. func (k msgServer) DefundPool(goCtx context.Context, msg *types.MsgDefundPool) (*types.MsgDefundPoolResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - pool, found := k.GetPool(ctx, msg.Id) // Pool has to exist - if !found { - return nil, errors.Wrapf(errorsTypes.ErrNotFound, types.ErrPoolNotFound.Error(), msg.Id) + pool, err := k.pookKeeper.GetPoolWithError(ctx, msg.PoolId) + if err != nil { + return nil, err } // Sender needs to be a funder in the pool @@ -44,7 +44,7 @@ func (k msgServer) DefundPool(goCtx context.Context, msg *types.MsgDefundPool) ( // Emit a defund event. _ = ctx.EventManager().EmitTypedEvent(&types.EventDefundPool{ - PoolId: msg.Id, + PoolId: msg.PoolId, Address: msg.Creator, Amount: msg.Amount, }) diff --git a/x/funders/keeper/msg_server_defund_pool_test.go b/x/funders/keeper/msg_server_defund_pool_test.go new file mode 100644 index 00000000..e5b3aff8 --- /dev/null +++ b/x/funders/keeper/msg_server_defund_pool_test.go @@ -0,0 +1,149 @@ +package keeper_test + +import ( + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + i "github.com/KYVENetwork/chain/testutil/integration" + pooltypes "github.com/KYVENetwork/chain/x/pool/types" +) + +/* + +TEST CASES - msg_server_defund_pool.go + +* Defund 50 KYVE from a funder who has previously funded 100 KYVE +* Try to defund more than actually funded +* Defund full funding amount from a funder who has previously funded 100 KYVE +* Defund as highest funder 75 KYVE in order to be the lowest funder afterwards + +*/ + +var _ = Describe("msg_server_defund_pool.go", Ordered, func() { + s := i.NewCleanChain() + + initialBalance := s.GetBalanceFromAddress(i.ALICE) + + BeforeEach(func() { + // init new clean chain + s = i.NewCleanChain() + + // create clean pool for every test case + s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ + Name: "PoolTest", + Protocol: &pooltypes.Protocol{ + Version: "0.0.0", + Binaries: "{}", + LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), + }, + UpgradePlan: &pooltypes.UpgradePlan{}, + }) + + // fund pool + s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ + Creator: i.ALICE, + Id: 0, + Amount: 100 * i.KYVE, + }) + }) + + AfterEach(func() { + s.PerformValidityChecks() + }) + + It("Defund 50 KYVE from a funder who has previously funded 100 KYVE", func() { + // ACT + s.RunTxPoolSuccess(&pooltypes.MsgDefundPool{ + Creator: i.ALICE, + Id: 0, + Amount: 50 * i.KYVE, + }) + + // ASSERT + balanceAfter := s.GetBalanceFromAddress(i.ALICE) + + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + + Expect(initialBalance - balanceAfter).To(Equal(50 * i.KYVE)) + + Expect(pool.Funders).To(HaveLen(1)) + Expect(pool.TotalFunds).To(Equal(50 * i.KYVE)) + + Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(50 * i.KYVE)) + + Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) + Expect(pool.GetLowestFunder().Amount).To(Equal(50 * i.KYVE)) + }) + + It("Try to defund more than actually funded", func() { + // ACT + s.RunTxPoolError(&pooltypes.MsgDefundPool{ + Creator: i.ALICE, + Id: 0, + Amount: 101 * i.KYVE, + }) + + // ASSERT + balanceAfter := s.GetBalanceFromAddress(i.ALICE) + + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + + Expect(initialBalance - balanceAfter).To(Equal(100 * i.KYVE)) + + Expect(pool.Funders).To(HaveLen(1)) + Expect(pool.TotalFunds).To(Equal(100 * i.KYVE)) + + Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100 * i.KYVE)) + + Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) + Expect(pool.GetLowestFunder().Amount).To(Equal(100 * i.KYVE)) + }) + + It("Defund full funding amount from a funder who has previously funded 100 KYVE", func() { + // ACT + s.RunTxPoolSuccess(&pooltypes.MsgDefundPool{ + Creator: i.ALICE, + Id: 0, + Amount: 100 * i.KYVE, + }) + + // ASSERT + balanceAfter := s.GetBalanceFromAddress(i.ALICE) + + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + + Expect(initialBalance - balanceAfter).To(BeZero()) + + Expect(pool.Funders).To(BeEmpty()) + Expect(pool.TotalFunds).To(BeZero()) + + Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(uint64(0))) + + Expect(pool.GetLowestFunder()).To(Equal(pooltypes.Funder{})) + }) + + It("Defund as highest funder 75 KYVE in order to be the lowest funder afterwards", func() { + // ARRANGE + s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ + Creator: i.BOB, + Id: 0, + Amount: 50 * i.KYVE, + }) + + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + Expect(pool.GetLowestFunder().Address).To(Equal(i.BOB)) + Expect(pool.GetLowestFunder().Amount).To(Equal(50 * i.KYVE)) + + // ACT + s.RunTxPoolSuccess(&pooltypes.MsgDefundPool{ + Creator: i.ALICE, + Id: 0, + Amount: 75 * i.KYVE, + }) + + // ASSERT + pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) + Expect(pool.GetLowestFunder().Amount).To(Equal(25 * i.KYVE)) + }) +}) diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go new file mode 100644 index 00000000..a165584b --- /dev/null +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -0,0 +1,139 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/errors" + "github.com/KYVENetwork/chain/util" + "github.com/KYVENetwork/chain/x/funders/types" + sdk "github.com/cosmos/cosmos-sdk/types" + errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" +) + +func (k msgServer) defundLowestFunding( + ctx sdk.Context, + lowestFunding *types.Funding, + fundingState *types.FundingState, + poolId uint64, +) error { + err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, types.ModuleName, lowestFunding.FunderAddress, lowestFunding.Amount) + if err != nil { + return err + } + + lowestFunding.SubtractAmount(lowestFunding.Amount) + fundingState.SetInactive(lowestFunding) + k.setFunding(ctx, lowestFunding) + + // Emit a defund event. + _ = ctx.EventManager().EmitTypedEvent(&types.EventDefundPool{ + PoolId: poolId, + Address: lowestFunding.FunderAddress, + Amount: lowestFunding.Amount, + }) + return nil +} + +// FundPool handles the logic to fund a pool. +// A funder is added to the active funders list with the specified amount +// If the funders list is full, it checks if the funder wants to fund +// more than the current lowest funder. If so, the current lowest funder +// will get their tokens back and removed form the active funders list. +func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*types.MsgFundPoolResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // Funder has to exist + if !k.doesFunderExist(ctx, msg.Creator) { + return nil, errors.Wrapf(errorsTypes.ErrUnauthorized, types.ErrFunderDoesNotExist.Error(), msg.Creator) + } + + // Pool has to exist + err := k.pookKeeper.AssertPoolExists(ctx, msg.PoolId) + if err != nil { + return nil, err + } + + // Get or create funding state for pool + fundingState, found := k.getFundingState(ctx, msg.PoolId) + if !found { + fundingState = types.FundingState{ + PoolId: msg.PoolId, + ActiveFundings: []*types.Funding{}, + InactiveFundings: []*types.Funding{}, + TotalAmount: 0, + } + k.setFundingState(ctx, fundingState) + } + + // Check if funding already exists + funding, found := k.getFunding(ctx, msg.Creator, msg.PoolId) + if found { + // If so, update funding + funding.AddAmount(msg.Amount) + } else { + // If not, create new funding + funding = &types.Funding{ + FunderAddress: msg.Creator, + PoolId: msg.PoolId, + Amount: msg.Amount, + AmountPerBundle: msg.AmountPerBundle, + TotalFunded: msg.Amount, + } + } + if funding.AmountPerBundle < types.MinFundingAmountPerBundle { + return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrAmountPerBundleTooLow.Error(), types.MinFundingAmountPerBundle) + } + if funding.Amount > types.MinFundingAmount { + return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrMinFundingAmount.Error(), types.MinFundingAmount) + } + + var defunding *types.Funding = nil + + // Check if funding limit is exceeded + if len(fundingState.ActiveFundings) >= types.MaxFunders { + lowestFunding, err := fundingState.GetLowestFunding() + if err != nil { + util.PanicHalt(k.upgradeKeeper, ctx, err.Error()) + } + + // Check if lowest funding is lower than new funding + if lowestFunding.Amount < funding.Amount { + // If so, check if lowest funding is from someone else + if lowestFunding.FunderAddress != funding.FunderAddress { + // Prepare to defund lowest funding + defunding = lowestFunding + } + } else { + return nil, errors.Wrapf(errorsTypes.ErrLogic, types.ErrFundsTooLow.Error(), lowestFunding.Amount) + } + } + + // TODO: do I have to call ValidateBasic() here? + // User is allowed to fund + // Let's see if he has enough funds + if err := util.TransferFromAddressToModule(k.bankKeeper, ctx, msg.Creator, types.ModuleName, msg.Amount); err != nil { + return nil, err + } + + // Check if defunding is necessary + if defunding != nil { + err := k.defundLowestFunding(ctx, defunding, &fundingState, msg.PoolId) + if err != nil { + return nil, err + } + } + + // Save funding and funding state + k.setFunding(ctx, funding) + fundingState.SetActive(funding) + + // Emit a fund event. + _ = ctx.EventManager().EmitTypedEvent(&types.EventFundPool{ + PoolId: msg.PoolId, + Address: msg.Creator, + Amount: msg.Amount, + AmountPerBundle: msg.AmountPerBundle, + }) + + return &types.MsgFundPoolResponse{}, nil +} diff --git a/x/pool/keeper/msg_server_fund_pool_test.go b/x/funders/keeper/msg_server_fund_pool_test.go similarity index 100% rename from x/pool/keeper/msg_server_fund_pool_test.go rename to x/funders/keeper/msg_server_fund_pool_test.go diff --git a/x/funders/keeper/msg_server_update_funder.go b/x/funders/keeper/msg_server_update_funder.go new file mode 100644 index 00000000..2a673f76 --- /dev/null +++ b/x/funders/keeper/msg_server_update_funder.go @@ -0,0 +1,44 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/errors" + "github.com/KYVENetwork/chain/x/funders/types" + sdk "github.com/cosmos/cosmos-sdk/types" + errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" +) + +// UpdateFunder allows a funder to change basic metadata like moniker, address, logo, etc. +func (k msgServer) UpdateFunder(goCtx context.Context, msg *types.MsgUpdateFunder) (*types.MsgUpdateFunderResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // Error if funder does not exist + if !k.doesFunderExist(ctx, msg.Creator) { + return nil, errors.Wrap(errorsTypes.ErrInvalidRequest, types.ErrFunderDoesNotExist.Error()) + } + + // Update funder + k.setFunder(ctx, types.Funder{ + Address: msg.Creator, + Moniker: msg.Moniker, + Identity: msg.Identity, + Logo: msg.Logo, + Website: msg.Website, + Contact: msg.Contact, + Details: msg.Details, + }) + + // Emit a update funder event + _ = ctx.EventManager().EmitTypedEvent(&types.EventUpdateFunder{ + Address: msg.Creator, + Moniker: msg.Moniker, + Identity: msg.Identity, + Logo: msg.Logo, + Website: msg.Website, + Contact: msg.Contact, + Details: msg.Details, + }) + + return &types.MsgUpdateFunderResponse{}, nil +} diff --git a/x/funders/types/errors.go b/x/funders/types/errors.go index 50c80d4e..2bd2b121 100644 --- a/x/funders/types/errors.go +++ b/x/funders/types/errors.go @@ -1,12 +1,15 @@ package types -// DONTCOVER - import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "cosmossdk.io/errors" ) // x/funders module sentinel errors var ( - ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") + ErrFunderAlreadyExists = errors.Register(ModuleName, 1100, "funder with address %v already exists") + ErrFunderDoesNotExist = errors.Register(ModuleName, 1101, "funder with address %v does not exist") + ErrFundsTooLow = errors.Register(ModuleName, 1102, "minimum funding amount of %vkyve not reached") + ErrAmountPerBundleTooLow = errors.Register(ModuleName, 1103, "minimum amount per bundle of %vkyve not reached") + ErrMinFundingAmount = errors.Register(ModuleName, 1104, "minimum funding amount of %vkyve not reached") + //ErrDefundTooHigh = errors.Register(ModuleName, 1102, "maximum defunding amount of %vkyve surpassed") ) diff --git a/x/funders/types/events.pb.go b/x/funders/types/events.pb.go index a6a5a55e..e9ca7d66 100644 --- a/x/funders/types/events.pb.go +++ b/x/funders/types/events.pb.go @@ -6,7 +6,9 @@ package types import ( fmt "fmt" proto "github.com/cosmos/gogoproto/proto" + io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -20,17 +22,1632 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// EventCreateFunder is an event emitted when a funder is created. +// emitted_by: MsgCreateFunder +type EventCreateFunder struct { + // address is the account address of the funder. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // moniker ... + Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` + // identity is the 64 bit keybase.io identity string + Identity string `protobuf:"bytes,3,opt,name=identity,proto3" json:"identity,omitempty"` + // logo ... + Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` + // website ... + Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` + // contact ... + Contact string `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` + // details are some additional notes the funder finds important + Details string `protobuf:"bytes,7,opt,name=details,proto3" json:"details,omitempty"` +} + +func (m *EventCreateFunder) Reset() { *m = EventCreateFunder{} } +func (m *EventCreateFunder) String() string { return proto.CompactTextString(m) } +func (*EventCreateFunder) ProtoMessage() {} +func (*EventCreateFunder) Descriptor() ([]byte, []int) { + return fileDescriptor_1cf957abd56bbcb0, []int{0} +} +func (m *EventCreateFunder) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventCreateFunder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventCreateFunder.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventCreateFunder) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventCreateFunder.Merge(m, src) +} +func (m *EventCreateFunder) XXX_Size() int { + return m.Size() +} +func (m *EventCreateFunder) XXX_DiscardUnknown() { + xxx_messageInfo_EventCreateFunder.DiscardUnknown(m) +} + +var xxx_messageInfo_EventCreateFunder proto.InternalMessageInfo + +func (m *EventCreateFunder) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *EventCreateFunder) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *EventCreateFunder) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *EventCreateFunder) GetLogo() string { + if m != nil { + return m.Logo + } + return "" +} + +func (m *EventCreateFunder) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *EventCreateFunder) GetContact() string { + if m != nil { + return m.Contact + } + return "" +} + +func (m *EventCreateFunder) GetDetails() string { + if m != nil { + return m.Details + } + return "" +} + +// EventUpdateFunder is an event emitted when a funder is created. +// emitted_by: MsgCreateFunder +type EventUpdateFunder struct { + // address is the account address of the funder. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // moniker ... + Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` + // identity is the 64 bit keybase.io identity string + Identity string `protobuf:"bytes,3,opt,name=identity,proto3" json:"identity,omitempty"` + // logo ... + Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` + // website ... + Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` + // contact ... + Contact string `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` + // details are some additional notes the funder finds important + Details string `protobuf:"bytes,7,opt,name=details,proto3" json:"details,omitempty"` +} + +func (m *EventUpdateFunder) Reset() { *m = EventUpdateFunder{} } +func (m *EventUpdateFunder) String() string { return proto.CompactTextString(m) } +func (*EventUpdateFunder) ProtoMessage() {} +func (*EventUpdateFunder) Descriptor() ([]byte, []int) { + return fileDescriptor_1cf957abd56bbcb0, []int{1} +} +func (m *EventUpdateFunder) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventUpdateFunder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventUpdateFunder.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventUpdateFunder) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventUpdateFunder.Merge(m, src) +} +func (m *EventUpdateFunder) XXX_Size() int { + return m.Size() +} +func (m *EventUpdateFunder) XXX_DiscardUnknown() { + xxx_messageInfo_EventUpdateFunder.DiscardUnknown(m) +} + +var xxx_messageInfo_EventUpdateFunder proto.InternalMessageInfo + +func (m *EventUpdateFunder) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *EventUpdateFunder) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *EventUpdateFunder) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *EventUpdateFunder) GetLogo() string { + if m != nil { + return m.Logo + } + return "" +} + +func (m *EventUpdateFunder) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *EventUpdateFunder) GetContact() string { + if m != nil { + return m.Contact + } + return "" +} + +func (m *EventUpdateFunder) GetDetails() string { + if m != nil { + return m.Details + } + return "" +} + +// EventFundPool is an event emitted when a pool is funded. +// emitted_by: MsgFundPool +type EventFundPool struct { + // pool_id is the unique ID of the pool. + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // address is the account address of the pool funder. + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + // amount is the amount in ukyve the funder has funded + Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` + // amount_per_bundle is the amount in ukyve the funder has funded per bundle + AmountPerBundle uint64 `protobuf:"varint,4,opt,name=amount_per_bundle,json=amountPerBundle,proto3" json:"amount_per_bundle,omitempty"` +} + +func (m *EventFundPool) Reset() { *m = EventFundPool{} } +func (m *EventFundPool) String() string { return proto.CompactTextString(m) } +func (*EventFundPool) ProtoMessage() {} +func (*EventFundPool) Descriptor() ([]byte, []int) { + return fileDescriptor_1cf957abd56bbcb0, []int{2} +} +func (m *EventFundPool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventFundPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventFundPool.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventFundPool) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventFundPool.Merge(m, src) +} +func (m *EventFundPool) XXX_Size() int { + return m.Size() +} +func (m *EventFundPool) XXX_DiscardUnknown() { + xxx_messageInfo_EventFundPool.DiscardUnknown(m) +} + +var xxx_messageInfo_EventFundPool proto.InternalMessageInfo + +func (m *EventFundPool) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *EventFundPool) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *EventFundPool) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +func (m *EventFundPool) GetAmountPerBundle() uint64 { + if m != nil { + return m.AmountPerBundle + } + return 0 +} + +// EventDefundPool is an event emitted when a pool is defunded. +// emitted_by: MsgDefundPool +type EventDefundPool struct { + // pool_id is the unique ID of the pool. + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // address is the account address of the pool funder. + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + // amount is the amount in ukyve the funder has defunded + Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *EventDefundPool) Reset() { *m = EventDefundPool{} } +func (m *EventDefundPool) String() string { return proto.CompactTextString(m) } +func (*EventDefundPool) ProtoMessage() {} +func (*EventDefundPool) Descriptor() ([]byte, []int) { + return fileDescriptor_1cf957abd56bbcb0, []int{3} +} +func (m *EventDefundPool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventDefundPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventDefundPool.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventDefundPool) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventDefundPool.Merge(m, src) +} +func (m *EventDefundPool) XXX_Size() int { + return m.Size() +} +func (m *EventDefundPool) XXX_DiscardUnknown() { + xxx_messageInfo_EventDefundPool.DiscardUnknown(m) +} + +var xxx_messageInfo_EventDefundPool proto.InternalMessageInfo + +func (m *EventDefundPool) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *EventDefundPool) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *EventDefundPool) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +func init() { + proto.RegisterType((*EventCreateFunder)(nil), "kyve.funders.v1beta1.EventCreateFunder") + proto.RegisterType((*EventUpdateFunder)(nil), "kyve.funders.v1beta1.EventUpdateFunder") + proto.RegisterType((*EventFundPool)(nil), "kyve.funders.v1beta1.EventFundPool") + proto.RegisterType((*EventDefundPool)(nil), "kyve.funders.v1beta1.EventDefundPool") +} + func init() { proto.RegisterFile("kyve/funders/v1beta1/events.proto", fileDescriptor_1cf957abd56bbcb0) } var fileDescriptor_1cf957abd56bbcb0 = []byte{ - // 141 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcc, 0xae, 0x2c, 0x4b, - 0xd5, 0x4f, 0x2b, 0xcd, 0x4b, 0x49, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, - 0xd4, 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, - 0x29, 0xd1, 0x83, 0x2a, 0xd1, 0x83, 0x2a, 0x71, 0x72, 0x3b, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, - 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, - 0x63, 0x39, 0x86, 0x28, 0x9d, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, - 0xef, 0xc8, 0x30, 0x57, 0xbf, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0xfd, 0xe4, 0x8c, 0xc4, 0xcc, - 0x3c, 0xfd, 0x0a, 0xb8, 0x65, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x4b, 0x8c, 0x01, - 0x01, 0x00, 0x00, 0xff, 0xff, 0x9b, 0xdc, 0x97, 0x93, 0x89, 0x00, 0x00, 0x00, + // 356 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x92, 0xc1, 0x4a, 0xeb, 0x40, + 0x14, 0x40, 0x9b, 0xbe, 0xbc, 0xf4, 0xbd, 0x81, 0x47, 0x69, 0x78, 0xe8, 0xe0, 0x22, 0x68, 0x57, + 0x22, 0x92, 0x50, 0xfc, 0x83, 0x6a, 0x0b, 0x22, 0x48, 0x09, 0x28, 0x28, 0x42, 0x49, 0x32, 0xb7, + 0xed, 0xd0, 0x74, 0x26, 0x4c, 0x6e, 0x5a, 0xfb, 0x03, 0xae, 0xfd, 0x29, 0xc1, 0x65, 0x97, 0x2e, + 0xa5, 0xfd, 0x11, 0x99, 0x49, 0xac, 0xba, 0x77, 0xe3, 0x6e, 0xce, 0x9c, 0xcb, 0x30, 0x07, 0x2e, + 0x39, 0x98, 0x2e, 0xe7, 0x10, 0x8c, 0x0a, 0xc1, 0x40, 0xe5, 0xc1, 0xbc, 0x13, 0x03, 0x46, 0x9d, + 0x00, 0xe6, 0x20, 0x30, 0xf7, 0x33, 0x25, 0x51, 0xba, 0xff, 0xf5, 0x88, 0x5f, 0x8d, 0xf8, 0xd5, + 0x48, 0xfb, 0xc9, 0x22, 0xad, 0x9e, 0x1e, 0x3b, 0x55, 0x10, 0x21, 0xf4, 0x8d, 0x76, 0x29, 0x69, + 0x44, 0x8c, 0x29, 0xc8, 0x73, 0x6a, 0xed, 0x5b, 0x87, 0x7f, 0xc3, 0x77, 0xd4, 0x66, 0x26, 0x05, + 0x9f, 0x82, 0xa2, 0xf5, 0xd2, 0x54, 0xe8, 0xee, 0x91, 0x3f, 0x9c, 0x81, 0x40, 0x8e, 0x4b, 0xfa, + 0xcb, 0xa8, 0x2d, 0xbb, 0x2e, 0xb1, 0x53, 0x39, 0x96, 0xd4, 0x36, 0xf7, 0xe6, 0xac, 0x5f, 0x5a, + 0x40, 0x9c, 0x73, 0x04, 0xfa, 0xbb, 0x7c, 0xa9, 0x42, 0x6d, 0x12, 0x29, 0x30, 0x4a, 0x90, 0x3a, + 0xa5, 0xa9, 0x50, 0x1b, 0x06, 0x18, 0xf1, 0x34, 0xa7, 0x8d, 0xd2, 0x54, 0xf8, 0xd1, 0x71, 0x95, + 0xb1, 0x9f, 0xdc, 0xf1, 0x60, 0x91, 0x7f, 0xa6, 0x43, 0x17, 0x0c, 0xa4, 0x4c, 0xdd, 0x5d, 0xd2, + 0xc8, 0xa4, 0x4c, 0x87, 0x9c, 0x99, 0x06, 0x3b, 0x74, 0x34, 0x9e, 0xb3, 0xcf, 0x71, 0xf5, 0xaf, + 0x71, 0x3b, 0xc4, 0x89, 0x66, 0xb2, 0x10, 0x68, 0x02, 0xec, 0xb0, 0x22, 0xf7, 0x88, 0xb4, 0xca, + 0xd3, 0x30, 0x03, 0x35, 0x8c, 0x0b, 0xc1, 0x52, 0x30, 0x2d, 0x76, 0xd8, 0x2c, 0xc5, 0x00, 0x54, + 0xd7, 0x5c, 0xb7, 0xef, 0x48, 0xd3, 0xfc, 0xe3, 0x0c, 0x46, 0xdf, 0xff, 0x93, 0x6e, 0xff, 0x79, + 0xed, 0x59, 0xab, 0xb5, 0x67, 0xbd, 0xae, 0x3d, 0xeb, 0x71, 0xe3, 0xd5, 0x56, 0x1b, 0xaf, 0xf6, + 0xb2, 0xf1, 0x6a, 0xb7, 0xc7, 0x63, 0x8e, 0x93, 0x22, 0xf6, 0x13, 0x39, 0x0b, 0x2e, 0x6e, 0xae, + 0x7b, 0x97, 0x80, 0x0b, 0xa9, 0xa6, 0x41, 0x32, 0x89, 0xb8, 0x08, 0xee, 0xb7, 0x3b, 0x8e, 0xcb, + 0x0c, 0xf2, 0xd8, 0x31, 0xbb, 0x7d, 0xf2, 0x16, 0x00, 0x00, 0xff, 0xff, 0x63, 0xf9, 0x75, 0xba, + 0x00, 0x03, 0x00, 0x00, +} + +func (m *EventCreateFunder) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventCreateFunder) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventCreateFunder) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Details) > 0 { + i -= len(m.Details) + copy(dAtA[i:], m.Details) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Details))) + i-- + dAtA[i] = 0x3a + } + if len(m.Contact) > 0 { + i -= len(m.Contact) + copy(dAtA[i:], m.Contact) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Contact))) + i-- + dAtA[i] = 0x32 + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x2a + } + if len(m.Logo) > 0 { + i -= len(m.Logo) + copy(dAtA[i:], m.Logo) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Logo))) + i-- + dAtA[i] = 0x22 + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x1a + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventUpdateFunder) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventUpdateFunder) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventUpdateFunder) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Details) > 0 { + i -= len(m.Details) + copy(dAtA[i:], m.Details) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Details))) + i-- + dAtA[i] = 0x3a + } + if len(m.Contact) > 0 { + i -= len(m.Contact) + copy(dAtA[i:], m.Contact) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Contact))) + i-- + dAtA[i] = 0x32 + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x2a + } + if len(m.Logo) > 0 { + i -= len(m.Logo) + copy(dAtA[i:], m.Logo) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Logo))) + i-- + dAtA[i] = 0x22 + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x1a + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventFundPool) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } + +func (m *EventFundPool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventFundPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AmountPerBundle != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.AmountPerBundle)) + i-- + dAtA[i] = 0x20 + } + if m.Amount != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x18 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x12 + } + if m.PoolId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EventDefundPool) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventDefundPool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventDefundPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Amount != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x18 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x12 + } + if m.PoolId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { + offset -= sovEvents(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EventCreateFunder) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Logo) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Contact) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Details) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func (m *EventUpdateFunder) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Logo) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Contact) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Details) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func (m *EventFundPool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovEvents(uint64(m.PoolId)) + } + l = len(m.Address) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.Amount != 0 { + n += 1 + sovEvents(uint64(m.Amount)) + } + if m.AmountPerBundle != 0 { + n += 1 + sovEvents(uint64(m.AmountPerBundle)) + } + return n +} + +func (m *EventDefundPool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovEvents(uint64(m.PoolId)) + } + l = len(m.Address) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.Amount != 0 { + n += 1 + sovEvents(uint64(m.Amount)) + } + return n +} + +func sovEvents(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvents(x uint64) (n int) { + return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventCreateFunder) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventCreateFunder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventCreateFunder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Logo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Details = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventUpdateFunder) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventUpdateFunder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventUpdateFunder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Logo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Details = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventFundPool) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventFundPool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventFundPool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AmountPerBundle", wireType) + } + m.AmountPerBundle = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AmountPerBundle |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventDefundPool) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventDefundPool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventDefundPool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvents(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEvents + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvents + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvents + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/funders/types/expected_keepers.go b/x/funders/types/expected_keepers.go index 6aa6e977..71c97ec0 100644 --- a/x/funders/types/expected_keepers.go +++ b/x/funders/types/expected_keepers.go @@ -2,17 +2,9 @@ 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 +type PoolKeeper interface { + AssertPoolExists(ctx sdk.Context, poolId uint64) error + //GetPoolWithError(ctx sdk.Context, poolId uint64) (pooltypes.Pool, error) } diff --git a/x/funders/types/funders.go b/x/funders/types/funders.go new file mode 100644 index 00000000..ee267460 --- /dev/null +++ b/x/funders/types/funders.go @@ -0,0 +1,72 @@ +package types + +import ( + "errors" + "fmt" +) + +func (f *Funding) AddAmount(amount uint64) { + f.Amount += amount +} + +func (f *Funding) SubtractAmount(amount uint64) { + if f.Amount > amount { + f.Amount -= amount + } else { + f.Amount = 0 + } +} + +func (fh *FundingState) GetLowestFunding() (funding *Funding, err error) { + if len(fh.ActiveFundings) == 0 { + return nil, errors.New(fmt.Sprintf("no active fundings for pool %d", fh.PoolId)) + } + + lowestFunding := fh.ActiveFundings[0] + for _, v := range fh.ActiveFundings { + if v.Amount < lowestFunding.Amount { + lowestFunding = v + } + } + return lowestFunding, nil +} + +// SetInactive moves a funding from active to inactive and subtracts the amount. +func (fh *FundingState) SetInactive(funding *Funding) { + // Remove funding from active fundings + for i, v := range fh.ActiveFundings { + if v.FunderAddress == funding.FunderAddress { + fh.ActiveFundings[i] = fh.ActiveFundings[len(fh.ActiveFundings)-1] + fh.ActiveFundings = fh.ActiveFundings[:len(fh.ActiveFundings)-1] + break + } + } + + // Add funding to inactive fundings + for _, v := range fh.InactiveFundings { + if v.FunderAddress == funding.FunderAddress { + return + } + } + fh.InactiveFundings = append(fh.InactiveFundings, funding) +} + +// SetActive moves a funding from inactive to active and adds the amount. +func (fh *FundingState) SetActive(funding *Funding) { + // Remove funding from inactive fundings + for i, v := range fh.InactiveFundings { + if v.FunderAddress == funding.FunderAddress { + fh.InactiveFundings[i] = fh.InactiveFundings[len(fh.InactiveFundings)-1] + fh.InactiveFundings = fh.InactiveFundings[:len(fh.InactiveFundings)-1] + break + } + } + + // Add funding to active fundings + for _, v := range fh.ActiveFundings { + if v.FunderAddress == funding.FunderAddress { + return + } + } + fh.ActiveFundings = append(fh.ActiveFundings, funding) +} diff --git a/x/funders/types/funders.pb.go b/x/funders/types/funders.pb.go index cf0d4b32..583eacf7 100644 --- a/x/funders/types/funders.pb.go +++ b/x/funders/types/funders.pb.go @@ -6,7 +6,9 @@ package types import ( fmt "fmt" proto "github.com/cosmos/gogoproto/proto" + io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -20,19 +22,1263 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// Funder is the object which holds info about a single pool funder +type Funder struct { + // address ... + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // moniker ... + Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` + // identity is the 64 bit keybase.io identity string + Identity string `protobuf:"bytes,3,opt,name=identity,proto3" json:"identity,omitempty"` + // logo ... + Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` + // website ... + Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` + // contact ... + Contact string `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` + // details are some additional notes the funder finds important + Details string `protobuf:"bytes,7,opt,name=details,proto3" json:"details,omitempty"` +} + +func (m *Funder) Reset() { *m = Funder{} } +func (m *Funder) String() string { return proto.CompactTextString(m) } +func (*Funder) ProtoMessage() {} +func (*Funder) Descriptor() ([]byte, []int) { + return fileDescriptor_252d80f89b0fa299, []int{0} +} +func (m *Funder) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Funder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Funder.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Funder) XXX_Merge(src proto.Message) { + xxx_messageInfo_Funder.Merge(m, src) +} +func (m *Funder) XXX_Size() int { + return m.Size() +} +func (m *Funder) XXX_DiscardUnknown() { + xxx_messageInfo_Funder.DiscardUnknown(m) +} + +var xxx_messageInfo_Funder proto.InternalMessageInfo + +func (m *Funder) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *Funder) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *Funder) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *Funder) GetLogo() string { + if m != nil { + return m.Logo + } + return "" +} + +func (m *Funder) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *Funder) GetContact() string { + if m != nil { + return m.Contact + } + return "" +} + +func (m *Funder) GetDetails() string { + if m != nil { + return m.Details + } + return "" +} + +// Funding is the object which holds info about the current funding +// funder_address and pool_id (m2m) are unique together which means that +// a funder can only fund each pool once and a pool can only be funded +// by each funder once. However, a funder can update the amount of funds. +type Funding struct { + // funder_id is the id of the funder + FunderAddress string `protobuf:"bytes,1,opt,name=funder_address,json=funderAddress,proto3" json:"funder_address,omitempty"` + // pool_id is the id of the pool this funding is for + PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // amount is the amount of funds in ukyve the funder has left + Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` + // amount_per_bundle is the amount of funds in ukyve the funder pays per bundle + AmountPerBundle uint64 `protobuf:"varint,4,opt,name=amount_per_bundle,json=amountPerBundle,proto3" json:"amount_per_bundle,omitempty"` + // total_funded is the total amount of funds in ukyve the funder has funded + TotalFunded uint64 `protobuf:"varint,5,opt,name=total_funded,json=totalFunded,proto3" json:"total_funded,omitempty"` +} + +func (m *Funding) Reset() { *m = Funding{} } +func (m *Funding) String() string { return proto.CompactTextString(m) } +func (*Funding) ProtoMessage() {} +func (*Funding) Descriptor() ([]byte, []int) { + return fileDescriptor_252d80f89b0fa299, []int{1} +} +func (m *Funding) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Funding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Funding.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Funding) XXX_Merge(src proto.Message) { + xxx_messageInfo_Funding.Merge(m, src) +} +func (m *Funding) XXX_Size() int { + return m.Size() +} +func (m *Funding) XXX_DiscardUnknown() { + xxx_messageInfo_Funding.DiscardUnknown(m) +} + +var xxx_messageInfo_Funding proto.InternalMessageInfo + +func (m *Funding) GetFunderAddress() string { + if m != nil { + return m.FunderAddress + } + return "" +} + +func (m *Funding) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *Funding) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +func (m *Funding) GetAmountPerBundle() uint64 { + if m != nil { + return m.AmountPerBundle + } + return 0 +} + +func (m *Funding) GetTotalFunded() uint64 { + if m != nil { + return m.TotalFunded + } + return 0 +} + +// FundingState is the object which holds info about the funding state +type FundingState struct { + // pool_id is the id of the pool this funding is for + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // active_fundings is the list of all active fundings + ActiveFundings []*Funding `protobuf:"bytes,2,rep,name=active_fundings,json=activeFundings,proto3" json:"active_fundings,omitempty"` + // inactive_fundings is the list of all inactive fundings that have been used up + InactiveFundings []*Funding `protobuf:"bytes,3,rep,name=inactive_fundings,json=inactiveFundings,proto3" json:"inactive_fundings,omitempty"` + // total_amount is the total amount of funds in ukyve the pool has from all fundings + TotalAmount uint64 `protobuf:"varint,4,opt,name=total_amount,json=totalAmount,proto3" json:"total_amount,omitempty"` +} + +func (m *FundingState) Reset() { *m = FundingState{} } +func (m *FundingState) String() string { return proto.CompactTextString(m) } +func (*FundingState) ProtoMessage() {} +func (*FundingState) Descriptor() ([]byte, []int) { + return fileDescriptor_252d80f89b0fa299, []int{2} +} +func (m *FundingState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FundingState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FundingState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *FundingState) XXX_Merge(src proto.Message) { + xxx_messageInfo_FundingState.Merge(m, src) +} +func (m *FundingState) XXX_Size() int { + return m.Size() +} +func (m *FundingState) XXX_DiscardUnknown() { + xxx_messageInfo_FundingState.DiscardUnknown(m) +} + +var xxx_messageInfo_FundingState proto.InternalMessageInfo + +func (m *FundingState) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *FundingState) GetActiveFundings() []*Funding { + if m != nil { + return m.ActiveFundings + } + return nil +} + +func (m *FundingState) GetInactiveFundings() []*Funding { + if m != nil { + return m.InactiveFundings + } + return nil +} + +func (m *FundingState) GetTotalAmount() uint64 { + if m != nil { + return m.TotalAmount + } + return 0 +} + +func init() { + proto.RegisterType((*Funder)(nil), "kyve.funders.v1beta1.Funder") + proto.RegisterType((*Funding)(nil), "kyve.funders.v1beta1.Funding") + proto.RegisterType((*FundingState)(nil), "kyve.funders.v1beta1.FundingState") +} + func init() { proto.RegisterFile("kyve/funders/v1beta1/funders.proto", fileDescriptor_252d80f89b0fa299) } var fileDescriptor_252d80f89b0fa299 = []byte{ - // 134 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xca, 0xae, 0x2c, 0x4b, - 0xd5, 0x4f, 0x2b, 0xcd, 0x4b, 0x49, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, - 0x84, 0xf1, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x44, 0x40, 0x6a, 0xf4, 0x60, 0x62, 0x50, - 0x35, 0x4e, 0x6e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, - 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x93, 0x9e, - 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0xef, 0x1d, 0x19, 0xe6, 0xea, 0x97, 0x5a, - 0x52, 0x9e, 0x5f, 0x94, 0xad, 0x9f, 0x9c, 0x91, 0x98, 0x99, 0xa7, 0x5f, 0x01, 0xb7, 0xad, 0xa4, - 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x6c, 0x89, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x49, 0x82, - 0xff, 0xea, 0x8a, 0x00, 0x00, 0x00, + // 429 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xd1, 0x6a, 0x14, 0x31, + 0x18, 0x85, 0x37, 0xdd, 0x71, 0x56, 0xd3, 0xda, 0xda, 0x20, 0x1a, 0x04, 0x87, 0xba, 0x20, 0x14, + 0x91, 0x19, 0xaa, 0x4f, 0xd0, 0x82, 0x0b, 0x2a, 0x88, 0x8c, 0x20, 0xe8, 0xcd, 0x90, 0x99, 0xfc, + 0x6e, 0xc3, 0xce, 0x26, 0xcb, 0xe4, 0xdf, 0xad, 0xfb, 0x16, 0x3e, 0x8a, 0xd7, 0x3e, 0x81, 0x97, + 0xbd, 0xf4, 0x4a, 0x64, 0xf7, 0x45, 0x64, 0x92, 0xcc, 0xd0, 0x8a, 0x17, 0xbd, 0xcb, 0x77, 0x4e, + 0x72, 0xe6, 0x3f, 0x99, 0xd0, 0xf1, 0x6c, 0xbd, 0x82, 0xec, 0xcb, 0x52, 0x4b, 0x68, 0x6c, 0xb6, + 0x3a, 0x29, 0x01, 0xc5, 0x49, 0xc7, 0xe9, 0xa2, 0x31, 0x68, 0xd8, 0xfd, 0x76, 0x4f, 0xda, 0x69, + 0x61, 0xcf, 0xf8, 0x07, 0xa1, 0xf1, 0xc4, 0x69, 0x8c, 0xd3, 0x91, 0x90, 0xb2, 0x01, 0x6b, 0x39, + 0x39, 0x22, 0xc7, 0x77, 0xf2, 0x0e, 0x5b, 0x67, 0x6e, 0xb4, 0x9a, 0x41, 0xc3, 0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0x69, 0x48, 0xcd, 0xf7, 0xfd, 0xa9, 0x80, 0x96, 0xbd, 0xa1, 0x87, 0x4a, 0xff, + 0x9b, 0x34, 0xbc, 0x49, 0xd2, 0xbd, 0xee, 0x5c, 0x9f, 0xd5, 0x17, 0x0c, 0x57, 0x15, 0x5d, 0x29, + 0x78, 0xea, 0xa4, 0xb3, 0xc9, 0xcf, 0x4d, 0x42, 0x2e, 0x37, 0x09, 0xf9, 0xb3, 0x49, 0xc8, 0xb7, + 0x6d, 0x32, 0xb8, 0xdc, 0x26, 0x83, 0x5f, 0xdb, 0x64, 0xf0, 0xf9, 0xf9, 0x54, 0xe1, 0xf9, 0xb2, + 0x4c, 0x2b, 0x33, 0xcf, 0xde, 0x7e, 0xfa, 0xf8, 0xea, 0x1d, 0xe0, 0x85, 0x69, 0x66, 0x59, 0x75, + 0x2e, 0x94, 0xce, 0xbe, 0xf6, 0xcf, 0x17, 0xd7, 0x0b, 0xb0, 0x65, 0xec, 0x5e, 0xed, 0xcb, 0xbf, + 0x01, 0x00, 0x00, 0xff, 0xff, 0xce, 0x3f, 0x73, 0x3c, 0xdb, 0x02, 0x00, 0x00, +} + +func (m *Funder) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Funder) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Funder) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Details) > 0 { + i -= len(m.Details) + copy(dAtA[i:], m.Details) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Details))) + i-- + dAtA[i] = 0x3a + } + if len(m.Contact) > 0 { + i -= len(m.Contact) + copy(dAtA[i:], m.Contact) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Contact))) + i-- + dAtA[i] = 0x32 + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x2a + } + if len(m.Logo) > 0 { + i -= len(m.Logo) + copy(dAtA[i:], m.Logo) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Logo))) + i-- + dAtA[i] = 0x22 + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x1a + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Funding) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Funding) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Funding) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TotalFunded != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.TotalFunded)) + i-- + dAtA[i] = 0x28 + } + if m.AmountPerBundle != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.AmountPerBundle)) + i-- + dAtA[i] = 0x20 + } + if m.Amount != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x18 + } + if m.PoolId != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x10 + } + if len(m.FunderAddress) > 0 { + i -= len(m.FunderAddress) + copy(dAtA[i:], m.FunderAddress) + i = encodeVarintFunders(dAtA, i, uint64(len(m.FunderAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } + +func (m *FundingState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FundingState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FundingState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TotalAmount != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.TotalAmount)) + i-- + dAtA[i] = 0x20 + } + if len(m.InactiveFundings) > 0 { + for iNdEx := len(m.InactiveFundings) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.InactiveFundings[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFunders(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.ActiveFundings) > 0 { + for iNdEx := len(m.ActiveFundings) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ActiveFundings[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFunders(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.PoolId != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintFunders(dAtA []byte, offset int, v uint64) int { + offset -= sovFunders(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Funder) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Logo) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Contact) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Details) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + return n +} + +func (m *Funding) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FunderAddress) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + if m.PoolId != 0 { + n += 1 + sovFunders(uint64(m.PoolId)) + } + if m.Amount != 0 { + n += 1 + sovFunders(uint64(m.Amount)) + } + if m.AmountPerBundle != 0 { + n += 1 + sovFunders(uint64(m.AmountPerBundle)) + } + if m.TotalFunded != 0 { + n += 1 + sovFunders(uint64(m.TotalFunded)) + } + return n +} + +func (m *FundingState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovFunders(uint64(m.PoolId)) + } + if len(m.ActiveFundings) > 0 { + for _, e := range m.ActiveFundings { + l = e.Size() + n += 1 + l + sovFunders(uint64(l)) + } + } + if len(m.InactiveFundings) > 0 { + for _, e := range m.InactiveFundings { + l = e.Size() + n += 1 + l + sovFunders(uint64(l)) + } + } + if m.TotalAmount != 0 { + n += 1 + sovFunders(uint64(m.TotalAmount)) + } + return n +} + +func sovFunders(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozFunders(x uint64) (n int) { + return sovFunders(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Funder) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Funder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Funder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Logo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Details = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Funding) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Funding: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Funding: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FunderAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FunderAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AmountPerBundle", wireType) + } + m.AmountPerBundle = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AmountPerBundle |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalFunded", wireType) + } + m.TotalFunded = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalFunded |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FundingState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FundingState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FundingState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ActiveFundings", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ActiveFundings = append(m.ActiveFundings, &Funding{}) + if err := m.ActiveFundings[len(m.ActiveFundings)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InactiveFundings", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InactiveFundings = append(m.InactiveFundings, &Funding{}) + if err := m.InactiveFundings[len(m.InactiveFundings)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalAmount", wireType) + } + m.TotalAmount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalAmount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipFunders(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFunders + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFunders + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFunders + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthFunders + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupFunders + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthFunders + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthFunders = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowFunders = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupFunders = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/funders/types/keys.go b/x/funders/types/keys.go index 8123d1a7..64cce341 100644 --- a/x/funders/types/keys.go +++ b/x/funders/types/keys.go @@ -1,5 +1,7 @@ package types +import "github.com/KYVENetwork/chain/util" + const ( // ModuleName defines the module name ModuleName = "funders" @@ -14,7 +16,51 @@ const ( MemStoreKey = "mem_funders" ) +const ( + // MaxFunders which are allowed + MaxFunders = 50 + // MinFundingAmount which is necessary to fund a pool + //TODO(rapha): how much should this be? + MinFundingAmount = 1_000_000_000 + //MinFundingAmountPerBundle which is necessary to fund a pool + //TODO: how much should this be? + MinFundingAmountPerBundle = 1_000_000 +) + var ( // ParamsKey is the prefix for all module params defined in params.proto ParamsKey = []byte{0x00} + + // FunderKeyPrefix is indexed by the funder address + // and contains all funders regardless of the pool + // key -> FunderKeyPrefix | + FunderKeyPrefix = []byte{1} + + // FundingKeyPrefixByFunder stores funding for each funder and pool by funder + // FundingKeyPrefixByFunder | | + FundingKeyPrefixByFunder = []byte{2, 0} + + // FundingKeyPrefixByPool stores funding for each funder and pool by pool + // FundingKeyPrefixByPool | | + FundingKeyPrefixByPool = []byte{2, 1} + + // FundingStateKeyPrefix stores funding state for each pool + // FundingStateKeyPrefix | | + FundingStateKeyPrefix = []byte{3, 0} ) + +func FunderKey(funderAddress string) []byte { + return util.GetByteKey(funderAddress) +} + +func FundingKeyByFunder(funderAddress string, poolId uint64) []byte { + return util.GetByteKey(funderAddress, poolId) +} + +func FundingKeyByPool(funderAddress string, poolId uint64) []byte { + return util.GetByteKey(poolId, funderAddress) +} + +func FundingStateKey(poolId uint64) []byte { + return util.GetByteKey(poolId) +} diff --git a/x/funders/types/message_create_funder.go b/x/funders/types/message_create_funder.go new file mode 100644 index 00000000..99e5e5e3 --- /dev/null +++ b/x/funders/types/message_create_funder.go @@ -0,0 +1,41 @@ +package types + +import ( + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" +) + +var ( + _ sdk.Msg = &MsgCreateFunder{} +) + +func (msg *MsgCreateFunder) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgCreateFunder) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{creator} +} + +func (msg *MsgCreateFunder) Route() string { + return RouterKey +} + +func (msg *MsgCreateFunder) Type() string { + return "kyve/funders/MsgCreateFunder" +} + +func (msg *MsgCreateFunder) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) + } + + return nil +} diff --git a/x/funders/types/message_fund_pool.go b/x/funders/types/message_fund_pool.go new file mode 100644 index 00000000..44aa69f0 --- /dev/null +++ b/x/funders/types/message_fund_pool.go @@ -0,0 +1,54 @@ +package types + +import ( + "cosmossdk.io/errors" + "github.com/KYVENetwork/chain/util" + sdk "github.com/cosmos/cosmos-sdk/types" + errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" +) + +var ( + _ sdk.Msg = &MsgFundPool{} +) + +func (msg *MsgFundPool) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgFundPool) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{creator} +} + +func (msg *MsgFundPool) Route() string { + return RouterKey +} + +func (msg *MsgFundPool) Type() string { + return "kyve/funders/MsgFundPool" +} + +func (msg *MsgFundPool) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) + } + + if util.ValidatePositiveNumber(msg.PoolId) != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid pool id") + } + + if util.ValidateNumber(msg.Amount) != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid amount") + } + + if util.ValidateNumber(msg.AmountPerBundle) != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid amount per bundle") + } + + return nil +} diff --git a/x/funders/types/tx.pb.go b/x/funders/types/tx.pb.go index af8fa694..730e5430 100644 --- a/x/funders/types/tx.pb.go +++ b/x/funders/types/tx.pb.go @@ -9,7 +9,11 @@ import ( grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -23,19 +27,535 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// MsgCreateFunder defines a SDK message for creating a funder. +type MsgCreateFunder struct { + // creator ... + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // moniker + Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` + // identity is the 64 bit keybase.io identity string + Identity string `protobuf:"bytes,3,opt,name=identity,proto3" json:"identity,omitempty"` + // logo + Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` + // website + Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` + // contact + Contact string `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` + // details are some additional notes the funder finds important + Details string `protobuf:"bytes,7,opt,name=details,proto3" json:"details,omitempty"` +} + +func (m *MsgCreateFunder) Reset() { *m = MsgCreateFunder{} } +func (m *MsgCreateFunder) String() string { return proto.CompactTextString(m) } +func (*MsgCreateFunder) ProtoMessage() {} +func (*MsgCreateFunder) Descriptor() ([]byte, []int) { + return fileDescriptor_5145d80c2db97f3d, []int{0} +} +func (m *MsgCreateFunder) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateFunder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateFunder.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateFunder) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateFunder.Merge(m, src) +} +func (m *MsgCreateFunder) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateFunder) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateFunder.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateFunder proto.InternalMessageInfo + +func (m *MsgCreateFunder) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgCreateFunder) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *MsgCreateFunder) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *MsgCreateFunder) GetLogo() string { + if m != nil { + return m.Logo + } + return "" +} + +func (m *MsgCreateFunder) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *MsgCreateFunder) GetContact() string { + if m != nil { + return m.Contact + } + return "" +} + +func (m *MsgCreateFunder) GetDetails() string { + if m != nil { + return m.Details + } + return "" +} + +// MsgCreateFunderResponse defines the Msg/CreateFunder response type. +type MsgCreateFunderResponse struct { +} + +func (m *MsgCreateFunderResponse) Reset() { *m = MsgCreateFunderResponse{} } +func (m *MsgCreateFunderResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateFunderResponse) ProtoMessage() {} +func (*MsgCreateFunderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5145d80c2db97f3d, []int{1} +} +func (m *MsgCreateFunderResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateFunderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateFunderResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateFunderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateFunderResponse.Merge(m, src) +} +func (m *MsgCreateFunderResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateFunderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateFunderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateFunderResponse proto.InternalMessageInfo + +// MsgUpdateFunder defines a SDK message for updating a funder. +type MsgUpdateFunder struct { + // creator ... + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // moniker + Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` + // identity is the 64 bit keybase.io identity string + Identity string `protobuf:"bytes,3,opt,name=identity,proto3" json:"identity,omitempty"` + // logo + Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` + // website + Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` + // contact + Contact string `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` + // details are some additional notes the funder finds important + Details string `protobuf:"bytes,7,opt,name=details,proto3" json:"details,omitempty"` +} + +func (m *MsgUpdateFunder) Reset() { *m = MsgUpdateFunder{} } +func (m *MsgUpdateFunder) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateFunder) ProtoMessage() {} +func (*MsgUpdateFunder) Descriptor() ([]byte, []int) { + return fileDescriptor_5145d80c2db97f3d, []int{2} +} +func (m *MsgUpdateFunder) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateFunder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateFunder.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateFunder) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateFunder.Merge(m, src) +} +func (m *MsgUpdateFunder) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateFunder) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateFunder.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateFunder proto.InternalMessageInfo + +func (m *MsgUpdateFunder) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgUpdateFunder) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *MsgUpdateFunder) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *MsgUpdateFunder) GetLogo() string { + if m != nil { + return m.Logo + } + return "" +} + +func (m *MsgUpdateFunder) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *MsgUpdateFunder) GetContact() string { + if m != nil { + return m.Contact + } + return "" +} + +func (m *MsgUpdateFunder) GetDetails() string { + if m != nil { + return m.Details + } + return "" +} + +// MsgUpdateFunderResponse defines the Msg/UpdateFunder response type. +type MsgUpdateFunderResponse struct { +} + +func (m *MsgUpdateFunderResponse) Reset() { *m = MsgUpdateFunderResponse{} } +func (m *MsgUpdateFunderResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateFunderResponse) ProtoMessage() {} +func (*MsgUpdateFunderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5145d80c2db97f3d, []int{3} +} +func (m *MsgUpdateFunderResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateFunderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateFunderResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateFunderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateFunderResponse.Merge(m, src) +} +func (m *MsgUpdateFunderResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateFunderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateFunderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateFunderResponse proto.InternalMessageInfo + +// MsgFundPool defines a SDK message for funding a pool. +type MsgFundPool struct { + // creator ... + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // id ... + PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // amount is the total amount available for distribution + Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` + // amount_per_bundle defines the amount of tokens that are distributed per submitted bundle + AmountPerBundle uint64 `protobuf:"varint,4,opt,name=amount_per_bundle,json=amountPerBundle,proto3" json:"amount_per_bundle,omitempty"` +} + +func (m *MsgFundPool) Reset() { *m = MsgFundPool{} } +func (m *MsgFundPool) String() string { return proto.CompactTextString(m) } +func (*MsgFundPool) ProtoMessage() {} +func (*MsgFundPool) Descriptor() ([]byte, []int) { + return fileDescriptor_5145d80c2db97f3d, []int{4} +} +func (m *MsgFundPool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgFundPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgFundPool.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgFundPool) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgFundPool.Merge(m, src) +} +func (m *MsgFundPool) XXX_Size() int { + return m.Size() +} +func (m *MsgFundPool) XXX_DiscardUnknown() { + xxx_messageInfo_MsgFundPool.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgFundPool proto.InternalMessageInfo + +func (m *MsgFundPool) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgFundPool) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *MsgFundPool) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +func (m *MsgFundPool) GetAmountPerBundle() uint64 { + if m != nil { + return m.AmountPerBundle + } + return 0 +} + +// MsgFundPoolResponse defines the Msg/DefundPool response type. +type MsgFundPoolResponse struct { +} + +func (m *MsgFundPoolResponse) Reset() { *m = MsgFundPoolResponse{} } +func (m *MsgFundPoolResponse) String() string { return proto.CompactTextString(m) } +func (*MsgFundPoolResponse) ProtoMessage() {} +func (*MsgFundPoolResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5145d80c2db97f3d, []int{5} +} +func (m *MsgFundPoolResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgFundPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgFundPoolResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgFundPoolResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgFundPoolResponse.Merge(m, src) +} +func (m *MsgFundPoolResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgFundPoolResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgFundPoolResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgFundPoolResponse proto.InternalMessageInfo + +// MsgDefundPool defines a SDK message for defunding a pool. +type MsgDefundPool struct { + // creator ... + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // id ... + PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // amount ... + Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *MsgDefundPool) Reset() { *m = MsgDefundPool{} } +func (m *MsgDefundPool) String() string { return proto.CompactTextString(m) } +func (*MsgDefundPool) ProtoMessage() {} +func (*MsgDefundPool) Descriptor() ([]byte, []int) { + return fileDescriptor_5145d80c2db97f3d, []int{6} +} +func (m *MsgDefundPool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDefundPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDefundPool.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDefundPool) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDefundPool.Merge(m, src) +} +func (m *MsgDefundPool) XXX_Size() int { + return m.Size() +} +func (m *MsgDefundPool) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDefundPool.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDefundPool proto.InternalMessageInfo + +func (m *MsgDefundPool) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgDefundPool) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *MsgDefundPool) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +// MsgDefundPoolResponse defines the Msg/DefundPool response type. +type MsgDefundPoolResponse struct { +} + +func (m *MsgDefundPoolResponse) Reset() { *m = MsgDefundPoolResponse{} } +func (m *MsgDefundPoolResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDefundPoolResponse) ProtoMessage() {} +func (*MsgDefundPoolResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5145d80c2db97f3d, []int{7} +} +func (m *MsgDefundPoolResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDefundPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDefundPoolResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDefundPoolResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDefundPoolResponse.Merge(m, src) +} +func (m *MsgDefundPoolResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDefundPoolResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDefundPoolResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDefundPoolResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateFunder)(nil), "kyve.funders.v1beta1.MsgCreateFunder") + proto.RegisterType((*MsgCreateFunderResponse)(nil), "kyve.funders.v1beta1.MsgCreateFunderResponse") + proto.RegisterType((*MsgUpdateFunder)(nil), "kyve.funders.v1beta1.MsgUpdateFunder") + proto.RegisterType((*MsgUpdateFunderResponse)(nil), "kyve.funders.v1beta1.MsgUpdateFunderResponse") + proto.RegisterType((*MsgFundPool)(nil), "kyve.funders.v1beta1.MsgFundPool") + proto.RegisterType((*MsgFundPoolResponse)(nil), "kyve.funders.v1beta1.MsgFundPoolResponse") + proto.RegisterType((*MsgDefundPool)(nil), "kyve.funders.v1beta1.MsgDefundPool") + proto.RegisterType((*MsgDefundPoolResponse)(nil), "kyve.funders.v1beta1.MsgDefundPoolResponse") +} + func init() { proto.RegisterFile("kyve/funders/v1beta1/tx.proto", fileDescriptor_5145d80c2db97f3d) } var fileDescriptor_5145d80c2db97f3d = []byte{ - // 143 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcd, 0xae, 0x2c, 0x4b, - 0xd5, 0x4f, 0x2b, 0xcd, 0x4b, 0x49, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, - 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, 0x49, 0xeb, 0x41, 0xa5, - 0xf5, 0xa0, 0xd2, 0x46, 0xac, 0x5c, 0xcc, 0xbe, 0xc5, 0xe9, 0x4e, 0x6e, 0x27, 0x1e, 0xc9, 0x31, - 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, - 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x93, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, - 0x9f, 0xab, 0xef, 0x1d, 0x19, 0xe6, 0xea, 0x97, 0x5a, 0x52, 0x9e, 0x5f, 0x94, 0xad, 0x9f, 0x9c, - 0x91, 0x98, 0x99, 0xa7, 0x5f, 0x01, 0xb7, 0xaf, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x6c, - 0x97, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x39, 0x2f, 0x59, 0x7f, 0x8c, 0x00, 0x00, 0x00, + // 454 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x94, 0xcd, 0x6e, 0xd4, 0x30, + 0x10, 0xc7, 0x37, 0x6d, 0xd8, 0x2d, 0x03, 0xa8, 0xc2, 0x50, 0xd6, 0xac, 0x44, 0x04, 0x8b, 0x90, + 0xf8, 0x4c, 0x54, 0x78, 0x83, 0x02, 0x95, 0x10, 0x5a, 0x54, 0x45, 0x02, 0x41, 0x0f, 0xac, 0x92, + 0x78, 0x9a, 0x5a, 0x9b, 0xb5, 0x23, 0xdb, 0x69, 0xbb, 0x77, 0x1e, 0x80, 0x97, 0xe0, 0x49, 0xb8, + 0x70, 0xec, 0x91, 0x23, 0xda, 0x7d, 0x11, 0x14, 0xe7, 0x83, 0x6d, 0x45, 0xa1, 0x07, 0x2e, 0xdc, + 0xfc, 0x9f, 0xdf, 0x78, 0x66, 0xfe, 0x96, 0x6d, 0xb8, 0x35, 0x99, 0x1d, 0x60, 0xb0, 0x57, 0x08, +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0x1a, 0xc7, 0x85, 0x60, 0x19, 0x5a, 0x93, 0x6e, 0xb8, 0x5e, + 0x81, 0x1d, 0x54, 0x5b, 0x36, 0x3c, 0xdc, 0x80, 0x6b, 0x4b, 0x53, 0xb4, 0xd3, 0xed, 0xc2, 0x95, + 0x91, 0x4e, 0x5f, 0xe0, 0xde, 0xbf, 0x1f, 0x6f, 0xd8, 0x87, 0x8d, 0x13, 0xb5, 0x9b, 0xa6, 0x4f, + 0xbf, 0xac, 0xc0, 0xea, 0x48, 0xa7, 0x84, 0xc1, 0xe5, 0x13, 0x17, 0xfb, 0x9e, 0xff, 0xbb, 0x37, + 0xe0, 0x9f, 0xba, 0x3a, 0x83, 0x27, 0xe7, 0x4a, 0x6b, 0xba, 0x91, 0xf7, 0xb0, 0xd6, 0x1e, 0xfe, + 0x9d, 0x33, 0xb7, 0x36, 0x29, 0x83, 0x07, 0x7f, 0x4d, 0x69, 0x2b, 0x7f, 0x04, 0x58, 0x3a, 0xb9, + 0xbb, 0x67, 0x6e, 0xfc, 0x95, 0x34, 0x78, 0x74, 0x8e, 0xa4, 0xa6, 0xfe, 0xd6, 0xf6, 0xb7, 0xb9, + 0xe7, 0x1c, 0xcf, 0x3d, 0xe7, 0xc7, 0xdc, 0x73, 0x3e, 0x2f, 0xbc, 0xce, 0xf1, 0xc2, 0xeb, 0x7c, + 0x5f, 0x78, 0x9d, 0xdd, 0xc7, 0x29, 0x37, 0xfb, 0x45, 0xec, 0x27, 0x72, 0x1a, 0xbc, 0xfe, 0xf0, + 0xee, 0xe5, 0x1b, 0x34, 0x87, 0x52, 0x4d, 0x82, 0x64, 0x3f, 0xe2, 0x22, 0x38, 0x6a, 0x7f, 0x19, + 0x33, 0xcb, 0x51, 0xc7, 0x5d, 0xfb, 0xc3, 0x3c, 0xfb, 0x19, 0x00, 0x00, 0xff, 0xff, 0x6a, 0x3b, + 0xf4, 0xc7, 0x82, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -50,6 +570,14 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + // CreateFunder ... + CreateFunder(ctx context.Context, in *MsgCreateFunder, opts ...grpc.CallOption) (*MsgCreateFunderResponse, error) + // UpdateFunder ... + // rpc UpdateFunder(MsgUpdateFunder) returns (MsgUpdateFunderResponse); + // FundPool ... + FundPool(ctx context.Context, in *MsgFundPool, opts ...grpc.CallOption) (*MsgFundPoolResponse, error) + // DefundPool ... + DefundPool(ctx context.Context, in *MsgDefundPool, opts ...grpc.CallOption) (*MsgDefundPoolResponse, error) } type msgClient struct { @@ -60,22 +588,1715 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } +func (c *msgClient) CreateFunder(ctx context.Context, in *MsgCreateFunder, opts ...grpc.CallOption) (*MsgCreateFunderResponse, error) { + out := new(MsgCreateFunderResponse) + err := c.cc.Invoke(ctx, "/kyve.funders.v1beta1.Msg/CreateFunder", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) FundPool(ctx context.Context, in *MsgFundPool, opts ...grpc.CallOption) (*MsgFundPoolResponse, error) { + out := new(MsgFundPoolResponse) + err := c.cc.Invoke(ctx, "/kyve.funders.v1beta1.Msg/FundPool", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DefundPool(ctx context.Context, in *MsgDefundPool, opts ...grpc.CallOption) (*MsgDefundPoolResponse, error) { + out := new(MsgDefundPoolResponse) + err := c.cc.Invoke(ctx, "/kyve.funders.v1beta1.Msg/DefundPool", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { + // CreateFunder ... + CreateFunder(context.Context, *MsgCreateFunder) (*MsgCreateFunderResponse, error) + // UpdateFunder ... + // rpc UpdateFunder(MsgUpdateFunder) returns (MsgUpdateFunderResponse); + // FundPool ... + FundPool(context.Context, *MsgFundPool) (*MsgFundPoolResponse, error) + // DefundPool ... + DefundPool(context.Context, *MsgDefundPool) (*MsgDefundPoolResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } +func (*UnimplementedMsgServer) CreateFunder(ctx context.Context, req *MsgCreateFunder) (*MsgCreateFunderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateFunder not implemented") +} +func (*UnimplementedMsgServer) FundPool(ctx context.Context, req *MsgFundPool) (*MsgFundPoolResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FundPool not implemented") +} +func (*UnimplementedMsgServer) DefundPool(ctx context.Context, req *MsgDefundPool) (*MsgDefundPoolResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DefundPool not implemented") +} + func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } +func _Msg_CreateFunder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateFunder) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateFunder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kyve.funders.v1beta1.Msg/CreateFunder", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateFunder(ctx, req.(*MsgCreateFunder)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_FundPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgFundPool) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).FundPool(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kyve.funders.v1beta1.Msg/FundPool", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).FundPool(ctx, req.(*MsgFundPool)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DefundPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDefundPool) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DefundPool(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kyve.funders.v1beta1.Msg/DefundPool", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DefundPool(ctx, req.(*MsgDefundPool)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kyve.funders.v1beta1.Msg", HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "kyve/funders/v1beta1/tx.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateFunder", + Handler: _Msg_CreateFunder_Handler, + }, + { + MethodName: "FundPool", + Handler: _Msg_FundPool_Handler, + }, + { + MethodName: "DefundPool", + Handler: _Msg_DefundPool_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "kyve/funders/v1beta1/tx.proto", } + +func (m *MsgCreateFunder) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateFunder) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateFunder) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Details) > 0 { + i -= len(m.Details) + copy(dAtA[i:], m.Details) + i = encodeVarintTx(dAtA, i, uint64(len(m.Details))) + i-- + dAtA[i] = 0x3a + } + if len(m.Contact) > 0 { + i -= len(m.Contact) + copy(dAtA[i:], m.Contact) + i = encodeVarintTx(dAtA, i, uint64(len(m.Contact))) + i-- + dAtA[i] = 0x32 + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintTx(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x2a + } + if len(m.Logo) > 0 { + i -= len(m.Logo) + copy(dAtA[i:], m.Logo) + i = encodeVarintTx(dAtA, i, uint64(len(m.Logo))) + i-- + dAtA[i] = 0x22 + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintTx(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x1a + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintTx(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateFunderResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateFunderResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateFunderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateFunder) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateFunder) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateFunder) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Details) > 0 { + i -= len(m.Details) + copy(dAtA[i:], m.Details) + i = encodeVarintTx(dAtA, i, uint64(len(m.Details))) + i-- + dAtA[i] = 0x3a + } + if len(m.Contact) > 0 { + i -= len(m.Contact) + copy(dAtA[i:], m.Contact) + i = encodeVarintTx(dAtA, i, uint64(len(m.Contact))) + i-- + dAtA[i] = 0x32 + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintTx(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x2a + } + if len(m.Logo) > 0 { + i -= len(m.Logo) + copy(dAtA[i:], m.Logo) + i = encodeVarintTx(dAtA, i, uint64(len(m.Logo))) + i-- + dAtA[i] = 0x22 + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintTx(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x1a + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintTx(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateFunderResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateFunderResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateFunderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgFundPool) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgFundPool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgFundPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AmountPerBundle != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.AmountPerBundle)) + i-- + dAtA[i] = 0x20 + } + if m.Amount != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x18 + } + if m.PoolId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgFundPoolResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgFundPoolResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgFundPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDefundPool) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDefundPool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDefundPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Amount != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x18 + } + if m.PoolId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDefundPoolResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDefundPoolResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDefundPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgCreateFunder) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Logo) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Contact) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Details) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCreateFunderResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateFunder) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Logo) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Contact) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Details) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateFunderResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgFundPool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.PoolId != 0 { + n += 1 + sovTx(uint64(m.PoolId)) + } + if m.Amount != 0 { + n += 1 + sovTx(uint64(m.Amount)) + } + if m.AmountPerBundle != 0 { + n += 1 + sovTx(uint64(m.AmountPerBundle)) + } + return n +} + +func (m *MsgFundPoolResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDefundPool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.PoolId != 0 { + n += 1 + sovTx(uint64(m.PoolId)) + } + if m.Amount != 0 { + n += 1 + sovTx(uint64(m.Amount)) + } + return n +} + +func (m *MsgDefundPoolResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgCreateFunder) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateFunder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateFunder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Logo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Details = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateFunderResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateFunderResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateFunderResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateFunder) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateFunder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateFunder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Logo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Details = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateFunderResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateFunderResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateFunderResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgFundPool) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgFundPool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgFundPool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AmountPerBundle", wireType) + } + m.AmountPerBundle = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AmountPerBundle |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgFundPoolResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgFundPoolResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgFundPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDefundPool) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDefundPool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDefundPool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDefundPoolResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDefundPoolResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDefundPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/pool/keeper/msg_server_fund_pool.go b/x/pool/keeper/msg_server_fund_pool.go deleted file mode 100644 index b6f5f099..00000000 --- a/x/pool/keeper/msg_server_fund_pool.go +++ /dev/null @@ -1,71 +0,0 @@ -package keeper - -import ( - "context" - - "cosmossdk.io/errors" - "github.com/KYVENetwork/chain/util" - "github.com/KYVENetwork/chain/x/pool/types" - sdk "github.com/cosmos/cosmos-sdk/types" - errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" -) - -// FundPool handles the logic to fund a pool. -// A funder is added to the funders list with the specified amount -// If the funders list is full, it checks if the funder wants to fund -// more than the current lowest funder. If so, the current lowest funder -// will get their tokens back and removed form the funders list. -func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*types.MsgFundPoolResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - pool, poolFound := k.GetPool(ctx, msg.Id) - - if !poolFound { - return nil, errors.Wrapf(errorsTypes.ErrNotFound, types.ErrPoolNotFound.Error(), msg.Id) - } - - // Check if funder already exists - // If sender is not a funder, check if a free funding slot is still available - if pool.GetFunderAmount(msg.Creator) == 0 { - // If funder does not exist, check if limit is already exceeded. - if len(pool.Funders) >= types.MaxFunders { - // If so, check if funder wants to fund more than current lowest funder. - lowestFunder := pool.GetLowestFunder() - if msg.Amount > lowestFunder.Amount { - // Unstake lowest Funder - err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, types.ModuleName, lowestFunder.Address, lowestFunder.Amount) - if err != nil { - return nil, err - } - - // Emit a defund event. - _ = ctx.EventManager().EmitTypedEvent(&types.EventDefundPool{ - PoolId: msg.Id, - Address: lowestFunder.Address, - Amount: lowestFunder.Amount, - }) - - // Remove from pool - pool.RemoveFunder(lowestFunder.Address) - } else { - return nil, errors.Wrapf(errorsTypes.ErrLogic, types.ErrFundsTooLow.Error(), lowestFunder.Amount) - } - } - } - - // User is allowed to fund - pool.AddAmountToFunder(msg.Creator, msg.Amount) - - if err := util.TransferFromAddressToModule(k.bankKeeper, ctx, msg.Creator, types.ModuleName, msg.Amount); err != nil { - return nil, err - } - - _ = ctx.EventManager().EmitTypedEvent(&types.EventFundPool{ - PoolId: msg.Id, - Address: msg.Creator, - Amount: msg.Amount, - }) - - k.SetPool(ctx, pool) - - return &types.MsgFundPoolResponse{}, nil -} diff --git a/x/pool/types/errors.go b/x/pool/types/errors.go index 991c858d..6f2ebc64 100644 --- a/x/pool/types/errors.go +++ b/x/pool/types/errors.go @@ -4,12 +4,9 @@ import ( "cosmossdk.io/errors" ) -var ErrPoolNotFound = errors.Register(ModuleName, 1100, "pool with id %v does not exist") - // funding errors var ( - ErrFundsTooLow = errors.Register(ModuleName, 1101, "minimum funding amount of %vkyve not reached") - ErrDefundTooHigh = errors.Register(ModuleName, 1102, "maximum defunding amount of %vkyve surpassed") - ErrInvalidJson = errors.Register(ModuleName, 1103, "invalid json object: %v") - ErrInvalidArgs = errors.Register(ModuleName, 1104, "invalid args") + ErrPoolNotFound = errors.Register(ModuleName, 1100, "pool with id %v does not exist") + ErrInvalidJson = errors.Register(ModuleName, 1101, "invalid json object: %v") + ErrInvalidArgs = errors.Register(ModuleName, 1102, "invalid args") ) diff --git a/x/pool/types/events.pb.go b/x/pool/types/events.pb.go index e2718420..8dac4bcd 100644 --- a/x/pool/types/events.pb.go +++ b/x/pool/types/events.pb.go @@ -658,136 +658,6 @@ func (m *EventPoolUpdated) GetCompressionId() uint32 { return 0 } -// EventFundPool is an event emitted when a pool is funded. -// emitted_by: MsgFundPool -type EventFundPool struct { - // pool_id is the unique ID of the pool. - PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` - // address is the account address of the pool funder. - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - // amount is the amount in ukyve the funder has funded - Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (m *EventFundPool) Reset() { *m = EventFundPool{} } -func (m *EventFundPool) String() string { return proto.CompactTextString(m) } -func (*EventFundPool) ProtoMessage() {} -func (*EventFundPool) Descriptor() ([]byte, []int) { - return fileDescriptor_c1828a100d789238, []int{7} -} -func (m *EventFundPool) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventFundPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventFundPool.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventFundPool) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventFundPool.Merge(m, src) -} -func (m *EventFundPool) XXX_Size() int { - return m.Size() -} -func (m *EventFundPool) XXX_DiscardUnknown() { - xxx_messageInfo_EventFundPool.DiscardUnknown(m) -} - -var xxx_messageInfo_EventFundPool proto.InternalMessageInfo - -func (m *EventFundPool) GetPoolId() uint64 { - if m != nil { - return m.PoolId - } - return 0 -} - -func (m *EventFundPool) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -func (m *EventFundPool) GetAmount() uint64 { - if m != nil { - return m.Amount - } - return 0 -} - -// EventDefundPool is an event emitted when a pool is defunded. -// emitted_by: MsgDefundPool -type EventDefundPool struct { - // pool_id is the unique ID of the pool. - PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` - // address is the account address of the pool funder. - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - // amount is the amount in ukyve the funder has defunded - Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (m *EventDefundPool) Reset() { *m = EventDefundPool{} } -func (m *EventDefundPool) String() string { return proto.CompactTextString(m) } -func (*EventDefundPool) ProtoMessage() {} -func (*EventDefundPool) Descriptor() ([]byte, []int) { - return fileDescriptor_c1828a100d789238, []int{8} -} -func (m *EventDefundPool) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventDefundPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventDefundPool.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventDefundPool) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventDefundPool.Merge(m, src) -} -func (m *EventDefundPool) XXX_Size() int { - return m.Size() -} -func (m *EventDefundPool) XXX_DiscardUnknown() { - xxx_messageInfo_EventDefundPool.DiscardUnknown(m) -} - -var xxx_messageInfo_EventDefundPool proto.InternalMessageInfo - -func (m *EventDefundPool) GetPoolId() uint64 { - if m != nil { - return m.PoolId - } - return 0 -} - -func (m *EventDefundPool) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -func (m *EventDefundPool) GetAmount() uint64 { - if m != nil { - return m.Amount - } - return 0 -} - // EventDefundPool is an event emitted when a pool is defunded. // emitted_by: MsgSubmitBundleProposal type EventPoolFundsSlashed struct { @@ -803,7 +673,7 @@ func (m *EventPoolFundsSlashed) Reset() { *m = EventPoolFundsSlashed{} } func (m *EventPoolFundsSlashed) String() string { return proto.CompactTextString(m) } func (*EventPoolFundsSlashed) ProtoMessage() {} func (*EventPoolFundsSlashed) Descriptor() ([]byte, []int) { - return fileDescriptor_c1828a100d789238, []int{9} + return fileDescriptor_c1828a100d789238, []int{7} } func (m *EventPoolFundsSlashed) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -864,7 +734,7 @@ func (m *EventPoolOutOfFunds) Reset() { *m = EventPoolOutOfFunds{} } func (m *EventPoolOutOfFunds) String() string { return proto.CompactTextString(m) } func (*EventPoolOutOfFunds) ProtoMessage() {} func (*EventPoolOutOfFunds) Descriptor() ([]byte, []int) { - return fileDescriptor_c1828a100d789238, []int{10} + return fileDescriptor_c1828a100d789238, []int{8} } func (m *EventPoolOutOfFunds) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -908,8 +778,6 @@ func init() { proto.RegisterType((*EventRuntimeUpgradeScheduled)(nil), "kyve.pool.v1beta1.EventRuntimeUpgradeScheduled") proto.RegisterType((*EventRuntimeUpgradeCancelled)(nil), "kyve.pool.v1beta1.EventRuntimeUpgradeCancelled") proto.RegisterType((*EventPoolUpdated)(nil), "kyve.pool.v1beta1.EventPoolUpdated") - proto.RegisterType((*EventFundPool)(nil), "kyve.pool.v1beta1.EventFundPool") - proto.RegisterType((*EventDefundPool)(nil), "kyve.pool.v1beta1.EventDefundPool") proto.RegisterType((*EventPoolFundsSlashed)(nil), "kyve.pool.v1beta1.EventPoolFundsSlashed") proto.RegisterType((*EventPoolOutOfFunds)(nil), "kyve.pool.v1beta1.EventPoolOutOfFunds") } @@ -917,57 +785,56 @@ func init() { func init() { proto.RegisterFile("kyve/pool/v1beta1/events.proto", fileDescriptor_c1828a100d789238) } var fileDescriptor_c1828a100d789238 = []byte{ - // 792 bytes of a gzipped FileDescriptorProto + // 769 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcd, 0x6e, 0xeb, 0x44, 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, 0x57, 0xee, 0x1e, 0xfa, 0x95, 0x3f, 0x1f, 0xfa, 0x95, 0x9f, 0xbf, 0x0c, + 0xa8, 0x5a, 0x26, 0x73, 0xd7, 0xe7, 0xd1, 0xe8, 0xec, 0xa7, 0x1f, 0x4f, 0x7f, 0x00, 0xb5, 0xe6, + 0xe2, 0x6a, 0xe4, 0x2f, 0x31, 0x65, 0xa3, 0xeb, 0xf4, 0x07, 0xa4, 0x36, 0x31, 0xc8, 0x79, 0xc3, + 0xfc, 0x78, 0xbe, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0x43, 0x39, 0xc6, 0x3f, 0xe3, 0x06, 0x00, + 0x00, } func (m *EventUpdateParams) Marshal() (dAtA []byte, err error) { @@ -1396,86 +1263,6 @@ func (m *EventPoolUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *EventFundPool) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventFundPool) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventFundPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Amount != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.Amount)) - i-- - dAtA[i] = 0x18 - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintEvents(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0x12 - } - if m.PoolId != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.PoolId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *EventDefundPool) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventDefundPool) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventDefundPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Amount != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.Amount)) - i-- - dAtA[i] = 0x18 - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintEvents(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0x12 - } - if m.PoolId != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.PoolId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - func (m *EventPoolFundsSlashed) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1758,44 +1545,6 @@ func (m *EventPoolUpdated) Size() (n int) { return n } -func (m *EventFundPool) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PoolId != 0 { - n += 1 + sovEvents(uint64(m.PoolId)) - } - l = len(m.Address) - if l > 0 { - n += 1 + l + sovEvents(uint64(l)) - } - if m.Amount != 0 { - n += 1 + sovEvents(uint64(m.Amount)) - } - return n -} - -func (m *EventDefundPool) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PoolId != 0 { - n += 1 + sovEvents(uint64(m.PoolId)) - } - l = len(m.Address) - if l > 0 { - n += 1 + l + sovEvents(uint64(l)) - } - if m.Amount != 0 { - n += 1 + sovEvents(uint64(m.Amount)) - } - return n -} - func (m *EventPoolFundsSlashed) Size() (n int) { if m == nil { return 0 @@ -3287,246 +3036,6 @@ func (m *EventPoolUpdated) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventFundPool) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventFundPool: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventFundPool: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) - } - m.PoolId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PoolId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvents - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvents - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - m.Amount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Amount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipEvents(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvents - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventDefundPool) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventDefundPool: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventDefundPool: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) - } - m.PoolId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PoolId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvents - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvents - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - m.Amount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Amount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipEvents(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvents - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *EventPoolFundsSlashed) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/pool/types/genesis.go b/x/pool/types/genesis.go index dff80bf7..a2838aec 100644 --- a/x/pool/types/genesis.go +++ b/x/pool/types/genesis.go @@ -1,6 +1,9 @@ package types -import "fmt" +import ( + "fmt" + fundersTypes "github.com/KYVENetwork/chain/x/funders/types" +) // DefaultGenesis returns the default Capability genesis state func DefaultGenesis() *GenesisState { @@ -24,7 +27,7 @@ func (gs GenesisState) Validate() error { if elem.Id >= gs.PoolCount { return fmt.Errorf("pool id higher than pool count %v", elem) } - if len(elem.Funders) > MaxFunders { + if len(elem.Funders) > fundersTypes.MaxFunders { return fmt.Errorf("more funders than allowed %v", elem) } } diff --git a/x/pool/types/keys.go b/x/pool/types/keys.go index 715bf985..4d44cd86 100644 --- a/x/pool/types/keys.go +++ b/x/pool/types/keys.go @@ -18,10 +18,6 @@ const ( MemStoreKey = "mem_pool" ) -const ( - MaxFunders = 50 // maximum amount of funders which are allowed -) - var ( // ParamsKey is the prefix for all module params defined in params.proto ParamsKey = []byte{0} diff --git a/x/pool/types/pool.pb.go b/x/pool/types/pool.pb.go index 27ae02e5..b2f697d5 100644 --- a/x/pool/types/pool.pb.go +++ b/x/pool/types/pool.pb.go @@ -209,62 +209,6 @@ func (m *UpgradePlan) GetDuration() uint64 { return 0 } -// Funder is the object which holds info about a single pool funder -type Funder struct { - // address is the address of the funder - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // amount is the current amount of funds in ukyve the funder has - // still funded the pool with - Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (m *Funder) Reset() { *m = Funder{} } -func (m *Funder) String() string { return proto.CompactTextString(m) } -func (*Funder) ProtoMessage() {} -func (*Funder) Descriptor() ([]byte, []int) { - return fileDescriptor_40c1730f47ff2ef8, []int{2} -} -func (m *Funder) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Funder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Funder.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Funder) XXX_Merge(src proto.Message) { - xxx_messageInfo_Funder.Merge(m, src) -} -func (m *Funder) XXX_Size() int { - return m.Size() -} -func (m *Funder) XXX_DiscardUnknown() { - xxx_messageInfo_Funder.DiscardUnknown(m) -} - -var xxx_messageInfo_Funder proto.InternalMessageInfo - -func (m *Funder) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -func (m *Funder) GetAmount() uint64 { - if m != nil { - return m.Amount - } - return 0 -} - // Pool ... type Pool struct { // id - unique identifier of the pool, can not be changed @@ -299,10 +243,6 @@ type Pool struct { // disabled is true when the pool is disabled. // Can only be done via governance. Disabled bool `protobuf:"varint,15,opt,name=disabled,proto3" json:"disabled,omitempty"` - // funders ... - Funders []*Funder `protobuf:"bytes,16,rep,name=funders,proto3" json:"funders,omitempty"` - // total_funds ... - TotalFunds uint64 `protobuf:"varint,17,opt,name=total_funds,json=totalFunds,proto3" json:"total_funds,omitempty"` // protocol ... Protocol *Protocol `protobuf:"bytes,18,opt,name=protocol,proto3" json:"protocol,omitempty"` // upgrade_plan ... @@ -317,7 +257,7 @@ func (m *Pool) Reset() { *m = Pool{} } func (m *Pool) String() string { return proto.CompactTextString(m) } func (*Pool) ProtoMessage() {} func (*Pool) Descriptor() ([]byte, []int) { - return fileDescriptor_40c1730f47ff2ef8, []int{3} + return fileDescriptor_40c1730f47ff2ef8, []int{2} } func (m *Pool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -451,20 +391,6 @@ func (m *Pool) GetDisabled() bool { return false } -func (m *Pool) GetFunders() []*Funder { - if m != nil { - return m.Funders - } - return nil -} - -func (m *Pool) GetTotalFunds() uint64 { - if m != nil { - return m.TotalFunds - } - return 0 -} - func (m *Pool) GetProtocol() *Protocol { if m != nil { return m.Protocol @@ -497,66 +423,61 @@ func init() { proto.RegisterEnum("kyve.pool.v1beta1.PoolStatus", PoolStatus_name, PoolStatus_value) proto.RegisterType((*Protocol)(nil), "kyve.pool.v1beta1.Protocol") proto.RegisterType((*UpgradePlan)(nil), "kyve.pool.v1beta1.UpgradePlan") - proto.RegisterType((*Funder)(nil), "kyve.pool.v1beta1.Funder") proto.RegisterType((*Pool)(nil), "kyve.pool.v1beta1.Pool") } func init() { proto.RegisterFile("kyve/pool/v1beta1/pool.proto", fileDescriptor_40c1730f47ff2ef8) } var fileDescriptor_40c1730f47ff2ef8 = []byte{ - // 818 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x41, 0x6f, 0xdb, 0x36, - 0x14, 0xc7, 0xad, 0xc4, 0x75, 0x6c, 0x3a, 0x71, 0x5c, 0x2e, 0xcd, 0xd8, 0x64, 0xf0, 0xdc, 0x0c, - 0xdd, 0xbc, 0x1d, 0x6c, 0xb4, 0x1d, 0x30, 0x60, 0xc0, 0x0e, 0x8e, 0xed, 0x64, 0x42, 0x03, 0xdb, - 0x90, 0xed, 0x02, 0xdb, 0x45, 0xa0, 0x45, 0x56, 0x21, 0x22, 0x91, 0x02, 0x49, 0x79, 0x71, 0x8f, - 0x3b, 0xed, 0xb8, 0xef, 0xd0, 0xcf, 0xb1, 0xfb, 0x8e, 0x3d, 0xee, 0x38, 0x24, 0x5f, 0x64, 0x20, - 0x25, 0x79, 0xee, 0xd6, 0x53, 0x6f, 0x7c, 0xbf, 0xff, 0xff, 0xe9, 0x3d, 0xf3, 0xf1, 0x19, 0x7c, - 0x76, 0xb3, 0x5e, 0xd1, 0x5e, 0x22, 0x44, 0xd4, 0x5b, 0x3d, 0x5b, 0x52, 0x8d, 0x9f, 0xd9, 0xa0, - 0x9b, 0x48, 0xa1, 0x05, 0x7c, 0x68, 0xd4, 0xae, 0x05, 0xb9, 0x7a, 0x72, 0x14, 0x8a, 0x50, 0x58, - 0xb5, 0x67, 0x4e, 0x99, 0xf1, 0x2c, 0x00, 0xd5, 0xa9, 0x39, 0x04, 0x22, 0x82, 0x08, 0xec, 0xad, - 0xa8, 0x54, 0x4c, 0x70, 0xe4, 0xb4, 0x9d, 0x4e, 0xcd, 0x2b, 0x42, 0x78, 0x02, 0xaa, 0x4b, 0xc6, - 0xb1, 0x64, 0x54, 0xa1, 0x1d, 0x2b, 0x6d, 0x62, 0xf8, 0x04, 0xec, 0x47, 0x58, 0x69, 0x3f, 0x4d, - 0x42, 0x89, 0x09, 0x45, 0xbb, 0x6d, 0xa7, 0x53, 0xf6, 0xea, 0x86, 0x2d, 0x32, 0x74, 0xf6, 0xab, - 0x03, 0xea, 0xf9, 0x79, 0x1a, 0x61, 0xfe, 0xf1, 0x85, 0x54, 0x70, 0x4d, 0x49, 0x1a, 0x51, 0xe2, - 0x63, 0x5d, 0x14, 0xda, 0xb0, 0xbe, 0x36, 0xe9, 0x24, 0x95, 0x58, 0x9b, 0x2f, 0x97, 0xad, 0xbc, - 0x89, 0xcf, 0xbe, 0x07, 0x95, 0x8b, 0x94, 0x13, 0x2a, 0x4d, 0x79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, 0x9f, 0x5e, 0x8d, 0xc6, 0x54, 0xff, - 0x22, 0xe4, 0x4d, 0x2f, 0xb8, 0xc6, 0x8c, 0xf7, 0x6e, 0xb3, 0xbf, 0x61, 0xbd, 0x4e, 0xa8, 0x5a, - 0x56, 0xec, 0x18, 0x5f, 0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0xec, 0x2d, 0x4a, 0x94, 0xa0, 0x05, - 0x00, 0x00, + // 763 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xcf, 0x73, 0xe3, 0x34, + 0x14, 0xc7, 0xe3, 0xae, 0xdb, 0x4d, 0x94, 0x36, 0x75, 0x45, 0xb7, 0x88, 0x96, 0x09, 0xd9, 0x32, + 0x0b, 0x81, 0x43, 0x32, 0x0b, 0xcc, 0x70, 0xe2, 0x90, 0x26, 0xde, 0xe2, 0xdd, 0x4e, 0x92, 0xb1, + 0x93, 0x9d, 0x81, 0x8b, 0x46, 0xb1, 0x85, 0xab, 0xa9, 0x6d, 0x79, 0x64, 0x39, 0x34, 0x7b, 0xe4, + 0xc4, 0x91, 0xff, 0x81, 0xbf, 0x83, 0x3b, 0xc7, 0x3d, 0xc2, 0x8d, 0x69, 0xff, 0x11, 0x46, 0xf2, + 0x0f, 0x52, 0xe0, 0xb4, 0xb7, 0xf7, 0x3e, 0xdf, 0xef, 0xf3, 0x93, 0xf2, 0x9e, 0x02, 0x3e, 0xbc, + 0xd9, 0xac, 0xe9, 0x30, 0xe5, 0x3c, 0x1a, 0xae, 0x9f, 0xaf, 0xa8, 0x24, 0xcf, 0x75, 0x32, 0x48, + 0x05, 0x97, 0x1c, 0x1e, 0x29, 0x75, 0xa0, 0x41, 0xa9, 0x9e, 0x1e, 0x87, 0x3c, 0xe4, 0x5a, 0x1d, + 0xaa, 0xa8, 0x30, 0x9e, 0xfb, 0xa0, 0x39, 0x57, 0x81, 0xcf, 0x23, 0x88, 0xc0, 0xe3, 0x35, 0x15, + 0x19, 0xe3, 0x09, 0x32, 0x7a, 0x46, 0xbf, 0xe5, 0x56, 0x29, 0x3c, 0x05, 0xcd, 0x15, 0x4b, 0x88, + 0x60, 0x34, 0x43, 0x3b, 0x5a, 0xaa, 0x73, 0xf8, 0x14, 0xec, 0x47, 0x24, 0x93, 0x38, 0x4f, 0x43, + 0x41, 0x02, 0x8a, 0x1e, 0xf5, 0x8c, 0xbe, 0xe9, 0xb6, 0x15, 0x5b, 0x16, 0xe8, 0xfc, 0x27, 0x03, + 0xb4, 0xcb, 0x78, 0x1e, 0x91, 0xe4, 0xdd, 0x1b, 0x65, 0xfe, 0x35, 0x0d, 0xf2, 0x88, 0x06, 0x98, + 0xc8, 0xaa, 0x51, 0xcd, 0x46, 0x52, 0x95, 0x07, 0xb9, 0x20, 0x52, 0x7d, 0xd9, 0xd4, 0x72, 0x9d, + 0x9f, 0xff, 0xb9, 0x0b, 0xcc, 0x39, 0xe7, 0x11, 0xec, 0x80, 0x1d, 0x16, 0xe8, 0xc6, 0xa6, 0xbb, + 0xc3, 0x02, 0x08, 0x81, 0x99, 0x90, 0x98, 0x96, 0xfd, 0x74, 0xac, 0x4e, 0x28, 0xf2, 0x44, 0xb2, + 0xb8, 0xb8, 0x4f, 0xcb, 0xad, 0x52, 0xe5, 0x8e, 0x78, 0xc8, 0xf5, 0xe7, 0x5b, 0xae, 0x8e, 0xe1, + 0x09, 0xd8, 0xf3, 0x79, 0xf2, 0x03, 0x0b, 0xd1, 0xae, 0xa6, 0x65, 0x06, 0xcf, 0x40, 0x2b, 0x93, + 0x44, 0x48, 0x7c, 0x43, 0x37, 0x68, 0xaf, 0xb8, 0x8e, 0x06, 0xaf, 0xe8, 0x06, 0x7e, 0x04, 0xda, + 0x7e, 0x2e, 0x04, 0x4d, 0x0a, 0xf9, 0xb1, 0x96, 0x41, 0x89, 0x94, 0xe1, 0x53, 0x70, 0x58, 0x19, + 0xb2, 0x3c, 0x8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 0x7f, + 0xbf, 0xeb, 0x1a, 0x6f, 0xef, 0xba, 0xc6, 0x5f, 0x77, 0x5d, 0xe3, 0x97, 0xfb, 0x6e, 0xe3, 0xed, + 0x7d, 0xb7, 0xf1, 0xc7, 0x7d, 0xb7, 0xf1, 0xfd, 0x67, 0x21, 0x93, 0xd7, 0xf9, 0x6a, 0xe0, 0xf3, + 0x78, 0xf8, 0xea, 0xbb, 0xd7, 0xf6, 0x94, 0xca, 0x1f, 0xb9, 0xb8, 0x19, 0xfa, 0xd7, 0x84, 0x25, + 0xc3, 0xdb, 0xe2, 0x0f, 0x50, 0x6e, 0x52, 0x9a, 0xad, 0xf6, 0xf4, 0x48, 0xbf, 0xfc, 0x3b, 0x00, + 0x00, 0xff, 0xff, 0x79, 0x2e, 0x04, 0x09, 0x1a, 0x05, 0x00, 0x00, } func (m *Protocol) Marshal() (dAtA []byte, err error) { @@ -648,41 +569,6 @@ func (m *UpgradePlan) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Funder) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Funder) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Funder) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Amount != 0 { - i = encodeVarintPool(dAtA, i, uint64(m.Amount)) - i-- - dAtA[i] = 0x10 - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintPool(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *Pool) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -745,29 +631,6 @@ func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x92 } - if m.TotalFunds != 0 { - i = encodeVarintPool(dAtA, i, uint64(m.TotalFunds)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x88 - } - if len(m.Funders) > 0 { - for iNdEx := len(m.Funders) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Funders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintPool(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x82 - } - } if m.Disabled { i-- if m.Disabled { @@ -919,22 +782,6 @@ func (m *UpgradePlan) Size() (n int) { return n } -func (m *Funder) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovPool(uint64(l)) - } - if m.Amount != 0 { - n += 1 + sovPool(uint64(m.Amount)) - } - return n -} - func (m *Pool) Size() (n int) { if m == nil { return 0 @@ -993,15 +840,6 @@ func (m *Pool) Size() (n int) { if m.Disabled { n += 2 } - if len(m.Funders) > 0 { - for _, e := range m.Funders { - l = e.Size() - n += 2 + l + sovPool(uint64(l)) - } - } - if m.TotalFunds != 0 { - n += 2 + sovPool(uint64(m.TotalFunds)) - } if m.Protocol != nil { l = m.Protocol.Size() n += 2 + l + sovPool(uint64(l)) @@ -1310,107 +1148,6 @@ func (m *UpgradePlan) Unmarshal(dAtA []byte) error { } return nil } -func (m *Funder) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Funder: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Funder: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPool - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPool - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - m.Amount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Amount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipPool(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPool - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *Pool) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1817,59 +1554,6 @@ func (m *Pool) Unmarshal(dAtA []byte) error { } } m.Disabled = bool(v != 0) - case 16: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Funders", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPool - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPool - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Funders = append(m.Funders, &Funder{}) - if err := m.Funders[len(m.Funders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 17: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalFunds", wireType) - } - m.TotalFunds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalFunds |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } case 18: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) diff --git a/x/pool/types/tx.pb.go b/x/pool/types/tx.pb.go index 9b045244..0998dfd0 100644 --- a/x/pool/types/tx.pb.go +++ b/x/pool/types/tx.pb.go @@ -28,208 +28,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgFundPool defines a SDK message for funding a pool. -type MsgFundPool struct { - // creator ... - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - // id ... - Id uint64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` - // amount ... - Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (m *MsgFundPool) Reset() { *m = MsgFundPool{} } -func (m *MsgFundPool) String() string { return proto.CompactTextString(m) } -func (*MsgFundPool) ProtoMessage() {} -func (*MsgFundPool) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{0} -} -func (m *MsgFundPool) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgFundPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgFundPool.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgFundPool) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgFundPool.Merge(m, src) -} -func (m *MsgFundPool) XXX_Size() int { - return m.Size() -} -func (m *MsgFundPool) XXX_DiscardUnknown() { - xxx_messageInfo_MsgFundPool.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgFundPool proto.InternalMessageInfo - -func (m *MsgFundPool) GetCreator() string { - if m != nil { - return m.Creator - } - return "" -} - -func (m *MsgFundPool) GetId() uint64 { - if m != nil { - return m.Id - } - return 0 -} - -func (m *MsgFundPool) GetAmount() uint64 { - if m != nil { - return m.Amount - } - return 0 -} - -// MsgFundPoolResponse defines the Msg/DefundPool response type. -type MsgFundPoolResponse struct { -} - -func (m *MsgFundPoolResponse) Reset() { *m = MsgFundPoolResponse{} } -func (m *MsgFundPoolResponse) String() string { return proto.CompactTextString(m) } -func (*MsgFundPoolResponse) ProtoMessage() {} -func (*MsgFundPoolResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{1} -} -func (m *MsgFundPoolResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgFundPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgFundPoolResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgFundPoolResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgFundPoolResponse.Merge(m, src) -} -func (m *MsgFundPoolResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgFundPoolResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgFundPoolResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgFundPoolResponse proto.InternalMessageInfo - -// MsgDefundPool defines a SDK message for defunding a pool. -type MsgDefundPool struct { - // creator ... - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - // id ... - Id uint64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` - // amount ... - Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (m *MsgDefundPool) Reset() { *m = MsgDefundPool{} } -func (m *MsgDefundPool) String() string { return proto.CompactTextString(m) } -func (*MsgDefundPool) ProtoMessage() {} -func (*MsgDefundPool) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{2} -} -func (m *MsgDefundPool) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDefundPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDefundPool.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgDefundPool) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDefundPool.Merge(m, src) -} -func (m *MsgDefundPool) XXX_Size() int { - return m.Size() -} -func (m *MsgDefundPool) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDefundPool.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDefundPool proto.InternalMessageInfo - -func (m *MsgDefundPool) GetCreator() string { - if m != nil { - return m.Creator - } - return "" -} - -func (m *MsgDefundPool) GetId() uint64 { - if m != nil { - return m.Id - } - return 0 -} - -func (m *MsgDefundPool) GetAmount() uint64 { - if m != nil { - return m.Amount - } - return 0 -} - -// MsgDefundPoolResponse defines the Msg/DefundPool response type. -type MsgDefundPoolResponse struct { -} - -func (m *MsgDefundPoolResponse) Reset() { *m = MsgDefundPoolResponse{} } -func (m *MsgDefundPoolResponse) String() string { return proto.CompactTextString(m) } -func (*MsgDefundPoolResponse) ProtoMessage() {} -func (*MsgDefundPoolResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{3} -} -func (m *MsgDefundPoolResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDefundPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDefundPoolResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgDefundPoolResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDefundPoolResponse.Merge(m, src) -} -func (m *MsgDefundPoolResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgDefundPoolResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDefundPoolResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDefundPoolResponse proto.InternalMessageInfo - // MsgCreatePool defines a SDK message for creating a new pool. type MsgCreatePool struct { // authority is the address of the governance account. @@ -266,7 +64,7 @@ func (m *MsgCreatePool) Reset() { *m = MsgCreatePool{} } func (m *MsgCreatePool) String() string { return proto.CompactTextString(m) } func (*MsgCreatePool) ProtoMessage() {} func (*MsgCreatePool) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{4} + return fileDescriptor_20ddefdf83388ddc, []int{0} } func (m *MsgCreatePool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -401,7 +199,7 @@ func (m *MsgCreatePoolResponse) Reset() { *m = MsgCreatePoolResponse{} } func (m *MsgCreatePoolResponse) String() string { return proto.CompactTextString(m) } func (*MsgCreatePoolResponse) ProtoMessage() {} func (*MsgCreatePoolResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{5} + return fileDescriptor_20ddefdf83388ddc, []int{1} } func (m *MsgCreatePoolResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -444,7 +242,7 @@ func (m *MsgUpdatePool) Reset() { *m = MsgUpdatePool{} } func (m *MsgUpdatePool) String() string { return proto.CompactTextString(m) } func (*MsgUpdatePool) ProtoMessage() {} func (*MsgUpdatePool) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{6} + return fileDescriptor_20ddefdf83388ddc, []int{2} } func (m *MsgUpdatePool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -502,7 +300,7 @@ func (m *MsgUpdatePoolResponse) Reset() { *m = MsgUpdatePoolResponse{} } func (m *MsgUpdatePoolResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdatePoolResponse) ProtoMessage() {} func (*MsgUpdatePoolResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{7} + return fileDescriptor_20ddefdf83388ddc, []int{3} } func (m *MsgUpdatePoolResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -543,7 +341,7 @@ func (m *MsgDisablePool) Reset() { *m = MsgDisablePool{} } func (m *MsgDisablePool) String() string { return proto.CompactTextString(m) } func (*MsgDisablePool) ProtoMessage() {} func (*MsgDisablePool) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{8} + return fileDescriptor_20ddefdf83388ddc, []int{4} } func (m *MsgDisablePool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -594,7 +392,7 @@ func (m *MsgDisablePoolResponse) Reset() { *m = MsgDisablePoolResponse{} func (m *MsgDisablePoolResponse) String() string { return proto.CompactTextString(m) } func (*MsgDisablePoolResponse) ProtoMessage() {} func (*MsgDisablePoolResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{9} + return fileDescriptor_20ddefdf83388ddc, []int{5} } func (m *MsgDisablePoolResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -635,7 +433,7 @@ func (m *MsgEnablePool) Reset() { *m = MsgEnablePool{} } func (m *MsgEnablePool) String() string { return proto.CompactTextString(m) } func (*MsgEnablePool) ProtoMessage() {} func (*MsgEnablePool) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{10} + return fileDescriptor_20ddefdf83388ddc, []int{6} } func (m *MsgEnablePool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -686,7 +484,7 @@ func (m *MsgEnablePoolResponse) Reset() { *m = MsgEnablePoolResponse{} } func (m *MsgEnablePoolResponse) String() string { return proto.CompactTextString(m) } func (*MsgEnablePoolResponse) ProtoMessage() {} func (*MsgEnablePoolResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{11} + return fileDescriptor_20ddefdf83388ddc, []int{7} } func (m *MsgEnablePoolResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -735,7 +533,7 @@ func (m *MsgScheduleRuntimeUpgrade) Reset() { *m = MsgScheduleRuntimeUpg func (m *MsgScheduleRuntimeUpgrade) String() string { return proto.CompactTextString(m) } func (*MsgScheduleRuntimeUpgrade) ProtoMessage() {} func (*MsgScheduleRuntimeUpgrade) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{12} + return fileDescriptor_20ddefdf83388ddc, []int{8} } func (m *MsgScheduleRuntimeUpgrade) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -814,7 +612,7 @@ func (m *MsgScheduleRuntimeUpgradeResponse) Reset() { *m = MsgScheduleRu func (m *MsgScheduleRuntimeUpgradeResponse) String() string { return proto.CompactTextString(m) } func (*MsgScheduleRuntimeUpgradeResponse) ProtoMessage() {} func (*MsgScheduleRuntimeUpgradeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{13} + return fileDescriptor_20ddefdf83388ddc, []int{9} } func (m *MsgScheduleRuntimeUpgradeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -855,7 +653,7 @@ func (m *MsgCancelRuntimeUpgrade) Reset() { *m = MsgCancelRuntimeUpgrade func (m *MsgCancelRuntimeUpgrade) String() string { return proto.CompactTextString(m) } func (*MsgCancelRuntimeUpgrade) ProtoMessage() {} func (*MsgCancelRuntimeUpgrade) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{14} + return fileDescriptor_20ddefdf83388ddc, []int{10} } func (m *MsgCancelRuntimeUpgrade) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -906,7 +704,7 @@ func (m *MsgCancelRuntimeUpgradeResponse) Reset() { *m = MsgCancelRuntim func (m *MsgCancelRuntimeUpgradeResponse) String() string { return proto.CompactTextString(m) } func (*MsgCancelRuntimeUpgradeResponse) ProtoMessage() {} func (*MsgCancelRuntimeUpgradeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{15} + return fileDescriptor_20ddefdf83388ddc, []int{11} } func (m *MsgCancelRuntimeUpgradeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -947,7 +745,7 @@ func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{16} + return fileDescriptor_20ddefdf83388ddc, []int{12} } func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -998,7 +796,7 @@ func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_20ddefdf83388ddc, []int{17} + return fileDescriptor_20ddefdf83388ddc, []int{13} } func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1028,10 +826,6 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgFundPool)(nil), "kyve.pool.v1beta1.MsgFundPool") - proto.RegisterType((*MsgFundPoolResponse)(nil), "kyve.pool.v1beta1.MsgFundPoolResponse") - proto.RegisterType((*MsgDefundPool)(nil), "kyve.pool.v1beta1.MsgDefundPool") - proto.RegisterType((*MsgDefundPoolResponse)(nil), "kyve.pool.v1beta1.MsgDefundPoolResponse") proto.RegisterType((*MsgCreatePool)(nil), "kyve.pool.v1beta1.MsgCreatePool") proto.RegisterType((*MsgCreatePoolResponse)(nil), "kyve.pool.v1beta1.MsgCreatePoolResponse") proto.RegisterType((*MsgUpdatePool)(nil), "kyve.pool.v1beta1.MsgUpdatePool") @@ -1051,63 +845,57 @@ func init() { func init() { proto.RegisterFile("kyve/pool/v1beta1/tx.proto", fileDescriptor_20ddefdf83388ddc) } var fileDescriptor_20ddefdf83388ddc = []byte{ - // 881 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xd1, 0x6e, 0x1b, 0x45, - 0x14, 0x8d, 0x9d, 0xd4, 0x89, 0x6f, 0x62, 0x47, 0xdd, 0xb6, 0xe9, 0x64, 0x91, 0x4c, 0x62, 0x44, - 0x49, 0x2b, 0xb0, 0xd5, 0x82, 0x78, 0x6f, 0xd2, 0x22, 0x45, 0x55, 0xa0, 0x6c, 0x54, 0x28, 0x20, - 0xb1, 0x1a, 0xef, 0x4c, 0x37, 0xa3, 0xec, 0xce, 0x2c, 0x33, 0xb3, 0x26, 0xae, 0xf8, 0x08, 0x3e, - 0x86, 0x8f, 0xe0, 0xb1, 0xe2, 0x89, 0x47, 0x94, 0xbc, 0xf1, 0xcc, 0x07, 0xa0, 0x99, 0x5d, 0xef, - 0xae, 0xb1, 0xb7, 0x01, 0x9a, 0xb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 0x3f, - 0x5f, 0xf4, 0x96, 0x5e, 0x5d, 0xf4, 0x96, 0x7e, 0xbf, 0xe8, 0x2d, 0x7d, 0x7b, 0x37, 0x64, 0xfa, - 0x24, 0x1d, 0x0d, 0x02, 0x11, 0x0f, 0x9f, 0x7c, 0xf3, 0xd5, 0xe3, 0xcf, 0xa9, 0xfe, 0x51, 0xc8, - 0xd3, 0x61, 0x70, 0x82, 0x19, 0x1f, 0x9e, 0x65, 0x9f, 0x96, 0x7a, 0x92, 0x50, 0x35, 0x6a, 0xd9, - 0x0f, 0xc5, 0x8f, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x68, 0x62, 0xc8, 0xb4, 0x74, 0x0a, 0x00, - 0x00, + // 795 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x6e, 0xeb, 0x44, + 0x14, 0xae, 0x93, 0x34, 0xb7, 0x99, 0x36, 0xa9, 0xae, 0xb9, 0xf4, 0xba, 0x46, 0x0a, 0x49, 0x10, + 0x90, 0x7b, 0x05, 0x89, 0x6e, 0x41, 0xec, 0xfb, 0xb7, 0xa8, 0xaa, 0xa0, 0xca, 0x55, 0xa1, 0x80, + 0x84, 0x35, 0xf1, 0x0c, 0xce, 0x28, 0xf6, 0x8c, 0x99, 0x99, 0x84, 0xa4, 0xe2, 0x21, 0x78, 0x18, + 0x9e, 0x01, 0xb1, 0xac, 0x58, 0xb1, 0x44, 0xe9, 0x8e, 0xa7, 0x40, 0x33, 0x76, 0x1c, 0x5b, 0x8d, + 0x29, 0xd0, 0xb2, 0xf3, 0x39, 0xe7, 0xf3, 0xf9, 0xce, 0xcc, 0xf9, 0x3e, 0xcb, 0xc0, 0x1e, 0xcf, + 0xa7, 0xb8, 0x1f, 0x31, 0x16, 0xf4, 0xa7, 0x6f, 0x86, 0x58, 0xc2, 0x37, 0x7d, 0x39, 0xeb, 0x45, + 0x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1, 0x57, 0x88, 0xa2, 0xb1, 0xef, 0x9b, 0xd1, 0xfc, 0x11, 0xec, 0x15, 0x18, 0xf1, + 0xa3, 0xf5, 0x3d, 0xd6, 0xa3, 0xed, 0x4f, 0xff, 0x0d, 0x3a, 0x65, 0x9f, 0x82, 0x17, 0x6b, 0xd5, + 0xff, 0xba, 0x60, 0xa1, 0x6b, 0xb0, 0xf6, 0xc1, 0x3f, 0xc7, 0xa6, 0xbc, 0xdf, 0x82, 0x9d, 0x9c, + 0xca, 0x3b, 0x7f, 0xbb, 0x66, 0x8d, 0xb1, 0x5f, 0x3f, 0x8c, 0x59, 0xf6, 0x3f, 0x3a, 0xfe, 0x75, + 0xd1, 0x34, 0x6e, 0x17, 0x4d, 0xe3, 0x8f, 0x45, 0xd3, 0xf8, 0xe9, 0xae, 0xb9, 0x71, 0x7b, 0xd7, + 0xdc, 0xf8, 0xfd, 0xae, 0xb9, 0xf1, 0xf5, 0x2b, 0x9f, 0xc8, 0xd1, 0x64, 0xd8, 0xf3, 0x58, 0xd8, + 0x3f, 0xff, 0xea, 0x8b, 0xd3, 0xcf, 0xb1, 0xfc, 0x81, 0xf1, 0x71, 0xdf, 0x1b, 0x41, 0x42, 0xfb, + 0xb3, 0xf8, 0xc7, 0x46, 0xce, 0x23, 0x2c, 0x86, 0x55, 0xfd, 0x9b, 0xf2, 0xc9, 0x5f, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x36, 0x93, 0x55, 0x3a, 0xf2, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1122,10 +910,6 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - // FundPool ... - FundPool(ctx context.Context, in *MsgFundPool, opts ...grpc.CallOption) (*MsgFundPoolResponse, error) - // DefundPool ... - DefundPool(ctx context.Context, in *MsgDefundPool, opts ...grpc.CallOption) (*MsgDefundPoolResponse, error) // CreatePool defines a governance operation for creating a new pool. // The authority is hard-coded to the x/gov module account. CreatePool(ctx context.Context, in *MsgCreatePool, opts ...grpc.CallOption) (*MsgCreatePoolResponse, error) @@ -1157,24 +941,6 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) FundPool(ctx context.Context, in *MsgFundPool, opts ...grpc.CallOption) (*MsgFundPoolResponse, error) { - out := new(MsgFundPoolResponse) - err := c.cc.Invoke(ctx, "/kyve.pool.v1beta1.Msg/FundPool", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) DefundPool(ctx context.Context, in *MsgDefundPool, opts ...grpc.CallOption) (*MsgDefundPoolResponse, error) { - out := new(MsgDefundPoolResponse) - err := c.cc.Invoke(ctx, "/kyve.pool.v1beta1.Msg/DefundPool", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *msgClient) CreatePool(ctx context.Context, in *MsgCreatePool, opts ...grpc.CallOption) (*MsgCreatePoolResponse, error) { out := new(MsgCreatePoolResponse) err := c.cc.Invoke(ctx, "/kyve.pool.v1beta1.Msg/CreatePool", in, out, opts...) @@ -1240,10 +1006,6 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts // MsgServer is the server API for Msg service. type MsgServer interface { - // FundPool ... - FundPool(context.Context, *MsgFundPool) (*MsgFundPoolResponse, error) - // DefundPool ... - DefundPool(context.Context, *MsgDefundPool) (*MsgDefundPoolResponse, error) // CreatePool defines a governance operation for creating a new pool. // The authority is hard-coded to the x/gov module account. CreatePool(context.Context, *MsgCreatePool) (*MsgCreatePoolResponse, error) @@ -1271,12 +1033,6 @@ type MsgServer interface { type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) FundPool(ctx context.Context, req *MsgFundPool) (*MsgFundPoolResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FundPool not implemented") -} -func (*UnimplementedMsgServer) DefundPool(ctx context.Context, req *MsgDefundPool) (*MsgDefundPoolResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DefundPool not implemented") -} func (*UnimplementedMsgServer) CreatePool(ctx context.Context, req *MsgCreatePool) (*MsgCreatePoolResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreatePool not implemented") } @@ -1303,42 +1059,6 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_FundPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgFundPool) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).FundPool(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/kyve.pool.v1beta1.Msg/FundPool", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).FundPool(ctx, req.(*MsgFundPool)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_DefundPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDefundPool) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).DefundPool(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/kyve.pool.v1beta1.Msg/DefundPool", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).DefundPool(ctx, req.(*MsgDefundPool)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_CreatePool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgCreatePool) if err := dec(in); err != nil { @@ -1469,14 +1189,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kyve.pool.v1beta1.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "FundPool", - Handler: _Msg_FundPool_Handler, - }, - { - MethodName: "DefundPool", - Handler: _Msg_DefundPool_Handler, - }, { MethodName: "CreatePool", Handler: _Msg_CreatePool_Handler, @@ -1510,7 +1222,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "kyve/pool/v1beta1/tx.proto", } -func (m *MsgFundPool) Marshal() (dAtA []byte, err error) { +func (m *MsgCreatePool) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1520,165 +1232,39 @@ func (m *MsgFundPool) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgFundPool) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgCreatePool) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgFundPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgCreatePool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Amount != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Amount)) + if m.CompressionId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.CompressionId)) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x70 } - if m.Id != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Id)) + if m.StorageProviderId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.StorageProviderId)) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x68 } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + if len(m.Binaries) > 0 { + i -= len(m.Binaries) + copy(dAtA[i:], m.Binaries) + i = encodeVarintTx(dAtA, i, uint64(len(m.Binaries))) i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgFundPoolResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgFundPoolResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgFundPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgDefundPool) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + dAtA[i] = 0x62 } - return dAtA[:n], nil -} - -func (m *MsgDefundPool) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDefundPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Amount != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Amount)) + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintTx(dAtA, i, uint64(len(m.Version))) i-- - dAtA[i] = 0x18 - } - if m.Id != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Id)) - i-- - dAtA[i] = 0x10 - } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgDefundPoolResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgDefundPoolResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDefundPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgCreatePool) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgCreatePool) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreatePool) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.CompressionId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.CompressionId)) - i-- - dAtA[i] = 0x70 - } - if m.StorageProviderId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.StorageProviderId)) - i-- - dAtA[i] = 0x68 - } - if len(m.Binaries) > 0 { - i -= len(m.Binaries) - copy(dAtA[i:], m.Binaries) - i = encodeVarintTx(dAtA, i, uint64(len(m.Binaries))) - i-- - dAtA[i] = 0x62 - } - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarintTx(dAtA, i, uint64(len(m.Version))) - i-- - dAtA[i] = 0x5a + dAtA[i] = 0x5a } if m.MaxBundleSize != 0 { i = encodeVarintTx(dAtA, i, uint64(m.MaxBundleSize)) @@ -2164,62 +1750,6 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgFundPool) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Id != 0 { - n += 1 + sovTx(uint64(m.Id)) - } - if m.Amount != 0 { - n += 1 + sovTx(uint64(m.Amount)) - } - return n -} - -func (m *MsgFundPoolResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgDefundPool) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Id != 0 { - n += 1 + sovTx(uint64(m.Id)) - } - if m.Amount != 0 { - n += 1 + sovTx(uint64(m.Amount)) - } - return n -} - -func (m *MsgDefundPoolResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *MsgCreatePool) Size() (n int) { if m == nil { return 0 @@ -2465,346 +1995,6 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgFundPool) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgFundPool: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgFundPool: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Creator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - m.Amount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Amount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgFundPoolResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgFundPoolResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgFundPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDefundPool) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgDefundPool: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDefundPool: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Creator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - m.Amount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Amount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDefundPoolResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgDefundPoolResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDefundPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *MsgCreatePool) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From b7400de939d51fdeaaa286745b8c325870f77b23 Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 25 Sep 2023 13:12:29 +0200 Subject: [PATCH 018/109] feat: implement DefundPool --- proto/kyve/funders/v1beta1/events.proto | 8 +- proto/kyve/funders/v1beta1/funders.proto | 6 +- proto/kyve/funders/v1beta1/tx.proto | 8 +- x/funders/keeper/keeper.go | 6 +- x/funders/keeper/logic_funders.go | 2 +- x/funders/keeper/msg_server_create_funder.go | 29 +++--- x/funders/keeper/msg_server_defund_pool.go | 44 +++++--- x/funders/keeper/msg_server_fund_pool.go | 8 +- x/funders/types/errors.go | 2 + x/funders/types/events.pb.go | 92 ++++++++-------- x/funders/types/funders.go | 4 +- x/funders/types/funders.pb.go | 81 ++++++++------- x/funders/types/tx.pb.go | 104 +++++++++---------- 13 files changed, 206 insertions(+), 188 deletions(-) diff --git a/proto/kyve/funders/v1beta1/events.proto b/proto/kyve/funders/v1beta1/events.proto index b461528a..7e09b5c6 100644 --- a/proto/kyve/funders/v1beta1/events.proto +++ b/proto/kyve/funders/v1beta1/events.proto @@ -22,8 +22,8 @@ message EventCreateFunder { string website = 5; // contact ... string contact = 6; - // details are some additional notes the funder finds important - string details = 7; + // description are some additional notes the funder finds important + string description = 7; } // EventUpdateFunder is an event emitted when a funder is created. @@ -41,8 +41,8 @@ message EventUpdateFunder { string website = 5; // contact ... string contact = 6; - // details are some additional notes the funder finds important - string details = 7; + // description are some additional notes the funder finds important + string description = 7; } // EventFundPool is an event emitted when a pool is funded. diff --git a/proto/kyve/funders/v1beta1/funders.proto b/proto/kyve/funders/v1beta1/funders.proto index 1273a5fa..2f8aa898 100644 --- a/proto/kyve/funders/v1beta1/funders.proto +++ b/proto/kyve/funders/v1beta1/funders.proto @@ -20,8 +20,8 @@ message Funder { string website = 5; // contact ... string contact = 6; - // details are some additional notes the funder finds important - string details = 7; + // description are some additional notes the funder finds important + string description = 7; } // Funding is the object which holds info about the current funding @@ -41,7 +41,7 @@ message Funding { uint64 total_funded = 5; } -// FundingState is the object which holds info about the funding state +// FundingState is the object which holds info about the funding state of a pool message FundingState { // pool_id is the id of the pool this funding is for uint64 pool_id = 1; diff --git a/proto/kyve/funders/v1beta1/tx.proto b/proto/kyve/funders/v1beta1/tx.proto index 598ea7e2..e94cc802 100644 --- a/proto/kyve/funders/v1beta1/tx.proto +++ b/proto/kyve/funders/v1beta1/tx.proto @@ -30,8 +30,8 @@ message MsgCreateFunder { string website = 5; // contact string contact = 6; - // details are some additional notes the funder finds important - string details = 7; + // description are some additional notes the funder finds important + string description = 7; } // MsgCreateFunderResponse defines the Msg/CreateFunder response type. @@ -51,8 +51,8 @@ message MsgUpdateFunder { string website = 5; // contact string contact = 6; - // details are some additional notes the funder finds important - string details = 7; + // description are some additional notes the funder finds important + string description = 7; } // MsgUpdateFunderResponse defines the Msg/UpdateFunder response type. diff --git a/x/funders/keeper/keeper.go b/x/funders/keeper/keeper.go index 13a79bec..50e898c2 100644 --- a/x/funders/keeper/keeper.go +++ b/x/funders/keeper/keeper.go @@ -20,7 +20,7 @@ type ( authority string bankKeeper util.BankKeeper - pookKeeper types.PoolKeeper + poolKeeper types.PoolKeeper upgradeKeeper util.UpgradeKeeper } ) @@ -33,7 +33,7 @@ func NewKeeper( authority string, bankKeeper util.BankKeeper, - pookKeeper types.PoolKeeper, + poolKeeper types.PoolKeeper, upgradeKeeper util.UpgradeKeeper, ) *Keeper { return &Keeper{ @@ -44,7 +44,7 @@ func NewKeeper( authority: authority, bankKeeper: bankKeeper, - pookKeeper: pookKeeper, + poolKeeper: poolKeeper, upgradeKeeper: upgradeKeeper, } } diff --git a/x/funders/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go index ac740bbd..7e3adf5f 100644 --- a/x/funders/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -12,7 +12,7 @@ import ( // This method does not transfer any funds. The bundles-module // is responsible for transferring the rewards out of the module. func (k Keeper) ChargeFundersOfPool(ctx sdk.Context, poolId uint64, amount uint64) (payout uint64, err error) { - pool, poolErr := k.pookKeeper.GetPoolWithError(ctx, poolId) + pool, poolErr := k.poolKeeper.GetPoolWithError(ctx, poolId) if poolErr != nil { return 0, poolErr } diff --git a/x/funders/keeper/msg_server_create_funder.go b/x/funders/keeper/msg_server_create_funder.go index 00c75546..75ab1e2e 100644 --- a/x/funders/keeper/msg_server_create_funder.go +++ b/x/funders/keeper/msg_server_create_funder.go @@ -11,6 +11,7 @@ import ( // CreateFunder creates a new funder object and stores it in the store. // If the funder already exists, an error is returned. +// TODO(rapha): this can be spammed right now. Someone can just created a bunch of funders to get displayed on the funders page. We should probably add a fee to this. func (k msgServer) CreateFunder(goCtx context.Context, msg *types.MsgCreateFunder) (*types.MsgCreateFunderResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) @@ -21,24 +22,24 @@ func (k msgServer) CreateFunder(goCtx context.Context, msg *types.MsgCreateFunde // Create new funder k.setFunder(ctx, types.Funder{ - Address: msg.Creator, - Moniker: msg.Moniker, - Identity: msg.Identity, - Logo: msg.Logo, - Website: msg.Website, - Contact: msg.Contact, - Details: msg.Details, + Address: msg.Creator, + Moniker: msg.Moniker, + Identity: msg.Identity, + Logo: msg.Logo, + Website: msg.Website, + Contact: msg.Contact, + Description: msg.Description, }) // Emit a create funder event _ = ctx.EventManager().EmitTypedEvent(&types.EventCreateFunder{ - Address: msg.Creator, - Moniker: msg.Moniker, - Identity: msg.Identity, - Logo: msg.Logo, - Website: msg.Website, - Contact: msg.Contact, - Details: msg.Details, + Address: msg.Creator, + Moniker: msg.Moniker, + Identity: msg.Identity, + Logo: msg.Logo, + Website: msg.Website, + Contact: msg.Contact, + Description: msg.Description, }) return &types.MsgCreateFunderResponse{}, nil diff --git a/x/funders/keeper/msg_server_defund_pool.go b/x/funders/keeper/msg_server_defund_pool.go index 06c85f6c..55064cca 100644 --- a/x/funders/keeper/msg_server_defund_pool.go +++ b/x/funders/keeper/msg_server_defund_pool.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "fmt" "github.com/KYVENetwork/chain/x/funders/types" "cosmossdk.io/errors" @@ -12,36 +13,47 @@ import ( // DefundPool handles the logic to defund a pool. // If the user is a funder, it will subtract the provided amount -// and send the tokens back. If the amount equals the current funding amount -// the funder is removed completely. +// and send the tokens back. If there are no more funds left, the funding will get inactive. func (k msgServer) DefundPool(goCtx context.Context, msg *types.MsgDefundPool) (*types.MsgDefundPoolResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // Pool has to exist - pool, err := k.pookKeeper.GetPoolWithError(ctx, msg.PoolId) - if err != nil { - return nil, err + // Funding has to exist + funding, found := k.getFunding(ctx, msg.Creator, msg.PoolId) + if !found { + return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrFundingDoesNotExist.Error(), msg.PoolId, msg.Creator) + } + + if funding.Amount == 0 { + return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrFundingIsUsedUp.Error(), msg.PoolId, msg.Creator) } - // Sender needs to be a funder in the pool - funderAmount := pool.GetFunderAmount(msg.Creator) - if funderAmount == 0 { - return nil, errorsTypes.ErrNotFound + // FundingState has to exist + fundingState, found := k.getFundingState(ctx, msg.PoolId) + if !found { + util.PanicHalt(k.upgradeKeeper, ctx, fmt.Sprintf("FundingState for pool %d does not exist", msg.PoolId)) } - // Check if the sender is trying to defund more than they have funded. - if msg.Amount > funderAmount { - return nil, errors.Wrapf(errorsTypes.ErrLogic, types.ErrDefundTooHigh.Error(), msg.Creator) + // Amount can not be higher than the current funding amount + amount := msg.Amount + if amount > funding.Amount { + amount = funding.Amount } - // Update state variables (or completely remove if fully defunding). - pool.SubtractAmountFromFunder(msg.Creator, msg.Amount) + funding.SubtractAmount(amount) + if funding.Amount == 0 { + fundingState.SetInactive(funding) + } + fundingState.TotalAmount -= amount // Transfer tokens from this module to sender. if err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, types.ModuleName, msg.Creator, msg.Amount); err != nil { return nil, err } + // Save funding and funding state + k.setFunding(ctx, funding) + fundingState.SetActive(funding) + // Emit a defund event. _ = ctx.EventManager().EmitTypedEvent(&types.EventDefundPool{ PoolId: msg.PoolId, @@ -49,7 +61,5 @@ func (k msgServer) DefundPool(goCtx context.Context, msg *types.MsgDefundPool) ( Amount: msg.Amount, }) - k.SetPool(ctx, pool) - return &types.MsgDefundPoolResponse{}, nil } diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go index a165584b..1874dd3e 100644 --- a/x/funders/keeper/msg_server_fund_pool.go +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -48,7 +48,7 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ } // Pool has to exist - err := k.pookKeeper.AssertPoolExists(ctx, msg.PoolId) + err := k.poolKeeper.AssertPoolExists(ctx, msg.PoolId) if err != nil { return nil, err } @@ -118,14 +118,18 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ // Check if defunding is necessary if defunding != nil { err := k.defundLowestFunding(ctx, defunding, &fundingState, msg.PoolId) + // TODO: what to do if defunding fails? Should we return the funds to the user? if err != nil { return nil, err } } + // Funding must be active + fundingState.SetActive(funding) + // Save funding and funding state k.setFunding(ctx, funding) - fundingState.SetActive(funding) + k.setFundingState(ctx, fundingState) // Emit a fund event. _ = ctx.EventManager().EmitTypedEvent(&types.EventFundPool{ diff --git a/x/funders/types/errors.go b/x/funders/types/errors.go index 2bd2b121..a1b3295c 100644 --- a/x/funders/types/errors.go +++ b/x/funders/types/errors.go @@ -11,5 +11,7 @@ var ( ErrFundsTooLow = errors.Register(ModuleName, 1102, "minimum funding amount of %vkyve not reached") ErrAmountPerBundleTooLow = errors.Register(ModuleName, 1103, "minimum amount per bundle of %vkyve not reached") ErrMinFundingAmount = errors.Register(ModuleName, 1104, "minimum funding amount of %vkyve not reached") + ErrFundingDoesNotExist = errors.Register(ModuleName, 1105, "funding for pool %v and funder %v does not exist") + ErrFundingIsUsedUp = errors.Register(ModuleName, 1106, "funding for pool %v and funder %v is used up") //ErrDefundTooHigh = errors.Register(ModuleName, 1102, "maximum defunding amount of %vkyve surpassed") ) diff --git a/x/funders/types/events.pb.go b/x/funders/types/events.pb.go index e9ca7d66..45116b84 100644 --- a/x/funders/types/events.pb.go +++ b/x/funders/types/events.pb.go @@ -37,8 +37,8 @@ type EventCreateFunder struct { Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` // contact ... Contact string `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` - // details are some additional notes the funder finds important - Details string `protobuf:"bytes,7,opt,name=details,proto3" json:"details,omitempty"` + // description are some additional notes the funder finds important + Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"` } func (m *EventCreateFunder) Reset() { *m = EventCreateFunder{} } @@ -116,9 +116,9 @@ func (m *EventCreateFunder) GetContact() string { return "" } -func (m *EventCreateFunder) GetDetails() string { +func (m *EventCreateFunder) GetDescription() string { if m != nil { - return m.Details + return m.Description } return "" } @@ -138,8 +138,8 @@ type EventUpdateFunder struct { Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` // contact ... Contact string `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` - // details are some additional notes the funder finds important - Details string `protobuf:"bytes,7,opt,name=details,proto3" json:"details,omitempty"` + // description are some additional notes the funder finds important + Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"` } func (m *EventUpdateFunder) Reset() { *m = EventUpdateFunder{} } @@ -217,9 +217,9 @@ func (m *EventUpdateFunder) GetContact() string { return "" } -func (m *EventUpdateFunder) GetDetails() string { +func (m *EventUpdateFunder) GetDescription() string { if m != nil { - return m.Details + return m.Description } return "" } @@ -373,30 +373,30 @@ func init() { func init() { proto.RegisterFile("kyve/funders/v1beta1/events.proto", fileDescriptor_1cf957abd56bbcb0) } var fileDescriptor_1cf957abd56bbcb0 = []byte{ - // 356 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x92, 0xc1, 0x4a, 0xeb, 0x40, - 0x14, 0x40, 0x9b, 0xbe, 0xbc, 0xf4, 0xbd, 0x81, 0x47, 0x69, 0x78, 0xe8, 0xe0, 0x22, 0x68, 0x57, - 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0x43, 0x17, 0x0c, 0xa4, 0x4c, 0xdd, 0x5d, 0xd2, - 0xc8, 0xa4, 0x4c, 0x87, 0x9c, 0x99, 0x06, 0x3b, 0x74, 0x34, 0x9e, 0xb3, 0xcf, 0x71, 0xf5, 0xaf, - 0x71, 0x3b, 0xc4, 0x89, 0x66, 0xb2, 0x10, 0x68, 0x02, 0xec, 0xb0, 0x22, 0xf7, 0x88, 0xb4, 0xca, - 0xd3, 0x30, 0x03, 0x35, 0x8c, 0x0b, 0xc1, 0x52, 0x30, 0x2d, 0x76, 0xd8, 0x2c, 0xc5, 0x00, 0x54, - 0xd7, 0x5c, 0xb7, 0xef, 0x48, 0xd3, 0xfc, 0xe3, 0x0c, 0x46, 0xdf, 0xff, 0x93, 0x6e, 0xff, 0x79, - 0xed, 0x59, 0xab, 0xb5, 0x67, 0xbd, 0xae, 0x3d, 0xeb, 0x71, 0xe3, 0xd5, 0x56, 0x1b, 0xaf, 0xf6, - 0xb2, 0xf1, 0x6a, 0xb7, 0xc7, 0x63, 0x8e, 0x93, 0x22, 0xf6, 0x13, 0x39, 0x0b, 0x2e, 0x6e, 0xae, - 0x7b, 0x97, 0x80, 0x0b, 0xa9, 0xa6, 0x41, 0x32, 0x89, 0xb8, 0x08, 0xee, 0xb7, 0x3b, 0x8e, 0xcb, - 0x0c, 0xf2, 0xd8, 0x31, 0xbb, 0x7d, 0xf2, 0x16, 0x00, 0x00, 0xff, 0xff, 0x63, 0xf9, 0x75, 0xba, - 0x00, 0x03, 0x00, 0x00, + // 362 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x92, 0xc1, 0x4a, 0xeb, 0x40, + 0x14, 0x86, 0x9b, 0xde, 0xdc, 0xf4, 0xde, 0x11, 0x29, 0x1d, 0x44, 0x07, 0x17, 0xa1, 0x76, 0x25, + 0x22, 0x09, 0xc5, 0x37, 0xa8, 0xb6, 0x20, 0x82, 0x94, 0x80, 0x82, 0x22, 0x94, 0x24, 0x73, 0xda, + 0x0e, 0x4d, 0x67, 0xc2, 0x64, 0xd2, 0xda, 0x17, 0x70, 0xed, 0x63, 0xb9, 0x11, 0xba, 0x74, 0x29, + 0xed, 0x8b, 0xc8, 0x4c, 0x62, 0xad, 0x7b, 0x57, 0xee, 0xe6, 0x3f, 0xdf, 0xcf, 0x70, 0x3e, 0x38, + 0xe8, 0x68, 0xb2, 0x98, 0x81, 0x3f, 0xcc, 0x39, 0x05, 0x99, 0xf9, 0xb3, 0x76, 0x04, 0x2a, 0x6c, + 0xfb, 0x30, 0x03, 0xae, 0x32, 0x2f, 0x95, 0x42, 0x09, 0xbc, 0xa7, 0x2b, 0x5e, 0x59, 0xf1, 0xca, + 0x4a, 0xeb, 0xd5, 0x42, 0x8d, 0xae, 0xae, 0x9d, 0x4b, 0x08, 0x15, 0xf4, 0x0c, 0xc6, 0x04, 0xd5, + 0x42, 0x4a, 0x25, 0x64, 0x19, 0xb1, 0x9a, 0xd6, 0xf1, 0xff, 0xe0, 0x33, 0x6a, 0x32, 0x15, 0x9c, + 0x4d, 0x40, 0x92, 0x6a, 0x41, 0xca, 0x88, 0x0f, 0xd1, 0x3f, 0x46, 0x81, 0x2b, 0xa6, 0x16, 0xe4, + 0x8f, 0x41, 0x9b, 0x8c, 0x31, 0xb2, 0x13, 0x31, 0x12, 0xc4, 0x36, 0x73, 0xf3, 0xd6, 0x3f, 0xcd, + 0x21, 0xca, 0x98, 0x02, 0xf2, 0xb7, 0xf8, 0xa9, 0x8c, 0x9a, 0xc4, 0x82, 0xab, 0x30, 0x56, 0xc4, + 0x29, 0x48, 0x19, 0x71, 0x13, 0xed, 0x50, 0xc8, 0x62, 0xc9, 0x52, 0xc5, 0x04, 0x27, 0x35, 0x43, + 0xb7, 0x47, 0x5f, 0x3e, 0x37, 0x29, 0xfd, 0x0d, 0x3e, 0x4f, 0x16, 0xda, 0x35, 0x3e, 0xda, 0xa4, + 0x2f, 0x44, 0x82, 0x0f, 0x50, 0x2d, 0x15, 0x22, 0x19, 0x30, 0x6a, 0x5c, 0xec, 0xc0, 0xd1, 0xf1, + 0x92, 0x6e, 0x4b, 0x56, 0xbf, 0x4b, 0xee, 0x23, 0x27, 0x9c, 0x8a, 0x9c, 0x2b, 0x23, 0x62, 0x07, + 0x65, 0xc2, 0x27, 0xa8, 0x51, 0xbc, 0x06, 0x29, 0xc8, 0x41, 0x94, 0x73, 0x9a, 0x80, 0x71, 0xb2, + 0x83, 0x7a, 0x01, 0xfa, 0x20, 0x3b, 0x66, 0xdc, 0x7a, 0x40, 0x75, 0xb3, 0xc7, 0x05, 0x0c, 0x7f, + 0x7e, 0x93, 0x4e, 0xef, 0x65, 0xe5, 0x5a, 0xcb, 0x95, 0x6b, 0xbd, 0xaf, 0x5c, 0xeb, 0x79, 0xed, + 0x56, 0x96, 0x6b, 0xb7, 0xf2, 0xb6, 0x76, 0x2b, 0xf7, 0xa7, 0x23, 0xa6, 0xc6, 0x79, 0xe4, 0xc5, + 0x62, 0xea, 0x5f, 0xdd, 0xdd, 0x76, 0xaf, 0x41, 0xcd, 0x85, 0x9c, 0xf8, 0xf1, 0x38, 0x64, 0xdc, + 0x7f, 0xdc, 0xdc, 0xbc, 0x5a, 0xa4, 0x90, 0x45, 0x8e, 0xb9, 0xf5, 0xb3, 0x8f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x90, 0xc3, 0x16, 0x64, 0x10, 0x03, 0x00, 0x00, } func (m *EventCreateFunder) Marshal() (dAtA []byte, err error) { @@ -419,10 +419,10 @@ func (m *EventCreateFunder) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Details) > 0 { - i -= len(m.Details) - copy(dAtA[i:], m.Details) - i = encodeVarintEvents(dAtA, i, uint64(len(m.Details))) + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Description))) i-- dAtA[i] = 0x3a } @@ -491,10 +491,10 @@ func (m *EventUpdateFunder) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Details) > 0 { - i -= len(m.Details) - copy(dAtA[i:], m.Details) - i = encodeVarintEvents(dAtA, i, uint64(len(m.Details))) + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Description))) i-- dAtA[i] = 0x3a } @@ -669,7 +669,7 @@ func (m *EventCreateFunder) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - l = len(m.Details) + l = len(m.Description) if l > 0 { n += 1 + l + sovEvents(uint64(l)) } @@ -706,7 +706,7 @@ func (m *EventUpdateFunder) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - l = len(m.Details) + l = len(m.Description) if l > 0 { n += 1 + l + sovEvents(uint64(l)) } @@ -983,7 +983,7 @@ func (m *EventCreateFunder) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1011,7 +1011,7 @@ func (m *EventCreateFunder) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Details = string(dAtA[iNdEx:postIndex]) + m.Description = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1257,7 +1257,7 @@ func (m *EventUpdateFunder) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1285,7 +1285,7 @@ func (m *EventUpdateFunder) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Details = string(dAtA[iNdEx:postIndex]) + m.Description = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/funders/types/funders.go b/x/funders/types/funders.go index ee267460..96eefaaa 100644 --- a/x/funders/types/funders.go +++ b/x/funders/types/funders.go @@ -31,7 +31,7 @@ func (fh *FundingState) GetLowestFunding() (funding *Funding, err error) { return lowestFunding, nil } -// SetInactive moves a funding from active to inactive and subtracts the amount. +// SetInactive moves a funding from active to inactive func (fh *FundingState) SetInactive(funding *Funding) { // Remove funding from active fundings for i, v := range fh.ActiveFundings { @@ -51,7 +51,7 @@ func (fh *FundingState) SetInactive(funding *Funding) { fh.InactiveFundings = append(fh.InactiveFundings, funding) } -// SetActive moves a funding from inactive to active and adds the amount. +// SetActive moves a funding from inactive to active func (fh *FundingState) SetActive(funding *Funding) { // Remove funding from inactive fundings for i, v := range fh.InactiveFundings { diff --git a/x/funders/types/funders.pb.go b/x/funders/types/funders.pb.go index 583eacf7..7c60e2c6 100644 --- a/x/funders/types/funders.pb.go +++ b/x/funders/types/funders.pb.go @@ -36,8 +36,8 @@ type Funder struct { Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` // contact ... Contact string `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` - // details are some additional notes the funder finds important - Details string `protobuf:"bytes,7,opt,name=details,proto3" json:"details,omitempty"` + // description are some additional notes the funder finds important + Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"` } func (m *Funder) Reset() { *m = Funder{} } @@ -115,9 +115,9 @@ func (m *Funder) GetContact() string { return "" } -func (m *Funder) GetDetails() string { +func (m *Funder) GetDescription() string { if m != nil { - return m.Details + return m.Description } return "" } @@ -207,7 +207,7 @@ func (m *Funding) GetTotalFunded() uint64 { return 0 } -// FundingState is the object which holds info about the funding state +// FundingState is the object which holds info about the funding state of a pool type FundingState struct { // pool_id is the id of the pool this funding is for PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` @@ -291,34 +291,35 @@ func init() { } var fileDescriptor_252d80f89b0fa299 = []byte{ - // 429 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xd1, 0x6a, 0x14, 0x31, - 0x18, 0x85, 0x37, 0xdd, 0x71, 0x56, 0xd3, 0xda, 0xda, 0x20, 0x1a, 0x04, 0x87, 0xba, 0x20, 0x14, - 0x91, 0x19, 0xaa, 0x4f, 0xd0, 0x82, 0x0b, 0x2a, 0x88, 0x8c, 0x20, 0xe8, 0xcd, 0x90, 0x99, 0xfc, - 0x6e, 0xc3, 0xce, 0x26, 0xcb, 0xe4, 0xdf, 0xad, 0xfb, 0x16, 0x3e, 0x8a, 0xd7, 0x3e, 0x81, 0x97, - 0xbd, 0xf4, 0x4a, 0x64, 0xf7, 0x45, 0x64, 0x92, 0xcc, 0xd0, 0x8a, 0x17, 0xbd, 0xcb, 0x77, 0x4e, - 0x72, 0xe6, 0x3f, 0x99, 0xd0, 0xf1, 0x6c, 0xbd, 0x82, 0xec, 0xcb, 0x52, 0x4b, 0x68, 0x6c, 0xb6, - 0x3a, 0x29, 0x01, 0xc5, 0x49, 0xc7, 0xe9, 0xa2, 0x31, 0x68, 0xd8, 0xfd, 0x76, 0x4f, 0xda, 0x69, - 0x61, 0xcf, 0xf8, 0x07, 0xa1, 0xf1, 0xc4, 0x69, 0x8c, 0xd3, 0x91, 0x90, 0xb2, 0x01, 0x6b, 0x39, - 0x39, 0x22, 0xc7, 0x77, 0xf2, 0x0e, 0x5b, 0x67, 0x6e, 0xb4, 0x9a, 0x41, 0xc3, 0x77, 0xbc, 0x13, - 0x90, 0x3d, 0xa2, 0xb7, 0x95, 0x04, 0x8d, 0x0a, 0xd7, 0x7c, 0xe8, 0xac, 0x9e, 0x19, 0xa3, 0x51, - 0x6d, 0xa6, 0x86, 0x47, 0x4e, 0x77, 0xeb, 0x36, 0xe9, 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0x29, - 0x78, 0xea, 0xa4, 0xb3, 0xc9, 0xcf, 0x4d, 0x42, 0x2e, 0x37, 0x09, 0xf9, 0xb3, 0x49, 0xc8, 0xb7, - 0x6d, 0x32, 0xb8, 0xdc, 0x26, 0x83, 0x5f, 0xdb, 0x64, 0xf0, 0xf9, 0xf9, 0x54, 0xe1, 0xf9, 0xb2, - 0x4c, 0x2b, 0x33, 0xcf, 0xde, 0x7e, 0xfa, 0xf8, 0xea, 0x1d, 0xe0, 0x85, 0x69, 0x66, 0x59, 0x75, - 0x2e, 0x94, 0xce, 0xbe, 0xf6, 0xcf, 0x17, 0xd7, 0x0b, 0xb0, 0x65, 0xec, 0x5e, 0xed, 0xcb, 0xbf, - 0x01, 0x00, 0x00, 0xff, 0xff, 0xce, 0x3f, 0x73, 0x3c, 0xdb, 0x02, 0x00, 0x00, + // 434 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xd1, 0x8a, 0xd3, 0x40, + 0x14, 0x86, 0x3b, 0xdb, 0x98, 0xea, 0x74, 0xdd, 0x75, 0x07, 0xd1, 0x41, 0x30, 0xd4, 0x82, 0xb0, + 0x88, 0x24, 0xac, 0x3e, 0xc1, 0x2e, 0x58, 0x50, 0x41, 0x24, 0x82, 0xa0, 0x37, 0x21, 0xc9, 0x1c, + 0xbb, 0x43, 0xdb, 0x99, 0x90, 0x9c, 0x76, 0xed, 0x5b, 0xf8, 0x28, 0x3e, 0x83, 0x57, 0x5e, 0xee, + 0xa5, 0x57, 0x22, 0xed, 0x8b, 0x48, 0xce, 0x4c, 0x4b, 0x2b, 0x5e, 0xec, 0xdd, 0xfc, 0xff, 0x3f, + 0xf3, 0xe7, 0x7c, 0x93, 0xe1, 0xc3, 0xc9, 0x72, 0x01, 0xc9, 0x97, 0xb9, 0x51, 0x50, 0x37, 0xc9, + 0xe2, 0xac, 0x00, 0xcc, 0xcf, 0x36, 0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 0x1a, 0xa4, 0x7d, 0xf2, + 0xe8, 0xb2, 0xd5, 0xf0, 0x37, 0xe3, 0x87, 0x7e, 0xe4, 0x0f, 0x98, 0x23, 0xec, 0x0e, 0xc4, 0xf6, + 0x06, 0x1a, 0xf1, 0xe3, 0xbc, 0x44, 0xbd, 0x00, 0x6a, 0xd3, 0x66, 0xdc, 0xc8, 0x83, 0x41, 0xf7, + 0xb4, 0xff, 0xe2, 0x71, 0xfc, 0xbf, 0x3f, 0x1a, 0xfb, 0xd6, 0xf4, 0xc8, 0x9d, 0xf2, 0xb2, 0x11, + 0x6f, 0xf8, 0x89, 0x36, 0xff, 0x36, 0x75, 0x6f, 0xd2, 0x74, 0x6f, 0x73, 0x6e, 0xdb, 0xb5, 0x05, + 0xf4, 0x57, 0x15, 0xec, 0x00, 0x9e, 0x93, 0x75, 0x31, 0xfa, 0xb9, 0x8a, 0xd8, 0xf5, 0x2a, 0x62, + 0x7f, 0x56, 0x11, 0xfb, 0xb6, 0x8e, 0x3a, 0xd7, 0xeb, 0xa8, 0xf3, 0x6b, 0x1d, 0x75, 0x3e, 0x3f, + 0x1f, 0x6b, 0xbc, 0x9c, 0x17, 0x71, 0x69, 0x67, 0xc9, 0xdb, 0x4f, 0x1f, 0x5f, 0xbd, 0x03, 0xbc, + 0xb2, 0xf5, 0x24, 0x29, 0x2f, 0x73, 0x6d, 0x92, 0xaf, 0xdb, 0x67, 0x8c, 0xcb, 0x0a, 0x9a, 0x22, + 0xa4, 0xd7, 0xfb, 0xf2, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x7f, 0x53, 0xc1, 0xe3, 0x02, + 0x00, 0x00, } func (m *Funder) Marshal() (dAtA []byte, err error) { @@ -341,10 +342,10 @@ func (m *Funder) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Details) > 0 { - i -= len(m.Details) - copy(dAtA[i:], m.Details) - i = encodeVarintFunders(dAtA, i, uint64(len(m.Details))) + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Description))) i-- dAtA[i] = 0x3a } @@ -545,7 +546,7 @@ func (m *Funder) Size() (n int) { if l > 0 { n += 1 + l + sovFunders(uint64(l)) } - l = len(m.Details) + l = len(m.Description) if l > 0 { n += 1 + l + sovFunders(uint64(l)) } @@ -833,7 +834,7 @@ func (m *Funder) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -861,7 +862,7 @@ func (m *Funder) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Details = string(dAtA[iNdEx:postIndex]) + m.Description = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/funders/types/tx.pb.go b/x/funders/types/tx.pb.go index 730e5430..cb7ce31f 100644 --- a/x/funders/types/tx.pb.go +++ b/x/funders/types/tx.pb.go @@ -41,8 +41,8 @@ type MsgCreateFunder struct { Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` // contact Contact string `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` - // details are some additional notes the funder finds important - Details string `protobuf:"bytes,7,opt,name=details,proto3" json:"details,omitempty"` + // description are some additional notes the funder finds important + Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"` } func (m *MsgCreateFunder) Reset() { *m = MsgCreateFunder{} } @@ -120,9 +120,9 @@ func (m *MsgCreateFunder) GetContact() string { return "" } -func (m *MsgCreateFunder) GetDetails() string { +func (m *MsgCreateFunder) GetDescription() string { if m != nil { - return m.Details + return m.Description } return "" } @@ -178,8 +178,8 @@ type MsgUpdateFunder struct { Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` // contact Contact string `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` - // details are some additional notes the funder finds important - Details string `protobuf:"bytes,7,opt,name=details,proto3" json:"details,omitempty"` + // description are some additional notes the funder finds important + Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"` } func (m *MsgUpdateFunder) Reset() { *m = MsgUpdateFunder{} } @@ -257,9 +257,9 @@ func (m *MsgUpdateFunder) GetContact() string { return "" } -func (m *MsgUpdateFunder) GetDetails() string { +func (m *MsgUpdateFunder) GetDescription() string { if m != nil { - return m.Details + return m.Description } return "" } @@ -526,36 +526,36 @@ func init() { func init() { proto.RegisterFile("kyve/funders/v1beta1/tx.proto", fileDescriptor_5145d80c2db97f3d) } var fileDescriptor_5145d80c2db97f3d = []byte{ - // 454 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x94, 0xcd, 0x6e, 0xd4, 0x30, - 0x10, 0xc7, 0x37, 0x6d, 0xd8, 0x2d, 0x03, 0xa8, 0xc2, 0x50, 0xd6, 0xac, 0x44, 0x04, 0x8b, 0x90, - 0xf8, 0x4c, 0x54, 0x78, 0x83, 0x02, 0x95, 0x10, 0x5a, 0x54, 0x45, 0x02, 0x41, 0x0f, 0xac, 0x92, - 0x78, 0x9a, 0x5a, 0x9b, 0xb5, 0x23, 0xdb, 0x69, 0xbb, 0x77, 0x1e, 0x80, 0x97, 0xe0, 0x49, 0xb8, - 0x70, 0xec, 0x91, 0x23, 0xda, 0x7d, 0x11, 0x14, 0xe7, 0x83, 0x6d, 0x45, 0xa1, 0x07, 0x2e, 0xdc, - 0xfc, 0x9f, 0xdf, 0x78, 0x66, 0xfe, 0x96, 0x6d, 0xb8, 0x35, 0x99, 0x1d, 0x60, 0xb0, 0x57, 0x08, - 0x86, 0x4a, 0x07, 0x07, 0x9b, 0x31, 0x9a, 0x68, 0x33, 0x30, 0x47, 0x7e, 0xae, 0xa4, 0x91, 0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, 0x3c, 0xdc, 0x80, 0x6b, 0x4b, 0x53, 0xb4, 0xd3, 0xed, 0xc2, 0x95, - 0x91, 0x4e, 0x5f, 0xe0, 0xde, 0xbf, 0x1f, 0x6f, 0xd8, 0x87, 0x8d, 0x13, 0xb5, 0x9b, 0xa6, 0x4f, - 0xbf, 0xac, 0xc0, 0xea, 0x48, 0xa7, 0x84, 0xc1, 0xe5, 0x13, 0x17, 0xfb, 0x9e, 0xff, 0xbb, 0x37, - 0xe0, 0x9f, 0xba, 0x3a, 0x83, 0x27, 0xe7, 0x4a, 0x6b, 0xba, 0x91, 0xf7, 0xb0, 0xd6, 0x1e, 0xfe, - 0x9d, 0x33, 0xb7, 0x36, 0x29, 0x83, 0x07, 0x7f, 0x4d, 0x69, 0x2b, 0x7f, 0x04, 0x58, 0x3a, 0xb9, - 0xbb, 0x67, 0x6e, 0xfc, 0x95, 0x34, 0x78, 0x74, 0x8e, 0xa4, 0xa6, 0xfe, 0xd6, 0xf6, 0xb7, 0xb9, - 0xe7, 0x1c, 0xcf, 0x3d, 0xe7, 0xc7, 0xdc, 0x73, 0x3e, 0x2f, 0xbc, 0xce, 0xf1, 0xc2, 0xeb, 0x7c, - 0x5f, 0x78, 0x9d, 0xdd, 0xc7, 0x29, 0x37, 0xfb, 0x45, 0xec, 0x27, 0x72, 0x1a, 0xbc, 0xfe, 0xf0, - 0xee, 0xe5, 0x1b, 0x34, 0x87, 0x52, 0x4d, 0x82, 0x64, 0x3f, 0xe2, 0x22, 0x38, 0x6a, 0x7f, 0x19, - 0x33, 0xcb, 0x51, 0xc7, 0x5d, 0xfb, 0xc3, 0x3c, 0xfb, 0x19, 0x00, 0x00, 0xff, 0xff, 0x6a, 0x3b, - 0xf4, 0xc7, 0x82, 0x04, 0x00, 0x00, + // 458 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x54, 0xcb, 0x6e, 0xd3, 0x40,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5, 0xbf, + 0xb3, 0xfb, 0x75, 0xee, 0x5a, 0xa7, 0x73, 0xd7, 0xfa, 0x31, 0x77, 0xad, 0xcf, 0x0b, 0xb7, 0x75, + 0xba, 0x70, 0x5b, 0xdf, 0x17, 0x6e, 0x6b, 0xff, 0x71, 0xca, 0xf5, 0xe1, 0x34, 0xf2, 0x62, 0x9a, + 0xf8, 0xaf, 0x3f, 0xbc, 0x7b, 0xf9, 0x06, 0xf5, 0x31, 0xc9, 0x91, 0x1f, 0x1f, 0x86, 0x5c, 0xf8, + 0x27, 0xf5, 0xaf, 0xa3, 0x67, 0x19, 0xaa, 0xa8, 0x6d, 0x7e, 0x9c, 0x67, 0x3f, 0x03, 0x00, 0x00, + 0xff, 0xff, 0xc5, 0x05, 0x8e, 0x7f, 0x92, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -740,10 +740,10 @@ func (m *MsgCreateFunder) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Details) > 0 { - i -= len(m.Details) - copy(dAtA[i:], m.Details) - i = encodeVarintTx(dAtA, i, uint64(len(m.Details))) + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintTx(dAtA, i, uint64(len(m.Description))) i-- dAtA[i] = 0x3a } @@ -835,10 +835,10 @@ func (m *MsgUpdateFunder) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Details) > 0 { - i -= len(m.Details) - copy(dAtA[i:], m.Details) - i = encodeVarintTx(dAtA, i, uint64(len(m.Details))) + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintTx(dAtA, i, uint64(len(m.Description))) i-- dAtA[i] = 0x3a } @@ -1082,7 +1082,7 @@ func (m *MsgCreateFunder) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Details) + l = len(m.Description) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1128,7 +1128,7 @@ func (m *MsgUpdateFunder) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Details) + l = len(m.Description) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1432,7 +1432,7 @@ func (m *MsgCreateFunder) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1460,7 +1460,7 @@ func (m *MsgCreateFunder) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Details = string(dAtA[iNdEx:postIndex]) + m.Description = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1756,7 +1756,7 @@ func (m *MsgUpdateFunder) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1784,7 +1784,7 @@ func (m *MsgUpdateFunder) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Details = string(dAtA[iNdEx:postIndex]) + m.Description = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex From 329fe892f0c9b20d7788ec87562d93ed3078e19d Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 25 Sep 2023 13:31:50 +0200 Subject: [PATCH 019/109] feat: add msg_server_create_funder tests --- x/funders/keeper/getters_funder.go | 6 +- x/funders/keeper/getters_funding.go | 4 +- x/funders/keeper/msg_server_create_funder.go | 2 +- .../keeper/msg_server_create_funder_test.go | 144 +++++------------- x/funders/keeper/msg_server_defund_pool.go | 2 +- x/funders/keeper/msg_server_fund_pool.go | 4 +- x/funders/keeper/msg_server_update_funder.go | 30 ++-- 7 files changed, 65 insertions(+), 127 deletions(-) diff --git a/x/funders/keeper/getters_funder.go b/x/funders/keeper/getters_funder.go index 342e9972..4a92598a 100644 --- a/x/funders/keeper/getters_funder.go +++ b/x/funders/keeper/getters_funder.go @@ -6,14 +6,14 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// DoesFundingExist checks if the funding exists -func (k Keeper) doesFunderExist(ctx sdk.Context, funderAddress string) bool { +// DoesFunderExist checks if the funding exists +func (k Keeper) DoesFunderExist(ctx sdk.Context, funderAddress string) bool { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FunderKeyPrefix) return store.Has(types.FunderKey(funderAddress)) } // GetFunder returns the funder -func (k Keeper) getFunder(ctx sdk.Context, funderAddress string) (funder types.Funder, found bool) { +func (k Keeper) GetFunder(ctx sdk.Context, funderAddress string) (funder types.Funder, found bool) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FunderKeyPrefix) b := store.Get(types.FunderKey( diff --git a/x/funders/keeper/getters_funding.go b/x/funders/keeper/getters_funding.go index 5b11e49c..55d138e4 100644 --- a/x/funders/keeper/getters_funding.go +++ b/x/funders/keeper/getters_funding.go @@ -7,13 +7,13 @@ import ( ) // DoesFundingExist checks if the funding exists -func (k Keeper) doesFundingExist(ctx sdk.Context, funderAddress string, poolId uint64) bool { +func (k Keeper) DoesFundingExist(ctx sdk.Context, funderAddress string, poolId uint64) bool { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingKeyPrefixByFunder) return store.Has(types.FundingKeyByFunder(funderAddress, poolId)) } // GetFunding returns the funding -func (k Keeper) getFunding(ctx sdk.Context, funderAddress string, poolId uint64) (funding *types.Funding, found bool) { +func (k Keeper) GetFunding(ctx sdk.Context, funderAddress string, poolId uint64) (funding *types.Funding, found bool) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingKeyPrefixByFunder) b := store.Get(types.FundingKeyByFunder( diff --git a/x/funders/keeper/msg_server_create_funder.go b/x/funders/keeper/msg_server_create_funder.go index 75ab1e2e..2e0704bd 100644 --- a/x/funders/keeper/msg_server_create_funder.go +++ b/x/funders/keeper/msg_server_create_funder.go @@ -16,7 +16,7 @@ func (k msgServer) CreateFunder(goCtx context.Context, msg *types.MsgCreateFunde ctx := sdk.UnwrapSDKContext(goCtx) // Check if funder already exists - if k.doesFunderExist(ctx, msg.Creator) { + if k.DoesFunderExist(ctx, msg.Creator) { return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrFunderAlreadyExists.Error(), msg.Creator) } diff --git a/x/funders/keeper/msg_server_create_funder_test.go b/x/funders/keeper/msg_server_create_funder_test.go index e5b3aff8..191cf922 100644 --- a/x/funders/keeper/msg_server_create_funder_test.go +++ b/x/funders/keeper/msg_server_create_funder_test.go @@ -1,149 +1,87 @@ package keeper_test import ( + "github.com/KYVENetwork/chain/x/funders/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" i "github.com/KYVENetwork/chain/testutil/integration" - pooltypes "github.com/KYVENetwork/chain/x/pool/types" ) /* -TEST CASES - msg_server_defund_pool.go - -* Defund 50 KYVE from a funder who has previously funded 100 KYVE -* Try to defund more than actually funded -* Defund full funding amount from a funder who has previously funded 100 KYVE -* Defund as highest funder 75 KYVE in order to be the lowest funder afterwards +TEST CASES - msg_server_create_funder.go +* Create a funder with empty values +* Create a funder with all values set +* Create a funder that already exists +* TODO: Create two funders with the same moniker */ -var _ = Describe("msg_server_defund_pool.go", Ordered, func() { +var _ = Describe("msg_server_create_funder.go", Ordered, func() { s := i.NewCleanChain() - initialBalance := s.GetBalanceFromAddress(i.ALICE) - BeforeEach(func() { // init new clean chain s = i.NewCleanChain() - - // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - // fund pool - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) }) AfterEach(func() { s.PerformValidityChecks() }) - It("Defund 50 KYVE from a funder who has previously funded 100 KYVE", func() { - // ACT - s.RunTxPoolSuccess(&pooltypes.MsgDefundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 50 * i.KYVE, - }) - - // ASSERT - balanceAfter := s.GetBalanceFromAddress(i.ALICE) - - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - - Expect(initialBalance - balanceAfter).To(Equal(50 * i.KYVE)) - - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.TotalFunds).To(Equal(50 * i.KYVE)) - - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(50 * i.KYVE)) - - Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) - Expect(pool.GetLowestFunder().Amount).To(Equal(50 * i.KYVE)) - }) - - It("Try to defund more than actually funded", func() { + It("Create a funder with empty values", func() { // ACT - s.RunTxPoolError(&pooltypes.MsgDefundPool{ + s.RunTxPoolSuccess(&types.MsgCreateFunder{ Creator: i.ALICE, - Id: 0, - Amount: 101 * i.KYVE, }) // ASSERT - balanceAfter := s.GetBalanceFromAddress(i.ALICE) - - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - - Expect(initialBalance - balanceAfter).To(Equal(100 * i.KYVE)) - - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.TotalFunds).To(Equal(100 * i.KYVE)) - - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100 * i.KYVE)) - - Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) - Expect(pool.GetLowestFunder().Amount).To(Equal(100 * i.KYVE)) + funder, found := s.App().FundersKeeper.GetFunder(s.Ctx(), i.ALICE) + Expect(found).To(BeTrue()) + Expect(funder.Address).To(Equal(i.ALICE)) + Expect(funder.Moniker).To(BeEmpty()) + Expect(funder.Identity).To(BeEmpty()) + Expect(funder.Logo).To(BeEmpty()) + Expect(funder.Website).To(BeEmpty()) + Expect(funder.Contact).To(BeEmpty()) + Expect(funder.Description).To(BeEmpty()) }) - It("Defund full funding amount from a funder who has previously funded 100 KYVE", func() { + It("Create a funder with all values set", func() { // ACT - s.RunTxPoolSuccess(&pooltypes.MsgDefundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + moniker, identity, logo, website, contact, description := "moniker", "identity", "logo", "website", "contact", "description" + s.RunTxPoolSuccess(&types.MsgCreateFunder{ + Creator: i.ALICE, + Moniker: moniker, + Identity: identity, + Logo: logo, + Website: website, + Contact: contact, + Description: description, }) // ASSERT - balanceAfter := s.GetBalanceFromAddress(i.ALICE) - - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - - Expect(initialBalance - balanceAfter).To(BeZero()) - - Expect(pool.Funders).To(BeEmpty()) - Expect(pool.TotalFunds).To(BeZero()) - - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(uint64(0))) - - Expect(pool.GetLowestFunder()).To(Equal(pooltypes.Funder{})) + funder, found := s.App().FundersKeeper.GetFunder(s.Ctx(), i.ALICE) + Expect(found).To(BeTrue()) + Expect(funder.Address).To(Equal(i.ALICE)) + Expect(funder.Moniker).To(Equal(moniker)) + Expect(funder.Identity).To(Equal(identity)) + Expect(funder.Logo).To(Equal(logo)) + Expect(funder.Website).To(Equal(website)) + Expect(funder.Contact).To(Equal(contact)) + Expect(funder.Description).To(Equal(description)) }) - It("Defund as highest funder 75 KYVE in order to be the lowest funder afterwards", func() { + It("Create a funder with empty values", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 50 * i.KYVE, + s.RunTxPoolSuccess(&types.MsgCreateFunder{ + Creator: i.ALICE, }) - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(pool.GetLowestFunder().Address).To(Equal(i.BOB)) - Expect(pool.GetLowestFunder().Amount).To(Equal(50 * i.KYVE)) - // ACT - s.RunTxPoolSuccess(&pooltypes.MsgDefundPool{ + s.RunTxPoolError(&types.MsgCreateFunder{ Creator: i.ALICE, - Id: 0, - Amount: 75 * i.KYVE, }) - - // ASSERT - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) - Expect(pool.GetLowestFunder().Amount).To(Equal(25 * i.KYVE)) }) }) diff --git a/x/funders/keeper/msg_server_defund_pool.go b/x/funders/keeper/msg_server_defund_pool.go index 55064cca..1da713cc 100644 --- a/x/funders/keeper/msg_server_defund_pool.go +++ b/x/funders/keeper/msg_server_defund_pool.go @@ -18,7 +18,7 @@ func (k msgServer) DefundPool(goCtx context.Context, msg *types.MsgDefundPool) ( ctx := sdk.UnwrapSDKContext(goCtx) // Funding has to exist - funding, found := k.getFunding(ctx, msg.Creator, msg.PoolId) + funding, found := k.GetFunding(ctx, msg.Creator, msg.PoolId) if !found { return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrFundingDoesNotExist.Error(), msg.PoolId, msg.Creator) } diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go index 1874dd3e..0be56829 100644 --- a/x/funders/keeper/msg_server_fund_pool.go +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -43,7 +43,7 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ ctx := sdk.UnwrapSDKContext(goCtx) // Funder has to exist - if !k.doesFunderExist(ctx, msg.Creator) { + if !k.DoesFunderExist(ctx, msg.Creator) { return nil, errors.Wrapf(errorsTypes.ErrUnauthorized, types.ErrFunderDoesNotExist.Error(), msg.Creator) } @@ -66,7 +66,7 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ } // Check if funding already exists - funding, found := k.getFunding(ctx, msg.Creator, msg.PoolId) + funding, found := k.GetFunding(ctx, msg.Creator, msg.PoolId) if found { // If so, update funding funding.AddAmount(msg.Amount) diff --git a/x/funders/keeper/msg_server_update_funder.go b/x/funders/keeper/msg_server_update_funder.go index 2a673f76..0c99fb11 100644 --- a/x/funders/keeper/msg_server_update_funder.go +++ b/x/funders/keeper/msg_server_update_funder.go @@ -14,30 +14,30 @@ func (k msgServer) UpdateFunder(goCtx context.Context, msg *types.MsgUpdateFunde ctx := sdk.UnwrapSDKContext(goCtx) // Error if funder does not exist - if !k.doesFunderExist(ctx, msg.Creator) { + if !k.DoesFunderExist(ctx, msg.Creator) { return nil, errors.Wrap(errorsTypes.ErrInvalidRequest, types.ErrFunderDoesNotExist.Error()) } // Update funder k.setFunder(ctx, types.Funder{ - Address: msg.Creator, - Moniker: msg.Moniker, - Identity: msg.Identity, - Logo: msg.Logo, - Website: msg.Website, - Contact: msg.Contact, - Details: msg.Details, + Address: msg.Creator, + Moniker: msg.Moniker, + Identity: msg.Identity, + Logo: msg.Logo, + Website: msg.Website, + Contact: msg.Contact, + Description: msg.Description, }) // Emit a update funder event _ = ctx.EventManager().EmitTypedEvent(&types.EventUpdateFunder{ - Address: msg.Creator, - Moniker: msg.Moniker, - Identity: msg.Identity, - Logo: msg.Logo, - Website: msg.Website, - Contact: msg.Contact, - Details: msg.Details, + Address: msg.Creator, + Moniker: msg.Moniker, + Identity: msg.Identity, + Logo: msg.Logo, + Website: msg.Website, + Contact: msg.Contact, + Description: msg.Description, }) return &types.MsgUpdateFunderResponse{}, nil From 1b302c0bb867626a31173be8f4b2cf1e2496daac Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 26 Sep 2023 17:36:38 +0200 Subject: [PATCH 020/109] chore: uncomment tests and breaking changes to make a running prototype --- app/app.go | 4 + config.yml | 2 - go.mod | 2 +- proto/kyve/funders/v1beta1/events.proto | 7 + proto/kyve/funders/v1beta1/funders.proto | 6 +- proto/kyve/funders/v1beta1/tx.proto | 2 +- proto/kyve/pool/v1beta1/events.proto | 7 - testutil/integration/checks.go | 37 +-- testutil/keeper/funders.go | 17 +- .../msg_server_submit_bundle_proposal.go | 10 +- x/funders/client/cli/flags.go | 27 ++ x/funders/client/cli/tx.go | 4 + x/funders/client/cli/tx_create_funder.go | 51 ++++ .../client/cli/tx_defund_pool.go | 12 +- .../client/cli/tx_fund_pool.go | 21 +- x/funders/client/cli/tx_update_funder.go | 48 ++++ x/funders/keeper/getters_funding.go | 16 ++ x/funders/keeper/getters_funding_state.go | 31 ++- x/funders/keeper/logic_funders.go | 66 ++--- x/funders/keeper/msg_server_defund_pool.go | 2 +- x/funders/keeper/msg_server_fund_pool.go | 15 +- x/funders/module.go | 10 +- x/funders/types/errors.go | 15 +- x/funders/types/events.pb.go | 206 ++++++++++++-- x/funders/types/funders.go | 63 ++--- x/funders/types/funders.pb.go | 166 ++++-------- x/funders/types/genesis.go | 2 +- x/funders/types/keys.go | 4 + x/funders/types/message_create_funder.go | 3 + .../types/message_defund_pool.go | 29 +- x/funders/types/message_update_funder.go | 41 +++ x/funders/types/tx.pb.go | 99 ++++--- x/pool/client/cli/tx.go | 3 - x/pool/spec/02_state.md | 6 +- x/pool/types/codec.go | 7 +- x/pool/types/events.pb.go | 256 ++++-------------- x/pool/types/genesis.go | 8 +- x/pool/types/message_fund_pool.go | 56 ---- x/pool/types/pool.go | 72 ----- x/query/keeper/grpc_account_assets.go | 7 +- x/query/keeper/grpc_account_funded.go | 20 +- x/query/keeper/helper.go | 20 +- 42 files changed, 753 insertions(+), 727 deletions(-) create mode 100644 x/funders/client/cli/flags.go create mode 100644 x/funders/client/cli/tx_create_funder.go rename x/{pool => funders}/client/cli/tx_defund_pool.go (83%) rename x/{pool => funders}/client/cli/tx_fund_pool.go (65%) create mode 100644 x/funders/client/cli/tx_update_funder.go rename x/{pool => funders}/types/message_defund_pool.go (61%) create mode 100644 x/funders/types/message_update_funder.go delete mode 100644 x/pool/types/message_fund_pool.go diff --git a/app/app.go b/app/app.go index 1ba5e498..68e792dd 100644 --- a/app/app.go +++ b/app/app.go @@ -533,6 +533,10 @@ func NewKYVEApp( memKeys[fundersTypes.MemStoreKey], authTypes.NewModuleAddress(govTypes.ModuleName).String(), + + app.BankKeeper, + app.PoolKeeper, + app.UpgradeKeeper, ) app.IBCKeeper = ibcKeeper.NewKeeper( diff --git a/config.yml b/config.yml index a2ef69a8..85e31b02 100644 --- a/config.yml +++ b/config.yml @@ -138,7 +138,6 @@ genesis: current_key: "" current_storage_provider_id: "1" current_summary: "" - funders: [] id: "0" logo: "" max_bundle_size: "100" @@ -149,7 +148,6 @@ genesis: runtime: '@kyvejs/tendermint-bsync' start_key: "1" total_bundles: "0" - total_funds: "0" upload_interval: "60" protocol: version: "1.0.0" diff --git a/go.mod b/go.mod index 5a316e96..699ac42b 100644 --- a/go.mod +++ b/go.mod @@ -19,6 +19,7 @@ require ( github.com/onsi/gomega v1.26.0 github.com/spf13/cast v1.5.1 github.com/spf13/cobra v1.7.0 + github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.16.0 github.com/strangelove-ventures/packet-forward-middleware/v7 v7.0.0-20230523193151-73dea436e53f github.com/stretchr/testify v1.8.4 @@ -257,7 +258,6 @@ require ( github.com/sourcegraph/go-diff v0.7.0 // indirect github.com/spf13/afero v1.9.5 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect github.com/stretchr/objx v0.5.0 // indirect diff --git a/proto/kyve/funders/v1beta1/events.proto b/proto/kyve/funders/v1beta1/events.proto index 7e09b5c6..f0c21008 100644 --- a/proto/kyve/funders/v1beta1/events.proto +++ b/proto/kyve/funders/v1beta1/events.proto @@ -68,3 +68,10 @@ message EventDefundPool { // amount is the amount in ukyve the funder has defunded uint64 amount = 3; } + +// EventPoolOutOfFunds is an event emitted when a pool has run out of funds +// emitted_by: MsgSubmitBundleProposal +message EventPoolOutOfFunds { + // pool_id is the unique ID of the pool. + uint64 pool_id = 1; +} diff --git a/proto/kyve/funders/v1beta1/funders.proto b/proto/kyve/funders/v1beta1/funders.proto index 2f8aa898..2f46d382 100644 --- a/proto/kyve/funders/v1beta1/funders.proto +++ b/proto/kyve/funders/v1beta1/funders.proto @@ -46,9 +46,7 @@ message FundingState { // pool_id is the id of the pool this funding is for uint64 pool_id = 1; // active_fundings is the list of all active fundings - repeated Funding active_fundings = 2; - // inactive_fundings is the list of all inactive fundings that have been used up - repeated Funding inactive_fundings = 3; + repeated string active_funder_addresses = 2; // total_amount is the total amount of funds in ukyve the pool has from all fundings - uint64 total_amount = 4; + uint64 total_amount = 3; } diff --git a/proto/kyve/funders/v1beta1/tx.proto b/proto/kyve/funders/v1beta1/tx.proto index e94cc802..6f447ac0 100644 --- a/proto/kyve/funders/v1beta1/tx.proto +++ b/proto/kyve/funders/v1beta1/tx.proto @@ -9,7 +9,7 @@ service Msg { // CreateFunder ... rpc CreateFunder(MsgCreateFunder) returns (MsgCreateFunderResponse); // UpdateFunder ... - // rpc UpdateFunder(MsgUpdateFunder) returns (MsgUpdateFunderResponse); + rpc UpdateFunder(MsgUpdateFunder) returns (MsgUpdateFunderResponse); // FundPool ... rpc FundPool(MsgFundPool) returns (MsgFundPoolResponse); // DefundPool ... diff --git a/proto/kyve/pool/v1beta1/events.proto b/proto/kyve/pool/v1beta1/events.proto index 79b528d4..bbbc38ee 100644 --- a/proto/kyve/pool/v1beta1/events.proto +++ b/proto/kyve/pool/v1beta1/events.proto @@ -148,10 +148,3 @@ message EventPoolFundsSlashed { // amount is the amount in ukyve the validator has lost due to the slash uint64 amount = 3; } - -// EventPoolOutOfFunds is an event emitted when a pool has run out of funds -// emitted_by: MsgSubmitBundleProposal -message EventPoolOutOfFunds { - // pool_id is the unique ID of the pool. - uint64 pool_id = 1; -} diff --git a/testutil/integration/checks.go b/testutil/integration/checks.go index e84c8c36..54dcf815 100644 --- a/testutil/integration/checks.go +++ b/testutil/integration/checks.go @@ -59,12 +59,13 @@ func (suite *KeeperTestSuite) VerifyPoolModuleAssetsIntegrity() { expectedBalance := uint64(0) actualBalance := uint64(0) - for _, pool := range suite.App().PoolKeeper.GetAllPools(suite.Ctx()) { - // pool funds should be in pool module - for _, funder := range pool.Funders { - expectedBalance += funder.Amount - } - } + // TODO(rapha): fix this + //for _, pool := range suite.App().PoolKeeper.GetAllPools(suite.Ctx()) { + // pool funds should be in pool module + //for _, funder := range pool.Funders { + // expectedBalance += funder.Amount + //} + //} moduleAcc := suite.App().AccountKeeper.GetModuleAccount(suite.Ctx(), pooltypes.ModuleName).GetAddress() actualBalance = suite.App().BankKeeper.GetBalance(suite.Ctx(), moduleAcc, globalTypes.Denom).Amount.Uint64() @@ -73,16 +74,17 @@ func (suite *KeeperTestSuite) VerifyPoolModuleAssetsIntegrity() { } func (suite *KeeperTestSuite) VerifyPoolTotalFunds() { - for _, pool := range suite.App().PoolKeeper.GetAllPools(suite.Ctx()) { - expectedBalance := uint64(0) - actualBalance := pool.TotalFunds - - for _, funder := range pool.Funders { - expectedBalance += funder.Amount - } - - Expect(actualBalance).To(Equal(expectedBalance)) - } + // TODO(rapha): fix this + //for _, pool := range suite.App().PoolKeeper.GetAllPools(suite.Ctx()) { + // expectedBalance := uint64(0) + //actualBalance := pool.TotalFunds + // + //for _, funder := range pool.Funders { + // expectedBalance += funder.Amount + //} + // + //Expect(actualBalance).To(Equal(expectedBalance)) + //} } func (suite *KeeperTestSuite) VerifyPoolQueries() { @@ -486,7 +488,8 @@ func (suite *KeeperTestSuite) verifyFullStaker(fullStaker querytypes.FullStaker, Expect(found).To(BeTrue()) Expect(poolMembership.Pool.Id).To(Equal(pool.Id)) Expect(poolMembership.Pool.Logo).To(Equal(pool.Logo)) - Expect(poolMembership.Pool.TotalFunds).To(Equal(pool.TotalFunds)) + //TODO(rapha): fix this + //Expect(poolMembership.Pool.TotalFunds).To(Equal(pool.TotalFunds)) Expect(poolMembership.Pool.Name).To(Equal(pool.Name)) Expect(poolMembership.Pool.Runtime).To(Equal(pool.Runtime)) Expect(poolMembership.Pool.Status).To(Equal(suite.App().QueryKeeper.GetPoolStatus(suite.Ctx(), &pool))) diff --git a/testutil/keeper/funders.go b/testutil/keeper/funders.go index b64096eb..6730fc53 100644 --- a/testutil/keeper/funders.go +++ b/testutil/keeper/funders.go @@ -36,17 +36,20 @@ func FundersKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { memStoreKey, "FundersParams", ) - k := keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, - ) - + //k := keeper.NewKeeper( + // cdc, + // storeKey, + // memStoreKey, + // paramsSubspace, + //) + + _ = paramsSubspace + var k *keeper.Keeper ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) // Initialize params k.SetParams(ctx, types.DefaultParams()) return k, ctx + return nil, ctx } diff --git a/x/bundles/keeper/msg_server_submit_bundle_proposal.go b/x/bundles/keeper/msg_server_submit_bundle_proposal.go index 4d95de09..64b7237d 100644 --- a/x/bundles/keeper/msg_server_submit_bundle_proposal.go +++ b/x/bundles/keeper/msg_server_submit_bundle_proposal.go @@ -67,10 +67,12 @@ func (k msgServer) SubmitBundleProposal(goCtx context.Context, msg *types.MsgSub pool, _ := k.poolKeeper.GetPool(ctx, msg.PoolId) // charge the operating cost from funders - fundersPayout, err := k.poolKeeper.ChargeFundersOfPool(ctx, msg.PoolId, pool.OperatingCost) - if err != nil { - return &types.MsgSubmitBundleProposalResponse{}, err - } + // TODO(rapha): fix this + fundersPayout := uint64(0) + //fundersPayout, err := k.poolKeeper.ChargeFundersOfPool(ctx, msg.PoolId, pool.OperatingCost) + //if err != nil { + // return &types.MsgSubmitBundleProposalResponse{}, err + //} // charge the inflation pool inflationPayout, err := k.poolKeeper.ChargeInflationPool(ctx, msg.PoolId) diff --git a/x/funders/client/cli/flags.go b/x/funders/client/cli/flags.go new file mode 100644 index 00000000..302a721c --- /dev/null +++ b/x/funders/client/cli/flags.go @@ -0,0 +1,27 @@ +package cli + +import ( + flag "github.com/spf13/pflag" +) + +const ( + FlagMoniker = "moniker" + FlagIdentity = "identity" + FlagLogo = "logo" + FlagWebsite = "website" + FlagContact = "contact" + FlagDescription = "description" +) + +func flagSetFunderCreate() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + + fs.String(FlagMoniker, "", "The funder's name") + fs.String(FlagIdentity, "", "The optional identity signature (ex. UPort or Keybase)") + fs.String(FlagLogo, "", "The funder's (optional) logo") + fs.String(FlagWebsite, "", "The funder's (optional) website") + fs.String(FlagContact, "", "The funder's (optional) security contact email") + fs.String(FlagDescription, "", "The funder's (optional) description") + + return fs +} diff --git a/x/funders/client/cli/tx.go b/x/funders/client/cli/tx.go index 7a54fc35..409cf79d 100644 --- a/x/funders/client/cli/tx.go +++ b/x/funders/client/cli/tx.go @@ -30,6 +30,10 @@ func GetTxCmd() *cobra.Command { RunE: client.ValidateCmd, } + cmd.AddCommand(CmdCreateFunder()) + cmd.AddCommand(CmdUpdateFunder()) + cmd.AddCommand(CmdFundPool()) + cmd.AddCommand(CmdDefundPool()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/funders/client/cli/tx_create_funder.go b/x/funders/client/cli/tx_create_funder.go new file mode 100644 index 00000000..7a944f0e --- /dev/null +++ b/x/funders/client/cli/tx_create_funder.go @@ -0,0 +1,51 @@ +package cli + +import ( + "github.com/KYVENetwork/chain/x/funders/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" +) + +func CmdCreateFunder() *cobra.Command { + cmd := &cobra.Command{ + Use: "create-funder [moniker]", + Short: "Broadcast message create-funder", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + argMoniker := args[0] + + //moniker, _ := cmd.Flags().GetString(FlagEditMoniker) + identity, _ := cmd.Flags().GetString(FlagIdentity) + logo, _ := cmd.Flags().GetString(FlagLogo) + website, _ := cmd.Flags().GetString(FlagWebsite) + contact, _ := cmd.Flags().GetString(FlagContact) + description, _ := cmd.Flags().GetString(FlagDescription) + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := &types.MsgCreateFunder{ + Creator: clientCtx.GetFromAddress().String(), + Moniker: argMoniker, + Identity: identity, + Logo: logo, + Website: website, + Contact: contact, + Description: description, + } + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + cmd.Flags().AddFlagSet(flagSetFunderCreate()) + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/pool/client/cli/tx_defund_pool.go b/x/funders/client/cli/tx_defund_pool.go similarity index 83% rename from x/pool/client/cli/tx_defund_pool.go rename to x/funders/client/cli/tx_defund_pool.go index 8bf60be8..3c41183f 100644 --- a/x/pool/client/cli/tx_defund_pool.go +++ b/x/funders/client/cli/tx_defund_pool.go @@ -1,7 +1,7 @@ package cli import ( - "github.com/KYVENetwork/chain/x/pool/types" + "github.com/KYVENetwork/chain/x/funders/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" @@ -29,11 +29,11 @@ func CmdDefundPool() *cobra.Command { return err } - msg := types.NewMsgDefundPool( - clientCtx.GetFromAddress().String(), - argId, - argAmount, - ) + msg := &types.MsgDefundPool{ + Creator: clientCtx.GetFromAddress().String(), + PoolId: argId, + Amount: argAmount, + } if err := msg.ValidateBasic(); err != nil { return err } diff --git a/x/pool/client/cli/tx_fund_pool.go b/x/funders/client/cli/tx_fund_pool.go similarity index 65% rename from x/pool/client/cli/tx_fund_pool.go rename to x/funders/client/cli/tx_fund_pool.go index aef09fbb..bdfce2dd 100644 --- a/x/pool/client/cli/tx_fund_pool.go +++ b/x/funders/client/cli/tx_fund_pool.go @@ -1,7 +1,7 @@ package cli import ( - "github.com/KYVENetwork/chain/x/pool/types" + "github.com/KYVENetwork/chain/x/funders/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" @@ -11,9 +11,9 @@ import ( func CmdFundPool() *cobra.Command { cmd := &cobra.Command{ - Use: "fund-pool [id] [amount]", + Use: "fund-pool [id] [amount] [amount_per_bundle]", Short: "Broadcast message fund-pool", - Args: cobra.ExactArgs(2), + Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) (err error) { argId, err := cast.ToUint64E(args[0]) if err != nil { @@ -23,17 +23,22 @@ func CmdFundPool() *cobra.Command { if err != nil { return err } + argAmountPerBundle, err := cast.ToUint64E(args[2]) + if err != nil { + return err + } clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } - msg := types.NewMsgFundPool( - clientCtx.GetFromAddress().String(), - argId, - argAmount, - ) + msg := &types.MsgFundPool{ + Creator: clientCtx.GetFromAddress().String(), + PoolId: argId, + Amount: argAmount, + AmountPerBundle: argAmountPerBundle, + } if err := msg.ValidateBasic(); err != nil { return err } diff --git a/x/funders/client/cli/tx_update_funder.go b/x/funders/client/cli/tx_update_funder.go new file mode 100644 index 00000000..bbff909c --- /dev/null +++ b/x/funders/client/cli/tx_update_funder.go @@ -0,0 +1,48 @@ +package cli + +import ( + "github.com/KYVENetwork/chain/x/funders/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" +) + +func CmdUpdateFunder() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-funder", + Short: "Broadcast message create-funder", + RunE: func(cmd *cobra.Command, args []string) (err error) { + moniker, _ := cmd.Flags().GetString(FlagMoniker) + identity, _ := cmd.Flags().GetString(FlagIdentity) + logo, _ := cmd.Flags().GetString(FlagLogo) + website, _ := cmd.Flags().GetString(FlagWebsite) + contact, _ := cmd.Flags().GetString(FlagContact) + description, _ := cmd.Flags().GetString(FlagDescription) + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := &types.MsgUpdateFunder{ + Creator: clientCtx.GetFromAddress().String(), + Moniker: moniker, + Identity: identity, + Logo: logo, + Website: website, + Contact: contact, + Description: description, + } + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + cmd.Flags().AddFlagSet(flagSetFunderCreate()) + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/funders/keeper/getters_funding.go b/x/funders/keeper/getters_funding.go index 55d138e4..da0d61c7 100644 --- a/x/funders/keeper/getters_funding.go +++ b/x/funders/keeper/getters_funding.go @@ -28,6 +28,22 @@ func (k Keeper) GetFunding(ctx sdk.Context, funderAddress string, poolId uint64) return funding, true } +// GetFundingsOfPool returns all fundings of a pool +func (k Keeper) GetFundingsOfPool(ctx sdk.Context, poolId uint64) (fundings []*types.Funding) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingKeyPrefixByPool) + + iterator := sdk.KVStorePrefixIterator(store, types.FundingKeyByPoolOnly(poolId)) + //goland:noinspection GoUnhandledErrorResult + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var funding types.Funding + k.cdc.MustUnmarshal(iterator.Value(), &funding) + fundings = append(fundings, &funding) + } + return fundings +} + // SetFunding sets a specific funding in the store from its index func (k Keeper) setFunding(ctx sdk.Context, funding *types.Funding) { b := k.cdc.MustMarshal(funding) diff --git a/x/funders/keeper/getters_funding_state.go b/x/funders/keeper/getters_funding_state.go index cf77c6a9..2c513f5c 100644 --- a/x/funders/keeper/getters_funding_state.go +++ b/x/funders/keeper/getters_funding_state.go @@ -1,19 +1,21 @@ package keeper import ( + "errors" + "fmt" "github.com/KYVENetwork/chain/x/funders/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" ) // DoesFundingStateExist checks if the FundingState exists -func (k Keeper) doesFundingStateExist(ctx sdk.Context, poolId uint64) bool { +func (k Keeper) DoesFundingStateExist(ctx sdk.Context, poolId uint64) bool { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingStateKeyPrefix) return store.Has(types.FundingStateKey(poolId)) } // GetFundingState returns the FundingState -func (k Keeper) getFundingState(ctx sdk.Context, poolId uint64) (fundingState types.FundingState, found bool) { +func (k Keeper) GetFundingState(ctx sdk.Context, poolId uint64) (fundingState types.FundingState, found bool) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingStateKeyPrefix) b := store.Get(types.FundingStateKey( @@ -35,3 +37,28 @@ func (k Keeper) setFundingState(ctx sdk.Context, fundingState types.FundingState fundingState.PoolId, ), b) } + +func (k Keeper) GetActiveFundings(ctx sdk.Context, fundingState types.FundingState) (fundings []*types.Funding) { + for _, funder := range fundingState.ActiveFunderAddresses { + funding, found := k.GetFunding(ctx, funder, fundingState.PoolId) + if found { + fundings = append(fundings, funding) + } // else should never happen or we have a corrupted state + } + return fundings +} + +// GetLowestFunding returns the funding with the lowest amount +// Precondition: len(fundings) > 0 +func (k Keeper) GetLowestFunding(fundings []*types.Funding) (lowestFunding *types.Funding, err error) { + if len(fundings) == 0 { + return nil, errors.New(fmt.Sprintf("no active fundings")) + } + + for _, funding := range fundings { + if funding.Amount < lowestFunding.Amount { + lowestFunding = funding + } + } + return lowestFunding, nil +} diff --git a/x/funders/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go index 7e3adf5f..5e1c00f6 100644 --- a/x/funders/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -1,8 +1,10 @@ package keeper import ( - poolTypes "github.com/KYVENetwork/chain/x/pool/types" + "cosmossdk.io/errors" + "github.com/KYVENetwork/chain/x/funders/types" sdk "github.com/cosmos/cosmos-sdk/types" + errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) // ChargeFundersOfPool equally splits the amount between all funders and removes @@ -11,54 +13,38 @@ import ( // Their remaining amount is transferred to the Treasury. // This method does not transfer any funds. The bundles-module // is responsible for transferring the rewards out of the module. -func (k Keeper) ChargeFundersOfPool(ctx sdk.Context, poolId uint64, amount uint64) (payout uint64, err error) { - pool, poolErr := k.poolKeeper.GetPoolWithError(ctx, poolId) - if poolErr != nil { - return 0, poolErr +// TODO: update text +func (k Keeper) ChargeFundersOfPool(ctx sdk.Context, poolId uint64) (payout uint64, err error) { + // Get funding state for pool + fundingState, found := k.GetFundingState(ctx, poolId) + if !found { + return 0, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrFundingStateDoesNotExist.Error(), poolId) } - // if pool has no funders we immediately return - if len(pool.Funders) == 0 { - return payout, err + // If there are no active fundings we immediately return + activeFundings := k.GetActiveFundings(ctx, fundingState) + if len(activeFundings) == 0 { + return 0, nil } - // This is the amount every funder will be charged - amountPerFunder := amount / uint64(len(pool.Funders)) - - // Due to discrete division there will be a remainder which can not be split - // equally among all funders. This amount is charged to the lowest funder - amountRemainder := amount - amountPerFunder*uint64(len(pool.Funders)) - - funders := pool.Funders - - for _, funder := range funders { - if funder.Amount < amountPerFunder { - pool.RemoveFunder(funder.Address) - payout += funder.Amount - } else { - pool.SubtractAmountFromFunder(funder.Address, amountPerFunder) - payout += amountPerFunder + // This is the amount every funding will be charged + payout = 0 + for _, funding := range activeFundings { + payout += funding.ChargeOneBundle() + if funding.Amount == 0 { + fundingState.SetInactive(funding) } + k.setFunding(ctx, funding) } - lowestFunder := pool.GetLowestFunder() + // Save funding state + k.setFundingState(ctx, fundingState) - if lowestFunder.Address != "" { - if lowestFunder.Amount < amountRemainder { - pool.RemoveFunder(lowestFunder.Address) - payout += lowestFunder.Amount - } else { - pool.SubtractAmountFromFunder(lowestFunder.Address, amountRemainder) - payout += amountRemainder - } - } - - if len(pool.Funders) == 0 { - _ = ctx.EventManager().EmitTypedEvent(&poolTypes.EventPoolOutOfFunds{ - PoolId: pool.Id, + // Emit a pool out of funds event if there are no more active funders + if len(fundingState.ActiveFunderAddresses) == 0 { + _ = ctx.EventManager().EmitTypedEvent(&types.EventPoolOutOfFunds{ + PoolId: poolId, }) } - - k.SetPool(ctx, pool) return payout, nil } diff --git a/x/funders/keeper/msg_server_defund_pool.go b/x/funders/keeper/msg_server_defund_pool.go index 1da713cc..9e0bd028 100644 --- a/x/funders/keeper/msg_server_defund_pool.go +++ b/x/funders/keeper/msg_server_defund_pool.go @@ -28,7 +28,7 @@ func (k msgServer) DefundPool(goCtx context.Context, msg *types.MsgDefundPool) ( } // FundingState has to exist - fundingState, found := k.getFundingState(ctx, msg.PoolId) + fundingState, found := k.GetFundingState(ctx, msg.PoolId) if !found { util.PanicHalt(k.upgradeKeeper, ctx, fmt.Sprintf("FundingState for pool %d does not exist", msg.PoolId)) } diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go index 0be56829..591d0cc9 100644 --- a/x/funders/keeper/msg_server_fund_pool.go +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -54,13 +54,12 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ } // Get or create funding state for pool - fundingState, found := k.getFundingState(ctx, msg.PoolId) + fundingState, found := k.GetFundingState(ctx, msg.PoolId) if !found { fundingState = types.FundingState{ - PoolId: msg.PoolId, - ActiveFundings: []*types.Funding{}, - InactiveFundings: []*types.Funding{}, - TotalAmount: 0, + PoolId: msg.PoolId, + ActiveFunderAddresses: []string{}, + TotalAmount: 0, } k.setFundingState(ctx, fundingState) } @@ -89,9 +88,11 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ var defunding *types.Funding = nil + activeFundings := k.GetActiveFundings(ctx, fundingState) + // Check if funding limit is exceeded - if len(fundingState.ActiveFundings) >= types.MaxFunders { - lowestFunding, err := fundingState.GetLowestFunding() + if len(activeFundings) >= types.MaxFunders { + lowestFunding, err := k.GetLowestFunding(activeFundings) if err != nil { util.PanicHalt(k.upgradeKeeper, ctx, err.Error()) } diff --git a/x/funders/module.go b/x/funders/module.go index 0fc0cccd..4d1a5047 100644 --- a/x/funders/module.go +++ b/x/funders/module.go @@ -4,6 +4,8 @@ import ( "context" "encoding/json" "fmt" + "github.com/KYVENetwork/chain/util" + // this line is used by starport scaffolding # 1 "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -92,15 +94,15 @@ type AppModule struct { AppModuleBasic keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper + accountKeeper util.AccountKeeper + bankKeeper util.BankKeeper } func NewAppModule( cdc codec.Codec, keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, + accountKeeper util.AccountKeeper, + bankKeeper util.BankKeeper, ) AppModule { return AppModule{ AppModuleBasic: NewAppModuleBasic(cdc), diff --git a/x/funders/types/errors.go b/x/funders/types/errors.go index a1b3295c..d630c94b 100644 --- a/x/funders/types/errors.go +++ b/x/funders/types/errors.go @@ -6,12 +6,13 @@ import ( // x/funders module sentinel errors var ( - ErrFunderAlreadyExists = errors.Register(ModuleName, 1100, "funder with address %v already exists") - ErrFunderDoesNotExist = errors.Register(ModuleName, 1101, "funder with address %v does not exist") - ErrFundsTooLow = errors.Register(ModuleName, 1102, "minimum funding amount of %vkyve not reached") - ErrAmountPerBundleTooLow = errors.Register(ModuleName, 1103, "minimum amount per bundle of %vkyve not reached") - ErrMinFundingAmount = errors.Register(ModuleName, 1104, "minimum funding amount of %vkyve not reached") - ErrFundingDoesNotExist = errors.Register(ModuleName, 1105, "funding for pool %v and funder %v does not exist") - ErrFundingIsUsedUp = errors.Register(ModuleName, 1106, "funding for pool %v and funder %v is used up") + ErrFunderAlreadyExists = errors.Register(ModuleName, 1100, "funder with address %v already exists") + ErrFunderDoesNotExist = errors.Register(ModuleName, 1101, "funder with address %v does not exist") + ErrFundsTooLow = errors.Register(ModuleName, 1102, "minimum funding amount of %vkyve not reached") + ErrAmountPerBundleTooLow = errors.Register(ModuleName, 1103, "minimum amount per bundle of %vkyve not reached") + ErrMinFundingAmount = errors.Register(ModuleName, 1104, "minimum funding amount of %vkyve not reached") + ErrFundingDoesNotExist = errors.Register(ModuleName, 1105, "funding for pool %v and funder %v does not exist") + ErrFundingIsUsedUp = errors.Register(ModuleName, 1106, "funding for pool %v and funder %v is used up") + ErrFundingStateDoesNotExist = errors.Register(ModuleName, 1107, "funding state for pool %v does not exist") //ErrDefundTooHigh = errors.Register(ModuleName, 1102, "maximum defunding amount of %vkyve surpassed") ) diff --git a/x/funders/types/events.pb.go b/x/funders/types/events.pb.go index 45116b84..9695e77d 100644 --- a/x/funders/types/events.pb.go +++ b/x/funders/types/events.pb.go @@ -363,40 +363,89 @@ func (m *EventDefundPool) GetAmount() uint64 { return 0 } +// EventPoolOutOfFunds is an event emitted when a pool has run out of funds +// emitted_by: MsgSubmitBundleProposal +type EventPoolOutOfFunds struct { + // pool_id is the unique ID of the pool. + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` +} + +func (m *EventPoolOutOfFunds) Reset() { *m = EventPoolOutOfFunds{} } +func (m *EventPoolOutOfFunds) String() string { return proto.CompactTextString(m) } +func (*EventPoolOutOfFunds) ProtoMessage() {} +func (*EventPoolOutOfFunds) Descriptor() ([]byte, []int) { + return fileDescriptor_1cf957abd56bbcb0, []int{4} +} +func (m *EventPoolOutOfFunds) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventPoolOutOfFunds) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventPoolOutOfFunds.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventPoolOutOfFunds) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventPoolOutOfFunds.Merge(m, src) +} +func (m *EventPoolOutOfFunds) XXX_Size() int { + return m.Size() +} +func (m *EventPoolOutOfFunds) XXX_DiscardUnknown() { + xxx_messageInfo_EventPoolOutOfFunds.DiscardUnknown(m) +} + +var xxx_messageInfo_EventPoolOutOfFunds proto.InternalMessageInfo + +func (m *EventPoolOutOfFunds) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + func init() { proto.RegisterType((*EventCreateFunder)(nil), "kyve.funders.v1beta1.EventCreateFunder") proto.RegisterType((*EventUpdateFunder)(nil), "kyve.funders.v1beta1.EventUpdateFunder") proto.RegisterType((*EventFundPool)(nil), "kyve.funders.v1beta1.EventFundPool") proto.RegisterType((*EventDefundPool)(nil), "kyve.funders.v1beta1.EventDefundPool") + proto.RegisterType((*EventPoolOutOfFunds)(nil), "kyve.funders.v1beta1.EventPoolOutOfFunds") } func init() { proto.RegisterFile("kyve/funders/v1beta1/events.proto", fileDescriptor_1cf957abd56bbcb0) } var fileDescriptor_1cf957abd56bbcb0 = []byte{ - // 362 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x92, 0xc1, 0x4a, 0xeb, 0x40, - 0x14, 0x86, 0x9b, 0xde, 0xdc, 0xf4, 0xde, 0x11, 0x29, 0x1d, 0x44, 0x07, 0x17, 0xa1, 0x76, 0x25, - 0x22, 0x09, 0xc5, 0x37, 0xa8, 0xb6, 0x20, 0x82, 0x94, 0x80, 0x82, 0x22, 0x94, 0x24, 0x73, 0xda, - 0x0e, 0x4d, 0x67, 0xc2, 0x64, 0xd2, 0xda, 0x17, 0x70, 0xed, 0x63, 0xb9, 0x11, 0xba, 0x74, 0x29, - 0xed, 0x8b, 0xc8, 0x4c, 0x62, 0xad, 0x7b, 0x57, 0xee, 0xe6, 0x3f, 0xdf, 0xcf, 0x70, 0x3e, 0x38, - 0xe8, 0x68, 0xb2, 0x98, 0x81, 0x3f, 0xcc, 0x39, 0x05, 0x99, 0xf9, 0xb3, 0x76, 0x04, 0x2a, 0x6c, - 0xfb, 0x30, 0x03, 0xae, 0x32, 0x2f, 0x95, 0x42, 0x09, 0xbc, 0xa7, 0x2b, 0x5e, 0x59, 0xf1, 0xca, - 0x4a, 0xeb, 0xd5, 0x42, 0x8d, 0xae, 0xae, 0x9d, 0x4b, 0x08, 0x15, 0xf4, 0x0c, 0xc6, 0x04, 0xd5, - 0x42, 0x4a, 0x25, 0x64, 0x19, 0xb1, 0x9a, 0xd6, 0xf1, 0xff, 0xe0, 0x33, 0x6a, 0x32, 0x15, 0x9c, - 0x4d, 0x40, 0x92, 0x6a, 0x41, 0xca, 0x88, 0x0f, 0xd1, 0x3f, 0x46, 0x81, 0x2b, 0xa6, 0x16, 0xe4, - 0x8f, 0x41, 0x9b, 0x8c, 0x31, 0xb2, 0x13, 0x31, 0x12, 0xc4, 0x36, 0x73, 0xf3, 0xd6, 0x3f, 0xcd, - 0x21, 0xca, 0x98, 0x02, 0xf2, 0xb7, 0xf8, 0xa9, 0x8c, 0x9a, 0xc4, 0x82, 0xab, 0x30, 0x56, 0xc4, - 0x29, 0x48, 0x19, 0x71, 0x13, 0xed, 0x50, 0xc8, 0x62, 0xc9, 0x52, 0xc5, 0x04, 0x27, 0x35, 0x43, - 0xb7, 0x47, 0x5f, 0x3e, 0x37, 0x29, 0xfd, 0x0d, 0x3e, 0x4f, 0x16, 0xda, 0x35, 0x3e, 0xda, 0xa4, - 0x2f, 0x44, 0x82, 0x0f, 0x50, 0x2d, 0x15, 0x22, 0x19, 0x30, 0x6a, 0x5c, 0xec, 0xc0, 0xd1, 0xf1, - 0x92, 0x6e, 0x4b, 0x56, 0xbf, 0x4b, 0xee, 0x23, 0x27, 0x9c, 0x8a, 0x9c, 0x2b, 0x23, 0x62, 0x07, - 0x65, 0xc2, 0x27, 0xa8, 0x51, 0xbc, 0x06, 0x29, 0xc8, 0x41, 0x94, 0x73, 0x9a, 0x80, 0x71, 0xb2, - 0x83, 0x7a, 0x01, 0xfa, 0x20, 0x3b, 0x66, 0xdc, 0x7a, 0x40, 0x75, 0xb3, 0xc7, 0x05, 0x0c, 0x7f, - 0x7e, 0x93, 0x4e, 0xef, 0x65, 0xe5, 0x5a, 0xcb, 0x95, 0x6b, 0xbd, 0xaf, 0x5c, 0xeb, 0x79, 0xed, - 0x56, 0x96, 0x6b, 0xb7, 0xf2, 0xb6, 0x76, 0x2b, 0xf7, 0xa7, 0x23, 0xa6, 0xc6, 0x79, 0xe4, 0xc5, - 0x62, 0xea, 0x5f, 0xdd, 0xdd, 0x76, 0xaf, 0x41, 0xcd, 0x85, 0x9c, 0xf8, 0xf1, 0x38, 0x64, 0xdc, - 0x7f, 0xdc, 0xdc, 0xbc, 0x5a, 0xa4, 0x90, 0x45, 0x8e, 0xb9, 0xf5, 0xb3, 0x8f, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x90, 0xc3, 0x16, 0x64, 0x10, 0x03, 0x00, 0x00, + // 383 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x93, 0xc1, 0x6a, 0xdb, 0x30, + 0x18, 0xc7, 0xe3, 0xcc, 0x73, 0x36, 0x8d, 0x11, 0xa2, 0x8d, 0x4d, 0xec, 0x60, 0xb2, 0x9c, 0xc6, + 0x18, 0x36, 0x61, 0x6f, 0x90, 0x2d, 0x81, 0x31, 0x68, 0x82, 0xa1, 0x85, 0x96, 0x42, 0xb0, 0xad, + 0x2f, 0x89, 0x88, 0x23, 0x19, 0x49, 0x4e, 0x9a, 0x17, 0xe8, 0xb9, 0x8f, 0xd5, 0x4b, 0x21, 0xc7, + 0x1e, 0x4b, 0xf2, 0x22, 0x45, 0xb2, 0x9b, 0xa6, 0x87, 0xde, 0x7a, 0xea, 0x4d, 0xff, 0xef, 0xf7, + 0xf1, 0x97, 0x7e, 0x07, 0xa1, 0xef, 0xf3, 0xf5, 0x12, 0xc2, 0x49, 0xc1, 0x29, 0x48, 0x15, 0x2e, + 0xbb, 0x09, 0xe8, 0xb8, 0x1b, 0xc2, 0x12, 0xb8, 0x56, 0x41, 0x2e, 0x85, 0x16, 0xf8, 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x5f, 0x98, 0xbc, 0xfc, 0x4b, 0x3a, 0x01, 0xfa, 0x64, 0xdb, 0x4d, 0xef, 0xb0, 0xd0, + 0xc3, 0x89, 0xd1, 0x55, 0xcf, 0xde, 0xd0, 0x1b, 0x5c, 0x6f, 0x7d, 0x67, 0xb3, 0xf5, 0x9d, 0xbb, + 0xad, 0xef, 0x5c, 0xed, 0xfc, 0xda, 0x66, 0xe7, 0xd7, 0x6e, 0x77, 0x7e, 0xed, 0xec, 0xd7, 0x94, + 0xe9, 0x59, 0x91, 0x04, 0xa9, 0x58, 0x84, 0xff, 0x4f, 0x4f, 0xfa, 0x47, 0xa0, 0x57, 0x42, 0xce, + 0xc3, 0x74, 0x16, 0x33, 0x1e, 0x5e, 0xec, 0xff, 0x88, 0x5e, 0xe7, 0xa0, 0x12, 0xcf, 0xfe, 0x8d, + 0xdf, 0xf7, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa6, 0x97, 0x99, 0x63, 0x40, 0x03, 0x00, 0x00, } func (m *EventCreateFunder) Marshal() (dAtA []byte, err error) { @@ -628,6 +677,34 @@ func (m *EventDefundPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EventPoolOutOfFunds) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventPoolOutOfFunds) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventPoolOutOfFunds) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PoolId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { offset -= sovEvents(v) base := offset @@ -754,6 +831,18 @@ func (m *EventDefundPool) Size() (n int) { return n } +func (m *EventPoolOutOfFunds) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovEvents(uint64(m.PoolId)) + } + return n +} + func sovEvents(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1567,6 +1656,75 @@ func (m *EventDefundPool) Unmarshal(dAtA []byte) error { } return nil } +func (m *EventPoolOutOfFunds) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventPoolOutOfFunds: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventPoolOutOfFunds: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipEvents(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/funders/types/funders.go b/x/funders/types/funders.go index 96eefaaa..85dd3a89 100644 --- a/x/funders/types/funders.go +++ b/x/funders/types/funders.go @@ -1,10 +1,5 @@ package types -import ( - "errors" - "fmt" -) - func (f *Funding) AddAmount(amount uint64) { f.Amount += amount } @@ -17,56 +12,32 @@ func (f *Funding) SubtractAmount(amount uint64) { } } -func (fh *FundingState) GetLowestFunding() (funding *Funding, err error) { - if len(fh.ActiveFundings) == 0 { - return nil, errors.New(fmt.Sprintf("no active fundings for pool %d", fh.PoolId)) - } - - lowestFunding := fh.ActiveFundings[0] - for _, v := range fh.ActiveFundings { - if v.Amount < lowestFunding.Amount { - lowestFunding = v - } +func (f *Funding) ChargeOneBundle() (amount uint64) { + amount = f.AmountPerBundle + if f.Amount < f.AmountPerBundle { + amount = f.Amount } - return lowestFunding, nil + f.SubtractAmount(amount) + return amount } -// SetInactive moves a funding from active to inactive -func (fh *FundingState) SetInactive(funding *Funding) { - // Remove funding from active fundings - for i, v := range fh.ActiveFundings { - if v.FunderAddress == funding.FunderAddress { - fh.ActiveFundings[i] = fh.ActiveFundings[len(fh.ActiveFundings)-1] - fh.ActiveFundings = fh.ActiveFundings[:len(fh.ActiveFundings)-1] +// SetInactive removes a funding from active fundings +func (fs *FundingState) SetInactive(funding *Funding) { + for i, funderAddress := range fs.ActiveFunderAddresses { + if funderAddress == funding.FunderAddress { + fs.ActiveFunderAddresses[i] = fs.ActiveFunderAddresses[len(fs.ActiveFunderAddresses)-1] + fs.ActiveFunderAddresses = fs.ActiveFunderAddresses[:len(fs.ActiveFunderAddresses)-1] break } } - - // Add funding to inactive fundings - for _, v := range fh.InactiveFundings { - if v.FunderAddress == funding.FunderAddress { - return - } - } - fh.InactiveFundings = append(fh.InactiveFundings, funding) } -// SetActive moves a funding from inactive to active -func (fh *FundingState) SetActive(funding *Funding) { - // Remove funding from inactive fundings - for i, v := range fh.InactiveFundings { - if v.FunderAddress == funding.FunderAddress { - fh.InactiveFundings[i] = fh.InactiveFundings[len(fh.InactiveFundings)-1] - fh.InactiveFundings = fh.InactiveFundings[:len(fh.InactiveFundings)-1] - break - } - } - - // Add funding to active fundings - for _, v := range fh.ActiveFundings { - if v.FunderAddress == funding.FunderAddress { +// SetActive adds a funding to active fundings +func (fs *FundingState) SetActive(funding *Funding) { + for _, funderAddress := range fs.ActiveFunderAddresses { + if funderAddress == funding.FunderAddress { return } } - fh.ActiveFundings = append(fh.ActiveFundings, funding) + fs.ActiveFunderAddresses = append(fs.ActiveFunderAddresses, funding.FunderAddress) } diff --git a/x/funders/types/funders.pb.go b/x/funders/types/funders.pb.go index 7c60e2c6..2201ca2d 100644 --- a/x/funders/types/funders.pb.go +++ b/x/funders/types/funders.pb.go @@ -212,11 +212,9 @@ type FundingState struct { // pool_id is the id of the pool this funding is for PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` // active_fundings is the list of all active fundings - ActiveFundings []*Funding `protobuf:"bytes,2,rep,name=active_fundings,json=activeFundings,proto3" json:"active_fundings,omitempty"` - // inactive_fundings is the list of all inactive fundings that have been used up - InactiveFundings []*Funding `protobuf:"bytes,3,rep,name=inactive_fundings,json=inactiveFundings,proto3" json:"inactive_fundings,omitempty"` + ActiveFunderAddresses []string `protobuf:"bytes,2,rep,name=active_funder_addresses,json=activeFunderAddresses,proto3" json:"active_funder_addresses,omitempty"` // total_amount is the total amount of funds in ukyve the pool has from all fundings - TotalAmount uint64 `protobuf:"varint,4,opt,name=total_amount,json=totalAmount,proto3" json:"total_amount,omitempty"` + TotalAmount uint64 `protobuf:"varint,3,opt,name=total_amount,json=totalAmount,proto3" json:"total_amount,omitempty"` } func (m *FundingState) Reset() { *m = FundingState{} } @@ -259,16 +257,9 @@ func (m *FundingState) GetPoolId() uint64 { return 0 } -func (m *FundingState) GetActiveFundings() []*Funding { +func (m *FundingState) GetActiveFunderAddresses() []string { if m != nil { - return m.ActiveFundings - } - return nil -} - -func (m *FundingState) GetInactiveFundings() []*Funding { - if m != nil { - return m.InactiveFundings + return m.ActiveFunderAddresses } return nil } @@ -291,35 +282,33 @@ func init() { } var fileDescriptor_252d80f89b0fa299 = []byte{ - // 434 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xd1, 0x8a, 0xd3, 0x40, - 0x14, 0x86, 0x3b, 0xdb, 0x98, 0xea, 0x74, 0xdd, 0x75, 0x07, 0xd1, 0x41, 0x30, 0xd4, 0x82, 0xb0, - 0x88, 0x24, 0xac, 0x3e, 0xc1, 0x2e, 0x58, 0x50, 0x41, 0x24, 0x82, 0xa0, 0x37, 0x21, 0xc9, 0x1c, - 0xbb, 0x43, 0xdb, 0x99, 0x90, 0x9c, 0x76, 0xed, 0x5b, 0xf8, 0x28, 0x3e, 0x83, 0x57, 0x5e, 0xee, - 0xa5, 0x57, 0x22, 0xed, 0x8b, 0x48, 0xce, 0x4c, 0x4b, 0x2b, 0x5e, 0xec, 0xdd, 0xfc, 0xff, 0x3f, - 0xf3, 0xe7, 0x7c, 0x93, 0xe1, 0xc3, 0xc9, 0x72, 0x01, 0xc9, 0x97, 0xb9, 0x51, 0x50, 0x37, 0xc9, - 0xe2, 0xac, 0x00, 0xcc, 0xcf, 0x36, 0x3a, 0xae, 0x6a, 0x8b, 0x56, 0xdc, 0x6f, 0xf7, 0xc4, 0x1b, - 0xcf, 0xef, 0x19, 0xfe, 0x60, 0x3c, 0x1c, 0x91, 0x27, 0x24, 0xef, 0xe5, 0x4a, 0xd5, 0xd0, 0x34, - 0x92, 0x0d, 0xd8, 0xe9, 0x9d, 0x74, 0x23, 0xdb, 0x64, 0x66, 0x8d, 0x9e, 0x40, 0x2d, 0x0f, 0x5c, - 0xe2, 0xa5, 0x78, 0xc4, 0x6f, 0x6b, 0x05, 0x06, 0x35, 0x2e, 0x65, 0x97, 0xa2, 0xad, 0x16, 0x82, - 0x07, 0x53, 0x3b, 0xb6, 0x32, 0x20, 0x9f, 0xd6, 0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e, 0xdb, 0xb5, 0x05, - 0xf4, 0x57, 0x15, 0xec, 0x00, 0x9e, 0x93, 0x75, 0x31, 0xfa, 0xb9, 0x8a, 0xd8, 0xf5, 0x2a, 0x62, - 0x7f, 0x56, 0x11, 0xfb, 0xb6, 0x8e, 0x3a, 0xd7, 0xeb, 0xa8, 0xf3, 0x6b, 0x1d, 0x75, 0x3e, 0x3f, - 0x1f, 0x6b, 0xbc, 0x9c, 0x17, 0x71, 0x69, 0x67, 0xc9, 0xdb, 0x4f, 0x1f, 0x5f, 0xbd, 0x03, 0xbc, - 0xb2, 0xf5, 0x24, 0x29, 0x2f, 0x73, 0x6d, 0x92, 0xaf, 0xdb, 0x67, 0x8c, 0xcb, 0x0a, 0x9a, 0x22, - 0xa4, 0xd7, 0xfb, 0xf2, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x7f, 0x53, 0xc1, 0xe3, 0x02, - 0x00, 0x00, + // 409 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x92, 0x41, 0x6b, 0xd4, 0x40, + 0x14, 0xc7, 0x77, 0xda, 0x98, 0xb5, 0xd3, 0xaa, 0x38, 0xa8, 0x1d, 0x3c, 0x84, 0x35, 0x20, 0x14, + 0x91, 0x0d, 0x45, 0xf0, 0xde, 0x82, 0x0b, 0x22, 0x88, 0x44, 0x10, 0xf4, 0x12, 0x26, 0x99, 0xe7, + 0x76, 0xd8, 0xec, 0x4c, 0x98, 0x79, 0xd9, 0xba, 0x57, 0x3f, 0x81, 0x1f, 0xc5, 0xcf, 0xe0, 0xc9, + 0x63, 0x8f, 0x1e, 0x65, 0xf7, 0x8b, 0x48, 0x66, 0xb2, 0x75, 0x73, 0x9b, 0xff, 0xff, 0xff, 0x78, + 0xf9, 0xff, 0xc2, 0xa3, 0xe9, 0x62, 0xbd, 0x82, 0xec, 0x6b, 0xab, 0x25, 0x58, 0x97, 0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 0x28, 0xea, 0xc2, 0x7f, 0x53, 0x7a, 0xd4, 0x28, 0x3f, 0xf6, 0x9e, 0xff, + 0xd9, 0x32, 0xfd, 0x4e, 0xe8, 0x49, 0x5f, 0xf9, 0x23, 0x0a, 0x84, 0xfd, 0x42, 0x64, 0x50, 0xe8, + 0x35, 0x3d, 0x15, 0x15, 0xaa, 0x15, 0x14, 0x43, 0x2e, 0x70, 0xfc, 0x60, 0x72, 0x78, 0x76, 0x94, + 0x3f, 0x0e, 0xf1, 0x6c, 0x9f, 0x0f, 0xdc, 0xff, 0x12, 0x03, 0x9c, 0x50, 0xe2, 0xc2, 0x5b, 0x97, + 0xb3, 0xdf, 0x9b, 0x84, 0xdc, 0x6c, 0x12, 0xf2, 0x77, 0x93, 0x90, 0x1f, 0xdb, 0x64, 0x74, 0xb3, + 0x4d, 0x46, 0x7f, 0xb6, 0xc9, 0xe8, 0xcb, 0xcb, 0xb9, 0xc2, 0xab, 0xb6, 0x9c, 0x56, 0x66, 0x99, + 0xbd, 0xfb, 0xfc, 0xe9, 0xcd, 0x7b, 0xc0, 0x6b, 0x63, 0x17, 0x59, 0x75, 0x25, 0x94, 0xce, 0xbe, + 0xdd, 0x9e, 0x1a, 0xae, 0x1b, 0x70, 0x65, 0xec, 0x2f, 0xec, 0xd5, 0xbf, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x49, 0x3b, 0xb1, 0x5c, 0x87, 0x02, 0x00, 0x00, } func (m *Funder) Marshal() (dAtA []byte, err error) { @@ -467,32 +456,13 @@ func (m *FundingState) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.TotalAmount != 0 { i = encodeVarintFunders(dAtA, i, uint64(m.TotalAmount)) i-- - dAtA[i] = 0x20 - } - if len(m.InactiveFundings) > 0 { - for iNdEx := len(m.InactiveFundings) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.InactiveFundings[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintFunders(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } + dAtA[i] = 0x18 } - if len(m.ActiveFundings) > 0 { - for iNdEx := len(m.ActiveFundings) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ActiveFundings[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintFunders(dAtA, i, uint64(size)) - } + if len(m.ActiveFunderAddresses) > 0 { + for iNdEx := len(m.ActiveFunderAddresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ActiveFunderAddresses[iNdEx]) + copy(dAtA[i:], m.ActiveFunderAddresses[iNdEx]) + i = encodeVarintFunders(dAtA, i, uint64(len(m.ActiveFunderAddresses[iNdEx]))) i-- dAtA[i] = 0x12 } @@ -587,15 +557,9 @@ func (m *FundingState) Size() (n int) { if m.PoolId != 0 { n += 1 + sovFunders(uint64(m.PoolId)) } - if len(m.ActiveFundings) > 0 { - for _, e := range m.ActiveFundings { - l = e.Size() - n += 1 + l + sovFunders(uint64(l)) - } - } - if len(m.InactiveFundings) > 0 { - for _, e := range m.InactiveFundings { - l = e.Size() + if len(m.ActiveFunderAddresses) > 0 { + for _, s := range m.ActiveFunderAddresses { + l = len(s) n += 1 + l + sovFunders(uint64(l)) } } @@ -1093,9 +1057,9 @@ func (m *FundingState) Unmarshal(dAtA []byte) error { } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ActiveFundings", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ActiveFunderAddresses", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowFunders @@ -1105,61 +1069,25 @@ func (m *FundingState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthFunders } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthFunders } if postIndex > l { return io.ErrUnexpectedEOF } - m.ActiveFundings = append(m.ActiveFundings, &Funding{}) - if err := m.ActiveFundings[len(m.ActiveFundings)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ActiveFunderAddresses = append(m.ActiveFunderAddresses, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InactiveFundings", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFunders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthFunders - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthFunders - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InactiveFundings = append(m.InactiveFundings, &Funding{}) - if err := m.InactiveFundings[len(m.InactiveFundings)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TotalAmount", wireType) } diff --git a/x/funders/types/genesis.go b/x/funders/types/genesis.go index b89c5f17..625fe8dc 100644 --- a/x/funders/types/genesis.go +++ b/x/funders/types/genesis.go @@ -12,6 +12,6 @@ func DefaultGenesis() *GenesisState { // failure. func (gs GenesisState) Validate() error { // this line is used by starport scaffolding # genesis/types/validate - + // TODO: check funders (not more than allowed) return gs.Params.Validate() } diff --git a/x/funders/types/keys.go b/x/funders/types/keys.go index 64cce341..f4a7b267 100644 --- a/x/funders/types/keys.go +++ b/x/funders/types/keys.go @@ -61,6 +61,10 @@ func FundingKeyByPool(funderAddress string, poolId uint64) []byte { return util.GetByteKey(poolId, funderAddress) } +func FundingKeyByPoolOnly(poolId uint64) []byte { + return util.GetByteKey(poolId) +} + func FundingStateKey(poolId uint64) []byte { return util.GetByteKey(poolId) } diff --git a/x/funders/types/message_create_funder.go b/x/funders/types/message_create_funder.go index 99e5e5e3..fc8046be 100644 --- a/x/funders/types/message_create_funder.go +++ b/x/funders/types/message_create_funder.go @@ -36,6 +36,9 @@ func (msg *MsgCreateFunder) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) } + if msg.Moniker == "" { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "moniker cannot be empty") + } return nil } diff --git a/x/pool/types/message_defund_pool.go b/x/funders/types/message_defund_pool.go similarity index 61% rename from x/pool/types/message_defund_pool.go rename to x/funders/types/message_defund_pool.go index ba6a2b63..fe611bb9 100644 --- a/x/pool/types/message_defund_pool.go +++ b/x/funders/types/message_defund_pool.go @@ -2,24 +2,15 @@ package types import ( "cosmossdk.io/errors" + "github.com/KYVENetwork/chain/util" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) var ( - _ legacytx.LegacyMsg = &MsgDefundPool{} - _ sdk.Msg = &MsgDefundPool{} + _ sdk.Msg = &MsgDefundPool{} ) -func NewMsgDefundPool(creator string, id uint64, amount uint64) *MsgDefundPool { - return &MsgDefundPool{ - Creator: creator, - Id: id, - Amount: amount, - } -} - func (msg *MsgDefundPool) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) return sdk.MustSortJSON(bz) @@ -39,13 +30,21 @@ func (msg *MsgDefundPool) Route() string { } func (msg *MsgDefundPool) Type() string { - return "kyve/pool/MsgDefundPool" + return "kyve/funders/MsgDefundPool" } func (msg *MsgDefundPool) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Creator) - if err != nil { - return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address (%s)", err) + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) } + + if util.ValidatePositiveNumber(msg.PoolId) != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid pool id") + } + + if util.ValidateNumber(msg.Amount) != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid amount") + } + return nil } diff --git a/x/funders/types/message_update_funder.go b/x/funders/types/message_update_funder.go new file mode 100644 index 00000000..86bcc42a --- /dev/null +++ b/x/funders/types/message_update_funder.go @@ -0,0 +1,41 @@ +package types + +import ( + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" +) + +var ( + _ sdk.Msg = &MsgUpdateFunder{} +) + +func (msg *MsgUpdateFunder) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUpdateFunder) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{creator} +} + +func (msg *MsgUpdateFunder) Route() string { + return RouterKey +} + +func (msg *MsgUpdateFunder) Type() string { + return "kyve/funders/MsgUpdateFunder" +} + +func (msg *MsgUpdateFunder) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) + } + + return nil +} diff --git a/x/funders/types/tx.pb.go b/x/funders/types/tx.pb.go index cb7ce31f..2d42010c 100644 --- a/x/funders/types/tx.pb.go +++ b/x/funders/types/tx.pb.go @@ -526,36 +526,37 @@ func init() { func init() { proto.RegisterFile("kyve/funders/v1beta1/tx.proto", fileDescriptor_5145d80c2db97f3d) } var fileDescriptor_5145d80c2db97f3d = []byte{ - // 458 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x54, 0xcb, 0x6e, 0xd3, 0x40, - 0x14, 0x8d, 0x5b, 0x93, 0x94, 0x5b, 0x50, 0xc5, 0x40, 0x89, 0x89, 0x84, 0x55, 0x82, 0x90, 0x78, - 0xda, 0x2a, 0xfc, 0x41, 0x81, 0x4a, 0x08, 0x05, 0x55, 0x96, 0x40, 0xd0, 0x05, 0x91, 0x1f, 0xb7, - 0xee, 0x28, 0xc9, 0x5c, 0x6b, 0x66, 0xd2, 0x36, 0x7b, 0x3e, 0x80, 0x9f, 0xe0, 0x5f, 0x90, 0xd8, - 0x74, 0xc9, 0x12, 0x25, 0x3f, 0x82, 0x3c, 0x7e, 0xe0, 0x56, 0x14, 0xb2, 0x60, 0xc5, 0x6e, 0xce, - 0x3d, 0x67, 0xce, 0xbd, 0x67, 0x34, 0x33, 0x70, 0x7b, 0x34, 0x3b, 0x42, 0xff, 0x60, 0x2a, 0x12, - 0x94, 0xca, 0x3f, 0xda, 0x8e, 0x50, 0x87, 0xdb, 0xbe, 0x3e, 0xf1, 0x32, 0x49, 0x9a, 0xd8, 0x8d, - 0x9c, 0xf6, 0x4a, 0xda, 0x2b, 0xe9, 0xfe, 0x37, 0x0b, 0x36, 0x06, 0x2a, 0x7d, 0x2e, 0x31, 0xd4, - 0xb8, 0x6b, 0x48, 0xe6, 0x40, 0x27, 0xce, 0x31, 0x49, 0xc7, 0xda, 0xb2, 0xee, 0x5f, 0x0e, 0x2a, - 0x98, 0x33, 0x13, 0x12, 0x7c, 0x84, 0xd2, 0x59, 0x29, 0x98, 0x12, 0xb2, 0x1e, 0xac, 0xf1, 0x04, - 0x85, 0xe6, 0x7a, 0xe6, 0xac, 0x1a, 0xaa, 0xc6, 0x8c, 0x81, 0x3d, 0xa6, 0x94, 0x1c, 0xdb, 0xd4, - 0xcd, 0x3a, 0x77, 0x3a, 0xc6, 0x48, 0x71, 0x8d, 0xce, 0xa5, 0xc2, 0xa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xe3, 0xe4, 0xee, 0x5e, 0xb8, 0xf1, 0x97, 0xa8, 0xf7, 0x68, 0x09, 0x51, 0xe5, 0xbf, - 0xb3, 0xfb, 0x75, 0xee, 0x5a, 0xa7, 0x73, 0xd7, 0xfa, 0x31, 0x77, 0xad, 0xcf, 0x0b, 0xb7, 0x75, - 0xba, 0x70, 0x5b, 0xdf, 0x17, 0x6e, 0x6b, 0xff, 0x71, 0xca, 0xf5, 0xe1, 0x34, 0xf2, 0x62, 0x9a, - 0xf8, 0xaf, 0x3f, 0xbc, 0x7b, 0xf9, 0x06, 0xf5, 0x31, 0xc9, 0x91, 0x1f, 0x1f, 0x86, 0x5c, 0xf8, - 0x27, 0xf5, 0xaf, 0xa3, 0x67, 0x19, 0xaa, 0xa8, 0x6d, 0x7e, 0x9c, 0x67, 0x3f, 0x03, 0x00, 0x00, - 0xff, 0xff, 0xc5, 0x05, 0x8e, 0x7f, 0x92, 0x04, 0x00, 0x00, + // 470 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x54, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0x8d, 0x89, 0x49, 0xca, 0x14, 0x54, 0xb1, 0x50, 0x62, 0x22, 0x61, 0x95, 0x20, 0x24, 0x3e, + 0x6d, 0x15, 0xfe, 0x41, 0x81, 0x4a, 0x08, 0x05, 0x55, 0x96, 0x40, 0xd0, 0x03, 0x91, 0xed, 0x9d, + 0xba, 0xab, 0x24, 0xbb, 0xd6, 0xee, 0xa6, 0x6d, 0xee, 0xdc, 0xb8, 0xf0, 0xb3, 0x90, 0xb8, 0xf4, + 0xc8, 0x11, 0x25, 0x7f, 0x04, 0x79, 0xfd, 0x81, 0x53, 0x35, 0x25, 0x07, 0x4e, 0xbd, 0xf9, 0xcd, + 0x7b, 0x3b, 0x6f, 0x9f, 0x66, 0xbc, 0x70, 0x6f, 0x38, 0x3d, 0x42, 0xff, 0x60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x5e, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xf5, 0xee, + 0x83, 0x69, 0xf8, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -573,7 +574,7 @@ type MsgClient interface { // CreateFunder ... CreateFunder(ctx context.Context, in *MsgCreateFunder, opts ...grpc.CallOption) (*MsgCreateFunderResponse, error) // UpdateFunder ... - // rpc UpdateFunder(MsgUpdateFunder) returns (MsgUpdateFunderResponse); + UpdateFunder(ctx context.Context, in *MsgUpdateFunder, opts ...grpc.CallOption) (*MsgUpdateFunderResponse, error) // FundPool ... FundPool(ctx context.Context, in *MsgFundPool, opts ...grpc.CallOption) (*MsgFundPoolResponse, error) // DefundPool ... @@ -597,6 +598,15 @@ func (c *msgClient) CreateFunder(ctx context.Context, in *MsgCreateFunder, opts return out, nil } +func (c *msgClient) UpdateFunder(ctx context.Context, in *MsgUpdateFunder, opts ...grpc.CallOption) (*MsgUpdateFunderResponse, error) { + out := new(MsgUpdateFunderResponse) + err := c.cc.Invoke(ctx, "/kyve.funders.v1beta1.Msg/UpdateFunder", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) FundPool(ctx context.Context, in *MsgFundPool, opts ...grpc.CallOption) (*MsgFundPoolResponse, error) { out := new(MsgFundPoolResponse) err := c.cc.Invoke(ctx, "/kyve.funders.v1beta1.Msg/FundPool", in, out, opts...) @@ -620,7 +630,7 @@ type MsgServer interface { // CreateFunder ... CreateFunder(context.Context, *MsgCreateFunder) (*MsgCreateFunderResponse, error) // UpdateFunder ... - // rpc UpdateFunder(MsgUpdateFunder) returns (MsgUpdateFunderResponse); + UpdateFunder(context.Context, *MsgUpdateFunder) (*MsgUpdateFunderResponse, error) // FundPool ... FundPool(context.Context, *MsgFundPool) (*MsgFundPoolResponse, error) // DefundPool ... @@ -634,6 +644,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) CreateFunder(ctx context.Context, req *MsgCreateFunder) (*MsgCreateFunderResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateFunder not implemented") } +func (*UnimplementedMsgServer) UpdateFunder(ctx context.Context, req *MsgUpdateFunder) (*MsgUpdateFunderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateFunder not implemented") +} func (*UnimplementedMsgServer) FundPool(ctx context.Context, req *MsgFundPool) (*MsgFundPoolResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FundPool not implemented") } @@ -663,6 +676,24 @@ func _Msg_CreateFunder_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_UpdateFunder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateFunder) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateFunder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kyve.funders.v1beta1.Msg/UpdateFunder", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateFunder(ctx, req.(*MsgUpdateFunder)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_FundPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgFundPool) if err := dec(in); err != nil { @@ -707,6 +738,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "CreateFunder", Handler: _Msg_CreateFunder_Handler, }, + { + MethodName: "UpdateFunder", + Handler: _Msg_UpdateFunder_Handler, + }, { MethodName: "FundPool", Handler: _Msg_FundPool_Handler, diff --git a/x/pool/client/cli/tx.go b/x/pool/client/cli/tx.go index bc7c3b03..a6298b9c 100644 --- a/x/pool/client/cli/tx.go +++ b/x/pool/client/cli/tx.go @@ -18,8 +18,5 @@ func GetTxCmd() *cobra.Command { RunE: client.ValidateCmd, } - cmd.AddCommand(CmdFundPool()) - cmd.AddCommand(CmdDefundPool()) - return cmd } diff --git a/x/pool/spec/02_state.md b/x/pool/spec/02_state.md index 17c51672..2aae48cb 100644 --- a/x/pool/spec/02_state.md +++ b/x/pool/spec/02_state.md @@ -113,10 +113,8 @@ message Pool { // disabled ... bool disabled = 15; - // funders ... - repeated Funder funders = 16; - // total_funds ... - uint64 total_funds = 17; + // old funders and total_funds fields + reserved 16, 17; // protocol ... Protocol protocol = 18; diff --git a/x/pool/types/codec.go b/x/pool/types/codec.go index b6f742a4..1bb09ac4 100644 --- a/x/pool/types/codec.go +++ b/x/pool/types/codec.go @@ -7,15 +7,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgFundPool{}, "kyve/pool/MsgFundPool", nil) - cdc.RegisterConcrete(&MsgDefundPool{}, "kyve/pool/MsgDefundPool", nil) +func RegisterLegacyAminoCodec(_ *codec.LegacyAmino) { } func RegisterInterfaces(registry codecTypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), &MsgFundPool{}) - registry.RegisterImplementations((*sdk.Msg)(nil), &MsgDefundPool{}) - registry.RegisterImplementations((*sdk.Msg)(nil), &MsgCreatePool{}) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUpdatePool{}) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgDisablePool{}) diff --git a/x/pool/types/events.pb.go b/x/pool/types/events.pb.go index 8dac4bcd..383d3838 100644 --- a/x/pool/types/events.pb.go +++ b/x/pool/types/events.pb.go @@ -723,53 +723,6 @@ func (m *EventPoolFundsSlashed) GetAmount() uint64 { return 0 } -// EventPoolOutOfFunds is an event emitted when a pool has run out of funds -// emitted_by: MsgSubmitBundleProposal -type EventPoolOutOfFunds struct { - // pool_id is the unique ID of the pool. - PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` -} - -func (m *EventPoolOutOfFunds) Reset() { *m = EventPoolOutOfFunds{} } -func (m *EventPoolOutOfFunds) String() string { return proto.CompactTextString(m) } -func (*EventPoolOutOfFunds) ProtoMessage() {} -func (*EventPoolOutOfFunds) Descriptor() ([]byte, []int) { - return fileDescriptor_c1828a100d789238, []int{8} -} -func (m *EventPoolOutOfFunds) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventPoolOutOfFunds) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventPoolOutOfFunds.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventPoolOutOfFunds) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventPoolOutOfFunds.Merge(m, src) -} -func (m *EventPoolOutOfFunds) XXX_Size() int { - return m.Size() -} -func (m *EventPoolOutOfFunds) XXX_DiscardUnknown() { - xxx_messageInfo_EventPoolOutOfFunds.DiscardUnknown(m) -} - -var xxx_messageInfo_EventPoolOutOfFunds proto.InternalMessageInfo - -func (m *EventPoolOutOfFunds) GetPoolId() uint64 { - if m != nil { - return m.PoolId - } - return 0 -} - func init() { proto.RegisterType((*EventUpdateParams)(nil), "kyve.pool.v1beta1.EventUpdateParams") proto.RegisterType((*EventCreatePool)(nil), "kyve.pool.v1beta1.EventCreatePool") @@ -779,62 +732,60 @@ func init() { proto.RegisterType((*EventRuntimeUpgradeCancelled)(nil), "kyve.pool.v1beta1.EventRuntimeUpgradeCancelled") proto.RegisterType((*EventPoolUpdated)(nil), "kyve.pool.v1beta1.EventPoolUpdated") proto.RegisterType((*EventPoolFundsSlashed)(nil), "kyve.pool.v1beta1.EventPoolFundsSlashed") - proto.RegisterType((*EventPoolOutOfFunds)(nil), "kyve.pool.v1beta1.EventPoolOutOfFunds") } func init() { proto.RegisterFile("kyve/pool/v1beta1/events.proto", fileDescriptor_c1828a100d789238) } var fileDescriptor_c1828a100d789238 = []byte{ - // 769 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcd, 0x6e, 0xeb, 0x44, - 0x14, 0x8e, 0x93, 0x34, 0x6d, 0x26, 0x4d, 0x42, 0x7c, 0xf9, 0x31, 0x05, 0x85, 0x10, 0x74, 0xa1, - 0xb0, 0x70, 0x74, 0x61, 0x8f, 0x44, 0x73, 0x8b, 0x14, 0x55, 0xa2, 0x55, 0xa2, 0x22, 0xc1, 0xc6, - 0x9a, 0x78, 0x4e, 0x9c, 0x51, 0xed, 0x19, 0x6b, 0x66, 0x9c, 0x34, 0x7d, 0x0a, 0x9e, 0x80, 0x37, - 0xe0, 0x2d, 0x58, 0x74, 0xd9, 0x05, 0x0b, 0x56, 0x08, 0xb5, 0x2f, 0x82, 0x66, 0xfc, 0x43, 0xd2, - 0xba, 0xa8, 0x4b, 0x76, 0x3e, 0xdf, 0xf9, 0xe6, 0x9c, 0x33, 0xe7, 0x9b, 0x4f, 0x46, 0xfd, 0xab, - 0xcd, 0x0a, 0x46, 0x31, 0xe7, 0xe1, 0x68, 0xf5, 0x66, 0x0e, 0x0a, 0xbf, 0x19, 0xc1, 0x0a, 0x98, - 0x92, 0x6e, 0x2c, 0xb8, 0xe2, 0x76, 0x4f, 0xe7, 0x5d, 0x9d, 0x77, 0xb3, 0xfc, 0xd1, 0xbb, 0x01, - 0x0f, 0xb8, 0xc9, 0x8e, 0xf4, 0x57, 0x4a, 0x3c, 0x2a, 0x29, 0x14, 0x63, 0x81, 0xa3, 0xac, 0xd0, - 0xf0, 0x37, 0x0b, 0xf5, 0x4e, 0x75, 0xe5, 0xcb, 0x98, 0x60, 0x05, 0x17, 0x26, 0x67, 0x7f, 0x8b, - 0x10, 0x0f, 0x89, 0x97, 0x32, 0x1d, 0x6b, 0x60, 0x1d, 0xb7, 0xbe, 0xfe, 0xd0, 0x7d, 0xd2, 0xd3, - 0x4d, 0xe9, 0x27,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26, 0x73, 0xd7, 0xe7, 0xd1, 0xe8, 0xec, 0xa7, 0x1f, 0x4f, 0x7f, 0x00, 0xb5, 0xe6, - 0xe2, 0x6a, 0xe4, 0x2f, 0x31, 0x65, 0xa3, 0xeb, 0xf4, 0x07, 0xa4, 0x36, 0x31, 0xc8, 0x79, 0xc3, - 0xfc, 0x78, 0xbe, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0x43, 0x39, 0xc6, 0x3f, 0xe3, 0x06, 0x00, - 0x00, + // 756 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcd, 0x6e, 0xdb, 0x38, + 0x10, 0xb6, 0x6c, 0xc7, 0x89, 0xe9, 0xd8, 0x5e, 0x6b, 0xff, 0xb4, 0xd9, 0x85, 0xd7, 0xeb, 0x45, + 0x76, 0xb3, 0x7b, 0xb0, 0x91, 0xf6, 0x5e, 0xa0, 0x71, 0x52, 0xc0, 0x08, 0x50, 0x04, 0x36, 0x52, + 0xa0, 0xbd, 0x08, 0xb4, 0x38, 0x91, 0x89, 0x48, 0xa4, 0x40, 0x52, 0x76, 0x9c, 0xa7, 0xe8, 0x13, + 0xf4, 0x0d, 0xfa, 0x16, 0x3d, 0xe4, 0x98, 0x43, 0x0f, 0x3d, 0x15, 0x45, 0xf2, 0x22, 0x05, 0x29, + 0xc9, 0xb5, 0x13, 0xb5, 0xc8, 0xb1, 0x37, 0xcd, 0x37, 0xdf, 0x0c, 0x87, 0xf3, 0xf1, 0x83, 0x50, + 0xfb, 0x7c, 0x31, 0x83, 0x7e, 0xc4, 0x79, 0xd0, 0x9f, 0xed, 0x4f, 0x40, 0xe1, 0xfd, 0x3e, 0xcc, + 0x80, 0x29, 0xd9, 0x8b, 0x04, 0x57, 0xdc, 0x6e, 0xe9, 0x7c, 0x4f, 0xe7, 0x7b, 0x69, 0x7e, 0xe7, + 0x27, 0x9f, 0xfb, 0x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 0x07, 0x83, 0xab, 0x9b, 0xb6, 0x75, 0x7d, 0xd3, + 0xb6, 0x3e, 0xdd, 0xb4, 0xad, 0xd7, 0xb7, 0xed, 0xc2, 0xf5, 0x6d, 0xbb, 0xf0, 0xe1, 0xb6, 0x5d, + 0x78, 0xf5, 0x9f, 0x4f, 0xd5, 0x34, 0x9e, 0xf4, 0x3c, 0x1e, 0xf6, 0x8f, 0x5f, 0xbe, 0x38, 0x7a, + 0x0e, 0x6a, 0xce, 0xc5, 0x79, 0xdf, 0x9b, 0x62, 0xca, 0xfa, 0x17, 0xc9, 0x0f, 0x45, 0x2d, 0x22, + 0x90, 0x93, 0x8a, 0xf9, 0x91, 0x3c, 0xfe, 0x1c, 0x00, 0x00, 0xff, 0xff, 0xb6, 0x61, 0x64, 0x6f, + 0xb3, 0x06, 0x00, 0x00, } func (m *EventUpdateParams) Marshal() (dAtA []byte, err error) { @@ -1303,34 +1254,6 @@ func (m *EventPoolFundsSlashed) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *EventPoolOutOfFunds) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventPoolOutOfFunds) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventPoolOutOfFunds) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.PoolId != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.PoolId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { offset -= sovEvents(v) base := offset @@ -1564,18 +1487,6 @@ func (m *EventPoolFundsSlashed) Size() (n int) { return n } -func (m *EventPoolOutOfFunds) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PoolId != 0 { - n += 1 + sovEvents(uint64(m.PoolId)) - } - return n -} - func sovEvents(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3156,75 +3067,6 @@ func (m *EventPoolFundsSlashed) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventPoolOutOfFunds) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventPoolOutOfFunds: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventPoolOutOfFunds: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) - } - m.PoolId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PoolId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipEvents(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvents - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipEvents(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/pool/types/genesis.go b/x/pool/types/genesis.go index a2838aec..db38b8ed 100644 --- a/x/pool/types/genesis.go +++ b/x/pool/types/genesis.go @@ -2,7 +2,6 @@ package types import ( "fmt" - fundersTypes "github.com/KYVENetwork/chain/x/funders/types" ) // DefaultGenesis returns the default Capability genesis state @@ -27,9 +26,10 @@ func (gs GenesisState) Validate() error { if elem.Id >= gs.PoolCount { return fmt.Errorf("pool id higher than pool count %v", elem) } - if len(elem.Funders) > fundersTypes.MaxFunders { - return fmt.Errorf("more funders than allowed %v", elem) - } + // TODO: fix this + //if len(elem.Funders) > fundersTypes.MaxFunders { + // return fmt.Errorf("more funders than allowed %v", elem) + //} } return gs.Params.Validate() diff --git a/x/pool/types/message_fund_pool.go b/x/pool/types/message_fund_pool.go deleted file mode 100644 index 61c716f8..00000000 --- a/x/pool/types/message_fund_pool.go +++ /dev/null @@ -1,56 +0,0 @@ -package types - -import ( - "cosmossdk.io/errors" - "github.com/KYVENetwork/chain/util" - sdk "github.com/cosmos/cosmos-sdk/types" - errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" -) - -var ( - _ legacytx.LegacyMsg = &MsgFundPool{} - _ sdk.Msg = &MsgFundPool{} -) - -func NewMsgFundPool(creator string, id uint64, amount uint64) *MsgFundPool { - return &MsgFundPool{ - Creator: creator, - Id: id, - Amount: amount, - } -} - -func (msg *MsgFundPool) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgFundPool) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromBech32(msg.Creator) - if err != nil { - panic(err) - } - - return []sdk.AccAddress{creator} -} - -func (msg *MsgFundPool) Route() string { - return RouterKey -} - -func (msg *MsgFundPool) Type() string { - return "kyve/pool/MsgFundPool" -} - -func (msg *MsgFundPool) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { - return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) - } - - if util.ValidateNumber(msg.Amount) != nil { - return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid amount") - } - - return nil -} diff --git a/x/pool/types/pool.go b/x/pool/types/pool.go index b9e46dbe..47eaaf77 100644 --- a/x/pool/types/pool.go +++ b/x/pool/types/pool.go @@ -2,84 +2,12 @@ package types import ( "fmt" - "math" - sdk "github.com/cosmos/cosmos-sdk/types" authTypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) -// Handles the funders of a pool. Functions safely add and remove funds to funders. -// If amount drops to zero the funder is automatically removed from the list. - -// AddAmountToFunder adds the given amount to an existing funder. -// If the funder does not exist, a new funder is inserted. -func (m *Pool) AddAmountToFunder(funderAddress string, amount uint64) { - for _, v := range m.Funders { - if v.Address == funderAddress { - m.TotalFunds += amount - v.Amount += amount - return - } - } - if amount > 0 { - // Funder was not found, insert new funder - m.Funders = append(m.Funders, &Funder{ - Address: funderAddress, - Amount: amount, - }) - m.TotalFunds += amount - } -} - -// SubtractAmountFromFunder subtracts the given amount form an existing funder -// If the amount is grater or equal to the funders amount, the funder is removed. -func (m *Pool) SubtractAmountFromFunder(funderAddress string, amount uint64) { - for i := range m.Funders { - if m.Funders[i].Address == funderAddress { - if m.Funders[i].Amount > amount { - m.TotalFunds -= amount - m.Funders[i].Amount -= amount - } else { - m.TotalFunds -= m.Funders[i].Amount - - // Remove funder - m.Funders[i] = m.Funders[len(m.Funders)-1] - m.Funders = m.Funders[:len(m.Funders)-1] - } - return - } - } -} - -func (m *Pool) RemoveFunder(funderAddress string) { - m.SubtractAmountFromFunder(funderAddress, math.MaxUint64) -} - -func (m *Pool) GetFunderAmount(address string) uint64 { - for _, v := range m.Funders { - if v.Address == address { - return v.Amount - } - } - return 0 -} - func (m *Pool) GetPoolAccount() sdk.AccAddress { name := fmt.Sprintf("%s/%d", ModuleName, m.Id) return authTypes.NewModuleAddress(name) } - -func (m *Pool) GetLowestFunder() Funder { - if len(m.Funders) == 0 { - return Funder{} - } - - lowestFunder := m.Funders[0] - for _, v := range m.Funders { - if v.Amount < lowestFunder.Amount { - lowestFunder = v - } - } - return *lowestFunder -} diff --git a/x/query/keeper/grpc_account_assets.go b/x/query/keeper/grpc_account_assets.go index b5c30b45..f02ca20f 100644 --- a/x/query/keeper/grpc_account_assets.go +++ b/x/query/keeper/grpc_account_assets.go @@ -74,9 +74,10 @@ func (k Keeper) AccountAssets(goCtx context.Context, req *types.QueryAccountAsse // =============== // Iterate all pools and look if the user is funding - for _, pool := range k.poolKeeper.GetAllPools(ctx) { - response.ProtocolFunding += pool.GetFunderAmount(req.Address) - } + // TODO(rapha): fix this + //for _, pool := range k.poolKeeper.GetAllPools(ctx) { + // response.ProtocolFunding += pool.GetFunderAmount(req.Address) + //} return &response, nil } diff --git a/x/query/keeper/grpc_account_funded.go b/x/query/keeper/grpc_account_funded.go index 73d48bee..ed30e273 100644 --- a/x/query/keeper/grpc_account_funded.go +++ b/x/query/keeper/grpc_account_funded.go @@ -21,19 +21,23 @@ func (k Keeper) AccountFundedList(goCtx context.Context, req *types.QueryAccount for i := range pools { pool := pools[i] - amount := pool.GetFunderAmount(req.Address) + // TODO(rapha): fix this + //amount := pool.GetFunderAmount(req.Address) + amount := uint64(0) if amount > 0 { funded = append(funded, types.Funded{ Amount: amount, Pool: &types.BasicPool{ - Id: pool.Id, - Name: pool.Name, - Runtime: pool.Runtime, - Logo: pool.Logo, - OperatingCost: pool.OperatingCost, - UploadInterval: pool.UploadInterval, - TotalFunds: pool.TotalFunds, + Id: pool.Id, + Name: pool.Name, + Runtime: pool.Runtime, + Logo: pool.Logo, + OperatingCost: pool.OperatingCost, + UploadInterval: pool.UploadInterval, + // TODO(rapha): fix this + TotalFunds: 0, + //TotalFunds: pool.TotalFunds, TotalDelegation: k.delegationKeeper.GetDelegationOfPool(ctx, pool.Id), Status: k.GetPoolStatus(ctx, &pool), }, diff --git a/x/query/keeper/helper.go b/x/query/keeper/helper.go index 0536becd..c0359469 100644 --- a/x/query/keeper/helper.go +++ b/x/query/keeper/helper.go @@ -44,13 +44,14 @@ func (k Keeper) GetFullStaker(ctx sdk.Context, stakerAddress string) *types.Full poolMemberships = append( poolMemberships, &types.PoolMembership{ Pool: &types.BasicPool{ - Id: pool.Id, - Name: pool.Name, - Runtime: pool.Runtime, - Logo: pool.Logo, - OperatingCost: pool.OperatingCost, - UploadInterval: pool.UploadInterval, - TotalFunds: pool.TotalFunds, + Id: pool.Id, + Name: pool.Name, + Runtime: pool.Runtime, + Logo: pool.Logo, + OperatingCost: pool.OperatingCost, + UploadInterval: pool.UploadInterval, + // TODO(rapha): fix this + //TotalFunds: pool.TotalFunds, TotalDelegation: k.delegationKeeper.GetDelegationOfPool(ctx, pool.Id), Status: k.GetPoolStatus(ctx, &pool), }, @@ -92,8 +93,9 @@ func (k Keeper) GetPoolStatus(ctx sdk.Context, pool *pooltypes.Pool) pooltypes.P poolStatus = pooltypes.POOL_STATUS_DISABLED } else if totalDelegation < pool.MinDelegation { poolStatus = pooltypes.POOL_STATUS_NOT_ENOUGH_DELEGATION - } else if pool.TotalFunds == 0 { - poolStatus = pooltypes.POOL_STATUS_NO_FUNDS + // TODO(rapha): fix this + //} else if pool.TotalFunds == 0 { + // poolStatus = pooltypes.POOL_STATUS_NO_FUNDS } else { poolStatus = pooltypes.POOL_STATUS_ACTIVE } From 88add2dc8f23d9d0d736cc675743295cdf76a124 Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 27 Sep 2023 14:35:05 +0200 Subject: [PATCH 021/109] fix: fixed some smaller issues --- app/modules.go | 2 ++ x/funders/keeper/getters_funder.go | 4 ++-- x/funders/keeper/getters_funding.go | 8 ++++---- x/funders/keeper/getters_funding_state.go | 6 +++--- x/funders/keeper/logic_funders.go | 6 +++--- x/funders/keeper/msg_server_create_funder.go | 2 +- x/funders/keeper/msg_server_defund_pool.go | 12 +++++++----- x/funders/keeper/msg_server_fund_pool.go | 13 +++++++------ x/funders/keeper/msg_server_update_funder.go | 4 ++-- x/funders/types/message_defund_pool.go | 4 ++-- x/funders/types/message_fund_pool.go | 2 +- 11 files changed, 34 insertions(+), 29 deletions(-) diff --git a/app/modules.go b/app/modules.go index 5a1a349f..cfcf3019 100644 --- a/app/modules.go +++ b/app/modules.go @@ -2,6 +2,7 @@ package app import ( "github.com/KYVENetwork/chain/x/funders" + fundersTypes "github.com/KYVENetwork/chain/x/funders/types" "github.com/cosmos/cosmos-sdk/types/module" // Auth @@ -154,6 +155,7 @@ var moduleAccountPermissions = map[string][]string{ poolTypes.ModuleName: nil, stakersTypes.ModuleName: nil, teamTypes.ModuleName: nil, + fundersTypes.ModuleName: nil, } // BlockedModuleAccountAddrs returns all the app's blocked module account addresses. diff --git a/x/funders/keeper/getters_funder.go b/x/funders/keeper/getters_funder.go index 4a92598a..c66bc7ed 100644 --- a/x/funders/keeper/getters_funder.go +++ b/x/funders/keeper/getters_funder.go @@ -28,9 +28,9 @@ func (k Keeper) GetFunder(ctx sdk.Context, funderAddress string) (funder types.F } // SetFunder sets a specific funder in the store from its index -func (k Keeper) setFunder(ctx sdk.Context, funder types.Funder) { +func (k Keeper) setFunder(ctx sdk.Context, funder *types.Funder) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FunderKeyPrefix) - b := k.cdc.MustMarshal(&funder) + b := k.cdc.MustMarshal(funder) store.Set(types.FunderKey( funder.Address, ), b) diff --git a/x/funders/keeper/getters_funding.go b/x/funders/keeper/getters_funding.go index da0d61c7..f6e430bd 100644 --- a/x/funders/keeper/getters_funding.go +++ b/x/funders/keeper/getters_funding.go @@ -13,7 +13,7 @@ func (k Keeper) DoesFundingExist(ctx sdk.Context, funderAddress string, poolId u } // GetFunding returns the funding -func (k Keeper) GetFunding(ctx sdk.Context, funderAddress string, poolId uint64) (funding *types.Funding, found bool) { +func (k Keeper) GetFunding(ctx sdk.Context, funderAddress string, poolId uint64) (funding types.Funding, found bool) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingKeyPrefixByFunder) b := store.Get(types.FundingKeyByFunder( @@ -24,12 +24,12 @@ func (k Keeper) GetFunding(ctx sdk.Context, funderAddress string, poolId uint64) return funding, false } - k.cdc.MustUnmarshal(b, funding) + k.cdc.MustUnmarshal(b, &funding) return funding, true } // GetFundingsOfPool returns all fundings of a pool -func (k Keeper) GetFundingsOfPool(ctx sdk.Context, poolId uint64) (fundings []*types.Funding) { +func (k Keeper) GetFundingsOfPool(ctx sdk.Context, poolId uint64) (fundings []types.Funding) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingKeyPrefixByPool) iterator := sdk.KVStorePrefixIterator(store, types.FundingKeyByPoolOnly(poolId)) @@ -39,7 +39,7 @@ func (k Keeper) GetFundingsOfPool(ctx sdk.Context, poolId uint64) (fundings []*t for ; iterator.Valid(); iterator.Next() { var funding types.Funding k.cdc.MustUnmarshal(iterator.Value(), &funding) - fundings = append(fundings, &funding) + fundings = append(fundings, funding) } return fundings } diff --git a/x/funders/keeper/getters_funding_state.go b/x/funders/keeper/getters_funding_state.go index 2c513f5c..5e043984 100644 --- a/x/funders/keeper/getters_funding_state.go +++ b/x/funders/keeper/getters_funding_state.go @@ -38,7 +38,7 @@ func (k Keeper) setFundingState(ctx sdk.Context, fundingState types.FundingState ), b) } -func (k Keeper) GetActiveFundings(ctx sdk.Context, fundingState types.FundingState) (fundings []*types.Funding) { +func (k Keeper) GetActiveFundings(ctx sdk.Context, fundingState types.FundingState) (fundings []types.Funding) { for _, funder := range fundingState.ActiveFunderAddresses { funding, found := k.GetFunding(ctx, funder, fundingState.PoolId) if found { @@ -50,14 +50,14 @@ func (k Keeper) GetActiveFundings(ctx sdk.Context, fundingState types.FundingSta // GetLowestFunding returns the funding with the lowest amount // Precondition: len(fundings) > 0 -func (k Keeper) GetLowestFunding(fundings []*types.Funding) (lowestFunding *types.Funding, err error) { +func (k Keeper) GetLowestFunding(fundings []types.Funding) (lowestFunding *types.Funding, err error) { if len(fundings) == 0 { return nil, errors.New(fmt.Sprintf("no active fundings")) } for _, funding := range fundings { if funding.Amount < lowestFunding.Amount { - lowestFunding = funding + lowestFunding = &funding } } return lowestFunding, nil diff --git a/x/funders/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go index 5e1c00f6..bc0b1271 100644 --- a/x/funders/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -18,7 +18,7 @@ func (k Keeper) ChargeFundersOfPool(ctx sdk.Context, poolId uint64) (payout uint // Get funding state for pool fundingState, found := k.GetFundingState(ctx, poolId) if !found { - return 0, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrFundingStateDoesNotExist.Error(), poolId) + return 0, errors.Wrapf(errorsTypes.ErrNotFound, types.ErrFundingStateDoesNotExist.Error(), poolId) } // If there are no active fundings we immediately return @@ -32,9 +32,9 @@ func (k Keeper) ChargeFundersOfPool(ctx sdk.Context, poolId uint64) (payout uint for _, funding := range activeFundings { payout += funding.ChargeOneBundle() if funding.Amount == 0 { - fundingState.SetInactive(funding) + fundingState.SetInactive(&funding) } - k.setFunding(ctx, funding) + k.setFunding(ctx, &funding) } // Save funding state diff --git a/x/funders/keeper/msg_server_create_funder.go b/x/funders/keeper/msg_server_create_funder.go index 2e0704bd..8bf2d464 100644 --- a/x/funders/keeper/msg_server_create_funder.go +++ b/x/funders/keeper/msg_server_create_funder.go @@ -21,7 +21,7 @@ func (k msgServer) CreateFunder(goCtx context.Context, msg *types.MsgCreateFunde } // Create new funder - k.setFunder(ctx, types.Funder{ + k.setFunder(ctx, &types.Funder{ Address: msg.Creator, Moniker: msg.Moniker, Identity: msg.Identity, diff --git a/x/funders/keeper/msg_server_defund_pool.go b/x/funders/keeper/msg_server_defund_pool.go index 9e0bd028..c1c095f2 100644 --- a/x/funders/keeper/msg_server_defund_pool.go +++ b/x/funders/keeper/msg_server_defund_pool.go @@ -20,7 +20,7 @@ func (k msgServer) DefundPool(goCtx context.Context, msg *types.MsgDefundPool) ( // Funding has to exist funding, found := k.GetFunding(ctx, msg.Creator, msg.PoolId) if !found { - return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrFundingDoesNotExist.Error(), msg.PoolId, msg.Creator) + return nil, errors.Wrapf(errorsTypes.ErrNotFound, types.ErrFundingDoesNotExist.Error(), msg.PoolId, msg.Creator) } if funding.Amount == 0 { @@ -41,18 +41,20 @@ func (k msgServer) DefundPool(goCtx context.Context, msg *types.MsgDefundPool) ( funding.SubtractAmount(amount) if funding.Amount == 0 { - fundingState.SetInactive(funding) + fundingState.SetInactive(&funding) } fundingState.TotalAmount -= amount // Transfer tokens from this module to sender. - if err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, types.ModuleName, msg.Creator, msg.Amount); err != nil { + // TODO: change module name to funders + //if err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, types.ModuleName, msg.Creator, amount); err != nil { + if err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, "pool", msg.Creator, amount); err != nil { return nil, err } // Save funding and funding state - k.setFunding(ctx, funding) - fundingState.SetActive(funding) + k.setFunding(ctx, &funding) + fundingState.SetActive(&funding) // Emit a defund event. _ = ctx.EventManager().EmitTypedEvent(&types.EventDefundPool{ diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go index 591d0cc9..264b3f65 100644 --- a/x/funders/keeper/msg_server_fund_pool.go +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -44,7 +44,7 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ // Funder has to exist if !k.DoesFunderExist(ctx, msg.Creator) { - return nil, errors.Wrapf(errorsTypes.ErrUnauthorized, types.ErrFunderDoesNotExist.Error(), msg.Creator) + return nil, errors.Wrapf(errorsTypes.ErrNotFound, types.ErrFunderDoesNotExist.Error(), msg.Creator) } // Pool has to exist @@ -71,7 +71,7 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ funding.AddAmount(msg.Amount) } else { // If not, create new funding - funding = &types.Funding{ + funding = types.Funding{ FunderAddress: msg.Creator, PoolId: msg.PoolId, Amount: msg.Amount, @@ -109,10 +109,11 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ } } - // TODO: do I have to call ValidateBasic() here? // User is allowed to fund // Let's see if he has enough funds - if err := util.TransferFromAddressToModule(k.bankKeeper, ctx, msg.Creator, types.ModuleName, msg.Amount); err != nil { + // TODO: change module name to types.ModuleName + //if err := util.TransferFromAddressToModule(k.bankKeeper, ctx, msg.Creator, types.ModuleName, msg.Amount); err != nil { + if err := util.TransferFromAddressToModule(k.bankKeeper, ctx, msg.Creator, "pool", msg.Amount); err != nil { return nil, err } @@ -126,10 +127,10 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ } // Funding must be active - fundingState.SetActive(funding) + fundingState.SetActive(&funding) // Save funding and funding state - k.setFunding(ctx, funding) + k.setFunding(ctx, &funding) k.setFundingState(ctx, fundingState) // Emit a fund event. diff --git a/x/funders/keeper/msg_server_update_funder.go b/x/funders/keeper/msg_server_update_funder.go index 0c99fb11..d43933c6 100644 --- a/x/funders/keeper/msg_server_update_funder.go +++ b/x/funders/keeper/msg_server_update_funder.go @@ -15,11 +15,11 @@ func (k msgServer) UpdateFunder(goCtx context.Context, msg *types.MsgUpdateFunde // Error if funder does not exist if !k.DoesFunderExist(ctx, msg.Creator) { - return nil, errors.Wrap(errorsTypes.ErrInvalidRequest, types.ErrFunderDoesNotExist.Error()) + return nil, errors.Wrap(errorsTypes.ErrNotFound, types.ErrFunderDoesNotExist.Error()) } // Update funder - k.setFunder(ctx, types.Funder{ + k.setFunder(ctx, &types.Funder{ Address: msg.Creator, Moniker: msg.Moniker, Identity: msg.Identity, diff --git a/x/funders/types/message_defund_pool.go b/x/funders/types/message_defund_pool.go index fe611bb9..14c7a86b 100644 --- a/x/funders/types/message_defund_pool.go +++ b/x/funders/types/message_defund_pool.go @@ -38,11 +38,11 @@ func (msg *MsgDefundPool) ValidateBasic() error { return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) } - if util.ValidatePositiveNumber(msg.PoolId) != nil { + if util.ValidateNumber(msg.PoolId) != nil { return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid pool id") } - if util.ValidateNumber(msg.Amount) != nil { + if util.ValidatePositiveNumber(msg.Amount) != nil { return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid amount") } diff --git a/x/funders/types/message_fund_pool.go b/x/funders/types/message_fund_pool.go index 44aa69f0..a05298ac 100644 --- a/x/funders/types/message_fund_pool.go +++ b/x/funders/types/message_fund_pool.go @@ -38,7 +38,7 @@ func (msg *MsgFundPool) ValidateBasic() error { return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) } - if util.ValidatePositiveNumber(msg.PoolId) != nil { + if util.ValidateNumber(msg.PoolId) != nil { return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid pool id") } From 9b8e333dce77ffb70e71f7f168ea4a248073559d Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 27 Sep 2023 16:09:59 +0200 Subject: [PATCH 022/109] fix: fixed some smaller issues --- proto/kyve/funders/v1beta1/funders.proto | 2 +- x/funders/keeper/msg_server_defund_pool.go | 4 +--- x/funders/keeper/msg_server_fund_pool.go | 12 +++++++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/proto/kyve/funders/v1beta1/funders.proto b/proto/kyve/funders/v1beta1/funders.proto index 2f46d382..19c7d7c3 100644 --- a/proto/kyve/funders/v1beta1/funders.proto +++ b/proto/kyve/funders/v1beta1/funders.proto @@ -45,7 +45,7 @@ message Funding { message FundingState { // pool_id is the id of the pool this funding is for uint64 pool_id = 1; - // active_fundings is the list of all active fundings + // active_funder_addresses is the list of all active fundings repeated string active_funder_addresses = 2; // total_amount is the total amount of funds in ukyve the pool has from all fundings uint64 total_amount = 3; diff --git a/x/funders/keeper/msg_server_defund_pool.go b/x/funders/keeper/msg_server_defund_pool.go index c1c095f2..12dca280 100644 --- a/x/funders/keeper/msg_server_defund_pool.go +++ b/x/funders/keeper/msg_server_defund_pool.go @@ -46,9 +46,7 @@ func (k msgServer) DefundPool(goCtx context.Context, msg *types.MsgDefundPool) ( fundingState.TotalAmount -= amount // Transfer tokens from this module to sender. - // TODO: change module name to funders - //if err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, types.ModuleName, msg.Creator, amount); err != nil { - if err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, "pool", msg.Creator, amount); err != nil { + if err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, types.ModuleName, msg.Creator, amount); err != nil { return nil, err } diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go index 264b3f65..dad3fa7c 100644 --- a/x/funders/keeper/msg_server_fund_pool.go +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -98,6 +98,7 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ } // Check if lowest funding is lower than new funding + // TODO: what criteria should we use to determine if a funder is the lowest? if lowestFunding.Amount < funding.Amount { // If so, check if lowest funding is from someone else if lowestFunding.FunderAddress != funding.FunderAddress { @@ -111,16 +112,21 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ // User is allowed to fund // Let's see if he has enough funds - // TODO: change module name to types.ModuleName - //if err := util.TransferFromAddressToModule(k.bankKeeper, ctx, msg.Creator, types.ModuleName, msg.Amount); err != nil { - if err := util.TransferFromAddressToModule(k.bankKeeper, ctx, msg.Creator, "pool", msg.Amount); err != nil { + if err := util.TransferFromAddressToModule(k.bankKeeper, ctx, msg.Creator, types.ModuleName, msg.Amount); err != nil { + //if err := util.TransferFromAddressToModule(k.bankKeeper, ctx, msg.Creator, "pool", msg.Amount); err != nil { return nil, err } // Check if defunding is necessary if defunding != nil { err := k.defundLowestFunding(ctx, defunding, &fundingState, msg.PoolId) + // TODO: what to do if defunding fails? Should we return the funds to the user? + if err2 := util.TransferFromModuleToAddress(k.bankKeeper, ctx, types.ModuleName, msg.Creator, msg.Amount); err2 != nil { + k.Logger(ctx).Error("Failed to defund lowest funding", "error", err.Error()) + k.Logger(ctx).Error("Failed to transfer funds back to user", "error", err2.Error()) + return nil, err2 + } if err != nil { return nil, err } From 8e95cb71175a3219dbafe0c444fbcae75a0839c4 Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 27 Sep 2023 17:36:12 +0200 Subject: [PATCH 023/109] chore: update test dependencies --- go.mod | 22 ++++++++++++---------- go.sum | 43 +++++++++++++++++++++++-------------------- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/go.mod b/go.mod index 4525ca89..aa664647 100644 --- a/go.mod +++ b/go.mod @@ -15,8 +15,8 @@ require ( github.com/golang/protobuf v1.5.3 github.com/golangci/golangci-lint v1.52.2 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/onsi/ginkgo/v2 v2.8.0 - github.com/onsi/gomega v1.26.0 + github.com/onsi/ginkgo/v2 v2.12.1 + github.com/onsi/gomega v1.27.10 github.com/spf13/cast v1.5.1 github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 @@ -114,7 +114,8 @@ require ( github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect + github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect github.com/go-toolsmith/astequal v1.1.0 // indirect @@ -144,6 +145,7 @@ require ( github.com/google/btree v1.1.2 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/orderedcode v0.0.1 // indirect + github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect github.com/google/s2a-go v0.1.4 // indirect github.com/google/uuid v1.3.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect @@ -287,17 +289,17 @@ require ( go.uber.org/goleak v1.1.12 // indirect go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.11.0 // indirect + golang.org/x/crypto v0.12.0 // indirect golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // indirect golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect - golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.12.0 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/net v0.14.0 // indirect golang.org/x/oauth2 v0.8.0 // indirect - golang.org/x/sync v0.2.0 // indirect - golang.org/x/sys v0.11.0 // indirect - golang.org/x/term v0.10.0 // indirect + golang.org/x/sync v0.3.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/term v0.11.0 // indirect golang.org/x/text v0.12.0 // indirect - golang.org/x/tools v0.8.0 // indirect + golang.org/x/tools v0.12.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.126.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index 855e70e7..b9aefb19 100644 --- a/go.sum +++ b/go.sum @@ -586,8 +586,8 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/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-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= @@ -602,6 +602,8 @@ github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5Nq github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-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.1.0 h1:+JN9xZV1A+Re+95pgnMgDboWNVnIMMQXwfBwLRPgSC8= github.com/go-toolsmith/astcast v1.1.0/go.mod h1:qdcuFWeGGS2xX5bLM/c3U9lewg7+Zu4mr+xPwZIB4ZU= github.com/go-toolsmith/astcopy v1.1.0 h1:YGwBN0WM+ekI/6SS6+52zLDEf8Yvp3n2seZITCUBt5s= @@ -754,6 +756,7 @@ github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= @@ -1126,14 +1129,14 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= -github.com/onsi/ginkgo/v2 v2.8.0 h1:pAM+oBNPrpXRs+E/8spkeGx9QgekbRVyr74EUvRVOUI= -github.com/onsi/ginkgo/v2 v2.8.0/go.mod h1:6JsQiECmxCa3V5st74AL/AmsV482EDdVrGaVW6z3oYU= +github.com/onsi/ginkgo/v2 v2.12.1 h1:uHNEO1RP2SpuZApSkel9nEh1/Mu+hmQe7Q+Pepg5OYA= +github.com/onsi/ginkgo/v2 v2.12.1/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= -github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= +github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= +github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= 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/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= @@ -1505,8 +1508,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= 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= @@ -1559,8 +1562,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= -golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= 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= @@ -1632,8 +1635,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1676,8 +1679,8 @@ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJ 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.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= 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= @@ -1795,8 +1798,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.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.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1805,8 +1808,8 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= 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= @@ -1911,8 +1914,8 @@ golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y= -golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= +golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss= +golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= 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= From 3f68c3512691f158096ec8906bddc195832d4c1e Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 27 Sep 2023 17:37:19 +0200 Subject: [PATCH 024/109] feat: add more tests for msg_server_create_funder --- testutil/integration/transactions.go | 10 ++++ testutil/keeper/funders.go | 18 +++--- x/funders/keeper/keeper_test.go | 16 ++++++ .../keeper/msg_server_create_funder_test.go | 55 ++++++++++++++++--- 4 files changed, 83 insertions(+), 16 deletions(-) create mode 100644 x/funders/keeper/keeper_test.go diff --git a/testutil/integration/transactions.go b/testutil/integration/transactions.go index 3dce58be..cf09b998 100644 --- a/testutil/integration/transactions.go +++ b/testutil/integration/transactions.go @@ -92,3 +92,13 @@ func (suite *KeeperTestSuite) RunTxTeamError(msg sdk.Msg) { _, err := suite.RunTx(msg) Expect(err).To(HaveOccurred()) } + +func (suite *KeeperTestSuite) RunTxFundersSuccess(msg sdk.Msg) { + _, err := suite.RunTx(msg) + Expect(err).NotTo(HaveOccurred()) +} + +func (suite *KeeperTestSuite) RunTxFundersError(msg sdk.Msg) { + _, err := suite.RunTx(msg) + Expect(err).To(HaveOccurred()) +} diff --git a/testutil/keeper/funders.go b/testutil/keeper/funders.go index 6730fc53..9b760812 100644 --- a/testutil/keeper/funders.go +++ b/testutil/keeper/funders.go @@ -36,20 +36,20 @@ func FundersKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { memStoreKey, "FundersParams", ) - //k := keeper.NewKeeper( - // cdc, - // storeKey, - // memStoreKey, - // paramsSubspace, - //) - + k := keeper.NewKeeper( + cdc, + storeKey, + memStoreKey, + "authority", + nil, + nil, + nil, + ) _ = paramsSubspace - var k *keeper.Keeper ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) // Initialize params k.SetParams(ctx, types.DefaultParams()) return k, ctx - return nil, ctx } diff --git a/x/funders/keeper/keeper_test.go b/x/funders/keeper/keeper_test.go new file mode 100644 index 00000000..6dee1b57 --- /dev/null +++ b/x/funders/keeper/keeper_test.go @@ -0,0 +1,16 @@ +package keeper_test + +import ( + "fmt" + "testing" + + "github.com/KYVENetwork/chain/x/team/types" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestTeamKeeper(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, fmt.Sprintf("x/%s Keeper Test Suite", types.ModuleName)) +} diff --git a/x/funders/keeper/msg_server_create_funder_test.go b/x/funders/keeper/msg_server_create_funder_test.go index 191cf922..bf74fb1d 100644 --- a/x/funders/keeper/msg_server_create_funder_test.go +++ b/x/funders/keeper/msg_server_create_funder_test.go @@ -13,9 +13,11 @@ import ( TEST CASES - msg_server_create_funder.go * Create a funder with empty values +* Create a funder with empty values except moniker * Create a funder with all values set * Create a funder that already exists -* TODO: Create two funders with the same moniker +* Create two funders with the same moniker // TODO: should this be allowed? +* Create two funders */ var _ = Describe("msg_server_create_funder.go", Ordered, func() { @@ -31,16 +33,24 @@ var _ = Describe("msg_server_create_funder.go", Ordered, func() { }) It("Create a funder with empty values", func() { + // ASSERT + s.RunTxFundersError(&types.MsgCreateFunder{ + Creator: i.ALICE, + }) + }) + + It("Create a funder with empty values except moniker", func() { // ACT - s.RunTxPoolSuccess(&types.MsgCreateFunder{ + s.RunTxFundersSuccess(&types.MsgCreateFunder{ Creator: i.ALICE, + Moniker: "moniker", }) // ASSERT funder, found := s.App().FundersKeeper.GetFunder(s.Ctx(), i.ALICE) Expect(found).To(BeTrue()) Expect(funder.Address).To(Equal(i.ALICE)) - Expect(funder.Moniker).To(BeEmpty()) + Expect(funder.Moniker).To(Equal("moniker")) Expect(funder.Identity).To(BeEmpty()) Expect(funder.Logo).To(BeEmpty()) Expect(funder.Website).To(BeEmpty()) @@ -51,7 +61,7 @@ var _ = Describe("msg_server_create_funder.go", Ordered, func() { It("Create a funder with all values set", func() { // ACT moniker, identity, logo, website, contact, description := "moniker", "identity", "logo", "website", "contact", "description" - s.RunTxPoolSuccess(&types.MsgCreateFunder{ + s.RunTxFundersSuccess(&types.MsgCreateFunder{ Creator: i.ALICE, Moniker: moniker, Identity: identity, @@ -73,15 +83,46 @@ var _ = Describe("msg_server_create_funder.go", Ordered, func() { Expect(funder.Description).To(Equal(description)) }) - It("Create a funder with empty values", func() { + It("Create a funder that already exists", func() { + // ARRANGE + s.RunTxFundersSuccess(&types.MsgCreateFunder{ + Creator: i.ALICE, + Moniker: "moniker 1", + }) + + // ACT + s.RunTxFundersError(&types.MsgCreateFunder{ + Creator: i.ALICE, + Moniker: "moniker 2", + }) + }) + + It("Create two funders with the same moniker", func() { // ARRANGE - s.RunTxPoolSuccess(&types.MsgCreateFunder{ + moniker := "moniker" + s.RunTxFundersSuccess(&types.MsgCreateFunder{ Creator: i.ALICE, + Moniker: moniker, }) // ACT - s.RunTxPoolError(&types.MsgCreateFunder{ + s.RunTxFundersError(&types.MsgCreateFunder{ + Creator: i.BOB, + Moniker: moniker, + }) + }) + + It("Create two funders", func() { + // ARRANGE + s.RunTxFundersSuccess(&types.MsgCreateFunder{ Creator: i.ALICE, + Moniker: "moniker 1", + }) + + // ACT + s.RunTxFundersError(&types.MsgCreateFunder{ + Creator: i.BOB, + Moniker: "moniker 2", }) }) }) From 9c3489cb45247f2129403299bb29e87d6ccca82c Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 27 Sep 2023 17:37:37 +0200 Subject: [PATCH 025/109] chore: update test --- x/funders/keeper/msg_server_create_funder_test.go | 4 ++-- x/funders/types/keys.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/x/funders/keeper/msg_server_create_funder_test.go b/x/funders/keeper/msg_server_create_funder_test.go index bf74fb1d..a241c804 100644 --- a/x/funders/keeper/msg_server_create_funder_test.go +++ b/x/funders/keeper/msg_server_create_funder_test.go @@ -97,7 +97,7 @@ var _ = Describe("msg_server_create_funder.go", Ordered, func() { }) }) - It("Create two funders with the same moniker", func() { + PIt("Create two funders with the same moniker", func() { // ARRANGE moniker := "moniker" s.RunTxFundersSuccess(&types.MsgCreateFunder{ @@ -120,7 +120,7 @@ var _ = Describe("msg_server_create_funder.go", Ordered, func() { }) // ACT - s.RunTxFundersError(&types.MsgCreateFunder{ + s.RunTxFundersSuccess(&types.MsgCreateFunder{ Creator: i.BOB, Moniker: "moniker 2", }) diff --git a/x/funders/types/keys.go b/x/funders/types/keys.go index f4a7b267..57cf5790 100644 --- a/x/funders/types/keys.go +++ b/x/funders/types/keys.go @@ -20,10 +20,10 @@ const ( // MaxFunders which are allowed MaxFunders = 50 // MinFundingAmount which is necessary to fund a pool - //TODO(rapha): how much should this be? + //TODO(rapha): how much should this be? -> move to params MinFundingAmount = 1_000_000_000 //MinFundingAmountPerBundle which is necessary to fund a pool - //TODO: how much should this be? + //TODO: how much should this be? -> move to params MinFundingAmountPerBundle = 1_000_000 ) From 9cb090457b5a4793e5ff3d23b46cbb2030f0f7bb Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 28 Sep 2023 10:14:18 +0200 Subject: [PATCH 026/109] feat: add genesis params --- proto/kyve/funders/v1beta1/genesis.proto | 8 +- proto/kyve/funders/v1beta1/params.proto | 6 +- x/funders/keeper/getters_funding.go | 2 +- .../keeper/{params.go => getters_params.go} | 0 x/funders/types/funders.pb.go | 2 +- x/funders/types/genesis.go | 31 ++- x/funders/types/genesis.pb.go | 216 +++++++++++++++++- x/funders/types/params.go | 41 ++-- x/funders/types/params.pb.go | 79 +++++-- 9 files changed, 332 insertions(+), 53 deletions(-) rename x/funders/keeper/{params.go => getters_params.go} (100%) diff --git a/proto/kyve/funders/v1beta1/genesis.proto b/proto/kyve/funders/v1beta1/genesis.proto index b62f7b34..f0686f39 100644 --- a/proto/kyve/funders/v1beta1/genesis.proto +++ b/proto/kyve/funders/v1beta1/genesis.proto @@ -3,7 +3,7 @@ syntax = "proto3"; package kyve.funders.v1beta1; import "gogoproto/gogo.proto"; -//import "kyve/funders/v1beta1/funders.proto"; +import "kyve/funders/v1beta1/funders.proto"; import "kyve/funders/v1beta1/params.proto"; option go_package = "github.com/KYVENetwork/chain/x/funders/types"; @@ -12,4 +12,10 @@ option go_package = "github.com/KYVENetwork/chain/x/funders/types"; message GenesisState { // params defines all the parameters of the module. Params params = 1 [(gogoproto.nullable) = false]; + // funder_list ... + repeated kyve.funders.v1beta1.Funder funder_list = 2 [(gogoproto.nullable) = false]; + // funding_list ... + repeated kyve.funders.v1beta1.Funding funding_list = 3 [(gogoproto.nullable) = false]; + // funding_state ... + repeated kyve.funders.v1beta1.FundingState funding_state_list = 4 [(gogoproto.nullable) = false]; } diff --git a/proto/kyve/funders/v1beta1/params.proto b/proto/kyve/funders/v1beta1/params.proto index 54e518ef..eb8a1b4d 100644 --- a/proto/kyve/funders/v1beta1/params.proto +++ b/proto/kyve/funders/v1beta1/params.proto @@ -6,6 +6,8 @@ option go_package = "github.com/KYVENetwork/chain/x/funders/types"; // Params defines the funders module parameters. message Params { - // //TODO: change param - uint64 random_param = 1; + // Minimum amount of tokens that can be funded. + uint64 min_funding_amount = 1; + // Minimum amount of tokens that can be funded per bundle. + uint64 min_funding_amount_per_bundle = 2; } diff --git a/x/funders/keeper/getters_funding.go b/x/funders/keeper/getters_funding.go index f6e430bd..2c53c722 100644 --- a/x/funders/keeper/getters_funding.go +++ b/x/funders/keeper/getters_funding.go @@ -32,7 +32,7 @@ func (k Keeper) GetFunding(ctx sdk.Context, funderAddress string, poolId uint64) func (k Keeper) GetFundingsOfPool(ctx sdk.Context, poolId uint64) (fundings []types.Funding) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingKeyPrefixByPool) - iterator := sdk.KVStorePrefixIterator(store, types.FundingKeyByPoolOnly(poolId)) + iterator := sdk.KVStorePrefixIterator(store, types.FundingKeyByPoolIter(poolId)) //goland:noinspection GoUnhandledErrorResult defer iterator.Close() diff --git a/x/funders/keeper/params.go b/x/funders/keeper/getters_params.go similarity index 100% rename from x/funders/keeper/params.go rename to x/funders/keeper/getters_params.go diff --git a/x/funders/types/funders.pb.go b/x/funders/types/funders.pb.go index 2201ca2d..1af79baa 100644 --- a/x/funders/types/funders.pb.go +++ b/x/funders/types/funders.pb.go @@ -211,7 +211,7 @@ func (m *Funding) GetTotalFunded() uint64 { type FundingState struct { // pool_id is the id of the pool this funding is for PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` - // active_fundings is the list of all active fundings + // active_funder_addresses is the list of all active fundings ActiveFunderAddresses []string `protobuf:"bytes,2,rep,name=active_funder_addresses,json=activeFunderAddresses,proto3" json:"active_funder_addresses,omitempty"` // total_amount is the total amount of funds in ukyve the pool has from all fundings TotalAmount uint64 `protobuf:"varint,3,opt,name=total_amount,json=totalAmount,proto3" json:"total_amount,omitempty"` diff --git a/x/funders/types/genesis.go b/x/funders/types/genesis.go index 625fe8dc..4e355271 100644 --- a/x/funders/types/genesis.go +++ b/x/funders/types/genesis.go @@ -1,5 +1,7 @@ package types +import "fmt" + // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ @@ -12,6 +14,33 @@ func DefaultGenesis() *GenesisState { // failure. func (gs GenesisState) Validate() error { // this line is used by starport scaffolding # genesis/types/validate - // TODO: check funders (not more than allowed) + fundersIndexMap := make(map[string]struct{}) + for _, funder := range gs.FunderList { + index := string(FunderKey(funder.Address)) + if _, ok := fundersIndexMap[index]; ok { + return fmt.Errorf("duplicated funder id for %v", funder) + } + } + + fundingByFunderIndexMap := make(map[string]struct{}) + fundingByPoolIndexMap := make(map[string]struct{}) + for _, funding := range gs.FundingList { + byFunderIndex := string(FundingKeyByFunder(funding.FunderAddress, funding.PoolId)) + if _, ok := fundingByFunderIndexMap[byFunderIndex]; ok { + return fmt.Errorf("duplicated funding id for %v", funding) + } + byPoolIndex := string(FundingKeyByPool(funding.FunderAddress, funding.PoolId)) + if _, ok := fundingByPoolIndexMap[byPoolIndex]; ok { + return fmt.Errorf("duplicated funding id for %v", funding) + } + } + + fundingStateIndexMap := make(map[string]struct{}) + for _, fundingState := range gs.FundingStateList { + index := string(FundingStateKey(fundingState.PoolId)) + if _, ok := fundingStateIndexMap[index]; ok { + return fmt.Errorf("duplicated funding state id for %v", fundingState) + } + } return gs.Params.Validate() } diff --git a/x/funders/types/genesis.pb.go b/x/funders/types/genesis.pb.go index df56bdc0..5d60f0b6 100644 --- a/x/funders/types/genesis.pb.go +++ b/x/funders/types/genesis.pb.go @@ -27,6 +27,12 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type GenesisState struct { // params defines all the parameters of the module. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // funder_list ... + FunderList []Funder `protobuf:"bytes,2,rep,name=funder_list,json=funderList,proto3" json:"funder_list"` + // funding_list ... + FundingList []Funding `protobuf:"bytes,3,rep,name=funding_list,json=fundingList,proto3" json:"funding_list"` + // funding_state ... + FundingStateList []FundingState `protobuf:"bytes,4,rep,name=funding_state_list,json=fundingStateList,proto3" json:"funding_state_list"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -69,6 +75,27 @@ func (m *GenesisState) GetParams() Params { return Params{} } +func (m *GenesisState) GetFunderList() []Funder { + if m != nil { + return m.FunderList + } + return nil +} + +func (m *GenesisState) GetFundingList() []Funding { + if m != nil { + return m.FundingList + } + return nil +} + +func (m *GenesisState) GetFundingStateList() []FundingState { + if m != nil { + return m.FundingStateList + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "kyve.funders.v1beta1.GenesisState") } @@ -78,21 +105,26 @@ func init() { } var fileDescriptor_d339226ca8e2c929 = []byte{ - // 209 bytes of a gzipped FileDescriptorProto + // 301 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xca, 0xae, 0x2c, 0x4b, 0xd5, 0x4f, 0x2b, 0xcd, 0x4b, 0x49, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, 0xa9, 0xd1, 0x83, 0xaa, 0xd1, 0x83, 0xaa, 0x91, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, - 0xd0, 0x07, 0xb1, 0x20, 0x6a, 0xa5, 0x14, 0xb1, 0x9a, 0x57, 0x90, 0x58, 0x94, 0x98, 0x0b, 0x35, - 0x4e, 0xc9, 0x8b, 0x8b, 0xc7, 0x1d, 0x62, 0x7e, 0x70, 0x49, 0x62, 0x49, 0xaa, 0x90, 0x15, 0x17, - 0x1b, 0x44, 0x5e, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x46, 0x0f, 0x9b, 0x7d, 0x7a, 0x01, - 0x60, 0x35, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x41, 0x75, 0x38, 0xb9, 0x9d, 0x78, 0x24, - 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, - 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x4e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, - 0x72, 0x7e, 0xae, 0xbe, 0x77, 0x64, 0x98, 0xab, 0x5f, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0xb6, 0x7e, - 0x72, 0x46, 0x62, 0x66, 0x9e, 0x7e, 0x05, 0xdc, 0x89, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, - 0x60, 0xa7, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x8a, 0xb6, 0xa8, 0x14, 0x0f, 0x01, 0x00, - 0x00, + 0xd0, 0x07, 0xb1, 0x20, 0x6a, 0xa5, 0xb0, 0x9b, 0x07, 0xd3, 0x0b, 0x51, 0xa3, 0x88, 0x55, 0x4d, + 0x41, 0x62, 0x51, 0x62, 0x2e, 0x54, 0x89, 0xd2, 0x7a, 0x26, 0x2e, 0x1e, 0x77, 0x88, 0x23, 0x82, + 0x4b, 0x12, 0x4b, 0x52, 0x85, 0xac, 0xb8, 0xd8, 0x20, 0x0a, 0x24, 0x18, 0x15, 0x18, 0x35, 0xb8, + 0x8d, 0x64, 0xf4, 0xb0, 0x39, 0x4a, 0x2f, 0x00, 0xac, 0xc6, 0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x86, + 0x20, 0xa8, 0x0e, 0x21, 0x67, 0x2e, 0x6e, 0x88, 0xba, 0xf8, 0x9c, 0xcc, 0xe2, 0x12, 0x09, 0x26, + 0x05, 0x66, 0xdc, 0x06, 0xb8, 0x81, 0xf9, 0x50, 0x03, 0xb8, 0x20, 0xb2, 0x3e, 0x99, 0xc5, 0x25, + 0x42, 0x6e, 0x5c, 0x3c, 0x20, 0x5e, 0x66, 0x5e, 0x3a, 0xc4, 0x14, 0x66, 0xb0, 0x29, 0xb2, 0xb8, + 0x4d, 0xc9, 0xcc, 0x4b, 0x87, 0x1a, 0xc3, 0x0d, 0xd5, 0x08, 0x36, 0x27, 0x8c, 0x4b, 0x08, 0x66, + 0x4e, 0x31, 0xc8, 0x67, 0x10, 0xd3, 0x58, 0xc0, 0xa6, 0x29, 0xe1, 0x35, 0x0d, 0x1c, 0x10, 0x50, + 0x23, 0x05, 0xd2, 0x90, 0xc4, 0x40, 0xe6, 0x3a, 0xb9, 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, + 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, + 0xb1, 0x1c, 0x43, 0x94, 0x4e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0xbe, + 0x77, 0x64, 0x98, 0xab, 0x5f, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0xb6, 0x7e, 0x72, 0x46, 0x62, 0x66, + 0x9e, 0x7e, 0x05, 0x3c, 0x22, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x11, 0x60, 0x0c, + 0x08, 0x00, 0x00, 0xff, 0xff, 0x69, 0x25, 0xe7, 0xb6, 0x19, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -115,6 +147,48 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.FundingStateList) > 0 { + for iNdEx := len(m.FundingStateList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FundingStateList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.FundingList) > 0 { + for iNdEx := len(m.FundingList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FundingList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.FunderList) > 0 { + for iNdEx := len(m.FunderList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FunderList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } { size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -147,6 +221,24 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) + if len(m.FunderList) > 0 { + for _, e := range m.FunderList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.FundingList) > 0 { + for _, e := range m.FundingList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.FundingStateList) > 0 { + for _, e := range m.FundingStateList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -218,6 +310,108 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FunderList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FunderList = append(m.FunderList, Funder{}) + if err := m.FunderList[len(m.FunderList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FundingList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FundingList = append(m.FundingList, Funding{}) + if err := m.FundingList[len(m.FundingList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FundingStateList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FundingStateList = append(m.FundingStateList, FundingState{}) + if err := m.FundingStateList[len(m.FundingStateList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/funders/types/params.go b/x/funders/types/params.go index 4f3215e3..0a9047f1 100644 --- a/x/funders/types/params.go +++ b/x/funders/types/params.go @@ -1,32 +1,41 @@ package types import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/KYVENetwork/chain/util" ) -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} +const ( + // DefaultMinFundingAmount 1000 Kyve + DefaultMinFundingAmount = uint64(1_000_000_000) + // DefaultMinFundingAmountPerBundle 1 Kyve + DefaultMinFundingAmountPerBundle = uint64(1_000_000) +) // NewParams creates a new Params instance -func NewParams() Params { - return Params{} +func NewParams(minFundingAmount uint64, minFundingAmountPerBundle uint64) Params { + return Params{ + MinFundingAmount: minFundingAmount, + MinFundingAmountPerBundle: minFundingAmountPerBundle, + } } // 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{} + return NewParams( + DefaultMinFundingAmount, + DefaultMinFundingAmountPerBundle, + ) } // Validate validates the set of params -func (p Params) Validate() error { +func (p *Params) Validate() error { + if err := util.ValidateNumber(p.MinFundingAmount); err != nil { + return err + } + + if err := util.ValidateNumber(p.MinFundingAmountPerBundle); err != nil { + return err + } + return nil } diff --git a/x/funders/types/params.pb.go b/x/funders/types/params.pb.go index 1a937ee8..89c13171 100644 --- a/x/funders/types/params.pb.go +++ b/x/funders/types/params.pb.go @@ -24,8 +24,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the funders module parameters. type Params struct { - // //TODO: change param - RandomParam uint64 `protobuf:"varint,1,opt,name=random_param,json=randomParam,proto3" json:"random_param,omitempty"` + // Minimum amount of tokens that can be funded. + MinFundingAmount uint64 `protobuf:"varint,1,opt,name=min_funding_amount,json=minFundingAmount,proto3" json:"min_funding_amount,omitempty"` + // Minimum amount of tokens that can be funded per bundle. + MinFundingAmountPerBundle uint64 `protobuf:"varint,2,opt,name=min_funding_amount_per_bundle,json=minFundingAmountPerBundle,proto3" json:"min_funding_amount_per_bundle,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -61,9 +63,16 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetRandomParam() uint64 { +func (m *Params) GetMinFundingAmount() uint64 { if m != nil { - return m.RandomParam + return m.MinFundingAmount + } + return 0 +} + +func (m *Params) GetMinFundingAmountPerBundle() uint64 { + if m != nil { + return m.MinFundingAmountPerBundle } return 0 } @@ -75,18 +84,21 @@ func init() { func init() { proto.RegisterFile("kyve/funders/v1beta1/params.proto", fileDescriptor_906a9a55094dc984) } var fileDescriptor_906a9a55094dc984 = []byte{ - // 173 bytes of a gzipped FileDescriptorProto + // 215 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcc, 0xae, 0x2c, 0x4b, 0xd5, 0x4f, 0x2b, 0xcd, 0x4b, 0x49, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, - 0x29, 0xd1, 0x83, 0x2a, 0xd1, 0x83, 0x2a, 0x51, 0xd2, 0xe6, 0x62, 0x0b, 0x00, 0xab, 0x12, 0x52, - 0xe4, 0xe2, 0x29, 0x4a, 0xcc, 0x4b, 0xc9, 0xcf, 0x8d, 0x07, 0x6b, 0x93, 0x60, 0x54, 0x60, 0xd4, - 0x60, 0x09, 0xe2, 0x86, 0x88, 0x81, 0xd5, 0x38, 0xb9, 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, - 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, - 0xb1, 0x1c, 0x43, 0x94, 0x4e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0xbe, - 0x77, 0x64, 0x98, 0xab, 0x5f, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0xb6, 0x7e, 0x72, 0x46, 0x62, 0x66, - 0x9e, 0x7e, 0x05, 0xdc, 0x65, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x17, 0x19, 0x03, - 0x02, 0x00, 0x00, 0xff, 0xff, 0x27, 0x35, 0xef, 0x63, 0xb6, 0x00, 0x00, 0x00, + 0x29, 0xd1, 0x83, 0x2a, 0xd1, 0x83, 0x2a, 0x51, 0xaa, 0xe0, 0x62, 0x0b, 0x00, 0xab, 0x12, 0xd2, + 0xe1, 0x12, 0xca, 0xcd, 0xcc, 0x8b, 0x07, 0x29, 0xc8, 0xcc, 0x4b, 0x8f, 0x4f, 0xcc, 0xcd, 0x2f, + 0xcd, 0x2b, 0x91, 0x60, 0x54, 0x60, 0xd4, 0x60, 0x09, 0x12, 0xc8, 0xcd, 0xcc, 0x73, 0x83, 0x48, + 0x38, 0x82, 0xc5, 0x85, 0x1c, 0xb8, 0x64, 0x31, 0x55, 0xc7, 0x17, 0xa4, 0x16, 0xc5, 0x27, 0x95, + 0xe6, 0xa5, 0xe4, 0xa4, 0x4a, 0x30, 0x81, 0x35, 0x4a, 0xa2, 0x6b, 0x0c, 0x48, 0x2d, 0x72, 0x02, + 0x2b, 0x70, 0x72, 0x3b, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, + 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x9d, 0xf4, + 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0xef, 0xc8, 0x30, 0x57, 0xbf, 0xd4, + 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0xfd, 0xe4, 0x8c, 0xc4, 0xcc, 0x3c, 0xfd, 0x0a, 0xb8, 0x37, 0x4b, + 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xde, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x14, + 0x1a, 0x73, 0x9d, 0x03, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -109,8 +121,13 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.RandomParam != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.RandomParam)) + if m.MinFundingAmountPerBundle != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MinFundingAmountPerBundle)) + i-- + dAtA[i] = 0x10 + } + if m.MinFundingAmount != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MinFundingAmount)) i-- dAtA[i] = 0x8 } @@ -134,8 +151,11 @@ func (m *Params) Size() (n int) { } var l int _ = l - if m.RandomParam != 0 { - n += 1 + sovParams(uint64(m.RandomParam)) + if m.MinFundingAmount != 0 { + n += 1 + sovParams(uint64(m.MinFundingAmount)) + } + if m.MinFundingAmountPerBundle != 0 { + n += 1 + sovParams(uint64(m.MinFundingAmountPerBundle)) } return n } @@ -177,9 +197,28 @@ func (m *Params) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RandomParam", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MinFundingAmount", wireType) + } + m.MinFundingAmount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinFundingAmount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinFundingAmountPerBundle", wireType) } - m.RandomParam = 0 + m.MinFundingAmountPerBundle = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowParams @@ -189,7 +228,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.RandomParam |= uint64(b&0x7F) << shift + m.MinFundingAmountPerBundle |= uint64(b&0x7F) << shift if b < 0x80 { break } From e9a3a5f5e5001d84721fc180aa80bd8e452e95bf Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 28 Sep 2023 10:19:06 +0200 Subject: [PATCH 027/109] chore: user params instead of const --- x/funders/keeper/msg_server_fund_pool.go | 10 ++++++---- x/funders/types/keys.go | 11 +++-------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go index dad3fa7c..4d0ac1a7 100644 --- a/x/funders/keeper/msg_server_fund_pool.go +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -79,11 +79,13 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ TotalFunded: msg.Amount, } } - if funding.AmountPerBundle < types.MinFundingAmountPerBundle { - return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrAmountPerBundleTooLow.Error(), types.MinFundingAmountPerBundle) + + params := k.GetParams(ctx) + if funding.AmountPerBundle < params.MinFundingAmountPerBundle { + return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrAmountPerBundleTooLow.Error(), params.MinFundingAmountPerBundle) } - if funding.Amount > types.MinFundingAmount { - return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrMinFundingAmount.Error(), types.MinFundingAmount) + if funding.Amount < params.MinFundingAmount { + return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrMinFundingAmount.Error(), params.MinFundingAmount) } var defunding *types.Funding = nil diff --git a/x/funders/types/keys.go b/x/funders/types/keys.go index 57cf5790..9010c806 100644 --- a/x/funders/types/keys.go +++ b/x/funders/types/keys.go @@ -17,14 +17,8 @@ const ( ) const ( - // MaxFunders which are allowed + // MaxFunders which are allowed per pool MaxFunders = 50 - // MinFundingAmount which is necessary to fund a pool - //TODO(rapha): how much should this be? -> move to params - MinFundingAmount = 1_000_000_000 - //MinFundingAmountPerBundle which is necessary to fund a pool - //TODO: how much should this be? -> move to params - MinFundingAmountPerBundle = 1_000_000 ) var ( @@ -61,7 +55,8 @@ func FundingKeyByPool(funderAddress string, poolId uint64) []byte { return util.GetByteKey(poolId, funderAddress) } -func FundingKeyByPoolOnly(poolId uint64) []byte { +// FundingKeyByPoolIter is used to query all fundings for a pool +func FundingKeyByPoolIter(poolId uint64) []byte { return util.GetByteKey(poolId) } From 7ddd03c32d5b28f55647199d0b3bfff03ee5ddf1 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 28 Sep 2023 10:31:08 +0200 Subject: [PATCH 028/109] feat: add genesis import/export --- x/funders/genesis.go | 14 ++++++++++++-- x/funders/keeper/getters_funder.go | 18 +++++++++++++++++- x/funders/keeper/getters_funding.go | 18 +++++++++++++++++- x/funders/keeper/getters_funding_state.go | 20 ++++++++++++++++++-- x/funders/keeper/logic_funders.go | 4 ++-- x/funders/keeper/msg_server_create_funder.go | 2 +- x/funders/keeper/msg_server_defund_pool.go | 2 +- x/funders/keeper/msg_server_fund_pool.go | 8 ++++---- x/funders/keeper/msg_server_update_funder.go | 2 +- 9 files changed, 73 insertions(+), 15 deletions(-) diff --git a/x/funders/genesis.go b/x/funders/genesis.go index 6b6b7b34..ea4dffd8 100644 --- a/x/funders/genesis.go +++ b/x/funders/genesis.go @@ -10,14 +10,24 @@ import ( 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) + for _, entry := range genState.FunderList { + k.SetFunder(ctx, &entry) + } + for _, entry := range genState.FundingList { + k.SetFunding(ctx, &entry) + } + for _, entry := range genState.FundingStateList { + k.SetFundingState(ctx, &entry) + } } // 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.FunderList = k.GetAllFunders(ctx) + genesis.FundingList = k.GetAllFundings(ctx) + genesis.FundingStateList = k.GetAllFundingStates(ctx) // this line is used by starport scaffolding # genesis/module/export - return genesis } diff --git a/x/funders/keeper/getters_funder.go b/x/funders/keeper/getters_funder.go index c66bc7ed..16d0aa95 100644 --- a/x/funders/keeper/getters_funder.go +++ b/x/funders/keeper/getters_funder.go @@ -27,8 +27,24 @@ func (k Keeper) GetFunder(ctx sdk.Context, funderAddress string) (funder types.F return funder, true } +// GetAllFunders returns all funders +func (k Keeper) GetAllFunders(ctx sdk.Context) (funders []types.Funder) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FunderKeyPrefix) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + //goland:noinspection GoUnhandledErrorResult + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + var val types.Funder + k.cdc.MustUnmarshal(iterator.Value(), &val) + funders = append(funders, val) + } + + return funders +} + // SetFunder sets a specific funder in the store from its index -func (k Keeper) setFunder(ctx sdk.Context, funder *types.Funder) { +func (k Keeper) SetFunder(ctx sdk.Context, funder *types.Funder) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FunderKeyPrefix) b := k.cdc.MustMarshal(funder) store.Set(types.FunderKey( diff --git a/x/funders/keeper/getters_funding.go b/x/funders/keeper/getters_funding.go index 2c53c722..c8f9ca11 100644 --- a/x/funders/keeper/getters_funding.go +++ b/x/funders/keeper/getters_funding.go @@ -44,8 +44,24 @@ func (k Keeper) GetFundingsOfPool(ctx sdk.Context, poolId uint64) (fundings []ty return fundings } +// GetAllFundings returns all fundings +func (k Keeper) GetAllFundings(ctx sdk.Context) (fundings []types.Funding) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingKeyPrefixByFunder) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + //goland:noinspection GoUnhandledErrorResult + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + var val types.Funding + k.cdc.MustUnmarshal(iterator.Value(), &val) + fundings = append(fundings, val) + } + + return fundings +} + // SetFunding sets a specific funding in the store from its index -func (k Keeper) setFunding(ctx sdk.Context, funding *types.Funding) { +func (k Keeper) SetFunding(ctx sdk.Context, funding *types.Funding) { b := k.cdc.MustMarshal(funding) storeByFunder := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingKeyPrefixByFunder) diff --git a/x/funders/keeper/getters_funding_state.go b/x/funders/keeper/getters_funding_state.go index 5e043984..8654fcf3 100644 --- a/x/funders/keeper/getters_funding_state.go +++ b/x/funders/keeper/getters_funding_state.go @@ -29,9 +29,25 @@ func (k Keeper) GetFundingState(ctx sdk.Context, poolId uint64) (fundingState ty return fundingState, true } +// GetAllFundingStates returns all FundingStates +func (k Keeper) GetAllFundingStates(ctx sdk.Context) (fundingStates []types.FundingState) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingStateKeyPrefix) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + //goland:noinspection GoUnhandledErrorResult + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + var val types.FundingState + k.cdc.MustUnmarshal(iterator.Value(), &val) + fundingStates = append(fundingStates, val) + } + + return fundingStates +} + // SetFundingState sets a specific FundingState in the store from its index -func (k Keeper) setFundingState(ctx sdk.Context, fundingState types.FundingState) { - b := k.cdc.MustMarshal(&fundingState) +func (k Keeper) SetFundingState(ctx sdk.Context, fundingState *types.FundingState) { + b := k.cdc.MustMarshal(fundingState) storeByFunder := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingStateKeyPrefix) storeByFunder.Set(types.FundingStateKey( fundingState.PoolId, diff --git a/x/funders/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go index bc0b1271..4f5057eb 100644 --- a/x/funders/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -34,11 +34,11 @@ func (k Keeper) ChargeFundersOfPool(ctx sdk.Context, poolId uint64) (payout uint if funding.Amount == 0 { fundingState.SetInactive(&funding) } - k.setFunding(ctx, &funding) + k.SetFunding(ctx, &funding) } // Save funding state - k.setFundingState(ctx, fundingState) + k.SetFundingState(ctx, &fundingState) // Emit a pool out of funds event if there are no more active funders if len(fundingState.ActiveFunderAddresses) == 0 { diff --git a/x/funders/keeper/msg_server_create_funder.go b/x/funders/keeper/msg_server_create_funder.go index 8bf2d464..a02adc9c 100644 --- a/x/funders/keeper/msg_server_create_funder.go +++ b/x/funders/keeper/msg_server_create_funder.go @@ -21,7 +21,7 @@ func (k msgServer) CreateFunder(goCtx context.Context, msg *types.MsgCreateFunde } // Create new funder - k.setFunder(ctx, &types.Funder{ + k.SetFunder(ctx, &types.Funder{ Address: msg.Creator, Moniker: msg.Moniker, Identity: msg.Identity, diff --git a/x/funders/keeper/msg_server_defund_pool.go b/x/funders/keeper/msg_server_defund_pool.go index 12dca280..efa0c5f6 100644 --- a/x/funders/keeper/msg_server_defund_pool.go +++ b/x/funders/keeper/msg_server_defund_pool.go @@ -51,7 +51,7 @@ func (k msgServer) DefundPool(goCtx context.Context, msg *types.MsgDefundPool) ( } // Save funding and funding state - k.setFunding(ctx, &funding) + k.SetFunding(ctx, &funding) fundingState.SetActive(&funding) // Emit a defund event. diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go index 4d0ac1a7..0460c9df 100644 --- a/x/funders/keeper/msg_server_fund_pool.go +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -23,7 +23,7 @@ func (k msgServer) defundLowestFunding( lowestFunding.SubtractAmount(lowestFunding.Amount) fundingState.SetInactive(lowestFunding) - k.setFunding(ctx, lowestFunding) + k.SetFunding(ctx, lowestFunding) // Emit a defund event. _ = ctx.EventManager().EmitTypedEvent(&types.EventDefundPool{ @@ -61,7 +61,7 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ ActiveFunderAddresses: []string{}, TotalAmount: 0, } - k.setFundingState(ctx, fundingState) + k.SetFundingState(ctx, &fundingState) } // Check if funding already exists @@ -138,8 +138,8 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ fundingState.SetActive(&funding) // Save funding and funding state - k.setFunding(ctx, &funding) - k.setFundingState(ctx, fundingState) + k.SetFunding(ctx, &funding) + k.SetFundingState(ctx, &fundingState) // Emit a fund event. _ = ctx.EventManager().EmitTypedEvent(&types.EventFundPool{ diff --git a/x/funders/keeper/msg_server_update_funder.go b/x/funders/keeper/msg_server_update_funder.go index d43933c6..4cb534ab 100644 --- a/x/funders/keeper/msg_server_update_funder.go +++ b/x/funders/keeper/msg_server_update_funder.go @@ -19,7 +19,7 @@ func (k msgServer) UpdateFunder(goCtx context.Context, msg *types.MsgUpdateFunde } // Update funder - k.setFunder(ctx, &types.Funder{ + k.SetFunder(ctx, &types.Funder{ Address: msg.Creator, Moniker: msg.Moniker, Identity: msg.Identity, From 84f15a026c20bd006b650c37db84d76953513606 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 28 Sep 2023 11:15:32 +0200 Subject: [PATCH 029/109] chore: update funder logic --- x/funders/keeper/msg_server_fund_pool.go | 10 ++++++++-- x/funders/types/funders.go | 22 ++++++++++++---------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go index 0460c9df..36788dd2 100644 --- a/x/funders/keeper/msg_server_fund_pool.go +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -56,6 +56,7 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ // Get or create funding state for pool fundingState, found := k.GetFundingState(ctx, msg.PoolId) if !found { + // TODO: should we create a funding state when the pool is created? fundingState = types.FundingState{ PoolId: msg.PoolId, ActiveFunderAddresses: []string{}, @@ -67,8 +68,12 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ // Check if funding already exists funding, found := k.GetFunding(ctx, msg.Creator, msg.PoolId) if found { - // If so, update funding + // If so, update funding amount funding.AddAmount(msg.Amount) + // If the amount per bundle is set, update it + if msg.AmountPerBundle > 0 { + funding.AmountPerBundle = msg.AmountPerBundle + } } else { // If not, create new funding funding = types.Funding{ @@ -76,9 +81,10 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ PoolId: msg.PoolId, Amount: msg.Amount, AmountPerBundle: msg.AmountPerBundle, - TotalFunded: msg.Amount, + TotalFunded: 0, } } + fundingState.AddAmount(msg.Amount) params := k.GetParams(ctx) if funding.AmountPerBundle < params.MinFundingAmountPerBundle { diff --git a/x/funders/types/funders.go b/x/funders/types/funders.go index 85dd3a89..f2bf4a76 100644 --- a/x/funders/types/funders.go +++ b/x/funders/types/funders.go @@ -4,23 +4,25 @@ func (f *Funding) AddAmount(amount uint64) { f.Amount += amount } -func (f *Funding) SubtractAmount(amount uint64) { - if f.Amount > amount { - f.Amount -= amount - } else { - f.Amount = 0 +func (f *Funding) SubtractAmount(amount uint64) (subtracted uint64) { + subtracted = amount + if f.Amount < amount { + subtracted = f.Amount } + f.Amount -= subtracted + return subtracted } func (f *Funding) ChargeOneBundle() (amount uint64) { - amount = f.AmountPerBundle - if f.Amount < f.AmountPerBundle { - amount = f.Amount - } - f.SubtractAmount(amount) + amount = f.SubtractAmount(f.AmountPerBundle) + f.TotalFunded += amount return amount } +func (fs *FundingState) AddAmount(amount uint64) { + fs.TotalAmount += amount +} + // SetInactive removes a funding from active fundings func (fs *FundingState) SetInactive(funding *Funding) { for i, funderAddress := range fs.ActiveFunderAddresses { From 92bcd5d54e2e2278c6caff40d81092eea35edebf Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 28 Sep 2023 11:16:03 +0200 Subject: [PATCH 030/109] chore: remove unnecessary tests --- x/funders/genesis_test.go | 29 ------------------- x/funders/keeper/msg_server_test.go | 23 --------------- x/funders/keeper/params_test.go | 18 ------------ x/funders/keeper/query_params_test.go | 21 -------------- x/funders/types/genesis_test.go | 41 --------------------------- 5 files changed, 132 deletions(-) delete mode 100644 x/funders/genesis_test.go delete mode 100644 x/funders/keeper/msg_server_test.go delete mode 100644 x/funders/keeper/params_test.go delete mode 100644 x/funders/keeper/query_params_test.go delete mode 100644 x/funders/types/genesis_test.go diff --git a/x/funders/genesis_test.go b/x/funders/genesis_test.go deleted file mode 100644 index 19cd91b1..00000000 --- a/x/funders/genesis_test.go +++ /dev/null @@ -1,29 +0,0 @@ -package funders_test - -import ( - "testing" - - keepertest "github.com/KYVENetwork/chain/testutil/keeper" - "github.com/KYVENetwork/chain/testutil/nullify" - "github.com/KYVENetwork/chain/x/funders" - "github.com/KYVENetwork/chain/x/funders/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.FundersKeeper(t) - funders.InitGenesis(ctx, *k, genesisState) - got := funders.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/funders/keeper/msg_server_test.go b/x/funders/keeper/msg_server_test.go deleted file mode 100644 index b67f11c0..00000000 --- a/x/funders/keeper/msg_server_test.go +++ /dev/null @@ -1,23 +0,0 @@ -package keeper_test - -import ( - "context" - "testing" - - keepertest "github.com/KYVENetwork/chain/testutil/keeper" - "github.com/KYVENetwork/chain/x/funders/keeper" - "github.com/KYVENetwork/chain/x/funders/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" -) - -func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { - k, ctx := keepertest.FundersKeeper(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/funders/keeper/params_test.go b/x/funders/keeper/params_test.go deleted file mode 100644 index 5ce8fda1..00000000 --- a/x/funders/keeper/params_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package keeper_test - -import ( - "testing" - - testkeeper "github.com/KYVENetwork/chain/testutil/keeper" - "github.com/KYVENetwork/chain/x/funders/types" - "github.com/stretchr/testify/require" -) - -func TestGetParams(t *testing.T) { - k, ctx := testkeeper.FundersKeeper(t) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) -} diff --git a/x/funders/keeper/query_params_test.go b/x/funders/keeper/query_params_test.go deleted file mode 100644 index 956d0d37..00000000 --- a/x/funders/keeper/query_params_test.go +++ /dev/null @@ -1,21 +0,0 @@ -package keeper_test - -import ( - "testing" - - testkeeper "github.com/KYVENetwork/chain/testutil/keeper" - "github.com/KYVENetwork/chain/x/funders/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" -) - -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.FundersKeeper(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/funders/types/genesis_test.go b/x/funders/types/genesis_test.go deleted file mode 100644 index ddea9f14..00000000 --- a/x/funders/types/genesis_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/KYVENetwork/chain/x/funders/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{ - - // 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) - } - }) - } -} From d4f71d0403a0e9014f3b56a3465d0fc8d90499a7 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 28 Sep 2023 11:18:37 +0200 Subject: [PATCH 031/109] chore: update defund logic --- x/funders/keeper/msg_server_defund_pool.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/x/funders/keeper/msg_server_defund_pool.go b/x/funders/keeper/msg_server_defund_pool.go index efa0c5f6..c6a098cb 100644 --- a/x/funders/keeper/msg_server_defund_pool.go +++ b/x/funders/keeper/msg_server_defund_pool.go @@ -33,13 +33,8 @@ func (k msgServer) DefundPool(goCtx context.Context, msg *types.MsgDefundPool) ( util.PanicHalt(k.upgradeKeeper, ctx, fmt.Sprintf("FundingState for pool %d does not exist", msg.PoolId)) } - // Amount can not be higher than the current funding amount - amount := msg.Amount - if amount > funding.Amount { - amount = funding.Amount - } - - funding.SubtractAmount(amount) + // Subtract amount from funding + amount := funding.SubtractAmount(msg.Amount) if funding.Amount == 0 { fundingState.SetInactive(&funding) } From 7c57a1d0f6f205126751792dcc357a5025409fc8 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 28 Sep 2023 14:56:14 +0200 Subject: [PATCH 032/109] feat: add FundersKeeper in app.go --- app/app.go | 27 +++++++++++++++------------ x/funders/keeper/keeper.go | 4 +++- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/app/app.go b/app/app.go index 1fc461c9..c8e432df 100644 --- a/app/app.go +++ b/app/app.go @@ -515,8 +515,22 @@ func NewKYVEApp( app.StakersKeeper, ) + app.FundersKeeper = *fundersKeeper.NewKeeper( + appCodec, + keys[fundersTypes.StoreKey], + memKeys[fundersTypes.MemStoreKey], + + authTypes.NewModuleAddress(govTypes.ModuleName).String(), + + app.AccountKeeper, + app.BankKeeper, + app.PoolKeeper, + app.UpgradeKeeper, + ) + stakersKeeper.SetDelegationKeeper(&app.StakersKeeper, app.DelegationKeeper) poolKeeper.SetStakersKeeper(&app.PoolKeeper, app.StakersKeeper) + poolKeeper.SetFundersKeeper(&app.PoolKeeper, app.FundersKeeper) app.BundlesKeeper = *bundlesKeeper.NewKeeper( appCodec, @@ -531,18 +545,7 @@ func NewKYVEApp( app.PoolKeeper, app.StakersKeeper, app.DelegationKeeper, - ) - - app.FundersKeeper = *fundersKeeper.NewKeeper( - appCodec, - keys[fundersTypes.StoreKey], - memKeys[fundersTypes.MemStoreKey], - - authTypes.NewModuleAddress(govTypes.ModuleName).String(), - - app.BankKeeper, - app.PoolKeeper, - app.UpgradeKeeper, + app.FundersKeeper, ) app.IBCKeeper = ibcKeeper.NewKeeper( diff --git a/x/funders/keeper/keeper.go b/x/funders/keeper/keeper.go index 50e898c2..e42d32c7 100644 --- a/x/funders/keeper/keeper.go +++ b/x/funders/keeper/keeper.go @@ -3,7 +3,6 @@ package keeper import ( "fmt" "github.com/KYVENetwork/chain/util" - "github.com/KYVENetwork/chain/x/funders/types" "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" @@ -19,6 +18,7 @@ type ( authority string + accountKeeper types.AccountKeeper bankKeeper util.BankKeeper poolKeeper types.PoolKeeper upgradeKeeper util.UpgradeKeeper @@ -32,6 +32,7 @@ func NewKeeper( authority string, + accountKeeper types.AccountKeeper, bankKeeper util.BankKeeper, poolKeeper types.PoolKeeper, upgradeKeeper util.UpgradeKeeper, @@ -43,6 +44,7 @@ func NewKeeper( authority: authority, + accountKeeper: accountKeeper, bankKeeper: bankKeeper, poolKeeper: poolKeeper, upgradeKeeper: upgradeKeeper, From c5748759cc3ecac205e14fae015d5e36d0275c73 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 28 Sep 2023 15:02:54 +0200 Subject: [PATCH 033/109] feat: add CreateFundingState and DefundFundingState --- x/funders/keeper/logic_funders.go | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/x/funders/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go index 4f5057eb..b7693ba0 100644 --- a/x/funders/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -2,11 +2,49 @@ package keeper import ( "cosmossdk.io/errors" + "github.com/KYVENetwork/chain/util" "github.com/KYVENetwork/chain/x/funders/types" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) +func (k Keeper) CreateFundingState(ctx sdk.Context, poolId uint64) { + fundingState := types.FundingState{ + PoolId: poolId, + ActiveFunderAddresses: []string{}, + TotalAmount: 0, + } + k.SetFundingState(ctx, &fundingState) +} + +func (k Keeper) DefundFundingState(ctx sdk.Context, poolId uint64) (err error) { + // Get funding state for pool + fundingState, found := k.GetFundingState(ctx, poolId) + if !found { + return errors.Wrapf(errorsTypes.ErrNotFound, types.ErrFundingStateDoesNotExist.Error(), poolId) + } + + // If there are no active fundings we immediately return + activeFundings := k.GetActiveFundings(ctx, fundingState) + if len(activeFundings) == 0 { + return nil + } + + // Transfer tokens back to funders + for _, funding := range activeFundings { + if err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, types.ModuleName, funding.FunderAddress, funding.Amount); err != nil { + return err + } + k.SetFunding(ctx, &funding) + } + + // Save funding state + fundingState.TotalAmount = 0 + fundingState.ActiveFunderAddresses = []string{} + k.SetFundingState(ctx, &fundingState) + return nil +} + // ChargeFundersOfPool equally splits the amount between all funders and removes // the appropriate amount from each funder. // All funders who can't afford the amount, are kicked out. From 11d648b0e5f43f05787de9084158f32ace8b4b32 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 28 Sep 2023 15:03:51 +0200 Subject: [PATCH 034/109] chore: small fixes --- .../keeper/msg_server_create_funder_test.go | 8 ++++---- x/funders/keeper/msg_server_fund_pool.go | 9 +-------- x/funders/types/errors.go | 19 ++++++++++--------- x/funders/types/expected_keepers.go | 7 ++++++- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/x/funders/keeper/msg_server_create_funder_test.go b/x/funders/keeper/msg_server_create_funder_test.go index a241c804..47059506 100644 --- a/x/funders/keeper/msg_server_create_funder_test.go +++ b/x/funders/keeper/msg_server_create_funder_test.go @@ -12,10 +12,10 @@ import ( TEST CASES - msg_server_create_funder.go -* Create a funder with empty values +* Try to create a funder with empty values * Create a funder with empty values except moniker * Create a funder with all values set -* Create a funder that already exists +* Try to create a funder that already exists * Create two funders with the same moniker // TODO: should this be allowed? * Create two funders */ @@ -32,7 +32,7 @@ var _ = Describe("msg_server_create_funder.go", Ordered, func() { s.PerformValidityChecks() }) - It("Create a funder with empty values", func() { + It("Try to create a funder with empty values", func() { // ASSERT s.RunTxFundersError(&types.MsgCreateFunder{ Creator: i.ALICE, @@ -83,7 +83,7 @@ var _ = Describe("msg_server_create_funder.go", Ordered, func() { Expect(funder.Description).To(Equal(description)) }) - It("Create a funder that already exists", func() { + It("Try to create a funder that already exists", func() { // ARRANGE s.RunTxFundersSuccess(&types.MsgCreateFunder{ Creator: i.ALICE, diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go index 36788dd2..044cf923 100644 --- a/x/funders/keeper/msg_server_fund_pool.go +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -2,7 +2,6 @@ package keeper import ( "context" - "cosmossdk.io/errors" "github.com/KYVENetwork/chain/util" "github.com/KYVENetwork/chain/x/funders/types" @@ -56,13 +55,7 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ // Get or create funding state for pool fundingState, found := k.GetFundingState(ctx, msg.PoolId) if !found { - // TODO: should we create a funding state when the pool is created? - fundingState = types.FundingState{ - PoolId: msg.PoolId, - ActiveFunderAddresses: []string{}, - TotalAmount: 0, - } - k.SetFundingState(ctx, &fundingState) + return nil, errors.Wrapf(errorsTypes.ErrNotFound, types.ErrFundingStateDoesNotExist.Error(), msg.PoolId) } // Check if funding already exists diff --git a/x/funders/types/errors.go b/x/funders/types/errors.go index d630c94b..9ef4f4f9 100644 --- a/x/funders/types/errors.go +++ b/x/funders/types/errors.go @@ -6,13 +6,14 @@ import ( // x/funders module sentinel errors var ( - ErrFunderAlreadyExists = errors.Register(ModuleName, 1100, "funder with address %v already exists") - ErrFunderDoesNotExist = errors.Register(ModuleName, 1101, "funder with address %v does not exist") - ErrFundsTooLow = errors.Register(ModuleName, 1102, "minimum funding amount of %vkyve not reached") - ErrAmountPerBundleTooLow = errors.Register(ModuleName, 1103, "minimum amount per bundle of %vkyve not reached") - ErrMinFundingAmount = errors.Register(ModuleName, 1104, "minimum funding amount of %vkyve not reached") - ErrFundingDoesNotExist = errors.Register(ModuleName, 1105, "funding for pool %v and funder %v does not exist") - ErrFundingIsUsedUp = errors.Register(ModuleName, 1106, "funding for pool %v and funder %v is used up") - ErrFundingStateDoesNotExist = errors.Register(ModuleName, 1107, "funding state for pool %v does not exist") - //ErrDefundTooHigh = errors.Register(ModuleName, 1102, "maximum defunding amount of %vkyve surpassed") + ErrFunderAlreadyExists = errors.Register(ModuleName, 1100, "funder with address %v already exists") + ErrFunderDoesNotExist = errors.Register(ModuleName, 1101, "funder with address %v does not exist") + ErrFundsTooLow = errors.Register(ModuleName, 1102, "minimum funding amount of %vkyve not reached") + ErrAmountPerBundleTooLow = errors.Register(ModuleName, 1103, "minimum amount per bundle of %vkyve not reached") + ErrMinFundingAmount = errors.Register(ModuleName, 1104, "minimum funding amount of %vkyve not reached") + ErrFundingDoesNotExist = errors.Register(ModuleName, 1105, "funding for pool %v and funder %v does not exist") + ErrFundingIsUsedUp = errors.Register(ModuleName, 1106, "funding for pool %v and funder %v is used up") + + ErrFundingStateDoesNotExist = errors.Register(ModuleName, 1107, "funding state for pool %v does not exist") + ErrFundingStateAlreadyExists = errors.Register(ModuleName, 1108, "funding state for pool %v already exists") ) diff --git a/x/funders/types/expected_keepers.go b/x/funders/types/expected_keepers.go index 71c97ec0..e4dacee0 100644 --- a/x/funders/types/expected_keepers.go +++ b/x/funders/types/expected_keepers.go @@ -2,9 +2,14 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/types" ) +type AccountKeeper interface { + GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI + SetAccount(ctx sdk.Context, acc types.AccountI) +} + type PoolKeeper interface { AssertPoolExists(ctx sdk.Context, poolId uint64) error - //GetPoolWithError(ctx sdk.Context, poolId uint64) (pooltypes.Pool, error) } From 7a0cc832049103ecb09f96de9117cd8d96bd7705 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 28 Sep 2023 15:34:49 +0200 Subject: [PATCH 035/109] fix: fix pool tests --- x/pool/keeper/keeper.go | 11 +- x/pool/keeper/msg_server_create_pool.go | 1 + x/pool/keeper/msg_server_create_pool_test.go | 22 ++- x/pool/keeper/msg_server_disable_pool.go | 4 + x/pool/keeper/msg_server_disable_pool_test.go | 129 ++++++++++++------ x/pool/keeper/msg_server_update_pool_test.go | 6 - x/pool/types/expected_keepers.go | 11 +- 7 files changed, 128 insertions(+), 56 deletions(-) diff --git a/x/pool/keeper/keeper.go b/x/pool/keeper/keeper.go index bf73b53f..64c15511 100644 --- a/x/pool/keeper/keeper.go +++ b/x/pool/keeper/keeper.go @@ -8,8 +8,6 @@ import ( storeTypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - // Auth - authKeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authTypes "github.com/cosmos/cosmos-sdk/x/auth/types" // Bank bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -32,12 +30,13 @@ type ( authority string stakersKeeper types.StakersKeeper - accountKeeper authKeeper.AccountKeeper + accountKeeper types.AccountKeeper bankKeeper bankKeeper.Keeper distrkeeper distributionKeeper.Keeper mintKeeper mintKeeper.Keeper upgradeKeeper types.UpgradeKeeper teamKeeper teamKeeper.Keeper + fundersKeeper types.FundersKeeper } ) @@ -48,7 +47,7 @@ func NewKeeper( authority string, - accountKeeper authKeeper.AccountKeeper, + accountKeeper types.AccountKeeper, bankKeeper bankKeeper.Keeper, distrKeeper distributionKeeper.Keeper, mintKeeper mintKeeper.Keeper, @@ -94,6 +93,10 @@ func SetStakersKeeper(k *Keeper, stakersKeeper types.StakersKeeper) { k.stakersKeeper = stakersKeeper } +func SetFundersKeeper(k *Keeper, fundersKeeper types.FundersKeeper) { + k.fundersKeeper = fundersKeeper +} + func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } diff --git a/x/pool/keeper/msg_server_create_pool.go b/x/pool/keeper/msg_server_create_pool.go index f69d29c8..64de8791 100644 --- a/x/pool/keeper/msg_server_create_pool.go +++ b/x/pool/keeper/msg_server_create_pool.go @@ -47,6 +47,7 @@ func (k msgServer) CreatePool(goCtx context.Context, req *types.MsgCreatePool) ( }) k.EnsurePoolAccount(ctx, id) + k.fundersKeeper.CreateFundingState(ctx, id) _ = ctx.EventManager().EmitTypedEvent(&types.EventCreatePool{ Id: k.GetPoolCount(ctx) - 1, diff --git a/x/pool/keeper/msg_server_create_pool_test.go b/x/pool/keeper/msg_server_create_pool_test.go index ae9230aa..f1f59df1 100644 --- a/x/pool/keeper/msg_server_create_pool_test.go +++ b/x/pool/keeper/msg_server_create_pool_test.go @@ -2,6 +2,7 @@ package keeper_test import ( i "github.com/KYVENetwork/chain/testutil/integration" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" sdk "github.com/cosmos/cosmos-sdk/types" govV1Types "github.com/cosmos/cosmos-sdk/x/gov/types/v1" . "github.com/onsi/ginkgo/v2" @@ -144,8 +145,6 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Disabled: false, - Funders: nil, - TotalFunds: 0, Protocol: &types.Protocol{ Version: "0.0.0", Binaries: "{}", @@ -160,6 +159,13 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { CurrentStorageProviderId: 2, CurrentCompressionId: 1, })) + + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState).To(Equal(funderstypes.FundingState{ + PoolId: 0, + ActiveFunderAddresses: nil, + TotalAmount: 0, + })) }) It("Create another pool", func() { @@ -247,8 +253,6 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Disabled: false, - Funders: nil, - TotalFunds: 0, Protocol: &types.Protocol{ Version: "0.0.0", Binaries: "{}", @@ -263,6 +267,13 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { CurrentStorageProviderId: 2, CurrentCompressionId: 1, })) + + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 1) + Expect(fundingState).To(Equal(funderstypes.FundingState{ + PoolId: 1, + ActiveFunderAddresses: nil, + TotalAmount: 0, + })) }) It("Create pool with invalid binaries", func() { @@ -303,5 +314,8 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { _, found := s.App().PoolKeeper.GetPool(s.Ctx(), 0) Expect(found).To(BeFalse()) + + _, found = s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(found).To(BeFalse()) }) }) diff --git a/x/pool/keeper/msg_server_disable_pool.go b/x/pool/keeper/msg_server_disable_pool.go index fd34663c..eabbb9de 100644 --- a/x/pool/keeper/msg_server_disable_pool.go +++ b/x/pool/keeper/msg_server_disable_pool.go @@ -44,6 +44,10 @@ func (k msgServer) DisablePool( k.stakersKeeper.LeavePool(ctx, staker, pool.Id) } + if err := k.fundersKeeper.DefundFundingState(ctx, pool.Id); err != nil { + return nil, err + } + // send remaining pool assets to treasury if balance := k.bankKeeper.GetBalance(ctx, pool.GetPoolAccount(), globalTypes.Denom).Amount.Uint64(); balance > 0 { if err := util.TransferFromAddressToTreasury(k.distrkeeper, ctx, pool.GetPoolAccount().String(), balance); err != nil { diff --git a/x/pool/keeper/msg_server_disable_pool_test.go b/x/pool/keeper/msg_server_disable_pool_test.go index 25251059..2cd382d5 100644 --- a/x/pool/keeper/msg_server_disable_pool_test.go +++ b/x/pool/keeper/msg_server_disable_pool_test.go @@ -3,6 +3,7 @@ package keeper_test import ( i "github.com/KYVENetwork/chain/testutil/integration" bundletypes "github.com/KYVENetwork/chain/x/bundles/types" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" globalTypes "github.com/KYVENetwork/chain/x/global/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -38,49 +39,64 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() votingPeriod := s.App().GovKeeper.GetParams(s.Ctx()).VotingPeriod + fundingAmount := 100 * i.KYVE BeforeEach(func() { s = i.NewCleanChain() - // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), types.Pool{ - Name: "PoolTest", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10_000, - Protocol: &types.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &types.UpgradePlan{}, - }) + msg := &types.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + OperatingCost: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) - s.RunTxPoolSuccess(&types.MsgFundPool{ + s.RunTxPoolSuccess(&funderstypes.MsgCreateFunder{ Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + Moniker: "Alice", }) - s.App().PoolKeeper.AppendPool(s.Ctx(), types.Pool{ - Name: "PoolTest2", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10_000, - Protocol: &types.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &types.UpgradePlan{}, + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: fundingAmount, + AmountPerBundle: 1 * i.KYVE, }) - s.RunTxPoolSuccess(&types.MsgFundPool{ - Creator: i.ALICE, - Id: 1, - Amount: 100 * i.KYVE, + msg = &types.MsgCreatePool{ + Authority: gov, + Name: "PoolTest2", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + OperatingCost: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) + + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 1, + Amount: fundingAmount, + AmountPerBundle: 1 * i.KYVE, }) }) @@ -164,6 +180,10 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { p, v := BuildGovernanceTxs(s, []sdk.Msg{msg}) + fundersModuleAddr := s.App().AccountKeeper.GetModuleAddress(funderstypes.ModuleName) + balanceBefore := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAddr, globalTypes.Denom).Amount.Uint64() + Expect(balanceBefore).To(BeNumerically(">", uint64(0))) + // ACT _, submitErr := s.RunTx(&p) _, voteErr := s.RunTx(&v) @@ -184,9 +204,14 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { bundleProposal, _ := s.App().BundlesKeeper.GetBundleProposal(s.Ctx(), 0) Expect(bundleProposal.StorageId).To(BeEmpty()) - // assert empty pool balance - b := s.App().BankKeeper.GetBalance(s.Ctx(), pool.GetPoolAccount(), globalTypes.Denom).Amount.Uint64() - Expect(b).To(BeZero()) + // assert smaller funding balance + balance := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAddr, globalTypes.Denom).Amount.Uint64() + Expect(balance).To(Equal(balanceBefore - fundingAmount)) + + // assert empty funding state + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.TotalAmount).To(BeZero()) + Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) }) It("Disable pool which is active and has a balance", func() { @@ -202,8 +227,13 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { s.Commit() } - b := s.App().BankKeeper.GetBalance(s.Ctx(), pool.GetPoolAccount(), globalTypes.Denom).Amount.Uint64() - Expect(b).To(BeNumerically(">", uint64(0))) + fundersModuleAddr := s.App().AccountKeeper.GetModuleAddress(funderstypes.ModuleName) + balanceBefore := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAddr, globalTypes.Denom).Amount.Uint64() + Expect(balanceBefore).To(BeNumerically(">", uint64(0))) + + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.TotalAmount).To(BeNumerically(">", uint64(0))) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) msg := &types.MsgDisablePool{ Authority: gov, @@ -232,9 +262,14 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { bundleProposal, _ := s.App().BundlesKeeper.GetBundleProposal(s.Ctx(), 0) Expect(bundleProposal.StorageId).To(BeEmpty()) - // assert empty pool balance - b = s.App().BankKeeper.GetBalance(s.Ctx(), pool.GetPoolAccount(), globalTypes.Denom).Amount.Uint64() - Expect(b).To(BeZero()) + // assert smaller funding balance + balance := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAddr, globalTypes.Denom).Amount.Uint64() + Expect(balance).To(Equal(balanceBefore - fundingState.TotalAmount)) + + // assert empty funding state + fundingState, _ = s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.TotalAmount).To(BeZero()) + Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) }) It("Disable pool which is active", func() { @@ -338,6 +373,18 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { bundleProposal, _ = s.App().BundlesKeeper.GetBundleProposal(s.Ctx(), 1) Expect(bundleProposal.StorageId).To(BeEmpty()) + + // assert empty funding balance + fundersModuleAddr := s.App().AccountKeeper.GetModuleAddress(funderstypes.ModuleName) + balance := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAddr, globalTypes.Denom).Amount.Uint64() + Expect(balance).To(BeZero()) + + // assert empty funding states + for _, poolId := range []uint64{0, 1} { + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), poolId) + Expect(fundingState.TotalAmount).To(BeZero()) + Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) + } }) It("Kick out all stakers from pool", func() { diff --git a/x/pool/keeper/msg_server_update_pool_test.go b/x/pool/keeper/msg_server_update_pool_test.go index 8468e995..b212f96f 100644 --- a/x/pool/keeper/msg_server_update_pool_test.go +++ b/x/pool/keeper/msg_server_update_pool_test.go @@ -127,8 +127,6 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Disabled: false, - Funders: nil, - TotalFunds: 0, Protocol: &types.Protocol{ Version: "", Binaries: "", @@ -187,8 +185,6 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { MinDelegation: 0, MaxBundleSize: 0, Disabled: false, - Funders: nil, - TotalFunds: 0, Protocol: &types.Protocol{ Version: "", Binaries: "", @@ -262,8 +258,6 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Disabled: false, - Funders: nil, - TotalFunds: 0, Protocol: &types.Protocol{ Version: "", Binaries: "", diff --git a/x/pool/types/expected_keepers.go b/x/pool/types/expected_keepers.go index 3c5ee050..315765a3 100644 --- a/x/pool/types/expected_keepers.go +++ b/x/pool/types/expected_keepers.go @@ -2,10 +2,14 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) -type AccountKeeper interface{} +type AccountKeeper interface { + GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI + SetAccount(ctx sdk.Context, acc types.AccountI) +} type UpgradeKeeper interface { ScheduleUpgrade(ctx sdk.Context, plan upgradetypes.Plan) error @@ -15,3 +19,8 @@ type StakersKeeper interface { LeavePool(ctx sdk.Context, staker string, poolId uint64) GetAllStakerAddressesOfPool(ctx sdk.Context, poolId uint64) (stakers []string) } + +type FundersKeeper interface { + CreateFundingState(ctx sdk.Context, poolId uint64) + DefundFundingState(ctx sdk.Context, poolId uint64) (err error) +} From 58b5d72623e658141d61b642b8aeb99191fb85eb Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 28 Sep 2023 15:37:02 +0200 Subject: [PATCH 036/109] fix: fix todo --- x/pool/types/genesis.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/x/pool/types/genesis.go b/x/pool/types/genesis.go index db38b8ed..096e5892 100644 --- a/x/pool/types/genesis.go +++ b/x/pool/types/genesis.go @@ -26,10 +26,6 @@ func (gs GenesisState) Validate() error { if elem.Id >= gs.PoolCount { return fmt.Errorf("pool id higher than pool count %v", elem) } - // TODO: fix this - //if len(elem.Funders) > fundersTypes.MaxFunders { - // return fmt.Errorf("more funders than allowed %v", elem) - //} } return gs.Params.Validate() From d120ddb7548825e4e884984762078e14e7ea4e41 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 28 Sep 2023 16:39:57 +0200 Subject: [PATCH 037/109] fix: rename operating_cost to inflation_share_weight --- docs/swagger.yml | 50 +++---- proto/kyve/pool/v1beta1/events.proto | 8 +- proto/kyve/pool/v1beta1/pool.proto | 4 +- proto/kyve/pool/v1beta1/tx.proto | 4 +- proto/kyve/query/v1beta1/query.proto | 4 +- x/pool/keeper/msg_server_create_pool.go | 46 +++--- x/pool/keeper/msg_server_disable_pool.go | 4 - x/pool/keeper/msg_server_update_pool.go | 28 ++-- x/pool/keeper/msg_server_update_pool_test.go | 14 +- x/pool/spec/02_state.md | 4 +- x/pool/types/events.pb.go | 142 +++++++++---------- x/pool/types/msgs.go | 30 ++-- x/pool/types/pool.pb.go | 121 ++++++++-------- x/pool/types/tx.pb.go | 125 ++++++++-------- 14 files changed, 291 insertions(+), 293 deletions(-) diff --git a/docs/swagger.yml b/docs/swagger.yml index c6b863c2..383e8a73 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -647,12 +647,12 @@ paths: logo: type: string title: logo of the pool - operating_cost: + inflation_share_weight: type: string format: uint64 title: >- - operating_cost is the base payout for each - bundle reward + inflation_share_weight is the base payout + for each bundle reward upload_interval: type: string format: uint64 @@ -1051,12 +1051,12 @@ paths: logo: type: string title: logo of the pool - operating_cost: + inflation_share_weight: type: string format: uint64 title: >- - operating_cost is the base payout for each bundle - reward + inflation_share_weight is the base payout for each + bundle reward upload_interval: type: string format: uint64 @@ -3913,12 +3913,12 @@ paths: logo: type: string title: logo of the pool - operating_cost: + inflation_share_weight: type: string format: uint64 title: >- - operating_cost is the base payout for each - bundle reward + inflation_share_weight is the base payout + for each bundle reward upload_interval: type: string format: uint64 @@ -4768,10 +4768,10 @@ paths: type: string format: uint64 description: upload_interval ... - operating_cost: + inflation_share_weight: type: string format: uint64 - description: operating_cost ... + description: inflation_share_weight ... min_delegation: type: string format: uint64 @@ -5260,10 +5260,10 @@ paths: type: string format: uint64 description: upload_interval ... - operating_cost: + inflation_share_weight: type: string format: uint64 - description: operating_cost ... + description: inflation_share_weight ... min_delegation: type: string format: uint64 @@ -5910,12 +5910,12 @@ paths: logo: type: string title: logo of the pool - operating_cost: + inflation_share_weight: type: string format: uint64 title: >- - operating_cost is the base payout for each - bundle reward + inflation_share_weight is the base payout for + each bundle reward upload_interval: type: string format: uint64 @@ -6339,12 +6339,12 @@ paths: logo: type: string title: logo of the pool - operating_cost: + inflation_share_weight: type: string format: uint64 title: >- - operating_cost is the base payout for each - bundle reward + inflation_share_weight is the base payout for + each bundle reward upload_interval: type: string format: uint64 @@ -6878,12 +6878,12 @@ paths: logo: type: string title: logo of the pool - operating_cost: + inflation_share_weight: type: string format: uint64 title: >- - operating_cost is the base payout for each - bundle reward + inflation_share_weight is the base payout + for each bundle reward upload_interval: type: string format: uint64 @@ -7352,12 +7352,12 @@ paths: logo: type: string title: logo of the pool - operating_cost: + inflation_share_weight: type: string format: uint64 title: >- - operating_cost is the base payout for each - bundle reward + inflation_share_weight is the base payout for + each bundle reward upload_interval: type: string format: uint64 diff --git a/proto/kyve/pool/v1beta1/events.proto b/proto/kyve/pool/v1beta1/events.proto index bbbc38ee..2c0d83fc 100644 --- a/proto/kyve/pool/v1beta1/events.proto +++ b/proto/kyve/pool/v1beta1/events.proto @@ -38,9 +38,9 @@ message EventCreatePool { // upload_interval is the interval the pool should validate // bundles with uint64 upload_interval = 7; - // operating_cost is the fixed cost which gets paid out + // inflation_share_weight is the fixed cost which gets paid out // to every successful uploader - uint64 operating_cost = 8; + uint64 inflation_share_weight = 8; // min_delegation is the minimum amount of $KYVE the pool has // to have in order to produce bundles uint64 min_delegation = 9; @@ -121,9 +121,9 @@ message EventPoolUpdated { // upload_interval is the interval the pool should validate // bundles with uint64 upload_interval = 7; - // operating_cost is the fixed cost which gets paid out + // inflation_share_weight is the fixed cost which gets paid out // to every successful uploader - uint64 operating_cost = 8; + uint64 inflation_share_weight = 8; // min_delegation is the minimum amount of $KYVE the pool has // to have in order to produce bundles uint64 min_delegation = 9; diff --git a/proto/kyve/pool/v1beta1/pool.proto b/proto/kyve/pool/v1beta1/pool.proto index 3014efc2..1cb7020a 100644 --- a/proto/kyve/pool/v1beta1/pool.proto +++ b/proto/kyve/pool/v1beta1/pool.proto @@ -79,8 +79,8 @@ message Pool { // upload_interval ... uint64 upload_interval = 11; - // operating_cost ... - uint64 operating_cost = 12; + // inflation_share_weight ... + uint64 inflation_share_weight = 12; // min_delegation ... uint64 min_delegation = 13; // max_bundle_size ... diff --git a/proto/kyve/pool/v1beta1/tx.proto b/proto/kyve/pool/v1beta1/tx.proto index ff26fcc3..808618a3 100644 --- a/proto/kyve/pool/v1beta1/tx.proto +++ b/proto/kyve/pool/v1beta1/tx.proto @@ -47,8 +47,8 @@ message MsgCreatePool { string start_key = 6; // upload_interval ... uint64 upload_interval = 7; - // operating_cost ... - uint64 operating_cost = 8; + // inflation_share_weight ... + uint64 inflation_share_weight = 8; // min_delegation ... uint64 min_delegation = 9; // max_bundle_size ... diff --git a/proto/kyve/query/v1beta1/query.proto b/proto/kyve/query/v1beta1/query.proto index b8033a71..cc150e36 100644 --- a/proto/kyve/query/v1beta1/query.proto +++ b/proto/kyve/query/v1beta1/query.proto @@ -38,8 +38,8 @@ message BasicPool { // logo of the pool string logo = 4; - // operating_cost is the base payout for each bundle reward - uint64 operating_cost = 5; + // inflation_share_weight is the base payout for each bundle reward + uint64 inflation_share_weight = 5; // upload_interval is the interval bundles get created uint64 upload_interval = 6; diff --git a/x/pool/keeper/msg_server_create_pool.go b/x/pool/keeper/msg_server_create_pool.go index 64de8791..2aaa5ee4 100644 --- a/x/pool/keeper/msg_server_create_pool.go +++ b/x/pool/keeper/msg_server_create_pool.go @@ -27,15 +27,15 @@ func (k msgServer) CreatePool(goCtx context.Context, req *types.MsgCreatePool) ( ctx := sdk.UnwrapSDKContext(goCtx) id := k.AppendPool(ctx, types.Pool{ - Name: req.Name, - Runtime: req.Runtime, - Logo: req.Logo, - Config: req.Config, - StartKey: req.StartKey, - UploadInterval: req.UploadInterval, - OperatingCost: req.OperatingCost, - MinDelegation: req.MinDelegation, - MaxBundleSize: req.MaxBundleSize, + Name: req.Name, + Runtime: req.Runtime, + Logo: req.Logo, + Config: req.Config, + StartKey: req.StartKey, + UploadInterval: req.UploadInterval, + InflationShareWeight: req.InflationShareWeight, + MinDelegation: req.MinDelegation, + MaxBundleSize: req.MaxBundleSize, Protocol: &types.Protocol{ Version: req.Version, Binaries: req.Binaries, @@ -50,20 +50,20 @@ func (k msgServer) CreatePool(goCtx context.Context, req *types.MsgCreatePool) ( k.fundersKeeper.CreateFundingState(ctx, id) _ = ctx.EventManager().EmitTypedEvent(&types.EventCreatePool{ - Id: k.GetPoolCount(ctx) - 1, - Name: req.Name, - Runtime: req.Runtime, - Logo: req.Logo, - Config: req.Config, - StartKey: req.StartKey, - UploadInterval: req.UploadInterval, - OperatingCost: req.OperatingCost, - MinDelegation: req.MinDelegation, - MaxBundleSize: req.MaxBundleSize, - Version: req.Version, - Binaries: req.Binaries, - StorageProviderId: req.StorageProviderId, - CompressionId: req.CompressionId, + Id: k.GetPoolCount(ctx) - 1, + Name: req.Name, + Runtime: req.Runtime, + Logo: req.Logo, + Config: req.Config, + StartKey: req.StartKey, + UploadInterval: req.UploadInterval, + InflationShareWeight: req.InflationShareWeight, + MinDelegation: req.MinDelegation, + MaxBundleSize: req.MaxBundleSize, + Version: req.Version, + Binaries: req.Binaries, + StorageProviderId: req.StorageProviderId, + CompressionId: req.CompressionId, }) return &types.MsgCreatePoolResponse{}, nil diff --git a/x/pool/keeper/msg_server_disable_pool.go b/x/pool/keeper/msg_server_disable_pool.go index eabbb9de..fd34663c 100644 --- a/x/pool/keeper/msg_server_disable_pool.go +++ b/x/pool/keeper/msg_server_disable_pool.go @@ -44,10 +44,6 @@ func (k msgServer) DisablePool( k.stakersKeeper.LeavePool(ctx, staker, pool.Id) } - if err := k.fundersKeeper.DefundFundingState(ctx, pool.Id); err != nil { - return nil, err - } - // send remaining pool assets to treasury if balance := k.bankKeeper.GetBalance(ctx, pool.GetPoolAccount(), globalTypes.Denom).Amount.Uint64(); balance > 0 { if err := util.TransferFromAddressToTreasury(k.distrkeeper, ctx, pool.GetPoolAccount().String(), balance); err != nil { diff --git a/x/pool/keeper/msg_server_update_pool.go b/x/pool/keeper/msg_server_update_pool.go index f8378a13..41f452f1 100644 --- a/x/pool/keeper/msg_server_update_pool.go +++ b/x/pool/keeper/msg_server_update_pool.go @@ -44,8 +44,8 @@ func (k msgServer) UpdatePool(goCtx context.Context, req *types.MsgUpdatePool) ( if update.UploadInterval != nil { pool.UploadInterval = *update.UploadInterval } - if update.OperatingCost != nil { - pool.OperatingCost = *update.OperatingCost + if update.InflationShareWeight != nil { + pool.InflationShareWeight = *update.InflationShareWeight } if update.MinDelegation != nil { pool.MinDelegation = *update.MinDelegation @@ -63,18 +63,18 @@ func (k msgServer) UpdatePool(goCtx context.Context, req *types.MsgUpdatePool) ( k.SetPool(ctx, pool) _ = ctx.EventManager().EmitTypedEvent(&types.EventPoolUpdated{ - Id: pool.Id, - RawUpdateString: req.Payload, - Name: pool.Name, - Runtime: pool.Runtime, - Logo: pool.Logo, - Config: pool.Config, - UploadInterval: pool.UploadInterval, - OperatingCost: pool.OperatingCost, - MinDelegation: pool.MinDelegation, - MaxBundleSize: pool.MaxBundleSize, - StorageProviderId: pool.CurrentStorageProviderId, - CompressionId: pool.CurrentCompressionId, + Id: pool.Id, + RawUpdateString: req.Payload, + Name: pool.Name, + Runtime: pool.Runtime, + Logo: pool.Logo, + Config: pool.Config, + UploadInterval: pool.UploadInterval, + InflationShareWeight: pool.InflationShareWeight, + MinDelegation: pool.MinDelegation, + MaxBundleSize: pool.MaxBundleSize, + StorageProviderId: pool.CurrentStorageProviderId, + CompressionId: pool.CurrentCompressionId, }) return &types.MsgUpdatePoolResponse{}, nil diff --git a/x/pool/keeper/msg_server_update_pool_test.go b/x/pool/keeper/msg_server_update_pool_test.go index b212f96f..ff4e3d50 100644 --- a/x/pool/keeper/msg_server_update_pool_test.go +++ b/x/pool/keeper/msg_server_update_pool_test.go @@ -58,7 +58,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { msg := &types.MsgUpdatePool{ Authority: i.DUMMY[0], Id: 0, - Payload: "{\"Name\":\"TestPool\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"OperatingCost\":10000,\"MinDelegation\":\"100000000000\",\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1}", + Payload: "{\"Name\":\"TestPool\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"InflationShareWeight\":10000,\"MinDelegation\":\"100000000000\",\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1}", } // ACT @@ -73,7 +73,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { msg := &types.MsgUpdatePool{ Authority: i.DUMMY[0], Id: 0, - Payload: "{\"Name\":\"TestPool\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"OperatingCost\":10000,\"MinDelegation\":\"100000000000\",\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1}", + Payload: "{\"Name\":\"TestPool\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"InflationShareWeight\":10000,\"MinDelegation\":\"100000000000\",\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1}", } proposal, _ := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -90,7 +90,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { msg := &types.MsgUpdatePool{ Authority: gov, Id: 0, - Payload: "{\"Name\":\"TestPool\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"OperatingCost\":10000,\"MinDelegation\":100000000000,\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1}", + Payload: "{\"Name\":\"TestPool\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"InflationShareWeight\":10000,\"MinDelegation\":100000000000,\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1}", } p, v := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -222,7 +222,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { msg := &types.MsgUpdatePool{ Authority: gov, Id: 1, - Payload: "{\"Name\":\"TestPool2\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"OperatingCost\":10000,\"MinDelegation\":100000000000,\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1}", + Payload: "{\"Name\":\"TestPool2\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"InflationShareWeight\":10000,\"MinDelegation\":100000000000,\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1}", } p, v := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -279,7 +279,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { msg := &types.MsgUpdatePool{ Authority: gov, Id: 1, - Payload: "invalid_json_payload\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"OperatingCost\":10000,\"MinDelegation\":100000000000,\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1}", + Payload: "invalid_json_payload\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"InflationShareWeight\":10000,\"MinDelegation\":100000000000,\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1}", } p, _ := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -316,12 +316,12 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { Expect(pool.Name).To(BeEmpty()) }) - It("Update pool with invalid OperatingCost", func() { + It("Update pool with invalid InflationShareWeight", func() { // ARRANGE msg := &types.MsgUpdatePool{ Authority: gov, Id: 1, - Payload: "{\"OperatingCost\": -1}", + Payload: "{\"InflationShareWeight\": -1}", } p, _ := BuildGovernanceTxs(s, []sdk.Msg{msg}) diff --git a/x/pool/spec/02_state.md b/x/pool/spec/02_state.md index 2aae48cb..c8b582b8 100644 --- a/x/pool/spec/02_state.md +++ b/x/pool/spec/02_state.md @@ -103,8 +103,8 @@ message Pool { // upload_interval ... uint64 upload_interval = 11; - // operating_cost ... - uint64 operating_cost = 12; + // inflation_share_weight ... + uint64 inflation_share_weight = 12; // min_delegation ... uint64 min_delegation = 13; // max_bundle_size ... diff --git a/x/pool/types/events.pb.go b/x/pool/types/events.pb.go index 383d3838..35d7e1a4 100644 --- a/x/pool/types/events.pb.go +++ b/x/pool/types/events.pb.go @@ -108,9 +108,9 @@ type EventCreatePool struct { // upload_interval is the interval the pool should validate // bundles with UploadInterval uint64 `protobuf:"varint,7,opt,name=upload_interval,json=uploadInterval,proto3" json:"upload_interval,omitempty"` - // operating_cost is the fixed cost which gets paid out + // inflation_share_weight is the fixed cost which gets paid out // to every successful uploader - OperatingCost uint64 `protobuf:"varint,8,opt,name=operating_cost,json=operatingCost,proto3" json:"operating_cost,omitempty"` + InflationShareWeight uint64 `protobuf:"varint,8,opt,name=inflation_share_weight,json=inflationShareWeight,proto3" json:"inflation_share_weight,omitempty"` // min_delegation is the minimum amount of $KYVE the pool has // to have in order to produce bundles MinDelegation uint64 `protobuf:"varint,9,opt,name=min_delegation,json=minDelegation,proto3" json:"min_delegation,omitempty"` @@ -211,9 +211,9 @@ func (m *EventCreatePool) GetUploadInterval() uint64 { return 0 } -func (m *EventCreatePool) GetOperatingCost() uint64 { +func (m *EventCreatePool) GetInflationShareWeight() uint64 { if m != nil { - return m.OperatingCost + return m.InflationShareWeight } return 0 } @@ -524,9 +524,9 @@ type EventPoolUpdated struct { // upload_interval is the interval the pool should validate // bundles with UploadInterval uint64 `protobuf:"varint,7,opt,name=upload_interval,json=uploadInterval,proto3" json:"upload_interval,omitempty"` - // operating_cost is the fixed cost which gets paid out + // inflation_share_weight is the fixed cost which gets paid out // to every successful uploader - OperatingCost uint64 `protobuf:"varint,8,opt,name=operating_cost,json=operatingCost,proto3" json:"operating_cost,omitempty"` + InflationShareWeight uint64 `protobuf:"varint,8,opt,name=inflation_share_weight,json=inflationShareWeight,proto3" json:"inflation_share_weight,omitempty"` // min_delegation is the minimum amount of $KYVE the pool has // to have in order to produce bundles MinDelegation uint64 `protobuf:"varint,9,opt,name=min_delegation,json=minDelegation,proto3" json:"min_delegation,omitempty"` @@ -623,9 +623,9 @@ func (m *EventPoolUpdated) GetUploadInterval() uint64 { return 0 } -func (m *EventPoolUpdated) GetOperatingCost() uint64 { +func (m *EventPoolUpdated) GetInflationShareWeight() uint64 { if m != nil { - return m.OperatingCost + return m.InflationShareWeight } return 0 } @@ -737,55 +737,55 @@ func init() { func init() { proto.RegisterFile("kyve/pool/v1beta1/events.proto", fileDescriptor_c1828a100d789238) } var fileDescriptor_c1828a100d789238 = []byte{ - // 756 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcd, 0x6e, 0xdb, 0x38, - 0x10, 0xb6, 0x6c, 0xc7, 0x89, 0xe9, 0xd8, 0x5e, 0x6b, 0xff, 0xb4, 0xd9, 0x85, 0xd7, 0xeb, 0x45, - 0x76, 0xb3, 0x7b, 0xb0, 0x91, 0xf6, 0x5e, 0xa0, 0x71, 0x52, 0xc0, 0x08, 0x50, 0x04, 0x36, 0x52, - 0xa0, 0xbd, 0x08, 0xb4, 0x38, 0x91, 0x89, 0x48, 0xa4, 0x40, 0x52, 0x76, 0x9c, 0xa7, 0xe8, 0x13, - 0xf4, 0x0d, 0xfa, 0x16, 0x3d, 0xe4, 0x98, 0x43, 0x0f, 0x3d, 0x15, 0x45, 0xf2, 0x22, 0x05, 0x29, - 0xc9, 0xb5, 0x13, 0xb5, 0xc8, 0xb1, 0x37, 0xcd, 0x37, 0xdf, 0x0c, 0x87, 0xf3, 0xf1, 0x83, 0x50, - 0xfb, 0x7c, 0x31, 0x83, 0x7e, 0xc4, 0x79, 0xd0, 0x9f, 0xed, 0x4f, 0x40, 0xe1, 0xfd, 0x3e, 0xcc, - 0x80, 0x29, 0xd9, 0x8b, 0x04, 0x57, 0xdc, 0x6e, 0xe9, 0x7c, 0x4f, 0xe7, 0x7b, 0x69, 0x7e, 0xe7, - 0x27, 0x9f, 0xfb, 0xdc, 0x64, 0xfb, 0xfa, 0x2b, 0x21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75, 0x7d, 0xd3, - 0xb6, 0x3e, 0xdd, 0xb4, 0xad, 0xd7, 0xb7, 0xed, 0xc2, 0xf5, 0x6d, 0xbb, 0xf0, 0xe1, 0xb6, 0x5d, - 0x78, 0xf5, 0x9f, 0x4f, 0xd5, 0x34, 0x9e, 0xf4, 0x3c, 0x1e, 0xf6, 0x8f, 0x5f, 0xbe, 0x38, 0x7a, - 0x0e, 0x6a, 0xce, 0xc5, 0x79, 0xdf, 0x9b, 0x62, 0xca, 0xfa, 0x17, 0xc9, 0x0f, 0x45, 0x2d, 0x22, - 0x90, 0x93, 0x8a, 0xf9, 0x91, 0x3c, 0xfe, 0x1c, 0x00, 0x00, 0xff, 0xff, 0xb6, 0x61, 0x64, 0x6f, - 0xb3, 0x06, 0x00, 0x00, + // 763 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xcf, 0x6e, 0x33, 0x35, + 0x10, 0xcf, 0x26, 0x69, 0xda, 0x38, 0x4d, 0x42, 0x96, 0x52, 0x96, 0x82, 0x42, 0x08, 0x2a, 0x14, + 0x0e, 0x89, 0x0a, 0x9c, 0x91, 0xe8, 0x1f, 0xa4, 0xa8, 0x12, 0xaa, 0x12, 0x15, 0x04, 0x17, 0xcb, + 0x89, 0x27, 0x1b, 0xab, 0xbb, 0xf6, 0xca, 0xf6, 0x26, 0x4d, 0x9f, 0x82, 0x17, 0xe9, 0x7b, 0xf4, + 0x58, 0x09, 0x0e, 0x9c, 0x10, 0x6a, 0x5f, 0x04, 0xd9, 0xbb, 0x9b, 0x2f, 0x69, 0xf7, 0xfb, 0xd4, + 0xeb, 0x77, 0xf3, 0xcc, 0xef, 0x37, 0xe3, 0xf1, 0xcc, 0xfc, 0x76, 0x51, 0xfb, 0x7a, 0x39, 0x87, + 0x7e, 0x24, 0x44, 0xd0, 0x9f, 0x1f, 0x8f, 0x41, 0x93, 0xe3, 0x3e, 0x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xf7, + 0x63, 0xb4, 0x6d, 0xc6, 0x8c, 0x57, 0x83, 0xab, 0x18, 0x73, 0x60, 0x57, 0x84, 0x50, 0x6a, 0x32, + 0x64, 0xeb, 0x9d, 0x9a, 0xa6, 0xd1, 0x24, 0x14, 0x31, 0xcf, 0x16, 0x3b, 0xb5, 0x4e, 0x4e, 0xef, + 0x1f, 0xdb, 0xce, 0xc3, 0x63, 0xdb, 0xf9, 0xef, 0xb1, 0xed, 0xfc, 0xf9, 0xd4, 0x2e, 0x3c, 0x3c, + 0xb5, 0x0b, 0xff, 0x3c, 0xb5, 0x0b, 0x7f, 0x7c, 0xe3, 0x33, 0x3d, 0x8b, 0xc7, 0xbd, 0x89, 0x08, + 0xfb, 0x17, 0xbf, 0xff, 0x7a, 0xfe, 0x0b, 0xe8, 0x85, 0x90, 0xd7, 0xfd, 0xc9, 0x8c, 0x30, 0xde, + 0xbf, 0x49, 0x7e, 0x37, 0x7a, 0x19, 0x81, 0x1a, 0x57, 0xec, 0x6f, 0xe6, 0xfb, 0xff, 0x03, 0x00, + 0x00, 0xff, 0xff, 0x99, 0xc5, 0x91, 0xec, 0xd1, 0x06, 0x00, 0x00, } func (m *EventUpdateParams) Marshal() (dAtA []byte, err error) { @@ -892,8 +892,8 @@ func (m *EventCreatePool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x48 } - if m.OperatingCost != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.OperatingCost)) + if m.InflationShareWeight != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.InflationShareWeight)) i-- dAtA[i] = 0x40 } @@ -1161,8 +1161,8 @@ func (m *EventPoolUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x48 } - if m.OperatingCost != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.OperatingCost)) + if m.InflationShareWeight != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.InflationShareWeight)) i-- dAtA[i] = 0x40 } @@ -1314,8 +1314,8 @@ func (m *EventCreatePool) Size() (n int) { if m.UploadInterval != 0 { n += 1 + sovEvents(uint64(m.UploadInterval)) } - if m.OperatingCost != 0 { - n += 1 + sovEvents(uint64(m.OperatingCost)) + if m.InflationShareWeight != 0 { + n += 1 + sovEvents(uint64(m.InflationShareWeight)) } if m.MinDelegation != 0 { n += 1 + sovEvents(uint64(m.MinDelegation)) @@ -1450,8 +1450,8 @@ func (m *EventPoolUpdated) Size() (n int) { if m.UploadInterval != 0 { n += 1 + sovEvents(uint64(m.UploadInterval)) } - if m.OperatingCost != 0 { - n += 1 + sovEvents(uint64(m.OperatingCost)) + if m.InflationShareWeight != 0 { + n += 1 + sovEvents(uint64(m.InflationShareWeight)) } if m.MinDelegation != 0 { n += 1 + sovEvents(uint64(m.MinDelegation)) @@ -1870,9 +1870,9 @@ func (m *EventCreatePool) Unmarshal(dAtA []byte) error { } case 8: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatingCost", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InflationShareWeight", wireType) } - m.OperatingCost = 0 + m.InflationShareWeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -1882,7 +1882,7 @@ func (m *EventCreatePool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.OperatingCost |= uint64(b&0x7F) << shift + m.InflationShareWeight |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2833,9 +2833,9 @@ func (m *EventPoolUpdated) Unmarshal(dAtA []byte) error { } case 8: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatingCost", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InflationShareWeight", wireType) } - m.OperatingCost = 0 + m.InflationShareWeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -2845,7 +2845,7 @@ func (m *EventPoolUpdated) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.OperatingCost |= uint64(b&0x7F) << shift + m.InflationShareWeight |= uint64(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/pool/types/msgs.go b/x/pool/types/msgs.go index 7d6072aa..3996bc6e 100644 --- a/x/pool/types/msgs.go +++ b/x/pool/types/msgs.go @@ -36,8 +36,8 @@ func (msg *MsgCreatePool) ValidateBasic() error { return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid upload interval") } - if err := util.ValidateNumber(msg.OperatingCost); err != nil { - return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid operating cost") + if err := util.ValidateNumber(msg.InflationShareWeight); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid inflation share weight") } if err := util.ValidateNumber(msg.MinDelegation); err != nil { @@ -59,16 +59,16 @@ func (msg *MsgUpdatePool) GetSigners() []sdk.AccAddress { // PoolUpdate ... type PoolUpdate struct { - Name *string - Runtime *string - Logo *string - Config *string - UploadInterval *uint64 - OperatingCost *uint64 - MinDelegation *uint64 - MaxBundleSize *uint64 - StorageProviderId *uint32 - CompressionId *uint32 + Name *string + Runtime *string + Logo *string + Config *string + UploadInterval *uint64 + InflationShareWeight *uint64 + MinDelegation *uint64 + MaxBundleSize *uint64 + StorageProviderId *uint32 + CompressionId *uint32 } // ValidateBasic does a sanity check on the provided data. @@ -88,9 +88,9 @@ func (msg *MsgUpdatePool) ValidateBasic() error { } } - if payload.OperatingCost != nil { - if err := util.ValidateNumber(*payload.OperatingCost); err != nil { - return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid operating cost") + if payload.InflationShareWeight != nil { + if err := util.ValidateNumber(*payload.InflationShareWeight); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid inflation share weight") } } diff --git a/x/pool/types/pool.pb.go b/x/pool/types/pool.pb.go index b2f697d5..8288cd4d 100644 --- a/x/pool/types/pool.pb.go +++ b/x/pool/types/pool.pb.go @@ -234,8 +234,8 @@ type Pool struct { TotalBundles uint64 `protobuf:"varint,10,opt,name=total_bundles,json=totalBundles,proto3" json:"total_bundles,omitempty"` // upload_interval ... UploadInterval uint64 `protobuf:"varint,11,opt,name=upload_interval,json=uploadInterval,proto3" json:"upload_interval,omitempty"` - // operating_cost ... - OperatingCost uint64 `protobuf:"varint,12,opt,name=operating_cost,json=operatingCost,proto3" json:"operating_cost,omitempty"` + // inflation_share_weight ... + InflationShareWeight uint64 `protobuf:"varint,12,opt,name=inflation_share_weight,json=inflationShareWeight,proto3" json:"inflation_share_weight,omitempty"` // min_delegation ... MinDelegation uint64 `protobuf:"varint,13,opt,name=min_delegation,json=minDelegation,proto3" json:"min_delegation,omitempty"` // max_bundle_size ... @@ -363,9 +363,9 @@ func (m *Pool) GetUploadInterval() uint64 { return 0 } -func (m *Pool) GetOperatingCost() uint64 { +func (m *Pool) GetInflationShareWeight() uint64 { if m != nil { - return m.OperatingCost + return m.InflationShareWeight } return 0 } @@ -429,55 +429,56 @@ func init() { func init() { proto.RegisterFile("kyve/pool/v1beta1/pool.proto", fileDescriptor_40c1730f47ff2ef8) } var fileDescriptor_40c1730f47ff2ef8 = []byte{ - // 763 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xcf, 0x73, 0xe3, 0x34, - 0x14, 0xc7, 0xe3, 0xae, 0xdb, 0x4d, 0x94, 0x36, 0x75, 0x45, 0xb7, 0x88, 0x96, 0x09, 0xd9, 0x32, - 0x0b, 0x81, 0x43, 0x32, 0x0b, 0xcc, 0x70, 0xe2, 0x90, 0x26, 0xde, 0xe2, 0xdd, 0x4e, 0x92, 0xb1, - 0x93, 0x9d, 0x81, 0x8b, 0x46, 0xb1, 0x85, 0xab, 0xa9, 0x6d, 0x79, 0x64, 0x39, 0x34, 0x7b, 0xe4, - 0xc4, 0x91, 0xff, 0x81, 0xbf, 0x83, 0x3b, 0xc7, 0x3d, 0xc2, 0x8d, 0x69, 0xff, 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3, 0x8b, 0x2b, 0x7b, 0x62, 0xed, 0xfc, 0x5b, 0x99, 0xce, 0xf0, 0x8b, 0xe5, 0x74, 0xe2, 0x59, - 0x8f, 0xe0, 0x33, 0xf0, 0xf4, 0xa1, 0xb2, 0xc0, 0xf6, 0x74, 0xb6, 0xbc, 0xfc, 0x16, 0x4f, 0xec, - 0x2b, 0xfb, 0x72, 0xb4, 0x70, 0x66, 0x53, 0xcb, 0x84, 0x1f, 0x80, 0x27, 0x0f, 0xce, 0x33, 0xbf, - 0x74, 0x47, 0x13, 0x67, 0x7a, 0x69, 0xed, 0x9e, 0x9a, 0x3f, 0xff, 0xda, 0x6d, 0x5c, 0x8c, 0x7f, - 0xbf, 0xeb, 0x1a, 0x6f, 0xef, 0xba, 0xc6, 0x5f, 0x77, 0x5d, 0xe3, 0x97, 0xfb, 0x6e, 0xe3, 0xed, - 0x7d, 0xb7, 0xf1, 0xc7, 0x7d, 0xb7, 0xf1, 0xfd, 0x67, 0x21, 0x93, 0xd7, 0xf9, 0x6a, 0xe0, 0xf3, - 0x78, 0xf8, 0xea, 0xbb, 0xd7, 0xf6, 0x94, 0xca, 0x1f, 0xb9, 0xb8, 0x19, 0xfa, 0xd7, 0x84, 0x25, - 0xc3, 0xdb, 0xe2, 0x0f, 0x50, 0x6e, 0x52, 0x9a, 0xad, 0xf6, 0xf4, 0x48, 0xbf, 0xfc, 0x3b, 0x00, - 0x00, 0xff, 0xff, 0x79, 0x2e, 0x04, 0x09, 0x1a, 0x05, 0x00, 0x00, + // 774 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xcf, 0x73, 0xdb, 0x44, + 0x14, 0xc7, 0xad, 0x54, 0x49, 0xed, 0x75, 0xe2, 0x28, 0x8b, 0x1b, 0x96, 0x84, 0x31, 0x6e, 0x98, + 0x82, 0xe1, 0x60, 0x4f, 0x81, 0x19, 0x4e, 0x1c, 0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 0x5c, + 0xe7, 0x67, 0x7f, 0xee, 0x02, 0x73, 0xce, 0x79, 0x04, 0x3b, 0x60, 0x87, 0x05, 0xba, 0xb1, 0xe9, + 0xee, 0xb0, 0x00, 0x42, 0x60, 0x26, 0x24, 0xa6, 0x65, 0x3f, 0x1d, 0xab, 0x13, 0x8a, 0x3c, 0x91, + 0x2c, 0x2e, 0xee, 0xd3, 0x72, 0xab, 0x54, 0xb9, 0x23, 0x1e, 0x72, 0xfd, 0xf8, 0x96, 0xab, 0x63, + 0x78, 0x0c, 0xf6, 0x7c, 0x9e, 0xbc, 0x62, 0x21, 0xda, 0xd5, 0xb4, 0xcc, 0xe0, 0x29, 0x68, 0x65, + 0x92, 0x08, 0x89, 0xaf, 0xe9, 0x16, 0xed, 0x15, 0xd7, 0xd1, 0xe0, 0x05, 0xdd, 0xc2, 0x8f, 0x40, + 0xdb, 0xcf, 0x85, 0xa0, 0x49, 0x21, 0x3f, 0xd4, 0x32, 0x28, 0x91, 0x32, 0x7c, 0x0a, 0x0e, 0x2b, + 0x43, 0x96, 0xc7, 0x31, 0x11, 0x5b, 0xd4, 0xd4, 0xa6, 0x4e, 0x89, 0xbd, 0x82, 0xc2, 0x8f, 0xc1, + 0x41, 0x65, 0x64, 0x49, 0x40, 0x6f, 0x50, 0x4b, 0xdf, 0x6d, 0xbf, 0x84, 0x8e, 0x62, 0xca, 0x24, + 0xb9, 0x24, 0x11, 0x5e, 0xe5, 0x49, 0x10, 0xd1, 0x0c, 0x81, 0xc2, 0xa4, 0xe1, 0x79, 0xc1, 0x54, + 0xcb, 0x3c, 0x8d, 0x38, 0x09, 0x30, 0x4b, 0x24, 0x15, 0x1b, 0x12, 0xa1, 0xb6, 0xb6, 0x75, 0x0a, + 0xec, 0x94, 0x14, 0x7e, 0x05, 0x8e, 0x59, 0xf2, 0x2a, 0xd2, 0x6f, 0x16, 0x67, 0x6b, 0x22, 0x28, + 0x7e, 0x4d, 0x59, 0xb8, 0x96, 0x68, 0x5f, 0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xa8, 0x36, + 0x52, 0xb4, 0x29, 0x05, 0x00, 0x00, } func (m *Protocol) Marshal() (dAtA []byte, err error) { @@ -651,8 +652,8 @@ func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x68 } - if m.OperatingCost != 0 { - i = encodeVarintPool(dAtA, i, uint64(m.OperatingCost)) + if m.InflationShareWeight != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.InflationShareWeight)) i-- dAtA[i] = 0x60 } @@ -828,8 +829,8 @@ func (m *Pool) Size() (n int) { if m.UploadInterval != 0 { n += 1 + sovPool(uint64(m.UploadInterval)) } - if m.OperatingCost != 0 { - n += 1 + sovPool(uint64(m.OperatingCost)) + if m.InflationShareWeight != 0 { + n += 1 + sovPool(uint64(m.InflationShareWeight)) } if m.MinDelegation != 0 { n += 1 + sovPool(uint64(m.MinDelegation)) @@ -1479,9 +1480,9 @@ func (m *Pool) Unmarshal(dAtA []byte) error { } case 12: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatingCost", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InflationShareWeight", wireType) } - m.OperatingCost = 0 + m.InflationShareWeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPool @@ -1491,7 +1492,7 @@ func (m *Pool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.OperatingCost |= uint64(b&0x7F) << shift + m.InflationShareWeight |= uint64(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/pool/types/tx.pb.go b/x/pool/types/tx.pb.go index 0998dfd0..755a5a78 100644 --- a/x/pool/types/tx.pb.go +++ b/x/pool/types/tx.pb.go @@ -44,8 +44,8 @@ type MsgCreatePool struct { StartKey string `protobuf:"bytes,6,opt,name=start_key,json=startKey,proto3" json:"start_key,omitempty"` // upload_interval ... UploadInterval uint64 `protobuf:"varint,7,opt,name=upload_interval,json=uploadInterval,proto3" json:"upload_interval,omitempty"` - // operating_cost ... - OperatingCost uint64 `protobuf:"varint,8,opt,name=operating_cost,json=operatingCost,proto3" json:"operating_cost,omitempty"` + // inflation_share_weight ... + InflationShareWeight uint64 `protobuf:"varint,8,opt,name=inflation_share_weight,json=inflationShareWeight,proto3" json:"inflation_share_weight,omitempty"` // min_delegation ... MinDelegation uint64 `protobuf:"varint,9,opt,name=min_delegation,json=minDelegation,proto3" json:"min_delegation,omitempty"` // max_bundle_size ... @@ -142,9 +142,9 @@ func (m *MsgCreatePool) GetUploadInterval() uint64 { return 0 } -func (m *MsgCreatePool) GetOperatingCost() uint64 { +func (m *MsgCreatePool) GetInflationShareWeight() uint64 { if m != nil { - return m.OperatingCost + return m.InflationShareWeight } return 0 } @@ -845,57 +845,58 @@ func init() { func init() { proto.RegisterFile("kyve/pool/v1beta1/tx.proto", fileDescriptor_20ddefdf83388ddc) } var fileDescriptor_20ddefdf83388ddc = []byte{ - // 795 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x6e, 0xeb, 0x44, - 0x14, 0xae, 0x93, 0x34, 0xb7, 0x99, 0x36, 0xa9, 0xae, 0xb9, 0xf4, 0xba, 0x46, 0x0a, 0x49, 0x10, - 0x90, 0x7b, 0x05, 0x89, 0x6e, 0x41, 0xec, 0xfb, 0xb7, 0xa8, 0xaa, 0xa0, 0xca, 0x55, 0xa1, 0x80, - 0x84, 0x35, 0xf1, 0x0c, 0xce, 0x28, 0xf6, 0x8c, 0x99, 0x99, 0x84, 0xa4, 0xe2, 0x21, 0x78, 0x18, - 0x9e, 0x01, 0xb1, 0xac, 0x58, 0xb1, 0x44, 0xe9, 0x8e, 0xa7, 0x40, 0x33, 0x76, 0x1c, 0x5b, 0x8d, - 0x29, 0xd0, 0xb2, 0xf3, 0x39, 0xe7, 0xf3, 0xf9, 0xce, 0xcc, 0xf9, 0x3e, 0xcb, 0xc0, 0x1e, 0xcf, - 0x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d, 0xdb, 0x5e, 0xff, 0x62, 0x06, 0x62, 0xbf, 0x7a, 0x10, 0x92, 0x1d, 0x3b, 0xe3, - 0xd0, 0x82, 0xb1, 0x57, 0x88, 0xa2, 0xb1, 0xef, 0x9b, 0xd1, 0xfc, 0x11, 0xec, 0x15, 0x18, 0xf1, - 0xa3, 0xf5, 0x3d, 0xd6, 0xa3, 0xed, 0x4f, 0xff, 0x0d, 0x3a, 0x65, 0x9f, 0x82, 0x17, 0x6b, 0xd5, - 0xff, 0xba, 0x60, 0xa1, 0x6b, 0xb0, 0xf6, 0xc1, 0x3f, 0xc7, 0xa6, 0xbc, 0xdf, 0x82, 0x9d, 0x9c, - 0xca, 0x3b, 0x7f, 0xbb, 0x66, 0x8d, 0xb1, 0x5f, 0x3f, 0x8c, 0x59, 0xf6, 0x3f, 0x3a, 0xfe, 0x75, - 0xd1, 0x34, 0x6e, 0x17, 0x4d, 0xe3, 0x8f, 0x45, 0xd3, 0xf8, 0xe9, 0xae, 0xb9, 0x71, 0x7b, 0xd7, - 0xdc, 0xf8, 0xfd, 0xae, 0xb9, 0xf1, 0xf5, 0x2b, 0x9f, 0xc8, 0xd1, 0x64, 0xd8, 0xf3, 0x58, 0xd8, - 0x3f, 0xff, 0xea, 0x8b, 0xd3, 0xcf, 0xb1, 0xfc, 0x81, 0xf1, 0x71, 0xdf, 0x1b, 0x41, 0x42, 0xfb, - 0xb3, 0xf8, 0xc7, 0x46, 0xce, 0x23, 0x2c, 0x86, 0x55, 0xfd, 0x9b, 0xf2, 0xc9, 0x5f, 0x01, 0x00, - 0x00, 0xff, 0xff, 0x36, 0x93, 0x55, 0x3a, 0xf2, 0x08, 0x00, 0x00, + // 807 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xd1, 0x8e, 0xdb, 0x44, + 0x14, 0x5d, 0x67, 0xb3, 0xe9, 0x66, 0x76, 0x93, 0x55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 0xbd, 0xed, 0x33, 0x35, 0x9d, 0x4f, 0x06, 0x1e, 0x0f, 0x87, 0x4f, 0xbe, 0xf9, 0xfa, + 0xf1, 0x57, 0x54, 0xbd, 0xe2, 0x62, 0x36, 0xf4, 0xa6, 0x98, 0x45, 0xc3, 0x65, 0xf2, 0x9f, 0xa3, + 0x56, 0x31, 0x95, 0x93, 0x9a, 0xf9, 0x6b, 0xf9, 0xe2, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa3, + 0x07, 0x08, 0x64, 0x01, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1276,8 +1277,8 @@ func (m *MsgCreatePool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x48 } - if m.OperatingCost != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.OperatingCost)) + if m.InflationShareWeight != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.InflationShareWeight)) i-- dAtA[i] = 0x40 } @@ -1783,8 +1784,8 @@ func (m *MsgCreatePool) Size() (n int) { if m.UploadInterval != 0 { n += 1 + sovTx(uint64(m.UploadInterval)) } - if m.OperatingCost != 0 { - n += 1 + sovTx(uint64(m.OperatingCost)) + if m.InflationShareWeight != 0 { + n += 1 + sovTx(uint64(m.InflationShareWeight)) } if m.MinDelegation != 0 { n += 1 + sovTx(uint64(m.MinDelegation)) @@ -2237,9 +2238,9 @@ func (m *MsgCreatePool) Unmarshal(dAtA []byte) error { } case 8: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatingCost", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InflationShareWeight", wireType) } - m.OperatingCost = 0 + m.InflationShareWeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2249,7 +2250,7 @@ func (m *MsgCreatePool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.OperatingCost |= uint64(b&0x7F) << shift + m.InflationShareWeight |= uint64(b&0x7F) << shift if b < 0x80 { break } From 51d00cf7842ffbe0d0a17af26f51ebc61e95ec24 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 28 Sep 2023 16:46:09 +0200 Subject: [PATCH 038/109] fix: x/pool tests --- ...gic_end_block_handle_pool_upgrades_test.go | 12 +- x/pool/keeper/msg_server_create_pool_test.go | 228 +++++++++--------- x/pool/keeper/msg_server_disable_pool_test.go | 90 +++---- x/pool/keeper/msg_server_update_pool_test.go | 94 ++++---- 4 files changed, 199 insertions(+), 225 deletions(-) diff --git a/x/pool/keeper/logic_end_block_handle_pool_upgrades_test.go b/x/pool/keeper/logic_end_block_handle_pool_upgrades_test.go index 416361ce..51dbd744 100644 --- a/x/pool/keeper/logic_end_block_handle_pool_upgrades_test.go +++ b/x/pool/keeper/logic_end_block_handle_pool_upgrades_test.go @@ -29,12 +29,12 @@ var _ = Describe("logic_end_block_handle_pool_upgrades.go", Ordered, func() { // create clean pool for every test case s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - MaxBundleSize: 100, - StartKey: "0", - MinDelegation: 100 * i.KYVE, - UploadInterval: 60, - OperatingCost: 10_000, + Name: "PoolTest", + MaxBundleSize: 100, + StartKey: "0", + MinDelegation: 100 * i.KYVE, + UploadInterval: 60, + InflationShareWeight: 10_000, Protocol: &pooltypes.Protocol{ Version: "0.0.0", Binaries: "{}", diff --git a/x/pool/keeper/msg_server_create_pool_test.go b/x/pool/keeper/msg_server_create_pool_test.go index f1f59df1..a82e665b 100644 --- a/x/pool/keeper/msg_server_create_pool_test.go +++ b/x/pool/keeper/msg_server_create_pool_test.go @@ -41,20 +41,20 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { It("Invalid authority (transaction)", func() { // ARRANGE msg := &types.MsgCreatePool{ - Authority: i.DUMMY[0], - Name: "TestPool", - Runtime: "@kyve/test", - Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", - Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10000, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Version: "0.0.0", - Binaries: "{}", - StorageProviderId: 2, - CompressionId: 1, + Authority: i.DUMMY[0], + Name: "TestPool", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, } // ACT @@ -67,20 +67,20 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { It("Invalid authority (proposal)", func() { // ARRANGE msg := &types.MsgCreatePool{ - Authority: i.DUMMY[0], - Name: "TestPool", - Runtime: "@kyve/test", - Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", - Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10000, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Version: "0.0.0", - Binaries: "{}", - StorageProviderId: 2, - CompressionId: 1, + Authority: i.DUMMY[0], + Name: "TestPool", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, } proposal, _ := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -95,20 +95,20 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { It("Create first pool", func() { // ARRANGE msg := &types.MsgCreatePool{ - Authority: gov, - Name: "TestPool", - Runtime: "@kyve/test", - Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", - Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10000, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Version: "0.0.0", - Binaries: "{}", - StorageProviderId: 2, - CompressionId: 1, + Authority: gov, + Name: "TestPool", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, } p, v := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -130,21 +130,21 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) Expect(pool).To(Equal(types.Pool{ - Id: 0, - Name: "TestPool", - Runtime: "@kyve/test", - Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", - Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", - StartKey: "0", - CurrentKey: "", - CurrentSummary: "", - CurrentIndex: 0, - TotalBundles: 0, - UploadInterval: 60, - OperatingCost: 10000, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Disabled: false, + Id: 0, + Name: "TestPool", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + CurrentKey: "", + CurrentSummary: "", + CurrentIndex: 0, + TotalBundles: 0, + UploadInterval: 60, + InflationShareWeight: 10000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Disabled: false, Protocol: &types.Protocol{ Version: "0.0.0", Binaries: "{}", @@ -171,20 +171,20 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { It("Create another pool", func() { // ARRANGE msg := &types.MsgCreatePool{ - Authority: gov, - Name: "TestPool", - Runtime: "@kyve/test", - Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", - Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10000, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Version: "0.0.0", - Binaries: "{}", - StorageProviderId: 2, - CompressionId: 1, + Authority: gov, + Name: "TestPool", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, } p, v := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -204,20 +204,20 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { // ACT msg = &types.MsgCreatePool{ - Authority: gov, - Name: "TestPool2", - Runtime: "@kyve/test", - Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", - Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10000, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Version: "0.0.0", - Binaries: "{}", - StorageProviderId: 2, - CompressionId: 1, + Authority: gov, + Name: "TestPool2", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, } p, v = BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -238,21 +238,21 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 1) Expect(pool).To(Equal(types.Pool{ - Id: 1, - Name: "TestPool2", - Runtime: "@kyve/test", - Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", - Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", - StartKey: "0", - CurrentKey: "", - CurrentSummary: "", - CurrentIndex: 0, - TotalBundles: 0, - UploadInterval: 60, - OperatingCost: 10000, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Disabled: false, + Id: 1, + Name: "TestPool2", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + CurrentKey: "", + CurrentSummary: "", + CurrentIndex: 0, + TotalBundles: 0, + UploadInterval: 60, + InflationShareWeight: 10000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Disabled: false, Protocol: &types.Protocol{ Version: "0.0.0", Binaries: "{}", @@ -279,20 +279,20 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { It("Create pool with invalid binaries", func() { // ARRANGE msg := &types.MsgCreatePool{ - Authority: gov, - Name: "TestPool", - Runtime: "@kyve/test", - Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", - Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10000, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Version: "0.0.0", - Binaries: "{", - StorageProviderId: 2, - CompressionId: 1, + Authority: gov, + Name: "TestPool", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{", + StorageProviderId: 2, + CompressionId: 1, } p, v := BuildGovernanceTxs(s, []sdk.Msg{msg}) diff --git a/x/pool/keeper/msg_server_disable_pool_test.go b/x/pool/keeper/msg_server_disable_pool_test.go index 2cd382d5..cb29df33 100644 --- a/x/pool/keeper/msg_server_disable_pool_test.go +++ b/x/pool/keeper/msg_server_disable_pool_test.go @@ -45,20 +45,20 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { s = i.NewCleanChain() msg := &types.MsgCreatePool{ - Authority: gov, - Name: "PoolTest", - Runtime: "@kyve/test", - Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", - Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10_000, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Version: "0.0.0", - Binaries: "{}", - StorageProviderId: 2, - CompressionId: 1, + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, } s.RunTxPoolSuccess(msg) @@ -75,20 +75,20 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { }) msg = &types.MsgCreatePool{ - Authority: gov, - Name: "PoolTest2", - Runtime: "@kyve/test", - Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", - Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10_000, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Version: "0.0.0", - Binaries: "{}", - StorageProviderId: 2, - CompressionId: 1, + Authority: gov, + Name: "PoolTest2", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, } s.RunTxPoolSuccess(msg) @@ -204,14 +204,9 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { bundleProposal, _ := s.App().BundlesKeeper.GetBundleProposal(s.Ctx(), 0) Expect(bundleProposal.StorageId).To(BeEmpty()) - // assert smaller funding balance + // assert same funding balance balance := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAddr, globalTypes.Denom).Amount.Uint64() - Expect(balance).To(Equal(balanceBefore - fundingAmount)) - - // assert empty funding state - fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(fundingState.TotalAmount).To(BeZero()) - Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) + Expect(balance).To(Equal(balanceBefore)) }) It("Disable pool which is active and has a balance", func() { @@ -231,10 +226,6 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { balanceBefore := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAddr, globalTypes.Denom).Amount.Uint64() Expect(balanceBefore).To(BeNumerically(">", uint64(0))) - fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(fundingState.TotalAmount).To(BeNumerically(">", uint64(0))) - Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) - msg := &types.MsgDisablePool{ Authority: gov, Id: 0, @@ -262,14 +253,9 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { bundleProposal, _ := s.App().BundlesKeeper.GetBundleProposal(s.Ctx(), 0) Expect(bundleProposal.StorageId).To(BeEmpty()) - // assert smaller funding balance + // assert same funding balance balance := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAddr, globalTypes.Denom).Amount.Uint64() - Expect(balance).To(Equal(balanceBefore - fundingState.TotalAmount)) - - // assert empty funding state - fundingState, _ = s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(fundingState.TotalAmount).To(BeZero()) - Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) + Expect(balance).To(Equal(balanceBefore)) }) It("Disable pool which is active", func() { @@ -373,18 +359,6 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { bundleProposal, _ = s.App().BundlesKeeper.GetBundleProposal(s.Ctx(), 1) Expect(bundleProposal.StorageId).To(BeEmpty()) - - // assert empty funding balance - fundersModuleAddr := s.App().AccountKeeper.GetModuleAddress(funderstypes.ModuleName) - balance := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAddr, globalTypes.Denom).Amount.Uint64() - Expect(balance).To(BeZero()) - - // assert empty funding states - for _, poolId := range []uint64{0, 1} { - fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), poolId) - Expect(fundingState.TotalAmount).To(BeZero()) - Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) - } }) It("Kick out all stakers from pool", func() { diff --git a/x/pool/keeper/msg_server_update_pool_test.go b/x/pool/keeper/msg_server_update_pool_test.go index ff4e3d50..70c40017 100644 --- a/x/pool/keeper/msg_server_update_pool_test.go +++ b/x/pool/keeper/msg_server_update_pool_test.go @@ -39,7 +39,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { Logo: "", Config: "", UploadInterval: 0, - OperatingCost: 0, + InflationShareWeight: 0, MinDelegation: 0, MaxBundleSize: 0, CurrentStorageProviderId: 0, @@ -112,21 +112,21 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) Expect(pool).To(Equal(types.Pool{ - Id: 0, - Name: "TestPool", - Runtime: "@kyve/test", - Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", - Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", - StartKey: "", - CurrentKey: "", - CurrentSummary: "", - CurrentIndex: 0, - TotalBundles: 0, - UploadInterval: 60, - OperatingCost: 10000, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Disabled: false, + Id: 0, + Name: "TestPool", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "", + CurrentKey: "", + CurrentSummary: "", + CurrentIndex: 0, + TotalBundles: 0, + UploadInterval: 60, + InflationShareWeight: 10000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Disabled: false, Protocol: &types.Protocol{ Version: "", Binaries: "", @@ -170,21 +170,21 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) Expect(pool).To(Equal(types.Pool{ - Id: 0, - Name: "TestPool", - Runtime: "@kyve/test", - Logo: "", - Config: "", - StartKey: "", - CurrentKey: "", - CurrentSummary: "", - CurrentIndex: 0, - TotalBundles: 0, - UploadInterval: 0, - OperatingCost: 0, - MinDelegation: 0, - MaxBundleSize: 0, - Disabled: false, + Id: 0, + Name: "TestPool", + Runtime: "@kyve/test", + Logo: "", + Config: "", + StartKey: "", + CurrentKey: "", + CurrentSummary: "", + CurrentIndex: 0, + TotalBundles: 0, + UploadInterval: 0, + InflationShareWeight: 0, + MinDelegation: 0, + MaxBundleSize: 0, + Disabled: false, Protocol: &types.Protocol{ Version: "", Binaries: "", @@ -209,7 +209,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { Logo: "", Config: "", UploadInterval: 0, - OperatingCost: 0, + InflationShareWeight: 0, MinDelegation: 0, MaxBundleSize: 0, CurrentStorageProviderId: 0, @@ -243,21 +243,21 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 1) Expect(pool).To(Equal(types.Pool{ - Id: 1, - Name: "TestPool2", - Runtime: "@kyve/test", - Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", - Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", - StartKey: "", - CurrentKey: "", - CurrentSummary: "", - CurrentIndex: 0, - TotalBundles: 0, - UploadInterval: 60, - OperatingCost: 10000, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Disabled: false, + Id: 1, + Name: "TestPool2", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "", + CurrentKey: "", + CurrentSummary: "", + CurrentIndex: 0, + TotalBundles: 0, + UploadInterval: 60, + InflationShareWeight: 10000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Disabled: false, Protocol: &types.Protocol{ Version: "", Binaries: "", From d1f3630b6bb8a0b775bdbe253023ef69f489e070 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 28 Sep 2023 16:51:34 +0200 Subject: [PATCH 039/109] fix: remove DefundFundingState --- x/funders/keeper/logic_funders.go | 38 ++++++++----------------------- x/pool/types/expected_keepers.go | 1 - 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/x/funders/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go index b7693ba0..c25dfde3 100644 --- a/x/funders/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -4,6 +4,7 @@ import ( "cosmossdk.io/errors" "github.com/KYVENetwork/chain/util" "github.com/KYVENetwork/chain/x/funders/types" + pooltypes "github.com/KYVENetwork/chain/x/pool/types" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -17,34 +18,6 @@ func (k Keeper) CreateFundingState(ctx sdk.Context, poolId uint64) { k.SetFundingState(ctx, &fundingState) } -func (k Keeper) DefundFundingState(ctx sdk.Context, poolId uint64) (err error) { - // Get funding state for pool - fundingState, found := k.GetFundingState(ctx, poolId) - if !found { - return errors.Wrapf(errorsTypes.ErrNotFound, types.ErrFundingStateDoesNotExist.Error(), poolId) - } - - // If there are no active fundings we immediately return - activeFundings := k.GetActiveFundings(ctx, fundingState) - if len(activeFundings) == 0 { - return nil - } - - // Transfer tokens back to funders - for _, funding := range activeFundings { - if err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, types.ModuleName, funding.FunderAddress, funding.Amount); err != nil { - return err - } - k.SetFunding(ctx, &funding) - } - - // Save funding state - fundingState.TotalAmount = 0 - fundingState.ActiveFunderAddresses = []string{} - k.SetFundingState(ctx, &fundingState) - return nil -} - // ChargeFundersOfPool equally splits the amount between all funders and removes // the appropriate amount from each funder. // All funders who can't afford the amount, are kicked out. @@ -84,5 +57,14 @@ func (k Keeper) ChargeFundersOfPool(ctx sdk.Context, poolId uint64) (payout uint PoolId: poolId, }) } + + // Move funds to pool module account + if payout > 0 { + err = util.TransferFromModuleToModule(k.bankKeeper, ctx, types.ModuleName, pooltypes.ModuleName, payout) + if err != nil { + return 0, err + } + } + return payout, nil } diff --git a/x/pool/types/expected_keepers.go b/x/pool/types/expected_keepers.go index 315765a3..d193dde2 100644 --- a/x/pool/types/expected_keepers.go +++ b/x/pool/types/expected_keepers.go @@ -22,5 +22,4 @@ type StakersKeeper interface { type FundersKeeper interface { CreateFundingState(ctx sdk.Context, poolId uint64) - DefundFundingState(ctx sdk.Context, poolId uint64) (err error) } From 6e305f21800a732f2a1adf74830a87a44a714f8d Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 28 Sep 2023 18:03:17 +0200 Subject: [PATCH 040/109] feat: add more tests for x/funders --- x/funders/keeper/getters_funding_state.go | 17 - x/funders/keeper/logic_funders.go | 18 + x/funders/keeper/msg_server_defund_pool.go | 10 +- .../keeper/msg_server_defund_pool_test.go | 175 ++++--- x/funders/keeper/msg_server_fund_pool.go | 2 +- x/funders/keeper/msg_server_fund_pool_test.go | 427 +++++++++--------- 6 files changed, 366 insertions(+), 283 deletions(-) diff --git a/x/funders/keeper/getters_funding_state.go b/x/funders/keeper/getters_funding_state.go index 8654fcf3..04770741 100644 --- a/x/funders/keeper/getters_funding_state.go +++ b/x/funders/keeper/getters_funding_state.go @@ -1,8 +1,6 @@ package keeper import ( - "errors" - "fmt" "github.com/KYVENetwork/chain/x/funders/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" @@ -63,18 +61,3 @@ func (k Keeper) GetActiveFundings(ctx sdk.Context, fundingState types.FundingSta } return fundings } - -// GetLowestFunding returns the funding with the lowest amount -// Precondition: len(fundings) > 0 -func (k Keeper) GetLowestFunding(fundings []types.Funding) (lowestFunding *types.Funding, err error) { - if len(fundings) == 0 { - return nil, errors.New(fmt.Sprintf("no active fundings")) - } - - for _, funding := range fundings { - if funding.Amount < lowestFunding.Amount { - lowestFunding = &funding - } - } - return lowestFunding, nil -} diff --git a/x/funders/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go index c25dfde3..debe169a 100644 --- a/x/funders/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -2,6 +2,8 @@ package keeper import ( "cosmossdk.io/errors" + goerrors "errors" + "fmt" "github.com/KYVENetwork/chain/util" "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" @@ -68,3 +70,19 @@ func (k Keeper) ChargeFundersOfPool(ctx sdk.Context, poolId uint64) (payout uint return payout, nil } + +// GetLowestFunding returns the funding with the lowest amount +// Precondition: len(fundings) > 0 +func (k Keeper) GetLowestFunding(fundings []types.Funding) (lowestFunding *types.Funding, err error) { + if len(fundings) == 0 { + return nil, goerrors.New(fmt.Sprintf("no active fundings")) + } + + lowestFunding = &fundings[0] + for _, funding := range fundings { + if funding.Amount < lowestFunding.Amount { + lowestFunding = &funding + } + } + return lowestFunding, nil +} diff --git a/x/funders/keeper/msg_server_defund_pool.go b/x/funders/keeper/msg_server_defund_pool.go index c6a098cb..bf673657 100644 --- a/x/funders/keeper/msg_server_defund_pool.go +++ b/x/funders/keeper/msg_server_defund_pool.go @@ -11,6 +11,9 @@ import ( errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) +// TODO: Right now it is possible to fund a pool above the minimum funding amount and then defund it below the minimum funding amount. +// This should not be possible. We should probably add a check for this. + // DefundPool handles the logic to defund a pool. // If the user is a funder, it will subtract the provided amount // and send the tokens back. If there are no more funds left, the funding will get inactive. @@ -47,13 +50,16 @@ func (k msgServer) DefundPool(goCtx context.Context, msg *types.MsgDefundPool) ( // Save funding and funding state k.SetFunding(ctx, &funding) - fundingState.SetActive(&funding) + if funding.Amount == 0 { + fundingState.SetInactive(&funding) + } + k.SetFundingState(ctx, &fundingState) // Emit a defund event. _ = ctx.EventManager().EmitTypedEvent(&types.EventDefundPool{ PoolId: msg.PoolId, Address: msg.Creator, - Amount: msg.Amount, + Amount: amount, }) return &types.MsgDefundPoolResponse{}, nil diff --git a/x/funders/keeper/msg_server_defund_pool_test.go b/x/funders/keeper/msg_server_defund_pool_test.go index e5b3aff8..0460b5ae 100644 --- a/x/funders/keeper/msg_server_defund_pool_test.go +++ b/x/funders/keeper/msg_server_defund_pool_test.go @@ -1,11 +1,11 @@ package keeper_test import ( - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - i "github.com/KYVENetwork/chain/testutil/integration" + "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" ) /* @@ -13,9 +13,11 @@ import ( TEST CASES - msg_server_defund_pool.go * Defund 50 KYVE from a funder who has previously funded 100 KYVE -* Try to defund more than actually funded +* Defund more than actually funded * Defund full funding amount from a funder who has previously funded 100 KYVE * Defund as highest funder 75 KYVE in order to be the lowest funder afterwards +* Try to defund nonexistent fundings +* Try to defund a funding twice */ @@ -29,21 +31,37 @@ var _ = Describe("msg_server_defund_pool.go", Ordered, func() { s = i.NewCleanChain() // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxFundersSuccess(msg) + + // create funder + s.RunTxFundersSuccess(&types.MsgCreateFunder{ + Creator: i.ALICE, + Moniker: "moniker", }) // fund pool - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&types.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) }) @@ -53,97 +71,134 @@ var _ = Describe("msg_server_defund_pool.go", Ordered, func() { It("Defund 50 KYVE from a funder who has previously funded 100 KYVE", func() { // ACT - s.RunTxPoolSuccess(&pooltypes.MsgDefundPool{ + s.RunTxFundersSuccess(&types.MsgDefundPool{ Creator: i.ALICE, - Id: 0, + PoolId: 0, Amount: 50 * i.KYVE, }) // ASSERT balanceAfter := s.GetBalanceFromAddress(i.ALICE) - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(initialBalance - balanceAfter).To(Equal(50 * i.KYVE)) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.TotalFunds).To(Equal(50 * i.KYVE)) - - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(50 * i.KYVE)) + funding, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + Expect(funding.Amount).To(Equal(50 * i.KYVE)) + Expect(funding.AmountPerBundle).To(Equal(1 * i.KYVE)) + Expect(funding.TotalFunded).To(Equal(0 * i.KYVE)) - Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) - Expect(pool.GetLowestFunder().Amount).To(Equal(50 * i.KYVE)) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.TotalAmount).To(Equal(50 * i.KYVE)) + Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(1)) + Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.ALICE)) }) - It("Try to defund more than actually funded", func() { + It("Defund more than actually funded", func() { // ACT - s.RunTxPoolError(&pooltypes.MsgDefundPool{ + s.RunTxFundersSuccess(&types.MsgDefundPool{ Creator: i.ALICE, - Id: 0, + PoolId: 0, Amount: 101 * i.KYVE, }) // ASSERT balanceAfter := s.GetBalanceFromAddress(i.ALICE) + Expect(initialBalance - balanceAfter).To(BeZero()) - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - - Expect(initialBalance - balanceAfter).To(Equal(100 * i.KYVE)) - - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.TotalFunds).To(Equal(100 * i.KYVE)) - - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100 * i.KYVE)) + funding, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + Expect(funding.Amount).To(Equal(0 * i.KYVE)) + Expect(funding.AmountPerBundle).To(Equal(1 * i.KYVE)) + Expect(funding.TotalFunded).To(Equal(0 * i.KYVE)) - Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) - Expect(pool.GetLowestFunder().Amount).To(Equal(100 * i.KYVE)) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.TotalAmount).To(Equal(0 * i.KYVE)) + Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(0)) }) It("Defund full funding amount from a funder who has previously funded 100 KYVE", func() { // ACT - s.RunTxPoolSuccess(&pooltypes.MsgDefundPool{ + s.RunTxFundersSuccess(&types.MsgDefundPool{ Creator: i.ALICE, - Id: 0, + PoolId: 0, Amount: 100 * i.KYVE, }) // ASSERT balanceAfter := s.GetBalanceFromAddress(i.ALICE) - - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(initialBalance - balanceAfter).To(BeZero()) - Expect(pool.Funders).To(BeEmpty()) - Expect(pool.TotalFunds).To(BeZero()) - - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(uint64(0))) + funding, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + Expect(funding.Amount).To(Equal(0 * i.KYVE)) + Expect(funding.AmountPerBundle).To(Equal(1 * i.KYVE)) + Expect(funding.TotalFunded).To(Equal(0 * i.KYVE)) - Expect(pool.GetLowestFunder()).To(Equal(pooltypes.Funder{})) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.TotalAmount).To(Equal(0 * i.KYVE)) + Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(0)) }) It("Defund as highest funder 75 KYVE in order to be the lowest funder afterwards", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ + s.RunTxFundersSuccess(&types.MsgCreateFunder{ Creator: i.BOB, - Id: 0, - Amount: 50 * i.KYVE, + Moniker: "moniker", + }) + s.RunTxFundersSuccess(&types.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 50 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(pool.GetLowestFunder().Address).To(Equal(i.BOB)) - Expect(pool.GetLowestFunder().Amount).To(Equal(50 * i.KYVE)) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + activeFundings := s.App().FundersKeeper.GetActiveFundings(s.Ctx(), fundingState) + lowestFunding, err := s.App().FundersKeeper.GetLowestFunding(activeFundings) + Expect(err).To(BeNil()) + Expect(lowestFunding.FunderAddress).To(Equal(i.BOB)) // ACT - s.RunTxPoolSuccess(&pooltypes.MsgDefundPool{ + s.RunTxFundersSuccess(&types.MsgDefundPool{ Creator: i.ALICE, - Id: 0, + PoolId: 0, Amount: 75 * i.KYVE, }) // ASSERT - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) - Expect(pool.GetLowestFunder().Amount).To(Equal(25 * i.KYVE)) + fundingState, _ = s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + activeFundings = s.App().FundersKeeper.GetActiveFundings(s.Ctx(), fundingState) + lowestFunding, err = s.App().FundersKeeper.GetLowestFunding(activeFundings) + Expect(err).To(BeNil()) + Expect(lowestFunding.FunderAddress).To(Equal(i.ALICE)) + }) + + It("Try to defund nonexistent fundings", func() { + // ASSERT + s.RunTxFundersError(&types.MsgDefundPool{ + Creator: i.ALICE, + PoolId: 1, + Amount: 1 * i.KYVE, + }) + + s.RunTxFundersError(&types.MsgDefundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 1 * i.KYVE, + }) + }) + + It("Try to defund a funding twice", func() { + // ACT + s.RunTxFundersSuccess(&types.MsgDefundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + }) + + // ASSERT + s.RunTxFundersError(&types.MsgDefundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + }) }) }) diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go index 044cf923..bc039c13 100644 --- a/x/funders/keeper/msg_server_fund_pool.go +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -52,7 +52,7 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ return nil, err } - // Get or create funding state for pool + // Get funding state for pool fundingState, found := k.GetFundingState(ctx, msg.PoolId) if !found { return nil, errors.Wrapf(errorsTypes.ErrNotFound, types.ErrFundingStateDoesNotExist.Error(), msg.PoolId) diff --git a/x/funders/keeper/msg_server_fund_pool_test.go b/x/funders/keeper/msg_server_fund_pool_test.go index 8dc9c6ba..611e233d 100644 --- a/x/funders/keeper/msg_server_fund_pool_test.go +++ b/x/funders/keeper/msg_server_fund_pool_test.go @@ -1,19 +1,19 @@ package keeper_test import ( - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - i "github.com/KYVENetwork/chain/testutil/integration" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" ) /* TEST CASES - msg_server_fund_pool.go -* Create funder by funding a pool with 100 $KYVE -* Fund additional 50 $KYVE to an existing funder with 100 $KYVE +* Fund a pool with 100 $KYVE +* Fund additional 50 $KYVE to an existing funding with 100 $KYVE * Try to fund more $KYVE than available in balance * Fund with a new funder less $KYVE than the existing one * Fund with a new funder more $KYVE than the existing one @@ -32,14 +32,29 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { s = i.NewCleanChain() // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxFundersSuccess(msg) + + // create funder + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.ALICE, + Moniker: "moniker", }) }) @@ -47,232 +62,238 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { s.PerformValidityChecks() }) - It("Create funder by funding a pool with 100 $KYVE", func() { + It("Fund a pool with 100 $KYVE", func() { // ACT - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) // ASSERT balanceAfter := s.GetBalanceFromAddress(i.ALICE) - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(initialBalance - balanceAfter).To(Equal(100 * i.KYVE)) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.TotalFunds).To(Equal(100 * i.KYVE)) - - funderAmount := pool.GetFunderAmount(i.ALICE) - - Expect(funderAmount).To(Equal(100 * i.KYVE)) - Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) - Expect(pool.GetLowestFunder().Amount).To(Equal(100 * i.KYVE)) + funding, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + Expect(funding.FunderAddress).To(Equal(i.ALICE)) + Expect(funding.PoolId).To(Equal(uint64(0))) + Expect(funding.Amount).To(Equal(100 * i.KYVE)) + Expect(funding.AmountPerBundle).To(Equal(1 * i.KYVE)) + Expect(funding.TotalFunded).To(Equal(0 * i.KYVE)) + + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.PoolId).To(Equal(uint64(0))) + Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(1)) + Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.ALICE)) + Expect(fundingState.TotalAmount).To(Equal(100 * i.KYVE)) }) - It("Fund additional 50 $KYVE to an existing funder with 100 $KYVE", func() { + It("Fund additional 50 $KYVE to an existing funding with 100 $KYVE", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) // ACT - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ Creator: i.ALICE, - Id: 0, + PoolId: 0, Amount: 50 * i.KYVE, }) // ASSERT balanceAfter := s.GetBalanceFromAddress(i.ALICE) - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(initialBalance - balanceAfter).To(Equal(150 * i.KYVE)) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.TotalFunds).To(Equal(150 * i.KYVE)) - - funderAmount := pool.GetFunderAmount(i.ALICE) - - Expect(funderAmount).To(Equal(150 * i.KYVE)) - Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) - Expect(pool.GetLowestFunder().Amount).To(Equal(150 * i.KYVE)) + funding, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + Expect(funding.FunderAddress).To(Equal(i.ALICE)) + Expect(funding.PoolId).To(Equal(uint64(0))) + Expect(funding.Amount).To(Equal(150 * i.KYVE)) + Expect(funding.AmountPerBundle).To(Equal(1 * i.KYVE)) + Expect(funding.TotalFunded).To(Equal(0 * i.KYVE)) + + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.PoolId).To(Equal(uint64(0))) + Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(1)) + Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.ALICE)) + Expect(fundingState.TotalAmount).To(Equal(150 * i.KYVE)) }) It("Try to fund more $KYVE than available in balance", func() { // ACT currentBalance := s.GetBalanceFromAddress(i.ALICE) - s.RunTxPoolError(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: currentBalance + 1, + s.RunTxFundersError(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: currentBalance + 1, + AmountPerBundle: 1 * i.KYVE, }) // ASSERT balanceAfter := s.GetBalanceFromAddress(i.ALICE) - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(initialBalance - balanceAfter).To(BeZero()) - Expect(pool.Funders).To(BeEmpty()) - Expect(pool.TotalFunds).To(BeZero()) - - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(0 * i.KYVE)) - Expect(pool.GetLowestFunder().Address).To(Equal("")) - Expect(pool.GetLowestFunder().Amount).To(Equal(0 * i.KYVE)) - }) - - It("Fund with a new funder less $KYVE than the existing one", func() { - // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - - // ACT - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 50 * i.KYVE, - }) - - // ASSERT - balanceAfter := s.GetBalanceFromAddress(i.BOB) - - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - - Expect(initialBalance - balanceAfter).To(Equal(50 * i.KYVE)) - - Expect(pool.Funders).To(HaveLen(2)) - Expect(pool.TotalFunds).To(Equal(150 * i.KYVE)) + _, found := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + Expect(found).To(BeFalse()) - funderAmount := pool.GetFunderAmount(i.BOB) - - Expect(funderAmount).To(Equal(50 * i.KYVE)) - Expect(pool.GetLowestFunder().Address).To(Equal(i.BOB)) - Expect(pool.GetLowestFunder().Amount).To(Equal(50 * i.KYVE)) - }) - - It("Fund with a new funder more $KYVE than the existing one", func() { - // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - - // ACT - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 200 * i.KYVE, - }) - - // ASSERT - balanceAfter := s.GetBalanceFromAddress(i.BOB) - - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - - Expect(initialBalance - balanceAfter).To(Equal(200 * i.KYVE)) - - Expect(pool.Funders).To(HaveLen(2)) - Expect(pool.TotalFunds).To(Equal(300 * i.KYVE)) - - funderAmount := pool.GetFunderAmount(i.BOB) - Expect(funderAmount).To(Equal(200 * i.KYVE)) - - Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) - Expect(pool.GetLowestFunder().Amount).To(Equal(100 * i.KYVE)) - }) - - It("Try to fund less $KYVE than the lowest funder with full funding slots", func() { - // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - - for a := 0; a < 49; a++ { - // fill remaining funding slots - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.DUMMY[a], - Id: 0, - Amount: 1000 * i.KYVE, - }) - } - - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - - Expect(pool.Funders).To(HaveLen(50)) - Expect(pool.TotalFunds).To(Equal(49_100 * i.KYVE)) - - Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) - Expect(pool.GetLowestFunder().Amount).To(Equal(100 * i.KYVE)) - - balanceAfter := s.GetBalanceFromAddress(i.ALICE) - - Expect(initialBalance - balanceAfter).To(Equal(100 * i.KYVE)) - - // ACT - s.RunTxPoolError(&pooltypes.MsgFundPool{ - Creator: i.DUMMY[49], - Id: 0, - Amount: 50 * i.KYVE, - }) - - // ASSERT - Expect(pool.Funders).To(HaveLen(50)) - Expect(pool.TotalFunds).To(Equal(49_100 * i.KYVE)) - - Expect(pool.GetFunderAmount(i.DUMMY[49])).To(BeZero()) - Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) - Expect(pool.GetLowestFunder().Amount).To(Equal(100 * i.KYVE)) - }) - - It("Fund more $KYVE than the lowest funder with full funding slots", func() { - // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - - for a := 0; a < 49; a++ { - // fill remaining funding slots - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.DUMMY[a], - Id: 0, - Amount: 1000 * i.KYVE, - }) - } - - // ACT - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.DUMMY[49], - Id: 0, - Amount: 200 * i.KYVE, - }) - - // ASSERT - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - - Expect(pool.Funders).To(HaveLen(50)) - Expect(pool.TotalFunds).To(Equal(49_200 * i.KYVE)) - - Expect(pool.GetFunderAmount(i.DUMMY[49])).To(Equal(200 * i.KYVE)) - Expect(pool.GetLowestFunder().Address).To(Equal(i.DUMMY[49])) - Expect(pool.GetLowestFunder().Amount).To(Equal(200 * i.KYVE)) - - balanceAfter := s.GetBalanceFromAddress(i.ALICE) - Expect(initialBalance - balanceAfter).To(BeZero()) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.PoolId).To(Equal(uint64(0))) + Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(0)) + Expect(fundingState.TotalAmount).To(Equal(uint64(0))) }) + // TODO: fix this test + //It("Fund with a new funder less $KYVE than the existing one", func() { + // // ARRANGE + // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + // Creator: i.ALICE, + // PoolId: 0, + // Amount: 100 * i.KYVE, + // }) + // + // // ACT + // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + // Creator: i.BOB, + // PoolId: 0, + // Amount: 50 * i.KYVE, + // }) + // + // // ASSERT + // balanceAfter := s.GetBalanceFromAddress(i.BOB) + // + // pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + // + // Expect(initialBalance - balanceAfter).To(Equal(50 * i.KYVE)) + // + // Expect(pool.Funders).To(HaveLen(2)) + // Expect(pool.TotalFunds).To(Equal(150 * i.KYVE)) + // + // funderAmount := pool.GetFunderAmount(i.BOB) + // + // Expect(funderAmount).To(Equal(50 * i.KYVE)) + // Expect(pool.GetLowestFunder().Address).To(Equal(i.BOB)) + // Expect(pool.GetLowestFunder().Amount).To(Equal(50 * i.KYVE)) + //}) + // + //It("Fund with a new funder more $KYVE than the existing one", func() { + // // ARRANGE + // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + // Creator: i.ALICE, + // PoolId: 0, + // Amount: 100 * i.KYVE, + // }) + // + // // ACT + // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + // Creator: i.BOB, + // PoolId: 0, + // Amount: 200 * i.KYVE, + // }) + // + // // ASSERT + // balanceAfter := s.GetBalanceFromAddress(i.BOB) + // + // pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + // + // Expect(initialBalance - balanceAfter).To(Equal(200 * i.KYVE)) + // + // Expect(pool.Funders).To(HaveLen(2)) + // Expect(pool.TotalFunds).To(Equal(300 * i.KYVE)) + // + // funderAmount := pool.GetFunderAmount(i.BOB) + // Expect(funderAmount).To(Equal(200 * i.KYVE)) + // + // Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) + // Expect(pool.GetLowestFunder().Amount).To(Equal(100 * i.KYVE)) + //}) + // + //It("Try to fund less $KYVE than the lowest funder with full funding slots", func() { + // // ARRANGE + // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + // Creator: i.ALICE, + // PoolId: 0, + // Amount: 100 * i.KYVE, + // }) + // + // for a := 0; a < 49; a++ { + // // fill remaining funding slots + // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + // Creator: i.DUMMY[a], + // PoolId: 0, + // Amount: 1000 * i.KYVE, + // }) + // } + // + // pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + // + // Expect(pool.Funders).To(HaveLen(50)) + // Expect(pool.TotalFunds).To(Equal(49_100 * i.KYVE)) + // + // Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) + // Expect(pool.GetLowestFunder().Amount).To(Equal(100 * i.KYVE)) + // + // balanceAfter := s.GetBalanceFromAddress(i.ALICE) + // + // Expect(initialBalance - balanceAfter).To(Equal(100 * i.KYVE)) + // + // // ACT + // s.RunTxFundersError(&funderstypes.MsgFundPool{ + // Creator: i.DUMMY[49], + // PoolId: 0, + // Amount: 50 * i.KYVE, + // }) + // + // // ASSERT + // Expect(pool.Funders).To(HaveLen(50)) + // Expect(pool.TotalFunds).To(Equal(49_100 * i.KYVE)) + // + // Expect(pool.GetFunderAmount(i.DUMMY[49])).To(BeZero()) + // Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) + // Expect(pool.GetLowestFunder().Amount).To(Equal(100 * i.KYVE)) + //}) + // + //It("Fund more $KYVE than the lowest funder with full funding slots", func() { + // // ARRANGE + // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + // Creator: i.ALICE, + // PoolId: 0, + // Amount: 100 * i.KYVE, + // }) + // + // for a := 0; a < 49; a++ { + // // fill remaining funding slots + // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + // Creator: i.DUMMY[a], + // PoolId: 0, + // Amount: 1000 * i.KYVE, + // }) + // } + // + // // ACT + // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + // Creator: i.DUMMY[49], + // PoolId: 0, + // Amount: 200 * i.KYVE, + // }) + // + // // ASSERT + // pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + // + // Expect(pool.Funders).To(HaveLen(50)) + // Expect(pool.TotalFunds).To(Equal(49_200 * i.KYVE)) + // + // Expect(pool.GetFunderAmount(i.DUMMY[49])).To(Equal(200 * i.KYVE)) + // Expect(pool.GetLowestFunder().Address).To(Equal(i.DUMMY[49])) + // Expect(pool.GetLowestFunder().Amount).To(Equal(200 * i.KYVE)) + // + // balanceAfter := s.GetBalanceFromAddress(i.ALICE) + // Expect(initialBalance - balanceAfter).To(BeZero()) + //}) }) From 7a41b5ac75c4cd6df63fa809be745962354a6459 Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 2 Oct 2023 10:57:35 +0200 Subject: [PATCH 041/109] feat: add more tests for x/funders --- x/funders/keeper/msg_server_fund_pool.go | 18 +- x/funders/keeper/msg_server_fund_pool_test.go | 401 +++++++++++------- x/funders/types/funders.go | 9 + 3 files changed, 266 insertions(+), 162 deletions(-) diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go index bc039c13..07d7585c 100644 --- a/x/funders/keeper/msg_server_fund_pool.go +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -20,7 +20,8 @@ func (k msgServer) defundLowestFunding( return err } - lowestFunding.SubtractAmount(lowestFunding.Amount) + subtracted := lowestFunding.SubtractAmount(lowestFunding.Amount) + fundingState.SubtractAmount(subtracted) fundingState.SetInactive(lowestFunding) k.SetFunding(ctx, lowestFunding) @@ -28,7 +29,7 @@ func (k msgServer) defundLowestFunding( _ = ctx.EventManager().EmitTypedEvent(&types.EventDefundPool{ PoolId: poolId, Address: lowestFunding.FunderAddress, - Amount: lowestFunding.Amount, + Amount: subtracted, }) return nil } @@ -98,8 +99,7 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ util.PanicHalt(k.upgradeKeeper, ctx, err.Error()) } - // Check if lowest funding is lower than new funding - // TODO: what criteria should we use to determine if a funder is the lowest? + // Check if lowest funding is lower than new funding based on amount (amount per bundle is ignored) if lowestFunding.Amount < funding.Amount { // If so, check if lowest funding is from someone else if lowestFunding.FunderAddress != funding.FunderAddress { @@ -121,15 +121,9 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ // Check if defunding is necessary if defunding != nil { err := k.defundLowestFunding(ctx, defunding, &fundingState, msg.PoolId) - - // TODO: what to do if defunding fails? Should we return the funds to the user? - if err2 := util.TransferFromModuleToAddress(k.bankKeeper, ctx, types.ModuleName, msg.Creator, msg.Amount); err2 != nil { - k.Logger(ctx).Error("Failed to defund lowest funding", "error", err.Error()) - k.Logger(ctx).Error("Failed to transfer funds back to user", "error", err2.Error()) - return nil, err2 - } if err != nil { - return nil, err + // TODO: should we panic here? + util.PanicHalt(k.upgradeKeeper, ctx, err.Error()) } } diff --git a/x/funders/keeper/msg_server_fund_pool_test.go b/x/funders/keeper/msg_server_fund_pool_test.go index 611e233d..ef5580f7 100644 --- a/x/funders/keeper/msg_server_fund_pool_test.go +++ b/x/funders/keeper/msg_server_fund_pool_test.go @@ -17,8 +17,10 @@ TEST CASES - msg_server_fund_pool.go * Try to fund more $KYVE than available in balance * Fund with a new funder less $KYVE than the existing one * Fund with a new funder more $KYVE than the existing one +* Try to fund with a non-existent funder * Try to fund less $KYVE than the lowest funder with full funding slots -* Try to fund more $KYVE than the lowest funder with full funding slots +* Fund more $KYVE than the lowest funder with full funding slots +* Refund a funding as the lowest funder */ @@ -54,7 +56,11 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { // create funder s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ Creator: i.ALICE, - Moniker: "moniker", + Moniker: "Alice", + }) + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.BOB, + Moniker: "Bob", }) }) @@ -123,6 +129,11 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(1)) Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.ALICE)) Expect(fundingState.TotalAmount).To(Equal(150 * i.KYVE)) + + activeFundings := s.App().FundersKeeper.GetActiveFundings(s.Ctx(), fundingState) + lowestFunding, err := s.App().FundersKeeper.GetLowestFunding(activeFundings) + Expect(err).To(BeNil()) + Expect(lowestFunding.FunderAddress).To(Equal(i.ALICE)) }) It("Try to fund more $KYVE than available in balance", func() { @@ -138,7 +149,6 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { // ASSERT balanceAfter := s.GetBalanceFromAddress(i.ALICE) - Expect(initialBalance - balanceAfter).To(BeZero()) _, found := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) @@ -149,151 +159,242 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(0)) Expect(fundingState.TotalAmount).To(Equal(uint64(0))) }) - // TODO: fix this test - //It("Fund with a new funder less $KYVE than the existing one", func() { - // // ARRANGE - // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ - // Creator: i.ALICE, - // PoolId: 0, - // Amount: 100 * i.KYVE, - // }) - // - // // ACT - // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ - // Creator: i.BOB, - // PoolId: 0, - // Amount: 50 * i.KYVE, - // }) - // - // // ASSERT - // balanceAfter := s.GetBalanceFromAddress(i.BOB) - // - // pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - // - // Expect(initialBalance - balanceAfter).To(Equal(50 * i.KYVE)) - // - // Expect(pool.Funders).To(HaveLen(2)) - // Expect(pool.TotalFunds).To(Equal(150 * i.KYVE)) - // - // funderAmount := pool.GetFunderAmount(i.BOB) - // - // Expect(funderAmount).To(Equal(50 * i.KYVE)) - // Expect(pool.GetLowestFunder().Address).To(Equal(i.BOB)) - // Expect(pool.GetLowestFunder().Amount).To(Equal(50 * i.KYVE)) - //}) - // - //It("Fund with a new funder more $KYVE than the existing one", func() { - // // ARRANGE - // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ - // Creator: i.ALICE, - // PoolId: 0, - // Amount: 100 * i.KYVE, - // }) - // - // // ACT - // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ - // Creator: i.BOB, - // PoolId: 0, - // Amount: 200 * i.KYVE, - // }) - // - // // ASSERT - // balanceAfter := s.GetBalanceFromAddress(i.BOB) - // - // pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - // - // Expect(initialBalance - balanceAfter).To(Equal(200 * i.KYVE)) - // - // Expect(pool.Funders).To(HaveLen(2)) - // Expect(pool.TotalFunds).To(Equal(300 * i.KYVE)) - // - // funderAmount := pool.GetFunderAmount(i.BOB) - // Expect(funderAmount).To(Equal(200 * i.KYVE)) - // - // Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) - // Expect(pool.GetLowestFunder().Amount).To(Equal(100 * i.KYVE)) - //}) - // - //It("Try to fund less $KYVE than the lowest funder with full funding slots", func() { - // // ARRANGE - // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ - // Creator: i.ALICE, - // PoolId: 0, - // Amount: 100 * i.KYVE, - // }) - // - // for a := 0; a < 49; a++ { - // // fill remaining funding slots - // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ - // Creator: i.DUMMY[a], - // PoolId: 0, - // Amount: 1000 * i.KYVE, - // }) - // } - // - // pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - // - // Expect(pool.Funders).To(HaveLen(50)) - // Expect(pool.TotalFunds).To(Equal(49_100 * i.KYVE)) - // - // Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) - // Expect(pool.GetLowestFunder().Amount).To(Equal(100 * i.KYVE)) - // - // balanceAfter := s.GetBalanceFromAddress(i.ALICE) - // - // Expect(initialBalance - balanceAfter).To(Equal(100 * i.KYVE)) - // - // // ACT - // s.RunTxFundersError(&funderstypes.MsgFundPool{ - // Creator: i.DUMMY[49], - // PoolId: 0, - // Amount: 50 * i.KYVE, - // }) - // - // // ASSERT - // Expect(pool.Funders).To(HaveLen(50)) - // Expect(pool.TotalFunds).To(Equal(49_100 * i.KYVE)) - // - // Expect(pool.GetFunderAmount(i.DUMMY[49])).To(BeZero()) - // Expect(pool.GetLowestFunder().Address).To(Equal(i.ALICE)) - // Expect(pool.GetLowestFunder().Amount).To(Equal(100 * i.KYVE)) - //}) - // - //It("Fund more $KYVE than the lowest funder with full funding slots", func() { - // // ARRANGE - // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ - // Creator: i.ALICE, - // PoolId: 0, - // Amount: 100 * i.KYVE, - // }) - // - // for a := 0; a < 49; a++ { - // // fill remaining funding slots - // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ - // Creator: i.DUMMY[a], - // PoolId: 0, - // Amount: 1000 * i.KYVE, - // }) - // } - // - // // ACT - // s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ - // Creator: i.DUMMY[49], - // PoolId: 0, - // Amount: 200 * i.KYVE, - // }) - // - // // ASSERT - // pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - // - // Expect(pool.Funders).To(HaveLen(50)) - // Expect(pool.TotalFunds).To(Equal(49_200 * i.KYVE)) - // - // Expect(pool.GetFunderAmount(i.DUMMY[49])).To(Equal(200 * i.KYVE)) - // Expect(pool.GetLowestFunder().Address).To(Equal(i.DUMMY[49])) - // Expect(pool.GetLowestFunder().Amount).To(Equal(200 * i.KYVE)) - // - // balanceAfter := s.GetBalanceFromAddress(i.ALICE) - // Expect(initialBalance - balanceAfter).To(BeZero()) - //}) + + It("Fund with a new funder less $KYVE than the existing one", func() { + // ARRANGE + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) + + // ACT + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 50 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) + + // ASSERT + balanceAfter := s.GetBalanceFromAddress(i.BOB) + Expect(initialBalance - balanceAfter).To(Equal(50 * i.KYVE)) + + funding, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.BOB, 0) + Expect(funding.Amount).To(Equal(50 * i.KYVE)) + Expect(funding.AmountPerBundle).To(Equal(1 * i.KYVE)) + Expect(funding.TotalFunded).To(Equal(0 * i.KYVE)) + + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.PoolId).To(Equal(uint64(0))) + Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(2)) + Expect(fundingState.TotalAmount).To(Equal(150 * i.KYVE)) + + activeFundings := s.App().FundersKeeper.GetActiveFundings(s.Ctx(), fundingState) + lowestFunding, err := s.App().FundersKeeper.GetLowestFunding(activeFundings) + Expect(err).To(BeNil()) + Expect(lowestFunding.FunderAddress).To(Equal(i.BOB)) + }) + + It("Fund with a new funder more $KYVE than the existing one", func() { + // ARRANGE + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) + + // ACT + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 200 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) + + // ASSERT + balanceAfter := s.GetBalanceFromAddress(i.BOB) + Expect(initialBalance - balanceAfter).To(Equal(200 * i.KYVE)) + + funding, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.BOB, 0) + Expect(funding.Amount).To(Equal(200 * i.KYVE)) + Expect(funding.AmountPerBundle).To(Equal(1 * i.KYVE)) + Expect(funding.TotalFunded).To(Equal(0 * i.KYVE)) + + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.PoolId).To(Equal(uint64(0))) + Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(2)) + Expect(fundingState.TotalAmount).To(Equal(300 * i.KYVE)) + + activeFundings := s.App().FundersKeeper.GetActiveFundings(s.Ctx(), fundingState) + lowestFunding, err := s.App().FundersKeeper.GetLowestFunding(activeFundings) + Expect(err).To(BeNil()) + Expect(lowestFunding.FunderAddress).To(Equal(i.ALICE)) + }) + + It("Try to fund with a non-existent funder", func() { + // ASSERT + s.RunTxFundersError(&funderstypes.MsgFundPool{ + Creator: i.CHARLIE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) + }) + + It("Try to fund less $KYVE than the lowest funder with full funding slots", func() { + // ARRANGE + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) + + for a := 0; a < funderstypes.MaxFunders-1; a++ { + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.DUMMY[a], + Moniker: i.DUMMY[a], + }) + // fill remaining funding slots + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.DUMMY[a], + PoolId: 0, + Amount: 1000 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) + } + totalFunded := (funderstypes.MaxFunders-1)*1000*i.KYVE + 100*i.KYVE + + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(funderstypes.MaxFunders)) + Expect(fundingState.TotalAmount).To(Equal(totalFunded)) + + balanceAfter := s.GetBalanceFromAddress(i.ALICE) + Expect(initialBalance - balanceAfter).To(Equal(100 * i.KYVE)) + + // ACT + s.RunTxFundersError(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 50 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) + + // ASSERT + fundingState, _ = s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(funderstypes.MaxFunders)) + Expect(fundingState.TotalAmount).To(Equal(totalFunded)) + + activeFundings := s.App().FundersKeeper.GetActiveFundings(s.Ctx(), fundingState) + Expect(activeFundings).To(HaveLen(50)) + lowestFunding, err := s.App().FundersKeeper.GetLowestFunding(activeFundings) + Expect(err).To(BeNil()) + Expect(lowestFunding.FunderAddress).To(Equal(i.ALICE)) + }) + + It("Fund more $KYVE than the lowest funder with full funding slots", func() { + // ARRANGE + initialBalanceBob := s.GetBalanceFromAddress(i.BOB) + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) + + for a := 0; a < funderstypes.MaxFunders-1; a++ { + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.DUMMY[a], + Moniker: i.DUMMY[a], + }) + // fill remaining funding slots + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.DUMMY[a], + PoolId: 0, + Amount: 1000 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) + } + balanceAfter := s.GetBalanceFromAddress(i.ALICE) + Expect(initialBalance - balanceAfter).To(Equal(100 * i.KYVE)) + + // ACT + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 200 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) + x := s.GetBalanceFromAddress(i.BOB) + Expect(initialBalanceBob - x).To(Equal(200 * i.KYVE)) + // ASSERT + totalFunded := (funderstypes.MaxFunders-1)*1000*i.KYVE + 200*i.KYVE + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(funderstypes.MaxFunders)) + Expect(fundingState.TotalAmount).To(Equal(totalFunded)) + + activeFundings := s.App().FundersKeeper.GetActiveFundings(s.Ctx(), fundingState) + Expect(activeFundings).To(HaveLen(50)) + lowestFunding, err := s.App().FundersKeeper.GetLowestFunding(activeFundings) + Expect(err).To(BeNil()) + Expect(lowestFunding.FunderAddress).To(Equal(i.BOB)) + + balanceEnd := s.GetBalanceFromAddress(i.ALICE) + Expect(initialBalance - balanceEnd).To(BeZero()) + + balanceAfterBob := s.GetBalanceFromAddress(i.BOB) + Expect(initialBalanceBob - balanceAfterBob).To(Equal(200 * i.KYVE)) + }) + + It("Refund a funding as the lowest funder", func() { + // ARRANGE + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) + + for a := 0; a < funderstypes.MaxFunders-1; a++ { + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.DUMMY[a], + Moniker: i.DUMMY[a], + }) + // fill remaining funding slots + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.DUMMY[a], + PoolId: 0, + Amount: 1000 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) + } + totalFunded := (funderstypes.MaxFunders-1)*1000*i.KYVE + 100*i.KYVE + + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(totalFunded).To(Equal(fundingState.TotalAmount)) + activeFundings := s.App().FundersKeeper.GetActiveFundings(s.Ctx(), fundingState) + Expect(activeFundings).To(HaveLen(50)) + lowestFunding, err := s.App().FundersKeeper.GetLowestFunding(activeFundings) + Expect(err).To(BeNil()) + Expect(lowestFunding.FunderAddress).To(Equal(i.ALICE)) + + // ACT + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 50 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) + + // ASSERT + fundingState, _ = s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(funderstypes.MaxFunders)) + Expect(fundingState.TotalAmount).To(Equal(totalFunded + 50*i.KYVE)) + + balanceEnd := s.GetBalanceFromAddress(i.ALICE) + Expect(initialBalance - balanceEnd).To(Equal(150 * i.KYVE)) + }) }) diff --git a/x/funders/types/funders.go b/x/funders/types/funders.go index f2bf4a76..d3791c0a 100644 --- a/x/funders/types/funders.go +++ b/x/funders/types/funders.go @@ -23,6 +23,15 @@ func (fs *FundingState) AddAmount(amount uint64) { fs.TotalAmount += amount } +func (fs *FundingState) SubtractAmount(amount uint64) (subtracted uint64) { + subtracted = amount + if fs.TotalAmount < amount { + subtracted = fs.TotalAmount + } + fs.TotalAmount -= subtracted + return subtracted +} + // SetInactive removes a funding from active fundings func (fs *FundingState) SetInactive(funding *Funding) { for i, funderAddress := range fs.ActiveFunderAddresses { From f8925d8566bda1af4b1e91ddad40334291e32d12 Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 2 Oct 2023 11:20:07 +0200 Subject: [PATCH 042/109] feat: add more tests for x/funders --- x/funders/keeper/msg_server_fund_pool_test.go | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/x/funders/keeper/msg_server_fund_pool_test.go b/x/funders/keeper/msg_server_fund_pool_test.go index ef5580f7..876c6e42 100644 --- a/x/funders/keeper/msg_server_fund_pool_test.go +++ b/x/funders/keeper/msg_server_fund_pool_test.go @@ -21,6 +21,9 @@ TEST CASES - msg_server_fund_pool.go * Try to fund less $KYVE than the lowest funder with full funding slots * Fund more $KYVE than the lowest funder with full funding slots * Refund a funding as the lowest funder +* Try to fund a non-existent pool +* Try to fund below the minimum amount +* Try to fund below the minimum amount per bundle */ @@ -397,4 +400,34 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { balanceEnd := s.GetBalanceFromAddress(i.ALICE) Expect(initialBalance - balanceEnd).To(Equal(150 * i.KYVE)) }) + + It("Try to fund a non-existent pool", func() { + // ASSERT + s.RunTxFundersError(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 1, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) + }) + + It("Try to fund below the minimum amount", func() { + // ASSERT + s.RunTxFundersError(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 1, + AmountPerBundle: 1 * i.KYVE, + }) + }) + + It("Try to fund below the minimum amount per bundle", func() { + // ASSERT + s.RunTxFundersError(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1, + }) + }) }) From ae58cf76e9b18f787d7d6536c2ee3d07d0de4183 Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 2 Oct 2023 11:52:54 +0200 Subject: [PATCH 043/109] feat: add more tests for x/funders --- x/funders/types/funders_test.go | 169 ++++++++++++++++++++++++++++++++ x/funders/types/types_test.go | 16 +++ 2 files changed, 185 insertions(+) create mode 100644 x/funders/types/funders_test.go create mode 100644 x/funders/types/types_test.go diff --git a/x/funders/types/funders_test.go b/x/funders/types/funders_test.go new file mode 100644 index 00000000..e3cdaeb9 --- /dev/null +++ b/x/funders/types/funders_test.go @@ -0,0 +1,169 @@ +package types_test + +import ( + i "github.com/KYVENetwork/chain/testutil/integration" + "github.com/KYVENetwork/chain/x/funders/types" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +/* + +TEST CASES - funders.go + +* Funding.AddAmount +* Funding.SubtractAmount +* Funding.SubtractAmount - subtract more than available +* Funding.ChargeOneBundle +* Funding.ChargeOneBundle - charge more than available +* FundintState.AddAmount +* FundintState.SubtractAmount +* FundintState.SubtractAmount - subtract more than available +* FundintState.SetActive +* FundintState.SetActive - add same funder twice +* FundintState.SetInactive +* FundintState.SetInactive - with multiple funders + +*/ + +var _ = Describe("logic_funders.go", Ordered, func() { + funding := types.Funding{} + fundingState := types.FundingState{} + + BeforeEach(func() { + funding = types.Funding{ + FunderAddress: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + TotalFunded: 0, + } + fundingState = types.FundingState{ + PoolId: 0, + ActiveFunderAddresses: []string{i.ALICE, i.BOB}, + TotalAmount: 100 * i.KYVE, + } + }) + + It("Funding.AddAmount", func() { + // ACT + funding.AddAmount(100 * i.KYVE) + + // ASSERT + Expect(funding.Amount).To(Equal(200 * i.KYVE)) + Expect(funding.TotalFunded).To(Equal(uint64(0))) + }) + + It("Funding.SubtractAmount", func() { + // ACT + funding.SubtractAmount(50 * i.KYVE) + + // ASSERT + Expect(funding.Amount).To(Equal(50 * i.KYVE)) + Expect(funding.TotalFunded).To(Equal(uint64(0))) + }) + + It("Funding.SubtractAmount - subtract more than available", func() { + // ACT + subtracted := funding.SubtractAmount(200 * i.KYVE) + + // ASSERT + Expect(subtracted).To(Equal(100 * i.KYVE)) + Expect(funding.Amount).To(Equal(uint64(0))) + }) + + It("Funding.ChargeOneBundle", func() { + // ACT + amount := funding.ChargeOneBundle() + + // ASSERT + Expect(amount).To(Equal(1 * i.KYVE)) + Expect(funding.Amount).To(Equal(99 * i.KYVE)) + Expect(funding.TotalFunded).To(Equal(1 * i.KYVE)) + }) + + It("Funding.ChargeOneBundle - charge more than available", func() { + // ARRANGE + funding.Amount = 1 * i.KYVE / 2 + + // ACT + amount := funding.ChargeOneBundle() + + // ASSERT + Expect(amount).To(Equal(1 * i.KYVE / 2)) + Expect(funding.Amount).To(Equal(uint64(0))) + Expect(funding.TotalFunded).To(Equal(1 * i.KYVE / 2)) + }) + + It("FundintState.AddAmount", func() { + // ACT + fundingState.AddAmount(100 * i.KYVE) + + // ASSERT + Expect(fundingState.TotalAmount).To(Equal(200 * i.KYVE)) + }) + + It("FundintState.SubtractAmount", func() { + // ACT + subtracted := fundingState.SubtractAmount(50 * i.KYVE) + + // ASSERT + Expect(subtracted).To(Equal(50 * i.KYVE)) + Expect(fundingState.TotalAmount).To(Equal(50 * i.KYVE)) + }) + + It("FundintState.SubtractAmount - subtract more than available", func() { + // ACT + subtracted := fundingState.SubtractAmount(200 * i.KYVE) + + // ASSERT + Expect(subtracted).To(Equal(100 * i.KYVE)) + Expect(fundingState.TotalAmount).To(Equal(uint64(0))) + }) + + It("FundintState.SetActive", func() { + // ARRANGE + fundingState.ActiveFunderAddresses = []string{} + + // ACT + fundingState.SetActive(&funding) + + // ASSERT + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) + Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.ALICE)) + }) + + It("FundintState.SetActive - add same funder twice", func() { + // ACT + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(2)) + Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.ALICE)) + + fundingState.SetActive(&funding) + + // ASSERT + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(2)) + Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.ALICE)) + }) + + It("FundintState.SetInactive", func() { + // ACT + Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.ALICE)) + fundingState.SetInactive(&funding) + + // ASSERT + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) + }) + + It("FundintState.SetInactive - with multiple funders", func() { + // ARRANGE + fundingState.ActiveFunderAddresses = []string{i.ALICE, i.BOB, i.CHARLIE} + + // ACT + fundingState.SetInactive(&funding) + + // ASSERT + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(2)) + Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.CHARLIE)) + Expect(fundingState.ActiveFunderAddresses[1]).To(Equal(i.BOB)) + }) +}) diff --git a/x/funders/types/types_test.go b/x/funders/types/types_test.go new file mode 100644 index 00000000..28251e21 --- /dev/null +++ b/x/funders/types/types_test.go @@ -0,0 +1,16 @@ +package types_test + +import ( + "fmt" + "testing" + + "github.com/KYVENetwork/chain/x/team/types" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestTeamKeeper(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, fmt.Sprintf("x/%s Types Test Suite", types.ModuleName)) +} From bb348f47f4bf653db9b963693765bab2d013c1a3 Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 2 Oct 2023 17:00:40 +0200 Subject: [PATCH 044/109] feat: add more tests for x/funders - logic_funders.go --- testutil/integration/checks.go | 137 ++++++--- x/funders/keeper/keeper.go | 4 + x/funders/keeper/logic_funders.go | 13 +- x/funders/keeper/logic_funders_test.go | 382 +++++++++---------------- 4 files changed, 248 insertions(+), 288 deletions(-) diff --git a/testutil/integration/checks.go b/testutil/integration/checks.go index 54dcf815..0d62b590 100644 --- a/testutil/integration/checks.go +++ b/testutil/integration/checks.go @@ -1,6 +1,8 @@ package integration import ( + "github.com/KYVENetwork/chain/x/funders" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" "time" "github.com/KYVENetwork/chain/x/bundles" @@ -16,20 +18,21 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" . "github.com/onsi/gomega" - pooltypes "github.com/KYVENetwork/chain/x/pool/types" sdk "github.com/cosmos/cosmos-sdk/types" ) func (suite *KeeperTestSuite) PerformValidityChecks() { // verify pool module - suite.VerifyPoolModuleAssetsIntegrity() - suite.VerifyPoolTotalFunds() - + suite.VerifyPoolModuleFundingStates() // TODO(@troy,@max): Figure out a better way to check this when disabling pools. // suite.VerifyPoolQueries() - suite.VerifyPoolGenesisImportExport() + // verify funders module + suite.VerifyFundersGenesisImportExport() + suite.VerifyFundersModuleIntegrity() + suite.VerifyFundersModuleAssetsIntegrity() + // verify stakers module suite.VerifyStakersGenesisImportExport() suite.VerifyStakersModuleAssetsIntegrity() @@ -55,36 +58,12 @@ func (suite *KeeperTestSuite) PerformValidityChecks() { // pool module checks // ================== -func (suite *KeeperTestSuite) VerifyPoolModuleAssetsIntegrity() { - expectedBalance := uint64(0) - actualBalance := uint64(0) - - // TODO(rapha): fix this - //for _, pool := range suite.App().PoolKeeper.GetAllPools(suite.Ctx()) { - // pool funds should be in pool module - //for _, funder := range pool.Funders { - // expectedBalance += funder.Amount - //} - //} - - moduleAcc := suite.App().AccountKeeper.GetModuleAccount(suite.Ctx(), pooltypes.ModuleName).GetAddress() - actualBalance = suite.App().BankKeeper.GetBalance(suite.Ctx(), moduleAcc, globalTypes.Denom).Amount.Uint64() - - Expect(actualBalance).To(Equal(expectedBalance)) -} - -func (suite *KeeperTestSuite) VerifyPoolTotalFunds() { - // TODO(rapha): fix this - //for _, pool := range suite.App().PoolKeeper.GetAllPools(suite.Ctx()) { - // expectedBalance := uint64(0) - //actualBalance := pool.TotalFunds - // - //for _, funder := range pool.Funders { - // expectedBalance += funder.Amount - //} - // - //Expect(actualBalance).To(Equal(expectedBalance)) - //} +func (suite *KeeperTestSuite) VerifyPoolModuleFundingStates() { + // every pool must have a funding state + for _, p := range suite.App().PoolKeeper.GetAllPools(suite.Ctx()) { + found := suite.App().FundersKeeper.DoesFundingStateExist(suite.Ctx(), p.Id) + Expect(found).To(BeTrue()) + } } func (suite *KeeperTestSuite) VerifyPoolQueries() { @@ -434,6 +413,94 @@ func (suite *KeeperTestSuite) VerifyTeamGenesisImportExport() { team.InitGenesis(suite.Ctx(), suite.App().TeamKeeper, *genState) } +// ======================== +// funders module checks +// ======================== + +func (suite *KeeperTestSuite) VerifyFundersGenesisImportExport() { + genState := funders.ExportGenesis(suite.Ctx(), suite.App().FundersKeeper) + + // Delete all entries in Funders Store + store := suite.Ctx().KVStore(suite.App().FundersKeeper.StoreKey()) + suite.deleteStore(store) + + err := genState.Validate() + Expect(err).To(BeNil()) + funders.InitGenesis(suite.Ctx(), suite.App().FundersKeeper, *genState) +} + +func (suite *KeeperTestSuite) VerifyFundersModuleIntegrity() { + funderAddresses := make(map[string]bool) + activeFunderAddresses := make(map[string]bool) + for _, funder := range suite.App().FundersKeeper.GetAllFunders(suite.Ctx()) { + funderAddresses[funder.Address] = false + } + + for _, funding := range suite.App().FundersKeeper.GetAllFundings(suite.Ctx()) { + // check if funding has a valid funder + _, found := funderAddresses[funding.FunderAddress] + Expect(found).To(BeTrue()) + + // check if the funder has already funded (should not be the case) + Expect(funderAddresses[funding.FunderAddress]).To(BeFalse()) + + funderAddresses[funding.FunderAddress] = true + + // check if funding is active + if funding.Amount > 0 { + activeFunderAddresses[funding.FunderAddress] = true + } + + // check if pool exists + _, found = suite.App().PoolKeeper.GetPool(suite.Ctx(), funding.PoolId) + Expect(found).To(BeTrue()) + } + + for _, fundingState := range suite.App().FundersKeeper.GetAllFundingStates(suite.Ctx()) { + fsActiveAddresses := make(map[string]bool) + for _, funderAddress := range fundingState.ActiveFunderAddresses { + // check if funding has a valid funder + _, found := activeFunderAddresses[funderAddress] + Expect(found).To(BeTrue()) + + // check if funder is not already in the list + Expect(fsActiveAddresses[funderAddress]).To(BeFalse()) + fsActiveAddresses[funderAddress] = true + } + + // check if the amount of active fundings is equal to the amount of active funder addresses + activeFundings := suite.App().FundersKeeper.GetActiveFundings(suite.Ctx(), fundingState) + Expect(activeFundings).To(HaveLen(len(fundingState.ActiveFunderAddresses))) + + // be lower or equal to max funders + Expect(len(fundingState.ActiveFunderAddresses)).To(BeNumerically("<=", funderstypes.MaxFunders)) + } +} + +func (suite *KeeperTestSuite) VerifyFundersModuleAssetsIntegrity() { + expectedBalance := uint64(0) + for _, funding := range suite.App().FundersKeeper.GetAllFundings(suite.Ctx()) { + expectedBalance += funding.Amount + } + + expectedFundingStateTotalAmount := uint64(0) + for _, fundingState := range suite.App().FundersKeeper.GetAllFundingStates(suite.Ctx()) { + activeFundings := suite.App().FundersKeeper.GetActiveFundings(suite.Ctx(), fundingState) + totalAmount := uint64(0) + for _, activeFunding := range activeFundings { + totalAmount += activeFunding.Amount + } + Expect(totalAmount).To(Equal(fundingState.TotalAmount)) + expectedFundingStateTotalAmount += fundingState.TotalAmount + } + + // total amount of fundings should be equal to the amount of the funders module account + moduleAcc := suite.App().AccountKeeper.GetModuleAccount(suite.Ctx(), funderstypes.ModuleName).GetAddress() + actualBalance := suite.App().BankKeeper.GetBalance(suite.Ctx(), moduleAcc, globalTypes.Denom).Amount.Uint64() + Expect(actualBalance).To(Equal(expectedBalance)) + Expect(actualBalance).To(Equal(expectedFundingStateTotalAmount)) +} + // ======================== // helpers // ======================== diff --git a/x/funders/keeper/keeper.go b/x/funders/keeper/keeper.go index e42d32c7..c7c835be 100644 --- a/x/funders/keeper/keeper.go +++ b/x/funders/keeper/keeper.go @@ -54,3 +54,7 @@ func NewKeeper( func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } + +func (k Keeper) StoreKey() storetypes.StoreKey { + return k.storeKey +} diff --git a/x/funders/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go index debe169a..9aa97abc 100644 --- a/x/funders/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -20,13 +20,11 @@ func (k Keeper) CreateFundingState(ctx sdk.Context, poolId uint64) { k.SetFundingState(ctx, &fundingState) } -// ChargeFundersOfPool equally splits the amount between all funders and removes -// the appropriate amount from each funder. -// All funders who can't afford the amount, are kicked out. -// Their remaining amount is transferred to the Treasury. -// This method does not transfer any funds. The bundles-module -// is responsible for transferring the rewards out of the module. -// TODO: update text +// ChargeFundersOfPool charges all funders of a pool with their amount_per_bundle +// If the amount is lower than the amount_per_bundle, +// the max amount is charged and the funder is removed from the active funders list. +// The amount is transferred from the funders to the pool module account where it can be paid out. +// If there are no more active funders, an event is emitted. func (k Keeper) ChargeFundersOfPool(ctx sdk.Context, poolId uint64) (payout uint64, err error) { // Get funding state for pool fundingState, found := k.GetFundingState(ctx, poolId) @@ -49,6 +47,7 @@ func (k Keeper) ChargeFundersOfPool(ctx sdk.Context, poolId uint64) (payout uint } k.SetFunding(ctx, &funding) } + fundingState.SubtractAmount(payout) // Save funding state k.SetFundingState(ctx, &fundingState) diff --git a/x/funders/keeper/logic_funders_test.go b/x/funders/keeper/logic_funders_test.go index ebb83291..3619ba63 100644 --- a/x/funders/keeper/logic_funders_test.go +++ b/x/funders/keeper/logic_funders_test.go @@ -2,7 +2,8 @@ package keeper_test import ( i "github.com/KYVENetwork/chain/testutil/integration" - "github.com/KYVENetwork/chain/util" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" + globaltypes "github.com/KYVENetwork/chain/x/global/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -12,303 +13,192 @@ import ( TEST CASES - logic_funders.go -* Add funders; check total sum -* Add multiple funders; check total sum -* Remove funder -* Remove funder by defunding everything -* Charge Funders with equal amounts -* Charge Funders test remainder -* Charge exactly the lowest funder amount -* Kick out multiple lowest funders -* Charge more than pool has funds -* Charge pool which has no funds at all +* Charge funders once +* Charge funders until one funder runs out of funds +* Charge funders until all funders run out of funds +* Charge funder with less funds than amount_per_bundle +* Charge without fundings */ -func chargeFunders(s *i.KeeperTestSuite, amount uint64) (payout uint64, err error) { - payout, err = s.App().PoolKeeper.ChargeFundersOfPool(s.Ctx(), 0, amount) - if err != nil { - return 0, err - } - - if err := util.TransferFromModuleToAddress(s.App().BankKeeper, s.Ctx(), pooltypes.ModuleName, i.BURNER, payout); err != nil { - return 0, err - } - - return payout, err -} - -func fundersCheck(pool *pooltypes.Pool) { - poolFunds := uint64(0) - funders := make(map[string]bool) - for _, funder := range pool.Funders { - Expect(funders[funder.Address]).To(BeFalse()) - funders[funder.Address] = true - poolFunds += funder.Amount - } - Expect(pool.TotalFunds).To(Equal(poolFunds)) -} - var _ = Describe("logic_funders.go", Ordered, func() { s := i.NewCleanChain() - var pool *pooltypes.Pool + fundersModuleAcc := s.App().AccountKeeper.GetModuleAccount(s.Ctx(), funderstypes.ModuleName).GetAddress() + poolModuleAcc := s.App().AccountKeeper.GetModuleAccount(s.Ctx(), pooltypes.ModuleName).GetAddress() BeforeEach(func() { s = i.NewCleanChain() - pool = &pooltypes.Pool{ - Name: "PoolTest", - MaxBundleSize: 100, - StartKey: "0", - MinDelegation: 100 * i.KYVE, - UploadInterval: 60, - OperatingCost: 10_000, - UpgradePlan: &pooltypes.UpgradePlan{}, - } - s.App().PoolKeeper.AppendPool(s.Ctx(), *pool) + // create clean pool for every test case + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxFundersSuccess(msg) + + // create funder + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.ALICE, + Moniker: "Alice", + }) + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.BOB, + Moniker: "Bob", + }) + + // fund pool + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 50 * i.KYVE, + AmountPerBundle: 10 * i.KYVE, + }) + + fundersBalance := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAcc, globaltypes.Denom).Amount.Uint64() + Expect(fundersBalance).To(Equal(150 * i.KYVE)) }) AfterEach(func() { - fundersCheck(pool) s.PerformValidityChecks() }) - It("Add funders; check total sum", func() { - // ACT - pool.AddAmountToFunder(i.ALICE, 1000) - pool.AddAmountToFunder(i.ALICE, 2000) - pool.AddAmountToFunder(i.ALICE, 0) - pool.AddAmountToFunder(i.BOB, 0) - pool.AddAmountToFunder(i.ALICE, 10) - - // ASSERT - Expect(pool.TotalFunds).To(Equal(uint64(3010))) - Expect(pool.Funders).To(HaveLen(1)) - }) - - It("Add multiple funders; check total sum", func() { + It("Charge funders once", func() { // ACT - pool.AddAmountToFunder(i.ALICE, 1000) - pool.AddAmountToFunder(i.ALICE, 2000) - pool.AddAmountToFunder(i.ALICE, 0) - pool.AddAmountToFunder(i.BOB, 1000) - pool.AddAmountToFunder(i.ALICE, 10) + payout, err := s.App().FundersKeeper.ChargeFundersOfPool(s.Ctx(), 0) + Expect(err).NotTo(HaveOccurred()) // ASSERT - Expect(pool.TotalFunds).To(Equal(uint64(4010))) - Expect(pool.Funders).To(HaveLen(2)) - }) - - It("Remove funder", func() { - // ARRANGE - pool.AddAmountToFunder(i.ALICE, 1000) - pool.AddAmountToFunder(i.ALICE, 2000) - pool.AddAmountToFunder(i.ALICE, 0) - pool.AddAmountToFunder(i.BOB, 0) - pool.AddAmountToFunder(i.ALICE, 10) - pool.AddAmountToFunder(i.CHARLIE, 500) - - Expect(pool.TotalFunds).To(Equal(uint64(3510))) - - // ACT - // Alice: 3010 - // Charlie: 500 - pool.RemoveFunder(i.CHARLIE) + Expect(payout).To(Equal(11 * i.KYVE)) - // ASSERT - Expect(pool.TotalFunds).To(Equal(uint64(3010))) - Expect(pool.Funders).To(HaveLen(1)) + fundersBalance := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAcc, globaltypes.Denom).Amount.Uint64() + poolBalance := s.App().BankKeeper.GetBalance(s.Ctx(), poolModuleAcc, globaltypes.Denom).Amount.Uint64() + Expect(fundersBalance).To(Equal(139 * i.KYVE)) + Expect(poolBalance).To(Equal(11 * i.KYVE)) }) - It("Remove funder by defunding everything", func() { - // ARRANGE - pool.AddAmountToFunder(i.ALICE, 1000) - pool.AddAmountToFunder(i.ALICE, 2000) - pool.AddAmountToFunder(i.ALICE, 0) - pool.AddAmountToFunder(i.BOB, 0) - pool.AddAmountToFunder(i.ALICE, 10) - pool.AddAmountToFunder(i.CHARLIE, 500) - + It("Charge funders until one funder runs out of funds", func() { // ACT - // Alice: 3010 - // Charlie: 500 - pool.SubtractAmountFromFunder(i.ALICE, 3010) - - // ASSERT - Expect(pool.TotalFunds).To(Equal(uint64(500))) - Expect(pool.Funders).To(HaveLen(1)) - }) - - It("Charge Funders with equal amounts", func() { - // ARRANGE - for k := 0; k < 50; k++ { - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.DUMMY[k], - Id: 0, - Amount: 100 * i.KYVE, - }) + for range [5]struct{}{} { + payout, err := s.App().FundersKeeper.ChargeFundersOfPool(s.Ctx(), 0) + Expect(err).NotTo(HaveOccurred()) + Expect(payout).To(Equal(11 * i.KYVE)) } - pool, poolFound := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(poolFound).To(BeTrue()) - Expect(pool.TotalFunds).To(Equal(50 * 100 * i.KYVE)) - - // ACT - payout, err := chargeFunders(s, 50*10*i.KYVE) // ASSERT - Expect(err).NotTo(HaveOccurred()) - Expect(payout).To(Equal(50 * 10 * i.KYVE)) - - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(pool.TotalFunds).To(Equal(50 * 90 * i.KYVE)) - - for _, funder := range pool.Funders { - Expect(funder.Amount).To(Equal(90 * i.KYVE)) - } + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.TotalAmount).To(Equal(95 * i.KYVE)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) + Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.ALICE)) + + fundersBalance := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAcc, globaltypes.Denom).Amount.Uint64() + poolBalance := s.App().BankKeeper.GetBalance(s.Ctx(), poolModuleAcc, globaltypes.Denom).Amount.Uint64() + Expect(fundersBalance).To(Equal(95 * i.KYVE)) + Expect(poolBalance).To(Equal(55 * i.KYVE)) }) - It("Charge Funders test remainder", func() { + It("Charge funders until all funders run out of funds", func() { // ARRANGE - for k := 0; k < 50; k++ { - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.DUMMY[k], - Id: 0, - Amount: 100 * i.KYVE, - }) - } - pool, poolFound := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(poolFound).To(BeTrue()) - Expect(pool.TotalFunds).To(Equal(50 * 100 * i.KYVE)) + funding, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + funding.AmountPerBundle = 10 * i.KYVE + s.App().FundersKeeper.SetFunding(s.Ctx(), &funding) // ACT - // Charge 10 $KYVE + 49tkyve - // the 49 tkyve will be charged to the lowest funder - payout, err := chargeFunders(s, 50*10*i.KYVE+49) - - // ASSERT - Expect(err).NotTo(HaveOccurred()) - Expect(payout).To(Equal(50*10*i.KYVE + 49)) - - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) - - for _, funder := range pool.Funders { - if pool.GetLowestFunder().Address == funder.Address { - Expect(funder.Amount).To(Equal(90*i.KYVE - 49)) - } else { - Expect(funder.Amount).To(Equal(90 * i.KYVE)) - } - } - }) + for range [5]struct{}{} { + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(2)) - It("Charge exactly lowest funder amount", func() { - // ARRANGE - for k := 0; k < 40; k++ { - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.DUMMY[k], - Id: 0, - Amount: 100 * i.KYVE, - }) - } - for k := 0; k < 10; k++ { - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.DUMMY[40+k], - Id: 0, - Amount: 200 * i.KYVE, - }) + payout, err := s.App().FundersKeeper.ChargeFundersOfPool(s.Ctx(), 0) + Expect(err).NotTo(HaveOccurred()) + Expect(payout).To(Equal(20 * i.KYVE)) } - pool, poolFound := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(poolFound).To(BeTrue()) - Expect(pool.TotalFunds).To(Equal((100*40 + 200*10) * i.KYVE)) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) - // ACT - payout, err := chargeFunders(s, 50*100*i.KYVE) + for range [5]struct{}{} { + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) - // ASSERT - Expect(err).NotTo(HaveOccurred()) - Expect(payout).To(Equal(50 * 100 * i.KYVE)) - - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(10)) - }) - - It("Kick out multiple lowest funders", func() { - // Arrange - for k := 0; k < 40; k++ { - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.DUMMY[k], - Id: 0, - Amount: 50 * i.KYVE, - }) - } - for k := 0; k < 10; k++ { - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.DUMMY[40+k], - Id: 0, - Amount: 1000 * i.KYVE, - }) + payout, err := s.App().FundersKeeper.ChargeFundersOfPool(s.Ctx(), 0) + Expect(err).NotTo(HaveOccurred()) + Expect(payout).To(Equal(10 * i.KYVE)) } - pool, poolFound := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(poolFound).To(BeTrue()) - Expect(pool.TotalFunds).To(Equal((50*40 + 1000*10) * i.KYVE)) + fundingState, _ = s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(0)) - // 40 * 50 = 2000 - // 10 * 1000 = 10000 - // Charge 5000 - - // Act - payout, err := chargeFunders(s, 5000*i.KYVE) - - // Assert + payout, err := s.App().FundersKeeper.ChargeFundersOfPool(s.Ctx(), 0) Expect(err).NotTo(HaveOccurred()) - Expect(payout).To(Equal(3000 * i.KYVE)) - - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(10)) + Expect(payout).To(Equal(0 * i.KYVE)) - for _, funder := range pool.Funders { - Expect(funder.Amount).To(Equal(900 * i.KYVE)) - } + fundersBalance := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAcc, globaltypes.Denom).Amount.Uint64() + poolBalance := s.App().BankKeeper.GetBalance(s.Ctx(), poolModuleAcc, globaltypes.Denom).Amount.Uint64() + Expect(fundersBalance).To(Equal(0 * i.KYVE)) + Expect(poolBalance).To(Equal(150 * i.KYVE)) }) - It("Charge more than pool has funds", func() { + It("Charge funder with less funds than amount_per_bundle", func() { // ARRANGE - for k := 0; k < 50; k++ { - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.DUMMY[k], - Id: 0, - Amount: 50 * i.KYVE, - }) - } - pool, poolFound := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(poolFound).To(BeTrue()) - Expect(pool.TotalFunds).To(Equal((50 * 50) * i.KYVE)) + funding, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + funding.AmountPerBundle = 105 * i.KYVE + s.App().FundersKeeper.SetFunding(s.Ctx(), &funding) // ACT - payout, err := chargeFunders(s, 5000*i.KYVE) - - // ASSERT + payout, err := s.App().FundersKeeper.ChargeFundersOfPool(s.Ctx(), 0) Expect(err).NotTo(HaveOccurred()) - Expect(payout).To(Equal(2500 * i.KYVE)) + Expect(payout).To(Equal(110 * i.KYVE)) - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(0)) + // ASSERT + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.TotalAmount).To(Equal(40 * i.KYVE)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) + Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.BOB)) + + fundersBalance := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAcc, globaltypes.Denom).Amount.Uint64() + poolBalance := s.App().BankKeeper.GetBalance(s.Ctx(), poolModuleAcc, globaltypes.Denom).Amount.Uint64() + Expect(fundersBalance).To(Equal(40 * i.KYVE)) + Expect(poolBalance).To(Equal(110 * i.KYVE)) }) - It("Charge pool which has no funds at all", func() { + It("Charge without fundings", func() { // ARRANGE - pool, poolFound := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(poolFound).To(BeTrue()) - Expect(pool.TotalFunds).To(BeZero()) + s.RunTxFundersSuccess(&funderstypes.MsgDefundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + }) + s.RunTxFundersSuccess(&funderstypes.MsgDefundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 50 * i.KYVE, + }) // ACT - payout, err := chargeFunders(s, 5000*i.KYVE) + payout, err := s.App().FundersKeeper.ChargeFundersOfPool(s.Ctx(), 0) // ASSERT Expect(err).NotTo(HaveOccurred()) - Expect(payout).To(BeZero()) - - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(0)) - Expect(pool.TotalFunds).To(BeZero()) + Expect(payout).To(Equal(0 * i.KYVE)) + fundersBalance := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAcc, globaltypes.Denom).Amount.Uint64() + poolBalance := s.App().BankKeeper.GetBalance(s.Ctx(), poolModuleAcc, globaltypes.Denom).Amount.Uint64() + Expect(fundersBalance).To(Equal(0 * i.KYVE)) + Expect(poolBalance).To(Equal(0 * i.KYVE)) }) }) From c2c54f284a1701ae6e30327a6b8902ac7de02590 Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 3 Oct 2023 11:25:53 +0200 Subject: [PATCH 045/109] fix: VerifyFundersModuleIntegrity --- testutil/integration/checks.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/testutil/integration/checks.go b/testutil/integration/checks.go index 0d62b590..ff296672 100644 --- a/testutil/integration/checks.go +++ b/testutil/integration/checks.go @@ -431,24 +431,20 @@ func (suite *KeeperTestSuite) VerifyFundersGenesisImportExport() { func (suite *KeeperTestSuite) VerifyFundersModuleIntegrity() { funderAddresses := make(map[string]bool) - activeFunderAddresses := make(map[string]bool) for _, funder := range suite.App().FundersKeeper.GetAllFunders(suite.Ctx()) { - funderAddresses[funder.Address] = false + funderAddresses[funder.Address] = true } + allActiveFundings := make(map[string]bool) for _, funding := range suite.App().FundersKeeper.GetAllFundings(suite.Ctx()) { // check if funding has a valid funder _, found := funderAddresses[funding.FunderAddress] Expect(found).To(BeTrue()) - // check if the funder has already funded (should not be the case) - Expect(funderAddresses[funding.FunderAddress]).To(BeFalse()) - - funderAddresses[funding.FunderAddress] = true - // check if funding is active if funding.Amount > 0 { - activeFunderAddresses[funding.FunderAddress] = true + key := string(funderstypes.FundingKeyByFunder(funding.FunderAddress, funding.PoolId)) + allActiveFundings[key] = true } // check if pool exists @@ -460,7 +456,8 @@ func (suite *KeeperTestSuite) VerifyFundersModuleIntegrity() { fsActiveAddresses := make(map[string]bool) for _, funderAddress := range fundingState.ActiveFunderAddresses { // check if funding has a valid funder - _, found := activeFunderAddresses[funderAddress] + key := string(funderstypes.FundingKeyByFunder(funderAddress, fundingState.PoolId)) + _, found := allActiveFundings[key] Expect(found).To(BeTrue()) // check if funder is not already in the list From 6c1d5f747c0cc723e98829e88f2b22edd08da2dc Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 3 Oct 2023 12:04:42 +0200 Subject: [PATCH 046/109] fix: keeper tests in x/bundles --- .../keeper_suite_dropped_bundles_test.go | 51 ++- .../keeper_suite_funding_bundles_test.go | 352 +++++++----------- .../keeper_suite_inflation_splitting_test.go | 297 +++++++++------ .../keeper_suite_invalid_bundles_test.go | 68 ++-- x/bundles/keeper/keeper_suite_points_test.go | 44 ++- .../keeper/keeper_suite_stakers_leave_test.go | 55 ++- .../keeper/keeper_suite_valid_bundles_test.go | 140 +++---- .../keeper_suite_zero_delegation_test.go | 83 +++-- 8 files changed, 573 insertions(+), 517 deletions(-) diff --git a/x/bundles/keeper/keeper_suite_dropped_bundles_test.go b/x/bundles/keeper/keeper_suite_dropped_bundles_test.go index f59064dd..4534bd54 100644 --- a/x/bundles/keeper/keeper_suite_dropped_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_dropped_bundles_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + funderstypes "github.com/KYVENetwork/chain/x/funders/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -32,24 +33,35 @@ var _ = Describe("dropped bundles", Ordered, func() { s = i.NewCleanChain() // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10_000, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxFundersSuccess(msg) + + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.ALICE, + Moniker: "Alice", }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ @@ -178,7 +190,10 @@ var _ = Describe("dropped bundles", Ordered, func() { // check pool funds pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100 * i.KYVE)) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + + // assert total pool funds + Expect(fundingState.TotalAmount).To(Equal(100 * i.KYVE)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) }) diff --git a/x/bundles/keeper/keeper_suite_funding_bundles_test.go b/x/bundles/keeper/keeper_suite_funding_bundles_test.go index 36f10c8a..53bfb4ae 100644 --- a/x/bundles/keeper/keeper_suite_funding_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_funding_bundles_test.go @@ -3,9 +3,9 @@ package keeper_test import ( i "github.com/KYVENetwork/chain/testutil/integration" bundletypes "github.com/KYVENetwork/chain/x/bundles/types" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" - sdk "github.com/cosmos/cosmos-sdk/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) @@ -17,10 +17,8 @@ TEST CASES - funding bundles * Produce a valid bundle with only one funder * Produce a valid bundle with multiple funders and same funding amounts * Produce a valid bundle with multiple funders and different funding amounts -* Produce a valid bundle with multiple funders and different funding amounts where not everyone can afford the funds -* Produce a valid bundle although the only funder can not pay for the bundle reward -* Produce a valid bundle although multiple funders with same amount can not pay for the bundle reward -* Produce a valid bundle although multiple funders with different amount can not pay for the bundle reward +* Produce a valid bundle with multiple funders and different funding amounts where not everyone can afford the full funds +* Produce a valid bundle although the only funder can not pay the full bundle reward * Produce a valid bundle although there are no funders at all */ @@ -36,18 +34,33 @@ var _ = Describe("funding bundles", Ordered, func() { s = i.NewCleanChain() // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10_000, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) + + // create funders + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.ALICE, + Moniker: "Alice", + }) + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.BOB, + Moniker: "Bob", }) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ @@ -68,10 +81,11 @@ var _ = Describe("funding bundles", Ordered, func() { It("Produce a valid bundle with only one funder", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 10 * i.KYVE, }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ @@ -120,14 +134,17 @@ var _ = Describe("funding bundles", Ordered, func() { Expect(pool.TotalBundles).To(Equal(uint64(1))) Expect(pool.CurrentKey).To(Equal("99")) - totalReward := pool.OperatingCost + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(pool.TotalFunds).To(Equal(100*i.KYVE - totalReward)) - Expect(pool.Funders).To(HaveLen(1)) + Expect(fundingState.TotalAmount).To(Equal(90 * i.KYVE)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) + + funding, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) // assert individual funds - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100*i.KYVE - totalReward)) + Expect(funding.Amount).To(Equal(90 * i.KYVE)) + Expect(funding.TotalFunded).To(Equal(10 * i.KYVE)) // assert individual balances balanceAlice := s.GetBalanceFromAddress(i.ALICE) @@ -136,16 +153,18 @@ var _ = Describe("funding bundles", Ordered, func() { It("Produce a valid bundle with multiple funders and same funding amounts", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 10 * i.KYVE, }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 10 * i.KYVE, }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ @@ -194,18 +213,20 @@ var _ = Describe("funding bundles", Ordered, func() { Expect(pool.TotalBundles).To(Equal(uint64(1))) Expect(pool.CurrentKey).To(Equal("99")) - totalReward := pool.OperatingCost + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(pool.TotalFunds).To(Equal(200*i.KYVE - totalReward)) - Expect(pool.Funders).To(HaveLen(2)) + Expect(fundingState.TotalAmount).To(Equal(180 * i.KYVE)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(2)) - // assert individual funds - fundersCharge := uint64(sdk.NewDec(int64(totalReward)).Quo(sdk.NewDec(2)).TruncateInt64()) - - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100*i.KYVE - fundersCharge)) + fundingAlice, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + fundingBob, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.BOB, 0) - Expect(pool.GetFunderAmount(i.BOB)).To(Equal(100*i.KYVE - fundersCharge)) + // assert individual funds + Expect(fundingAlice.Amount).To(Equal(90 * i.KYVE)) + Expect(fundingAlice.TotalFunded).To(Equal(10 * i.KYVE)) + Expect(fundingBob.Amount).To(Equal(90 * i.KYVE)) + Expect(fundingBob.TotalFunded).To(Equal(10 * i.KYVE)) // assert individual balances balanceAlice := s.GetBalanceFromAddress(i.ALICE) @@ -217,16 +238,18 @@ var _ = Describe("funding bundles", Ordered, func() { It("Produce a valid bundle with multiple funders and different funding amounts", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 150 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 150 * i.KYVE, + AmountPerBundle: 15 * i.KYVE, }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 50 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 50 * i.KYVE, + AmountPerBundle: 5 * i.KYVE, }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ @@ -275,18 +298,20 @@ var _ = Describe("funding bundles", Ordered, func() { Expect(pool.TotalBundles).To(Equal(uint64(1))) Expect(pool.CurrentKey).To(Equal("99")) - totalReward := pool.OperatingCost + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(pool.TotalFunds).To(Equal(200*i.KYVE - totalReward)) - Expect(pool.Funders).To(HaveLen(2)) + Expect(fundingState.TotalAmount).To(Equal(180 * i.KYVE)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(2)) - // assert individual funds - fundersCharge := uint64(sdk.NewDec(int64(totalReward)).Quo(sdk.NewDec(2)).TruncateInt64()) - - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(150*i.KYVE - fundersCharge)) + fundingAlice, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + fundingBob, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.BOB, 0) - Expect(pool.GetFunderAmount(i.BOB)).To(Equal(50*i.KYVE - fundersCharge)) + // assert individual funds + Expect(fundingAlice.Amount).To(Equal(135 * i.KYVE)) + Expect(fundingAlice.TotalFunded).To(Equal(15 * i.KYVE)) + Expect(fundingBob.Amount).To(Equal(45 * i.KYVE)) + Expect(fundingBob.TotalFunded).To(Equal(5 * i.KYVE)) // assert individual balances balanceAlice := s.GetBalanceFromAddress(i.ALICE) @@ -296,18 +321,20 @@ var _ = Describe("funding bundles", Ordered, func() { Expect(balanceBob).To(Equal(initialBalanceBob - 50*i.KYVE)) }) - It("Produce a valid bundle with multiple funders and different funding amounts where not everyone can afford the funds", func() { + It("Produce a valid bundle with multiple funders and different funding amounts where not everyone can afford the full funds", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 10, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 10 * i.KYVE, + AmountPerBundle: 50 * i.KYVE, }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 50 * i.KYVE, }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ @@ -356,28 +383,37 @@ var _ = Describe("funding bundles", Ordered, func() { Expect(pool.TotalBundles).To(Equal(uint64(1))) Expect(pool.CurrentKey).To(Equal("99")) - totalReward := pool.OperatingCost + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(pool.TotalFunds).To(Equal(100*i.KYVE - (totalReward / 2))) - Expect(pool.Funders).To(HaveLen(1)) + Expect(fundingState.TotalAmount).To(Equal(50 * i.KYVE)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) + Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.BOB)) - Expect(pool.GetFunderAmount(i.BOB)).To(Equal(100*i.KYVE - (totalReward / 2))) + fundingAlice, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + fundingBob, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.BOB, 0) + + // assert individual funds + Expect(fundingAlice.Amount).To(Equal(0 * i.KYVE)) + Expect(fundingAlice.TotalFunded).To(Equal(10 * i.KYVE)) + Expect(fundingBob.Amount).To(Equal(50 * i.KYVE)) + Expect(fundingBob.TotalFunded).To(Equal(50 * i.KYVE)) // assert individual balances balanceAlice := s.GetBalanceFromAddress(i.ALICE) - Expect(balanceAlice).To(Equal(initialBalanceAlice - 10)) + Expect(balanceAlice).To(Equal(initialBalanceAlice - 10*i.KYVE)) balanceBob := s.GetBalanceFromAddress(i.BOB) Expect(balanceBob).To(Equal(initialBalanceBob - 100*i.KYVE)) }) - It("Produce a valid bundle although the only funder can not pay for the bundle reward", func() { + It("Produce a valid bundle although the only funder can not pay the full bundle reward", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 10, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 10 * i.KYVE, + AmountPerBundle: 20 * i.KYVE, }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ @@ -426,157 +462,21 @@ var _ = Describe("funding bundles", Ordered, func() { Expect(pool.TotalBundles).To(Equal(uint64(1))) Expect(pool.CurrentKey).To(Equal("99")) - // assert total pool funds - Expect(pool.TotalFunds).To(BeZero()) - Expect(pool.Funders).To(BeEmpty()) - - // assert individual balances - balanceAlice := s.GetBalanceFromAddress(i.ALICE) - Expect(balanceAlice).To(Equal(initialBalanceAlice - 10)) - }) - - It("Produce a valid bundle although multiple funders with same amount can not pay for the bundle reward", func() { - // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 10, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 10, - }) - - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0, - Staker: i.STAKER_0, - PoolId: 0, - }) - - s.CommitAfterSeconds(60) - - s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0, - Staker: i.STAKER_0, - PoolId: 0, - StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", - DataSize: 100, - DataHash: "test_hash", - FromIndex: 0, - BundleSize: 100, - FromKey: "0", - ToKey: "99", - BundleSummary: "test_value", - }) - - s.CommitAfterSeconds(60) - - // ACT - s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0, - Staker: i.STAKER_0, - PoolId: 0, - StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", - DataSize: 100, - DataHash: "test_hash2", - FromIndex: 100, - BundleSize: 100, - FromKey: "100", - ToKey: "199", - BundleSummary: "test_value2", - }) - - // ASSERT - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - - // assert if bundle go finalized - Expect(pool.TotalBundles).To(Equal(uint64(1))) - Expect(pool.CurrentKey).To(Equal("99")) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(pool.TotalFunds).To(BeZero()) - Expect(pool.Funders).To(BeEmpty()) + Expect(fundingState.TotalAmount).To(Equal(0 * i.KYVE)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(0)) - // assert individual balances - balanceAlice := s.GetBalanceFromAddress(i.ALICE) - Expect(balanceAlice).To(Equal(initialBalanceAlice - 10)) + fundingAlice, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) - balanceBob := s.GetBalanceFromAddress(i.BOB) - Expect(balanceBob).To(Equal(initialBalanceBob - 10)) - }) - - It("Produce a dropped bundle because multiple funders with different amount can not pay for the bundle reward", func() { - // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 10, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 20, - }) - - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ - Creator: i.VALADDRESS_0, - Staker: i.STAKER_0, - PoolId: 0, - }) - - s.CommitAfterSeconds(60) - - s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0, - Staker: i.STAKER_0, - PoolId: 0, - StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", - DataSize: 100, - DataHash: "test_hash", - FromIndex: 0, - BundleSize: 100, - FromKey: "0", - ToKey: "99", - BundleSummary: "test_value", - }) - - s.CommitAfterSeconds(60) - - // ACT - s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0, - Staker: i.STAKER_0, - PoolId: 0, - StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", - DataSize: 100, - DataHash: "test_hash2", - FromIndex: 100, - BundleSize: 100, - FromKey: "100", - ToKey: "199", - BundleSummary: "test_value2", - }) - - // ASSERT - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - - // assert if bundle go finalized - Expect(pool.TotalBundles).To(Equal(uint64(1))) - Expect(pool.CurrentKey).To(Equal("99")) - - // assert total pool funds - Expect(pool.TotalFunds).To(BeZero()) - Expect(pool.Funders).To(BeEmpty()) + // assert individual funds + Expect(fundingAlice.Amount).To(Equal(0 * i.KYVE)) + Expect(fundingAlice.TotalFunded).To(Equal(10 * i.KYVE)) // assert individual balances balanceAlice := s.GetBalanceFromAddress(i.ALICE) - Expect(balanceAlice).To(Equal(initialBalanceAlice - 10)) - - balanceBob := s.GetBalanceFromAddress(i.BOB) - Expect(balanceBob).To(Equal(initialBalanceBob - 20)) + Expect(balanceAlice).To(Equal(initialBalanceAlice - 10*i.KYVE)) }) It("Produce a valid bundle although there are no funders at all", func() { @@ -605,9 +505,11 @@ var _ = Describe("funding bundles", Ordered, func() { pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + // assert total pool funds - Expect(pool.TotalFunds).To(BeZero()) - Expect(pool.Funders).To(BeEmpty()) + Expect(fundingState.TotalAmount).To(Equal(0 * i.KYVE)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(0)) s.CommitAfterSeconds(60) @@ -633,8 +535,10 @@ var _ = Describe("funding bundles", Ordered, func() { Expect(pool.TotalBundles).To(Equal(uint64(1))) Expect(pool.CurrentKey).To(Equal("99")) + fundingState, _ = s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + // assert total pool funds - Expect(pool.TotalFunds).To(BeZero()) - Expect(pool.Funders).To(BeEmpty()) + Expect(fundingState.TotalAmount).To(Equal(0 * i.KYVE)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(0)) }) }) diff --git a/x/bundles/keeper/keeper_suite_inflation_splitting_test.go b/x/bundles/keeper/keeper_suite_inflation_splitting_test.go index 500aa90a..17250358 100644 --- a/x/bundles/keeper/keeper_suite_inflation_splitting_test.go +++ b/x/bundles/keeper/keeper_suite_inflation_splitting_test.go @@ -3,6 +3,7 @@ package keeper_test import ( i "github.com/KYVENetwork/chain/testutil/integration" bundletypes "github.com/KYVENetwork/chain/x/bundles/types" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -40,18 +41,38 @@ var _ = Describe("inflation splitting", Ordered, func() { s = i.NewCleanChain() // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10_000, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) + + params := s.App().FundersKeeper.GetParams(s.Ctx()) + params.MinFundingAmountPerBundle = 1_000 + params.MinFundingAmount = 100 + s.App().FundersKeeper.SetParams(s.Ctx(), params) + + // create funders + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.ALICE, + Moniker: "Alice", + }) + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.BOB, + Moniker: "Bob", }) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ @@ -143,9 +164,11 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(BeZero()) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + // assert total pool funds - Expect(pool.TotalFunds).To(BeZero()) - Expect(pool.Funders).To(BeEmpty()) + Expect(fundingState.TotalAmount).To(BeZero()) + Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) }) It("Produce a valid bundle with no funders and 10% inflation splitting", func() { @@ -226,9 +249,11 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + // assert total pool funds - Expect(pool.TotalFunds).To(BeZero()) - Expect(pool.Funders).To(BeEmpty()) + Expect(fundingState.TotalAmount).To(BeZero()) + Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) }) It("Produce a valid bundle with no funders and 100% inflation splitting", func() { @@ -309,9 +334,11 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + // assert total pool funds - Expect(pool.TotalFunds).To(BeZero()) - Expect(pool.Funders).To(BeEmpty()) + Expect(fundingState.TotalAmount).To(BeZero()) + Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) }) It("Produce a valid bundle with sufficient funders and 0% inflation splitting", func() { @@ -326,16 +353,18 @@ var _ = Describe("inflation splitting", Ordered, func() { s.Commit() } - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 5_000, }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 5_000, }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -386,9 +415,9 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert bundle reward uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) - // the total payout is the operating cost because the funding is sufficient + // the total payout is the inflation share weight because the funding is sufficient // and there is no additional inflation - totalPayout := pool.OperatingCost + totalPayout := pool.InflationShareWeight networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) treasuryReward := uint64(sdk.NewDec(int64(totalPayout)).Mul(networkFee).TruncateInt64()) @@ -403,9 +432,11 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + // assert total pool funds - Expect(pool.TotalFunds).To(Equal(200*i.KYVE - totalPayout)) - Expect(pool.Funders).To(HaveLen(2)) + Expect(fundingState.TotalAmount).To(Equal(200*i.KYVE - 10_000)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(2)) }) It("Produce a valid bundle with sufficient funders and 10% inflation splitting", func() { @@ -420,16 +451,18 @@ var _ = Describe("inflation splitting", Ordered, func() { s.Commit() } - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 5_000, }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 5_000, }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -483,7 +516,7 @@ var _ = Describe("inflation splitting", Ordered, func() { uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) // the total payout is the operating cost plus the inflation payout - totalPayout := pool.OperatingCost + payout + totalPayout := pool.InflationShareWeight + payout networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) treasuryReward := uint64(sdk.NewDec(int64(totalPayout)).Mul(networkFee).TruncateInt64()) @@ -498,9 +531,11 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + // assert total pool funds - Expect(pool.TotalFunds).To(Equal(200*i.KYVE - pool.OperatingCost)) - Expect(pool.Funders).To(HaveLen(2)) + Expect(fundingState.TotalAmount).To(Equal(200*i.KYVE - 10_000)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(2)) }) It("Produce a valid bundle with sufficient funders and 100% inflation splitting", func() { @@ -515,16 +550,18 @@ var _ = Describe("inflation splitting", Ordered, func() { s.Commit() } - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 5_000, }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 5_000, }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -578,7 +615,7 @@ var _ = Describe("inflation splitting", Ordered, func() { uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) // the total payout is the operating cost plus the inflation payout - totalPayout := pool.OperatingCost + payout + totalPayout := pool.InflationShareWeight + payout networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) treasuryReward := uint64(sdk.NewDec(int64(totalPayout)).Mul(networkFee).TruncateInt64()) @@ -593,9 +630,11 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + // assert total pool funds - Expect(pool.TotalFunds).To(Equal(200*i.KYVE - pool.OperatingCost)) - Expect(pool.Funders).To(HaveLen(2)) + Expect(fundingState.TotalAmount).To(Equal(200*i.KYVE - 10_000)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(2)) }) It("Produce a valid bundle with insufficient funders and 0% inflation splitting", func() { @@ -610,16 +649,18 @@ var _ = Describe("inflation splitting", Ordered, func() { s.Commit() } - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100, + AmountPerBundle: 5_000, }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 200, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 200, + AmountPerBundle: 5_000, }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -686,12 +727,14 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + // assert total pool funds - Expect(pool.TotalFunds).To(BeZero()) - Expect(pool.Funders).To(BeEmpty()) + Expect(fundingState.TotalAmount).To(BeZero()) + Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) }) - It("Produce a valid bundle with insufficient funders and 10% inflation splitting", func() { + It("Produce a valid bundle with insufficient funders and 30% inflation splitting", func() { // ARRANGE s.App().PoolKeeper.SetParams(s.Ctx(), pooltypes.Params{ ProtocolInflationShare: sdk.MustNewDecFromStr("0.1"), @@ -703,16 +746,18 @@ var _ = Describe("inflation splitting", Ordered, func() { s.Commit() } - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100, + AmountPerBundle: 5_000, }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 200, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 200, + AmountPerBundle: 5_000, }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -781,9 +826,11 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + // assert total pool funds - Expect(pool.TotalFunds).To(BeZero()) - Expect(pool.Funders).To(BeEmpty()) + Expect(fundingState.TotalAmount).To(BeZero()) + Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) }) It("Produce a valid bundle with insufficient funders and 10% inflation splitting", func() { @@ -798,16 +845,18 @@ var _ = Describe("inflation splitting", Ordered, func() { s.Commit() } - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100, + AmountPerBundle: 5_000, }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 200, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 200, + AmountPerBundle: 5_000, }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -876,9 +925,11 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + // assert total pool funds - Expect(pool.TotalFunds).To(BeZero()) - Expect(pool.Funders).To(BeEmpty()) + Expect(fundingState.TotalAmount).To(BeZero()) + Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) }) It("Produce a valid bundle with some insufficient funders and 0% inflation splitting", func() { @@ -893,16 +944,18 @@ var _ = Describe("inflation splitting", Ordered, func() { s.Commit() } - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 5_000, }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 200, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 200, + AmountPerBundle: 5_000, }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -954,7 +1007,7 @@ var _ = Describe("inflation splitting", Ordered, func() { uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) // the total payout is the total funds - totalPayout := (pool.OperatingCost / 2) + 200 + totalPayout := (pool.InflationShareWeight / 2) + 200 networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) treasuryReward := uint64(sdk.NewDec(int64(totalPayout)).Mul(networkFee).TruncateInt64()) @@ -969,12 +1022,14 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + // assert total pool funds - Expect(pool.TotalFunds).To(Equal(100*i.KYVE - (pool.OperatingCost / 2))) - Expect(pool.Funders).To(HaveLen(1)) + Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 5_000)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) - It("Produce a valid bundle with some insufficient funders and 10% inflation splitting", func() { + It("Produce a valid bundle with some insufficient funders and 30% inflation splitting", func() { // ARRANGE s.App().PoolKeeper.SetParams(s.Ctx(), pooltypes.Params{ ProtocolInflationShare: sdk.MustNewDecFromStr("0.1"), @@ -986,16 +1041,18 @@ var _ = Describe("inflation splitting", Ordered, func() { s.Commit() } - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 5_000, }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 200, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 200, + AmountPerBundle: 5_000, }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -1049,7 +1106,7 @@ var _ = Describe("inflation splitting", Ordered, func() { uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) // the total payout is the operating cost plus the inflation payout - totalPayout := (pool.OperatingCost / 2) + 200 + payout + totalPayout := (pool.InflationShareWeight / 2) + 200 + payout networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) treasuryReward := uint64(sdk.NewDec(int64(totalPayout)).Mul(networkFee).TruncateInt64()) @@ -1064,9 +1121,11 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + // assert total pool funds - Expect(pool.TotalFunds).To(Equal(100*i.KYVE - (pool.OperatingCost / 2))) - Expect(pool.Funders).To(HaveLen(1)) + Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 5_000)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) It("Produce a valid bundle with some insufficient funders and 10% inflation splitting", func() { @@ -1081,16 +1140,18 @@ var _ = Describe("inflation splitting", Ordered, func() { s.Commit() } - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 5_000, }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 200, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 200, + AmountPerBundle: 5_000, }) s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -1144,7 +1205,7 @@ var _ = Describe("inflation splitting", Ordered, func() { uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) // the total payout is the operating cost plus the inflation payout - totalPayout := (pool.OperatingCost / 2) + 200 + payout + totalPayout := (pool.InflationShareWeight / 2) + 200 + payout networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) treasuryReward := uint64(sdk.NewDec(int64(totalPayout)).Mul(networkFee).TruncateInt64()) @@ -1159,8 +1220,10 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + // assert total pool funds - Expect(pool.TotalFunds).To(Equal(100*i.KYVE - (pool.OperatingCost / 2))) - Expect(pool.Funders).To(HaveLen(1)) + Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 5_000)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) }) diff --git a/x/bundles/keeper/keeper_suite_invalid_bundles_test.go b/x/bundles/keeper/keeper_suite_invalid_bundles_test.go index 8dfc69c4..50c2398f 100644 --- a/x/bundles/keeper/keeper_suite_invalid_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_invalid_bundles_test.go @@ -7,6 +7,7 @@ import ( i "github.com/KYVENetwork/chain/testutil/integration" bundletypes "github.com/KYVENetwork/chain/x/bundles/types" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -39,24 +40,35 @@ var _ = Describe("invalid bundles", Ordered, func() { s = i.NewCleanChain() // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10_000, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) + + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.ALICE, + Moniker: "Alice", }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ @@ -214,11 +226,11 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(balanceVoter).To(Equal(initialBalanceStaker1)) Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.STAKER_1)).To(BeZero()) - // check pool funds - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100 * i.KYVE)) + // assert total pool funds + Expect(fundingState.TotalAmount).To(Equal(100 * i.KYVE)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) It("Produce an invalid bundle with multiple validators and foreign delegations", func() { @@ -359,11 +371,11 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.STAKER_1)).To(BeZero()) Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.BOB)).To(BeZero()) - // check pool funds - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100 * i.KYVE)) + // assert total pool funds + Expect(fundingState.TotalAmount).To(Equal(100 * i.KYVE)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) It("Produce an invalid bundle with multiple validators although some voted valid", func() { @@ -551,10 +563,10 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_2, i.STAKER_2)).To(BeZero()) Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_2, i.CHARLIE)).To(BeZero()) - // check pool funds - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100 * i.KYVE)) + // assert total pool funds + Expect(fundingState.TotalAmount).To(Equal(100 * i.KYVE)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) }) diff --git a/x/bundles/keeper/keeper_suite_points_test.go b/x/bundles/keeper/keeper_suite_points_test.go index 0fe53c3f..2f3998d2 100644 --- a/x/bundles/keeper/keeper_suite_points_test.go +++ b/x/bundles/keeper/keeper_suite_points_test.go @@ -3,6 +3,7 @@ package keeper_test import ( i "github.com/KYVENetwork/chain/testutil/integration" bundletypes "github.com/KYVENetwork/chain/x/bundles/types" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -33,24 +34,35 @@ var _ = Describe("points", Ordered, func() { s = i.NewCleanChain() // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10_000, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + Moniker: "Alice", + }) + + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ diff --git a/x/bundles/keeper/keeper_suite_stakers_leave_test.go b/x/bundles/keeper/keeper_suite_stakers_leave_test.go index 6250d77f..926d56ad 100644 --- a/x/bundles/keeper/keeper_suite_stakers_leave_test.go +++ b/x/bundles/keeper/keeper_suite_stakers_leave_test.go @@ -3,6 +3,7 @@ package keeper_test import ( i "github.com/KYVENetwork/chain/testutil/integration" bundletypes "github.com/KYVENetwork/chain/x/bundles/types" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -39,25 +40,41 @@ var _ = Describe("stakers leave", Ordered, func() { // init new clean chain s = i.NewCleanChain() - // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10_000, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + //create clean pool for every test case + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 0 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ + // create funders + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + Moniker: "Alice", + }) + + params := s.App().FundersKeeper.GetParams(s.Ctx()) + params.MinFundingAmountPerBundle = 10_000 + s.App().FundersKeeper.SetParams(s.Ctx(), params) + + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 10_000, }) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ @@ -219,9 +236,9 @@ var _ = Describe("stakers leave", Ordered, func() { // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(sdk.NewDec(int64(pool.OperatingCost)).Mul(networkFee).TruncateInt64()) + treasuryReward := uint64(sdk.NewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.OperatingCost - treasuryReward - storageReward + totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward diff --git a/x/bundles/keeper/keeper_suite_valid_bundles_test.go b/x/bundles/keeper/keeper_suite_valid_bundles_test.go index 007f40ca..8fa1bd49 100644 --- a/x/bundles/keeper/keeper_suite_valid_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_valid_bundles_test.go @@ -1,12 +1,13 @@ package keeper_test import ( + delegationtypes "github.com/KYVENetwork/chain/x/delegation/types" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" i "github.com/KYVENetwork/chain/testutil/integration" bundletypes "github.com/KYVENetwork/chain/x/bundles/types" - delegationtypes "github.com/KYVENetwork/chain/x/delegation/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -35,29 +36,45 @@ var _ = Describe("valid bundles", Ordered, func() { initialBalanceStaker1 := s.GetBalanceFromAddress(i.STAKER_1) initialBalanceValaddress1 := s.GetBalanceFromAddress(i.VALADDRESS_1) + amountPerBundle := uint64(10_000) + BeforeEach(func() { // init new clean chain s = i.NewCleanChain() - // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10_000, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, + //create clean pool for every test case + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 0 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) + + // create funders + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.ALICE, + Moniker: "Alice", }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + params := s.App().FundersKeeper.GetParams(s.Ctx()) + params.MinFundingAmountPerBundle = amountPerBundle + s.App().FundersKeeper.SetParams(s.Ctx(), params) + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + Amount: 100 * i.KYVE, + AmountPerBundle: amountPerBundle, }) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ @@ -181,9 +198,9 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(sdk.NewDec(int64(pool.OperatingCost)).Mul(networkFee).TruncateInt64()) + treasuryReward := uint64(sdk.NewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.OperatingCost - treasuryReward - storageReward + totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward @@ -195,11 +212,11 @@ var _ = Describe("valid bundles", Ordered, func() { // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) - // check pool funds - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100*i.KYVE - pool.OperatingCost)) + // assert total pool funds + Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 1*amountPerBundle)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) It("Produce a valid bundle with one validator and foreign delegations", func() { @@ -299,9 +316,9 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(sdk.NewDec(int64(pool.OperatingCost)).Mul(networkFee).TruncateInt64()) + treasuryReward := uint64(sdk.NewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.OperatingCost - treasuryReward - storageReward + totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) totalDelegationReward := totalUploaderReward - uploaderPayoutReward @@ -319,11 +336,11 @@ var _ = Describe("valid bundles", Ordered, func() { // assert delegator delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.ALICE)).To(Equal(delegatorDelegationReward)) - // check pool funds - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100*i.KYVE - pool.OperatingCost)) + // assert total pool funds + Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 1*amountPerBundle)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) It("Produce a valid bundle with multiple validators and no foreign delegations", func() { @@ -450,9 +467,9 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(sdk.NewDec(int64(pool.OperatingCost)).Mul(networkFee).TruncateInt64()) + treasuryReward := uint64(sdk.NewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.OperatingCost - treasuryReward - storageReward + totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward @@ -464,11 +481,11 @@ var _ = Describe("valid bundles", Ordered, func() { // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) - // check pool funds - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100*i.KYVE - pool.OperatingCost)) + // assert total pool funds + Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 1*amountPerBundle)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) It("Produce a valid bundle with one validator and foreign delegations", func() { @@ -606,9 +623,9 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(sdk.NewDec(int64(pool.OperatingCost)).Mul(networkFee).TruncateInt64()) + treasuryReward := uint64(sdk.NewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.OperatingCost - treasuryReward - storageReward + totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) totalDelegationReward := totalUploaderReward - uploaderPayoutReward @@ -636,11 +653,11 @@ var _ = Describe("valid bundles", Ordered, func() { // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) - // check pool funds - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100*i.KYVE - pool.OperatingCost)) + // assert total pool funds + Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 1*amountPerBundle)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) It("Produce a valid bundle with multiple validators and foreign delegation although some did not vote at all", func() { @@ -768,12 +785,11 @@ var _ = Describe("valid bundles", Ordered, func() { balanceVoter := s.GetBalanceFromAddress(valaccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) - // calculate uploader rewards // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(sdk.NewDec(int64(pool.OperatingCost)).Mul(networkFee).TruncateInt64()) + treasuryReward := uint64(sdk.NewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.OperatingCost - treasuryReward - storageReward + totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) totalDelegationReward := totalUploaderReward - uploaderPayoutReward @@ -794,11 +810,11 @@ var _ = Describe("valid bundles", Ordered, func() { // check voter rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.BOB)).To(BeZero()) - // check pool funds - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100*i.KYVE - pool.OperatingCost)) + // assert total pool funds + Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 1*amountPerBundle)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) It("Produce a valid bundle with multiple validators and foreign delegation although some voted abstain", func() { @@ -934,12 +950,11 @@ var _ = Describe("valid bundles", Ordered, func() { balanceVoter := s.GetBalanceFromAddress(valaccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) - // calculate uploader rewards // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(sdk.NewDec(int64(pool.OperatingCost)).Mul(networkFee).TruncateInt64()) + treasuryReward := uint64(sdk.NewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.OperatingCost - treasuryReward - storageReward + totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) totalDelegationReward := totalUploaderReward - uploaderPayoutReward @@ -960,11 +975,11 @@ var _ = Describe("valid bundles", Ordered, func() { // check voter rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.BOB)).To(BeZero()) - // check pool funds - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100*i.KYVE - pool.OperatingCost)) + // assert total pool funds + Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 1*amountPerBundle)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) It("Produce a valid bundle with multiple validators and foreign delegation although some voted invalid", func() { @@ -1110,12 +1125,11 @@ var _ = Describe("valid bundles", Ordered, func() { balanceVoter := s.GetBalanceFromAddress(i.STAKER_1) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) - // calculate uploader rewards // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(sdk.NewDec(int64(pool.OperatingCost)).Mul(networkFee).TruncateInt64()) + treasuryReward := uint64(sdk.NewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.OperatingCost - treasuryReward - storageReward + totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) totalDelegationReward := totalUploaderReward - uploaderPayoutReward @@ -1136,10 +1150,10 @@ var _ = Describe("valid bundles", Ordered, func() { // check voter rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.BOB)).To(BeZero()) - // check pool funds - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100*i.KYVE - pool.OperatingCost)) + // assert total pool funds + Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 1*amountPerBundle)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) }) diff --git a/x/bundles/keeper/keeper_suite_zero_delegation_test.go b/x/bundles/keeper/keeper_suite_zero_delegation_test.go index 79504765..633392ab 100644 --- a/x/bundles/keeper/keeper_suite_zero_delegation_test.go +++ b/x/bundles/keeper/keeper_suite_zero_delegation_test.go @@ -3,6 +3,7 @@ package keeper_test import ( i "github.com/KYVENetwork/chain/testutil/integration" bundletypes "github.com/KYVENetwork/chain/x/bundles/types" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -32,29 +33,47 @@ var _ = Describe("zero delegation", Ordered, func() { initialBalanceStaker1 := s.GetBalanceFromAddress(i.STAKER_1) initialBalanceValaddress1 := s.GetBalanceFromAddress(i.VALADDRESS_1) + amountPerBundle := uint64(10_000) + BeforeEach(func() { // init new clean chain s = i.NewCleanChain() - // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10_000, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ + //create clean pool for every test case + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 0 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) + + params := s.App().FundersKeeper.GetParams(s.Ctx()) + params.MinFundingAmountPerBundle = amountPerBundle + s.App().FundersKeeper.SetParams(s.Ctx(), params) + + // create funders + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + Moniker: "Alice", + }) + + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: amountPerBundle, }) s.CommitAfterSeconds(60) @@ -385,9 +404,9 @@ var _ = Describe("zero delegation", Ordered, func() { // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(sdk.NewDec(int64(pool.OperatingCost)).Mul(networkFee).TruncateInt64()) + treasuryReward := uint64(sdk.NewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.OperatingCost - treasuryReward - storageReward + totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) @@ -398,11 +417,11 @@ var _ = Describe("zero delegation", Ordered, func() { // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(BeZero()) - // check pool funds - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100*i.KYVE - pool.OperatingCost)) + // assert total pool funds + Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 1*amountPerBundle)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) It("Staker receives upload slash with zero delegation", func() { @@ -550,11 +569,11 @@ var _ = Describe("zero delegation", Ordered, func() { Expect(balanceVoter).To(Equal(initialBalanceStaker1)) Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.STAKER_1)).To(BeZero()) - // check pool funds - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100 * i.KYVE)) + // assert total pool funds + Expect(fundingState.TotalAmount).To(Equal(100 * i.KYVE)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) It("Staker receives timeout slash because votes were missed", func() { @@ -780,10 +799,10 @@ var _ = Describe("zero delegation", Ordered, func() { Expect(balanceVoter).To(Equal(initialBalanceStaker1)) Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.STAKER_1)).To(BeZero()) - // check pool funds - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100 * i.KYVE)) + // assert total pool funds + Expect(fundingState.TotalAmount).To(Equal(100 * i.KYVE)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) }) From c0a16432c055936162f8befdbf8a6a3cc640d8dd Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 3 Oct 2023 12:05:14 +0200 Subject: [PATCH 047/109] feat: add fundersKeeper in x/bundles --- x/bundles/abci.go | 17 ++++++++++------- x/bundles/keeper/keeper.go | 4 +++- x/bundles/types/expected_keepers.go | 5 ++++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/x/bundles/abci.go b/x/bundles/abci.go index 245607a1..b6fc9ebe 100644 --- a/x/bundles/abci.go +++ b/x/bundles/abci.go @@ -39,26 +39,29 @@ func SplitInflation(ctx sdk.Context, k bundlesKeeper.Keeper, bk bankKeeper.Keepe // track actual distributed block provision for protocol distributed := uint64(0) - // calculate total operating cost of pools to get each pool's reward share - totalOperatingCost := uint64(0) + // calculate total inflation share weight of pools to get each pool's reward share + totalInflationShareWeight := uint64(0) for _, pool := range pk.GetAllPools(ctx) { // only include active pools if err := k.AssertPoolCanRun(ctx, pool.Id); err == nil { - totalOperatingCost += pool.OperatingCost + totalInflationShareWeight += pool.InflationShareWeight } } - // if the total operating cost is zero all rewards go the chain - if totalOperatingCost == 0 { + // if the total inflation share weight is zero all rewards go the chain + if totalInflationShareWeight == 0 { return } for _, pool := range pk.GetAllPools(ctx) { // only include active pools if err := k.AssertPoolCanRun(ctx, pool.Id); err == nil { - // calculate pool share based of operating cost - amount := uint64(sdk.NewDec(int64(pool.OperatingCost)).Quo(sdk.NewDec(int64(totalOperatingCost))).Mul(sdk.NewDec(protocolBlockProvision)).TruncateInt64()) + // calculate pool share based of inflation share weight + amount := uint64(sdk.NewDec(int64(pool.InflationShareWeight)). + Quo(sdk.NewDec(int64(totalInflationShareWeight))). + Mul(sdk.NewDec(protocolBlockProvision)). + TruncateInt64()) // transfer funds to pool account if err := util.TransferFromModuleToAddress(bk, ctx, authTypes.FeeCollectorName, pool.GetPoolAccount().String(), amount); err != nil { diff --git a/x/bundles/keeper/keeper.go b/x/bundles/keeper/keeper.go index 35811cd4..6e3d47a4 100644 --- a/x/bundles/keeper/keeper.go +++ b/x/bundles/keeper/keeper.go @@ -2,7 +2,6 @@ package keeper import ( "fmt" - "github.com/cometbft/cometbft/libs/log" "github.com/KYVENetwork/chain/x/bundles/types" @@ -25,6 +24,7 @@ type ( poolKeeper types.PoolKeeper stakerKeeper types.StakerKeeper delegationKeeper types.DelegationKeeper + fundersKeeper types.FundersKeeper } ) @@ -41,6 +41,7 @@ func NewKeeper( poolKeeper types.PoolKeeper, stakerKeeper types.StakerKeeper, delegationKeeper types.DelegationKeeper, + fundersKeeper types.FundersKeeper, ) *Keeper { return &Keeper{ cdc: cdc, @@ -55,6 +56,7 @@ func NewKeeper( poolKeeper: poolKeeper, stakerKeeper: stakerKeeper, delegationKeeper: delegationKeeper, + fundersKeeper: fundersKeeper, } } diff --git a/x/bundles/types/expected_keepers.go b/x/bundles/types/expected_keepers.go index 7bf1a5c1..bdc5afa7 100644 --- a/x/bundles/types/expected_keepers.go +++ b/x/bundles/types/expected_keepers.go @@ -36,7 +36,6 @@ type PoolKeeper interface { IncrementBundleInformation(ctx sdk.Context, poolId uint64, currentHeight uint64, currentKey string, currentValue string) GetAllPools(ctx sdk.Context) (list []pooltypes.Pool) - //ChargeFundersOfPool(ctx sdk.Context, poolId uint64, amount uint64) (payout uint64, err error) //TODO(rapha): remove ChargeInflationPool(ctx sdk.Context, poolId uint64) (payout uint64, err error) } @@ -61,3 +60,7 @@ type DelegationKeeper interface { PayoutRewards(ctx sdk.Context, staker string, amount uint64, payerModuleName string) error SlashDelegators(ctx sdk.Context, poolId uint64, staker string, slashType delegationTypes.SlashType) } + +type FundersKeeper interface { + ChargeFundersOfPool(ctx sdk.Context, poolId uint64) (payout uint64, err error) +} From ccaaef720790cd15d8d2357bbf07c0d3cbc7bea5 Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 3 Oct 2023 13:28:14 +0200 Subject: [PATCH 048/109] fix: tests for logic in x/bundles --- x/bundles/keeper/logic_bundles_test.go | 420 ++++-------------- ...ic_end_block_handle_upload_timeout_test.go | 94 ++-- x/bundles/keeper/logic_round_robin_test.go | 47 +- 3 files changed, 164 insertions(+), 397 deletions(-) diff --git a/x/bundles/keeper/logic_bundles_test.go b/x/bundles/keeper/logic_bundles_test.go index a4c4a98a..e2dd55bb 100644 --- a/x/bundles/keeper/logic_bundles_test.go +++ b/x/bundles/keeper/logic_bundles_test.go @@ -2,7 +2,8 @@ package keeper_test import ( i "github.com/KYVENetwork/chain/testutil/integration" - bundlesTypes "github.com/KYVENetwork/chain/x/bundles/types" + bundletypes "github.com/KYVENetwork/chain/x/bundles/types" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" . "github.com/onsi/ginkgo/v2" @@ -36,10 +37,42 @@ TEST CASES - logic_bundles.go var _ = Describe("logic_bundles.go", Ordered, func() { s := i.NewCleanChain() + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() BeforeEach(func() { // init new clean chain s = i.NewCleanChain() + + // create clean pool for every test case + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 2 * i.KYVE, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) + + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.ALICE, + Moniker: "Alice", + }) + + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) }) AfterEach(func() { @@ -50,30 +83,14 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert pool can run while pool is upgrading", func() { // ASSERT - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{ - Version: "1.0.0", - Binaries: "{}", - ScheduledAt: uint64(s.Ctx().BlockTime().Unix()), - Duration: 60, - }, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + pool.UpgradePlan = &pooltypes.UpgradePlan{ + Version: "1.0.0", + Binaries: "{}", + ScheduledAt: uint64(s.Ctx().BlockTime().Unix()), + Duration: 60, + } + s.App().PoolKeeper.SetPool(s.Ctx(), pool) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, @@ -96,27 +113,6 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert pool can run while pool is disabled", func() { // ASSERT - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Disabled: true, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -131,26 +127,6 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert pool can run while min delegation is not reached", func() { // ASSERT - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 99 * i.KYVE, @@ -172,26 +148,6 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert pool can run", func() { // ASSERT - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -213,19 +169,23 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert pool can run while pool has no funds", func() { // ASSERT - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 2 * i.KYVE, + MinDelegation: 100, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, @@ -234,13 +194,13 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, - PoolId: 0, + PoolId: 1, Valaddress: i.VALADDRESS_0, Amount: 0, }) // ACT - err := s.App().BundlesKeeper.AssertPoolCanRun(s.Ctx(), 0) + err := s.App().BundlesKeeper.AssertPoolCanRun(s.Ctx(), 1) // ASSERT Expect(err).NotTo(HaveOccurred()) @@ -250,26 +210,6 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert can vote if sender is no staker", func() { // ASSERT - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -282,7 +222,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0, Staker: i.STAKER_0, PoolId: 0, @@ -290,7 +230,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.CommitAfterSeconds(60) - s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ + s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ Creator: i.VALADDRESS_0, Staker: i.STAKER_0, PoolId: 0, @@ -320,26 +260,6 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert can vote if bundle is dropped", func() { // ASSERT - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -352,7 +272,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0, Staker: i.STAKER_0, PoolId: 0, @@ -360,7 +280,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.CommitAfterSeconds(60) - s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ + s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ Creator: i.VALADDRESS_0, Staker: i.STAKER_0, PoolId: 0, @@ -399,26 +319,6 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert can vote if storage id does not match", func() { // ASSERT - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -431,7 +331,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0, Staker: i.STAKER_0, PoolId: 0, @@ -439,7 +339,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.CommitAfterSeconds(60) - s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ + s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ Creator: i.VALADDRESS_0, Staker: i.STAKER_0, PoolId: 0, @@ -476,26 +376,6 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert can vote if sender has already voted valid", func() { // ASSERT - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -508,7 +388,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0, Staker: i.STAKER_0, PoolId: 0, @@ -516,7 +396,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.CommitAfterSeconds(60) - s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ + s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ Creator: i.VALADDRESS_0, Staker: i.STAKER_0, PoolId: 0, @@ -544,7 +424,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundlesTypes.MsgVoteBundleProposal{ + s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ Creator: i.VALADDRESS_1, Staker: i.STAKER_1, PoolId: 0, @@ -561,26 +441,6 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert can vote if sender has already voted invalid", func() { // ASSERT - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -593,7 +453,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0, Staker: i.STAKER_0, PoolId: 0, @@ -601,7 +461,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.CommitAfterSeconds(60) - s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ + s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ Creator: i.VALADDRESS_0, Staker: i.STAKER_0, PoolId: 0, @@ -629,7 +489,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundlesTypes.MsgVoteBundleProposal{ + s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ Creator: i.VALADDRESS_1, Staker: i.STAKER_1, PoolId: 0, @@ -646,26 +506,6 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert can vote", func() { // ASSERT - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -678,7 +518,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0, Staker: i.STAKER_0, PoolId: 0, @@ -686,7 +526,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.CommitAfterSeconds(60) - s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ + s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ Creator: i.VALADDRESS_0, Staker: i.STAKER_0, PoolId: 0, @@ -725,26 +565,6 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert can propose if sender is no staker", func() { // ASSERT - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -757,7 +577,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0, Staker: i.STAKER_0, PoolId: 0, @@ -774,26 +594,6 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert can propose if sender is not next uploader", func() { // ASSERT - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -806,7 +606,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0, Staker: i.STAKER_0, PoolId: 0, @@ -835,26 +635,6 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert can propose if upload interval has not passed", func() { // ASSERT - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -867,7 +647,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0, Staker: i.STAKER_0, PoolId: 0, @@ -884,26 +664,6 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert can propose if index does not match", func() { // ASSERT - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -916,7 +676,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0, Staker: i.STAKER_0, PoolId: 0, @@ -933,26 +693,6 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert can propose", func() { // ASSERT - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) - s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -965,7 +705,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0, Staker: i.STAKER_0, PoolId: 0, diff --git a/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go b/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go index d78ce528..3f633200 100644 --- a/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go +++ b/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go @@ -4,6 +4,7 @@ import ( i "github.com/KYVENetwork/chain/testutil/integration" bundletypes "github.com/KYVENetwork/chain/x/bundles/types" delegationtypes "github.com/KYVENetwork/chain/x/delegation/types" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -44,25 +45,35 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { s = i.NewCleanChain() // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - MaxBundleSize: 100, - StartKey: "0", - MinDelegation: 100 * i.KYVE, - UploadInterval: 60, - OperatingCost: 10_000, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) + + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + Moniker: "Alice", + }) + + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ @@ -89,9 +100,9 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { PoolId: 0, }) - s.RunTxPoolSuccess(&pooltypes.MsgDefundPool{ + s.RunTxPoolSuccess(&funderstypes.MsgDefundPool{ Creator: i.ALICE, - Id: 0, + PoolId: 0, Amount: 100 * i.KYVE, }) @@ -863,25 +874,30 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { It("Staker with already max points is next uploader of bundle proposal in a second pool and upload timeout passes", func() { // ARRANGE - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest2", - MaxBundleSize: 100, - StartKey: "0", - MinDelegation: 100 * i.KYVE, - UploadInterval: 60, - OperatingCost: 10_000, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 1, - Amount: 100 * i.KYVE, + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxFundersSuccess(msg) + + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 1, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ diff --git a/x/bundles/keeper/logic_round_robin_test.go b/x/bundles/keeper/logic_round_robin_test.go index 8e9f95a6..7b0a1d01 100644 --- a/x/bundles/keeper/logic_round_robin_test.go +++ b/x/bundles/keeper/logic_round_robin_test.go @@ -63,24 +63,35 @@ var _ = Describe("logic_round_robin.go", Ordered, func() { return i.DUMMY[k] < i.DUMMY[j] }) - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 1_000_000 * i.KYVE, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{ - Version: "1.0.0", - Binaries: "{}", - ScheduledAt: uint64(s.Ctx().BlockTime().Unix()), - Duration: 60, - }, - }) + // create clean pool for every test case + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 2 * i.KYVE, + MinDelegation: 1_000_000 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxFundersSuccess(msg) + + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + pool.Protocol.LastUpgrade = uint64(s.Ctx().BlockTime().Unix()) + pool.UpgradePlan = &pooltypes.UpgradePlan{ + Version: "1.0.0", + Binaries: "{}", + ScheduledAt: uint64(s.Ctx().BlockTime().Unix()), + Duration: 60, + } + s.App().PoolKeeper.SetPool(s.Ctx(), pool) }) AfterEach(func() { From a5d7eaf3059427779ae4cdaf7d242df847533d06 Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 3 Oct 2023 13:34:07 +0200 Subject: [PATCH 049/109] fix: use new ChargeInflationPool --- .../keeper/msg_server_submit_bundle_proposal.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/x/bundles/keeper/msg_server_submit_bundle_proposal.go b/x/bundles/keeper/msg_server_submit_bundle_proposal.go index 64b7237d..2185b45e 100644 --- a/x/bundles/keeper/msg_server_submit_bundle_proposal.go +++ b/x/bundles/keeper/msg_server_submit_bundle_proposal.go @@ -66,13 +66,11 @@ func (k msgServer) SubmitBundleProposal(goCtx context.Context, msg *types.MsgSub pool, _ := k.poolKeeper.GetPool(ctx, msg.PoolId) - // charge the operating cost from funders - // TODO(rapha): fix this - fundersPayout := uint64(0) - //fundersPayout, err := k.poolKeeper.ChargeFundersOfPool(ctx, msg.PoolId, pool.OperatingCost) - //if err != nil { - // return &types.MsgSubmitBundleProposalResponse{}, err - //} + // charge the funders of the pool + fundersPayout, err := k.fundersKeeper.ChargeFundersOfPool(ctx, msg.PoolId) + if err != nil { + return &types.MsgSubmitBundleProposalResponse{}, err + } // charge the inflation pool inflationPayout, err := k.poolKeeper.ChargeInflationPool(ctx, msg.PoolId) From 60948c8b63ac1ba3c50b672415e06f85928e1f74 Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 3 Oct 2023 13:46:01 +0200 Subject: [PATCH 050/109] fix: remaining tests in x/bundles --- x/bundles/keeper/abci_protocol_split_test.go | 164 +++++++++--------- .../msg_server_claim_uploader_role_test.go | 103 +++++++---- .../msg_server_skip_uploader_role_test.go | 45 +++-- .../msg_server_submit_bundle_proposal_test.go | 45 +++-- .../msg_server_vote_bundle_proposal_test.go | 45 +++-- 5 files changed, 240 insertions(+), 162 deletions(-) diff --git a/x/bundles/keeper/abci_protocol_split_test.go b/x/bundles/keeper/abci_protocol_split_test.go index bfcf0ad1..081fb3f9 100644 --- a/x/bundles/keeper/abci_protocol_split_test.go +++ b/x/bundles/keeper/abci_protocol_split_test.go @@ -3,7 +3,7 @@ package keeper_test import ( i "github.com/KYVENetwork/chain/testutil/integration" globalTypes "github.com/KYVENetwork/chain/x/global/types" - poolTypes "github.com/KYVENetwork/chain/x/pool/types" + pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" sdk "github.com/cosmos/cosmos-sdk/types" . "github.com/onsi/ginkgo/v2" @@ -16,37 +16,42 @@ TEST CASES - abci.go * inactive pool should not receive inflation funds * active pool should receive inflation funds -* pool should split inflation funds depending on operating cost -* pools with zero operating cost should receive nothing -* every pool has zero operating cost +* pool should split inflation funds depending on inflation share weight +* pools with zero inflation share weight should receive nothing +* every pool has zero inflation share weight */ var _ = Describe("abci.go", Ordered, func() { s := i.NewCleanChain() + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() BeforeEach(func() { s = i.NewCleanChain() - s.App().PoolKeeper.SetParams(s.Ctx(), poolTypes.Params{ + s.App().PoolKeeper.SetParams(s.Ctx(), pooltypes.Params{ ProtocolInflationShare: sdk.MustNewDecFromStr("0.1"), PoolInflationPayoutRate: sdk.MustNewDecFromStr("0.1"), }) - s.App().PoolKeeper.AppendPool(s.Ctx(), poolTypes.Pool{ - Name: "PoolTest", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - MinDelegation: 100 * i.KYVE, - OperatingCost: 1_000_000, - Protocol: &poolTypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &poolTypes.UpgradePlan{}, - }) + // create clean pool for every test case + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 1_000_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) }) AfterEach(func() { @@ -97,22 +102,25 @@ var _ = Describe("abci.go", Ordered, func() { } }) - It("pool should split inflation funds depending on operating cost", func() { + It("pool should split inflation funds depending on inflation share weight", func() { // ARRANGE - s.App().PoolKeeper.AppendPool(s.Ctx(), poolTypes.Pool{ - Name: "PoolTest2", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - MinDelegation: 100 * i.KYVE, - OperatingCost: 2_000_000, - Protocol: &poolTypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &poolTypes.UpgradePlan{}, - }) + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 2_000_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, @@ -146,25 +154,28 @@ var _ = Describe("abci.go", Ordered, func() { b2 := uint64(s.App().BankKeeper.GetBalance(s.Ctx(), pool2.GetPoolAccount(), globalTypes.Denom).Amount.Int64()) // ASSERT - Expect(b1 * 2).To(BeNumerically("~", b2, 1)) + Expect(b1 * 2).To(BeNumerically("~", b2-10, b2+10)) }) - It("pools with zero operating cost should receive nothing", func() { + It("pools with zero inflation share weight should receive nothing", func() { // ARRANGE - s.App().PoolKeeper.AppendPool(s.Ctx(), poolTypes.Pool{ - Name: "PoolTest2", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - MinDelegation: 100 * i.KYVE, - OperatingCost: 0, - Protocol: &poolTypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &poolTypes.UpgradePlan{}, - }) + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 0, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxFundersSuccess(msg) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, @@ -191,41 +202,34 @@ var _ = Describe("abci.go", Ordered, func() { Expect(b2).To(BeZero()) }) - It("every pool has zero operating cost", func() { + It("every pool has zero inflation share weight", func() { // ARRANGE - s.App().PoolKeeper.SetPool(s.Ctx(), poolTypes.Pool{ - Id: 0, - Name: "PoolTest", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - OperatingCost: 0, - Protocol: &poolTypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &poolTypes.UpgradePlan{}, - }) - - s.App().PoolKeeper.AppendPool(s.Ctx(), poolTypes.Pool{ - Name: "PoolTest2", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - OperatingCost: 0, - Protocol: &poolTypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &poolTypes.UpgradePlan{}, - }) + pool1, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + pool1.InflationShareWeight = 0 + s.App().PoolKeeper.SetPool(s.Ctx(), pool1) + + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 0, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) // ACT s.Commit() - pool1, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + pool1, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) b1 := uint64(s.App().BankKeeper.GetBalance(s.Ctx(), pool1.GetPoolAccount(), globalTypes.Denom).Amount.Int64()) pool2, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 1) diff --git a/x/bundles/keeper/msg_server_claim_uploader_role_test.go b/x/bundles/keeper/msg_server_claim_uploader_role_test.go index eec9c553..04c96ee9 100644 --- a/x/bundles/keeper/msg_server_claim_uploader_role_test.go +++ b/x/bundles/keeper/msg_server_claim_uploader_role_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + funderstypes "github.com/KYVENetwork/chain/x/funders/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -24,20 +25,35 @@ TEST CASES - msg_server_claim_uploader_role.go var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { s := i.NewCleanChain() + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() BeforeEach(func() { // init new clean chain s = i.NewCleanChain() // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) + + // create funders + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.ALICE, + Moniker: "Alice", }) }) @@ -72,10 +88,11 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { It("Try to claim uploader role without being a staker", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) // ACT @@ -92,10 +109,11 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { It("Try to claim uploader role if the next uploader is not set yet", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ @@ -138,10 +156,11 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { It("Try to claim uploader role with non existing valaccount", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ @@ -169,21 +188,30 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { It("Try to claim uploader role with valaccount that belongs to another pool", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest2", - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, @@ -210,10 +238,11 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { It("Try to claim uploader role if someone else is already next uploader", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ diff --git a/x/bundles/keeper/msg_server_skip_uploader_role_test.go b/x/bundles/keeper/msg_server_skip_uploader_role_test.go index d06df361..5feb94d2 100644 --- a/x/bundles/keeper/msg_server_skip_uploader_role_test.go +++ b/x/bundles/keeper/msg_server_skip_uploader_role_test.go @@ -3,6 +3,7 @@ package keeper_test import ( i "github.com/KYVENetwork/chain/testutil/integration" bundletypes "github.com/KYVENetwork/chain/x/bundles/types" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" . "github.com/onsi/ginkgo/v2" @@ -27,24 +28,36 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { // init new clean chain s = i.NewCleanChain() - // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10_000, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, + //create clean pool for every test case + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 0 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) + + //// create funders + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.ALICE, + Moniker: "Alice", }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Amount: 100 * i.KYVE, + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ diff --git a/x/bundles/keeper/msg_server_submit_bundle_proposal_test.go b/x/bundles/keeper/msg_server_submit_bundle_proposal_test.go index afc891ba..e0b4a7b1 100644 --- a/x/bundles/keeper/msg_server_submit_bundle_proposal_test.go +++ b/x/bundles/keeper/msg_server_submit_bundle_proposal_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + funderstypes "github.com/KYVENetwork/chain/x/funders/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -34,24 +35,36 @@ var _ = Describe("msg_server_submit_bundle_proposal.go", Ordered, func() { // init new clean chain s = i.NewCleanChain() - // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10_000, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, + //create clean pool for every test case + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 0 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) + + //// create funders + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.STAKER_0, + Moniker: "Staker 0", }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.STAKER_0, - Amount: 100 * i.KYVE, + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.STAKER_0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ diff --git a/x/bundles/keeper/msg_server_vote_bundle_proposal_test.go b/x/bundles/keeper/msg_server_vote_bundle_proposal_test.go index 082983ce..6b7c7d8a 100644 --- a/x/bundles/keeper/msg_server_vote_bundle_proposal_test.go +++ b/x/bundles/keeper/msg_server_vote_bundle_proposal_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + funderstypes "github.com/KYVENetwork/chain/x/funders/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -32,21 +33,39 @@ var _ = Describe("msg_server_vote_bundle_proposal.go", Ordered, func() { // init new clean chain s = i.NewCleanChain() - // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, + //create clean pool for every test case + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 0 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + pool.UploadInterval = 0 + s.App().PoolKeeper.SetPool(s.Ctx(), pool) + + //// create funders + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + Creator: i.ALICE, + Moniker: "Alice", }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Amount: 100 * i.KYVE, + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ From 68e13e1d2606b14d2e4f2efb1133fbe58a1230c2 Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 3 Oct 2023 14:09:28 +0200 Subject: [PATCH 051/109] fix: tests in x/delegation --- x/delegation/keeper/keeper_suite_test.go | 57 +++++++++++++------ .../keeper/msg_server_delegate_test.go | 18 +++--- .../keeper/msg_server_redelegate_test.go | 29 ++++++---- .../keeper/msg_server_undelegate_test.go | 28 +++++---- .../msg_server_withdraw_rewards_test.go | 16 +++--- 5 files changed, 95 insertions(+), 53 deletions(-) diff --git a/x/delegation/keeper/keeper_suite_test.go b/x/delegation/keeper/keeper_suite_test.go index 160587f1..5e3c2398 100644 --- a/x/delegation/keeper/keeper_suite_test.go +++ b/x/delegation/keeper/keeper_suite_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "fmt" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" "testing" i "github.com/KYVENetwork/chain/testutil/integration" @@ -18,7 +19,17 @@ func TestDelegationKeeper(t *testing.T) { } func PayoutRewards(s *i.KeeperTestSuite, staker string, amount uint64) { - payout, err := s.App().PoolKeeper.ChargeFundersOfPool(s.Ctx(), 0, amount) + fundingState, found := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(found).To(BeTrue()) + + // divide amount by number of active fundings so that total payout is equal to amount + activeFundings := s.App().FundersKeeper.GetActiveFundings(s.Ctx(), fundingState) + for _, funding := range activeFundings { + funding.AmountPerBundle = amount / uint64(len(activeFundings)) + s.App().FundersKeeper.SetFunding(s.Ctx(), &funding) + } + + payout, err := s.App().FundersKeeper.ChargeFundersOfPool(s.Ctx(), 0) Expect(err).To(BeNil()) err = s.App().DelegationKeeper.PayoutRewards(s.Ctx(), staker, amount, pooltypes.ModuleName) Expect(err).NotTo(HaveOccurred()) @@ -26,30 +37,44 @@ func PayoutRewards(s *i.KeeperTestSuite, staker string, amount uint64) { } func CreateFundedPool(s *i.KeeperTestSuite) { - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxFundersSuccess(msg) s.CommitAfterSeconds(7) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + Moniker: "Alice", + }) + + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) s.CommitAfterSeconds(7) - pool, poolFound := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(poolFound).To(BeTrue()) - Expect(pool.TotalFunds).To(Equal(100 * i.KYVE)) + Expect(fundingState.TotalAmount).To(Equal(100 * i.KYVE)) } func CheckAndContinueChainForOneMonth(s *i.KeeperTestSuite) { diff --git a/x/delegation/keeper/msg_server_delegate_test.go b/x/delegation/keeper/msg_server_delegate_test.go index 9160f14d..93ae4273 100644 --- a/x/delegation/keeper/msg_server_delegate_test.go +++ b/x/delegation/keeper/msg_server_delegate_test.go @@ -1,12 +1,12 @@ package keeper_test import ( + funderstypes "github.com/KYVENetwork/chain/x/funders/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" i "github.com/KYVENetwork/chain/testutil/integration" "github.com/KYVENetwork/chain/x/delegation/types" - pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakerstypes "github.com/KYVENetwork/chain/x/stakers/types" ) @@ -156,9 +156,9 @@ var _ = Describe("msg_server_delegate.go", Ordered, func() { Amount: 209 * i.KYVE, }) - poolModuleBalance := s.GetBalanceFromModule(pooltypes.ModuleName) + fundersModuleBalance := s.GetBalanceFromModule(funderstypes.ModuleName) - Expect(poolModuleBalance).To(Equal(100 * i.KYVE)) + Expect(fundersModuleBalance).To(Equal(100 * i.KYVE)) Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.ALICE, i.DUMMY[0])).To(BeZero()) Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.ALICE, i.DUMMY[1])).To(BeZero()) @@ -186,8 +186,8 @@ var _ = Describe("msg_server_delegate.go", Ordered, func() { Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.ALICE, i.DUMMY[0])).To(Equal(uint64(0))) Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.ALICE, i.DUMMY[1])).To(Equal(uint64(5_110_024_449))) - Expect(s.GetBalanceFromAddress(i.DUMMY[0])).To(Equal(uint64(900*i.KYVE + 2_444_987_775))) - Expect(s.GetBalanceFromModule(pooltypes.ModuleName)).To(Equal(90 * i.KYVE)) + Expect(s.GetBalanceFromAddress(i.DUMMY[0])).To(Equal(900*i.KYVE + 2_444_987_775)) + Expect(s.GetBalanceFromModule(funderstypes.ModuleName)).To(Equal(90 * i.KYVE)) Expect(s.GetBalanceFromModule(types.ModuleName)).To(Equal((200+409)*i.KYVE + uint64(2_444_987_775+5_110_024_449+1))) }) @@ -205,9 +205,9 @@ var _ = Describe("msg_server_delegate.go", Ordered, func() { Amount: 200 * i.KYVE, }) - poolModuleBalance := s.GetBalanceFromModule(pooltypes.ModuleName) + fundersModuleBalance := s.GetBalanceFromModule(funderstypes.ModuleName) - Expect(poolModuleBalance).To(Equal(100 * i.KYVE)) + Expect(fundersModuleBalance).To(Equal(100 * i.KYVE)) Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.ALICE, i.DUMMY[0])).To(BeZero()) Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.ALICE, i.DUMMY[1])).To(BeZero()) @@ -238,8 +238,8 @@ var _ = Describe("msg_server_delegate.go", Ordered, func() { Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.ALICE, i.DUMMY[0])).To(Equal(uint64(0))) Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.ALICE, i.DUMMY[1])).To(Equal(uint64(5_000_000_000))) - Expect(s.GetBalanceFromAddress(i.DUMMY[0])).To(Equal(uint64(900*i.KYVE + 2_500_000_000))) - Expect(s.GetBalanceFromModule(pooltypes.ModuleName)).To(Equal(90 * i.KYVE)) + Expect(s.GetBalanceFromAddress(i.DUMMY[0])).To(Equal(900*i.KYVE + 2_500_000_000)) + Expect(s.GetBalanceFromModule(funderstypes.ModuleName)).To(Equal(90 * i.KYVE)) Expect(s.GetBalanceFromModule(types.ModuleName)).To(Equal(600*i.KYVE + 7_500_000_000)) }) diff --git a/x/delegation/keeper/msg_server_redelegate_test.go b/x/delegation/keeper/msg_server_redelegate_test.go index 43dc8361..a3552ec6 100644 --- a/x/delegation/keeper/msg_server_redelegate_test.go +++ b/x/delegation/keeper/msg_server_redelegate_test.go @@ -34,17 +34,24 @@ var _ = Describe("Delegation - Redelegation", Ordered, func() { CreateFundedPool(s) - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "EnabledPool", - MinDelegation: 1_000 * i.KYVE, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - Disabled: false, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 1_000 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxFundersSuccess(msg) s.RunTxStakersSuccess(&stakerstypes.MsgCreateStaker{ Creator: i.ALICE, diff --git a/x/delegation/keeper/msg_server_undelegate_test.go b/x/delegation/keeper/msg_server_undelegate_test.go index 7c2225c1..dc551e86 100644 --- a/x/delegation/keeper/msg_server_undelegate_test.go +++ b/x/delegation/keeper/msg_server_undelegate_test.go @@ -52,16 +52,24 @@ var _ = Describe("msg_server_undelegate.go", Ordered, func() { Amount: bobSelfDelegation, }) - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "DisabledPool", - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - Disabled: true, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxFundersSuccess(msg) s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.BOB, diff --git a/x/delegation/keeper/msg_server_withdraw_rewards_test.go b/x/delegation/keeper/msg_server_withdraw_rewards_test.go index 331eaadb..4def289a 100644 --- a/x/delegation/keeper/msg_server_withdraw_rewards_test.go +++ b/x/delegation/keeper/msg_server_withdraw_rewards_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakerstypes "github.com/KYVENetwork/chain/x/stakers/types" . "github.com/onsi/ginkgo/v2" @@ -83,7 +84,7 @@ var _ = Describe("msg_server_withdraw_rewards.go", Ordered, func() { Expect(s.App().DelegationKeeper.GetDelegationAmount(s.Ctx(), i.ALICE)).To(Equal(aliceSelfDelegation + 30*i.KYVE)) delegationModuleBalanceBefore := s.GetBalanceFromModule(types.ModuleName) - poolModuleBalanceBefore := s.GetBalanceFromModule(pooltypes.ModuleName) + fundersModuleBalanceBefore := s.GetBalanceFromModule(funderstypes.ModuleName) s.PerformValidityChecks() // ACT @@ -95,10 +96,10 @@ var _ = Describe("msg_server_withdraw_rewards.go", Ordered, func() { // ASSERT delegationModuleBalanceAfter := s.GetBalanceFromModule(types.ModuleName) - poolModuleBalanceAfter := s.GetBalanceFromModule(pooltypes.ModuleName) + fundersModuleBalanceAfter := s.GetBalanceFromModule(funderstypes.ModuleName) Expect(delegationModuleBalanceAfter).To(Equal(delegationModuleBalanceBefore + 20*i.KYVE)) - Expect(poolModuleBalanceAfter).To(Equal(poolModuleBalanceBefore - 20*i.KYVE)) + Expect(fundersModuleBalanceAfter).To(Equal(fundersModuleBalanceBefore - 20*i.KYVE)) Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.ALICE, i.DUMMY[0])).To(Equal(uint64(6666666666))) Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.ALICE, i.DUMMY[1])).To(Equal(uint64(6666666666))) @@ -155,10 +156,11 @@ var _ = Describe("msg_server_withdraw_rewards.go", Ordered, func() { // ARRANGE // fund pool module - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) // ACT From 68f31f4f6bd6fd3c8ff62618d49742eece5d64cc Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 3 Oct 2023 14:50:02 +0200 Subject: [PATCH 052/109] fix: tests in x/pool --- x/pool/keeper/keeper_utils_test.go | 20 +++++++++++++ ...gic_end_block_handle_pool_upgrades_test.go | 24 ++++++++------- .../msg_server_cancel_runtime_upgrade_test.go | 19 ++++++------ x/pool/keeper/msg_server_enable_pool_test.go | 8 ++--- ...sg_server_schedule_runtime_upgrade_test.go | 19 ++++++------ x/pool/keeper/msg_server_update_pool_test.go | 30 ++----------------- 6 files changed, 58 insertions(+), 62 deletions(-) diff --git a/x/pool/keeper/keeper_utils_test.go b/x/pool/keeper/keeper_utils_test.go index f13f8866..3dcc27ba 100644 --- a/x/pool/keeper/keeper_utils_test.go +++ b/x/pool/keeper/keeper_utils_test.go @@ -2,6 +2,7 @@ package keeper_test import ( i "github.com/KYVENetwork/chain/testutil/integration" + "github.com/KYVENetwork/chain/x/pool/types" sdk "github.com/cosmos/cosmos-sdk/types" govV1Types "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) @@ -23,3 +24,22 @@ func BuildGovernanceTxs(s *i.KeeperTestSuite, msgs []sdk.Msg) (govV1Types.MsgSub return *proposal, *vote } + +func createPoolWithEmptyValues(s *i.KeeperTestSuite) { + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &types.MsgCreatePool{ + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + Binaries: "{}", + } + s.RunTxFundersSuccess(msg) + + poolId := s.App().PoolKeeper.GetPoolCount(s.Ctx()) - 1 + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), poolId) + pool.UploadInterval = 0 + pool.MaxBundleSize = 0 + pool.Protocol = &types.Protocol{} + pool.UpgradePlan = &types.UpgradePlan{} + s.App().PoolKeeper.SetPool(s.Ctx(), pool) +} diff --git a/x/pool/keeper/logic_end_block_handle_pool_upgrades_test.go b/x/pool/keeper/logic_end_block_handle_pool_upgrades_test.go index 51dbd744..b237d9b0 100644 --- a/x/pool/keeper/logic_end_block_handle_pool_upgrades_test.go +++ b/x/pool/keeper/logic_end_block_handle_pool_upgrades_test.go @@ -28,20 +28,24 @@ var _ = Describe("logic_end_block_handle_pool_upgrades.go", Ordered, func() { s = i.NewCleanChain() // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, Name: "PoolTest", - MaxBundleSize: 100, + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", - MinDelegation: 100 * i.KYVE, UploadInterval: 60, InflationShareWeight: 10_000, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxFundersSuccess(msg) }) AfterEach(func() { diff --git a/x/pool/keeper/msg_server_cancel_runtime_upgrade_test.go b/x/pool/keeper/msg_server_cancel_runtime_upgrade_test.go index 2924ccfe..6ed1db59 100644 --- a/x/pool/keeper/msg_server_cancel_runtime_upgrade_test.go +++ b/x/pool/keeper/msg_server_cancel_runtime_upgrade_test.go @@ -33,15 +33,16 @@ var _ = Describe("msg_server_cancel_runtime_upgrade.go", Ordered, func() { BeforeEach(func() { s = i.NewCleanChain() - s.App().PoolKeeper.AppendPool(s.Ctx(), types.Pool{ - Runtime: "@kyve/test", - Protocol: &types.Protocol{ - Version: "0.0.0", - Binaries: "{\"linux\":\"test\"}", - LastUpgrade: 0, - }, - UpgradePlan: &types.UpgradePlan{}, - }) + createPoolWithEmptyValues(s) + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + pool.UpgradePlan = &types.UpgradePlan{} + pool.Protocol = &types.Protocol{ + Version: "0.0.0", + Binaries: "{\"linux\":\"test\"}", + LastUpgrade: 0, + } + pool.Runtime = "@kyve/test" + s.App().PoolKeeper.SetPool(s.Ctx(), pool) }) AfterEach(func() { diff --git a/x/pool/keeper/msg_server_enable_pool_test.go b/x/pool/keeper/msg_server_enable_pool_test.go index 27dffc78..87730fa7 100644 --- a/x/pool/keeper/msg_server_enable_pool_test.go +++ b/x/pool/keeper/msg_server_enable_pool_test.go @@ -35,12 +35,8 @@ var _ = Describe("msg_server_enable_pool.go", Ordered, func() { BeforeEach(func() { s = i.NewCleanChain() - s.App().PoolKeeper.AppendPool(s.Ctx(), types.Pool{ - UpgradePlan: &types.UpgradePlan{}, - }) - s.App().PoolKeeper.AppendPool(s.Ctx(), types.Pool{ - UpgradePlan: &types.UpgradePlan{}, - }) + createPoolWithEmptyValues(s) + createPoolWithEmptyValues(s) }) AfterEach(func() { diff --git a/x/pool/keeper/msg_server_schedule_runtime_upgrade_test.go b/x/pool/keeper/msg_server_schedule_runtime_upgrade_test.go index 32caece2..bf0625b2 100644 --- a/x/pool/keeper/msg_server_schedule_runtime_upgrade_test.go +++ b/x/pool/keeper/msg_server_schedule_runtime_upgrade_test.go @@ -36,15 +36,16 @@ var _ = Describe("msg_server_schedule_runtime_upgrade.go", Ordered, func() { BeforeEach(func() { s = i.NewCleanChain() - s.App().PoolKeeper.AppendPool(s.Ctx(), types.Pool{ - Runtime: "@kyve/test", - Protocol: &types.Protocol{ - Version: "0.0.0", - Binaries: "{\"linux\":\"test\"}", - LastUpgrade: 0, - }, - UpgradePlan: &types.UpgradePlan{}, - }) + createPoolWithEmptyValues(s) + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + pool.UpgradePlan = &types.UpgradePlan{} + pool.Protocol = &types.Protocol{ + Version: "0.0.0", + Binaries: "{\"linux\":\"test\"}", + LastUpgrade: 0, + } + pool.Runtime = "@kyve/test" + s.App().PoolKeeper.SetPool(s.Ctx(), pool) }) AfterEach(func() { diff --git a/x/pool/keeper/msg_server_update_pool_test.go b/x/pool/keeper/msg_server_update_pool_test.go index 70c40017..4c370a15 100644 --- a/x/pool/keeper/msg_server_update_pool_test.go +++ b/x/pool/keeper/msg_server_update_pool_test.go @@ -33,20 +33,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { BeforeEach(func() { s = i.NewCleanChain() - s.App().PoolKeeper.AppendPool(s.Ctx(), types.Pool{ - Name: "", - Runtime: "", - Logo: "", - Config: "", - UploadInterval: 0, - InflationShareWeight: 0, - MinDelegation: 0, - MaxBundleSize: 0, - CurrentStorageProviderId: 0, - CurrentCompressionId: 0, - Protocol: &types.Protocol{}, - UpgradePlan: &types.UpgradePlan{}, - }) + createPoolWithEmptyValues(s) }) AfterEach(func() { @@ -203,20 +190,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { It("Update another pool", func() { // ARRANGE - s.App().PoolKeeper.AppendPool(s.Ctx(), types.Pool{ - Name: "", - Runtime: "", - Logo: "", - Config: "", - UploadInterval: 0, - InflationShareWeight: 0, - MinDelegation: 0, - MaxBundleSize: 0, - CurrentStorageProviderId: 0, - CurrentCompressionId: 0, - Protocol: &types.Protocol{}, - UpgradePlan: &types.UpgradePlan{}, - }) + createPoolWithEmptyValues(s) // ACT msg := &types.MsgUpdatePool{ From a6190d94280716cc24f209ae871bbd0074bb8937 Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 3 Oct 2023 14:54:20 +0200 Subject: [PATCH 053/109] fix: typo --- x/bundles/keeper/abci_protocol_split_test.go | 2 +- x/bundles/keeper/keeper_suite_dropped_bundles_test.go | 2 +- x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go | 2 +- x/bundles/keeper/logic_round_robin_test.go | 2 +- x/delegation/keeper/keeper_suite_test.go | 2 +- x/delegation/keeper/msg_server_redelegate_test.go | 2 +- x/delegation/keeper/msg_server_undelegate_test.go | 2 +- x/funders/keeper/logic_funders_test.go | 2 +- x/funders/keeper/msg_server_defund_pool_test.go | 2 +- x/funders/keeper/msg_server_fund_pool_test.go | 2 +- x/pool/keeper/keeper_utils_test.go | 2 +- x/pool/keeper/logic_end_block_handle_pool_upgrades_test.go | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/x/bundles/keeper/abci_protocol_split_test.go b/x/bundles/keeper/abci_protocol_split_test.go index 081fb3f9..8aa23f0b 100644 --- a/x/bundles/keeper/abci_protocol_split_test.go +++ b/x/bundles/keeper/abci_protocol_split_test.go @@ -175,7 +175,7 @@ var _ = Describe("abci.go", Ordered, func() { StorageProviderId: 2, CompressionId: 1, } - s.RunTxFundersSuccess(msg) + s.RunTxPoolSuccess(msg) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, diff --git a/x/bundles/keeper/keeper_suite_dropped_bundles_test.go b/x/bundles/keeper/keeper_suite_dropped_bundles_test.go index 4534bd54..f3a2db01 100644 --- a/x/bundles/keeper/keeper_suite_dropped_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_dropped_bundles_test.go @@ -50,7 +50,7 @@ var _ = Describe("dropped bundles", Ordered, func() { StorageProviderId: 2, CompressionId: 1, } - s.RunTxFundersSuccess(msg) + s.RunTxPoolSuccess(msg) s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ Creator: i.ALICE, diff --git a/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go b/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go index 3f633200..b16d74cc 100644 --- a/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go +++ b/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go @@ -891,7 +891,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { StorageProviderId: 2, CompressionId: 1, } - s.RunTxFundersSuccess(msg) + s.RunTxPoolSuccess(msg) s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ Creator: i.ALICE, diff --git a/x/bundles/keeper/logic_round_robin_test.go b/x/bundles/keeper/logic_round_robin_test.go index 7b0a1d01..c207b6cb 100644 --- a/x/bundles/keeper/logic_round_robin_test.go +++ b/x/bundles/keeper/logic_round_robin_test.go @@ -81,7 +81,7 @@ var _ = Describe("logic_round_robin.go", Ordered, func() { StorageProviderId: 2, CompressionId: 1, } - s.RunTxFundersSuccess(msg) + s.RunTxPoolSuccess(msg) pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) pool.Protocol.LastUpgrade = uint64(s.Ctx().BlockTime().Unix()) diff --git a/x/delegation/keeper/keeper_suite_test.go b/x/delegation/keeper/keeper_suite_test.go index 5e3c2398..0b3eb058 100644 --- a/x/delegation/keeper/keeper_suite_test.go +++ b/x/delegation/keeper/keeper_suite_test.go @@ -54,7 +54,7 @@ func CreateFundedPool(s *i.KeeperTestSuite) { StorageProviderId: 2, CompressionId: 1, } - s.RunTxFundersSuccess(msg) + s.RunTxPoolSuccess(msg) s.CommitAfterSeconds(7) diff --git a/x/delegation/keeper/msg_server_redelegate_test.go b/x/delegation/keeper/msg_server_redelegate_test.go index a3552ec6..a72631d5 100644 --- a/x/delegation/keeper/msg_server_redelegate_test.go +++ b/x/delegation/keeper/msg_server_redelegate_test.go @@ -51,7 +51,7 @@ var _ = Describe("Delegation - Redelegation", Ordered, func() { StorageProviderId: 2, CompressionId: 1, } - s.RunTxFundersSuccess(msg) + s.RunTxPoolSuccess(msg) s.RunTxStakersSuccess(&stakerstypes.MsgCreateStaker{ Creator: i.ALICE, diff --git a/x/delegation/keeper/msg_server_undelegate_test.go b/x/delegation/keeper/msg_server_undelegate_test.go index dc551e86..c1a6b1cb 100644 --- a/x/delegation/keeper/msg_server_undelegate_test.go +++ b/x/delegation/keeper/msg_server_undelegate_test.go @@ -69,7 +69,7 @@ var _ = Describe("msg_server_undelegate.go", Ordered, func() { StorageProviderId: 2, CompressionId: 1, } - s.RunTxFundersSuccess(msg) + s.RunTxPoolSuccess(msg) s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.BOB, diff --git a/x/funders/keeper/logic_funders_test.go b/x/funders/keeper/logic_funders_test.go index 3619ba63..2b57091a 100644 --- a/x/funders/keeper/logic_funders_test.go +++ b/x/funders/keeper/logic_funders_test.go @@ -47,7 +47,7 @@ var _ = Describe("logic_funders.go", Ordered, func() { StorageProviderId: 2, CompressionId: 1, } - s.RunTxFundersSuccess(msg) + s.RunTxPoolSuccess(msg) // create funder s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ diff --git a/x/funders/keeper/msg_server_defund_pool_test.go b/x/funders/keeper/msg_server_defund_pool_test.go index 0460b5ae..3a04bd8c 100644 --- a/x/funders/keeper/msg_server_defund_pool_test.go +++ b/x/funders/keeper/msg_server_defund_pool_test.go @@ -48,7 +48,7 @@ var _ = Describe("msg_server_defund_pool.go", Ordered, func() { StorageProviderId: 2, CompressionId: 1, } - s.RunTxFundersSuccess(msg) + s.RunTxPoolSuccess(msg) // create funder s.RunTxFundersSuccess(&types.MsgCreateFunder{ diff --git a/x/funders/keeper/msg_server_fund_pool_test.go b/x/funders/keeper/msg_server_fund_pool_test.go index 876c6e42..f9f10473 100644 --- a/x/funders/keeper/msg_server_fund_pool_test.go +++ b/x/funders/keeper/msg_server_fund_pool_test.go @@ -54,7 +54,7 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { StorageProviderId: 2, CompressionId: 1, } - s.RunTxFundersSuccess(msg) + s.RunTxPoolSuccess(msg) // create funder s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ diff --git a/x/pool/keeper/keeper_utils_test.go b/x/pool/keeper/keeper_utils_test.go index 3dcc27ba..49142dc4 100644 --- a/x/pool/keeper/keeper_utils_test.go +++ b/x/pool/keeper/keeper_utils_test.go @@ -33,7 +33,7 @@ func createPoolWithEmptyValues(s *i.KeeperTestSuite) { MaxBundleSize: 100, Binaries: "{}", } - s.RunTxFundersSuccess(msg) + s.RunTxPoolSuccess(msg) poolId := s.App().PoolKeeper.GetPoolCount(s.Ctx()) - 1 pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), poolId) diff --git a/x/pool/keeper/logic_end_block_handle_pool_upgrades_test.go b/x/pool/keeper/logic_end_block_handle_pool_upgrades_test.go index b237d9b0..4d05d370 100644 --- a/x/pool/keeper/logic_end_block_handle_pool_upgrades_test.go +++ b/x/pool/keeper/logic_end_block_handle_pool_upgrades_test.go @@ -45,7 +45,7 @@ var _ = Describe("logic_end_block_handle_pool_upgrades.go", Ordered, func() { StorageProviderId: 2, CompressionId: 1, } - s.RunTxFundersSuccess(msg) + s.RunTxPoolSuccess(msg) }) AfterEach(func() { From 8a7fea3b19e050a5fccaf8e897e8c3de87889f7f Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 3 Oct 2023 15:00:12 +0200 Subject: [PATCH 054/109] fix: tests in x/stakers --- ...sg_server_claim_commission_rewards_test.go | 86 +++++++++++-------- 1 file changed, 51 insertions(+), 35 deletions(-) diff --git a/x/stakers/keeper/msg_server_claim_commission_rewards_test.go b/x/stakers/keeper/msg_server_claim_commission_rewards_test.go index 8c9b578b..f014e914 100644 --- a/x/stakers/keeper/msg_server_claim_commission_rewards_test.go +++ b/x/stakers/keeper/msg_server_claim_commission_rewards_test.go @@ -3,6 +3,7 @@ package keeper_test import ( i "github.com/KYVENetwork/chain/testutil/integration" bundletypes "github.com/KYVENetwork/chain/x/bundles/types" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -34,19 +35,24 @@ var _ = Describe("msg_server_claim_commission_rewards.go", Ordered, func() { s = i.NewCleanChain() // create clean pool for every test case - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - MaxBundleSize: 100, - StartKey: "0", - UploadInterval: 60, - OperatingCost: 10_000, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, @@ -61,11 +67,21 @@ var _ = Describe("msg_server_claim_commission_rewards.go", Ordered, func() { initialBalanceStaker0 = s.GetBalanceFromAddress(i.STAKER_0) - // create a valid bundle so that uploader earns commission rewards - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + Moniker: "Alice", + }) + + params := s.App().FundersKeeper.GetParams(s.Ctx()) + params.MinFundingAmountPerBundle = 10_000 + s.App().FundersKeeper.SetParams(s.Ctx(), params) + + // create a valid bundle so that uploader earns commission rewards + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 10_000, }) s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ @@ -128,9 +144,9 @@ var _ = Describe("msg_server_claim_commission_rewards.go", Ordered, func() { balanceUploader := s.GetBalanceFromAddress(i.STAKER_0) networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(sdk.NewDec(int64(pool.OperatingCost)).Mul(networkFee).TruncateInt64()) + treasuryReward := uint64(sdk.NewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.OperatingCost - treasuryReward - storageReward + totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) totalDelegationReward := totalUploaderReward - uploaderPayoutReward @@ -143,11 +159,11 @@ var _ = Describe("msg_server_claim_commission_rewards.go", Ordered, func() { // assert commission rewards Expect(uploader.CommissionRewards).To(Equal(uploaderPayoutReward + storageReward)) - // check pool funds - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(pool.Funders).To(HaveLen(1)) - Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100*i.KYVE - pool.OperatingCost)) + // assert total pool funds + Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 10_000)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) It("Claim with non-staker account", func() { @@ -165,9 +181,9 @@ var _ = Describe("msg_server_claim_commission_rewards.go", Ordered, func() { pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(sdk.NewDec(int64(pool.OperatingCost)).Mul(networkFee).TruncateInt64()) + treasuryReward := uint64(sdk.NewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.OperatingCost - treasuryReward - storageReward + totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) @@ -193,9 +209,9 @@ var _ = Describe("msg_server_claim_commission_rewards.go", Ordered, func() { pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(sdk.NewDec(int64(pool.OperatingCost)).Mul(networkFee).TruncateInt64()) + treasuryReward := uint64(sdk.NewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.OperatingCost - treasuryReward - storageReward + totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) @@ -217,9 +233,9 @@ var _ = Describe("msg_server_claim_commission_rewards.go", Ordered, func() { pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(sdk.NewDec(int64(pool.OperatingCost)).Mul(networkFee).TruncateInt64()) + treasuryReward := uint64(sdk.NewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.OperatingCost - treasuryReward - storageReward + totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) @@ -243,9 +259,9 @@ var _ = Describe("msg_server_claim_commission_rewards.go", Ordered, func() { pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(sdk.NewDec(int64(pool.OperatingCost)).Mul(networkFee).TruncateInt64()) + treasuryReward := uint64(sdk.NewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.OperatingCost - treasuryReward - storageReward + totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) @@ -269,9 +285,9 @@ var _ = Describe("msg_server_claim_commission_rewards.go", Ordered, func() { pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(sdk.NewDec(int64(pool.OperatingCost)).Mul(networkFee).TruncateInt64()) + treasuryReward := uint64(sdk.NewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.OperatingCost - treasuryReward - storageReward + totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) @@ -310,9 +326,9 @@ var _ = Describe("msg_server_claim_commission_rewards.go", Ordered, func() { pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) networkFee = s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward = uint64(sdk.NewDec(int64(pool.OperatingCost)).Mul(networkFee).TruncateInt64()) + treasuryReward = uint64(sdk.NewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) storageReward = uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) - totalUploaderReward = pool.OperatingCost - treasuryReward - storageReward + totalUploaderReward = pool.InflationShareWeight - treasuryReward - storageReward uploaderPayoutReward = uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) From 0c0cec8eac11b7d7dd7e3c05b36581712a9500f5 Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 3 Oct 2023 15:33:09 +0200 Subject: [PATCH 055/109] chore: refactor x/query --- app/app.go | 1 + x/query/keeper/grpc_account_funded.go | 38 ++++---- x/query/keeper/grpc_query_pool.go | 2 +- x/query/keeper/helper.go | 36 ++++---- x/query/keeper/keeper.go | 4 + x/query/types/query.pb.go | 123 +++++++++++++------------- 6 files changed, 109 insertions(+), 95 deletions(-) diff --git a/app/app.go b/app/app.go index c8e432df..449cc89f 100644 --- a/app/app.go +++ b/app/app.go @@ -659,6 +659,7 @@ func NewKYVEApp( app.GlobalKeeper, *app.GovKeeper, app.TeamKeeper, + app.FundersKeeper, ) // this line is used by starport scaffolding # stargate/app/keeperDefinition diff --git a/x/query/keeper/grpc_account_funded.go b/x/query/keeper/grpc_account_funded.go index ed30e273..5ffe02ee 100644 --- a/x/query/keeper/grpc_account_funded.go +++ b/x/query/keeper/grpc_account_funded.go @@ -19,27 +19,29 @@ func (k Keeper) AccountFundedList(goCtx context.Context, req *types.QueryAccount pools := k.poolKeeper.GetAllPools(ctx) - for i := range pools { - pool := pools[i] - // TODO(rapha): fix this - //amount := pool.GetFunderAmount(req.Address) - amount := uint64(0) + for _, pool := range pools { + funding, found := k.fundersKeeper.GetFunding(ctx, req.Address, pool.Id) + if !found { + return nil, status.Error(codes.Internal, "funding not found") + } + fundingState, found := k.fundersKeeper.GetFundingState(ctx, pool.Id) + if !found { + return nil, status.Error(codes.Internal, "funding state not found") + } - if amount > 0 { + if funding.Amount > 0 { funded = append(funded, types.Funded{ - Amount: amount, + Amount: funding.Amount, Pool: &types.BasicPool{ - Id: pool.Id, - Name: pool.Name, - Runtime: pool.Runtime, - Logo: pool.Logo, - OperatingCost: pool.OperatingCost, - UploadInterval: pool.UploadInterval, - // TODO(rapha): fix this - TotalFunds: 0, - //TotalFunds: pool.TotalFunds, - TotalDelegation: k.delegationKeeper.GetDelegationOfPool(ctx, pool.Id), - Status: k.GetPoolStatus(ctx, &pool), + Id: pool.Id, + Name: pool.Name, + Runtime: pool.Runtime, + Logo: pool.Logo, + InflationShareWeight: pool.InflationShareWeight, + UploadInterval: pool.UploadInterval, + TotalFunds: fundingState.TotalAmount, + TotalDelegation: k.delegationKeeper.GetDelegationOfPool(ctx, pool.Id), + Status: k.GetPoolStatus(ctx, &pool, &fundingState), }, }) } diff --git a/x/query/keeper/grpc_query_pool.go b/x/query/keeper/grpc_query_pool.go index 71c692c1..0f2ad33b 100644 --- a/x/query/keeper/grpc_query_pool.go +++ b/x/query/keeper/grpc_query_pool.go @@ -70,7 +70,7 @@ func (k Keeper) parsePoolResponse(ctx sdk.Context, pool *poolTypes.Pool) types.P Stakers: stakers, TotalSelfDelegation: totalSelfDelegation, TotalDelegation: totalDelegation, - Status: k.GetPoolStatus(ctx, pool), + Status: k.GetPoolStatus(ctx, pool, nil), Account: poolAccount.String(), AccountBalance: poolBalance, } diff --git a/x/query/keeper/helper.go b/x/query/keeper/helper.go index c0359469..4558f999 100644 --- a/x/query/keeper/helper.go +++ b/x/query/keeper/helper.go @@ -1,6 +1,7 @@ package keeper import ( + funderstypes "github.com/KYVENetwork/chain/x/funders/types" globalTypes "github.com/KYVENetwork/chain/x/global/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" "github.com/KYVENetwork/chain/x/query/types" @@ -37,6 +38,7 @@ func (k Keeper) GetFullStaker(ctx sdk.Context, stakerAddress string) *types.Full for _, valaccount := range k.stakerKeeper.GetValaccountsFromStaker(ctx, staker.Address) { pool, _ := k.poolKeeper.GetPool(ctx, valaccount.PoolId) + fundingState, _ := k.fundersKeeper.GetFundingState(ctx, valaccount.PoolId) accountValaddress, _ := sdk.AccAddressFromBech32(valaccount.Valaddress) balanceValaccount := k.bankKeeper.GetBalance(ctx, accountValaddress, globalTypes.Denom).Amount.Uint64() @@ -44,16 +46,15 @@ func (k Keeper) GetFullStaker(ctx sdk.Context, stakerAddress string) *types.Full poolMemberships = append( poolMemberships, &types.PoolMembership{ Pool: &types.BasicPool{ - Id: pool.Id, - Name: pool.Name, - Runtime: pool.Runtime, - Logo: pool.Logo, - OperatingCost: pool.OperatingCost, - UploadInterval: pool.UploadInterval, - // TODO(rapha): fix this - //TotalFunds: pool.TotalFunds, - TotalDelegation: k.delegationKeeper.GetDelegationOfPool(ctx, pool.Id), - Status: k.GetPoolStatus(ctx, &pool), + Id: pool.Id, + Name: pool.Name, + Runtime: pool.Runtime, + Logo: pool.Logo, + InflationShareWeight: pool.InflationShareWeight, + UploadInterval: pool.UploadInterval, + TotalFunds: fundingState.TotalAmount, + TotalDelegation: k.delegationKeeper.GetDelegationOfPool(ctx, pool.Id), + Status: k.GetPoolStatus(ctx, &pool, &fundingState), }, Points: valaccount.Points, IsLeaving: valaccount.IsLeaving, @@ -82,22 +83,27 @@ func (k Keeper) GetFullStaker(ctx sdk.Context, stakerAddress string) *types.Full } } -func (k Keeper) GetPoolStatus(ctx sdk.Context, pool *pooltypes.Pool) pooltypes.PoolStatus { +func (k Keeper) GetPoolStatus(ctx sdk.Context, pool *pooltypes.Pool, fundingState *funderstypes.FundingState) pooltypes.PoolStatus { totalDelegation := k.delegationKeeper.GetDelegationOfPool(ctx, pool.Id) var poolStatus pooltypes.PoolStatus + poolStatus = pooltypes.POOL_STATUS_ACTIVE if pool.UpgradePlan.ScheduledAt > 0 && uint64(ctx.BlockTime().Unix()) >= pool.UpgradePlan.ScheduledAt { poolStatus = pooltypes.POOL_STATUS_UPGRADING } else if pool.Disabled { poolStatus = pooltypes.POOL_STATUS_DISABLED } else if totalDelegation < pool.MinDelegation { poolStatus = pooltypes.POOL_STATUS_NOT_ENOUGH_DELEGATION - // TODO(rapha): fix this - //} else if pool.TotalFunds == 0 { - // poolStatus = pooltypes.POOL_STATUS_NO_FUNDS } else { - poolStatus = pooltypes.POOL_STATUS_ACTIVE + // Get funding state if not provided + if fundingState == nil { + fs, _ := k.fundersKeeper.GetFundingState(ctx, pool.Id) + fundingState = &fs + } + if fundingState.TotalAmount == 0 { + poolStatus = pooltypes.POOL_STATUS_NO_FUNDS + } } return poolStatus diff --git a/x/query/keeper/keeper.go b/x/query/keeper/keeper.go index 570911f4..2ea59f71 100644 --- a/x/query/keeper/keeper.go +++ b/x/query/keeper/keeper.go @@ -2,6 +2,7 @@ package keeper import ( "fmt" + fundersKeeper "github.com/KYVENetwork/chain/x/funders/keeper" globalKeeper "github.com/KYVENetwork/chain/x/global/keeper" teamKeeper "github.com/KYVENetwork/chain/x/team/keeper" @@ -41,6 +42,7 @@ type ( globalKeeper globalKeeper.Keeper govKeeper govkeeper.Keeper teamKeeper teamKeeper.Keeper + fundersKeeper fundersKeeper.Keeper } ) @@ -60,6 +62,7 @@ func NewKeeper( globalKeeper globalKeeper.Keeper, govKeeper govkeeper.Keeper, teamKeeper teamKeeper.Keeper, + fundersKeeper fundersKeeper.Keeper, ) *Keeper { return &Keeper{ cdc: cdc, @@ -77,6 +80,7 @@ func NewKeeper( globalKeeper: globalKeeper, govKeeper: govKeeper, teamKeeper: teamKeeper, + fundersKeeper: fundersKeeper, } } diff --git a/x/query/types/query.pb.go b/x/query/types/query.pb.go index 24b741e6..1ebb132a 100644 --- a/x/query/types/query.pb.go +++ b/x/query/types/query.pb.go @@ -37,8 +37,8 @@ type BasicPool struct { Runtime string `protobuf:"bytes,3,opt,name=runtime,proto3" json:"runtime,omitempty"` // logo of the pool Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` - // operating_cost is the base payout for each bundle reward - OperatingCost uint64 `protobuf:"varint,5,opt,name=operating_cost,json=operatingCost,proto3" json:"operating_cost,omitempty"` + // inflation_share_weight is the base payout for each bundle reward + InflationShareWeight uint64 `protobuf:"varint,5,opt,name=inflation_share_weight,json=inflationShareWeight,proto3" json:"inflation_share_weight,omitempty"` // upload_interval is the interval bundles get created UploadInterval uint64 `protobuf:"varint,6,opt,name=upload_interval,json=uploadInterval,proto3" json:"upload_interval,omitempty"` // total_funds of the pool. If the pool runs @@ -112,9 +112,9 @@ func (m *BasicPool) GetLogo() string { return "" } -func (m *BasicPool) GetOperatingCost() uint64 { +func (m *BasicPool) GetInflationShareWeight() uint64 { if m != nil { - return m.OperatingCost + return m.InflationShareWeight } return 0 } @@ -520,56 +520,57 @@ func init() { func init() { proto.RegisterFile("kyve/query/v1beta1/query.proto", fileDescriptor_6b41255feae93a15) } var fileDescriptor_6b41255feae93a15 = []byte{ - // 782 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x41, 0x8f, 0xe3, 0x34, - 0x14, 0xc7, 0x9b, 0xb6, 0xd3, 0x6d, 0x5f, 0xd9, 0x16, 0x2c, 0x60, 0xb3, 0x23, 0x36, 0x33, 0x2a, - 0x82, 0x9d, 0x45, 0xda, 0x54, 0x33, 0x08, 0x09, 0x71, 0xe0, 0x30, 0xed, 0xae, 0x84, 0x60, 0x57, - 0xc8, 0x08, 0x24, 0xb8, 0x44, 0x6e, 0xe2, 0x4d, 0xad, 0x26, 0x76, 0xb0, 0x9d, 0x0e, 0xfd, 0x0c, - 0x70, 0xe0, 0xa3, 0x70, 0xe0, 0x43, 0xec, 0x71, 0x8e, 0xc0, 0x61, 0x84, 0x66, 0xbe, 0x08, 0xb2, - 0x9d, 0x64, 0xda, 0xa1, 0xdc, 0x38, 0x25, 0xef, 0xff, 0xfe, 0x79, 0xb1, 0x7f, 0xef, 0xd9, 0x10, - 0xac, 0x36, 0x6b, 0x3a, 0xfd, 0xb1, 0xa4, 0x72, 0x33, 0x5d, 0x9f, 0x2e, 0xa8, 0x26, 0xa7, 0x2e, - 0x0a, 0x0b, 0x29, 0xb4, 0x40, 0xc8, 0xe4, 0x43, 0xa7, 0x54, 0xf9, 0xc3, 0xb7, 0x53, 0x91, 0x0a, - 0x9b, 0x9e, 0x9a, 0x37, 0x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0x19, 0x25, 0x6b, 0x73, 0x6a, 0xcc, 0x00, 0xf4, 0xf1, 0x80, - 0xa9, 0xaf, 0x9c, 0x80, 0x02, 0x80, 0x35, 0xc9, 0xea, 0x93, 0xee, 0x86, 0x60, 0x4b, 0x31, 0xbd, - 0x5d, 0x90, 0x8c, 0xf0, 0x98, 0x56, 0xc7, 0xa7, 0x0e, 0xcf, 0xe7, 0xaf, 0xaf, 0x03, 0xef, 0xf2, - 0x3a, 0xf0, 0xfe, 0xbe, 0x0e, 0xbc, 0x5f, 0x6f, 0x82, 0xd6, 0xe5, 0x4d, 0xd0, 0xfa, 0xe3, 0x26, - 0x68, 0xfd, 0xf0, 0xd1, 0x16, 0xa9, 0x2f, 0xbf, 0xff, 0xee, 0xd9, 0x4b, 0xaa, 0x2f, 0x84, 0x5c, - 0x4d, 0xe3, 0x25, 0x61, 0x7c, 0xfa, 0x53, 0x75, 0xfd, 0x5b, 0x62, 0x8b, 0x9e, 0xbd, 0xaf, 0x3f, - 0xfe, 0x27, 0x00, 0x00, 0xff, 0xff, 0x50, 0x8f, 0x9d, 0x37, 0x19, 0x06, 0x00, 0x00, + // 790 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0xda, 0x4e, 0x1a, 0xbf, 0x80, 0x03, 0xa3, 0xd2, 0x6e, 0x23, 0xba, 0x89, 0x8c, 0x44, + 0x53, 0xa4, 0xae, 0x95, 0x00, 0x12, 0xe2, 0xc0, 0x21, 0x49, 0x2b, 0x21, 0x68, 0x85, 0xa6, 0x02, + 0x04, 0x97, 0xd5, 0x78, 0xf7, 0x65, 0x3d, 0xf2, 0xee, 0x8c, 0x99, 0x99, 0xb5, 0xf1, 0x6f, 0x80, + 0x03, 0x3f, 0x86, 0x3b, 0xd7, 0x1e, 0x7b, 0x04, 0x0e, 0x15, 0x4a, 0xf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xf0, 0xde, 0xc6, 0x1d, 0xde, + 0x78, 0x51, 0x3e, 0x80, 0xb7, 0x53, 0x85, 0xbe, 0x75, 0x33, 0x66, 0xfc, 0x03, 0xd4, 0xa5, 0x6f, + 0x35, 0xe0, 0x05, 0x33, 0x38, 0xfc, 0x3d, 0x80, 0xc1, 0x7a, 0xdb, 0x90, 0x13, 0xe8, 0xd9, 0xc6, + 0x71, 0x27, 0xd8, 0x6b, 0x06, 0x78, 0xdd, 0xa2, 0xf6, 0xb1, 0xa3, 0x4e, 0x4a, 0xee, 0xc0, 0xce, + 0x4c, 0x72, 0x61, 0xb4, 0xdb, 0xa3, 0x47, 0xeb, 0x88, 0xdc, 0x07, 0xe0, 0x3a, 0x29, 0x90, 0xcd, + 0xed, 0xd4, 0xd8, 0x06, 0xd8, 0xa5, 0x7d, 0xae, 0xbf, 0xf6, 0x00, 0x89, 0x00, 0xe6, 0xac, 0x68, + 0x26, 0xdd, 0x37, 0xc1, 0x0a, 0x62, 0x6b, 0x3b, 0x66, 0x05, 0x13, 0x29, 0xd6, 0xe3, 0xd3, 0x84, + 0x67, 0x17, 0x2f, 0xae, 0xa2, 0xe0, 0xe5, 0x55, 0x14, 0xfc, 0x73, 0x15, 0x05, 0xbf, 0x5d, 0x47, + 0x5b, 0x2f, 0xaf, 0xa3, 0xad, 0x3f, 0xaf, 0xa3, 0xad, 0x1f, 0x3f, 0x5a, 0x71, 0xea, 0xab, 0x1f, + 0xbe, 0x7b, 0xfc, 0x0c, 0xcd, 0x42, 0xaa, 0xe9, 0x28, 0x9d, 0x30, 0x2e, 0x46, 0x3f, 0xd7, 0xff, + 0x06, 0xce, 0xb1, 0xf1, 0x8e, 0x7b, 0xbe, 0x3f, 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, 0x52, 0x8f, + 0x3f, 0x0f, 0x28, 0x06, 0x00, 0x00, } func (m *BasicPool) Marshal() (dAtA []byte, err error) { @@ -612,8 +613,8 @@ func (m *BasicPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x30 } - if m.OperatingCost != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.OperatingCost)) + if m.InflationShareWeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.InflationShareWeight)) i-- dAtA[i] = 0x28 } @@ -939,8 +940,8 @@ func (m *BasicPool) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - if m.OperatingCost != 0 { - n += 1 + sovQuery(uint64(m.OperatingCost)) + if m.InflationShareWeight != 0 { + n += 1 + sovQuery(uint64(m.InflationShareWeight)) } if m.UploadInterval != 0 { n += 1 + sovQuery(uint64(m.UploadInterval)) @@ -1222,9 +1223,9 @@ func (m *BasicPool) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 5: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatingCost", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InflationShareWeight", wireType) } - m.OperatingCost = 0 + m.InflationShareWeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1234,7 +1235,7 @@ func (m *BasicPool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.OperatingCost |= uint64(b&0x7F) << shift + m.InflationShareWeight |= uint64(b&0x7F) << shift if b < 0x80 { break } From 596109652af0b243c5a35fb81553a3314dd7436e Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 3 Oct 2023 15:34:20 +0200 Subject: [PATCH 056/109] fix: tests in x/query --- .../keeper/grpc_account_redelegation_test.go | 29 +++++++++---------- x/query/keeper/grpc_query_can_propose_test.go | 28 +++++++++++------- .../keeper/grpc_query_can_validate_test.go | 22 +++++--------- x/query/keeper/grpc_query_can_vote_test.go | 28 +++++++++++------- 4 files changed, 57 insertions(+), 50 deletions(-) diff --git a/x/query/keeper/grpc_account_redelegation_test.go b/x/query/keeper/grpc_account_redelegation_test.go index 1e8f1d9c..c8f26a88 100644 --- a/x/query/keeper/grpc_account_redelegation_test.go +++ b/x/query/keeper/grpc_account_redelegation_test.go @@ -28,14 +28,22 @@ var _ = Describe("grpc_account_redelegation.go", Ordered, func() { BeforeEach(func() { s = i.NewCleanChain() - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "T", + // create 2 pools + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, MinDelegation: 200 * i.KYVE, UploadInterval: 60, MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{}, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + Binaries: "{}", + } + s.RunTxPoolSuccess(msg) + s.RunTxPoolSuccess(msg) + + // disable second pool + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 1) + pool.Disabled = true + s.App().PoolKeeper.SetPool(s.Ctx(), pool) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, @@ -47,17 +55,6 @@ var _ = Describe("grpc_account_redelegation.go", Ordered, func() { Amount: 100 * i.KYVE, }) - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "DisabledPool", - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - Disabled: true, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, PoolId: 0, diff --git a/x/query/keeper/grpc_query_can_propose_test.go b/x/query/keeper/grpc_query_can_propose_test.go index 963a1983..a828d400 100644 --- a/x/query/keeper/grpc_query_can_propose_test.go +++ b/x/query/keeper/grpc_query_can_propose_test.go @@ -5,6 +5,7 @@ import ( i "github.com/KYVENetwork/chain/testutil/integration" bundletypes "github.com/KYVENetwork/chain/x/bundles/types" delegationtypes "github.com/KYVENetwork/chain/x/delegation/types" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" querytypes "github.com/KYVENetwork/chain/x/query/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" @@ -38,19 +39,26 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { BeforeEach(func() { s = i.NewCleanChain() - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, MinDelegation: 200 * i.KYVE, UploadInterval: 60, MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{}, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + Binaries: "{}", + } + s.RunTxPoolSuccess(msg) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + Moniker: "Alice", + }) + + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ @@ -518,9 +526,9 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { It("Call can propose on an active pool without funds as the next uploader with valid args", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgDefundPool{ + s.RunTxPoolSuccess(&funderstypes.MsgDefundPool{ Creator: i.ALICE, - Id: 0, + PoolId: 0, Amount: 100 * i.KYVE, }) diff --git a/x/query/keeper/grpc_query_can_validate_test.go b/x/query/keeper/grpc_query_can_validate_test.go index 89a49c41..f778e81d 100644 --- a/x/query/keeper/grpc_query_can_validate_test.go +++ b/x/query/keeper/grpc_query_can_validate_test.go @@ -29,14 +29,17 @@ var _ = Describe("grpc_query_can_validate.go", Ordered, func() { BeforeEach(func() { s = i.NewCleanChain() - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", + // create 2 pools + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, MinDelegation: 200 * i.KYVE, UploadInterval: 60, MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{}, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + Binaries: "{}", + } + s.RunTxPoolSuccess(msg) + s.RunTxPoolSuccess(msg) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, @@ -50,15 +53,6 @@ var _ = Describe("grpc_query_can_validate.go", Ordered, func() { Amount: 0, }) - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "Test Pool2", - MinDelegation: 200 * i.KYVE, - UploadInterval: 60, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{}, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_1, Amount: 100 * i.KYVE, diff --git a/x/query/keeper/grpc_query_can_vote_test.go b/x/query/keeper/grpc_query_can_vote_test.go index 1b18563b..0cd228e8 100644 --- a/x/query/keeper/grpc_query_can_vote_test.go +++ b/x/query/keeper/grpc_query_can_vote_test.go @@ -5,6 +5,7 @@ import ( i "github.com/KYVENetwork/chain/testutil/integration" bundletypes "github.com/KYVENetwork/chain/x/bundles/types" delegationtypes "github.com/KYVENetwork/chain/x/delegation/types" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" querytypes "github.com/KYVENetwork/chain/x/query/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" @@ -39,19 +40,26 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { BeforeEach(func() { s = i.NewCleanChain() - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, MinDelegation: 200 * i.KYVE, UploadInterval: 60, MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{}, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + Binaries: "{}", + } + s.RunTxPoolSuccess(msg) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ + s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, + Moniker: "Alice", + }) + + s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, }) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ @@ -467,9 +475,9 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { It("Call can vote on an active pool with no funds and a data bundle with valid args", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgDefundPool{ + s.RunTxPoolSuccess(&funderstypes.MsgDefundPool{ Creator: i.ALICE, - Id: 0, + PoolId: 0, Amount: 100 * i.KYVE, }) From cd57ba51e69ddf2f9f6cd9fb303b5e8bd195b982 Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 3 Oct 2023 15:59:13 +0200 Subject: [PATCH 057/109] fix: tests in x/stakers --- x/stakers/keeper/exported_functions_test.go | 21 +++-- x/stakers/keeper/msg_server_join_pool_test.go | 87 +++++++++---------- .../keeper/msg_server_leave_pool_test.go | 33 ++++--- 3 files changed, 66 insertions(+), 75 deletions(-) diff --git a/x/stakers/keeper/exported_functions_test.go b/x/stakers/keeper/exported_functions_test.go index 3bb9fa44..05acfa2c 100644 --- a/x/stakers/keeper/exported_functions_test.go +++ b/x/stakers/keeper/exported_functions_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + pooltypes "github.com/KYVENetwork/chain/x/pool/types" "strconv" kyveApp "github.com/KYVENetwork/chain/app" @@ -14,8 +15,7 @@ import ( delegationTypes "github.com/KYVENetwork/chain/x/delegation/types" // Gov govTypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - // Pool - poolTypes "github.com/KYVENetwork/chain/x/pool/types" + // Stakers stakersTypes "github.com/KYVENetwork/chain/x/stakers/types" ) @@ -56,15 +56,14 @@ var _ = Describe("Protocol Governance Voting", Ordered, func() { _ = s.RunTxSuccess(createTx) // Create and join a pool. - s.App().PoolKeeper.AppendPool(s.Ctx(), poolTypes.Pool{ - Name: "Cosmos Hub", - Protocol: &poolTypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &poolTypes.UpgradePlan{}, - }) + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + Binaries: "{}", + } + s.RunTxPoolSuccess(msg) joinTx := &stakersTypes.MsgJoinPool{ Creator: i.ALICE, diff --git a/x/stakers/keeper/msg_server_join_pool_test.go b/x/stakers/keeper/msg_server_join_pool_test.go index 841327b5..47f99a6a 100644 --- a/x/stakers/keeper/msg_server_join_pool_test.go +++ b/x/stakers/keeper/msg_server_join_pool_test.go @@ -46,20 +46,20 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { initialBalanceStaker1 := uint64(0) initialBalanceValaddress1 := uint64(0) + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + BeforeEach(func() { // init new clean chain s = i.NewCleanChain() // create pool - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + Binaries: "{}", + } + s.RunTxPoolSuccess(msg) // create staker s.RunTxStakersSuccess(&stakerstypes.MsgCreateStaker{ @@ -174,16 +174,17 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { It("Join disabled pool", func() { // ARRANGE - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "DisabledPool", - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - Disabled: true, - }) + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + Binaries: "{}", + } + s.RunTxPoolSuccess(msg) + + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 1) + pool.Disabled = true + s.App().PoolKeeper.SetPool(s.Ctx(), pool) // ACT _, err := s.RunTx(&stakerstypes.MsgJoinPool{ @@ -392,15 +393,13 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { Amount: 100 * i.KYVE, }) - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "Test Pool2", - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + Binaries: "{}", + } + s.RunTxPoolSuccess(msg) // ACT s.RunTxStakersError(&stakerstypes.MsgJoinPool{ @@ -417,15 +416,13 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { It("Try to join pool with a valaddress that is already used by another staker", func() { // ARRANGE - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "Test Pool2", - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + Binaries: "{}", + } + s.RunTxPoolSuccess(msg) s.RunTxStakersSuccess(&stakerstypes.MsgCreateStaker{ Creator: i.STAKER_1, @@ -488,15 +485,13 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { Amount: 100 * i.KYVE, }) - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "Test Pool2", - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + Binaries: "{}", + } + s.RunTxPoolSuccess(msg) // ACT s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ diff --git a/x/stakers/keeper/msg_server_leave_pool_test.go b/x/stakers/keeper/msg_server_leave_pool_test.go index bc05b851..788ca95e 100644 --- a/x/stakers/keeper/msg_server_leave_pool_test.go +++ b/x/stakers/keeper/msg_server_leave_pool_test.go @@ -23,21 +23,20 @@ TEST CASES - msg_server_leave_pool.go var _ = Describe("msg_server_leave_pool.go", Ordered, func() { s := i.NewCleanChain() + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() BeforeEach(func() { // init new clean chain s = i.NewCleanChain() // create pool - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + Binaries: "{}", + } + s.RunTxPoolSuccess(msg) // create staker s.RunTxStakersSuccess(&stakerstypes.MsgCreateStaker{ @@ -208,15 +207,13 @@ var _ = Describe("msg_server_leave_pool.go", Ordered, func() { It("Leave one of multiple pools a staker has previously joined", func() { // ARRANGE - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + Binaries: "{}", + } + s.RunTxPoolSuccess(msg) s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ Creator: i.STAKER_0, From 01b999f78dc927b5c4965cb950497a30de2f4a8e Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 4 Oct 2023 08:58:47 +0200 Subject: [PATCH 058/109] fix: integration checks --- testutil/integration/checks.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/testutil/integration/checks.go b/testutil/integration/checks.go index ff296672..7b9e08e5 100644 --- a/testutil/integration/checks.go +++ b/testutil/integration/checks.go @@ -552,11 +552,14 @@ func (suite *KeeperTestSuite) verifyFullStaker(fullStaker querytypes.FullStaker, Expect(found).To(BeTrue()) Expect(poolMembership.Pool.Id).To(Equal(pool.Id)) Expect(poolMembership.Pool.Logo).To(Equal(pool.Logo)) - //TODO(rapha): fix this - //Expect(poolMembership.Pool.TotalFunds).To(Equal(pool.TotalFunds)) + + fundingState, found := suite.App().FundersKeeper.GetFundingState(suite.Ctx(), poolMembership.Pool.Id) + Expect(found).To(BeTrue()) + Expect(poolMembership.Pool.TotalFunds).To(Equal(fundingState.TotalAmount)) Expect(poolMembership.Pool.Name).To(Equal(pool.Name)) Expect(poolMembership.Pool.Runtime).To(Equal(pool.Runtime)) - Expect(poolMembership.Pool.Status).To(Equal(suite.App().QueryKeeper.GetPoolStatus(suite.Ctx(), &pool))) + Expect(poolMembership.Pool.Status).To(Equal(suite.App().QueryKeeper.GetPoolStatus(suite.Ctx(), &pool, &fundingState))) + Expect(poolMembership.Pool.Status).To(Equal(suite.App().QueryKeeper.GetPoolStatus(suite.Ctx(), &pool, nil))) } // Reverse check the pool memberships From 7cf0b693b6abedb8d929ca3e214079f3ea77f88e Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 4 Oct 2023 09:53:23 +0200 Subject: [PATCH 059/109] chore: add some comments --- x/funders/keeper/msg_server_create_funder_test.go | 1 + x/funders/keeper/msg_server_fund_pool.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/x/funders/keeper/msg_server_create_funder_test.go b/x/funders/keeper/msg_server_create_funder_test.go index 47059506..1f2ffb32 100644 --- a/x/funders/keeper/msg_server_create_funder_test.go +++ b/x/funders/keeper/msg_server_create_funder_test.go @@ -97,6 +97,7 @@ var _ = Describe("msg_server_create_funder.go", Ordered, func() { }) }) + // TODO: should this be allowed? PIt("Create two funders with the same moniker", func() { // ARRANGE moniker := "moniker" diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go index 07d7585c..ef2b3b51 100644 --- a/x/funders/keeper/msg_server_fund_pool.go +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -39,6 +39,7 @@ func (k msgServer) defundLowestFunding( // If the funders list is full, it checks if the funder wants to fund // more than the current lowest funder. If so, the current lowest funder // will get their tokens back and removed form the active funders list. +// TODO: what if amount_per_bundle is higher than the amount? A funder that knows that he is the next uploader could just fund a huge amount which gets payed to only himself. func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*types.MsgFundPoolResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) @@ -123,6 +124,9 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ err := k.defundLowestFunding(ctx, defunding, &fundingState, msg.PoolId) if err != nil { // TODO: should we panic here? + // This can only happen if: + // - we don't have enough funds which would be a corrupt state + // - the funder address is being blacklisted util.PanicHalt(k.upgradeKeeper, ctx, err.Error()) } } From 04f0699640fe338cb2285cb080d2bc6259086125 Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 4 Oct 2023 10:41:09 +0200 Subject: [PATCH 060/109] feat: add funders queries --- proto/kyve/query/v1beta1/funders.proto | 107 ++ x/funders/keeper/getters_funder.go | 38 + x/funders/keeper/getters_funding.go | 16 + x/funders/types/keys.go | 5 + x/query/keeper/grpc_query.go | 1 + x/query/keeper/grpc_query_funder.go | 89 + x/query/types/funders.pb.go | 2355 ++++++++++++++++++++++++ x/query/types/funders.pb.gw.go | 290 +++ 8 files changed, 2901 insertions(+) create mode 100644 proto/kyve/query/v1beta1/funders.proto create mode 100644 x/query/keeper/grpc_query_funder.go create mode 100644 x/query/types/funders.pb.go create mode 100644 x/query/types/funders.pb.gw.go diff --git a/proto/kyve/query/v1beta1/funders.proto b/proto/kyve/query/v1beta1/funders.proto new file mode 100644 index 00000000..54100c07 --- /dev/null +++ b/proto/kyve/query/v1beta1/funders.proto @@ -0,0 +1,107 @@ +syntax = "proto3"; + +package kyve.query.v1beta1; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; + +option go_package = "github.com/KYVENetwork/chain/x/query/types"; + +// QueryFunders ... +service QueryFunders { + // Funders queries all funders. + rpc Funders(QueryFundersRequest) returns (QueryFundersResponse) { + option (google.api.http).get = "/kyve/query/v1beta1/funders"; + } + // Funder queries a funder by address. + rpc Funder(QueryFunderRequest) returns (QueryFunderResponse) { + option (google.api.http).get = "/kyve/query/v1beta1/funder/{address}"; + } +} + +// =============== +// Common messages +// =============== + +// Funder ... +message Funder { + // address ... + string address = 1; + // moniker ... + string moniker = 2; + // identity is the 64 bit keybase.io identity string + string identity = 3; + // logo ... + string logo = 4; + // website ... + string website = 5; + // contact ... + string contact = 6; + // description ... + string description = 7; +} + +// FunderStats ... +message FunderStats { + // total_used_funds are the total funds that have been distributed by the funder. + uint64 total_used_funds = 1; + // total_allocated_funds are the total funds that have been allocated by the funder. They can either get distributed or refunded. + uint64 total_allocated_funds = 2; + // pools_funded are the ids of the pools that have been funded by the funder. + repeated uint64 pools_funded = 3; +} + +// Funding ... +message Funding { + // pool_id ... + uint64 pool_id = 1; + // amount ... + uint64 amount = 2; + // amount_per_bundle ... + uint64 amount_per_bundle = 3; + // total_funded ... + uint64 total_funded = 4; +} + +// ======== +// /funders +// ======== + +// QueryFundersRequest is the request type for the Query/Funders RPC method. +message QueryFundersRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; + // search ... + string search = 2; +} + +// QueryFundersResponse is the response type for the Query/Funders RPC method. +message QueryFundersResponse { + // funders ... + repeated Funder funders = 1 [(gogoproto.nullable) = false]; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// ============ +// /funder/{id} +// ============ + +// QueryFunderRequest is the request type for the Query/Funder RPC method. +message QueryFunderRequest { + // address ... + string address = 1; + // with_inactive_fundings ... + bool with_inactive_fundings = 2; +} + +// QueryFunderResponse is the response type for the Query/Funder RPC method. +message QueryFunderResponse { + // funder ... + Funder funder = 1; + // fundings ... + repeated Funding fundings = 2 [(gogoproto.nullable) = false]; + // stats ... + FunderStats stats = 3; +} diff --git a/x/funders/keeper/getters_funder.go b/x/funders/keeper/getters_funder.go index 16d0aa95..d9cdf98b 100644 --- a/x/funders/keeper/getters_funder.go +++ b/x/funders/keeper/getters_funder.go @@ -4,6 +4,10 @@ import ( "github.com/KYVENetwork/chain/x/funders/types" "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" + "strings" ) // DoesFunderExist checks if the funding exists @@ -51,3 +55,37 @@ func (k Keeper) SetFunder(ctx sdk.Context, funder *types.Funder) { funder.Address, ), b) } + +// GetPaginatedFundersQuery performs a full search on all funders with the given parameters. +func (k Keeper) GetPaginatedFundersQuery( + ctx sdk.Context, + pagination *query.PageRequest, + search string, +) ([]types.Funder, *query.PageResponse, error) { + var funders []types.Funder + + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FunderKeyPrefix) + + pageRes, err := query.FilteredPaginate(store, pagination, func(key []byte, value []byte, accumulate bool) (bool, error) { + var funder types.Funder + if err := k.cdc.Unmarshal(value, &funder); err != nil { + return false, err + } + + // filter search + if !strings.Contains(strings.ToLower(funder.Moniker), strings.ToLower(search)) { + return false, nil + } + + if accumulate { + funders = append(funders, funder) + } + + return true, nil + }) + if err != nil { + return nil, nil, status.Error(codes.Internal, err.Error()) + } + + return funders, pageRes, nil +} diff --git a/x/funders/keeper/getters_funding.go b/x/funders/keeper/getters_funding.go index c8f9ca11..db5f48e8 100644 --- a/x/funders/keeper/getters_funding.go +++ b/x/funders/keeper/getters_funding.go @@ -28,6 +28,22 @@ func (k Keeper) GetFunding(ctx sdk.Context, funderAddress string, poolId uint64) return funding, true } +// GetFundingsOfFunder returns all fundings of a funder +func (k Keeper) GetFundingsOfFunder(ctx sdk.Context, funderAddress string) (fundings []types.Funding) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingKeyPrefixByFunder) + + iterator := sdk.KVStorePrefixIterator(store, types.FundingKeyByFunderIter(funderAddress)) + //goland:noinspection GoUnhandledErrorResult + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var funding types.Funding + k.cdc.MustUnmarshal(iterator.Value(), &funding) + fundings = append(fundings, funding) + } + return fundings +} + // GetFundingsOfPool returns all fundings of a pool func (k Keeper) GetFundingsOfPool(ctx sdk.Context, poolId uint64) (fundings []types.Funding) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.FundingKeyPrefixByPool) diff --git a/x/funders/types/keys.go b/x/funders/types/keys.go index 9010c806..24b69fc9 100644 --- a/x/funders/types/keys.go +++ b/x/funders/types/keys.go @@ -55,6 +55,11 @@ func FundingKeyByPool(funderAddress string, poolId uint64) []byte { return util.GetByteKey(poolId, funderAddress) } +// FundingKeyByFunderIter is used to query all fundings for a funder +func FundingKeyByFunderIter(funderAddress string) []byte { + return util.GetByteKey(funderAddress) +} + // FundingKeyByPoolIter is used to query all fundings for a pool func FundingKeyByPoolIter(poolId uint64) []byte { return util.GetByteKey(poolId) diff --git a/x/query/keeper/grpc_query.go b/x/query/keeper/grpc_query.go index efa8a9d1..a7441bb7 100644 --- a/x/query/keeper/grpc_query.go +++ b/x/query/keeper/grpc_query.go @@ -11,4 +11,5 @@ var ( _ types.QueryDelegationServer = Keeper{} _ types.QueryBundlesServer = Keeper{} _ types.QueryParamsServer = Keeper{} + _ types.QueryFundersServer = Keeper{} ) diff --git a/x/query/keeper/grpc_query_funder.go b/x/query/keeper/grpc_query_funder.go new file mode 100644 index 00000000..89938b72 --- /dev/null +++ b/x/query/keeper/grpc_query_funder.go @@ -0,0 +1,89 @@ +package keeper + +import ( + "context" + fundersTypes "github.com/KYVENetwork/chain/x/funders/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/KYVENetwork/chain/x/query/types" +) + +func (k Keeper) Funders(c context.Context, req *types.QueryFundersRequest) (*types.QueryFundersResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + funders, pageRes, err := k.fundersKeeper.GetPaginatedFundersQuery(ctx, req.Pagination, req.Search) + if err != nil { + return nil, err + } + + data := make([]types.Funder, 0) + for _, funder := range funders { + data = append(data, k.parseFunder(&funder)) + } + + return &types.QueryFundersResponse{Funders: data, Pagination: pageRes}, nil +} + +func (k Keeper) Funder(c context.Context, req *types.QueryFunderRequest) (*types.QueryFunderResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + funder, found := k.fundersKeeper.GetFunder(ctx, req.Address) + if !found { + return nil, errorsTypes.ErrKeyNotFound + } + funderData := k.parseFunder(&funder) + + totalUsedFunds := uint64(0) + totalAllocatedFunds := uint64(0) + poolsFunded := make([]uint64, 0) + + fundings := k.fundersKeeper.GetFundingsOfFunder(ctx, req.Address) + fundingsData := make([]types.Funding, 0) + for _, funding := range fundings { + if funding.Amount > 0 || req.WithInactiveFundings { + fundingsData = append(fundingsData, types.Funding{ + PoolId: funding.PoolId, + Amount: funding.Amount, + AmountPerBundle: funding.AmountPerBundle, + TotalFunded: funding.TotalFunded, + }) + } + totalUsedFunds += funding.TotalFunded + totalAllocatedFunds += funding.Amount + poolsFunded = append(poolsFunded, funding.PoolId) + } + + statsData := &types.FunderStats{ + TotalUsedFunds: totalUsedFunds, + TotalAllocatedFunds: totalAllocatedFunds, + PoolsFunded: poolsFunded, + } + + return &types.QueryFunderResponse{ + Funder: &funderData, + Fundings: fundingsData, + Stats: statsData, + }, nil +} + +func (k Keeper) parseFunder(funder *fundersTypes.Funder) types.Funder { + return types.Funder{ + Address: funder.Address, + Moniker: funder.Moniker, + Identity: funder.Identity, + Logo: funder.Logo, + Website: funder.Website, + Contact: funder.Contact, + Description: funder.Description, + } +} diff --git a/x/query/types/funders.pb.go b/x/query/types/funders.pb.go new file mode 100644 index 00000000..6bfd1862 --- /dev/null +++ b/x/query/types/funders.pb.go @@ -0,0 +1,2355 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/query/v1beta1/funders.proto + +package types + +import ( + context "context" + fmt "fmt" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Funder ... +type Funder struct { + // address ... + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // moniker ... + Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` + // identity is the 64 bit keybase.io identity string + Identity string `protobuf:"bytes,3,opt,name=identity,proto3" json:"identity,omitempty"` + // logo ... + Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` + // website ... + Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` + // contact ... + Contact string `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` + // description ... + Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"` +} + +func (m *Funder) Reset() { *m = Funder{} } +func (m *Funder) String() string { return proto.CompactTextString(m) } +func (*Funder) ProtoMessage() {} +func (*Funder) Descriptor() ([]byte, []int) { + return fileDescriptor_a182f068d9f0dba9, []int{0} +} +func (m *Funder) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Funder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Funder.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Funder) XXX_Merge(src proto.Message) { + xxx_messageInfo_Funder.Merge(m, src) +} +func (m *Funder) XXX_Size() int { + return m.Size() +} +func (m *Funder) XXX_DiscardUnknown() { + xxx_messageInfo_Funder.DiscardUnknown(m) +} + +var xxx_messageInfo_Funder proto.InternalMessageInfo + +func (m *Funder) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *Funder) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *Funder) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *Funder) GetLogo() string { + if m != nil { + return m.Logo + } + return "" +} + +func (m *Funder) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *Funder) GetContact() string { + if m != nil { + return m.Contact + } + return "" +} + +func (m *Funder) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +// FunderStats ... +type FunderStats struct { + // total_used_funds are the total funds that have been distributed by the funder. + TotalUsedFunds uint64 `protobuf:"varint,1,opt,name=total_used_funds,json=totalUsedFunds,proto3" json:"total_used_funds,omitempty"` + // total_allocated_funds are the total funds that have been allocated by the funder. They can either get distributed or refunded. + TotalAllocatedFunds uint64 `protobuf:"varint,2,opt,name=total_allocated_funds,json=totalAllocatedFunds,proto3" json:"total_allocated_funds,omitempty"` + // pools_funded are the ids of the pools that have been funded by the funder. + PoolsFunded []uint64 `protobuf:"varint,3,rep,packed,name=pools_funded,json=poolsFunded,proto3" json:"pools_funded,omitempty"` +} + +func (m *FunderStats) Reset() { *m = FunderStats{} } +func (m *FunderStats) String() string { return proto.CompactTextString(m) } +func (*FunderStats) ProtoMessage() {} +func (*FunderStats) Descriptor() ([]byte, []int) { + return fileDescriptor_a182f068d9f0dba9, []int{1} +} +func (m *FunderStats) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FunderStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FunderStats.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *FunderStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_FunderStats.Merge(m, src) +} +func (m *FunderStats) XXX_Size() int { + return m.Size() +} +func (m *FunderStats) XXX_DiscardUnknown() { + xxx_messageInfo_FunderStats.DiscardUnknown(m) +} + +var xxx_messageInfo_FunderStats proto.InternalMessageInfo + +func (m *FunderStats) GetTotalUsedFunds() uint64 { + if m != nil { + return m.TotalUsedFunds + } + return 0 +} + +func (m *FunderStats) GetTotalAllocatedFunds() uint64 { + if m != nil { + return m.TotalAllocatedFunds + } + return 0 +} + +func (m *FunderStats) GetPoolsFunded() []uint64 { + if m != nil { + return m.PoolsFunded + } + return nil +} + +// Funding ... +type Funding struct { + // pool_id ... + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // amount ... + Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` + // amount_per_bundle ... + AmountPerBundle uint64 `protobuf:"varint,3,opt,name=amount_per_bundle,json=amountPerBundle,proto3" json:"amount_per_bundle,omitempty"` + // total_funded ... + TotalFunded uint64 `protobuf:"varint,4,opt,name=total_funded,json=totalFunded,proto3" json:"total_funded,omitempty"` +} + +func (m *Funding) Reset() { *m = Funding{} } +func (m *Funding) String() string { return proto.CompactTextString(m) } +func (*Funding) ProtoMessage() {} +func (*Funding) Descriptor() ([]byte, []int) { + return fileDescriptor_a182f068d9f0dba9, []int{2} +} +func (m *Funding) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Funding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Funding.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Funding) XXX_Merge(src proto.Message) { + xxx_messageInfo_Funding.Merge(m, src) +} +func (m *Funding) XXX_Size() int { + return m.Size() +} +func (m *Funding) XXX_DiscardUnknown() { + xxx_messageInfo_Funding.DiscardUnknown(m) +} + +var xxx_messageInfo_Funding proto.InternalMessageInfo + +func (m *Funding) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *Funding) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +func (m *Funding) GetAmountPerBundle() uint64 { + if m != nil { + return m.AmountPerBundle + } + return 0 +} + +func (m *Funding) GetTotalFunded() uint64 { + if m != nil { + return m.TotalFunded + } + return 0 +} + +// QueryFundersRequest is the request type for the Query/Funders RPC method. +type QueryFundersRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` + // search ... + Search string `protobuf:"bytes,2,opt,name=search,proto3" json:"search,omitempty"` +} + +func (m *QueryFundersRequest) Reset() { *m = QueryFundersRequest{} } +func (m *QueryFundersRequest) String() string { return proto.CompactTextString(m) } +func (*QueryFundersRequest) ProtoMessage() {} +func (*QueryFundersRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a182f068d9f0dba9, []int{3} +} +func (m *QueryFundersRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFundersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFundersRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryFundersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFundersRequest.Merge(m, src) +} +func (m *QueryFundersRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryFundersRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFundersRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFundersRequest proto.InternalMessageInfo + +func (m *QueryFundersRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +func (m *QueryFundersRequest) GetSearch() string { + if m != nil { + return m.Search + } + return "" +} + +// QueryFundersResponse is the response type for the Query/Funders RPC method. +type QueryFundersResponse struct { + // funders ... + Funders []Funder `protobuf:"bytes,1,rep,name=funders,proto3" json:"funders"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryFundersResponse) Reset() { *m = QueryFundersResponse{} } +func (m *QueryFundersResponse) String() string { return proto.CompactTextString(m) } +func (*QueryFundersResponse) ProtoMessage() {} +func (*QueryFundersResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a182f068d9f0dba9, []int{4} +} +func (m *QueryFundersResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFundersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFundersResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryFundersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFundersResponse.Merge(m, src) +} +func (m *QueryFundersResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryFundersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFundersResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFundersResponse proto.InternalMessageInfo + +func (m *QueryFundersResponse) GetFunders() []Funder { + if m != nil { + return m.Funders + } + return nil +} + +func (m *QueryFundersResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryFunderRequest is the request type for the Query/Funder RPC method. +type QueryFunderRequest struct { + // address ... + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // with_inactive_fundings ... + WithInactiveFundings bool `protobuf:"varint,2,opt,name=with_inactive_fundings,json=withInactiveFundings,proto3" json:"with_inactive_fundings,omitempty"` +} + +func (m *QueryFunderRequest) Reset() { *m = QueryFunderRequest{} } +func (m *QueryFunderRequest) String() string { return proto.CompactTextString(m) } +func (*QueryFunderRequest) ProtoMessage() {} +func (*QueryFunderRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a182f068d9f0dba9, []int{5} +} +func (m *QueryFunderRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFunderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFunderRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryFunderRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFunderRequest.Merge(m, src) +} +func (m *QueryFunderRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryFunderRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFunderRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFunderRequest proto.InternalMessageInfo + +func (m *QueryFunderRequest) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *QueryFunderRequest) GetWithInactiveFundings() bool { + if m != nil { + return m.WithInactiveFundings + } + return false +} + +// QueryFunderResponse is the response type for the Query/Funder RPC method. +type QueryFunderResponse struct { + // funder ... + Funder *Funder `protobuf:"bytes,1,opt,name=funder,proto3" json:"funder,omitempty"` + // fundings ... + Fundings []Funding `protobuf:"bytes,2,rep,name=fundings,proto3" json:"fundings"` + // stats ... + Stats *FunderStats `protobuf:"bytes,3,opt,name=stats,proto3" json:"stats,omitempty"` +} + +func (m *QueryFunderResponse) Reset() { *m = QueryFunderResponse{} } +func (m *QueryFunderResponse) String() string { return proto.CompactTextString(m) } +func (*QueryFunderResponse) ProtoMessage() {} +func (*QueryFunderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a182f068d9f0dba9, []int{6} +} +func (m *QueryFunderResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFunderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFunderResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryFunderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFunderResponse.Merge(m, src) +} +func (m *QueryFunderResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryFunderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFunderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFunderResponse proto.InternalMessageInfo + +func (m *QueryFunderResponse) GetFunder() *Funder { + if m != nil { + return m.Funder + } + return nil +} + +func (m *QueryFunderResponse) GetFundings() []Funding { + if m != nil { + return m.Fundings + } + return nil +} + +func (m *QueryFunderResponse) GetStats() *FunderStats { + if m != nil { + return m.Stats + } + return nil +} + +func init() { + proto.RegisterType((*Funder)(nil), "kyve.query.v1beta1.Funder") + proto.RegisterType((*FunderStats)(nil), "kyve.query.v1beta1.FunderStats") + proto.RegisterType((*Funding)(nil), "kyve.query.v1beta1.Funding") + proto.RegisterType((*QueryFundersRequest)(nil), "kyve.query.v1beta1.QueryFundersRequest") + proto.RegisterType((*QueryFundersResponse)(nil), "kyve.query.v1beta1.QueryFundersResponse") + proto.RegisterType((*QueryFunderRequest)(nil), "kyve.query.v1beta1.QueryFunderRequest") + proto.RegisterType((*QueryFunderResponse)(nil), "kyve.query.v1beta1.QueryFunderResponse") +} + +func init() { proto.RegisterFile("kyve/query/v1beta1/funders.proto", fileDescriptor_a182f068d9f0dba9) } + +var fileDescriptor_a182f068d9f0dba9 = []byte{ + // 737 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0xcf, 0x6b, 0x13, 0x4d, + 0x18, 0xce, 0x26, 0x69, 0xd2, 0x6f, 0xb6, 0x7c, 0xdf, 0xe7, 0xb4, 0xd6, 0x25, 0xd5, 0x34, 0xae, + 0xd2, 0x86, 0x22, 0xbb, 0x34, 0xea, 0x45, 0xf0, 0x60, 0xd1, 0x4a, 0x11, 0xa4, 0xae, 0x28, 0xe8, + 0x25, 0x4c, 0x76, 0xc7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, 0x89, 0xc0, 0xce, 0x8c, 0xde, + 0xc9, 0x94, 0x12, 0x09, 0x19, 0x15, 0x28, 0x14, 0x4e, 0x45, 0x23, 0xa6, 0x84, 0x0d, 0x60, 0x47, + 0x98, 0x87, 0x19, 0x49, 0xa5, 0x70, 0xa7, 0xaa, 0xd0, 0xd1, 0x96, 0xfb, 0xce, 0x02, 0xb6, 0xbe, + 0xc4, 0x43, 0x81, 0x04, 0x87, 0x4d, 0xf0, 0xbf, 0x60, 0x02, 0x25, 0xed, 0x9c, 0xe3, 0xa8, 0x2d, + 0x4d, 0xd6, 0x57, 0x2a, 0x07, 0xff, 0xaa, 0xfe, 0x23, 0x8e, 0x23, 0xc9, 0xe7, 0xb0, 0x05, 0xce, + 0x6a, 0x26, 0x4a, 0x12, 0x16, 0x22, 0x31, 0xa4, 0x17, 0x15, 0x7d, 0x5e, 0x81, 0xb7, 0x06, 0x98, + 0x9e, 0xb9, 0x08, 0xe6, 0x52, 0xc6, 0x12, 0xae, 0x98, 0x38, 0x72, 0x4a, 0x8d, 0x52, 0xb3, 0x1c, + 0xd8, 0xaa, 0xa7, 0x54, 0x44, 0xee, 0x5b, 0x0b, 0x54, 0xe5, 0x92, 0xd0, 0x18, 0x9e, 0x03, 0x55, + 0x09, 0xb5, 0x49, 0x64, 0x34, 0x54, 0x64, 0xb9, 0x15, 0xc1, 0x45, 0x50, 0x41, 0x3d, 0x96, 0x53, + 0x61, 0x0e, 0x33, 0x15, 0x5c, 0x03, 0x67, 0xf4, 0xaa, 0x9d, 0xe2, 0xac, 0xdd, 0xc9, 0x69, 0x94, + 0x60, 0x65, 0x6e, 0x39, 0xf8, 0x4f, 0x03, 0xdb, 0x38, 0xdb, 0x50, 0x6d, 0xa9, 0x45, 0xeb, 0x37, + 0x5a, 0xca, 0x8a, 0x66, 0xab, 0x9e, 0xd1, 0x92, 0x83, 0xf9, 0x07, 0x32, 0x37, 0xda, 0x20, 0x1e, + 0xe0, 0xdd, 0x1c, 0x73, 0x01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f0, 0x95, 0x49, 0xb6, 0x5c, + 0xaf, 0x9e, 0xb6, 0xc9, 0x29, 0x59, 0xab, 0x35, 0xa7, 0x13, 0xb5, 0x33, 0xee, 0xa5, 0xd7, 0x5f, + 0x7f, 0x7e, 0x28, 0x5e, 0x80, 0x4b, 0xfe, 0xe4, 0xd7, 0x12, 0xbe, 0x39, 0x79, 0xb3, 0x56, 0xa6, + 0xec, 0x3c, 0x50, 0xb0, 0x3a, 0x95, 0x67, 0x04, 0x5c, 0x51, 0x02, 0x56, 0xe0, 0xe5, 0xc9, 0x02, + 0xfc, 0x17, 0x26, 0x15, 0x2f, 0x37, 0x6e, 0x1f, 0x1c, 0xd5, 0xad, 0xc3, 0xa3, 0xba, 0xf5, 0xe3, + 0xa8, 0x6e, 0xbd, 0x3f, 0xae, 0x17, 0x0e, 0x8f, 0xeb, 0x85, 0x6f, 0xc7, 0xf5, 0xc2, 0xd3, 0xb5, + 0x98, 0x88, 0x6e, 0xde, 0xf1, 0x42, 0xd6, 0xf3, 0xef, 0x3d, 0x79, 0x7c, 0xe7, 0x3e, 0x16, 0xfb, + 0x2c, 0xdb, 0xf1, 0xc3, 0x2e, 0x22, 0xd4, 0x7f, 0x6e, 0x36, 0x16, 0xfd, 0x14, 0xf3, 0x4e, 0x45, + 0x3d, 0xc5, 0x57, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0xf3, 0x64, 0x62, 0xc8, 0x22, 0x06, 0x00, + 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryFundersClient is the client API for QueryFunders service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryFundersClient interface { + // Funders queries all funders. + Funders(ctx context.Context, in *QueryFundersRequest, opts ...grpc.CallOption) (*QueryFundersResponse, error) + // Funder queries a funder by address. + Funder(ctx context.Context, in *QueryFunderRequest, opts ...grpc.CallOption) (*QueryFunderResponse, error) +} + +type queryFundersClient struct { + cc grpc1.ClientConn +} + +func NewQueryFundersClient(cc grpc1.ClientConn) QueryFundersClient { + return &queryFundersClient{cc} +} + +func (c *queryFundersClient) Funders(ctx context.Context, in *QueryFundersRequest, opts ...grpc.CallOption) (*QueryFundersResponse, error) { + out := new(QueryFundersResponse) + err := c.cc.Invoke(ctx, "/kyve.query.v1beta1.QueryFunders/Funders", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryFundersClient) Funder(ctx context.Context, in *QueryFunderRequest, opts ...grpc.CallOption) (*QueryFunderResponse, error) { + out := new(QueryFunderResponse) + err := c.cc.Invoke(ctx, "/kyve.query.v1beta1.QueryFunders/Funder", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryFundersServer is the server API for QueryFunders service. +type QueryFundersServer interface { + // Funders queries all funders. + Funders(context.Context, *QueryFundersRequest) (*QueryFundersResponse, error) + // Funder queries a funder by address. + Funder(context.Context, *QueryFunderRequest) (*QueryFunderResponse, error) +} + +// UnimplementedQueryFundersServer can be embedded to have forward compatible implementations. +type UnimplementedQueryFundersServer struct { +} + +func (*UnimplementedQueryFundersServer) Funders(ctx context.Context, req *QueryFundersRequest) (*QueryFundersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Funders not implemented") +} +func (*UnimplementedQueryFundersServer) Funder(ctx context.Context, req *QueryFunderRequest) (*QueryFunderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Funder not implemented") +} + +func RegisterQueryFundersServer(s grpc1.Server, srv QueryFundersServer) { + s.RegisterService(&_QueryFunders_serviceDesc, srv) +} + +func _QueryFunders_Funders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryFundersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryFundersServer).Funders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kyve.query.v1beta1.QueryFunders/Funders", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryFundersServer).Funders(ctx, req.(*QueryFundersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _QueryFunders_Funder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryFunderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryFundersServer).Funder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kyve.query.v1beta1.QueryFunders/Funder", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryFundersServer).Funder(ctx, req.(*QueryFunderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _QueryFunders_serviceDesc = grpc.ServiceDesc{ + ServiceName: "kyve.query.v1beta1.QueryFunders", + HandlerType: (*QueryFundersServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Funders", + Handler: _QueryFunders_Funders_Handler, + }, + { + MethodName: "Funder", + Handler: _QueryFunders_Funder_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "kyve/query/v1beta1/funders.proto", +} + +func (m *Funder) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Funder) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Funder) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x3a + } + if len(m.Contact) > 0 { + i -= len(m.Contact) + copy(dAtA[i:], m.Contact) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Contact))) + i-- + dAtA[i] = 0x32 + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x2a + } + if len(m.Logo) > 0 { + i -= len(m.Logo) + copy(dAtA[i:], m.Logo) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Logo))) + i-- + dAtA[i] = 0x22 + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x1a + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *FunderStats) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FunderStats) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FunderStats) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PoolsFunded) > 0 { + dAtA2 := make([]byte, len(m.PoolsFunded)*10) + var j1 int + for _, num := range m.PoolsFunded { + for num >= 1<<7 { + dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j1++ + } + dAtA2[j1] = uint8(num) + j1++ + } + i -= j1 + copy(dAtA[i:], dAtA2[:j1]) + i = encodeVarintFunders(dAtA, i, uint64(j1)) + i-- + dAtA[i] = 0x1a + } + if m.TotalAllocatedFunds != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.TotalAllocatedFunds)) + i-- + dAtA[i] = 0x10 + } + if m.TotalUsedFunds != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.TotalUsedFunds)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Funding) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Funding) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Funding) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TotalFunded != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.TotalFunded)) + i-- + dAtA[i] = 0x20 + } + if m.AmountPerBundle != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.AmountPerBundle)) + i-- + dAtA[i] = 0x18 + } + if m.Amount != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x10 + } + if m.PoolId != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryFundersRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryFundersRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFundersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Search) > 0 { + i -= len(m.Search) + copy(dAtA[i:], m.Search) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Search))) + i-- + dAtA[i] = 0x12 + } + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFunders(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryFundersResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryFundersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFundersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFunders(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Funders) > 0 { + for iNdEx := len(m.Funders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Funders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFunders(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryFunderRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryFunderRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFunderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.WithInactiveFundings { + i-- + if m.WithInactiveFundings { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryFunderResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryFunderResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFunderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Stats != nil { + { + size, err := m.Stats.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFunders(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.Fundings) > 0 { + for iNdEx := len(m.Fundings) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Fundings[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFunders(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Funder != nil { + { + size, err := m.Funder.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFunders(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintFunders(dAtA []byte, offset int, v uint64) int { + offset -= sovFunders(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Funder) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Logo) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Contact) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + return n +} + +func (m *FunderStats) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TotalUsedFunds != 0 { + n += 1 + sovFunders(uint64(m.TotalUsedFunds)) + } + if m.TotalAllocatedFunds != 0 { + n += 1 + sovFunders(uint64(m.TotalAllocatedFunds)) + } + if len(m.PoolsFunded) > 0 { + l = 0 + for _, e := range m.PoolsFunded { + l += sovFunders(uint64(e)) + } + n += 1 + sovFunders(uint64(l)) + l + } + return n +} + +func (m *Funding) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovFunders(uint64(m.PoolId)) + } + if m.Amount != 0 { + n += 1 + sovFunders(uint64(m.Amount)) + } + if m.AmountPerBundle != 0 { + n += 1 + sovFunders(uint64(m.AmountPerBundle)) + } + if m.TotalFunded != 0 { + n += 1 + sovFunders(uint64(m.TotalFunded)) + } + return n +} + +func (m *QueryFundersRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Search) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + return n +} + +func (m *QueryFundersResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Funders) > 0 { + for _, e := range m.Funders { + l = e.Size() + n += 1 + l + sovFunders(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovFunders(uint64(l)) + } + return n +} + +func (m *QueryFunderRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + if m.WithInactiveFundings { + n += 2 + } + return n +} + +func (m *QueryFunderResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Funder != nil { + l = m.Funder.Size() + n += 1 + l + sovFunders(uint64(l)) + } + if len(m.Fundings) > 0 { + for _, e := range m.Fundings { + l = e.Size() + n += 1 + l + sovFunders(uint64(l)) + } + } + if m.Stats != nil { + l = m.Stats.Size() + n += 1 + l + sovFunders(uint64(l)) + } + return n +} + +func sovFunders(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozFunders(x uint64) (n int) { + return sovFunders(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Funder) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Funder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Funder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Logo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FunderStats) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FunderStats: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FunderStats: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalUsedFunds", wireType) + } + m.TotalUsedFunds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalUsedFunds |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalAllocatedFunds", wireType) + } + m.TotalAllocatedFunds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalAllocatedFunds |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PoolsFunded = append(m.PoolsFunded, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PoolsFunded) == 0 { + m.PoolsFunded = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PoolsFunded = append(m.PoolsFunded, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PoolsFunded", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Funding) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Funding: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Funding: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AmountPerBundle", wireType) + } + m.AmountPerBundle = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AmountPerBundle |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalFunded", wireType) + } + m.TotalFunded = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalFunded |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryFundersRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryFundersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFundersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Search", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Search = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryFundersResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryFundersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFundersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Funders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Funders = append(m.Funders, Funder{}) + if err := m.Funders[len(m.Funders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryFunderRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryFunderRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFunderRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field WithInactiveFundings", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.WithInactiveFundings = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryFunderResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryFunderResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFunderResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Funder", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Funder == nil { + m.Funder = &Funder{} + } + if err := m.Funder.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fundings", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Fundings = append(m.Fundings, Funding{}) + if err := m.Fundings[len(m.Fundings)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stats", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Stats == nil { + m.Stats = &FunderStats{} + } + if err := m.Stats.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipFunders(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFunders + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFunders + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFunders + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthFunders + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupFunders + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthFunders + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthFunders = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowFunders = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupFunders = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/query/types/funders.pb.gw.go b/x/query/types/funders.pb.gw.go new file mode 100644 index 00000000..791a5a0c --- /dev/null +++ b/x/query/types/funders.pb.gw.go @@ -0,0 +1,290 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: kyve/query/v1beta1/funders.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +var ( + filter_QueryFunders_Funders_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_QueryFunders_Funders_0(ctx context.Context, marshaler runtime.Marshaler, client QueryFundersClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFundersRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryFunders_Funders_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Funders(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_QueryFunders_Funders_0(ctx context.Context, marshaler runtime.Marshaler, server QueryFundersServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFundersRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryFunders_Funders_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Funders(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_QueryFunders_Funder_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_QueryFunders_Funder_0(ctx context.Context, marshaler runtime.Marshaler, client QueryFundersClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFunderRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryFunders_Funder_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Funder(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_QueryFunders_Funder_0(ctx context.Context, marshaler runtime.Marshaler, server QueryFundersServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFunderRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryFunders_Funder_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Funder(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryFundersHandlerServer registers the http handlers for service QueryFunders to "mux". +// UnaryRPC :call QueryFundersServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryFundersHandlerFromEndpoint instead. +func RegisterQueryFundersHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryFundersServer) error { + + mux.Handle("GET", pattern_QueryFunders_Funders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_QueryFunders_Funders_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_QueryFunders_Funders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_QueryFunders_Funder_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_QueryFunders_Funder_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_QueryFunders_Funder_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryFundersHandlerFromEndpoint is same as RegisterQueryFundersHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryFundersHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryFundersHandler(ctx, mux, conn) +} + +// RegisterQueryFundersHandler registers the http handlers for service QueryFunders to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryFundersHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryFundersHandlerClient(ctx, mux, NewQueryFundersClient(conn)) +} + +// RegisterQueryFundersHandlerClient registers the http handlers for service QueryFunders +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryFundersClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryFundersClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryFundersClient" to call the correct interceptors. +func RegisterQueryFundersHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryFundersClient) error { + + mux.Handle("GET", pattern_QueryFunders_Funders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_QueryFunders_Funders_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_QueryFunders_Funders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_QueryFunders_Funder_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_QueryFunders_Funder_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_QueryFunders_Funder_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_QueryFunders_Funders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kyve", "query", "v1beta1", "funders"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_QueryFunders_Funder_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"kyve", "query", "v1beta1", "funder", "address"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_QueryFunders_Funders_0 = runtime.ForwardResponseMessage + + forward_QueryFunders_Funder_0 = runtime.ForwardResponseMessage +) From 7d79b8eee0358e547985e5419959a18dd652aa6e Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 4 Oct 2023 10:51:31 +0200 Subject: [PATCH 061/109] chore: run formatter --- testutil/integration/checks.go | 3 ++- testutil/keeper/funders.go | 1 + x/bundles/keeper/keeper.go | 1 + x/bundles/keeper/keeper_suite_stakers_leave_test.go | 2 +- x/bundles/keeper/keeper_suite_valid_bundles_test.go | 2 +- x/bundles/keeper/keeper_suite_zero_delegation_test.go | 2 +- x/bundles/keeper/msg_server_skip_uploader_role_test.go | 2 +- x/bundles/keeper/msg_server_submit_bundle_proposal_test.go | 2 +- x/bundles/keeper/msg_server_vote_bundle_proposal_test.go | 2 +- x/delegation/keeper/keeper_suite_test.go | 3 ++- x/funders/client/cli/tx.go | 4 +--- x/funders/client/cli/tx_create_funder.go | 2 +- x/funders/keeper/getters_funder.go | 3 ++- x/funders/keeper/keeper.go | 1 + x/funders/keeper/logic_funders.go | 4 +++- x/funders/keeper/msg_server_defund_pool.go | 1 + x/funders/keeper/msg_server_fund_pool.go | 3 ++- x/funders/module.go | 1 + x/funders/types/message_create_funder.go | 4 +--- x/funders/types/message_defund_pool.go | 4 +--- x/funders/types/message_fund_pool.go | 4 +--- x/funders/types/message_update_funder.go | 4 +--- x/pool/types/pool.go | 1 + x/query/keeper/grpc_query_funder.go | 1 + x/query/keeper/keeper.go | 1 + x/stakers/keeper/exported_functions_test.go | 3 ++- 26 files changed, 33 insertions(+), 28 deletions(-) diff --git a/testutil/integration/checks.go b/testutil/integration/checks.go index 7b9e08e5..33d5acb3 100644 --- a/testutil/integration/checks.go +++ b/testutil/integration/checks.go @@ -1,9 +1,10 @@ package integration import ( + "time" + "github.com/KYVENetwork/chain/x/funders" funderstypes "github.com/KYVENetwork/chain/x/funders/types" - "time" "github.com/KYVENetwork/chain/x/bundles" bundlesTypes "github.com/KYVENetwork/chain/x/bundles/types" diff --git a/testutil/keeper/funders.go b/testutil/keeper/funders.go index 9b760812..9a511ee6 100644 --- a/testutil/keeper/funders.go +++ b/testutil/keeper/funders.go @@ -44,6 +44,7 @@ func FundersKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { nil, nil, nil, + nil, ) _ = paramsSubspace ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) diff --git a/x/bundles/keeper/keeper.go b/x/bundles/keeper/keeper.go index 6e3d47a4..24be1fd2 100644 --- a/x/bundles/keeper/keeper.go +++ b/x/bundles/keeper/keeper.go @@ -2,6 +2,7 @@ package keeper import ( "fmt" + "github.com/cometbft/cometbft/libs/log" "github.com/KYVENetwork/chain/x/bundles/types" diff --git a/x/bundles/keeper/keeper_suite_stakers_leave_test.go b/x/bundles/keeper/keeper_suite_stakers_leave_test.go index 926d56ad..cb6b40d4 100644 --- a/x/bundles/keeper/keeper_suite_stakers_leave_test.go +++ b/x/bundles/keeper/keeper_suite_stakers_leave_test.go @@ -40,7 +40,7 @@ var _ = Describe("stakers leave", Ordered, func() { // init new clean chain s = i.NewCleanChain() - //create clean pool for every test case + // create clean pool for every test case gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() msg := &pooltypes.MsgCreatePool{ Authority: gov, diff --git a/x/bundles/keeper/keeper_suite_valid_bundles_test.go b/x/bundles/keeper/keeper_suite_valid_bundles_test.go index 8fa1bd49..411b290c 100644 --- a/x/bundles/keeper/keeper_suite_valid_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_valid_bundles_test.go @@ -42,7 +42,7 @@ var _ = Describe("valid bundles", Ordered, func() { // init new clean chain s = i.NewCleanChain() - //create clean pool for every test case + // create clean pool for every test case gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() msg := &pooltypes.MsgCreatePool{ Authority: gov, diff --git a/x/bundles/keeper/keeper_suite_zero_delegation_test.go b/x/bundles/keeper/keeper_suite_zero_delegation_test.go index 633392ab..f6f309c9 100644 --- a/x/bundles/keeper/keeper_suite_zero_delegation_test.go +++ b/x/bundles/keeper/keeper_suite_zero_delegation_test.go @@ -39,7 +39,7 @@ var _ = Describe("zero delegation", Ordered, func() { // init new clean chain s = i.NewCleanChain() - //create clean pool for every test case + // create clean pool for every test case gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() msg := &pooltypes.MsgCreatePool{ Authority: gov, diff --git a/x/bundles/keeper/msg_server_skip_uploader_role_test.go b/x/bundles/keeper/msg_server_skip_uploader_role_test.go index 5feb94d2..634fe8f0 100644 --- a/x/bundles/keeper/msg_server_skip_uploader_role_test.go +++ b/x/bundles/keeper/msg_server_skip_uploader_role_test.go @@ -28,7 +28,7 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { // init new clean chain s = i.NewCleanChain() - //create clean pool for every test case + // create clean pool for every test case gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() msg := &pooltypes.MsgCreatePool{ Authority: gov, diff --git a/x/bundles/keeper/msg_server_submit_bundle_proposal_test.go b/x/bundles/keeper/msg_server_submit_bundle_proposal_test.go index e0b4a7b1..2967bfc2 100644 --- a/x/bundles/keeper/msg_server_submit_bundle_proposal_test.go +++ b/x/bundles/keeper/msg_server_submit_bundle_proposal_test.go @@ -35,7 +35,7 @@ var _ = Describe("msg_server_submit_bundle_proposal.go", Ordered, func() { // init new clean chain s = i.NewCleanChain() - //create clean pool for every test case + // create clean pool for every test case gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() msg := &pooltypes.MsgCreatePool{ Authority: gov, diff --git a/x/bundles/keeper/msg_server_vote_bundle_proposal_test.go b/x/bundles/keeper/msg_server_vote_bundle_proposal_test.go index 6b7c7d8a..386743e7 100644 --- a/x/bundles/keeper/msg_server_vote_bundle_proposal_test.go +++ b/x/bundles/keeper/msg_server_vote_bundle_proposal_test.go @@ -33,7 +33,7 @@ var _ = Describe("msg_server_vote_bundle_proposal.go", Ordered, func() { // init new clean chain s = i.NewCleanChain() - //create clean pool for every test case + // create clean pool for every test case gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() msg := &pooltypes.MsgCreatePool{ Authority: gov, diff --git a/x/delegation/keeper/keeper_suite_test.go b/x/delegation/keeper/keeper_suite_test.go index 0b3eb058..e7130b99 100644 --- a/x/delegation/keeper/keeper_suite_test.go +++ b/x/delegation/keeper/keeper_suite_test.go @@ -2,9 +2,10 @@ package keeper_test import ( "fmt" - funderstypes "github.com/KYVENetwork/chain/x/funders/types" "testing" + funderstypes "github.com/KYVENetwork/chain/x/funders/types" + i "github.com/KYVENetwork/chain/testutil/integration" "github.com/KYVENetwork/chain/x/delegation/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" diff --git a/x/funders/client/cli/tx.go b/x/funders/client/cli/tx.go index 409cf79d..7161ea30 100644 --- a/x/funders/client/cli/tx.go +++ b/x/funders/client/cli/tx.go @@ -11,9 +11,7 @@ import ( "github.com/KYVENetwork/chain/x/funders/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) +var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) const ( flagPacketTimeoutTimestamp = "packet-timeout-timestamp" diff --git a/x/funders/client/cli/tx_create_funder.go b/x/funders/client/cli/tx_create_funder.go index 7a944f0e..f9a3e5ab 100644 --- a/x/funders/client/cli/tx_create_funder.go +++ b/x/funders/client/cli/tx_create_funder.go @@ -16,7 +16,7 @@ func CmdCreateFunder() *cobra.Command { RunE: func(cmd *cobra.Command, args []string) (err error) { argMoniker := args[0] - //moniker, _ := cmd.Flags().GetString(FlagEditMoniker) + // moniker, _ := cmd.Flags().GetString(FlagEditMoniker) identity, _ := cmd.Flags().GetString(FlagIdentity) logo, _ := cmd.Flags().GetString(FlagLogo) website, _ := cmd.Flags().GetString(FlagWebsite) diff --git a/x/funders/keeper/getters_funder.go b/x/funders/keeper/getters_funder.go index d9cdf98b..b049066f 100644 --- a/x/funders/keeper/getters_funder.go +++ b/x/funders/keeper/getters_funder.go @@ -1,13 +1,14 @@ package keeper import ( + "strings" + "github.com/KYVENetwork/chain/x/funders/types" "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" - "strings" ) // DoesFunderExist checks if the funding exists diff --git a/x/funders/keeper/keeper.go b/x/funders/keeper/keeper.go index c7c835be..e188b999 100644 --- a/x/funders/keeper/keeper.go +++ b/x/funders/keeper/keeper.go @@ -2,6 +2,7 @@ package keeper import ( "fmt" + "github.com/KYVENetwork/chain/util" "github.com/KYVENetwork/chain/x/funders/types" "github.com/cometbft/cometbft/libs/log" diff --git a/x/funders/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go index 9aa97abc..96635f4f 100644 --- a/x/funders/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -1,9 +1,11 @@ package keeper import ( - "cosmossdk.io/errors" goerrors "errors" "fmt" + + "cosmossdk.io/errors" + "github.com/KYVENetwork/chain/util" "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" diff --git a/x/funders/keeper/msg_server_defund_pool.go b/x/funders/keeper/msg_server_defund_pool.go index bf673657..4a696d84 100644 --- a/x/funders/keeper/msg_server_defund_pool.go +++ b/x/funders/keeper/msg_server_defund_pool.go @@ -3,6 +3,7 @@ package keeper import ( "context" "fmt" + "github.com/KYVENetwork/chain/x/funders/types" "cosmossdk.io/errors" diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go index ef2b3b51..db8614b6 100644 --- a/x/funders/keeper/msg_server_fund_pool.go +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "cosmossdk.io/errors" "github.com/KYVENetwork/chain/util" "github.com/KYVENetwork/chain/x/funders/types" @@ -115,7 +116,7 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ // User is allowed to fund // Let's see if he has enough funds if err := util.TransferFromAddressToModule(k.bankKeeper, ctx, msg.Creator, types.ModuleName, msg.Amount); err != nil { - //if err := util.TransferFromAddressToModule(k.bankKeeper, ctx, msg.Creator, "pool", msg.Amount); err != nil { + // if err := util.TransferFromAddressToModule(k.bankKeeper, ctx, msg.Creator, "pool", msg.Amount); err != nil { return nil, err } diff --git a/x/funders/module.go b/x/funders/module.go index 4d1a5047..961c6ec5 100644 --- a/x/funders/module.go +++ b/x/funders/module.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/KYVENetwork/chain/util" // this line is used by starport scaffolding # 1 diff --git a/x/funders/types/message_create_funder.go b/x/funders/types/message_create_funder.go index fc8046be..da23795f 100644 --- a/x/funders/types/message_create_funder.go +++ b/x/funders/types/message_create_funder.go @@ -6,9 +6,7 @@ import ( errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) -var ( - _ sdk.Msg = &MsgCreateFunder{} -) +var _ sdk.Msg = &MsgCreateFunder{} func (msg *MsgCreateFunder) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) diff --git a/x/funders/types/message_defund_pool.go b/x/funders/types/message_defund_pool.go index 14c7a86b..85329811 100644 --- a/x/funders/types/message_defund_pool.go +++ b/x/funders/types/message_defund_pool.go @@ -7,9 +7,7 @@ import ( errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) -var ( - _ sdk.Msg = &MsgDefundPool{} -) +var _ sdk.Msg = &MsgDefundPool{} func (msg *MsgDefundPool) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) diff --git a/x/funders/types/message_fund_pool.go b/x/funders/types/message_fund_pool.go index a05298ac..44efdafe 100644 --- a/x/funders/types/message_fund_pool.go +++ b/x/funders/types/message_fund_pool.go @@ -7,9 +7,7 @@ import ( errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) -var ( - _ sdk.Msg = &MsgFundPool{} -) +var _ sdk.Msg = &MsgFundPool{} func (msg *MsgFundPool) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) diff --git a/x/funders/types/message_update_funder.go b/x/funders/types/message_update_funder.go index 86bcc42a..a6ce23f4 100644 --- a/x/funders/types/message_update_funder.go +++ b/x/funders/types/message_update_funder.go @@ -6,9 +6,7 @@ import ( errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) -var ( - _ sdk.Msg = &MsgUpdateFunder{} -) +var _ sdk.Msg = &MsgUpdateFunder{} func (msg *MsgUpdateFunder) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) diff --git a/x/pool/types/pool.go b/x/pool/types/pool.go index 47eaaf77..4354326a 100644 --- a/x/pool/types/pool.go +++ b/x/pool/types/pool.go @@ -2,6 +2,7 @@ package types import ( "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" authTypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) diff --git a/x/query/keeper/grpc_query_funder.go b/x/query/keeper/grpc_query_funder.go index 89938b72..2175ffc7 100644 --- a/x/query/keeper/grpc_query_funder.go +++ b/x/query/keeper/grpc_query_funder.go @@ -2,6 +2,7 @@ package keeper import ( "context" + fundersTypes "github.com/KYVENetwork/chain/x/funders/types" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/query/keeper/keeper.go b/x/query/keeper/keeper.go index 2ea59f71..09a794ba 100644 --- a/x/query/keeper/keeper.go +++ b/x/query/keeper/keeper.go @@ -2,6 +2,7 @@ package keeper import ( "fmt" + fundersKeeper "github.com/KYVENetwork/chain/x/funders/keeper" globalKeeper "github.com/KYVENetwork/chain/x/global/keeper" diff --git a/x/stakers/keeper/exported_functions_test.go b/x/stakers/keeper/exported_functions_test.go index 05acfa2c..f7af1e17 100644 --- a/x/stakers/keeper/exported_functions_test.go +++ b/x/stakers/keeper/exported_functions_test.go @@ -1,9 +1,10 @@ package keeper_test import ( - pooltypes "github.com/KYVENetwork/chain/x/pool/types" "strconv" + pooltypes "github.com/KYVENetwork/chain/x/pool/types" + kyveApp "github.com/KYVENetwork/chain/app" i "github.com/KYVENetwork/chain/testutil/integration" sdk "github.com/cosmos/cosmos-sdk/types" From 8c56ba5a931eb622a2d5264661cda8518d277c57 Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 4 Oct 2023 16:36:52 +0200 Subject: [PATCH 062/109] chore: add funders store to v1.4.0 upgrade --- app/upgrades/v1_4/store.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/upgrades/v1_4/store.go b/app/upgrades/v1_4/store.go index 95ef9d11..5f5f52ca 100644 --- a/app/upgrades/v1_4/store.go +++ b/app/upgrades/v1_4/store.go @@ -1,6 +1,7 @@ package v1_4 import ( + funderstypes "github.com/KYVENetwork/chain/x/funders/types" "github.com/cosmos/cosmos-sdk/baseapp" storeTypes "github.com/cosmos/cosmos-sdk/store/types" @@ -16,7 +17,7 @@ import ( func CreateStoreLoader(upgradeHeight int64) baseapp.StoreLoader { storeUpgrades := storeTypes.StoreUpgrades{ Added: []string{ - consensusTypes.StoreKey, crisisTypes.StoreKey, + consensusTypes.StoreKey, crisisTypes.StoreKey, funderstypes.StoreKey, }, } From ef7804701c342eb80d320ae8a8b482881a1a0072 Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 4 Oct 2023 16:38:04 +0200 Subject: [PATCH 063/109] feat: add show-funder and list-funder commands --- x/funders/module.go | 2 +- x/query/client/cli/query.go | 6 +- x/query/client/cli/query_funders.go | 86 +++++++++++++++++++++++++++++ x/query/module.go | 2 + 4 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 x/query/client/cli/query_funders.go diff --git a/x/funders/module.go b/x/funders/module.go index 961c6ec5..87f5b484 100644 --- a/x/funders/module.go +++ b/x/funders/module.go @@ -73,7 +73,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod // 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)) + _ = 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 diff --git a/x/query/client/cli/query.go b/x/query/client/cli/query.go index e88a40c4..55df931a 100644 --- a/x/query/client/cli/query.go +++ b/x/query/client/cli/query.go @@ -39,7 +39,7 @@ func GetQueryCmd(queryRoute string) *cobra.Command { cmd.AddCommand(CmdListStakers()) cmd.AddCommand(CmdListStakersByPool()) - // DELEGATION + // Delegation cmd.AddCommand(CmdDelegator()) cmd.AddCommand(CmdStakersByPoolAndDelegator()) cmd.AddCommand(CmdDelegatorsByPoolAndStaker()) @@ -52,5 +52,9 @@ func GetQueryCmd(queryRoute string) *cobra.Command { cmd.AddCommand(CmdCurrentVoteStatus()) cmd.AddCommand(CmdCanValidate()) + // Funders + cmd.AddCommand(CmdShowFunder()) + cmd.AddCommand(CmdListFunders()) + return cmd } diff --git a/x/query/client/cli/query_funders.go b/x/query/client/cli/query_funders.go new file mode 100644 index 00000000..053e24a7 --- /dev/null +++ b/x/query/client/cli/query_funders.go @@ -0,0 +1,86 @@ +package cli + +import ( + "context" + "github.com/KYVENetwork/chain/x/query/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" +) + +func CmdListFunders() *cobra.Command { + cmd := &cobra.Command{ + Use: "funders", + Short: "list all funders", + Args: cobra.MaximumNArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + reqSearch := "" + if len(args) >= 1 { + reqSearch = args[0] + } + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryFundersClient(clientCtx) + + params := &types.QueryFundersRequest{ + Pagination: pageReq, + Search: reqSearch, + } + + res, err := queryClient.Funders(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdShowFunder() *cobra.Command { + cmd := &cobra.Command{ + Use: "funder [address]", + Short: "shows a funder", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + reqAddress := args[0] + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryFundersClient(clientCtx) + + params := &types.QueryFunderRequest{ + Address: reqAddress, + WithInactiveFundings: true, + } + + res, err := queryClient.Funder(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/query/module.go b/x/query/module.go index 6997f108..1846e55e 100644 --- a/x/query/module.go +++ b/x/query/module.go @@ -67,6 +67,7 @@ func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *r _ = types.RegisterQueryDelegationHandlerClient(context.Background(), mux, types.NewQueryDelegationClient(clientCtx)) _ = types.RegisterQueryBundlesHandlerClient(context.Background(), mux, types.NewQueryBundlesClient(clientCtx)) _ = types.RegisterQueryParamsHandlerClient(context.Background(), mux, types.NewQueryParamsClient(clientCtx)) + _ = types.RegisterQueryFundersHandlerClient(context.Background(), mux, types.NewQueryFundersClient(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 @@ -117,6 +118,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryDelegationServer(cfg.QueryServer(), am.keeper) types.RegisterQueryBundlesServer(cfg.QueryServer(), am.keeper) types.RegisterQueryParamsServer(cfg.QueryServer(), am.keeper) + types.RegisterQueryFundersServer(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) From 149503d9caffeb946daa69186224701ec18379f2 Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 4 Oct 2023 16:39:08 +0200 Subject: [PATCH 064/109] feat: add some default funding in config.yml --- config.yml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/config.yml b/config.yml index 85e31b02..2eb656f9 100644 --- a/config.yml +++ b/config.yml @@ -66,6 +66,10 @@ genesis: coins: - denom: "tkyve" amount: "165000000000000000" + - address: "kyve1vg5325u5mat0y44g73n8t8z2le26fsa4n947f5" # funders module (funding from Alice) + coins: + - denom: "tkyve" + amount: "1001234" delegation: params: unbonding_delegation_time: 10 @@ -143,7 +147,7 @@ genesis: max_bundle_size: "100" min_delegation: "100000000000" name: "KYVE // Mainnet" - operating_cost: "2500000000" + inflation_share_weight: "2500000000" disabled: false runtime: '@kyvejs/tendermint-bsync' start_key: "1" @@ -164,6 +168,28 @@ genesis: staking: params: bond_denom: tkyve + funders: + params: + min_funding_amount: 1000 + min_funding_amount_per_bundle: 100 + funder_list: + - address: "kyve1jq304cthpx0lwhpqzrdjrcza559ukyy3zsl2vd" + contact: "https://twitter.com/kyvenetwork" + moniker: "Alice" + description: "Alice is the first funder of the KYVE network." + logo: "https://avatars.githubusercontent.com/u/76891822?s=200&v=4" + website: "https://kyve.network" + identity: "0657A086E5201562" + funding_list: + - pool_id: 0 + funder_address: "kyve1jq304cthpx0lwhpqzrdjrcza559ukyy3zsl2vd" + amount: 1000000 + amount_per_bundle: 1000 + total_funded: 0 + funding_state_list: + - pool_id: 0 + active_funder_addresses: [] + total_amount: 1000000 chain_id: kyve-local validators: - name: alice From 2174309f87a9a60014f0ad3b71ed06b40bf2292e Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 4 Oct 2023 17:19:06 +0200 Subject: [PATCH 065/109] fix: rename operating_cost to inflation_share_weight --- .../keeper/keeper_suite_inflation_splitting_test.go | 12 ++++++------ x/bundles/spec/04_begin_block.md | 2 +- x/pool/spec/06_events.md | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/x/bundles/keeper/keeper_suite_inflation_splitting_test.go b/x/bundles/keeper/keeper_suite_inflation_splitting_test.go index 17250358..0d74148b 100644 --- a/x/bundles/keeper/keeper_suite_inflation_splitting_test.go +++ b/x/bundles/keeper/keeper_suite_inflation_splitting_test.go @@ -515,7 +515,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert bundle reward uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) - // the total payout is the operating cost plus the inflation payout + // the total payout is the inflation share weight plus the inflation payout totalPayout := pool.InflationShareWeight + payout networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) @@ -614,7 +614,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert bundle reward uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) - // the total payout is the operating cost plus the inflation payout + // the total payout is the inflation share weight plus the inflation payout totalPayout := pool.InflationShareWeight + payout networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) @@ -810,7 +810,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert bundle reward uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) - // the total payout is the operating cost plus the inflation payout + // the total payout is the inflation share weight plus the inflation payout totalPayout := 300 + payout networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) @@ -909,7 +909,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert bundle reward uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) - // the total payout is the operating cost plus the inflation payout + // the total payout is the inflation share weight plus the inflation payout totalPayout := 300 + payout networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) @@ -1105,7 +1105,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert bundle reward uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) - // the total payout is the operating cost plus the inflation payout + // the total payout is the inflation share weight plus the inflation payout totalPayout := (pool.InflationShareWeight / 2) + 200 + payout networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) @@ -1204,7 +1204,7 @@ var _ = Describe("inflation splitting", Ordered, func() { // assert bundle reward uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) - // the total payout is the operating cost plus the inflation payout + // the total payout is the inflation share weight plus the inflation payout totalPayout := (pool.InflationShareWeight / 2) + 200 + payout networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) diff --git a/x/bundles/spec/04_begin_block.md b/x/bundles/spec/04_begin_block.md index cb7d4c17..7f0e8cb9 100644 --- a/x/bundles/spec/04_begin_block.md +++ b/x/bundles/spec/04_begin_block.md @@ -6,4 +6,4 @@ order: 4 BeginBlock is used to distribute the inflation split to the pools. All active pools are eligible for the inflation split. The distribution -between the pools are determined by the operating cost of each pool. +between the pools are determined by the inflation share weight of each pool. diff --git a/x/pool/spec/06_events.md b/x/pool/spec/06_events.md index 6ec5be6d..c26c3c51 100644 --- a/x/pool/spec/06_events.md +++ b/x/pool/spec/06_events.md @@ -114,9 +114,9 @@ message EventCreatePool { // upload_interval is the interval the pool should validate // bundles with uint64 upload_interval = 7; - // operating_cost is the fixed cost which gets paid out + // inflation_share_weight is the fixed cost which gets paid out // to every successful uploader - uint64 operating_cost = 8; + uint64 inflation_share_weight = 8; // min_delegation is the minimum amount of $KYVE the pool has // to have in order to produce bundles uint64 min_delegation = 9; @@ -256,9 +256,9 @@ message EventPoolUpdated { // upload_interval is the interval the pool should validate // bundles with uint64 upload_interval = 7; - // operating_cost is the fixed cost which gets paid out + // inflation_share_weight is the fixed cost which gets paid out // to every successful uploader - uint64 operating_cost = 8; + uint64 inflation_share_weight = 8; // min_delegation is the minimum amount of $KYVE the pool has // to have in order to produce bundles uint64 min_delegation = 9; From b9a9fb8bb41f2c5a94039db7fc88ff9493aafd78 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 5 Oct 2023 13:19:18 +0200 Subject: [PATCH 066/109] feat: add funders module to swagger --- docs/config.json | 3 + docs/swagger.yml | 611 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 614 insertions(+) diff --git a/docs/config.json b/docs/config.json index 3ef0f89d..40381d27 100644 --- a/docs/config.json +++ b/docs/config.json @@ -66,6 +66,9 @@ { "url": "./tmp-swagger-gen/kyve/query/v1beta1/stakers.swagger.json" }, + { + "url": "./tmp-swagger-gen/kyve/query/v1beta1/funders.swagger.json" + }, { "url": "./tmp-swagger-gen/kyve/stakers/v1beta1/query.swagger.json", "operationIds": { diff --git a/docs/swagger.yml b/docs/swagger.yml index 383e8a73..17b337e5 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -7709,6 +7709,617 @@ paths: type: boolean tags: - QueryStakers + /kyve/query/v1beta1/funder/{address}: + get: + summary: Funder queries a funder by address. + operationId: Funder + responses: + '200': + description: A successful response. + schema: + type: object + properties: + funder: + description: funder ... + type: object + properties: + address: + type: string + description: address ... + moniker: + type: string + description: moniker ... + identity: + type: string + title: identity is the 64 bit keybase.io identity string + logo: + type: string + description: logo ... + website: + type: string + description: website ... + contact: + type: string + description: contact ... + description: + type: string + description: description ... + fundings: + type: array + items: + type: object + properties: + pool_id: + type: string + format: uint64 + description: pool_id ... + amount: + type: string + format: uint64 + description: amount ... + amount_per_bundle: + type: string + format: uint64 + description: amount_per_bundle ... + total_funded: + type: string + format: uint64 + description: total_funded ... + description: Funding ... + description: fundings ... + stats: + description: stats ... + type: object + properties: + total_used_funds: + type: string + format: uint64 + description: >- + total_used_funds are the total funds that have been + distributed by the funder. + total_allocated_funds: + type: string + format: uint64 + description: >- + total_allocated_funds are the total funds that have been + allocated by the funder. They can either get distributed + or refunded. + pools_funded: + type: array + items: + type: string + format: uint64 + description: >- + pools_funded are the ids of the pools that have been + funded by the funder. + description: >- + QueryFunderResponse is the response type for the Query/Funder RPC + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: 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: address + description: address ... + in: path + required: true + type: string + - name: with_inactive_fundings + description: with_inactive_fundings ... + in: query + required: false + type: boolean + tags: + - QueryFunders + /kyve/query/v1beta1/funders: + get: + summary: Funders queries all funders. + operationId: Funders + responses: + '200': + description: A successful response. + schema: + type: object + properties: + funders: + type: array + items: + type: object + properties: + address: + type: string + description: address ... + moniker: + type: string + description: moniker ... + identity: + type: string + title: identity is the 64 bit keybase.io identity string + logo: + type: string + description: logo ... + website: + type: string + description: website ... + contact: + type: string + description: contact ... + description: + type: string + description: description ... + description: Funder ... + description: funders ... + 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: >- + QueryFundersResponse is the response type for the Query/Funders + RPC method. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: 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: 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: search + description: search ... + in: query + required: false + type: string + tags: + - QueryFunders /kyve/stakers/v1beta1/params: get: summary: Parameters queries the parameters of the module. From 448b2b896d250068d8eaca87e734710044de8ba3 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 5 Oct 2023 15:46:30 +0200 Subject: [PATCH 067/109] feat: add funders to params query --- docs/swagger.yml | 12 +++ proto/kyve/query/v1beta1/params.proto | 5 +- x/query/types/params.pb.go | 123 +++++++++++++++++++------- 3 files changed, 109 insertions(+), 31 deletions(-) diff --git a/docs/swagger.yml b/docs/swagger.yml index 17b337e5..7a758e18 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -4506,6 +4506,18 @@ paths: pool_inflation_payout_rate: type: string description: pool_inflation_payout_rate ... + funders_params: + description: funders_params ... + type: object + properties: + min_funding_amount: + type: string + format: uint64 + description: Minimum amount of tokens that can be funded. + min_funding_amount_per_bundle: + type: string + format: uint64 + description: Minimum amount of tokens that can be funded per bundle. description: QueryParamsResponse ... default: description: An unexpected error response. diff --git a/proto/kyve/query/v1beta1/params.proto b/proto/kyve/query/v1beta1/params.proto index 7d9381fe..6dd9b6f1 100644 --- a/proto/kyve/query/v1beta1/params.proto +++ b/proto/kyve/query/v1beta1/params.proto @@ -9,10 +9,11 @@ import "kyve/delegation/v1beta1/params.proto"; import "kyve/global/v1beta1/global.proto"; import "kyve/pool/v1beta1/params.proto"; import "kyve/stakers/v1beta1/params.proto"; +import "kyve/funders/v1beta1/params.proto"; option go_package = "github.com/KYVENetwork/chain/x/query/types"; -// QueryPool ... +// QueryParams ... service QueryParams { // Pools queries for all pools. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { @@ -41,4 +42,6 @@ message QueryParamsResponse { kyve.stakers.v1beta1.Params stakers_params = 5; // pool_params ... kyve.pool.v1beta1.Params pool_params = 6; + // funders_params ... + kyve.funders.v1beta1.Params funders_params = 7; } diff --git a/x/query/types/params.pb.go b/x/query/types/params.pb.go index 43458762..0e688f6c 100644 --- a/x/query/types/params.pb.go +++ b/x/query/types/params.pb.go @@ -8,6 +8,7 @@ import ( fmt "fmt" types "github.com/KYVENetwork/chain/x/bundles/types" types1 "github.com/KYVENetwork/chain/x/delegation/types" + types5 "github.com/KYVENetwork/chain/x/funders/types" types2 "github.com/KYVENetwork/chain/x/global/types" types4 "github.com/KYVENetwork/chain/x/pool/types" types3 "github.com/KYVENetwork/chain/x/stakers/types" @@ -85,6 +86,8 @@ type QueryParamsResponse struct { StakersParams *types3.Params `protobuf:"bytes,5,opt,name=stakers_params,json=stakersParams,proto3" json:"stakers_params,omitempty"` // pool_params ... PoolParams *types4.Params `protobuf:"bytes,6,opt,name=pool_params,json=poolParams,proto3" json:"pool_params,omitempty"` + // funders_params ... + FundersParams *types5.Params `protobuf:"bytes,7,opt,name=funders_params,json=fundersParams,proto3" json:"funders_params,omitempty"` } func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } @@ -162,6 +165,13 @@ func (m *QueryParamsResponse) GetPoolParams() *types4.Params { return nil } +func (m *QueryParamsResponse) GetFundersParams() *types5.Params { + if m != nil { + return m.FundersParams + } + return nil +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "kyve.query.v1beta1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "kyve.query.v1beta1.QueryParamsResponse") @@ -170,36 +180,37 @@ func init() { func init() { proto.RegisterFile("kyve/query/v1beta1/params.proto", fileDescriptor_b5269c0a69f1d3d4) } var fileDescriptor_b5269c0a69f1d3d4 = []byte{ - // 453 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xb1, 0xae, 0xd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, 0xf1, 0x93, 0x1f, 0x2b, - 0xdf, 0x59, 0xae, 0x7c, 0xe7, 0xf7, 0xca, 0x77, 0xbe, 0xae, 0xfd, 0xc6, 0x72, 0xed, 0x37, 0x7e, - 0xad, 0xfd, 0xc6, 0xbb, 0x7b, 0x32, 0xd2, 0x93, 0x3c, 0xa4, 0x23, 0x98, 0xb1, 0x67, 0x6f, 0xdf, - 0x3c, 0x7d, 0x21, 0xf4, 0x07, 0xc8, 0xa6, 0x6c, 0x34, 0xe1, 0x51, 0xc2, 0x3e, 0x22, 0x4e, 0x2f, - 0x52, 0xa1, 0xc2, 0xa6, 0x79, 0x95, 0xf7, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x81, 0x22, 0x17, - 0x0f, 0xb1, 0x03, 0x00, 0x00, + // 474 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xb1, 0x8f, 0xd3, 0x30, + 0x14, 0xc6, 0x9b, 0x3b, 0x28, 0xc2, 0xe5, 0x4e, 0x10, 0x40, 0x40, 0xa8, 0x72, 0x47, 0x84, 0x00, + 0x31, 0xd8, 0xea, 0xc1, 0xc4, 0x84, 0x38, 0x98, 0x40, 0x08, 0x18, 0x90, 0x60, 0x41, 0x4e, 0x6b, + 0xdc, 0xa8, 0x69, 0x5e, 0x1a, 0x3b, 0x81, 0x0e, 0x2c, 0xcc, 0x0c, 0x48, 0xfc, 0x53, 0x8c, 0x95, + 0x58, 0x18, 0x51, 0x8b, 0xf8, 0x3b, 0x50, 0xec, 0x97, 0xa6, 0x34, 0x2d, 0x37, 0xb5, 0x7e, 0xef, + 0xfb, 0x7e, 0x79, 0xf9, 0xfc, 0x42, 0x0e, 0x46, 0xd3, 0x42, 0xb0, 0x49, 0x2e, 0xb2, 0x29, 0x2b, + 0x7a, 0xa1, 0xd0, 0xbc, 0xc7, 0x52, 0x9e, 0xf1, 0xb1, 0xa2, 0x69, 0x06, 0x1a, 0x5c, 0xb7, 0x14, + 0x50, 0x23, 0xa0, 0x28, 0xf0, 0xae, 0xf4, 0x41, 0x8d, 0x41, 0x31, 0x09, 0x05, 0x2b, 0x7a, 0xe5, + 0x8f, 0x15, 0x7b, 0x5d, 0x09, 0x20, 0x63, 0xc1, 0x78, 0x1a, 0x31, 0x9e, 0x24, 0xa0, 0xb9, 0x8e, + 0x20, 0x41, 0x94, 0x77, 0xc3, 0x3c, 0x2b, 0xcc, 0x93, 0x41, 0x2c, 0xd4, 0xc6, 0xa7, 0x79, 0x37, + 0x8d, 0x64, 0x20, 0x62, 0x21, 0x8d, 0x75, 0xb3, 0xea, 0xd0, 0xa8, 0x64, 0x0c, 0x21, 0x8f, 0x97, + 0x0a, 0x7b, 0x44, 0x85, 0x6f, 0x14, 0x29, 0x40, 0xbc, 0x99, 0x60, 0x47, 0x51, 0x9a, 0x8f, 0x44, + 0xa6, 0xfe, 0x27, 0x79, 0x9f, 0x27, 0x83, 0x6d, 0x92, 0xe0, 0x12, 0x71, 0x5f, 0x96, 0xc1, 0xbc, + 0x30, 0xc5, 0x57, 0x62, 0x92, 0x0b, 0xa5, 0x83, 0x3f, 0xbb, 0xe4, 0xe2, 0x3f, 0x65, 0x95, 0x42, + 0xa2, 0x84, 0x7b, 0x4c, 0xf6, 0xf1, 0xdd, 0xdf, 0x59, 0xca, 0x55, 0xe7, 0xd0, 0xb9, 0xd3, 0x39, + 0xea, 0x52, 0x13, 0x31, 0xf6, 0xaa, 0x90, 0x29, 0xba, 0xf7, 0xb0, 0x6e, 0x8f, 0xee, 0x33, 0x72, + 0xa1, 0x4e, 0xa7, 0xe2, 0xec, 0x18, 0xce, 0x81, 0xe5, 0xd4, 0xed, 0x75, 0xd4, 0xf9, 0xba, 0x85, + 0xb4, 0x87, 0x64, 0xcf, 0xc6, 0x56, 0x91, 0x76, 0x0d, 0xe9, 0xba, 0x25, 0x61, 0xa2, 0x6b, 0x94, + 0x73, 0xb6, 0x8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 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -327,6 +338,18 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.FundersParams != nil { + { + size, err := m.FundersParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } if m.PoolParams != nil { { size, err := m.PoolParams.MarshalToSizedBuffer(dAtA[:i]) @@ -452,6 +475,10 @@ func (m *QueryParamsResponse) Size() (n int) { l = m.PoolParams.Size() n += 1 + l + sovParams(uint64(l)) } + if m.FundersParams != nil { + l = m.FundersParams.Size() + n += 1 + l + sovParams(uint64(l)) + } return n } @@ -756,6 +783,42 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FundersParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.FundersParams == nil { + m.FundersParams = &types5.Params{} + } + if err := m.FundersParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) From 5298410a9f87dbeaa31007b4e53c230075c3bbb7 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 5 Oct 2023 17:01:02 +0200 Subject: [PATCH 068/109] fix: todo in queries --- x/query/keeper/grpc_account_assets.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/x/query/keeper/grpc_account_assets.go b/x/query/keeper/grpc_account_assets.go index f02ca20f..bb62d192 100644 --- a/x/query/keeper/grpc_account_assets.go +++ b/x/query/keeper/grpc_account_assets.go @@ -73,11 +73,10 @@ func (k Keeper) AccountAssets(goCtx context.Context, req *types.QueryAccountAsse // ProtocolFunding // =============== - // Iterate all pools and look if the user is funding - // TODO(rapha): fix this - //for _, pool := range k.poolKeeper.GetAllPools(ctx) { - // response.ProtocolFunding += pool.GetFunderAmount(req.Address) - //} + // Iterate all fundings of the user to get total funding amount + for _, funding := range k.fundersKeeper.GetFundingsOfFunder(ctx, req.Address) { + response.ProtocolFunding += funding.Amount + } return &response, nil } From 139b518e1e6e9ab70361abc4dd5ff58c4357cf14 Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 9 Oct 2023 14:52:10 +0200 Subject: [PATCH 069/109] fix: default values for strings in x/team/types --- x/team/types/types.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/team/types/types.go b/x/team/types/types.go index 2ff5a778..62ad3767 100644 --- a/x/team/types/types.go +++ b/x/team/types/types.go @@ -43,8 +43,8 @@ type VestingStatus struct { var ( TEAM_FOUNDATION_STRING = "kyve1u7ukf2nv6v5j5y2yqprm8yqruue2rlmrkx4xgq" TEAM_BCP_STRING = "kyve1ruxaec07ca3dh0amkzxjap7av3xjt5vjgnd424" - TEAM_ALLOCATION_STRING = "165000000000000" - TGE_STRING = "2023-03-14T14:03:14" + TEAM_ALLOCATION_STRING = "165000000000000000" + TGE_STRING = "2023-02-01T10:34:15" ) // Convert passed build variables (string) to the corresponding int values From 64d85e6a981d41fb70f499da8cf6138e01807335 Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 10 Oct 2023 15:29:12 +0200 Subject: [PATCH 070/109] fix: remove logo from funder --- docs/swagger.yml | 6 - proto/kyve/funders/v1beta1/events.proto | 16 +- proto/kyve/funders/v1beta1/funders.proto | 8 +- proto/kyve/funders/v1beta1/tx.proto | 16 +- proto/kyve/query/v1beta1/funders.proto | 8 +- proto/kyve/query/v1beta1/params.proto | 2 +- x/funders/client/cli/flags.go | 2 - x/funders/client/cli/tx_create_funder.go | 4 - x/funders/client/cli/tx_update_funder.go | 2 - x/funders/keeper/msg_server_create_funder.go | 2 - .../keeper/msg_server_create_funder_test.go | 5 +- x/funders/keeper/msg_server_update_funder.go | 2 - x/funders/types/events.pb.go | 182 ++++------------- x/funders/types/funders.pb.go | 119 +++-------- x/funders/types/tx.pb.go | 193 ++++-------------- x/query/keeper/grpc_query_funder.go | 1 - x/query/types/funders.pb.go | 161 +++++---------- x/query/types/params.pb.go | 46 ++--- 18 files changed, 213 insertions(+), 562 deletions(-) diff --git a/docs/swagger.yml b/docs/swagger.yml index 7a758e18..f040d422 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -7744,9 +7744,6 @@ paths: identity: type: string title: identity is the 64 bit keybase.io identity string - logo: - type: string - description: logo ... website: type: string description: website ... @@ -8038,9 +8035,6 @@ paths: identity: type: string title: identity is the 64 bit keybase.io identity string - logo: - type: string - description: logo ... website: type: string description: website ... diff --git a/proto/kyve/funders/v1beta1/events.proto b/proto/kyve/funders/v1beta1/events.proto index f0c21008..86e0feaf 100644 --- a/proto/kyve/funders/v1beta1/events.proto +++ b/proto/kyve/funders/v1beta1/events.proto @@ -16,14 +16,12 @@ message EventCreateFunder { string moniker = 2; // identity is the 64 bit keybase.io identity string string identity = 3; - // logo ... - string logo = 4; // website ... - string website = 5; + string website = 4; // contact ... - string contact = 6; + string contact = 5; // description are some additional notes the funder finds important - string description = 7; + string description = 6; } // EventUpdateFunder is an event emitted when a funder is created. @@ -35,14 +33,12 @@ message EventUpdateFunder { string moniker = 2; // identity is the 64 bit keybase.io identity string string identity = 3; - // logo ... - string logo = 4; // website ... - string website = 5; + string website = 4; // contact ... - string contact = 6; + string contact = 5; // description are some additional notes the funder finds important - string description = 7; + string description = 6; } // EventFundPool is an event emitted when a pool is funded. diff --git a/proto/kyve/funders/v1beta1/funders.proto b/proto/kyve/funders/v1beta1/funders.proto index 19c7d7c3..2ef833f8 100644 --- a/proto/kyve/funders/v1beta1/funders.proto +++ b/proto/kyve/funders/v1beta1/funders.proto @@ -14,14 +14,12 @@ message Funder { string moniker = 2; // identity is the 64 bit keybase.io identity string string identity = 3; - // logo ... - string logo = 4; // website ... - string website = 5; + string website = 4; // contact ... - string contact = 6; + string contact = 5; // description are some additional notes the funder finds important - string description = 7; + string description = 6; } // Funding is the object which holds info about the current funding diff --git a/proto/kyve/funders/v1beta1/tx.proto b/proto/kyve/funders/v1beta1/tx.proto index 6f447ac0..7539a9ee 100644 --- a/proto/kyve/funders/v1beta1/tx.proto +++ b/proto/kyve/funders/v1beta1/tx.proto @@ -24,14 +24,12 @@ message MsgCreateFunder { string moniker = 2; // identity is the 64 bit keybase.io identity string string identity = 3; - // logo - string logo = 4; // website - string website = 5; + string website = 4; // contact - string contact = 6; + string contact = 5; // description are some additional notes the funder finds important - string description = 7; + string description = 6; } // MsgCreateFunderResponse defines the Msg/CreateFunder response type. @@ -45,14 +43,12 @@ message MsgUpdateFunder { string moniker = 2; // identity is the 64 bit keybase.io identity string string identity = 3; - // logo - string logo = 4; // website - string website = 5; + string website = 4; // contact - string contact = 6; + string contact = 5; // description are some additional notes the funder finds important - string description = 7; + string description = 6; } // MsgUpdateFunderResponse defines the Msg/UpdateFunder response type. diff --git a/proto/kyve/query/v1beta1/funders.proto b/proto/kyve/query/v1beta1/funders.proto index 54100c07..909d1672 100644 --- a/proto/kyve/query/v1beta1/funders.proto +++ b/proto/kyve/query/v1beta1/funders.proto @@ -32,14 +32,12 @@ message Funder { string moniker = 2; // identity is the 64 bit keybase.io identity string string identity = 3; - // logo ... - string logo = 4; // website ... - string website = 5; + string website = 4; // contact ... - string contact = 6; + string contact = 5; // description ... - string description = 7; + string description = 6; } // FunderStats ... diff --git a/proto/kyve/query/v1beta1/params.proto b/proto/kyve/query/v1beta1/params.proto index 6dd9b6f1..799ae5b5 100644 --- a/proto/kyve/query/v1beta1/params.proto +++ b/proto/kyve/query/v1beta1/params.proto @@ -6,10 +6,10 @@ import "cosmos/gov/v1/gov.proto"; import "google/api/annotations.proto"; import "kyve/bundles/v1beta1/params.proto"; import "kyve/delegation/v1beta1/params.proto"; +import "kyve/funders/v1beta1/params.proto"; import "kyve/global/v1beta1/global.proto"; import "kyve/pool/v1beta1/params.proto"; import "kyve/stakers/v1beta1/params.proto"; -import "kyve/funders/v1beta1/params.proto"; option go_package = "github.com/KYVENetwork/chain/x/query/types"; diff --git a/x/funders/client/cli/flags.go b/x/funders/client/cli/flags.go index 302a721c..e9258eb7 100644 --- a/x/funders/client/cli/flags.go +++ b/x/funders/client/cli/flags.go @@ -7,7 +7,6 @@ import ( const ( FlagMoniker = "moniker" FlagIdentity = "identity" - FlagLogo = "logo" FlagWebsite = "website" FlagContact = "contact" FlagDescription = "description" @@ -18,7 +17,6 @@ func flagSetFunderCreate() *flag.FlagSet { fs.String(FlagMoniker, "", "The funder's name") fs.String(FlagIdentity, "", "The optional identity signature (ex. UPort or Keybase)") - fs.String(FlagLogo, "", "The funder's (optional) logo") fs.String(FlagWebsite, "", "The funder's (optional) website") fs.String(FlagContact, "", "The funder's (optional) security contact email") fs.String(FlagDescription, "", "The funder's (optional) description") diff --git a/x/funders/client/cli/tx_create_funder.go b/x/funders/client/cli/tx_create_funder.go index f9a3e5ab..e7bb4c72 100644 --- a/x/funders/client/cli/tx_create_funder.go +++ b/x/funders/client/cli/tx_create_funder.go @@ -15,10 +15,7 @@ func CmdCreateFunder() *cobra.Command { Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) (err error) { argMoniker := args[0] - - // moniker, _ := cmd.Flags().GetString(FlagEditMoniker) identity, _ := cmd.Flags().GetString(FlagIdentity) - logo, _ := cmd.Flags().GetString(FlagLogo) website, _ := cmd.Flags().GetString(FlagWebsite) contact, _ := cmd.Flags().GetString(FlagContact) description, _ := cmd.Flags().GetString(FlagDescription) @@ -32,7 +29,6 @@ func CmdCreateFunder() *cobra.Command { Creator: clientCtx.GetFromAddress().String(), Moniker: argMoniker, Identity: identity, - Logo: logo, Website: website, Contact: contact, Description: description, diff --git a/x/funders/client/cli/tx_update_funder.go b/x/funders/client/cli/tx_update_funder.go index bbff909c..17666c62 100644 --- a/x/funders/client/cli/tx_update_funder.go +++ b/x/funders/client/cli/tx_update_funder.go @@ -15,7 +15,6 @@ func CmdUpdateFunder() *cobra.Command { RunE: func(cmd *cobra.Command, args []string) (err error) { moniker, _ := cmd.Flags().GetString(FlagMoniker) identity, _ := cmd.Flags().GetString(FlagIdentity) - logo, _ := cmd.Flags().GetString(FlagLogo) website, _ := cmd.Flags().GetString(FlagWebsite) contact, _ := cmd.Flags().GetString(FlagContact) description, _ := cmd.Flags().GetString(FlagDescription) @@ -29,7 +28,6 @@ func CmdUpdateFunder() *cobra.Command { Creator: clientCtx.GetFromAddress().String(), Moniker: moniker, Identity: identity, - Logo: logo, Website: website, Contact: contact, Description: description, diff --git a/x/funders/keeper/msg_server_create_funder.go b/x/funders/keeper/msg_server_create_funder.go index a02adc9c..36bf8ae2 100644 --- a/x/funders/keeper/msg_server_create_funder.go +++ b/x/funders/keeper/msg_server_create_funder.go @@ -25,7 +25,6 @@ func (k msgServer) CreateFunder(goCtx context.Context, msg *types.MsgCreateFunde Address: msg.Creator, Moniker: msg.Moniker, Identity: msg.Identity, - Logo: msg.Logo, Website: msg.Website, Contact: msg.Contact, Description: msg.Description, @@ -36,7 +35,6 @@ func (k msgServer) CreateFunder(goCtx context.Context, msg *types.MsgCreateFunde Address: msg.Creator, Moniker: msg.Moniker, Identity: msg.Identity, - Logo: msg.Logo, Website: msg.Website, Contact: msg.Contact, Description: msg.Description, diff --git a/x/funders/keeper/msg_server_create_funder_test.go b/x/funders/keeper/msg_server_create_funder_test.go index 1f2ffb32..2f32103a 100644 --- a/x/funders/keeper/msg_server_create_funder_test.go +++ b/x/funders/keeper/msg_server_create_funder_test.go @@ -52,7 +52,6 @@ var _ = Describe("msg_server_create_funder.go", Ordered, func() { Expect(funder.Address).To(Equal(i.ALICE)) Expect(funder.Moniker).To(Equal("moniker")) Expect(funder.Identity).To(BeEmpty()) - Expect(funder.Logo).To(BeEmpty()) Expect(funder.Website).To(BeEmpty()) Expect(funder.Contact).To(BeEmpty()) Expect(funder.Description).To(BeEmpty()) @@ -60,12 +59,11 @@ var _ = Describe("msg_server_create_funder.go", Ordered, func() { It("Create a funder with all values set", func() { // ACT - moniker, identity, logo, website, contact, description := "moniker", "identity", "logo", "website", "contact", "description" + moniker, identity, website, contact, description := "moniker", "identity", "website", "contact", "description" s.RunTxFundersSuccess(&types.MsgCreateFunder{ Creator: i.ALICE, Moniker: moniker, Identity: identity, - Logo: logo, Website: website, Contact: contact, Description: description, @@ -77,7 +75,6 @@ var _ = Describe("msg_server_create_funder.go", Ordered, func() { Expect(funder.Address).To(Equal(i.ALICE)) Expect(funder.Moniker).To(Equal(moniker)) Expect(funder.Identity).To(Equal(identity)) - Expect(funder.Logo).To(Equal(logo)) Expect(funder.Website).To(Equal(website)) Expect(funder.Contact).To(Equal(contact)) Expect(funder.Description).To(Equal(description)) diff --git a/x/funders/keeper/msg_server_update_funder.go b/x/funders/keeper/msg_server_update_funder.go index 4cb534ab..b609f768 100644 --- a/x/funders/keeper/msg_server_update_funder.go +++ b/x/funders/keeper/msg_server_update_funder.go @@ -23,7 +23,6 @@ func (k msgServer) UpdateFunder(goCtx context.Context, msg *types.MsgUpdateFunde Address: msg.Creator, Moniker: msg.Moniker, Identity: msg.Identity, - Logo: msg.Logo, Website: msg.Website, Contact: msg.Contact, Description: msg.Description, @@ -34,7 +33,6 @@ func (k msgServer) UpdateFunder(goCtx context.Context, msg *types.MsgUpdateFunde Address: msg.Creator, Moniker: msg.Moniker, Identity: msg.Identity, - Logo: msg.Logo, Website: msg.Website, Contact: msg.Contact, Description: msg.Description, diff --git a/x/funders/types/events.pb.go b/x/funders/types/events.pb.go index 9695e77d..a67955ab 100644 --- a/x/funders/types/events.pb.go +++ b/x/funders/types/events.pb.go @@ -31,14 +31,12 @@ type EventCreateFunder struct { Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` // identity is the 64 bit keybase.io identity string Identity string `protobuf:"bytes,3,opt,name=identity,proto3" json:"identity,omitempty"` - // logo ... - Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` // website ... - Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` + Website string `protobuf:"bytes,4,opt,name=website,proto3" json:"website,omitempty"` // contact ... - Contact string `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` + Contact string `protobuf:"bytes,5,opt,name=contact,proto3" json:"contact,omitempty"` // description are some additional notes the funder finds important - Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"` + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` } func (m *EventCreateFunder) Reset() { *m = EventCreateFunder{} } @@ -95,13 +93,6 @@ func (m *EventCreateFunder) GetIdentity() string { return "" } -func (m *EventCreateFunder) GetLogo() string { - if m != nil { - return m.Logo - } - return "" -} - func (m *EventCreateFunder) GetWebsite() string { if m != nil { return m.Website @@ -132,14 +123,12 @@ type EventUpdateFunder struct { Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` // identity is the 64 bit keybase.io identity string Identity string `protobuf:"bytes,3,opt,name=identity,proto3" json:"identity,omitempty"` - // logo ... - Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` // website ... - Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` + Website string `protobuf:"bytes,4,opt,name=website,proto3" json:"website,omitempty"` // contact ... - Contact string `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` + Contact string `protobuf:"bytes,5,opt,name=contact,proto3" json:"contact,omitempty"` // description are some additional notes the funder finds important - Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"` + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` } func (m *EventUpdateFunder) Reset() { *m = EventUpdateFunder{} } @@ -196,13 +185,6 @@ func (m *EventUpdateFunder) GetIdentity() string { return "" } -func (m *EventUpdateFunder) GetLogo() string { - if m != nil { - return m.Logo - } - return "" -} - func (m *EventUpdateFunder) GetWebsite() string { if m != nil { return m.Website @@ -421,31 +403,31 @@ func init() { func init() { proto.RegisterFile("kyve/funders/v1beta1/events.proto", fileDescriptor_1cf957abd56bbcb0) } var fileDescriptor_1cf957abd56bbcb0 = []byte{ - // 383 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x93, 0xc1, 0x6a, 0xdb, 0x30, - 0x18, 0xc7, 0xe3, 0xcc, 0x73, 0x36, 0x8d, 0x11, 0xa2, 0x8d, 0x4d, 0xec, 0x60, 0xb2, 0x9c, 0xc6, - 0x18, 0x36, 0x61, 0x6f, 0x90, 0x2d, 0x81, 0x31, 0x68, 0x82, 0xa1, 0x85, 0x96, 0x42, 0xb0, 0xad, - 0x2f, 0x89, 0x88, 0x23, 0x19, 0x49, 0x4e, 0x9a, 0x17, 0xe8, 0xb9, 0x8f, 0xd5, 0x4b, 0x21, 0xc7, - 0x1e, 0x4b, 0xf2, 0x22, 0x45, 0xb2, 0x9b, 0xa6, 0x87, 0xde, 0x7a, 0xea, 0x4d, 0xff, 0xef, 0xf7, - 0xf1, 0x97, 0x7e, 0x07, 0xa1, 0xef, 0xf3, 0xf5, 0x12, 0xc2, 0x49, 0xc1, 0x29, 0x48, 0x15, 0x2e, - 0xbb, 0x09, 0xe8, 0xb8, 0x1b, 0xc2, 0x12, 0xb8, 0x56, 0x41, 0x2e, 0x85, 0x16, 0xf8, 0xb3, 0x59, - 0x09, 0xaa, 0x95, 0xa0, 0x5a, 0xe9, 0xdc, 0x38, 0xa8, 0xd5, 0x37, 0x6b, 0x7f, 0x24, 0x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d1, 0x55, 0xcf, 0xde, 0xd0, 0x1b, 0x5c, 0x6f, 0x7d, 0x67, 0xb3, 0xf5, 0x9d, 0xbb, - 0xad, 0xef, 0x5c, 0xed, 0xfc, 0xda, 0x66, 0xe7, 0xd7, 0x6e, 0x77, 0x7e, 0xed, 0xec, 0xd7, 0x94, - 0xe9, 0x59, 0x91, 0x04, 0xa9, 0x58, 0x84, 0xff, 0x4f, 0x4f, 0xfa, 0x47, 0xa0, 0x57, 0x42, 0xce, - 0xc3, 0x74, 0x16, 0x33, 0x1e, 0x5e, 0xec, 0xff, 0x88, 0x5e, 0xe7, 0xa0, 0x12, 0xcf, 0xfe, 0x8d, - 0xdf, 0xf7, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa6, 0x97, 0x99, 0x63, 0x40, 0x03, 0x00, 0x00, + // 373 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x92, 0xc1, 0x4a, 0xe3, 0x40, + 0x18, 0xc7, 0x9b, 0x6e, 0x36, 0xdd, 0x9d, 0x65, 0x29, 0xcd, 0x2e, 0xbb, 0x61, 0x0f, 0xa1, 0xdb, + 0xd3, 0xb2, 0x48, 0x42, 0xf1, 0x0d, 0xaa, 0x2d, 0x88, 0x60, 0x4b, 0x40, 0x41, 0x11, 0x4a, 0x92, + 0xf9, 0x6a, 0x87, 0xb6, 0x33, 0x61, 0xe6, 0x4b, 0x6b, 0x5f, 0xc0, 0xb3, 0xaf, 0xe3, 0x1b, 0x78, + 0xec, 0xd1, 0xa3, 0xb4, 0x2f, 0x22, 0x33, 0x89, 0xb5, 0x1e, 0xbc, 0x79, 0xf1, 0x96, 0xff, 0xfc, + 0xfe, 0x33, 0xf9, 0x7d, 0xf0, 0x91, 0xbf, 0x93, 0xe5, 0x1c, 0xc2, 0x51, 0xce, 0x29, 0x48, 0x15, + 0xce, 0xdb, 0x09, 0x60, 0xdc, 0x0e, 0x61,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7f, 0x93, 0x56, 0x40, + 0x7e, 0x98, 0xd7, 0xf5, 0xbb, 0xfd, 0x1c, 0xfb, 0x23, 0x3d, 0xae, 0x7a, 0xf3, 0x0f, 0x9d, 0xde, + 0xfd, 0xda, 0xb7, 0x56, 0x6b, 0xdf, 0x7a, 0x5c, 0xfb, 0xd6, 0xed, 0xc6, 0xaf, 0xac, 0x36, 0x7e, + 0xe5, 0x61, 0xe3, 0x57, 0x2e, 0xf6, 0xae, 0x18, 0x8e, 0xf3, 0x24, 0x48, 0xc5, 0x2c, 0x3c, 0x3e, + 0x3f, 0xeb, 0x9e, 0x00, 0x2e, 0x84, 0x9c, 0x84, 0xe9, 0x38, 0x66, 0x3c, 0xbc, 0xde, 0xee, 0x3e, + 0x2e, 0x33, 0x50, 0x89, 0x63, 0x76, 0x7e, 0xff, 0x29, 0x00, 0x00, 0xff, 0xff, 0x41, 0xe2, 0x8e, + 0xb0, 0x18, 0x03, 0x00, 0x00, } func (m *EventCreateFunder) Marshal() (dAtA []byte, err error) { @@ -473,27 +455,20 @@ func (m *EventCreateFunder) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Description) i = encodeVarintEvents(dAtA, i, uint64(len(m.Description))) i-- - dAtA[i] = 0x3a + dAtA[i] = 0x32 } if len(m.Contact) > 0 { i -= len(m.Contact) copy(dAtA[i:], m.Contact) i = encodeVarintEvents(dAtA, i, uint64(len(m.Contact))) i-- - dAtA[i] = 0x32 + dAtA[i] = 0x2a } if len(m.Website) > 0 { i -= len(m.Website) copy(dAtA[i:], m.Website) i = encodeVarintEvents(dAtA, i, uint64(len(m.Website))) i-- - dAtA[i] = 0x2a - } - if len(m.Logo) > 0 { - i -= len(m.Logo) - copy(dAtA[i:], m.Logo) - i = encodeVarintEvents(dAtA, i, uint64(len(m.Logo))) - i-- dAtA[i] = 0x22 } if len(m.Identity) > 0 { @@ -545,27 +520,20 @@ func (m *EventUpdateFunder) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Description) i = encodeVarintEvents(dAtA, i, uint64(len(m.Description))) i-- - dAtA[i] = 0x3a + dAtA[i] = 0x32 } if len(m.Contact) > 0 { i -= len(m.Contact) copy(dAtA[i:], m.Contact) i = encodeVarintEvents(dAtA, i, uint64(len(m.Contact))) i-- - dAtA[i] = 0x32 + dAtA[i] = 0x2a } if len(m.Website) > 0 { i -= len(m.Website) copy(dAtA[i:], m.Website) i = encodeVarintEvents(dAtA, i, uint64(len(m.Website))) i-- - dAtA[i] = 0x2a - } - if len(m.Logo) > 0 { - i -= len(m.Logo) - copy(dAtA[i:], m.Logo) - i = encodeVarintEvents(dAtA, i, uint64(len(m.Logo))) - i-- dAtA[i] = 0x22 } if len(m.Identity) > 0 { @@ -734,10 +702,6 @@ func (m *EventCreateFunder) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - l = len(m.Logo) - if l > 0 { - n += 1 + l + sovEvents(uint64(l)) - } l = len(m.Website) if l > 0 { n += 1 + l + sovEvents(uint64(l)) @@ -771,10 +735,6 @@ func (m *EventUpdateFunder) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - l = len(m.Logo) - if l > 0 { - n += 1 + l + sovEvents(uint64(l)) - } l = len(m.Website) if l > 0 { n += 1 + l + sovEvents(uint64(l)) @@ -975,38 +935,6 @@ func (m *EventCreateFunder) Unmarshal(dAtA []byte) error { m.Identity = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Logo", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvents - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvents - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Logo = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) } @@ -1038,7 +966,7 @@ func (m *EventCreateFunder) Unmarshal(dAtA []byte) error { } m.Website = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Contact", wireType) } @@ -1070,7 +998,7 @@ func (m *EventCreateFunder) Unmarshal(dAtA []byte) error { } m.Contact = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } @@ -1249,38 +1177,6 @@ func (m *EventUpdateFunder) Unmarshal(dAtA []byte) error { m.Identity = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Logo", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvents - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvents - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Logo = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) } @@ -1312,7 +1208,7 @@ func (m *EventUpdateFunder) Unmarshal(dAtA []byte) error { } m.Website = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Contact", wireType) } @@ -1344,7 +1240,7 @@ func (m *EventUpdateFunder) Unmarshal(dAtA []byte) error { } m.Contact = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } diff --git a/x/funders/types/funders.pb.go b/x/funders/types/funders.pb.go index 1af79baa..e47ea8a4 100644 --- a/x/funders/types/funders.pb.go +++ b/x/funders/types/funders.pb.go @@ -30,14 +30,12 @@ type Funder struct { Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` // identity is the 64 bit keybase.io identity string Identity string `protobuf:"bytes,3,opt,name=identity,proto3" json:"identity,omitempty"` - // logo ... - Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` // website ... - Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` + Website string `protobuf:"bytes,4,opt,name=website,proto3" json:"website,omitempty"` // contact ... - Contact string `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` + Contact string `protobuf:"bytes,5,opt,name=contact,proto3" json:"contact,omitempty"` // description are some additional notes the funder finds important - Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"` + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` } func (m *Funder) Reset() { *m = Funder{} } @@ -94,13 +92,6 @@ func (m *Funder) GetIdentity() string { return "" } -func (m *Funder) GetLogo() string { - if m != nil { - return m.Logo - } - return "" -} - func (m *Funder) GetWebsite() string { if m != nil { return m.Website @@ -282,33 +273,32 @@ func init() { } var fileDescriptor_252d80f89b0fa299 = []byte{ - // 409 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x92, 0x41, 0x6b, 0xd4, 0x40, - 0x14, 0xc7, 0x77, 0xda, 0x98, 0xb5, 0xd3, 0xaa, 0x38, 0xa8, 0x1d, 0x3c, 0x84, 0x35, 0x20, 0x14, - 0x91, 0x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xff, - 0xff, 0x49, 0x3b, 0xb1, 0x5c, 0x87, 0x02, 0x00, 0x00, + // 397 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x92, 0xd1, 0x8a, 0xd3, 0x40, + 0x14, 0x86, 0x3b, 0xbb, 0x31, 0x75, 0x67, 0x57, 0xc5, 0x41, 0xdd, 0xc1, 0x8b, 0x50, 0x03, 0xc2, + 0x22, 0xd2, 0xb0, 0x08, 0xde, 0xef, 0x82, 0x05, 0x11, 0x44, 0x22, 0x08, 0x7a, 0x13, 0x26, 0x99, + 0xe3, 0xee, 0xd0, 0x76, 0x26, 0xcc, 0x9c, 0xb4, 0xf6, 0xd6, 0x27, 0xf0, 0x49, 0xc4, 0xc7, 0xf0, + 0xb2, 0x97, 0x5e, 0x4a, 0xfb, 0x22, 0x92, 0x99, 0xb4, 0x36, 0x77, 0xf9, 0xff, 0xff, 0x1c, 0xf2, + 0xfd, 0xc3, 0xa1, 0xe9, 0x74, 0xb5, 0x80, 0xec, 0x6b, 0xa3, 0x25, 0x58, 0x97, 0x2d, 0x2e, 0x4b, + 0x40, 0x71, 0xb9, 0xd3, 0xe3, 0xda, 0x1a, 0x34, 0xec, 0x51, 0x3b, 0x33, 0xde, 0x79, 0xdd, 0x4c, + 0xfa, 0x93, 0xd0, 0x78, 0xe2, 0x3d, 0xc6, 0xe9, 0x50, 0x48, 0x69, 0xc1, 0x39, 0x4e, 0x46, 0xe4, + 0xe2, 0x24, 0xdf, 0xc9, 0x36, 0x99, 0x1b, 0xad, 0xa6, 0x60, 0xf9, 0x51, 0x48, 0x3a, 0xc9, 0x9e, + 0xd2, 0xbb, 0x4a, 0x82, 0x46, 0x85, 0x2b, 0x7e, 0xec, 0xa3, 0xbd, 0x6e, 0xb7, 0x96, 0x50, 0x3a, + 0x85, 0xc0, 0xa3, 0xb0, 0xd5, 0xc9, 0x36, 0xa9, 0x8c, 0x46, 0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, + 0x94, 0xe3, 0xca, 0xcc, 0xb3, 0x77, 0x9f, 0x3f, 0xbd, 0x79, 0x0f, 0xb8, 0x34, 0x76, 0x9a, 0x55, + 0xb7, 0x42, 0xe9, 0xec, 0xdb, 0xfe, 0xac, 0x70, 0x55, 0x83, 0x2b, 0x63, 0x7f, 0x4d, 0xaf, 0xfe, + 0x05, 0x00, 0x00, 0xff, 0xff, 0xa8, 0x19, 0x79, 0xa7, 0x73, 0x02, 0x00, 0x00, } func (m *Funder) Marshal() (dAtA []byte, err error) { @@ -336,27 +326,20 @@ func (m *Funder) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Description) i = encodeVarintFunders(dAtA, i, uint64(len(m.Description))) i-- - dAtA[i] = 0x3a + dAtA[i] = 0x32 } if len(m.Contact) > 0 { i -= len(m.Contact) copy(dAtA[i:], m.Contact) i = encodeVarintFunders(dAtA, i, uint64(len(m.Contact))) i-- - dAtA[i] = 0x32 + dAtA[i] = 0x2a } if len(m.Website) > 0 { i -= len(m.Website) copy(dAtA[i:], m.Website) i = encodeVarintFunders(dAtA, i, uint64(len(m.Website))) i-- - dAtA[i] = 0x2a - } - if len(m.Logo) > 0 { - i -= len(m.Logo) - copy(dAtA[i:], m.Logo) - i = encodeVarintFunders(dAtA, i, uint64(len(m.Logo))) - i-- dAtA[i] = 0x22 } if len(m.Identity) > 0 { @@ -504,10 +487,6 @@ func (m *Funder) Size() (n int) { if l > 0 { n += 1 + l + sovFunders(uint64(l)) } - l = len(m.Logo) - if l > 0 { - n += 1 + l + sovFunders(uint64(l)) - } l = len(m.Website) if l > 0 { n += 1 + l + sovFunders(uint64(l)) @@ -701,38 +680,6 @@ func (m *Funder) Unmarshal(dAtA []byte) error { m.Identity = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Logo", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFunders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthFunders - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthFunders - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Logo = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) } @@ -764,7 +711,7 @@ func (m *Funder) Unmarshal(dAtA []byte) error { } m.Website = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Contact", wireType) } @@ -796,7 +743,7 @@ func (m *Funder) Unmarshal(dAtA []byte) error { } m.Contact = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } diff --git a/x/funders/types/tx.pb.go b/x/funders/types/tx.pb.go index 2d42010c..779d0930 100644 --- a/x/funders/types/tx.pb.go +++ b/x/funders/types/tx.pb.go @@ -35,14 +35,12 @@ type MsgCreateFunder struct { Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` // identity is the 64 bit keybase.io identity string Identity string `protobuf:"bytes,3,opt,name=identity,proto3" json:"identity,omitempty"` - // logo - Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` // website - Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` + Website string `protobuf:"bytes,4,opt,name=website,proto3" json:"website,omitempty"` // contact - Contact string `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` + Contact string `protobuf:"bytes,5,opt,name=contact,proto3" json:"contact,omitempty"` // description are some additional notes the funder finds important - Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"` + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` } func (m *MsgCreateFunder) Reset() { *m = MsgCreateFunder{} } @@ -99,13 +97,6 @@ func (m *MsgCreateFunder) GetIdentity() string { return "" } -func (m *MsgCreateFunder) GetLogo() string { - if m != nil { - return m.Logo - } - return "" -} - func (m *MsgCreateFunder) GetWebsite() string { if m != nil { return m.Website @@ -172,14 +163,12 @@ type MsgUpdateFunder struct { Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` // identity is the 64 bit keybase.io identity string Identity string `protobuf:"bytes,3,opt,name=identity,proto3" json:"identity,omitempty"` - // logo - Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` // website - Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` + Website string `protobuf:"bytes,4,opt,name=website,proto3" json:"website,omitempty"` // contact - Contact string `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` + Contact string `protobuf:"bytes,5,opt,name=contact,proto3" json:"contact,omitempty"` // description are some additional notes the funder finds important - Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"` + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` } func (m *MsgUpdateFunder) Reset() { *m = MsgUpdateFunder{} } @@ -236,13 +225,6 @@ func (m *MsgUpdateFunder) GetIdentity() string { return "" } -func (m *MsgUpdateFunder) GetLogo() string { - if m != nil { - return m.Logo - } - return "" -} - func (m *MsgUpdateFunder) GetWebsite() string { if m != nil { return m.Website @@ -526,37 +508,36 @@ func init() { func init() { proto.RegisterFile("kyve/funders/v1beta1/tx.proto", fileDescriptor_5145d80c2db97f3d) } var fileDescriptor_5145d80c2db97f3d = []byte{ - // 470 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x54, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0x8d, 0x89, 0x49, 0xca, 0x14, 0x54, 0xb1, 0x50, 0x62, 0x22, 0x61, 0x95, 0x20, 0x24, 0x3e, - 0x6d, 0x15, 0xfe, 0x41, 0x81, 0x4a, 0x08, 0x05, 0x55, 0x96, 0x40, 0xd0, 0x03, 0x91, 0xed, 0x9d, - 0xba, 0xab, 0x24, 0xbb, 0xd6, 0xee, 0xa6, 0x6d, 0xee, 0xdc, 0xb8, 0xf0, 0xb3, 0x90, 0xb8, 0xf4, - 0xc8, 0x11, 0x25, 0x7f, 0x04, 0x79, 0xfd, 0x81, 0x53, 0x35, 0x25, 0x07, 0x4e, 0xbd, 0xf9, 0xcd, - 0x7b, 0x3b, 0x6f, 0x9f, 0x66, 0xbc, 0x70, 0x6f, 0x38, 0x3d, 0x42, 0xff, 0x60, 0xc2, 0x29, 0x4a, - 0xe5, 0x1f, 0x6d, 0x47, 0xa8, 0xc3, 0x6d, 0x5f, 0x9f, 0x78, 0xa9, 0x14, 0x5a, 0x90, 0xdb, 0x19, - 0xed, 0x15, 0xb4, 0x57, 0xd0, 0xbd, 0x9f, 0x16, 0x6c, 0xf4, 0x55, 0xf2, 0x4a, 0x62, 0xa8, 0x71, - 0xd7, 0x90, 0xc4, 0x81, 0x76, 0x9c, 0x61, 0x21, 0x1d, 0x6b, 0xcb, 0x7a, 0x74, 0x2d, 0x28, 0x61, - 0xc6, 0x8c, 0x05, 0x67, 0x43, 0x94, 0xce, 0x95, 0x9c, 0x29, 0x20, 0xe9, 0xc2, 0x1a, 0xa3, 0xc8, - 0x35, 0xd3, 0x53, 0xa7, 0x69, 0xa8, 0x0a, 0x13, 0x02, 0xf6, 0x48, 0x24, 0xc2, 0xb1, 0x4d, 0xdd, - 0x7c, 0x67, 0x9d, 0x8e, 0x31, 0x52, 0x4c, 0xa3, 0x73, 0x35, 0xef, 0x54, 0x40, 0xe3, 0x2e, 0xb8, - 0x0e, 0x63, 0xed, 0xb4, 0x0a, 0xf7, 0x1c, 0x92, 0x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80, 0xda, 0x7c, - 0x1e, 0x2c, 0x3d, 0xf8, 0x57, 0xd4, 0x7d, 0xba, 0x82, 0xa8, 0xec, 0xbf, 0xb3, 0xfb, 0x63, 0xe6, - 0x5a, 0xa7, 0x33, 0xd7, 0xfa, 0x3d, 0x73, 0xad, 0xef, 0x73, 0xb7, 0x71, 0x3a, 0x77, 0x1b, 0xbf, - 0xe6, 0x6e, 0x63, 0xff, 0x59, 0xc2, 0xf4, 0xe1, 0x24, 0xf2, 0x62, 0x31, 0xf6, 0xdf, 0x7d, 0xfe, - 0xf8, 0xe6, 0x3d, 0xea, 0x63, 0x21, 0x87, 0x7e, 0x7c, 0x18, 0x32, 0xee, 0x9f, 0x54, 0x6f, 0x9b, - 0x9e, 0xa6, 0xa8, 0xa2, 0x96, 0x79, 0xd7, 0x5e, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xf5, 0xee, - 0x83, 0x69, 0xf8, 0x04, 0x00, 0x00, + // 460 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0x8d, 0x49, 0x48, 0xcb, 0x14, 0x54, 0xb1, 0x50, 0x62, 0x22, 0x61, 0x95, 0x20, 0x24, 0x3e, + 0x6d, 0x15, 0xfe, 0x41, 0x81, 0x4a, 0x08, 0x19, 0x55, 0x96, 0x40, 0xd0, 0x03, 0x91, 0xed, 0x9d, + 0xba, 0xab, 0x24, 0xbb, 0xd6, 0xee, 0xba, 0x6d, 0xee, 0xdc, 0xb8, 0xf0, 0x6f, 0xf8, 0x0b, 0x1c, + 0x7b, 0xe4, 0x88, 0x92, 0x3f, 0x82, 0xbc, 0xfe, 0xc0, 0xa9, 0x9a, 0xd2, 0x03, 0x97, 0xde, 0xfc, + 0xf6, 0xbd, 0x99, 0x37, 0x4f, 0x33, 0x32, 0xdc, 0x1b, 0x4d, 0x0f, 0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 0x5c, 0xd0, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -780,27 +761,20 @@ func (m *MsgCreateFunder) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Description) i = encodeVarintTx(dAtA, i, uint64(len(m.Description))) i-- - dAtA[i] = 0x3a + dAtA[i] = 0x32 } if len(m.Contact) > 0 { i -= len(m.Contact) copy(dAtA[i:], m.Contact) i = encodeVarintTx(dAtA, i, uint64(len(m.Contact))) i-- - dAtA[i] = 0x32 + dAtA[i] = 0x2a } if len(m.Website) > 0 { i -= len(m.Website) copy(dAtA[i:], m.Website) i = encodeVarintTx(dAtA, i, uint64(len(m.Website))) i-- - dAtA[i] = 0x2a - } - if len(m.Logo) > 0 { - i -= len(m.Logo) - copy(dAtA[i:], m.Logo) - i = encodeVarintTx(dAtA, i, uint64(len(m.Logo))) - i-- dAtA[i] = 0x22 } if len(m.Identity) > 0 { @@ -875,27 +849,20 @@ func (m *MsgUpdateFunder) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Description) i = encodeVarintTx(dAtA, i, uint64(len(m.Description))) i-- - dAtA[i] = 0x3a + dAtA[i] = 0x32 } if len(m.Contact) > 0 { i -= len(m.Contact) copy(dAtA[i:], m.Contact) i = encodeVarintTx(dAtA, i, uint64(len(m.Contact))) i-- - dAtA[i] = 0x32 + dAtA[i] = 0x2a } if len(m.Website) > 0 { i -= len(m.Website) copy(dAtA[i:], m.Website) i = encodeVarintTx(dAtA, i, uint64(len(m.Website))) i-- - dAtA[i] = 0x2a - } - if len(m.Logo) > 0 { - i -= len(m.Logo) - copy(dAtA[i:], m.Logo) - i = encodeVarintTx(dAtA, i, uint64(len(m.Logo))) - i-- dAtA[i] = 0x22 } if len(m.Identity) > 0 { @@ -1105,10 +1072,6 @@ func (m *MsgCreateFunder) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Logo) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } l = len(m.Website) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -1151,10 +1114,6 @@ func (m *MsgUpdateFunder) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Logo) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } l = len(m.Website) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -1370,38 +1329,6 @@ func (m *MsgCreateFunder) Unmarshal(dAtA []byte) error { m.Identity = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Logo", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Logo = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) } @@ -1433,7 +1360,7 @@ func (m *MsgCreateFunder) Unmarshal(dAtA []byte) error { } m.Website = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Contact", wireType) } @@ -1465,7 +1392,7 @@ func (m *MsgCreateFunder) Unmarshal(dAtA []byte) error { } m.Contact = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } @@ -1694,38 +1621,6 @@ func (m *MsgUpdateFunder) Unmarshal(dAtA []byte) error { m.Identity = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Logo", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Logo = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) } @@ -1757,7 +1652,7 @@ func (m *MsgUpdateFunder) Unmarshal(dAtA []byte) error { } m.Website = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Contact", wireType) } @@ -1789,7 +1684,7 @@ func (m *MsgUpdateFunder) Unmarshal(dAtA []byte) error { } m.Contact = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } diff --git a/x/query/keeper/grpc_query_funder.go b/x/query/keeper/grpc_query_funder.go index 2175ffc7..9dbd777c 100644 --- a/x/query/keeper/grpc_query_funder.go +++ b/x/query/keeper/grpc_query_funder.go @@ -82,7 +82,6 @@ func (k Keeper) parseFunder(funder *fundersTypes.Funder) types.Funder { Address: funder.Address, Moniker: funder.Moniker, Identity: funder.Identity, - Logo: funder.Logo, Website: funder.Website, Contact: funder.Contact, Description: funder.Description, diff --git a/x/query/types/funders.pb.go b/x/query/types/funders.pb.go index 6bfd1862..e0d9bd77 100644 --- a/x/query/types/funders.pb.go +++ b/x/query/types/funders.pb.go @@ -38,14 +38,12 @@ type Funder struct { Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` // identity is the 64 bit keybase.io identity string Identity string `protobuf:"bytes,3,opt,name=identity,proto3" json:"identity,omitempty"` - // logo ... - Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` // website ... - Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` + Website string `protobuf:"bytes,4,opt,name=website,proto3" json:"website,omitempty"` // contact ... - Contact string `protobuf:"bytes,6,opt,name=contact,proto3" json:"contact,omitempty"` + Contact string `protobuf:"bytes,5,opt,name=contact,proto3" json:"contact,omitempty"` // description ... - Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"` + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` } func (m *Funder) Reset() { *m = Funder{} } @@ -102,13 +100,6 @@ func (m *Funder) GetIdentity() string { return "" } -func (m *Funder) GetLogo() string { - if m != nil { - return m.Logo - } - return "" -} - func (m *Funder) GetWebsite() string { if m != nil { return m.Website @@ -509,54 +500,53 @@ func init() { func init() { proto.RegisterFile("kyve/query/v1beta1/funders.proto", fileDescriptor_a182f068d9f0dba9) } var fileDescriptor_a182f068d9f0dba9 = []byte{ - // 737 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0xcf, 0x6b, 0x13, 0x4d, - 0x18, 0xce, 0x26, 0x69, 0xd2, 0x6f, 0xb6, 0x7c, 0xdf, 0xe7, 0xb4, 0xd6, 0x25, 0xd5, 0x34, 0xae, - 0xd2, 0x86, 0x22, 0xbb, 0x34, 0xea, 0x45, 0xf0, 0x60, 0xd1, 0x4a, 0x11, 0xa4, 0xae, 0x28, 0xe8, - 0x25, 0x4c, 0x76, 0xc7, 0xcd, 0xd0, 0xcd, 0xcc, 0x76, 0x67, 0xb6, 0x35, 0x88, 0x07, 0xbd, 0x88, - 0x17, 0x11, 0x3c, 0xea, 0xff, 0x22, 0x78,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0x60, 0x47, - 0x98, 0x87, 0x19, 0x49, 0xa5, 0x70, 0xa7, 0xaa, 0xd0, 0xd1, 0x96, 0xfb, 0xce, 0x02, 0xb6, 0xbe, - 0xc4, 0x43, 0x81, 0x04, 0x87, 0x4d, 0xf0, 0xbf, 0x60, 0x02, 0x25, 0xed, 0x9c, 0xe3, 0xa8, 0x2d, - 0x4d, 0xd6, 0x57, 0x2a, 0x07, 0xff, 0xaa, 0xfe, 0x23, 0x8e, 0x23, 0xc9, 0xe7, 0xb0, 0x05, 0xce, - 0x6a, 0x26, 0x4a, 0x12, 0x16, 0x22, 0x31, 0xa4, 0x17, 0x15, 0x7d, 0x5e, 0x81, 0xb7, 0x06, 0x98, - 0x9e, 0xb9, 0x08, 0xe6, 0x52, 0xc6, 0x12, 0xae, 0x98, 0x38, 0x72, 0x4a, 0x8d, 0x52, 0xb3, 0x1c, - 0xd8, 0xaa, 0xa7, 0x54, 0x44, 0xee, 0x5b, 0x0b, 0x54, 0xe5, 0x92, 0xd0, 0x18, 0x9e, 0x03, 0x55, - 0x09, 0xb5, 0x49, 0x64, 0x34, 0x54, 0x64, 0xb9, 0x15, 0xc1, 0x45, 0x50, 0x41, 0x3d, 0x96, 0x53, - 0x61, 0x0e, 0x33, 0x15, 0x5c, 0x03, 0x67, 0xf4, 0xaa, 0x9d, 0xe2, 0xac, 0xdd, 0xc9, 0x69, 0x94, - 0x60, 0x65, 0x6e, 0x39, 0xf8, 0x4f, 0x03, 0xdb, 0x38, 0xdb, 0x50, 0x6d, 0xa9, 0x45, 0xeb, 0x37, - 0x5a, 0xca, 0x8a, 0x66, 0xab, 0x9e, 0xd1, 0x92, 0x83, 0xf9, 0x07, 0x32, 0x37, 0xda, 0x20, 0x1e, - 0xe0, 0xdd, 0x1c, 0x73, 0x01, 0x37, 0x01, 0x38, 0x09, 0x90, 0x52, 0x66, 0xb7, 0x56, 0x3c, 0x9d, - 0x36, 0x4f, 0xa6, 0x6d, 0x3c, 0x88, 0xde, 0x36,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0xd7, 0x5f, - 0x7f, 0x7e, 0x28, 0x5e, 0x80, 0x4b, 0xfe, 0xe4, 0xd7, 0x12, 0xbe, 0x39, 0x79, 0xb3, 0x56, 0xa6, - 0xec, 0x3c, 0x50, 0xb0, 0x3a, 0x95, 0x67, 0x04, 0x5c, 0x51, 0x02, 0x56, 0xe0, 0xe5, 0xc9, 0x02, - 0xfc, 0x17, 0x26, 0x15, 0x2f, 0x37, 0x6e, 0x1f, 0x1c, 0xd5, 0xad, 0xc3, 0xa3, 0xba, 0xf5, 0xe3, - 0xa8, 0x6e, 0xbd, 0x3f, 0xae, 0x17, 0x0e, 0x8f, 0xeb, 0x85, 0x6f, 0xc7, 0xf5, 0xc2, 0xd3, 0xb5, - 0x98, 0x88, 0x6e, 0xde, 0xf1, 0x42, 0xd6, 0xf3, 0xef, 0x3d, 0x79, 0x7c, 0xe7, 0x3e, 0x16, 0xfb, - 0x2c, 0xdb, 0xf1, 0xc3, 0x2e, 0x22, 0xd4, 0x7f, 0x6e, 0x36, 0x16, 0xfd, 0x14, 0xf3, 0x4e, 0x45, - 0x3d, 0xc5, 0x57, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0xf3, 0x64, 0x62, 0xc8, 0x22, 0x06, 0x00, - 0x00, + // 724 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0x4f, 0x6b, 0x13, 0x41, + 0x1c, 0xcd, 0x26, 0x69, 0x52, 0x67, 0x8b, 0x7f, 0xa6, 0xb5, 0x2e, 0xa9, 0xa6, 0x71, 0x95, 0x36, + 0x14, 0xd9, 0xa5, 0x51, 0x2f, 0x82, 0x07, 0x8b, 0x56, 0x8a, 0x20, 0x75, 0x45, 0x41, 0x2f, 0x61, + 0xb2, 0x3b, 0x6e, 0x86, 0x26, 0x33, 0xdb, 0x9d, 0xd9, 0xd6, 0x20, 0x1e, 0xf4, 0x22, 0x5e, 0x44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x48, 0x93, 0x4e, 0x49, 0xa1, 0xa3, 0x5b, 0xee, 0x07, + 0x0b, 0xd8, 0xda, 0xf0, 0x63, 0x81, 0x04, 0x87, 0x75, 0x70, 0x56, 0x30, 0x81, 0x3a, 0xcd, 0x8c, + 0xe3, 0xa8, 0x29, 0x03, 0xd5, 0xf6, 0x8b, 0xc1, 0x69, 0xb5, 0xff, 0x84, 0xe3, 0x48, 0xf2, 0x39, + 0x6c, 0x80, 0xf3, 0x9a, 0x89, 0x3a, 0x1d, 0x16, 0x22, 0x31, 0xa4, 0xe7, 0x15, 0x7d, 0x5e, 0x81, + 0x77, 0x06, 0x98, 0xd6, 0x5c, 0x06, 0x73, 0x09, 0x63, 0x1d, 0xae, 0x98, 0x38, 0x72, 0x0a, 0xb5, + 0x42, 0xbd, 0x18, 0xd8, 0x6a, 0x4f, 0xb9, 0x88, 0xdc, 0xf7, 0x16, 0x28, 0xcb, 0x25, 0xa1, 0x31, + 0xbc, 0x00, 0xca, 0x12, 0x6a, 0x92, 0xc8, 0x78, 0x28, 0xc9, 0x71, 0x2b, 0x82, 0x8b, 0xa0, 0x84, + 0xba, 0x2c, 0xa3, 0xc2, 0x1c, 0x66, 0x26, 0xb8, 0x06, 0xce, 0xe9, 0x55, 0x33, 0xc1, 0x69, 0xb3, + 0x95, 0xd1, 0xa8, 0x83, 0x55, 0x90, 0xc5, 0xe0, 0x8c, 0x06, 0xb6, 0x71, 0xba, 0xa1, 0xb6, 0xa5, + 0x17, 0xed, 0xdf, 0x78, 0x29, 0x2a, 0x9a, 0xad, 0xf6, 0x8c, 0x97, 0x0c, 0xcc, 0x3f, 0x92, 0x1d, + 0xd1, 0x01, 0xf1, 0x00, 0xef, 0x66, 0x98, 0x0b, 0xb8, 0x09, 0xc0, 0x71, 0x59, 0x94, 0x33, 0xbb, + 0xb1, 0xe2, 0xe9, 0x66, 0x79, 0xb2, 0x59, 0xe3, 0xa5, 0xf3, 0xb6, 0x51, 0x8c, 0x8d, 0x36, 0x18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0x4b, 0x70, 0xc9, 0x9f, 0x7c, 0x33, 0xc2, 0x77, 0xc7, 0xf7, + 0xd3, 0xca, 0x94, 0x27, 0x0f, 0x1c, 0xac, 0x4e, 0xe5, 0x19, 0x03, 0xd7, 0x94, 0x81, 0x15, 0x78, + 0x75, 0xb2, 0x01, 0xff, 0x95, 0x69, 0xc5, 0xeb, 0x8d, 0xbb, 0x07, 0x47, 0x55, 0xeb, 0xf0, 0xa8, + 0x6a, 0xfd, 0x3a, 0xaa, 0x5a, 0x1f, 0xfb, 0xd5, 0xdc, 0x61, 0xbf, 0x9a, 0xfb, 0xd1, 0xaf, 0xe6, + 0x9e, 0xaf, 0xc5, 0x44, 0xb4, 0xb3, 0x96, 0x17, 0xb2, 0xae, 0xff, 0xe0, 0xd9, 0xd3, 0x7b, 0x0f, + 0xb1, 0xd8, 0x67, 0xe9, 0x8e, 0x1f, 0xb6, 0x11, 0xa1, 0xfe, 0x4b, 0xf3, 0x60, 0xd1, 0x4b, 0x30, + 0x6f, 0x95, 0xd4, 0xb5, 0x7b, 0xfd, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x43, 0x76, 0x14, 0x80, + 0x0e, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -704,27 +694,20 @@ func (m *Funder) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Description) i = encodeVarintFunders(dAtA, i, uint64(len(m.Description))) i-- - dAtA[i] = 0x3a + dAtA[i] = 0x32 } if len(m.Contact) > 0 { i -= len(m.Contact) copy(dAtA[i:], m.Contact) i = encodeVarintFunders(dAtA, i, uint64(len(m.Contact))) i-- - dAtA[i] = 0x32 + dAtA[i] = 0x2a } if len(m.Website) > 0 { i -= len(m.Website) copy(dAtA[i:], m.Website) i = encodeVarintFunders(dAtA, i, uint64(len(m.Website))) i-- - dAtA[i] = 0x2a - } - if len(m.Logo) > 0 { - i -= len(m.Logo) - copy(dAtA[i:], m.Logo) - i = encodeVarintFunders(dAtA, i, uint64(len(m.Logo))) - i-- dAtA[i] = 0x22 } if len(m.Identity) > 0 { @@ -1066,10 +1049,6 @@ func (m *Funder) Size() (n int) { if l > 0 { n += 1 + l + sovFunders(uint64(l)) } - l = len(m.Logo) - if l > 0 { - n += 1 + l + sovFunders(uint64(l)) - } l = len(m.Website) if l > 0 { n += 1 + l + sovFunders(uint64(l)) @@ -1335,38 +1314,6 @@ func (m *Funder) Unmarshal(dAtA []byte) error { m.Identity = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Logo", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFunders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthFunders - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthFunders - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Logo = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) } @@ -1398,7 +1345,7 @@ func (m *Funder) Unmarshal(dAtA []byte) error { } m.Website = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Contact", wireType) } @@ -1430,7 +1377,7 @@ func (m *Funder) Unmarshal(dAtA []byte) error { } m.Contact = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } diff --git a/x/query/types/params.pb.go b/x/query/types/params.pb.go index 0e688f6c..2760847e 100644 --- a/x/query/types/params.pb.go +++ b/x/query/types/params.pb.go @@ -180,37 +180,37 @@ func init() { func init() { proto.RegisterFile("kyve/query/v1beta1/params.proto", fileDescriptor_b5269c0a69f1d3d4) } var fileDescriptor_b5269c0a69f1d3d4 = []byte{ - // 474 bytes of a gzipped FileDescriptorProto + // 473 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xb1, 0x8f, 0xd3, 0x30, 0x14, 0xc6, 0x9b, 0x3b, 0x28, 0xc2, 0xe5, 0x4e, 0x10, 0x40, 0x40, 0xa8, 0x72, 0x47, 0x84, 0x00, 0x31, 0xd8, 0xea, 0xc1, 0xc4, 0x84, 0x38, 0x98, 0x40, 0x08, 0x18, 0x90, 0x60, 0x41, 0x4e, 0x6b, 0xdc, 0xa8, 0x69, 0x5e, 0x1a, 0x3b, 0x81, 0x0e, 0x2c, 0xcc, 0x0c, 0x48, 0xfc, 0x53, 0x8c, 0x95, 0x58, 0x18, 0x51, 0x8b, 0xf8, 0x3b, 0x50, 0xec, 0x97, 0xa6, 0x34, 0x2d, 0x37, 0xb5, 0x7e, 0xef, - 0xfb, 0x7e, 0x79, 0xf9, 0xfc, 0x42, 0x0e, 0x46, 0xd3, 0x42, 0xb0, 0x49, 0x2e, 0xb2, 0x29, 0x2b, + 0xfb, 0x7e, 0xcf, 0xf9, 0xf2, 0x42, 0x0e, 0x46, 0xd3, 0x42, 0xb0, 0x49, 0x2e, 0xb2, 0x29, 0x2b, 0x7a, 0xa1, 0xd0, 0xbc, 0xc7, 0x52, 0x9e, 0xf1, 0xb1, 0xa2, 0x69, 0x06, 0x1a, 0x5c, 0xb7, 0x14, 0x50, 0x23, 0xa0, 0x28, 0xf0, 0xae, 0xf4, 0x41, 0x8d, 0x41, 0x31, 0x09, 0x05, 0x2b, 0x7a, 0xe5, 0x8f, 0x15, 0x7b, 0x5d, 0x09, 0x20, 0x63, 0xc1, 0x78, 0x1a, 0x31, 0x9e, 0x24, 0xa0, 0xb9, 0x8e, - 0x20, 0x41, 0x94, 0x77, 0xc3, 0x3c, 0x2b, 0xcc, 0x93, 0x41, 0x2c, 0xd4, 0xc6, 0xa7, 0x79, 0x37, - 0x8d, 0x64, 0x20, 0x62, 0x21, 0x8d, 0x75, 0xb3, 0xea, 0xd0, 0xa8, 0x64, 0x0c, 0x21, 0x8f, 0x97, - 0x0a, 0x7b, 0x44, 0x85, 0x6f, 0x14, 0x29, 0x40, 0xbc, 0x99, 0x60, 0x47, 0x51, 0x9a, 0x8f, 0x44, - 0xa6, 0xfe, 0x27, 0x79, 0x9f, 0x27, 0x83, 0x6d, 0x92, 0xe0, 0x12, 0x71, 0x5f, 0x96, 0xc1, 0xbc, - 0x30, 0xc5, 0x57, 0x62, 0x92, 0x0b, 0xa5, 0x83, 0x3f, 0xbb, 0xe4, 0xe2, 0x3f, 0x65, 0x95, 0x42, - 0xa2, 0x84, 0x7b, 0x4c, 0xf6, 0xf1, 0xdd, 0xdf, 0x59, 0xca, 0x55, 0xe7, 0xd0, 0xb9, 0xd3, 0x39, - 0xea, 0x52, 0x13, 0x31, 0xf6, 0xaa, 0x90, 0x29, 0xba, 0xf7, 0xb0, 0x6e, 0x8f, 0xee, 0x33, 0x72, - 0xa1, 0x4e, 0xa7, 0xe2, 0xec, 0x18, 0xce, 0x81, 0xe5, 0xd4, 0xed, 0x75, 0xd4, 0xf9, 0xba, 0x85, - 0xb4, 0x87, 0x64, 0xcf, 0xc6, 0x56, 0x91, 0x76, 0x0d, 0xe9, 0xba, 0x25, 0x61, 0xa2, 0x6b, 0x94, - 0x73, 0xb6, 0x8c, 0x84, 0xfb, 0x84, 0x48, 0x28, 0x2a, 0xfb, 0x29, 0x63, 0xbf, 0x4c, 0xed, 0x7e, - 0xd0, 0x72, 0x31, 0x8a, 0xa5, 0xf1, 0xac, 0x84, 0x02, 0x5d, 0xc7, 0x64, 0x1f, 0xb3, 0xaf, 0x9c, - 0xa7, 0x57, 0xa3, 0xc0, 0x5e, 0x23, 0x0a, 0xac, 0x23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87, 0x74, 0x56, 0x5e, + 0xb4, 0xfb, 0x89, 0xb4, 0xf1, 0xdf, 0x2d, 0xda, 0xfc, 0x6a, 0x68, 0x73, 0x55, 0xbc, 0xdb, 0x27, + 0xea, 0xec, 0xee, 0x04, 0xc1, 0xe7, 0x1f, 0xbf, 0xbf, 0xed, 0x74, 0x5d, 0x8f, 0x6d, 0xfd, 0x5e, + 0x1f, 0x3d, 0xfe, 0x3e, 0xf7, 0x9d, 0xd9, 0xdc, 0x77, 0x7e, 0xcd, 0x7d, 0xe7, 0xeb, 0xc2, 0x6f, + 0xcd, 0x16, 0x7e, 0xeb, 0xe7, 0xc2, 0x6f, 0xbd, 0xbd, 0x2b, 0x23, 0x3d, 0xcc, 0x43, 0xda, 0x87, + 0x31, 0x7b, 0xfa, 0xe6, 0xf5, 0x93, 0xe7, 0x42, 0x7f, 0x80, 0x6c, 0xc4, 0xfa, 0x43, 0x1e, 0x25, + 0xec, 0x23, 0xe2, 0xf4, 0x34, 0x15, 0x2a, 0x6c, 0x9b, 0xd5, 0xbe, 0xf7, 0x37, 0x00, 0x00, 0xff, + 0xff, 0xcf, 0xec, 0x60, 0xa4, 0x19, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. From 4b627a90830ec7f68d7617dbb8e86888392554cf Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 12 Oct 2023 14:03:13 +0200 Subject: [PATCH 071/109] feat: add FundingStats and total_amount_per_bundle for funders queries --- docs/swagger.yml | 87 +++++-- proto/kyve/query/v1beta1/funders.proto | 12 +- x/query/keeper/grpc_query_funder.go | 58 +++-- x/query/types/funders.pb.go | 326 ++++++++++++++----------- 4 files changed, 287 insertions(+), 196 deletions(-) diff --git a/docs/swagger.yml b/docs/swagger.yml index f040d422..2e89fd70 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -7753,6 +7753,37 @@ paths: description: type: string description: description ... + stats: + description: statistics about all the fundings of the funder. + type: object + properties: + total_used_funds: + type: string + format: uint64 + description: >- + total_used_funds are the total funds that have been + distributed by the funder. + total_allocated_funds: + type: string + format: uint64 + description: >- + total_allocated_funds are the total funds that have + been allocated by the funder. They can either get + distributed or refunded. + total_amount_per_bundle: + type: string + format: uint64 + description: >- + total_amount_per_bundle is the total amount per bundle + of all fundings of the funder. + pools_funded: + type: array + items: + type: string + format: uint64 + description: >- + pools_funded are the ids of the pools that have been + funded by the funder. fundings: type: array items: @@ -7776,31 +7807,6 @@ paths: description: total_funded ... description: Funding ... description: fundings ... - stats: - description: stats ... - type: object - properties: - total_used_funds: - type: string - format: uint64 - description: >- - total_used_funds are the total funds that have been - distributed by the funder. - total_allocated_funds: - type: string - format: uint64 - description: >- - total_allocated_funds are the total funds that have been - allocated by the funder. They can either get distributed - or refunded. - pools_funded: - type: array - items: - type: string - format: uint64 - description: >- - pools_funded are the ids of the pools that have been - funded by the funder. description: >- QueryFunderResponse is the response type for the Query/Funder RPC method. @@ -8044,6 +8050,37 @@ paths: description: type: string description: description ... + stats: + description: statistics about all the fundings of the funder. + type: object + properties: + total_used_funds: + type: string + format: uint64 + description: >- + total_used_funds are the total funds that have been + distributed by the funder. + total_allocated_funds: + type: string + format: uint64 + description: >- + total_allocated_funds are the total funds that have + been allocated by the funder. They can either get + distributed or refunded. + total_amount_per_bundle: + type: string + format: uint64 + description: >- + total_amount_per_bundle is the total amount per + bundle of all fundings of the funder. + pools_funded: + type: array + items: + type: string + format: uint64 + description: >- + pools_funded are the ids of the pools that have been + funded by the funder. description: Funder ... description: funders ... pagination: diff --git a/proto/kyve/query/v1beta1/funders.proto b/proto/kyve/query/v1beta1/funders.proto index 909d1672..01fa6bba 100644 --- a/proto/kyve/query/v1beta1/funders.proto +++ b/proto/kyve/query/v1beta1/funders.proto @@ -38,16 +38,20 @@ message Funder { string contact = 5; // description ... string description = 6; + // statistics about all the fundings of the funder. + FundingStats stats = 7; } -// FunderStats ... -message FunderStats { +// FundingStats ... +message FundingStats { // total_used_funds are the total funds that have been distributed by the funder. uint64 total_used_funds = 1; // total_allocated_funds are the total funds that have been allocated by the funder. They can either get distributed or refunded. uint64 total_allocated_funds = 2; + // total_amount_per_bundle is the total amount per bundle of all fundings of the funder. + uint64 total_amount_per_bundle = 3; // pools_funded are the ids of the pools that have been funded by the funder. - repeated uint64 pools_funded = 3; + repeated uint64 pools_funded = 4; } // Funding ... @@ -100,6 +104,4 @@ message QueryFunderResponse { Funder funder = 1; // fundings ... repeated Funding fundings = 2 [(gogoproto.nullable) = false]; - // stats ... - FunderStats stats = 3; } diff --git a/x/query/keeper/grpc_query_funder.go b/x/query/keeper/grpc_query_funder.go index 9dbd777c..5497c021 100644 --- a/x/query/keeper/grpc_query_funder.go +++ b/x/query/keeper/grpc_query_funder.go @@ -26,7 +26,8 @@ func (k Keeper) Funders(c context.Context, req *types.QueryFundersRequest) (*typ data := make([]types.Funder, 0) for _, funder := range funders { - data = append(data, k.parseFunder(&funder)) + fundings := k.fundersKeeper.GetFundingsOfFunder(ctx, funder.Address) + data = append(data, k.parseFunder(&funder, fundings)) } return &types.QueryFundersResponse{Funders: data, Pagination: pageRes}, nil @@ -42,16 +43,22 @@ func (k Keeper) Funder(c context.Context, req *types.QueryFunderRequest) (*types if !found { return nil, errorsTypes.ErrKeyNotFound } - funderData := k.parseFunder(&funder) - totalUsedFunds := uint64(0) - totalAllocatedFunds := uint64(0) - poolsFunded := make([]uint64, 0) + fundings := k.fundersKeeper.GetFundingsOfFunder(ctx, funder.Address) + + funderData := k.parseFunder(&funder, fundings) + fundingsData := k.parseFundings(fundings, req.WithInactiveFundings) - fundings := k.fundersKeeper.GetFundingsOfFunder(ctx, req.Address) + return &types.QueryFunderResponse{ + Funder: &funderData, + Fundings: fundingsData, + }, nil +} + +func (k Keeper) parseFundings(fundings []fundersTypes.Funding, withInactiveFundings bool) []types.Funding { fundingsData := make([]types.Funding, 0) for _, funding := range fundings { - if funding.Amount > 0 || req.WithInactiveFundings { + if funding.Amount > 0 || withInactiveFundings { fundingsData = append(fundingsData, types.Funding{ PoolId: funding.PoolId, Amount: funding.Amount, @@ -59,25 +66,28 @@ func (k Keeper) Funder(c context.Context, req *types.QueryFunderRequest) (*types TotalFunded: funding.TotalFunded, }) } + } + return fundingsData +} + +func (k Keeper) parseFunder(funder *fundersTypes.Funder, fundings []fundersTypes.Funding) types.Funder { + totalUsedFunds := uint64(0) + totalAllocatedFunds := uint64(0) + totalAmountPerBundle := uint64(0) + poolsFunded := make([]uint64, 0) + + for _, funding := range fundings { + // Only count active fundings for totalAmountPerBundle + if funding.Amount > 0 { + totalAmountPerBundle += funding.AmountPerBundle + } + totalUsedFunds += funding.TotalFunded totalAllocatedFunds += funding.Amount - poolsFunded = append(poolsFunded, funding.PoolId) - } - statsData := &types.FunderStats{ - TotalUsedFunds: totalUsedFunds, - TotalAllocatedFunds: totalAllocatedFunds, - PoolsFunded: poolsFunded, + poolsFunded = append(poolsFunded, funding.PoolId) } - return &types.QueryFunderResponse{ - Funder: &funderData, - Fundings: fundingsData, - Stats: statsData, - }, nil -} - -func (k Keeper) parseFunder(funder *fundersTypes.Funder) types.Funder { return types.Funder{ Address: funder.Address, Moniker: funder.Moniker, @@ -85,5 +95,11 @@ func (k Keeper) parseFunder(funder *fundersTypes.Funder) types.Funder { Website: funder.Website, Contact: funder.Contact, Description: funder.Description, + Stats: &types.FundingStats{ + TotalUsedFunds: totalUsedFunds, + TotalAllocatedFunds: totalAllocatedFunds, + TotalAmountPerBundle: totalAmountPerBundle, + PoolsFunded: poolsFunded, + }, } } diff --git a/x/query/types/funders.pb.go b/x/query/types/funders.pb.go index e0d9bd77..1e58f5e3 100644 --- a/x/query/types/funders.pb.go +++ b/x/query/types/funders.pb.go @@ -44,6 +44,8 @@ type Funder struct { Contact string `protobuf:"bytes,5,opt,name=contact,proto3" json:"contact,omitempty"` // description ... Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` + // statistics about all the fundings of the funder. + Stats *FundingStats `protobuf:"bytes,7,opt,name=stats,proto3" json:"stats,omitempty"` } func (m *Funder) Reset() { *m = Funder{} } @@ -121,28 +123,37 @@ func (m *Funder) GetDescription() string { return "" } -// FunderStats ... -type FunderStats struct { +func (m *Funder) GetStats() *FundingStats { + if m != nil { + return m.Stats + } + return nil +} + +// FundingStats ... +type FundingStats struct { // total_used_funds are the total funds that have been distributed by the funder. TotalUsedFunds uint64 `protobuf:"varint,1,opt,name=total_used_funds,json=totalUsedFunds,proto3" json:"total_used_funds,omitempty"` // total_allocated_funds are the total funds that have been allocated by the funder. They can either get distributed or refunded. TotalAllocatedFunds uint64 `protobuf:"varint,2,opt,name=total_allocated_funds,json=totalAllocatedFunds,proto3" json:"total_allocated_funds,omitempty"` + // total_amount_per_bundle is the total amount per bundle of all fundings of the funder. + TotalAmountPerBundle uint64 `protobuf:"varint,3,opt,name=total_amount_per_bundle,json=totalAmountPerBundle,proto3" json:"total_amount_per_bundle,omitempty"` // pools_funded are the ids of the pools that have been funded by the funder. - PoolsFunded []uint64 `protobuf:"varint,3,rep,packed,name=pools_funded,json=poolsFunded,proto3" json:"pools_funded,omitempty"` + PoolsFunded []uint64 `protobuf:"varint,4,rep,packed,name=pools_funded,json=poolsFunded,proto3" json:"pools_funded,omitempty"` } -func (m *FunderStats) Reset() { *m = FunderStats{} } -func (m *FunderStats) String() string { return proto.CompactTextString(m) } -func (*FunderStats) ProtoMessage() {} -func (*FunderStats) Descriptor() ([]byte, []int) { +func (m *FundingStats) Reset() { *m = FundingStats{} } +func (m *FundingStats) String() string { return proto.CompactTextString(m) } +func (*FundingStats) ProtoMessage() {} +func (*FundingStats) Descriptor() ([]byte, []int) { return fileDescriptor_a182f068d9f0dba9, []int{1} } -func (m *FunderStats) XXX_Unmarshal(b []byte) error { +func (m *FundingStats) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *FunderStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *FundingStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_FunderStats.Marshal(b, m, deterministic) + return xxx_messageInfo_FundingStats.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -152,33 +163,40 @@ func (m *FunderStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *FunderStats) XXX_Merge(src proto.Message) { - xxx_messageInfo_FunderStats.Merge(m, src) +func (m *FundingStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_FundingStats.Merge(m, src) } -func (m *FunderStats) XXX_Size() int { +func (m *FundingStats) XXX_Size() int { return m.Size() } -func (m *FunderStats) XXX_DiscardUnknown() { - xxx_messageInfo_FunderStats.DiscardUnknown(m) +func (m *FundingStats) XXX_DiscardUnknown() { + xxx_messageInfo_FundingStats.DiscardUnknown(m) } -var xxx_messageInfo_FunderStats proto.InternalMessageInfo +var xxx_messageInfo_FundingStats proto.InternalMessageInfo -func (m *FunderStats) GetTotalUsedFunds() uint64 { +func (m *FundingStats) GetTotalUsedFunds() uint64 { if m != nil { return m.TotalUsedFunds } return 0 } -func (m *FunderStats) GetTotalAllocatedFunds() uint64 { +func (m *FundingStats) GetTotalAllocatedFunds() uint64 { if m != nil { return m.TotalAllocatedFunds } return 0 } -func (m *FunderStats) GetPoolsFunded() []uint64 { +func (m *FundingStats) GetTotalAmountPerBundle() uint64 { + if m != nil { + return m.TotalAmountPerBundle + } + return 0 +} + +func (m *FundingStats) GetPoolsFunded() []uint64 { if m != nil { return m.PoolsFunded } @@ -429,8 +447,6 @@ type QueryFunderResponse struct { Funder *Funder `protobuf:"bytes,1,opt,name=funder,proto3" json:"funder,omitempty"` // fundings ... Fundings []Funding `protobuf:"bytes,2,rep,name=fundings,proto3" json:"fundings"` - // stats ... - Stats *FunderStats `protobuf:"bytes,3,opt,name=stats,proto3" json:"stats,omitempty"` } func (m *QueryFunderResponse) Reset() { *m = QueryFunderResponse{} } @@ -480,16 +496,9 @@ func (m *QueryFunderResponse) GetFundings() []Funding { return nil } -func (m *QueryFunderResponse) GetStats() *FunderStats { - if m != nil { - return m.Stats - } - return nil -} - func init() { proto.RegisterType((*Funder)(nil), "kyve.query.v1beta1.Funder") - proto.RegisterType((*FunderStats)(nil), "kyve.query.v1beta1.FunderStats") + proto.RegisterType((*FundingStats)(nil), "kyve.query.v1beta1.FundingStats") proto.RegisterType((*Funding)(nil), "kyve.query.v1beta1.Funding") proto.RegisterType((*QueryFundersRequest)(nil), "kyve.query.v1beta1.QueryFundersRequest") proto.RegisterType((*QueryFundersResponse)(nil), "kyve.query.v1beta1.QueryFundersResponse") @@ -500,53 +509,53 @@ func init() { func init() { proto.RegisterFile("kyve/query/v1beta1/funders.proto", fileDescriptor_a182f068d9f0dba9) } var fileDescriptor_a182f068d9f0dba9 = []byte{ - // 724 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0x4f, 0x6b, 0x13, 0x41, - 0x1c, 0xcd, 0x26, 0x69, 0x52, 0x67, 0x8b, 0x7f, 0xa6, 0xb5, 0x2e, 0xa9, 0xa6, 0x71, 0x95, 0x36, - 0x14, 0xd9, 0xa5, 0x51, 0x2f, 0x82, 0x07, 0x8b, 0x56, 0x8a, 0x20, 0x75, 0x45, 0x41, 0x2f, 0x61, - 0xb2, 0x3b, 0x6e, 0x86, 0x26, 0x33, 0xdb, 0x9d, 0xd9, 0xd6, 0x20, 0x1e, 0xf4, 0x22, 0x5e, 0x44, - 0xf0, 0xa8, 0x9f, 0xc1, 0xaf, 0xe0, 0xb5, 0xc7, 0x82, 0x17, 0x4f, 0x22, 0x8d, 0x1f, 0x44, 0xe6, - 0x4f, 0xd2, 0x44, 0x1b, 0x73, 0x9b, 0xdf, 0xbc, 0xf7, 0x76, 0xde, 0xbe, 0x7d, 0x3b, 0xa0, 0xb6, - 0xd3, 0xdb, 0xc3, 0xfe, 0x6e, 0x86, 0xd3, 0x9e, 0xbf, 0xb7, 0xde, 0xc2, 0x02, 0xad, 0xfb, 0x2f, - 0x32, 0x1a, 0xe1, 0x94, 0x7b, 0x49, 0xca, 0x04, 0x83, 0x50, 0x32, 0x3c, 0xc5, 0xf0, 0x0c, 0xa3, - 0xb2, 0x16, 0x32, 0xde, 0x65, 0xdc, 0x6f, 0x21, 0xfe, 0xb7, 0x38, 0x41, 0x31, 0xa1, 0x48, 0x10, - 0x46, 0xb5, 0xbe, 0xb2, 0x10, 0xb3, 0x98, 0xa9, 0xa5, 0x2f, 0x57, 0x66, 0xf7, 0x62, 0xcc, 0x58, - 0xdc, 0xc1, 0x3e, 0x4a, 0x88, 0x8f, 0x28, 0x65, 0x42, 0x49, 0xcc, 0x99, 0xee, 0x57, 0x0b, 0x94, - 0x36, 0x95, 0x0b, 0xe8, 0x80, 0x32, 0x8a, 0xa2, 0x14, 0x73, 0xee, 0x58, 0x35, 0xab, 0x7e, 0x2a, - 0x18, 0x8c, 0x12, 0xe9, 0x32, 0x4a, 0x76, 0x70, 0xea, 0xe4, 0x35, 0x62, 0x46, 0x58, 0x01, 0xb3, - 0x24, 0xc2, 0x54, 0x10, 0xd1, 0x73, 0x0a, 0x0a, 0x1a, 0xce, 0x52, 0xb5, 0x8f, 0x5b, 0x9c, 0x08, - 0xec, 0x14, 0xb5, 0xca, 0x8c, 0x12, 0x09, 0x19, 0x15, 0x28, 0x14, 0xce, 0x8c, 0x46, 0xcc, 0x08, - 0x6b, 0xc0, 0x8e, 0x30, 0x0f, 0x53, 0x92, 0x48, 0x93, 0x4e, 0x49, 0xa1, 0xa3, 0x5b, 0xee, 0x07, - 0x0b, 0xd8, 0xda, 0xf0, 0x63, 0x81, 0x04, 0x87, 0x75, 0x70, 0x56, 0x30, 0x81, 0x3a, 0xcd, 0x8c, - 0xe3, 0xa8, 0x29, 0x03, 0xd5, 0xf6, 0x8b, 0xc1, 0x69, 0xb5, 0xff, 0x84, 0xe3, 0x48, 0xf2, 0x39, - 0x6c, 0x80, 0xf3, 0x9a, 0x89,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xaa, 0x5a, 0x1f, 0xfb, 0xd5, 0xdc, 0x61, 0xbf, 0x9a, 0xfb, 0xd1, 0xaf, 0xe6, - 0x9e, 0xaf, 0xc5, 0x44, 0xb4, 0xb3, 0x96, 0x17, 0xb2, 0xae, 0xff, 0xe0, 0xd9, 0xd3, 0x7b, 0x0f, - 0xb1, 0xd8, 0x67, 0xe9, 0x8e, 0x1f, 0xb6, 0x11, 0xa1, 0xfe, 0x4b, 0xf3, 0x60, 0xd1, 0x4b, 0x30, - 0x6f, 0x95, 0xd4, 0xb5, 0x7b, 0xfd, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x43, 0x76, 0x14, 0x80, - 0x0e, 0x06, 0x00, 0x00, + // 734 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0xcb, 0x6e, 0xd3, 0x40, + 0x14, 0x8d, 0xd3, 0x34, 0x29, 0x93, 0x8a, 0xc7, 0x34, 0xb4, 0x56, 0x0a, 0x21, 0x18, 0xd4, 0x46, + 0x15, 0xb2, 0xd5, 0xf0, 0x58, 0x20, 0xb1, 0xa0, 0x82, 0xa2, 0x0a, 0x09, 0x15, 0x23, 0x90, 0x60, + 0x13, 0x4d, 0xec, 0xc1, 0x19, 0x35, 0x99, 0x71, 0x3d, 0xe3, 0x96, 0x08, 0xb1, 0x80, 0x0d, 0xb0, + 0x43, 0x62, 0x09, 0xdf, 0x83, 0xba, 0xac, 0xc4, 0x86, 0x15, 0x42, 0x2d, 0xe2, 0x3b, 0xd0, 0x3c, + 0x92, 0xba, 0x8f, 0x34, 0x3b, 0xdf, 0x7b, 0xce, 0xf1, 0x3d, 0xf7, 0x61, 0x83, 0xfa, 0x46, 0x7f, + 0x0b, 0x7b, 0x9b, 0x29, 0x4e, 0xfa, 0xde, 0xd6, 0x72, 0x1b, 0x0b, 0xb4, 0xec, 0xbd, 0x4e, 0x69, + 0x88, 0x13, 0xee, 0xc6, 0x09, 0x13, 0x0c, 0x42, 0xc9, 0x70, 0x15, 0xc3, 0x35, 0x8c, 0xea, 0x52, + 0xc0, 0x78, 0x8f, 0x71, 0xaf, 0x8d, 0xf8, 0x51, 0x71, 0x8c, 0x22, 0x42, 0x91, 0x20, 0x8c, 0x6a, + 0x7d, 0xb5, 0x12, 0xb1, 0x88, 0xa9, 0x47, 0x4f, 0x3e, 0x99, 0xec, 0xa5, 0x88, 0xb1, 0xa8, 0x8b, + 0x3d, 0x14, 0x13, 0x0f, 0x51, 0xca, 0x84, 0x92, 0x98, 0x9a, 0xce, 0x3f, 0x0b, 0x14, 0x57, 0x95, + 0x0b, 0x68, 0x83, 0x12, 0x0a, 0xc3, 0x04, 0x73, 0x6e, 0x5b, 0x75, 0xab, 0x71, 0xc6, 0x1f, 0x84, + 0x12, 0xe9, 0x31, 0x4a, 0x36, 0x70, 0x62, 0xe7, 0x35, 0x62, 0x42, 0x58, 0x05, 0x53, 0x24, 0xc4, + 0x54, 0x10, 0xd1, 0xb7, 0x27, 0x14, 0x34, 0x8c, 0xa5, 0x6a, 0x1b, 0xb7, 0x39, 0x11, 0xd8, 0x2e, + 0x68, 0x95, 0x09, 0x25, 0x12, 0x30, 0x2a, 0x50, 0x20, 0xec, 0x49, 0x8d, 0x98, 0x10, 0xd6, 0x41, + 0x39, 0xc4, 0x3c, 0x48, 0x48, 0x2c, 0x4d, 0xda, 0x45, 0x85, 0x66, 0x53, 0xf0, 0x0e, 0x98, 0xe4, + 0x02, 0x09, 0x6e, 0x97, 0xea, 0x56, 0xa3, 0xdc, 0xac, 0xbb, 0xc7, 0x87, 0xe6, 0xca, 0x86, 0x08, + 0x8d, 0x9e, 0x49, 0x9e, 0xaf, 0xe9, 0xce, 0x0f, 0x0b, 0x4c, 0x67, 0xf3, 0xb0, 0x01, 0xce, 0x0b, + 0x26, 0x50, 0xb7, 0x95, 0x72, 0x1c, 0xb6, 0xe4, 0x26, 0x74, 0xdf, 0x05, 0xff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d5, 0xac, 0x3f, 0x7b, 0x35, 0xeb, 0xcb, + 0x7e, 0x2d, 0xb7, 0xbb, 0x5f, 0xcb, 0xfd, 0xda, 0xaf, 0xe5, 0x5e, 0x2d, 0x45, 0x44, 0x74, 0xd2, + 0xb6, 0x1b, 0xb0, 0x9e, 0xf7, 0xf8, 0xe5, 0x8b, 0x87, 0x4f, 0xb0, 0xd8, 0x66, 0xc9, 0x86, 0x17, + 0x74, 0x10, 0xa1, 0xde, 0x1b, 0xf3, 0x62, 0xd1, 0x8f, 0x31, 0x6f, 0x17, 0xd5, 0xff, 0xfa, 0xe6, + 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x54, 0xf8, 0xcb, 0x74, 0x47, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -689,6 +698,18 @@ func (m *Funder) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Stats != nil { + { + size, err := m.Stats.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFunders(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } if len(m.Description) > 0 { i -= len(m.Description) copy(dAtA[i:], m.Description) @@ -734,7 +755,7 @@ func (m *Funder) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *FunderStats) Marshal() (dAtA []byte, err error) { +func (m *FundingStats) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -744,33 +765,38 @@ func (m *FunderStats) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *FunderStats) MarshalTo(dAtA []byte) (int, error) { +func (m *FundingStats) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *FunderStats) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *FundingStats) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.PoolsFunded) > 0 { - dAtA2 := make([]byte, len(m.PoolsFunded)*10) - var j1 int + dAtA3 := make([]byte, len(m.PoolsFunded)*10) + var j2 int for _, num := range m.PoolsFunded { for num >= 1<<7 { - dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80) + dAtA3[j2] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j1++ + j2++ } - dAtA2[j1] = uint8(num) - j1++ + dAtA3[j2] = uint8(num) + j2++ } - i -= j1 - copy(dAtA[i:], dAtA2[:j1]) - i = encodeVarintFunders(dAtA, i, uint64(j1)) + i -= j2 + copy(dAtA[i:], dAtA3[:j2]) + i = encodeVarintFunders(dAtA, i, uint64(j2)) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 + } + if m.TotalAmountPerBundle != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.TotalAmountPerBundle)) + i-- + dAtA[i] = 0x18 } if m.TotalAllocatedFunds != 0 { i = encodeVarintFunders(dAtA, i, uint64(m.TotalAllocatedFunds)) @@ -979,18 +1005,6 @@ func (m *QueryFunderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Stats != nil { - { - size, err := m.Stats.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintFunders(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } if len(m.Fundings) > 0 { for iNdEx := len(m.Fundings) - 1; iNdEx >= 0; iNdEx-- { { @@ -1061,10 +1075,14 @@ func (m *Funder) Size() (n int) { if l > 0 { n += 1 + l + sovFunders(uint64(l)) } + if m.Stats != nil { + l = m.Stats.Size() + n += 1 + l + sovFunders(uint64(l)) + } return n } -func (m *FunderStats) Size() (n int) { +func (m *FundingStats) Size() (n int) { if m == nil { return 0 } @@ -1076,6 +1094,9 @@ func (m *FunderStats) Size() (n int) { if m.TotalAllocatedFunds != 0 { n += 1 + sovFunders(uint64(m.TotalAllocatedFunds)) } + if m.TotalAmountPerBundle != 0 { + n += 1 + sovFunders(uint64(m.TotalAmountPerBundle)) + } if len(m.PoolsFunded) > 0 { l = 0 for _, e := range m.PoolsFunded { @@ -1175,10 +1196,6 @@ func (m *QueryFunderResponse) Size() (n int) { n += 1 + l + sovFunders(uint64(l)) } } - if m.Stats != nil { - l = m.Stats.Size() - n += 1 + l + sovFunders(uint64(l)) - } return n } @@ -1409,6 +1426,42 @@ func (m *Funder) Unmarshal(dAtA []byte) error { } m.Description = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stats", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Stats == nil { + m.Stats = &FundingStats{} + } + if err := m.Stats.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipFunders(dAtA[iNdEx:]) @@ -1430,7 +1483,7 @@ func (m *Funder) Unmarshal(dAtA []byte) error { } return nil } -func (m *FunderStats) Unmarshal(dAtA []byte) error { +func (m *FundingStats) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1453,10 +1506,10 @@ func (m *FunderStats) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: FunderStats: wiretype end group for non-group") + return fmt.Errorf("proto: FundingStats: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: FunderStats: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: FundingStats: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1498,6 +1551,25 @@ func (m *FunderStats) Unmarshal(dAtA []byte) error { } } case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalAmountPerBundle", wireType) + } + m.TotalAmountPerBundle = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalAmountPerBundle |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: if wireType == 0 { var v uint64 for shift := uint(0); ; shift += 7 { @@ -2159,42 +2231,6 @@ func (m *QueryFunderResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Stats", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFunders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthFunders - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthFunders - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Stats == nil { - m.Stats = &FunderStats{} - } - if err := m.Stats.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipFunders(dAtA[iNdEx:]) From 6e712df68ca5e2aeb228f5de478ed6795197028d Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 12 Oct 2023 14:06:16 +0200 Subject: [PATCH 072/109] fix: rename grpc_query_funder.go to grpc_query_funders.go --- x/query/keeper/{grpc_query_funder.go => grpc_query_funders.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename x/query/keeper/{grpc_query_funder.go => grpc_query_funders.go} (100%) diff --git a/x/query/keeper/grpc_query_funder.go b/x/query/keeper/grpc_query_funders.go similarity index 100% rename from x/query/keeper/grpc_query_funder.go rename to x/query/keeper/grpc_query_funders.go From a4fb0ab3a216e0af162fbda76c3c05acd4765b17 Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 16 Oct 2023 14:08:36 +0200 Subject: [PATCH 073/109] fix: remove logo from config.yml --- config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/config.yml b/config.yml index 2eb656f9..cf9eea86 100644 --- a/config.yml +++ b/config.yml @@ -177,7 +177,6 @@ genesis: contact: "https://twitter.com/kyvenetwork" moniker: "Alice" description: "Alice is the first funder of the KYVE network." - logo: "https://avatars.githubusercontent.com/u/76891822?s=200&v=4" website: "https://kyve.network" identity: "0657A086E5201562" funding_list: From dc43e79b12addf90039b9a74448f005add829919 Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 16 Oct 2023 14:41:28 +0200 Subject: [PATCH 074/109] chore: test github commit signing --- config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.yml b/config.yml index cf9eea86..99b27eb2 100644 --- a/config.yml +++ b/config.yml @@ -196,4 +196,4 @@ validators: config: consensus: timeout_commit: "2s" - timeout_propose: "2s" + timeout_propose: "2s" \ No newline at end of file From 3bceb243a8a9c8325ebffcb226b68b0e90e05a89 Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 17 Oct 2023 14:20:04 +0200 Subject: [PATCH 075/109] chore: add comment --- x/funders/keeper/logic_funders.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/funders/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go index 96635f4f..c8b9f63e 100644 --- a/x/funders/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -13,6 +13,7 @@ import ( errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) +// TODO: should this be here or when we call the getter of the funding state? func (k Keeper) CreateFundingState(ctx sdk.Context, poolId uint64) { fundingState := types.FundingState{ PoolId: poolId, From 42a3035d9fa53cf081e0a5127a7a725b5b96c1e4 Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 18 Oct 2023 15:35:18 +0200 Subject: [PATCH 076/109] Rapha/funders module ts proto gen (#131) --- proto/Dockerfile | 1 + proto/buf.gen.yaml | 2 +- proto/generate.sh | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/proto/Dockerfile b/proto/Dockerfile index ea2150dc..d2385fc3 100644 --- a/proto/Dockerfile +++ b/proto/Dockerfile @@ -16,5 +16,6 @@ RUN git clone https://github.com/cosmos/gogoproto.git; \ make install RUN npm install -g swagger-combine +RUN npm install -g ts-proto COPY --from=BUILDER /usr/local/bin /usr/local/bin diff --git a/proto/buf.gen.yaml b/proto/buf.gen.yaml index 90dcc2a7..d57a306f 100644 --- a/proto/buf.gen.yaml +++ b/proto/buf.gen.yaml @@ -9,4 +9,4 @@ plugins: - name: swagger out: ../tmp-swagger-gen opt: - - simple_operation_ids=true + - simple_operation_ids=true \ No newline at end of file diff --git a/proto/generate.sh b/proto/generate.sh index 27a7fa57..fe4889f5 100644 --- a/proto/generate.sh +++ b/proto/generate.sh @@ -6,4 +6,4 @@ cp -r github.com/KYVENetwork/chain/* ./ rm -rf github.com swagger-combine ./docs/config.json -o ./docs/swagger.yml -rm -rf tmp-swagger-gen +rm -rf tmp-swagger-gen \ No newline at end of file From 1122c2e0ab7909a93a712615af9aa8fa2462df0e Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 19 Oct 2023 12:46:20 +0200 Subject: [PATCH 077/109] chore: revert adding ts-proto in Dockerfile --- proto/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/proto/Dockerfile b/proto/Dockerfile index d2385fc3..ea2150dc 100644 --- a/proto/Dockerfile +++ b/proto/Dockerfile @@ -16,6 +16,5 @@ RUN git clone https://github.com/cosmos/gogoproto.git; \ make install RUN npm install -g swagger-combine -RUN npm install -g ts-proto COPY --from=BUILDER /usr/local/bin /usr/local/bin From 5c349d0f8ecea3f5a919cde4f1f73cd3bbf601e7 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 19 Oct 2023 17:10:56 +0200 Subject: [PATCH 078/109] feat: add FundingsByFunder and FundingsByPool queries --- docs/swagger.yml | 685 ++++++++- proto/kyve/query/v1beta1/funders.proto | 62 +- x/funders/keeper/getters_funding.go | 40 + x/query/keeper/grpc_query_funders.go | 15 - x/query/keeper/grpc_query_fundings.go | 57 + x/query/types/funders.pb.go | 1882 +++++++++++++++++++----- x/query/types/funders.pb.gw.go | 238 +++ 7 files changed, 2607 insertions(+), 372 deletions(-) create mode 100644 x/query/keeper/grpc_query_fundings.go diff --git a/docs/swagger.yml b/docs/swagger.yml index 2e89fd70..cb4a9732 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -8027,6 +8027,25 @@ paths: schema: type: object properties: + 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 funders: type: array items: @@ -8083,25 +8102,6 @@ paths: funded by the funder. description: Funder ... description: funders ... - 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: >- QueryFundersResponse is the response type for the Query/Funders RPC method. @@ -8363,6 +8363,653 @@ paths: type: string tags: - QueryFunders + /kyve/query/v1beta1/fundings_by_funder/{address}: + get: + summary: FundingsByFunder queries all fundings of a funder by address. + operationId: FundingsByFunder + responses: + '200': + description: A successful response. + schema: + type: object + properties: + 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 + fundings: + type: array + items: + type: object + properties: + pool_id: + type: string + format: uint64 + description: pool_id ... + amount: + type: string + format: uint64 + description: amount ... + amount_per_bundle: + type: string + format: uint64 + description: amount_per_bundle ... + total_funded: + type: string + format: uint64 + description: total_funded ... + description: Funding ... + description: fundings ... + description: >- + QueryFundingsByFunderResponse is the response type for the + Query/FundingsByFunder RPC method. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: 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: address + description: 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 + - name: search + description: search. + in: query + required: false + type: string + - name: with_inactive_fundings + description: with_inactive_fundings ... + in: query + required: false + type: boolean + tags: + - QueryFunders + /kyve/query/v1beta1/fundings_by_pool/{pool_id}: + get: + summary: FundingsByPool queries all fundings of a pool by id. + operationId: FundingsByPool + responses: + '200': + description: A successful response. + schema: + type: object + properties: + 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 + fundings: + type: array + items: + type: object + properties: + pool_id: + type: string + format: uint64 + description: pool_id ... + amount: + type: string + format: uint64 + description: amount ... + amount_per_bundle: + type: string + format: uint64 + description: amount_per_bundle ... + total_funded: + type: string + format: uint64 + description: total_funded ... + description: Funding ... + description: fundings ... + description: >- + QueryFundingsByPoolResponse is the response type for the + Query/FundingsByPool RPC method. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: 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: pool_id + description: pool_id ... + 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 + - name: search + description: search. + in: query + required: false + type: string + - name: with_inactive_fundings + description: with_inactive_fundings ... + in: query + required: false + type: boolean + tags: + - QueryFunders /kyve/stakers/v1beta1/params: get: summary: Parameters queries the parameters of the module. diff --git a/proto/kyve/query/v1beta1/funders.proto b/proto/kyve/query/v1beta1/funders.proto index 01fa6bba..49728468 100644 --- a/proto/kyve/query/v1beta1/funders.proto +++ b/proto/kyve/query/v1beta1/funders.proto @@ -18,6 +18,14 @@ service QueryFunders { rpc Funder(QueryFunderRequest) returns (QueryFunderResponse) { option (google.api.http).get = "/kyve/query/v1beta1/funder/{address}"; } + // FundingsByFunder queries all fundings of a funder by address. + rpc FundingsByFunder(QueryFundingsByFunderRequest) returns (QueryFundingsByFunderResponse) { + option (google.api.http).get = "/kyve/query/v1beta1/fundings_by_funder/{address}"; + } + // FundingsByPool queries all fundings of a pool by id. + rpc FundingsByPool(QueryFundingsByPoolRequest) returns (QueryFundingsByPoolResponse) { + option (google.api.http).get = "/kyve/query/v1beta1/fundings_by_pool/{pool_id}"; + } } // =============== @@ -80,10 +88,10 @@ message QueryFundersRequest { // QueryFundersResponse is the response type for the Query/Funders RPC method. message QueryFundersResponse { - // funders ... - repeated Funder funders = 1 [(gogoproto.nullable) = false]; // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; + cosmos.base.query.v1beta1.PageResponse pagination = 1; + // funders ... + repeated Funder funders = 2 [(gogoproto.nullable) = false]; } // ============ @@ -105,3 +113,51 @@ message QueryFunderResponse { // fundings ... repeated Funding fundings = 2 [(gogoproto.nullable) = false]; } + +// ======================== +// /fundings_by_funder/{id} +// ======================== + +// QueryFundingsByFunderRequest is the request type for the Query/FundingsByFunder RPC method. +message QueryFundingsByFunderRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; + // address ... + string address = 2; + // search + string search = 3; + // with_inactive_fundings ... + bool with_inactive_fundings = 4; +} + +// QueryFundingsByFunderResponse is the response type for the Query/FundingsByFunder RPC method. +message QueryFundingsByFunderResponse { + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 1; + // fundings ... + repeated Funding fundings = 2 [(gogoproto.nullable) = false]; +} + +// ====================== +// /fundings_by_pool/{id} +// ====================== + +// QueryFundingsByPoolRequest is the request type for the Query/FundingsByPool RPC method. +message QueryFundingsByPoolRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; + // pool_id ... + uint64 pool_id = 2; + // search + string search = 3; + // with_inactive_fundings ... + bool with_inactive_fundings = 4; +} + +// QueryFundingsByPoolResponse is the response type for the Query/FundingsByPool RPC method. +message QueryFundingsByPoolResponse { + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 1; + // fundings ... + repeated Funding fundings = 2 [(gogoproto.nullable) = false]; +} diff --git a/x/funders/keeper/getters_funding.go b/x/funders/keeper/getters_funding.go index db5f48e8..b1e57c18 100644 --- a/x/funders/keeper/getters_funding.go +++ b/x/funders/keeper/getters_funding.go @@ -4,6 +4,9 @@ import ( "github.com/KYVENetwork/chain/x/funders/types" "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" ) // DoesFundingExist checks if the funding exists @@ -92,3 +95,40 @@ func (k Keeper) SetFunding(ctx sdk.Context, funding *types.Funding) { funding.PoolId, ), b) } + +// GetPaginatedFundingQuery performs a full search on all fundings with the given parameters. +func (k Keeper) GetPaginatedFundingQuery( + ctx sdk.Context, + pagination *query.PageRequest, + funderAddress *string, + poolId *uint64, +) ([]types.Funding, *query.PageResponse, error) { + if funderAddress == nil && poolId == nil { + return nil, nil, status.Error(codes.InvalidArgument, "either funderAddress or poolId must be provided") + } + keyPrefix := types.FundingKeyPrefixByFunder + if funderAddress == nil { + keyPrefix = types.FundingKeyPrefixByPool + } + + var fundings []types.Funding + store := prefix.NewStore(ctx.KVStore(k.storeKey), keyPrefix) + + pageRes, err := query.FilteredPaginate(store, pagination, func(key []byte, value []byte, accumulate bool) (bool, error) { + var funding types.Funding + if err := k.cdc.Unmarshal(value, &funding); err != nil { + return false, err + } + + if accumulate { + fundings = append(fundings, funding) + } + + return true, nil + }) + if err != nil { + return nil, nil, status.Error(codes.Internal, err.Error()) + } + + return fundings, pageRes, nil +} diff --git a/x/query/keeper/grpc_query_funders.go b/x/query/keeper/grpc_query_funders.go index 5497c021..c1af3d8b 100644 --- a/x/query/keeper/grpc_query_funders.go +++ b/x/query/keeper/grpc_query_funders.go @@ -55,21 +55,6 @@ func (k Keeper) Funder(c context.Context, req *types.QueryFunderRequest) (*types }, nil } -func (k Keeper) parseFundings(fundings []fundersTypes.Funding, withInactiveFundings bool) []types.Funding { - fundingsData := make([]types.Funding, 0) - for _, funding := range fundings { - if funding.Amount > 0 || withInactiveFundings { - fundingsData = append(fundingsData, types.Funding{ - PoolId: funding.PoolId, - Amount: funding.Amount, - AmountPerBundle: funding.AmountPerBundle, - TotalFunded: funding.TotalFunded, - }) - } - } - return fundingsData -} - func (k Keeper) parseFunder(funder *fundersTypes.Funder, fundings []fundersTypes.Funding) types.Funder { totalUsedFunds := uint64(0) totalAllocatedFunds := uint64(0) diff --git a/x/query/keeper/grpc_query_fundings.go b/x/query/keeper/grpc_query_fundings.go new file mode 100644 index 00000000..93eb1241 --- /dev/null +++ b/x/query/keeper/grpc_query_fundings.go @@ -0,0 +1,57 @@ +package keeper + +import ( + "context" + fundersTypes "github.com/KYVENetwork/chain/x/funders/types" + "github.com/KYVENetwork/chain/x/query/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) FundingsByFunder(c context.Context, req *types.QueryFundingsByFunderRequest) (*types.QueryFundingsByFunderResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + fundings, pageRes, err := k.fundersKeeper.GetPaginatedFundingQuery(ctx, req.Pagination, &req.Address, nil) + if err != nil { + return nil, err + } + + data := k.parseFundings(fundings, req.WithInactiveFundings) + + return &types.QueryFundingsByFunderResponse{Fundings: data, Pagination: pageRes}, nil +} + +func (k Keeper) FundingsByPool(c context.Context, req *types.QueryFundingsByPoolRequest) (*types.QueryFundingsByPoolResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + fundings, pageRes, err := k.fundersKeeper.GetPaginatedFundingQuery(ctx, req.Pagination, nil, &req.PoolId) + if err != nil { + return nil, err + } + + data := k.parseFundings(fundings, req.WithInactiveFundings) + + return &types.QueryFundingsByPoolResponse{Fundings: data, Pagination: pageRes}, nil +} + +func (k Keeper) parseFundings(fundings []fundersTypes.Funding, withInactiveFundings bool) []types.Funding { + fundingsData := make([]types.Funding, 0) + for _, funding := range fundings { + if funding.Amount > 0 || withInactiveFundings { + fundingsData = append(fundingsData, types.Funding{ + PoolId: funding.PoolId, + Amount: funding.Amount, + AmountPerBundle: funding.AmountPerBundle, + TotalFunded: funding.TotalFunded, + }) + } + } + return fundingsData +} diff --git a/x/query/types/funders.pb.go b/x/query/types/funders.pb.go index 1e58f5e3..34afa4dc 100644 --- a/x/query/types/funders.pb.go +++ b/x/query/types/funders.pb.go @@ -333,10 +333,10 @@ func (m *QueryFundersRequest) GetSearch() string { // QueryFundersResponse is the response type for the Query/Funders RPC method. type QueryFundersResponse struct { - // funders ... - Funders []Funder `protobuf:"bytes,1,rep,name=funders,proto3" json:"funders"` // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` + // funders ... + Funders []Funder `protobuf:"bytes,2,rep,name=funders,proto3" json:"funders"` } func (m *QueryFundersResponse) Reset() { *m = QueryFundersResponse{} } @@ -372,16 +372,16 @@ func (m *QueryFundersResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryFundersResponse proto.InternalMessageInfo -func (m *QueryFundersResponse) GetFunders() []Funder { +func (m *QueryFundersResponse) GetPagination() *query.PageResponse { if m != nil { - return m.Funders + return m.Pagination } return nil } -func (m *QueryFundersResponse) GetPagination() *query.PageResponse { +func (m *QueryFundersResponse) GetFunders() []Funder { if m != nil { - return m.Pagination + return m.Funders } return nil } @@ -496,6 +496,262 @@ func (m *QueryFunderResponse) GetFundings() []Funding { return nil } +// QueryFundingsByFunderRequest is the request type for the Query/FundingsByFunder RPC method. +type QueryFundingsByFunderRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` + // address ... + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + // search + Search string `protobuf:"bytes,3,opt,name=search,proto3" json:"search,omitempty"` + // with_inactive_fundings ... + WithInactiveFundings bool `protobuf:"varint,4,opt,name=with_inactive_fundings,json=withInactiveFundings,proto3" json:"with_inactive_fundings,omitempty"` +} + +func (m *QueryFundingsByFunderRequest) Reset() { *m = QueryFundingsByFunderRequest{} } +func (m *QueryFundingsByFunderRequest) String() string { return proto.CompactTextString(m) } +func (*QueryFundingsByFunderRequest) ProtoMessage() {} +func (*QueryFundingsByFunderRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a182f068d9f0dba9, []int{7} +} +func (m *QueryFundingsByFunderRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFundingsByFunderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFundingsByFunderRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryFundingsByFunderRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFundingsByFunderRequest.Merge(m, src) +} +func (m *QueryFundingsByFunderRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryFundingsByFunderRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFundingsByFunderRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFundingsByFunderRequest proto.InternalMessageInfo + +func (m *QueryFundingsByFunderRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +func (m *QueryFundingsByFunderRequest) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *QueryFundingsByFunderRequest) GetSearch() string { + if m != nil { + return m.Search + } + return "" +} + +func (m *QueryFundingsByFunderRequest) GetWithInactiveFundings() bool { + if m != nil { + return m.WithInactiveFundings + } + return false +} + +// QueryFundingsByFunderResponse is the response type for the Query/FundingsByFunder RPC method. +type QueryFundingsByFunderResponse struct { + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` + // fundings ... + Fundings []Funding `protobuf:"bytes,2,rep,name=fundings,proto3" json:"fundings"` +} + +func (m *QueryFundingsByFunderResponse) Reset() { *m = QueryFundingsByFunderResponse{} } +func (m *QueryFundingsByFunderResponse) String() string { return proto.CompactTextString(m) } +func (*QueryFundingsByFunderResponse) ProtoMessage() {} +func (*QueryFundingsByFunderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a182f068d9f0dba9, []int{8} +} +func (m *QueryFundingsByFunderResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFundingsByFunderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFundingsByFunderResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryFundingsByFunderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFundingsByFunderResponse.Merge(m, src) +} +func (m *QueryFundingsByFunderResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryFundingsByFunderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFundingsByFunderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFundingsByFunderResponse proto.InternalMessageInfo + +func (m *QueryFundingsByFunderResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +func (m *QueryFundingsByFunderResponse) GetFundings() []Funding { + if m != nil { + return m.Fundings + } + return nil +} + +// QueryFundingsByPoolRequest is the request type for the Query/FundingsByPool RPC method. +type QueryFundingsByPoolRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` + // pool_id ... + PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // search + Search string `protobuf:"bytes,3,opt,name=search,proto3" json:"search,omitempty"` + // with_inactive_fundings ... + WithInactiveFundings bool `protobuf:"varint,4,opt,name=with_inactive_fundings,json=withInactiveFundings,proto3" json:"with_inactive_fundings,omitempty"` +} + +func (m *QueryFundingsByPoolRequest) Reset() { *m = QueryFundingsByPoolRequest{} } +func (m *QueryFundingsByPoolRequest) String() string { return proto.CompactTextString(m) } +func (*QueryFundingsByPoolRequest) ProtoMessage() {} +func (*QueryFundingsByPoolRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a182f068d9f0dba9, []int{9} +} +func (m *QueryFundingsByPoolRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFundingsByPoolRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFundingsByPoolRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryFundingsByPoolRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFundingsByPoolRequest.Merge(m, src) +} +func (m *QueryFundingsByPoolRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryFundingsByPoolRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFundingsByPoolRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFundingsByPoolRequest proto.InternalMessageInfo + +func (m *QueryFundingsByPoolRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +func (m *QueryFundingsByPoolRequest) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *QueryFundingsByPoolRequest) GetSearch() string { + if m != nil { + return m.Search + } + return "" +} + +func (m *QueryFundingsByPoolRequest) GetWithInactiveFundings() bool { + if m != nil { + return m.WithInactiveFundings + } + return false +} + +// QueryFundingsByPoolResponse is the response type for the Query/FundingsByPool RPC method. +type QueryFundingsByPoolResponse struct { + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` + // fundings ... + Fundings []Funding `protobuf:"bytes,2,rep,name=fundings,proto3" json:"fundings"` +} + +func (m *QueryFundingsByPoolResponse) Reset() { *m = QueryFundingsByPoolResponse{} } +func (m *QueryFundingsByPoolResponse) String() string { return proto.CompactTextString(m) } +func (*QueryFundingsByPoolResponse) ProtoMessage() {} +func (*QueryFundingsByPoolResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a182f068d9f0dba9, []int{10} +} +func (m *QueryFundingsByPoolResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFundingsByPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFundingsByPoolResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryFundingsByPoolResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFundingsByPoolResponse.Merge(m, src) +} +func (m *QueryFundingsByPoolResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryFundingsByPoolResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFundingsByPoolResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFundingsByPoolResponse proto.InternalMessageInfo + +func (m *QueryFundingsByPoolResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +func (m *QueryFundingsByPoolResponse) GetFundings() []Funding { + if m != nil { + return m.Fundings + } + return nil +} + func init() { proto.RegisterType((*Funder)(nil), "kyve.query.v1beta1.Funder") proto.RegisterType((*FundingStats)(nil), "kyve.query.v1beta1.FundingStats") @@ -504,58 +760,72 @@ func init() { proto.RegisterType((*QueryFundersResponse)(nil), "kyve.query.v1beta1.QueryFundersResponse") proto.RegisterType((*QueryFunderRequest)(nil), "kyve.query.v1beta1.QueryFunderRequest") proto.RegisterType((*QueryFunderResponse)(nil), "kyve.query.v1beta1.QueryFunderResponse") + proto.RegisterType((*QueryFundingsByFunderRequest)(nil), "kyve.query.v1beta1.QueryFundingsByFunderRequest") + proto.RegisterType((*QueryFundingsByFunderResponse)(nil), "kyve.query.v1beta1.QueryFundingsByFunderResponse") + proto.RegisterType((*QueryFundingsByPoolRequest)(nil), "kyve.query.v1beta1.QueryFundingsByPoolRequest") + proto.RegisterType((*QueryFundingsByPoolResponse)(nil), "kyve.query.v1beta1.QueryFundingsByPoolResponse") } func init() { proto.RegisterFile("kyve/query/v1beta1/funders.proto", fileDescriptor_a182f068d9f0dba9) } var fileDescriptor_a182f068d9f0dba9 = []byte{ - // 734 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0xcb, 0x6e, 0xd3, 0x40, - 0x14, 0x8d, 0xd3, 0x34, 0x29, 0x93, 0x8a, 0xc7, 0x34, 0xb4, 0x56, 0x0a, 0x21, 0x18, 0xd4, 0x46, - 0x15, 0xb2, 0xd5, 0xf0, 0x58, 0x20, 0xb1, 0xa0, 0x82, 0xa2, 0x0a, 0x09, 0x15, 0x23, 0x90, 0x60, - 0x13, 0x4d, 0xec, 0xc1, 0x19, 0x35, 0x99, 0x71, 0x3d, 0xe3, 0x96, 0x08, 0xb1, 0x80, 0x0d, 0xb0, - 0x43, 0x62, 0x09, 0xdf, 0x83, 0xba, 0xac, 0xc4, 0x86, 0x15, 0x42, 0x2d, 0xe2, 0x3b, 0xd0, 0x3c, - 0x92, 0xba, 0x8f, 0x34, 0x3b, 0xdf, 0x7b, 0xce, 0xf1, 0x3d, 0xf7, 0x61, 0x83, 0xfa, 0x46, 0x7f, - 0x0b, 0x7b, 0x9b, 0x29, 0x4e, 0xfa, 0xde, 0xd6, 0x72, 0x1b, 0x0b, 0xb4, 0xec, 0xbd, 0x4e, 0x69, - 0x88, 0x13, 0xee, 0xc6, 0x09, 0x13, 0x0c, 0x42, 0xc9, 0x70, 0x15, 0xc3, 0x35, 0x8c, 0xea, 0x52, - 0xc0, 0x78, 0x8f, 0x71, 0xaf, 0x8d, 0xf8, 0x51, 0x71, 0x8c, 0x22, 0x42, 0x91, 0x20, 0x8c, 0x6a, - 0x7d, 0xb5, 0x12, 0xb1, 0x88, 0xa9, 0x47, 0x4f, 0x3e, 0x99, 0xec, 0xa5, 0x88, 0xb1, 0xa8, 0x8b, - 0x3d, 0x14, 0x13, 0x0f, 0x51, 0xca, 0x84, 0x92, 0x98, 0x9a, 0xce, 0x3f, 0x0b, 0x14, 0x57, 0x95, - 0x0b, 0x68, 0x83, 0x12, 0x0a, 0xc3, 0x04, 0x73, 0x6e, 0x5b, 0x75, 0xab, 0x71, 0xc6, 0x1f, 0x84, - 0x12, 0xe9, 0x31, 0x4a, 0x36, 0x70, 0x62, 0xe7, 0x35, 0x62, 0x42, 0x58, 0x05, 0x53, 0x24, 0xc4, - 0x54, 0x10, 0xd1, 0xb7, 0x27, 0x14, 0x34, 0x8c, 0xa5, 0x6a, 0x1b, 0xb7, 0x39, 0x11, 0xd8, 0x2e, - 0x68, 0x95, 0x09, 0x25, 0x12, 0x30, 0x2a, 0x50, 0x20, 0xec, 0x49, 0x8d, 0x98, 0x10, 0xd6, 0x41, - 0x39, 0xc4, 0x3c, 0x48, 0x48, 0x2c, 0x4d, 0xda, 0x45, 0x85, 0x66, 0x53, 0xf0, 0x0e, 0x98, 0xe4, - 0x02, 0x09, 0x6e, 0x97, 0xea, 0x56, 0xa3, 0xdc, 0xac, 0xbb, 0xc7, 0x87, 0xe6, 0xca, 0x86, 0x08, - 0x8d, 0x9e, 0x49, 0x9e, 0xaf, 0xe9, 0xce, 0x0f, 0x0b, 0x4c, 0x67, 0xf3, 0xb0, 0x01, 0xce, 0x0b, - 0x26, 0x50, 0xb7, 0x95, 0x72, 0x1c, 0xb6, 0xe4, 0x26, 0x74, 0xdf, 0x05, 0xff, 0xac, 0xca, 0x3f, - 0xe7, 0x38, 0x94, 0x02, 0x0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, 0x2d, 0xb7, 0xbb, 0x5f, 0xcb, 0xfd, 0xda, 0xaf, 0xe5, 0x5e, 0x2d, 0x45, 0x44, 0x74, 0xd2, - 0xb6, 0x1b, 0xb0, 0x9e, 0xf7, 0xf8, 0xe5, 0x8b, 0x87, 0x4f, 0xb0, 0xd8, 0x66, 0xc9, 0x86, 0x17, - 0x74, 0x10, 0xa1, 0xde, 0x1b, 0xf3, 0x62, 0xd1, 0x8f, 0x31, 0x6f, 0x17, 0xd5, 0xff, 0xfa, 0xe6, - 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x54, 0xf8, 0xcb, 0x74, 0x47, 0x06, 0x00, 0x00, + // 890 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcd, 0x8b, 0x23, 0x45, + 0x14, 0x9f, 0xca, 0xf4, 0x26, 0x63, 0x65, 0x58, 0xd7, 0xda, 0x71, 0xb7, 0xe9, 0xd9, 0x8d, 0xb1, + 0x95, 0x99, 0x30, 0x48, 0xf7, 0x4c, 0xd4, 0x45, 0x04, 0x0f, 0x06, 0x5d, 0x59, 0x04, 0x19, 0x5b, + 0x14, 0xf4, 0xd2, 0x54, 0xba, 0xcb, 0x4e, 0x31, 0x49, 0x57, 0x6f, 0x57, 0xf5, 0x8c, 0x61, 0xd9, + 0x83, 0x5e, 0xd4, 0x9b, 0xe0, 0xd1, 0xb3, 0x88, 0x47, 0xff, 0x09, 0x59, 0x10, 0x64, 0xc1, 0x8b, + 0x27, 0x91, 0x19, 0xf1, 0xaf, 0xf0, 0x20, 0xf5, 0x91, 0x4c, 0x27, 0x93, 0x8f, 0x11, 0x73, 0xd8, + 0x5b, 0xbd, 0x8f, 0x5f, 0xde, 0xef, 0xfd, 0xea, 0xbd, 0x4a, 0xc3, 0xe6, 0xd1, 0xf0, 0x98, 0xf8, + 0xf7, 0x0b, 0x92, 0x0f, 0xfd, 0xe3, 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0xeb, 0x45, 0x6c, 0xe0, + 0xbf, 0xfb, 0xf1, 0x47, 0x6f, 0xbf, 0x47, 0xc4, 0x09, 0xcb, 0x8f, 0xfc, 0xa8, 0x87, 0x69, 0xea, + 0x7f, 0x66, 0x4a, 0x88, 0x61, 0x46, 0x78, 0xb7, 0xaa, 0x3e, 0x00, 0x5f, 0xfe, 0x37, 0x00, 0x00, + 0xff, 0xff, 0x59, 0x58, 0xba, 0xfc, 0x98, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -574,6 +844,10 @@ type QueryFundersClient interface { Funders(ctx context.Context, in *QueryFundersRequest, opts ...grpc.CallOption) (*QueryFundersResponse, error) // Funder queries a funder by address. Funder(ctx context.Context, in *QueryFunderRequest, opts ...grpc.CallOption) (*QueryFunderResponse, error) + // FundingsByFunder queries all fundings of a funder by address. + FundingsByFunder(ctx context.Context, in *QueryFundingsByFunderRequest, opts ...grpc.CallOption) (*QueryFundingsByFunderResponse, error) + // FundingsByPool queries all fundings of a pool by id. + FundingsByPool(ctx context.Context, in *QueryFundingsByPoolRequest, opts ...grpc.CallOption) (*QueryFundingsByPoolResponse, error) } type queryFundersClient struct { @@ -602,12 +876,34 @@ func (c *queryFundersClient) Funder(ctx context.Context, in *QueryFunderRequest, return out, nil } +func (c *queryFundersClient) FundingsByFunder(ctx context.Context, in *QueryFundingsByFunderRequest, opts ...grpc.CallOption) (*QueryFundingsByFunderResponse, error) { + out := new(QueryFundingsByFunderResponse) + err := c.cc.Invoke(ctx, "/kyve.query.v1beta1.QueryFunders/FundingsByFunder", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryFundersClient) FundingsByPool(ctx context.Context, in *QueryFundingsByPoolRequest, opts ...grpc.CallOption) (*QueryFundingsByPoolResponse, error) { + out := new(QueryFundingsByPoolResponse) + err := c.cc.Invoke(ctx, "/kyve.query.v1beta1.QueryFunders/FundingsByPool", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryFundersServer is the server API for QueryFunders service. type QueryFundersServer interface { // Funders queries all funders. Funders(context.Context, *QueryFundersRequest) (*QueryFundersResponse, error) // Funder queries a funder by address. Funder(context.Context, *QueryFunderRequest) (*QueryFunderResponse, error) + // FundingsByFunder queries all fundings of a funder by address. + FundingsByFunder(context.Context, *QueryFundingsByFunderRequest) (*QueryFundingsByFunderResponse, error) + // FundingsByPool queries all fundings of a pool by id. + FundingsByPool(context.Context, *QueryFundingsByPoolRequest) (*QueryFundingsByPoolResponse, error) } // UnimplementedQueryFundersServer can be embedded to have forward compatible implementations. @@ -620,6 +916,12 @@ func (*UnimplementedQueryFundersServer) Funders(ctx context.Context, req *QueryF func (*UnimplementedQueryFundersServer) Funder(ctx context.Context, req *QueryFunderRequest) (*QueryFunderResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Funder not implemented") } +func (*UnimplementedQueryFundersServer) FundingsByFunder(ctx context.Context, req *QueryFundingsByFunderRequest) (*QueryFundingsByFunderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FundingsByFunder not implemented") +} +func (*UnimplementedQueryFundersServer) FundingsByPool(ctx context.Context, req *QueryFundingsByPoolRequest) (*QueryFundingsByPoolResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FundingsByPool not implemented") +} func RegisterQueryFundersServer(s grpc1.Server, srv QueryFundersServer) { s.RegisterService(&_QueryFunders_serviceDesc, srv) @@ -661,6 +963,42 @@ func _QueryFunders_Funder_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _QueryFunders_FundingsByFunder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryFundingsByFunderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryFundersServer).FundingsByFunder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kyve.query.v1beta1.QueryFunders/FundingsByFunder", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryFundersServer).FundingsByFunder(ctx, req.(*QueryFundingsByFunderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _QueryFunders_FundingsByPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryFundingsByPoolRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryFundersServer).FundingsByPool(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kyve.query.v1beta1.QueryFunders/FundingsByPool", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryFundersServer).FundingsByPool(ctx, req.(*QueryFundingsByPoolRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _QueryFunders_serviceDesc = grpc.ServiceDesc{ ServiceName: "kyve.query.v1beta1.QueryFunders", HandlerType: (*QueryFundersServer)(nil), @@ -673,6 +1011,14 @@ var _QueryFunders_serviceDesc = grpc.ServiceDesc{ MethodName: "Funder", Handler: _QueryFunders_Funder_Handler, }, + { + MethodName: "FundingsByFunder", + Handler: _QueryFunders_FundingsByFunder_Handler, + }, + { + MethodName: "FundingsByPool", + Handler: _QueryFunders_FundingsByPool_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "kyve/query/v1beta1/funders.proto", @@ -916,18 +1262,6 @@ func (m *QueryFundersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintFunders(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } if len(m.Funders) > 0 { for iNdEx := len(m.Funders) - 1; iNdEx >= 0; iNdEx-- { { @@ -939,8 +1273,20 @@ func (m *QueryFundersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintFunders(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + } + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFunders(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -1034,13 +1380,227 @@ func (m *QueryFunderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintFunders(dAtA []byte, offset int, v uint64) int { - offset -= sovFunders(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *QueryFundingsByFunderRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryFundingsByFunderRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFundingsByFunderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.WithInactiveFundings { + i-- + if m.WithInactiveFundings { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(m.Search) > 0 { + i -= len(m.Search) + copy(dAtA[i:], m.Search) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Search))) + i-- + dAtA[i] = 0x1a + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x12 + } + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFunders(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryFundingsByFunderResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryFundingsByFunderResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFundingsByFunderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Fundings) > 0 { + for iNdEx := len(m.Fundings) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Fundings[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFunders(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFunders(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryFundingsByPoolRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryFundingsByPoolRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFundingsByPoolRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.WithInactiveFundings { + i-- + if m.WithInactiveFundings { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(m.Search) > 0 { + i -= len(m.Search) + copy(dAtA[i:], m.Search) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Search))) + i-- + dAtA[i] = 0x1a + } + if m.PoolId != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x10 + } + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFunders(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryFundingsByPoolResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryFundingsByPoolResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFundingsByPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Fundings) > 0 { + for iNdEx := len(m.Fundings) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Fundings[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFunders(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFunders(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintFunders(dAtA []byte, offset int, v uint64) int { + offset -= sovFunders(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ } dAtA[offset] = uint8(v) return base @@ -1151,16 +1711,16 @@ func (m *QueryFundersResponse) Size() (n int) { } var l int _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovFunders(uint64(l)) + } if len(m.Funders) > 0 { for _, e := range m.Funders { l = e.Size() n += 1 + l + sovFunders(uint64(l)) } } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovFunders(uint64(l)) - } return n } @@ -1199,25 +1759,110 @@ func (m *QueryFunderResponse) Size() (n int) { return n } -func sovFunders(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozFunders(x uint64) (n int) { - return sovFunders(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func (m *QueryFundingsByFunderRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Address) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Search) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + if m.WithInactiveFundings { + n += 2 + } + return n } -func (m *Funder) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFunders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } + +func (m *QueryFundingsByFunderResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovFunders(uint64(l)) + } + if len(m.Fundings) > 0 { + for _, e := range m.Fundings { + l = e.Size() + n += 1 + l + sovFunders(uint64(l)) + } + } + return n +} + +func (m *QueryFundingsByPoolRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovFunders(uint64(l)) + } + if m.PoolId != 0 { + n += 1 + sovFunders(uint64(m.PoolId)) + } + l = len(m.Search) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + if m.WithInactiveFundings { + n += 2 + } + return n +} + +func (m *QueryFundingsByPoolResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovFunders(uint64(l)) + } + if len(m.Fundings) > 0 { + for _, e := range m.Fundings { + l = e.Size() + n += 1 + l + sovFunders(uint64(l)) + } + } + return n +} + +func sovFunders(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozFunders(x uint64) (n int) { + return sovFunders(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Funder) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift @@ -1300,9 +1945,532 @@ func (m *Funder) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stats", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Stats == nil { + m.Stats = &FundingStats{} + } + if err := m.Stats.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FundingStats) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FundingStats: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FundingStats: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalUsedFunds", wireType) + } + m.TotalUsedFunds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalUsedFunds |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalAllocatedFunds", wireType) + } + m.TotalAllocatedFunds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalAllocatedFunds |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalAmountPerBundle", wireType) + } + m.TotalAmountPerBundle = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalAmountPerBundle |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PoolsFunded = append(m.PoolsFunded, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PoolsFunded) == 0 { + m.PoolsFunded = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PoolsFunded = append(m.PoolsFunded, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PoolsFunded", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Funding) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Funding: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Funding: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AmountPerBundle", wireType) + } + m.AmountPerBundle = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AmountPerBundle |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalFunded", wireType) + } + m.TotalFunded = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalFunded |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryFundersRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryFundersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFundersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowFunders @@ -1312,27 +2480,31 @@ func (m *Funder) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthFunders } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthFunders } if postIndex > l { return io.ErrUnexpectedEOF } - m.Identity = string(dAtA[iNdEx:postIndex]) + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 4: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Search", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1360,45 +2532,63 @@ func (m *Funder) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Website = string(dAtA[iNdEx:postIndex]) + m.Search = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contact", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFunders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthFunders } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthFunders + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - if postIndex > l { + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryFundersResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.Contact = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryFundersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFundersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowFunders @@ -1408,27 +2598,31 @@ func (m *Funder) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthFunders } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthFunders } if postIndex > l { return io.ErrUnexpectedEOF } - m.Description = string(dAtA[iNdEx:postIndex]) + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 7: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Stats", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Funders", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1455,10 +2649,8 @@ func (m *Funder) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Stats == nil { - m.Stats = &FundingStats{} - } - if err := m.Stats.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Funders = append(m.Funders, Funder{}) + if err := m.Funders[len(m.Funders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1483,7 +2675,7 @@ func (m *Funder) Unmarshal(dAtA []byte) error { } return nil } -func (m *FundingStats) Unmarshal(dAtA []byte) error { +func (m *QueryFunderRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1506,36 +2698,17 @@ func (m *FundingStats) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: FundingStats: wiretype end group for non-group") + return fmt.Errorf("proto: QueryFunderRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: FundingStats: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryFunderRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalUsedFunds", wireType) - } - m.TotalUsedFunds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFunders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalUsedFunds |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalAllocatedFunds", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } - m.TotalAllocatedFunds = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowFunders @@ -1545,106 +2718,44 @@ func (m *FundingStats) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TotalAllocatedFunds |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalAmountPerBundle", wireType) + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders } - m.TotalAmountPerBundle = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFunders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalAmountPerBundle |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders } - case 4: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFunders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.PoolsFunded = append(m.PoolsFunded, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFunders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthFunders - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthFunders - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.PoolsFunded) == 0 { - m.PoolsFunded = make([]uint64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFunders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.PoolsFunded = append(m.PoolsFunded, v) + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field WithInactiveFundings", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field PoolsFunded", wireType) } + m.WithInactiveFundings = bool(v != 0) default: iNdEx = preIndex skippy, err := skipFunders(dAtA[iNdEx:]) @@ -1666,7 +2777,7 @@ func (m *FundingStats) Unmarshal(dAtA []byte) error { } return nil } -func (m *Funding) Unmarshal(dAtA []byte) error { +func (m *QueryFunderResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1689,17 +2800,17 @@ func (m *Funding) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Funding: wiretype end group for non-group") + return fmt.Errorf("proto: QueryFunderResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Funding: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryFunderResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Funder", wireType) } - m.PoolId = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowFunders @@ -1709,16 +2820,33 @@ func (m *Funding) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.PoolId |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Funder == nil { + m.Funder = &Funder{} + } + if err := m.Funder.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fundings", wireType) } - m.Amount = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowFunders @@ -1728,49 +2856,26 @@ func (m *Funding) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Amount |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AmountPerBundle", wireType) + if msglen < 0 { + return ErrInvalidLengthFunders } - m.AmountPerBundle = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFunders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AmountPerBundle |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFunders } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalFunded", wireType) + if postIndex > l { + return io.ErrUnexpectedEOF } - m.TotalFunded = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFunders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalFunded |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + m.Fundings = append(m.Fundings, Funding{}) + if err := m.Fundings[len(m.Fundings)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipFunders(dAtA[iNdEx:]) @@ -1792,7 +2897,7 @@ func (m *Funding) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryFundersRequest) Unmarshal(dAtA []byte) error { +func (m *QueryFundingsByFunderRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1815,10 +2920,10 @@ func (m *QueryFundersRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFundersRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryFundingsByFunderRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFundersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryFundingsByFunderRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1858,6 +2963,38 @@ func (m *QueryFundersRequest) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Search", wireType) } @@ -1889,6 +3026,26 @@ func (m *QueryFundersRequest) Unmarshal(dAtA []byte) error { } m.Search = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field WithInactiveFundings", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.WithInactiveFundings = bool(v != 0) default: iNdEx = preIndex skippy, err := skipFunders(dAtA[iNdEx:]) @@ -1910,7 +3067,7 @@ func (m *QueryFundersRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryFundersResponse) Unmarshal(dAtA []byte) error { +func (m *QueryFundingsByFunderResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1933,15 +3090,15 @@ func (m *QueryFundersResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFundersResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryFundingsByFunderResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFundersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryFundingsByFunderResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Funders", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1968,14 +3125,16 @@ func (m *QueryFundersResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Funders = append(m.Funders, Funder{}) - if err := m.Funders[len(m.Funders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Fundings", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2002,10 +3161,8 @@ func (m *QueryFundersResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Fundings = append(m.Fundings, Funding{}) + if err := m.Fundings[len(m.Fundings)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2030,7 +3187,7 @@ func (m *QueryFundersResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryFunderRequest) Unmarshal(dAtA []byte) error { +func (m *QueryFundingsByPoolRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2053,15 +3210,70 @@ func (m *QueryFunderRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFunderRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryFundingsByPoolRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFunderRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryFundingsByPoolRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Search", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2089,9 +3301,9 @@ func (m *QueryFunderRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Address = string(dAtA[iNdEx:postIndex]) + m.Search = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field WithInactiveFundings", wireType) } @@ -2132,7 +3344,7 @@ func (m *QueryFunderRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryFunderResponse) Unmarshal(dAtA []byte) error { +func (m *QueryFundingsByPoolResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2155,15 +3367,15 @@ func (m *QueryFunderResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFunderResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryFundingsByPoolResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFunderResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryFundingsByPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Funder", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2190,10 +3402,10 @@ func (m *QueryFunderResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Funder == nil { - m.Funder = &Funder{} + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} } - if err := m.Funder.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/query/types/funders.pb.gw.go b/x/query/types/funders.pb.gw.go index 791a5a0c..b9d4697e 100644 --- a/x/query/types/funders.pb.gw.go +++ b/x/query/types/funders.pb.gw.go @@ -141,6 +141,150 @@ func local_request_QueryFunders_Funder_0(ctx context.Context, marshaler runtime. } +var ( + filter_QueryFunders_FundingsByFunder_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_QueryFunders_FundingsByFunder_0(ctx context.Context, marshaler runtime.Marshaler, client QueryFundersClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFundingsByFunderRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryFunders_FundingsByFunder_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.FundingsByFunder(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_QueryFunders_FundingsByFunder_0(ctx context.Context, marshaler runtime.Marshaler, server QueryFundersServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFundingsByFunderRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryFunders_FundingsByFunder_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.FundingsByFunder(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_QueryFunders_FundingsByPool_0 = &utilities.DoubleArray{Encoding: map[string]int{"pool_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_QueryFunders_FundingsByPool_0(ctx context.Context, marshaler runtime.Marshaler, client QueryFundersClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFundingsByPoolRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["pool_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "pool_id") + } + + protoReq.PoolId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryFunders_FundingsByPool_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.FundingsByPool(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_QueryFunders_FundingsByPool_0(ctx context.Context, marshaler runtime.Marshaler, server QueryFundersServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFundingsByPoolRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["pool_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "pool_id") + } + + protoReq.PoolId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryFunders_FundingsByPool_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.FundingsByPool(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryFundersHandlerServer registers the http handlers for service QueryFunders to "mux". // UnaryRPC :call QueryFundersServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -193,6 +337,52 @@ func RegisterQueryFundersHandlerServer(ctx context.Context, mux *runtime.ServeMu }) + mux.Handle("GET", pattern_QueryFunders_FundingsByFunder_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_QueryFunders_FundingsByFunder_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_QueryFunders_FundingsByFunder_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_QueryFunders_FundingsByPool_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_QueryFunders_FundingsByPool_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_QueryFunders_FundingsByPool_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -274,6 +464,46 @@ func RegisterQueryFundersHandlerClient(ctx context.Context, mux *runtime.ServeMu }) + mux.Handle("GET", pattern_QueryFunders_FundingsByFunder_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_QueryFunders_FundingsByFunder_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_QueryFunders_FundingsByFunder_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_QueryFunders_FundingsByPool_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_QueryFunders_FundingsByPool_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_QueryFunders_FundingsByPool_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -281,10 +511,18 @@ var ( pattern_QueryFunders_Funders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kyve", "query", "v1beta1", "funders"}, "", runtime.AssumeColonVerbOpt(true))) pattern_QueryFunders_Funder_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"kyve", "query", "v1beta1", "funder", "address"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_QueryFunders_FundingsByFunder_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"kyve", "query", "v1beta1", "fundings_by_funder", "address"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_QueryFunders_FundingsByPool_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"kyve", "query", "v1beta1", "fundings_by_pool", "pool_id"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( forward_QueryFunders_Funders_0 = runtime.ForwardResponseMessage forward_QueryFunders_Funder_0 = runtime.ForwardResponseMessage + + forward_QueryFunders_FundingsByFunder_0 = runtime.ForwardResponseMessage + + forward_QueryFunders_FundingsByPool_0 = runtime.ForwardResponseMessage ) From 3c11db8b98993d6861bbe0c807bfa2e412870be3 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 19 Oct 2023 17:24:19 +0200 Subject: [PATCH 079/109] fix: linter errors --- testutil/integration/checks.go | 4 ++-- .../keeper/keeper_suite_funding_bundles_test.go | 4 +--- x/funders/client/cli/tx.go | 9 --------- x/funders/keeper/logic_funders.go | 3 +-- x/funders/types/genesis.go | 16 ++++++++-------- 5 files changed, 12 insertions(+), 24 deletions(-) diff --git a/testutil/integration/checks.go b/testutil/integration/checks.go index bcfde8a5..fc3d51ac 100644 --- a/testutil/integration/checks.go +++ b/testutil/integration/checks.go @@ -465,8 +465,8 @@ func (suite *KeeperTestSuite) VerifyFundersModuleIntegrity() { fsActiveAddresses := make(map[string]bool) for _, funderAddress := range fundingState.ActiveFunderAddresses { // check if funding has a valid funder - key := string(funderstypes.FundingKeyByFunder(funderAddress, fundingState.PoolId)) - _, found := allActiveFundings[key] + key := funderstypes.FundingKeyByFunder(funderAddress, fundingState.PoolId) + _, found := allActiveFundings[string(key)] Expect(found).To(BeTrue()) // check if funder is not already in the list diff --git a/x/bundles/keeper/keeper_suite_funding_bundles_test.go b/x/bundles/keeper/keeper_suite_funding_bundles_test.go index 53bfb4ae..d014456a 100644 --- a/x/bundles/keeper/keeper_suite_funding_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_funding_bundles_test.go @@ -503,8 +503,6 @@ var _ = Describe("funding bundles", Ordered, func() { BundleSummary: "test_value", }) - pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds @@ -529,7 +527,7 @@ var _ = Describe("funding bundles", Ordered, func() { }) // ASSERT - pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) // assert if bundle go finalized Expect(pool.TotalBundles).To(Equal(uint64(1))) diff --git a/x/funders/client/cli/tx.go b/x/funders/client/cli/tx.go index 7161ea30..6ff358ec 100644 --- a/x/funders/client/cli/tx.go +++ b/x/funders/client/cli/tx.go @@ -2,8 +2,6 @@ package cli import ( "fmt" - "time" - "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" @@ -11,13 +9,6 @@ import ( "github.com/KYVENetwork/chain/x/funders/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{ diff --git a/x/funders/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go index c8b9f63e..e464a48f 100644 --- a/x/funders/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -1,7 +1,6 @@ package keeper import ( - goerrors "errors" "fmt" "cosmossdk.io/errors" @@ -77,7 +76,7 @@ func (k Keeper) ChargeFundersOfPool(ctx sdk.Context, poolId uint64) (payout uint // Precondition: len(fundings) > 0 func (k Keeper) GetLowestFunding(fundings []types.Funding) (lowestFunding *types.Funding, err error) { if len(fundings) == 0 { - return nil, goerrors.New(fmt.Sprintf("no active fundings")) + return nil, fmt.Errorf("no active fundings") } lowestFunding = &fundings[0] diff --git a/x/funders/types/genesis.go b/x/funders/types/genesis.go index 4e355271..9529939d 100644 --- a/x/funders/types/genesis.go +++ b/x/funders/types/genesis.go @@ -16,8 +16,8 @@ func (gs GenesisState) Validate() error { // this line is used by starport scaffolding # genesis/types/validate fundersIndexMap := make(map[string]struct{}) for _, funder := range gs.FunderList { - index := string(FunderKey(funder.Address)) - if _, ok := fundersIndexMap[index]; ok { + index := FunderKey(funder.Address) + if _, ok := fundersIndexMap[string(index)]; ok { return fmt.Errorf("duplicated funder id for %v", funder) } } @@ -25,20 +25,20 @@ func (gs GenesisState) Validate() error { fundingByFunderIndexMap := make(map[string]struct{}) fundingByPoolIndexMap := make(map[string]struct{}) for _, funding := range gs.FundingList { - byFunderIndex := string(FundingKeyByFunder(funding.FunderAddress, funding.PoolId)) - if _, ok := fundingByFunderIndexMap[byFunderIndex]; ok { + byFunderIndex := FundingKeyByFunder(funding.FunderAddress, funding.PoolId) + if _, ok := fundingByFunderIndexMap[string(byFunderIndex)]; ok { return fmt.Errorf("duplicated funding id for %v", funding) } - byPoolIndex := string(FundingKeyByPool(funding.FunderAddress, funding.PoolId)) - if _, ok := fundingByPoolIndexMap[byPoolIndex]; ok { + byPoolIndex := FundingKeyByPool(funding.FunderAddress, funding.PoolId) + if _, ok := fundingByPoolIndexMap[string(byPoolIndex)]; ok { return fmt.Errorf("duplicated funding id for %v", funding) } } fundingStateIndexMap := make(map[string]struct{}) for _, fundingState := range gs.FundingStateList { - index := string(FundingStateKey(fundingState.PoolId)) - if _, ok := fundingStateIndexMap[index]; ok { + index := FundingStateKey(fundingState.PoolId) + if _, ok := fundingStateIndexMap[string(index)]; ok { return fmt.Errorf("duplicated funding state id for %v", fundingState) } } From 92bf81b15fdcaf12d7e01f3a38aaa3df812ea305 Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 23 Oct 2023 14:43:19 +0200 Subject: [PATCH 080/109] fix: filter in GetPaginatedFundingQuery --- x/funders/keeper/getters_funding.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/x/funders/keeper/getters_funding.go b/x/funders/keeper/getters_funding.go index b1e57c18..4952b99e 100644 --- a/x/funders/keeper/getters_funding.go +++ b/x/funders/keeper/getters_funding.go @@ -120,6 +120,14 @@ func (k Keeper) GetPaginatedFundingQuery( return false, err } + if funderAddress != nil && *funderAddress != funding.FunderAddress { + return false, nil + } + + if poolId != nil && *poolId != funding.PoolId { + return false, nil + } + if accumulate { fundings = append(fundings, funding) } From e96b42d330a381585761918c9fed662e661dfb17 Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 24 Oct 2023 11:22:18 +0200 Subject: [PATCH 081/109] feat: add funder address for funding queries --- docs/swagger.yml | 9 ++ proto/kyve/query/v1beta1/funders.proto | 10 +- x/query/keeper/grpc_query_fundings.go | 1 + x/query/types/funders.pb.go | 189 ++++++++++++++++--------- 4 files changed, 137 insertions(+), 72 deletions(-) diff --git a/docs/swagger.yml b/docs/swagger.yml index cb4a9732..a45a5840 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -7789,6 +7789,9 @@ paths: items: type: object properties: + funder_address: + type: string + title: funder_address pool_id: type: string format: uint64 @@ -8397,6 +8400,9 @@ paths: items: type: object properties: + funder_address: + type: string + title: funder_address pool_id: type: string format: uint64 @@ -8720,6 +8726,9 @@ paths: items: type: object properties: + funder_address: + type: string + title: funder_address pool_id: type: string format: uint64 diff --git a/proto/kyve/query/v1beta1/funders.proto b/proto/kyve/query/v1beta1/funders.proto index 49728468..6692963b 100644 --- a/proto/kyve/query/v1beta1/funders.proto +++ b/proto/kyve/query/v1beta1/funders.proto @@ -64,14 +64,16 @@ message FundingStats { // Funding ... message Funding { + // funder_address + string funder_address = 1; // pool_id ... - uint64 pool_id = 1; + uint64 pool_id = 2; // amount ... - uint64 amount = 2; + uint64 amount = 3; // amount_per_bundle ... - uint64 amount_per_bundle = 3; + uint64 amount_per_bundle = 4; // total_funded ... - uint64 total_funded = 4; + uint64 total_funded = 5; } // ======== diff --git a/x/query/keeper/grpc_query_fundings.go b/x/query/keeper/grpc_query_fundings.go index 93eb1241..1f6d7e66 100644 --- a/x/query/keeper/grpc_query_fundings.go +++ b/x/query/keeper/grpc_query_fundings.go @@ -46,6 +46,7 @@ func (k Keeper) parseFundings(fundings []fundersTypes.Funding, withInactiveFundi for _, funding := range fundings { if funding.Amount > 0 || withInactiveFundings { fundingsData = append(fundingsData, types.Funding{ + FunderAddress: funding.FunderAddress, PoolId: funding.PoolId, Amount: funding.Amount, AmountPerBundle: funding.AmountPerBundle, diff --git a/x/query/types/funders.pb.go b/x/query/types/funders.pb.go index 34afa4dc..ada27d2b 100644 --- a/x/query/types/funders.pb.go +++ b/x/query/types/funders.pb.go @@ -205,14 +205,16 @@ func (m *FundingStats) GetPoolsFunded() []uint64 { // Funding ... type Funding struct { + // funder_address + FunderAddress string `protobuf:"bytes,1,opt,name=funder_address,json=funderAddress,proto3" json:"funder_address,omitempty"` // pool_id ... - PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` // amount ... - Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` + Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` // amount_per_bundle ... - AmountPerBundle uint64 `protobuf:"varint,3,opt,name=amount_per_bundle,json=amountPerBundle,proto3" json:"amount_per_bundle,omitempty"` + AmountPerBundle uint64 `protobuf:"varint,4,opt,name=amount_per_bundle,json=amountPerBundle,proto3" json:"amount_per_bundle,omitempty"` // total_funded ... - TotalFunded uint64 `protobuf:"varint,4,opt,name=total_funded,json=totalFunded,proto3" json:"total_funded,omitempty"` + TotalFunded uint64 `protobuf:"varint,5,opt,name=total_funded,json=totalFunded,proto3" json:"total_funded,omitempty"` } func (m *Funding) Reset() { *m = Funding{} } @@ -248,6 +250,13 @@ func (m *Funding) XXX_DiscardUnknown() { var xxx_messageInfo_Funding proto.InternalMessageInfo +func (m *Funding) GetFunderAddress() string { + if m != nil { + return m.FunderAddress + } + return "" +} + func (m *Funding) GetPoolId() uint64 { if m != nil { return m.PoolId @@ -769,63 +778,64 @@ func init() { func init() { proto.RegisterFile("kyve/query/v1beta1/funders.proto", fileDescriptor_a182f068d9f0dba9) } var fileDescriptor_a182f068d9f0dba9 = []byte{ - // 890 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcd, 0x8b, 0x23, 0x45, - 0x14, 0x9f, 0xca, 0xf4, 0x26, 0x63, 0x65, 0x58, 0xd7, 0xda, 0x71, 0xb7, 0xe9, 0xd9, 0x8d, 0xb1, - 0x95, 0x99, 0x30, 0x48, 0xf7, 0x4c, 0xd4, 0x45, 0x04, 0x0f, 0x06, 0x5d, 0x59, 0x04, 0x19, 0x5b, - 0x14, 0xf4, 0xd2, 0x54, 0xba, 0xcb, 0x4e, 0x31, 0x49, 0x57, 0x6f, 0x57, 0xf5, 0x8c, 0x61, 0xd9, - 0x83, 0x5e, 0xd4, 0x9b, 0xe0, 0xd1, 0xb3, 0x88, 0x47, 0xff, 0x09, 0x59, 0x10, 0x64, 0xc1, 0x8b, - 0x27, 0x91, 0x19, 0xf1, 0xaf, 0xf0, 0x20, 0xf5, 0x91, 0x4c, 0x27, 0x93, 0x8f, 0x11, 0x73, 0xd8, - 0x5b, 0xbd, 0x8f, 0x5f, 0xde, 0xef, 0xfd, 0xea, 0xbd, 0x4a, 0xc3, 0xe6, 0xd1, 0xf0, 0x98, 0xf8, - 0xf7, 0x0b, 0x92, 0x0f, 0xfd, 0xe3, 0x83, 0x2e, 0x11, 0xf8, 0xc0, 0xff, 0xb4, 0x48, 0x63, 0x92, - 0x73, 0x2f, 0xcb, 0x99, 0x60, 0x08, 0xc9, 0x0c, 0x4f, 0x65, 0x78, 0x26, 0xc3, 0xd9, 0x8b, 0x18, - 0x1f, 0x30, 0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, 0xaa, 0x3e, 0x00, 0x5f, 0xfe, 0x37, 0x00, 0x00, - 0xff, 0xff, 0x59, 0x58, 0xba, 0xfc, 0x98, 0x0a, 0x00, 0x00, + // 905 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcd, 0x6b, 0x24, 0x45, + 0x14, 0x4f, 0x4d, 0x3a, 0x33, 0xf1, 0x4d, 0x8c, 0x6b, 0x6d, 0xdc, 0x6d, 0x26, 0xbb, 0xe3, 0x38, + 0x6a, 0x32, 0x04, 0xe9, 0x4e, 0x46, 0x5d, 0x44, 0xf0, 0xb0, 0x41, 0x57, 0x16, 0x41, 0x62, 0x8b, + 0x82, 0x5e, 0x9a, 0x9a, 0xee, 0xb2, 0x53, 0x64, 0xd2, 0x35, 0xdb, 0x55, 0x9d, 0x38, 0x2c, 0x7b, + 0xd0, 0x8b, 0x1e, 0x05, 0x8f, 0x9e, 0x45, 0xbc, 0xe9, 0x3f, 0x21, 0x0b, 0x82, 0x2c, 0x78, 0xf1, + 0x24, 0x92, 0x88, 0x7f, 0x85, 0x07, 0xa9, 0x8f, 0x99, 0xf4, 0x4c, 0xe6, 0x63, 0xc5, 0x39, 0x78, + 0xeb, 0xf7, 0xf1, 0xab, 0xf7, 0x7b, 0xaf, 0x7e, 0xaf, 0x66, 0xa0, 0x71, 0xd4, 0x3f, 0xa1, 0xfe, + 0xbd, 0x9c, 0x66, 0x7d, 0xff, 0x64, 0xaf, 0x43, 0x25, 0xd9, 0xf3, 0x3f, 0xc9, 0xd3, 0x98, 0x66, + 0xc2, 0xeb, 0x65, 0x5c, 0x72, 0x8c, 0x55, 0x86, 0xa7, 0x33, 0x3c, 0x9b, 0x51, 0xdb, 0x89, 0xb8, + 0x38, 0xe6, 0xc2, 0xef, 0x10, 0x31, 0x0e, 0xee, 0x91, 0x84, 0xa5, 0x44, 0x32, 0x9e, 0x1a, 0x7c, + 0x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0xff, 0x89, 0x2f, 0xff, 0x13, 0x00, 0x00, 0xff, + 0xff, 0xac, 0x47, 0xbc, 0xca, 0xbf, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1180,22 +1190,29 @@ func (m *Funding) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.TotalFunded != 0 { i = encodeVarintFunders(dAtA, i, uint64(m.TotalFunded)) i-- - dAtA[i] = 0x20 + dAtA[i] = 0x28 } if m.AmountPerBundle != 0 { i = encodeVarintFunders(dAtA, i, uint64(m.AmountPerBundle)) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x20 } if m.Amount != 0 { i = encodeVarintFunders(dAtA, i, uint64(m.Amount)) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x18 } if m.PoolId != 0 { i = encodeVarintFunders(dAtA, i, uint64(m.PoolId)) i-- - dAtA[i] = 0x8 + dAtA[i] = 0x10 + } + if len(m.FunderAddress) > 0 { + i -= len(m.FunderAddress) + copy(dAtA[i:], m.FunderAddress) + i = encodeVarintFunders(dAtA, i, uint64(len(m.FunderAddress))) + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -1673,6 +1690,10 @@ func (m *Funding) Size() (n int) { } var l int _ = l + l = len(m.FunderAddress) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } if m.PoolId != 0 { n += 1 + sovFunders(uint64(m.PoolId)) } @@ -2341,6 +2362,38 @@ func (m *Funding) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FunderAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FunderAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) } @@ -2359,7 +2412,7 @@ func (m *Funding) Unmarshal(dAtA []byte) error { break } } - case 2: + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } @@ -2378,7 +2431,7 @@ func (m *Funding) Unmarshal(dAtA []byte) error { break } } - case 3: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field AmountPerBundle", wireType) } @@ -2397,7 +2450,7 @@ func (m *Funding) Unmarshal(dAtA []byte) error { break } } - case 4: + case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TotalFunded", wireType) } From 39315c5d8a5aa0c7b0651014d89129cbd5f8e10a Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 25 Oct 2023 16:02:28 +0200 Subject: [PATCH 082/109] chore: add new values to config.yml --- config.yml | 65 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 10 deletions(-) diff --git a/config.yml b/config.yml index 99b27eb2..4017eef6 100644 --- a/config.yml +++ b/config.yml @@ -31,17 +31,17 @@ accounts: - 1000000000000000tkyve mnemonic: open home share route party lake room solution quantum pact model avocado humor dilemma review desert turtle total humor produce rate keen eagle fee -# - name: team -# coins: -# - 165000000000000tkyve -# address: kyve1e29j95xmsw3zmvtrk4st8e89z5n72v7nf70ma4 + # - name: team + # coins: + # - 165000000000000tkyve + # address: kyve1e29j95xmsw3zmvtrk4st8e89z5n72v7nf70ma4 - name: foundation coins: # for fees - 1000000tkyve mnemonic: evidence taxi material cabin annual phrase practice unhappy safe jealous section drink illness panther bread aim mouse dolphin deliver ready doll finger search cheap -# address: kyve1fd4qu868n7arav8vteghcppxxa0p2vna5f5ep8 + # address: kyve1fd4qu868n7arav8vteghcppxxa0p2vna5f5ep8 - name: foundation_inflation coins: # for fees @@ -134,7 +134,7 @@ genesis: pool: params: protocol_inflation_share: "0.04" - pool_count: "1" + pool_count: "2" pool_list: - config: "{\"network\":\"kyve-1\",\"rpc\":\"https://rpc-eu-1.kyve.network\"}" current_compression_id: "1" @@ -162,6 +162,32 @@ genesis: binaries: "" scheduled_at: "0" duration: "0" + - config: "{\"network\":\"kyve-1\",\"rpc\":\"https://rpc-eu-1.kyve.network\"}" + current_compression_id: "1" + current_index: "0" + current_key: "" + current_storage_provider_id: "1" + current_summary: "" + id: "1" + logo: "" + max_bundle_size: "100" + min_delegation: "100000000000" + name: "KYVE // Blub" + inflation_share_weight: "2500000000" + disabled: false + runtime: '@kyvejs/tendermint-bsync' + start_key: "1" + total_bundles: "0" + upload_interval: "60" + protocol: + version: "1.0.0" + binaries: "{\"kyve-linux-arm64\":\"https://github.com/KYVENetwork/kyvejs/releases/download/%40kyvejs%2Ftendermint-bsync%401.0.0/kyve-linux-arm64.zip\",\"kyve-linux-x64\":\"https://github.com/KYVENetwork/kyvejs/releases/download/%40kyvejs%2Ftendermint-bsync%401.0.0/kyve-linux-x64.zip\",\"kyve-macos-x64\":\"https://github.com/KYVENetwork/kyvejs/releases/download/%40kyvejs%2Ftendermint-bsync%401.0.0/kyve-macos-x64.zip\"}" + last_upgrade: "0" + upgrade_plan: + version: "" + binaries: "" + scheduled_at: "0" + duration: "0" stakers: params: commission_change_time: 10 @@ -179,16 +205,35 @@ genesis: description: "Alice is the first funder of the KYVE network." website: "https://kyve.network" identity: "0657A086E5201562" + - address: "kyve1e29j95xmsw3zmvtrk4st8e89z5n72v7nf70ma4" + contact: "https://twitter.com/kyvenetwork" + moniker: "Otto" + description: "Another funder of the KYVE network." + website: "https://ot.to" + identity: "0657A086E5201562" funding_list: - pool_id: 0 funder_address: "kyve1jq304cthpx0lwhpqzrdjrcza559ukyy3zsl2vd" - amount: 1000000 - amount_per_bundle: 1000 - total_funded: 0 + amount: 5000000000000 + amount_per_bundle: 230000000 + total_funded: 2200400000000 + - pool_id: 0 + funder_address: "kyve1e29j95xmsw3zmvtrk4st8e89z5n72v7nf70ma4" + amount: 200000000000 + amount_per_bundle: 20000000 + total_funded: 64500000000 + - pool_id: 1 + funder_address: "kyve1jq304cthpx0lwhpqzrdjrcza559ukyy3zsl2vd" + amount: 100000000000 + amount_per_bundle: 10000000 + total_funded: 23000000000 funding_state_list: - pool_id: 0 active_funder_addresses: [] - total_amount: 1000000 + total_amount: 5200000000000 + - pool_id: 1 + active_funder_addresses: [ ] + total_amount: 100000000000 chain_id: kyve-local validators: - name: alice From f2fc0ce5b43bc1d00aacc181f7416fcfe8a77d1b Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 25 Oct 2023 16:03:39 +0200 Subject: [PATCH 083/109] chore: remove unused error --- x/bundles/types/errors.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/bundles/types/errors.go b/x/bundles/types/errors.go index bacc1e93..5b3d2ff7 100644 --- a/x/bundles/types/errors.go +++ b/x/bundles/types/errors.go @@ -18,7 +18,6 @@ var ( ErrPoolDisabled = errors.Register(ModuleName, 1121, "pool is disabled") ErrPoolCurrentlyUpgrading = errors.Register(ModuleName, 1122, "pool currently upgrading") ErrMinDelegationNotReached = errors.Register(ModuleName, 1200, "min delegation not reached") - ErrPoolOutOfFunds = errors.Register(ModuleName, 1201, "pool is out of funds") ErrBundleDropped = errors.Register(ModuleName, 1202, "bundle proposal is dropped") ErrAlreadyVotedValid = errors.Register(ModuleName, 1204, "already voted valid on bundle proposal") ErrAlreadyVotedInvalid = errors.Register(ModuleName, 1205, "already voted invalid on bundle proposal") From 427f930090c974f84d70b692974cf8ed18c9b67e Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 25 Oct 2023 16:04:19 +0200 Subject: [PATCH 084/109] chore: optimize grpc_account_funded query --- x/query/keeper/grpc_account_funded.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/x/query/keeper/grpc_account_funded.go b/x/query/keeper/grpc_account_funded.go index 5ffe02ee..f87e47e0 100644 --- a/x/query/keeper/grpc_account_funded.go +++ b/x/query/keeper/grpc_account_funded.go @@ -17,23 +17,22 @@ func (k Keeper) AccountFundedList(goCtx context.Context, req *types.QueryAccount ctx := sdk.UnwrapSDKContext(goCtx) var funded []types.Funded - pools := k.poolKeeper.GetAllPools(ctx) - - for _, pool := range pools { - funding, found := k.fundersKeeper.GetFunding(ctx, req.Address, pool.Id) - if !found { - return nil, status.Error(codes.Internal, "funding not found") - } - fundingState, found := k.fundersKeeper.GetFundingState(ctx, pool.Id) - if !found { - return nil, status.Error(codes.Internal, "funding state not found") - } + fundings := k.fundersKeeper.GetFundingsOfFunder(ctx, req.Address) + for _, funding := range fundings { if funding.Amount > 0 { + pool, found := k.poolKeeper.GetPool(ctx, funding.PoolId) + if !found { + return nil, status.Error(codes.Internal, "pool not found") + } + fundingState, found := k.fundersKeeper.GetFundingState(ctx, funding.PoolId) + if !found { + return nil, status.Error(codes.Internal, "funding state not found") + } funded = append(funded, types.Funded{ Amount: funding.Amount, Pool: &types.BasicPool{ - Id: pool.Id, + Id: funding.PoolId, Name: pool.Name, Runtime: pool.Runtime, Logo: pool.Logo, From b143cea22437885922abe962a30406ed6f607849 Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 25 Oct 2023 16:04:38 +0200 Subject: [PATCH 085/109] feat: add fundings cli query --- x/query/client/cli/query.go | 1 + x/query/client/cli/query_fundings.go | 83 ++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 x/query/client/cli/query_fundings.go diff --git a/x/query/client/cli/query.go b/x/query/client/cli/query.go index 55df931a..2598a301 100644 --- a/x/query/client/cli/query.go +++ b/x/query/client/cli/query.go @@ -55,6 +55,7 @@ func GetQueryCmd(queryRoute string) *cobra.Command { // Funders cmd.AddCommand(CmdShowFunder()) cmd.AddCommand(CmdListFunders()) + cmd.AddCommand(CmdListFundings()) return cmd } diff --git a/x/query/client/cli/query_fundings.go b/x/query/client/cli/query_fundings.go new file mode 100644 index 00000000..5903e5d0 --- /dev/null +++ b/x/query/client/cli/query_fundings.go @@ -0,0 +1,83 @@ +package cli + +import ( + "context" + "github.com/KYVENetwork/chain/x/query/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/spf13/cobra" + "strconv" +) + +func byFunder( + clientCtx client.Context, + queryClient types.QueryFundersClient, + pageReq *query.PageRequest, + address string, +) error { + params := &types.QueryFundingsByFunderRequest{ + Pagination: pageReq, + Address: address, + WithInactiveFundings: true, + } + + res, err := queryClient.FundingsByFunder(context.Background(), params) + if err != nil { + return err + } + return clientCtx.PrintProto(res) +} + +func byPool( + clientCtx client.Context, + queryClient types.QueryFundersClient, + pageReq *query.PageRequest, + poolId uint64, +) error { + params := &types.QueryFundingsByPoolRequest{ + Pagination: pageReq, + PoolId: poolId, + WithInactiveFundings: true, + } + + res, err := queryClient.FundingsByPool(context.Background(), params) + if err != nil { + return err + } + return clientCtx.PrintProto(res) +} + +func CmdListFundings() *cobra.Command { + cmd := &cobra.Command{ + Use: "fundings [address | pool-id]", + Short: "list all fundings of a user or a pool", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + reqAddressOrPool := args[0] + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryFundersClient(clientCtx) + + poolId, err := strconv.ParseUint(reqAddressOrPool, 10, 64) + if err != nil { + return byFunder(clientCtx, queryClient, pageReq, reqAddressOrPool) + } + return byPool(clientCtx, queryClient, pageReq, poolId) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} From 701a54f26ff180c11fe6e1a8735844eae1ad8ec4 Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Thu, 26 Oct 2023 10:21:01 +0200 Subject: [PATCH 086/109] chore: remove aggregated variable --- proto/kyve/funders/v1beta1/funders.proto | 2 - testutil/integration/checks.go | 7 +- .../keeper_suite_dropped_bundles_test.go | 2 +- .../keeper_suite_funding_bundles_test.go | 14 ++-- .../keeper_suite_inflation_splitting_test.go | 24 +++--- .../keeper_suite_invalid_bundles_test.go | 6 +- .../keeper/keeper_suite_valid_bundles_test.go | 14 ++-- .../keeper_suite_zero_delegation_test.go | 6 +- x/delegation/keeper/keeper_suite_test.go | 2 +- x/funders/keeper/logic_funders.go | 14 +++- x/funders/keeper/logic_funders_test.go | 2 - x/funders/keeper/msg_server_defund_pool.go | 1 - .../keeper/msg_server_defund_pool_test.go | 3 - x/funders/keeper/msg_server_fund_pool.go | 2 - x/funders/keeper/msg_server_fund_pool_test.go | 13 --- x/funders/types/funders.go | 13 --- x/funders/types/funders.pb.go | 84 ++++++------------- x/funders/types/funders_test.go | 30 ------- x/pool/keeper/msg_server_create_pool_test.go | 2 - x/query/keeper/grpc_account_funded.go | 2 +- x/query/keeper/helper.go | 9 +- ...sg_server_claim_commission_rewards_test.go | 2 +- 22 files changed, 78 insertions(+), 176 deletions(-) diff --git a/proto/kyve/funders/v1beta1/funders.proto b/proto/kyve/funders/v1beta1/funders.proto index 2ef833f8..13867c80 100644 --- a/proto/kyve/funders/v1beta1/funders.proto +++ b/proto/kyve/funders/v1beta1/funders.proto @@ -45,6 +45,4 @@ message FundingState { uint64 pool_id = 1; // active_funder_addresses is the list of all active fundings repeated string active_funder_addresses = 2; - // total_amount is the total amount of funds in ukyve the pool has from all fundings - uint64 total_amount = 3; } diff --git a/testutil/integration/checks.go b/testutil/integration/checks.go index fc3d51ac..975df2df 100644 --- a/testutil/integration/checks.go +++ b/testutil/integration/checks.go @@ -496,8 +496,9 @@ func (suite *KeeperTestSuite) VerifyFundersModuleAssetsIntegrity() { for _, activeFunding := range activeFundings { totalAmount += activeFunding.Amount } - Expect(totalAmount).To(Equal(fundingState.TotalAmount)) - expectedFundingStateTotalAmount += fundingState.TotalAmount + totalActiveFunding := suite.App().FundersKeeper.GetTotalActiveFunding(suite.ctx, fundingState.PoolId) + Expect(totalAmount).To(Equal(totalActiveFunding)) + expectedFundingStateTotalAmount += totalAmount } // total amount of fundings should be equal to the amount of the funders module account @@ -564,7 +565,7 @@ func (suite *KeeperTestSuite) verifyFullStaker(fullStaker querytypes.FullStaker, fundingState, found := suite.App().FundersKeeper.GetFundingState(suite.Ctx(), poolMembership.Pool.Id) Expect(found).To(BeTrue()) - Expect(poolMembership.Pool.TotalFunds).To(Equal(fundingState.TotalAmount)) + Expect(poolMembership.Pool.TotalFunds).To(Equal(suite.App().FundersKeeper.GetTotalActiveFunding(suite.Ctx(), fundingState.PoolId))) Expect(poolMembership.Pool.Name).To(Equal(pool.Name)) Expect(poolMembership.Pool.Runtime).To(Equal(pool.Runtime)) Expect(poolMembership.Pool.Status).To(Equal(suite.App().QueryKeeper.GetPoolStatus(suite.Ctx(), &pool, &fundingState))) diff --git a/x/bundles/keeper/keeper_suite_dropped_bundles_test.go b/x/bundles/keeper/keeper_suite_dropped_bundles_test.go index f3a2db01..07e95a50 100644 --- a/x/bundles/keeper/keeper_suite_dropped_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_dropped_bundles_test.go @@ -193,7 +193,7 @@ var _ = Describe("dropped bundles", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100 * i.KYVE)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100 * i.KYVE)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) }) diff --git a/x/bundles/keeper/keeper_suite_funding_bundles_test.go b/x/bundles/keeper/keeper_suite_funding_bundles_test.go index d014456a..25bf36e7 100644 --- a/x/bundles/keeper/keeper_suite_funding_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_funding_bundles_test.go @@ -137,7 +137,7 @@ var _ = Describe("funding bundles", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(90 * i.KYVE)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(90 * i.KYVE)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) funding, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) @@ -216,7 +216,7 @@ var _ = Describe("funding bundles", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(180 * i.KYVE)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(180 * i.KYVE)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(2)) fundingAlice, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) @@ -301,7 +301,7 @@ var _ = Describe("funding bundles", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(180 * i.KYVE)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(180 * i.KYVE)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(2)) fundingAlice, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) @@ -386,7 +386,7 @@ var _ = Describe("funding bundles", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(50 * i.KYVE)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(50 * i.KYVE)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.BOB)) @@ -465,7 +465,7 @@ var _ = Describe("funding bundles", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(0 * i.KYVE)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(0 * i.KYVE)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(0)) fundingAlice, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) @@ -506,7 +506,7 @@ var _ = Describe("funding bundles", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(0 * i.KYVE)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(0 * i.KYVE)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(0)) s.CommitAfterSeconds(60) @@ -536,7 +536,7 @@ var _ = Describe("funding bundles", Ordered, func() { fundingState, _ = s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(0 * i.KYVE)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(0 * i.KYVE)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(0)) }) }) diff --git a/x/bundles/keeper/keeper_suite_inflation_splitting_test.go b/x/bundles/keeper/keeper_suite_inflation_splitting_test.go index 0d74148b..95b44312 100644 --- a/x/bundles/keeper/keeper_suite_inflation_splitting_test.go +++ b/x/bundles/keeper/keeper_suite_inflation_splitting_test.go @@ -167,7 +167,7 @@ var _ = Describe("inflation splitting", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(BeZero()) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(BeZero()) Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) }) @@ -252,7 +252,7 @@ var _ = Describe("inflation splitting", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(BeZero()) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(BeZero()) Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) }) @@ -337,7 +337,7 @@ var _ = Describe("inflation splitting", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(BeZero()) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(BeZero()) Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) }) @@ -435,7 +435,7 @@ var _ = Describe("inflation splitting", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(200*i.KYVE - 10_000)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(200*i.KYVE - 10_000)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(2)) }) @@ -534,7 +534,7 @@ var _ = Describe("inflation splitting", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(200*i.KYVE - 10_000)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(200*i.KYVE - 10_000)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(2)) }) @@ -633,7 +633,7 @@ var _ = Describe("inflation splitting", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(200*i.KYVE - 10_000)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(200*i.KYVE - 10_000)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(2)) }) @@ -730,7 +730,7 @@ var _ = Describe("inflation splitting", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(BeZero()) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(BeZero()) Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) }) @@ -829,7 +829,7 @@ var _ = Describe("inflation splitting", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(BeZero()) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(BeZero()) Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) }) @@ -928,7 +928,7 @@ var _ = Describe("inflation splitting", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(BeZero()) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(BeZero()) Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) }) @@ -1025,7 +1025,7 @@ var _ = Describe("inflation splitting", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 5_000)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100*i.KYVE - 5_000)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) @@ -1124,7 +1124,7 @@ var _ = Describe("inflation splitting", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 5_000)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100*i.KYVE - 5_000)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) @@ -1223,7 +1223,7 @@ var _ = Describe("inflation splitting", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 5_000)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100*i.KYVE - 5_000)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) }) diff --git a/x/bundles/keeper/keeper_suite_invalid_bundles_test.go b/x/bundles/keeper/keeper_suite_invalid_bundles_test.go index 50c2398f..7902be46 100644 --- a/x/bundles/keeper/keeper_suite_invalid_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_invalid_bundles_test.go @@ -229,7 +229,7 @@ var _ = Describe("invalid bundles", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100 * i.KYVE)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100 * i.KYVE)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) @@ -374,7 +374,7 @@ var _ = Describe("invalid bundles", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100 * i.KYVE)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100 * i.KYVE)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) @@ -566,7 +566,7 @@ var _ = Describe("invalid bundles", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100 * i.KYVE)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100 * i.KYVE)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) }) diff --git a/x/bundles/keeper/keeper_suite_valid_bundles_test.go b/x/bundles/keeper/keeper_suite_valid_bundles_test.go index 411b290c..5c812820 100644 --- a/x/bundles/keeper/keeper_suite_valid_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_valid_bundles_test.go @@ -215,7 +215,7 @@ var _ = Describe("valid bundles", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 1*amountPerBundle)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100*i.KYVE - 1*amountPerBundle)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) @@ -339,7 +339,7 @@ var _ = Describe("valid bundles", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 1*amountPerBundle)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100*i.KYVE - 1*amountPerBundle)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) @@ -484,7 +484,7 @@ var _ = Describe("valid bundles", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 1*amountPerBundle)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100*i.KYVE - 1*amountPerBundle)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) @@ -656,7 +656,7 @@ var _ = Describe("valid bundles", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 1*amountPerBundle)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100*i.KYVE - 1*amountPerBundle)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) @@ -813,7 +813,7 @@ var _ = Describe("valid bundles", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 1*amountPerBundle)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100*i.KYVE - 1*amountPerBundle)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) @@ -978,7 +978,7 @@ var _ = Describe("valid bundles", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 1*amountPerBundle)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100*i.KYVE - 1*amountPerBundle)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) @@ -1153,7 +1153,7 @@ var _ = Describe("valid bundles", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 1*amountPerBundle)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100*i.KYVE - 1*amountPerBundle)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) }) diff --git a/x/bundles/keeper/keeper_suite_zero_delegation_test.go b/x/bundles/keeper/keeper_suite_zero_delegation_test.go index f6f309c9..aba2c552 100644 --- a/x/bundles/keeper/keeper_suite_zero_delegation_test.go +++ b/x/bundles/keeper/keeper_suite_zero_delegation_test.go @@ -420,7 +420,7 @@ var _ = Describe("zero delegation", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 1*amountPerBundle)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100*i.KYVE - 1*amountPerBundle)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) @@ -572,7 +572,7 @@ var _ = Describe("zero delegation", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100 * i.KYVE)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100 * i.KYVE)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) @@ -802,7 +802,7 @@ var _ = Describe("zero delegation", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100 * i.KYVE)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100 * i.KYVE)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) }) diff --git a/x/delegation/keeper/keeper_suite_test.go b/x/delegation/keeper/keeper_suite_test.go index e7130b99..392e2468 100644 --- a/x/delegation/keeper/keeper_suite_test.go +++ b/x/delegation/keeper/keeper_suite_test.go @@ -75,7 +75,7 @@ func CreateFundedPool(s *i.KeeperTestSuite) { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(fundingState.TotalAmount).To(Equal(100 * i.KYVE)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100 * i.KYVE)) } func CheckAndContinueChainForOneMonth(s *i.KeeperTestSuite) { diff --git a/x/funders/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go index e464a48f..c33e9bdc 100644 --- a/x/funders/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -17,11 +17,22 @@ func (k Keeper) CreateFundingState(ctx sdk.Context, poolId uint64) { fundingState := types.FundingState{ PoolId: poolId, ActiveFunderAddresses: []string{}, - TotalAmount: 0, } k.SetFundingState(ctx, &fundingState) } +func (k Keeper) GetTotalActiveFunding(ctx sdk.Context, poolId uint64) (amount uint64) { + state, found := k.GetFundingState(ctx, poolId) + if !found { + return 0 + } + for _, address := range state.ActiveFunderAddresses { + funding, _ := k.GetFunding(ctx, address, poolId) + amount += funding.Amount + } + return amount +} + // ChargeFundersOfPool charges all funders of a pool with their amount_per_bundle // If the amount is lower than the amount_per_bundle, // the max amount is charged and the funder is removed from the active funders list. @@ -49,7 +60,6 @@ func (k Keeper) ChargeFundersOfPool(ctx sdk.Context, poolId uint64) (payout uint } k.SetFunding(ctx, &funding) } - fundingState.SubtractAmount(payout) // Save funding state k.SetFundingState(ctx, &fundingState) diff --git a/x/funders/keeper/logic_funders_test.go b/x/funders/keeper/logic_funders_test.go index 2b57091a..b2bf876c 100644 --- a/x/funders/keeper/logic_funders_test.go +++ b/x/funders/keeper/logic_funders_test.go @@ -105,7 +105,6 @@ var _ = Describe("logic_funders.go", Ordered, func() { // ASSERT fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(fundingState.TotalAmount).To(Equal(95 * i.KYVE)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.ALICE)) @@ -167,7 +166,6 @@ var _ = Describe("logic_funders.go", Ordered, func() { // ASSERT fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(fundingState.TotalAmount).To(Equal(40 * i.KYVE)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.BOB)) diff --git a/x/funders/keeper/msg_server_defund_pool.go b/x/funders/keeper/msg_server_defund_pool.go index 4a696d84..060711a7 100644 --- a/x/funders/keeper/msg_server_defund_pool.go +++ b/x/funders/keeper/msg_server_defund_pool.go @@ -42,7 +42,6 @@ func (k msgServer) DefundPool(goCtx context.Context, msg *types.MsgDefundPool) ( if funding.Amount == 0 { fundingState.SetInactive(&funding) } - fundingState.TotalAmount -= amount // Transfer tokens from this module to sender. if err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, types.ModuleName, msg.Creator, amount); err != nil { diff --git a/x/funders/keeper/msg_server_defund_pool_test.go b/x/funders/keeper/msg_server_defund_pool_test.go index 3a04bd8c..9bc5a204 100644 --- a/x/funders/keeper/msg_server_defund_pool_test.go +++ b/x/funders/keeper/msg_server_defund_pool_test.go @@ -88,7 +88,6 @@ var _ = Describe("msg_server_defund_pool.go", Ordered, func() { Expect(funding.TotalFunded).To(Equal(0 * i.KYVE)) fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(fundingState.TotalAmount).To(Equal(50 * i.KYVE)) Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(1)) Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.ALICE)) }) @@ -111,7 +110,6 @@ var _ = Describe("msg_server_defund_pool.go", Ordered, func() { Expect(funding.TotalFunded).To(Equal(0 * i.KYVE)) fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(fundingState.TotalAmount).To(Equal(0 * i.KYVE)) Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(0)) }) @@ -133,7 +131,6 @@ var _ = Describe("msg_server_defund_pool.go", Ordered, func() { Expect(funding.TotalFunded).To(Equal(0 * i.KYVE)) fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(fundingState.TotalAmount).To(Equal(0 * i.KYVE)) Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(0)) }) diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go index db8614b6..f473c136 100644 --- a/x/funders/keeper/msg_server_fund_pool.go +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -22,7 +22,6 @@ func (k msgServer) defundLowestFunding( } subtracted := lowestFunding.SubtractAmount(lowestFunding.Amount) - fundingState.SubtractAmount(subtracted) fundingState.SetInactive(lowestFunding) k.SetFunding(ctx, lowestFunding) @@ -80,7 +79,6 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ TotalFunded: 0, } } - fundingState.AddAmount(msg.Amount) params := k.GetParams(ctx) if funding.AmountPerBundle < params.MinFundingAmountPerBundle { diff --git a/x/funders/keeper/msg_server_fund_pool_test.go b/x/funders/keeper/msg_server_fund_pool_test.go index f9f10473..50a44e19 100644 --- a/x/funders/keeper/msg_server_fund_pool_test.go +++ b/x/funders/keeper/msg_server_fund_pool_test.go @@ -96,7 +96,6 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { Expect(fundingState.PoolId).To(Equal(uint64(0))) Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(1)) Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.ALICE)) - Expect(fundingState.TotalAmount).To(Equal(100 * i.KYVE)) }) It("Fund additional 50 $KYVE to an existing funding with 100 $KYVE", func() { @@ -131,7 +130,6 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { Expect(fundingState.PoolId).To(Equal(uint64(0))) Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(1)) Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.ALICE)) - Expect(fundingState.TotalAmount).To(Equal(150 * i.KYVE)) activeFundings := s.App().FundersKeeper.GetActiveFundings(s.Ctx(), fundingState) lowestFunding, err := s.App().FundersKeeper.GetLowestFunding(activeFundings) @@ -160,7 +158,6 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) Expect(fundingState.PoolId).To(Equal(uint64(0))) Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(0)) - Expect(fundingState.TotalAmount).To(Equal(uint64(0))) }) It("Fund with a new funder less $KYVE than the existing one", func() { @@ -192,7 +189,6 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) Expect(fundingState.PoolId).To(Equal(uint64(0))) Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(2)) - Expect(fundingState.TotalAmount).To(Equal(150 * i.KYVE)) activeFundings := s.App().FundersKeeper.GetActiveFundings(s.Ctx(), fundingState) lowestFunding, err := s.App().FundersKeeper.GetLowestFunding(activeFundings) @@ -229,7 +225,6 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) Expect(fundingState.PoolId).To(Equal(uint64(0))) Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(2)) - Expect(fundingState.TotalAmount).To(Equal(300 * i.KYVE)) activeFundings := s.App().FundersKeeper.GetActiveFundings(s.Ctx(), fundingState) lowestFunding, err := s.App().FundersKeeper.GetLowestFunding(activeFundings) @@ -269,11 +264,9 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { AmountPerBundle: 1 * i.KYVE, }) } - totalFunded := (funderstypes.MaxFunders-1)*1000*i.KYVE + 100*i.KYVE fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(funderstypes.MaxFunders)) - Expect(fundingState.TotalAmount).To(Equal(totalFunded)) balanceAfter := s.GetBalanceFromAddress(i.ALICE) Expect(initialBalance - balanceAfter).To(Equal(100 * i.KYVE)) @@ -289,7 +282,6 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { // ASSERT fundingState, _ = s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(funderstypes.MaxFunders)) - Expect(fundingState.TotalAmount).To(Equal(totalFunded)) activeFundings := s.App().FundersKeeper.GetActiveFundings(s.Ctx(), fundingState) Expect(activeFundings).To(HaveLen(50)) @@ -334,10 +326,8 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { x := s.GetBalanceFromAddress(i.BOB) Expect(initialBalanceBob - x).To(Equal(200 * i.KYVE)) // ASSERT - totalFunded := (funderstypes.MaxFunders-1)*1000*i.KYVE + 200*i.KYVE fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(funderstypes.MaxFunders)) - Expect(fundingState.TotalAmount).To(Equal(totalFunded)) activeFundings := s.App().FundersKeeper.GetActiveFundings(s.Ctx(), fundingState) Expect(activeFundings).To(HaveLen(50)) @@ -374,10 +364,8 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { AmountPerBundle: 1 * i.KYVE, }) } - totalFunded := (funderstypes.MaxFunders-1)*1000*i.KYVE + 100*i.KYVE fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) - Expect(totalFunded).To(Equal(fundingState.TotalAmount)) activeFundings := s.App().FundersKeeper.GetActiveFundings(s.Ctx(), fundingState) Expect(activeFundings).To(HaveLen(50)) lowestFunding, err := s.App().FundersKeeper.GetLowestFunding(activeFundings) @@ -395,7 +383,6 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { // ASSERT fundingState, _ = s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) Expect(len(fundingState.ActiveFunderAddresses)).To(Equal(funderstypes.MaxFunders)) - Expect(fundingState.TotalAmount).To(Equal(totalFunded + 50*i.KYVE)) balanceEnd := s.GetBalanceFromAddress(i.ALICE) Expect(initialBalance - balanceEnd).To(Equal(150 * i.KYVE)) diff --git a/x/funders/types/funders.go b/x/funders/types/funders.go index d3791c0a..8431a82f 100644 --- a/x/funders/types/funders.go +++ b/x/funders/types/funders.go @@ -19,19 +19,6 @@ func (f *Funding) ChargeOneBundle() (amount uint64) { return amount } -func (fs *FundingState) AddAmount(amount uint64) { - fs.TotalAmount += amount -} - -func (fs *FundingState) SubtractAmount(amount uint64) (subtracted uint64) { - subtracted = amount - if fs.TotalAmount < amount { - subtracted = fs.TotalAmount - } - fs.TotalAmount -= subtracted - return subtracted -} - // SetInactive removes a funding from active fundings func (fs *FundingState) SetInactive(funding *Funding) { for i, funderAddress := range fs.ActiveFunderAddresses { diff --git a/x/funders/types/funders.pb.go b/x/funders/types/funders.pb.go index e47ea8a4..1748443e 100644 --- a/x/funders/types/funders.pb.go +++ b/x/funders/types/funders.pb.go @@ -204,8 +204,6 @@ type FundingState struct { PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` // active_funder_addresses is the list of all active fundings ActiveFunderAddresses []string `protobuf:"bytes,2,rep,name=active_funder_addresses,json=activeFunderAddresses,proto3" json:"active_funder_addresses,omitempty"` - // total_amount is the total amount of funds in ukyve the pool has from all fundings - TotalAmount uint64 `protobuf:"varint,3,opt,name=total_amount,json=totalAmount,proto3" json:"total_amount,omitempty"` } func (m *FundingState) Reset() { *m = FundingState{} } @@ -255,13 +253,6 @@ func (m *FundingState) GetActiveFunderAddresses() []string { return nil } -func (m *FundingState) GetTotalAmount() uint64 { - if m != nil { - return m.TotalAmount - } - return 0 -} - func init() { proto.RegisterType((*Funder)(nil), "kyve.funders.v1beta1.Funder") proto.RegisterType((*Funding)(nil), "kyve.funders.v1beta1.Funding") @@ -273,32 +264,32 @@ func init() { } var fileDescriptor_252d80f89b0fa299 = []byte{ - // 397 bytes of a gzipped FileDescriptorProto + // 386 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x92, 0xd1, 0x8a, 0xd3, 0x40, 0x14, 0x86, 0x3b, 0xbb, 0x31, 0x75, 0x67, 0x57, 0x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marshal() (dAtA []byte, err error) { @@ -436,11 +427,6 @@ func (m *FundingState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.TotalAmount != 0 { - i = encodeVarintFunders(dAtA, i, uint64(m.TotalAmount)) - i-- - dAtA[i] = 0x18 - } if len(m.ActiveFunderAddresses) > 0 { for iNdEx := len(m.ActiveFunderAddresses) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.ActiveFunderAddresses[iNdEx]) @@ -542,9 +528,6 @@ func (m *FundingState) Size() (n int) { n += 1 + l + sovFunders(uint64(l)) } } - if m.TotalAmount != 0 { - n += 1 + sovFunders(uint64(m.TotalAmount)) - } return n } @@ -1034,25 +1017,6 @@ func (m *FundingState) Unmarshal(dAtA []byte) error { } m.ActiveFunderAddresses = append(m.ActiveFunderAddresses, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalAmount", wireType) - } - m.TotalAmount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFunders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalAmount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipFunders(dAtA[iNdEx:]) diff --git a/x/funders/types/funders_test.go b/x/funders/types/funders_test.go index e3cdaeb9..47763b61 100644 --- a/x/funders/types/funders_test.go +++ b/x/funders/types/funders_test.go @@ -16,9 +16,6 @@ TEST CASES - funders.go * Funding.SubtractAmount - subtract more than available * Funding.ChargeOneBundle * Funding.ChargeOneBundle - charge more than available -* FundintState.AddAmount -* FundintState.SubtractAmount -* FundintState.SubtractAmount - subtract more than available * FundintState.SetActive * FundintState.SetActive - add same funder twice * FundintState.SetInactive @@ -41,7 +38,6 @@ var _ = Describe("logic_funders.go", Ordered, func() { fundingState = types.FundingState{ PoolId: 0, ActiveFunderAddresses: []string{i.ALICE, i.BOB}, - TotalAmount: 100 * i.KYVE, } }) @@ -95,32 +91,6 @@ var _ = Describe("logic_funders.go", Ordered, func() { Expect(funding.TotalFunded).To(Equal(1 * i.KYVE / 2)) }) - It("FundintState.AddAmount", func() { - // ACT - fundingState.AddAmount(100 * i.KYVE) - - // ASSERT - Expect(fundingState.TotalAmount).To(Equal(200 * i.KYVE)) - }) - - It("FundintState.SubtractAmount", func() { - // ACT - subtracted := fundingState.SubtractAmount(50 * i.KYVE) - - // ASSERT - Expect(subtracted).To(Equal(50 * i.KYVE)) - Expect(fundingState.TotalAmount).To(Equal(50 * i.KYVE)) - }) - - It("FundintState.SubtractAmount - subtract more than available", func() { - // ACT - subtracted := fundingState.SubtractAmount(200 * i.KYVE) - - // ASSERT - Expect(subtracted).To(Equal(100 * i.KYVE)) - Expect(fundingState.TotalAmount).To(Equal(uint64(0))) - }) - It("FundintState.SetActive", func() { // ARRANGE fundingState.ActiveFunderAddresses = []string{} diff --git a/x/pool/keeper/msg_server_create_pool_test.go b/x/pool/keeper/msg_server_create_pool_test.go index a82e665b..22a4a0b1 100644 --- a/x/pool/keeper/msg_server_create_pool_test.go +++ b/x/pool/keeper/msg_server_create_pool_test.go @@ -164,7 +164,6 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { Expect(fundingState).To(Equal(funderstypes.FundingState{ PoolId: 0, ActiveFunderAddresses: nil, - TotalAmount: 0, })) }) @@ -272,7 +271,6 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { Expect(fundingState).To(Equal(funderstypes.FundingState{ PoolId: 1, ActiveFunderAddresses: nil, - TotalAmount: 0, })) }) diff --git a/x/query/keeper/grpc_account_funded.go b/x/query/keeper/grpc_account_funded.go index 5ffe02ee..944fe834 100644 --- a/x/query/keeper/grpc_account_funded.go +++ b/x/query/keeper/grpc_account_funded.go @@ -39,7 +39,7 @@ func (k Keeper) AccountFundedList(goCtx context.Context, req *types.QueryAccount Logo: pool.Logo, InflationShareWeight: pool.InflationShareWeight, UploadInterval: pool.UploadInterval, - TotalFunds: fundingState.TotalAmount, + TotalFunds: k.fundersKeeper.GetTotalActiveFunding(ctx, pool.Id), TotalDelegation: k.delegationKeeper.GetDelegationOfPool(ctx, pool.Id), Status: k.GetPoolStatus(ctx, &pool, &fundingState), }, diff --git a/x/query/keeper/helper.go b/x/query/keeper/helper.go index 4558f999..033b8b0d 100644 --- a/x/query/keeper/helper.go +++ b/x/query/keeper/helper.go @@ -52,7 +52,7 @@ func (k Keeper) GetFullStaker(ctx sdk.Context, stakerAddress string) *types.Full Logo: pool.Logo, InflationShareWeight: pool.InflationShareWeight, UploadInterval: pool.UploadInterval, - TotalFunds: fundingState.TotalAmount, + TotalFunds: k.fundersKeeper.GetTotalActiveFunding(ctx, pool.Id), TotalDelegation: k.delegationKeeper.GetDelegationOfPool(ctx, pool.Id), Status: k.GetPoolStatus(ctx, &pool, &fundingState), }, @@ -96,12 +96,7 @@ func (k Keeper) GetPoolStatus(ctx sdk.Context, pool *pooltypes.Pool, fundingStat } else if totalDelegation < pool.MinDelegation { poolStatus = pooltypes.POOL_STATUS_NOT_ENOUGH_DELEGATION } else { - // Get funding state if not provided - if fundingState == nil { - fs, _ := k.fundersKeeper.GetFundingState(ctx, pool.Id) - fundingState = &fs - } - if fundingState.TotalAmount == 0 { + if k.fundersKeeper.GetTotalActiveFunding(ctx, pool.Id) == 0 { poolStatus = pooltypes.POOL_STATUS_NO_FUNDS } } diff --git a/x/stakers/keeper/msg_server_claim_commission_rewards_test.go b/x/stakers/keeper/msg_server_claim_commission_rewards_test.go index f014e914..d0224c6c 100644 --- a/x/stakers/keeper/msg_server_claim_commission_rewards_test.go +++ b/x/stakers/keeper/msg_server_claim_commission_rewards_test.go @@ -162,7 +162,7 @@ var _ = Describe("msg_server_claim_commission_rewards.go", Ordered, func() { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) // assert total pool funds - Expect(fundingState.TotalAmount).To(Equal(100*i.KYVE - 10_000)) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(100*i.KYVE - 10_000)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) From 8ebc46ee66951a086a127033b929755a3f3bb1a3 Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Thu, 26 Oct 2023 11:04:30 +0200 Subject: [PATCH 087/109] chore: resolve TODOs --- .../keeper/msg_server_create_funder_test.go | 17 ----------------- x/stakers/keeper/exported_functions_test.go | 1 - 2 files changed, 18 deletions(-) diff --git a/x/funders/keeper/msg_server_create_funder_test.go b/x/funders/keeper/msg_server_create_funder_test.go index 2f32103a..f06308fe 100644 --- a/x/funders/keeper/msg_server_create_funder_test.go +++ b/x/funders/keeper/msg_server_create_funder_test.go @@ -16,7 +16,6 @@ TEST CASES - msg_server_create_funder.go * Create a funder with empty values except moniker * Create a funder with all values set * Try to create a funder that already exists -* Create two funders with the same moniker // TODO: should this be allowed? * Create two funders */ @@ -94,22 +93,6 @@ var _ = Describe("msg_server_create_funder.go", Ordered, func() { }) }) - // TODO: should this be allowed? - PIt("Create two funders with the same moniker", func() { - // ARRANGE - moniker := "moniker" - s.RunTxFundersSuccess(&types.MsgCreateFunder{ - Creator: i.ALICE, - Moniker: moniker, - }) - - // ACT - s.RunTxFundersError(&types.MsgCreateFunder{ - Creator: i.BOB, - Moniker: moniker, - }) - }) - It("Create two funders", func() { // ARRANGE s.RunTxFundersSuccess(&types.MsgCreateFunder{ diff --git a/x/stakers/keeper/exported_functions_test.go b/x/stakers/keeper/exported_functions_test.go index f7af1e17..bb37ab92 100644 --- a/x/stakers/keeper/exported_functions_test.go +++ b/x/stakers/keeper/exported_functions_test.go @@ -38,7 +38,6 @@ var _ = Describe("Protocol Governance Voting", Ordered, func() { parsedAliceAddr := sdk.MustAccAddressFromBech32(i.ALICE) parsedBobAddr := sdk.MustAccAddressFromBech32(i.BOB) - // TODO(postAudit,@john): Think about randomly generating these values. validatorAmount := 500 * i.KYVE delegatorAmount := 250 * i.KYVE From 85f7e528566c097fffa5247dc2473fc65cd7c82a Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 26 Oct 2023 14:44:41 +0200 Subject: [PATCH 088/109] Rapha/funders module migration (#130) Co-authored-by: mbreithecker --- app/app.go | 4 + app/upgrades/v1_4/upgrade.go | 163 +- app/upgrades/v1_4/v1_3_types/getters_pool.go | 29 + app/upgrades/v1_4/v1_3_types/pool.pb.go | 2120 +++++++++++++++++ proto/kyve/pool/v1beta1/pool.proto | 11 +- x/funders/client/cli/tx.go | 1 + x/funders/keeper/msg_server_create_funder.go | 1 - .../msg_server_cancel_runtime_upgrade_test.go | 8 +- ...sg_server_schedule_runtime_upgrade_test.go | 26 +- x/pool/types/pool.pb.go | 121 +- x/query/client/cli/query_funders.go | 1 + x/query/client/cli/query_fundings.go | 3 +- x/query/keeper/grpc_query_fundings.go | 1 + 13 files changed, 2399 insertions(+), 90 deletions(-) create mode 100644 app/upgrades/v1_4/v1_3_types/getters_pool.go create mode 100644 app/upgrades/v1_4/v1_3_types/pool.pb.go diff --git a/app/app.go b/app/app.go index 60df660f..0ed558bb 100644 --- a/app/app.go +++ b/app/app.go @@ -911,6 +911,10 @@ func NewKYVEApp( *app.GovKeeper, *app.IBCKeeper, app.ParamsKeeper, + app.PoolKeeper, + app.FundersKeeper, + app.BankKeeper, + app.AccountKeeper, ), ) diff --git a/app/upgrades/v1_4/upgrade.go b/app/upgrades/v1_4/upgrade.go index 78d3bdbd..d472c171 100644 --- a/app/upgrades/v1_4/upgrade.go +++ b/app/upgrades/v1_4/upgrade.go @@ -1,11 +1,22 @@ package v1_4 import ( + "errors" + + "github.com/KYVENetwork/chain/app/upgrades/v1_4/v1_3_types" + "github.com/KYVENetwork/chain/util" + fundersKeeper "github.com/KYVENetwork/chain/x/funders/keeper" + fundersTypes "github.com/KYVENetwork/chain/x/funders/types" + globalTypes "github.com/KYVENetwork/chain/x/global/types" + poolKeeper "github.com/KYVENetwork/chain/x/pool/keeper" + poolTypes "github.com/KYVENetwork/chain/x/pool/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + authKeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authTypes "github.com/cosmos/cosmos-sdk/x/auth/types" + bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" bankTypes "github.com/cosmos/cosmos-sdk/x/bank/types" crisisTypes "github.com/cosmos/cosmos-sdk/x/crisis/types" distributionTypes "github.com/cosmos/cosmos-sdk/x/distribution/types" @@ -17,18 +28,12 @@ import ( "github.com/cosmos/ibc-go/v7/modules/core/exported" ibcTmMigrations "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint/migrations" - // Consensus - consensusKeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" - // Global globalKeeper "github.com/KYVENetwork/chain/x/global/keeper" - // Governance + consensusKeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" govKeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" - // IBC Core ibcKeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - // Params paramsKeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" - // Upgrade upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) @@ -43,6 +48,10 @@ func CreateUpgradeHandler( govKeeper govKeeper.Keeper, ibcKeeper ibcKeeper.Keeper, paramsKeeper paramsKeeper.Keeper, + poolKeeper poolKeeper.Keeper, + fundersKeeper fundersKeeper.Keeper, + bankKeeper bankKeeper.Keeper, + accountKeeper authKeeper.AccountKeeper, ) upgradeTypes.UpgradeHandler { return func(ctx sdk.Context, _ upgradeTypes.Plan, vm module.VersionMap) (module.VersionMap, error) { logger := ctx.Logger().With("upgrade", UpgradeName) @@ -103,6 +112,20 @@ func CreateUpgradeHandler( return vm, err } + // Migrate funders. + err = migrateFundersAndPools(ctx, cdc, poolKeeper, fundersKeeper, bankKeeper, accountKeeper) + if err != nil { + return vm, err + } + + // Set min gas for funder creation in global module + globalParams := globalKeeper.GetParams(ctx) + globalParams.GasAdjustments = append(globalParams.GasAdjustments, globalTypes.GasAdjustment{ + Type: "/kyve.funders.v1beta1.MsgCreateFunder", + Amount: 50_000_000, + }) + globalKeeper.SetParams(ctx, globalParams) + return vm, nil } } @@ -121,3 +144,129 @@ func migrateInitialDepositRatio( return govKeeper.SetParams(ctx, params) } + +type FundingMigration struct { + PoolId uint64 + Amount uint64 +} + +type FunderMigration struct { + Address string + Fundings []FundingMigration +} + +// migrateFunders migrates funders from x/pool to x/funders and creates funding states for pools. +func migrateFundersAndPools( + ctx sdk.Context, + cdc codec.BinaryCodec, + poolKeeper poolKeeper.Keeper, + fundersKeeper fundersKeeper.Keeper, + bankKeeper bankKeeper.Keeper, + accountKeeper authKeeper.AccountKeeper, +) error { + pools, err := v1_3_types.GetAllPools(ctx, poolKeeper, cdc) + if err != nil { + return err + } + + toBeCreatedFunders := make(map[string]*FunderMigration) + amountToBeTransferred := uint64(0) + + // Get all funders and their funding from pools. + for _, oldPool := range pools { + checkTotalFunds := uint64(0) + for _, funder := range oldPool.Funders { + if funder.Amount > 0 { + _, ok := toBeCreatedFunders[funder.Address] + if ok { + toBeCreatedFunders[funder.Address].Fundings = append(toBeCreatedFunders[funder.Address].Fundings, FundingMigration{PoolId: oldPool.Id, Amount: funder.Amount}) + } else { + toBeCreatedFunders[funder.Address] = &FunderMigration{ + Address: funder.Address, + Fundings: []FundingMigration{{PoolId: oldPool.Id, Amount: funder.Amount}}, + } + } + checkTotalFunds += funder.Amount + } + } + if checkTotalFunds != oldPool.TotalFunds { + return errors.New("total funds is not equal to the sum of all funders amount") + } + amountToBeTransferred += oldPool.TotalFunds + + // Create funding state for pool. + fundersKeeper.SetFundingState(ctx, &fundersTypes.FundingState{ + PoolId: oldPool.Id, + ActiveFunderAddresses: []string{}, + TotalAmount: oldPool.TotalFunds, + }) + + poolKeeper.SetPool(ctx, poolTypes.Pool{ + Id: oldPool.Id, + Name: oldPool.Name, + Runtime: oldPool.Runtime, + Logo: oldPool.Logo, + Config: oldPool.Config, + StartKey: oldPool.StartKey, + CurrentKey: oldPool.CurrentKey, + CurrentSummary: oldPool.CurrentSummary, + CurrentIndex: oldPool.CurrentIndex, + TotalBundles: oldPool.TotalBundles, + UploadInterval: oldPool.UploadInterval, + InflationShareWeight: oldPool.OperatingCost, + MinDelegation: oldPool.MinDelegation, + MaxBundleSize: oldPool.MaxBundleSize, + Disabled: oldPool.Disabled, + Protocol: &poolTypes.Protocol{ + Version: oldPool.Protocol.Version, + Binaries: oldPool.Protocol.Binaries, + LastUpgrade: oldPool.Protocol.LastUpgrade, + }, + UpgradePlan: &poolTypes.UpgradePlan{ + Version: oldPool.UpgradePlan.Version, + Binaries: oldPool.UpgradePlan.Binaries, + ScheduledAt: oldPool.UpgradePlan.ScheduledAt, + Duration: oldPool.UpgradePlan.Duration, + }, + CurrentStorageProviderId: oldPool.CurrentStorageProviderId, + CurrentCompressionId: oldPool.CurrentCompressionId, + }) + } + + // Create new funders and fundings. + for _, funder := range toBeCreatedFunders { + fundersKeeper.SetFunder(ctx, &fundersTypes.Funder{ + Address: funder.Address, + Moniker: funder.Address, + Identity: "", + Website: "", + Contact: "", + Description: "", + }) + for _, funding := range funder.Fundings { + fundersKeeper.SetFunding(ctx, &fundersTypes.Funding{ + FunderAddress: funder.Address, + PoolId: funding.PoolId, + Amount: funding.Amount, + AmountPerBundle: fundersTypes.DefaultMinFundingAmountPerBundle, + // Previous funders will not be considered, as there is no way to calculate this on chain. + // Although almost all funding was only provided by the Foundation itself. + TotalFunded: 0, + }) + } + } + + // Check if pool module balance is equal to the sum of all pools total funds. + poolModule := accountKeeper.GetModuleAddress(poolTypes.ModuleName) + balance := bankKeeper.GetBalance(ctx, poolModule, globalTypes.Denom) + if balance.Amount.Uint64() != amountToBeTransferred { + return errors.New("pool module balance is not equal to the sum of all pools total funds") + } + + // Transfer funds from pools to funders. + if err := util.TransferFromModuleToModule(bankKeeper, ctx, poolTypes.ModuleName, fundersTypes.ModuleName, amountToBeTransferred); err != nil { + return err + } + + return nil +} diff --git a/app/upgrades/v1_4/v1_3_types/getters_pool.go b/app/upgrades/v1_4/v1_3_types/getters_pool.go new file mode 100644 index 00000000..80d31ff7 --- /dev/null +++ b/app/upgrades/v1_4/v1_3_types/getters_pool.go @@ -0,0 +1,29 @@ +package v1_3_types + +import ( + poolKeeper "github.com/KYVENetwork/chain/x/pool/keeper" + "github.com/KYVENetwork/chain/x/pool/types" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetAllPools returns all pools +func GetAllPools(ctx sdk.Context, poolKeeper poolKeeper.Keeper, cdc codec.BinaryCodec) (list []Pool, err error) { + store := prefix.NewStore(ctx.KVStore(poolKeeper.StoreKey()), types.PoolKey) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + //goland:noinspection GoUnhandledErrorResult + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val Pool + err = cdc.Unmarshal(iterator.Value(), &val) + if err != nil { + return + } + list = append(list, val) + } + + return +} diff --git a/app/upgrades/v1_4/v1_3_types/pool.pb.go b/app/upgrades/v1_4/v1_3_types/pool.pb.go new file mode 100644 index 00000000..f2a5536f --- /dev/null +++ b/app/upgrades/v1_4/v1_3_types/pool.pb.go @@ -0,0 +1,2120 @@ +package v1_3_types + +import ( + "fmt" + "io" +) + +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/pool/v1beta1/pool.proto + +import ( + math "math" + math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// PoolStatus ... +type PoolStatus int32 + +const ( + // POOL_STATUS_UNSPECIFIED ... + POOL_STATUS_UNSPECIFIED PoolStatus = 0 + // POOL_STATUS_ACTIVE ... + POOL_STATUS_ACTIVE PoolStatus = 1 + // POOL_STATUS_DISABLED ... + POOL_STATUS_DISABLED PoolStatus = 2 + // POOL_STATUS_NO_FUNDS ... + POOL_STATUS_NO_FUNDS PoolStatus = 3 + // POOL_STATUS_NOT_ENOUGH_DELEGATION ... + POOL_STATUS_NOT_ENOUGH_DELEGATION PoolStatus = 4 + // POOL_STATUS_UPGRADING ... + POOL_STATUS_UPGRADING PoolStatus = 5 +) + +var PoolStatus_name = map[int32]string{ + 0: "POOL_STATUS_UNSPECIFIED", + 1: "POOL_STATUS_ACTIVE", + 2: "POOL_STATUS_DISABLED", + 3: "POOL_STATUS_NO_FUNDS", + 4: "POOL_STATUS_NOT_ENOUGH_DELEGATION", + 5: "POOL_STATUS_UPGRADING", +} + +var PoolStatus_value = map[string]int32{ + "POOL_STATUS_UNSPECIFIED": 0, + "POOL_STATUS_ACTIVE": 1, + "POOL_STATUS_DISABLED": 2, + "POOL_STATUS_NO_FUNDS": 3, + "POOL_STATUS_NOT_ENOUGH_DELEGATION": 4, + "POOL_STATUS_UPGRADING": 5, +} + +func (x PoolStatus) String() string { + return proto.EnumName(PoolStatus_name, int32(x)) +} + +func (PoolStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_40c1730f47ff2ef8, []int{0} +} + +// Protocol holds all info about the current pool version and the +// available binaries for participating as a validator in a pool +type Protocol struct { + // version holds the current software version tag of the pool binaries + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // binaries is a stringified json object which holds binaries in the + // current version for multiple platforms and architectures + Binaries string `protobuf:"bytes,2,opt,name=binaries,proto3" json:"binaries,omitempty"` + // last_upgrade is the unix time the pool was upgraded the last time + LastUpgrade uint64 `protobuf:"varint,3,opt,name=last_upgrade,json=lastUpgrade,proto3" json:"last_upgrade,omitempty"` +} + +func (m *Protocol) Reset() { *m = Protocol{} } +func (m *Protocol) String() string { return proto.CompactTextString(m) } +func (*Protocol) ProtoMessage() {} +func (*Protocol) Descriptor() ([]byte, []int) { + return fileDescriptor_40c1730f47ff2ef8, []int{0} +} + +func (m *Protocol) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *Protocol) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Protocol.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} + +func (m *Protocol) XXX_Merge(src proto.Message) { + xxx_messageInfo_Protocol.Merge(m, src) +} + +func (m *Protocol) XXX_Size() int { + return m.Size() +} + +func (m *Protocol) XXX_DiscardUnknown() { + xxx_messageInfo_Protocol.DiscardUnknown(m) +} + +var xxx_messageInfo_Protocol proto.InternalMessageInfo + +func (m *Protocol) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *Protocol) GetBinaries() string { + if m != nil { + return m.Binaries + } + return "" +} + +func (m *Protocol) GetLastUpgrade() uint64 { + if m != nil { + return m.LastUpgrade + } + return 0 +} + +// Upgrade holds all info when a pool has a scheduled upgrade +type UpgradePlan struct { + // version is the new software version tag of the upgrade + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // binaries is the new stringified json object which holds binaries in the + // upgrade version for multiple platforms and architectures + Binaries string `protobuf:"bytes,2,opt,name=binaries,proto3" json:"binaries,omitempty"` + // scheduled_at is the unix time the upgrade is supposed to be done + ScheduledAt uint64 `protobuf:"varint,3,opt,name=scheduled_at,json=scheduledAt,proto3" json:"scheduled_at,omitempty"` + // duration is the time in seconds how long the pool should halt + // during the upgrade to give all validators a chance of switching + // to the new binaries + Duration uint64 `protobuf:"varint,4,opt,name=duration,proto3" json:"duration,omitempty"` +} + +func (m *UpgradePlan) Reset() { *m = UpgradePlan{} } +func (m *UpgradePlan) String() string { return proto.CompactTextString(m) } +func (*UpgradePlan) ProtoMessage() {} +func (*UpgradePlan) Descriptor() ([]byte, []int) { + return fileDescriptor_40c1730f47ff2ef8, []int{1} +} + +func (m *UpgradePlan) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *UpgradePlan) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpgradePlan.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} + +func (m *UpgradePlan) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpgradePlan.Merge(m, src) +} + +func (m *UpgradePlan) XXX_Size() int { + return m.Size() +} + +func (m *UpgradePlan) XXX_DiscardUnknown() { + xxx_messageInfo_UpgradePlan.DiscardUnknown(m) +} + +var xxx_messageInfo_UpgradePlan proto.InternalMessageInfo + +func (m *UpgradePlan) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *UpgradePlan) GetBinaries() string { + if m != nil { + return m.Binaries + } + return "" +} + +func (m *UpgradePlan) GetScheduledAt() uint64 { + if m != nil { + return m.ScheduledAt + } + return 0 +} + +func (m *UpgradePlan) GetDuration() uint64 { + if m != nil { + return m.Duration + } + return 0 +} + +// Funder is the object which holds info about a single pool funder +type Funder struct { + // address is the address of the funder + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // amount is the current amount of funds in ukyve the funder has + // still funded the pool with + Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *Funder) Reset() { *m = Funder{} } +func (m *Funder) String() string { return proto.CompactTextString(m) } +func (*Funder) ProtoMessage() {} +func (*Funder) Descriptor() ([]byte, []int) { + return fileDescriptor_40c1730f47ff2ef8, []int{2} +} + +func (m *Funder) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *Funder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Funder.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} + +func (m *Funder) XXX_Merge(src proto.Message) { + xxx_messageInfo_Funder.Merge(m, src) +} + +func (m *Funder) XXX_Size() int { + return m.Size() +} + +func (m *Funder) XXX_DiscardUnknown() { + xxx_messageInfo_Funder.DiscardUnknown(m) +} + +var xxx_messageInfo_Funder proto.InternalMessageInfo + +func (m *Funder) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *Funder) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +// Pool ... +type Pool struct { + // id - unique identifier of the pool, can not be changed + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // name is a human readable name for the pool + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // runtime specified which protocol and which version needs is required + Runtime string `protobuf:"bytes,3,opt,name=runtime,proto3" json:"runtime,omitempty"` + // logo is a link to an image file + Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` + // config is either a JSON encoded string or a link to an external storage provider. + // This is up to the implementation of the protocol node. + Config string `protobuf:"bytes,5,opt,name=config,proto3" json:"config,omitempty"` + // start_key ... + StartKey string `protobuf:"bytes,6,opt,name=start_key,json=startKey,proto3" json:"start_key,omitempty"` + // current_key ... + CurrentKey string `protobuf:"bytes,7,opt,name=current_key,json=currentKey,proto3" json:"current_key,omitempty"` + // current_summary ... + CurrentSummary string `protobuf:"bytes,8,opt,name=current_summary,json=currentSummary,proto3" json:"current_summary,omitempty"` + // current_index ... + CurrentIndex uint64 `protobuf:"varint,9,opt,name=current_index,json=currentIndex,proto3" json:"current_index,omitempty"` + // total_bundles is the number of total finalized bundles + TotalBundles uint64 `protobuf:"varint,10,opt,name=total_bundles,json=totalBundles,proto3" json:"total_bundles,omitempty"` + // upload_interval ... + UploadInterval uint64 `protobuf:"varint,11,opt,name=upload_interval,json=uploadInterval,proto3" json:"upload_interval,omitempty"` + // operating_cost ... + OperatingCost uint64 `protobuf:"varint,12,opt,name=operating_cost,json=operatingCost,proto3" json:"operating_cost,omitempty"` + // min_delegation ... + MinDelegation uint64 `protobuf:"varint,13,opt,name=min_delegation,json=minDelegation,proto3" json:"min_delegation,omitempty"` + // max_bundle_size ... + MaxBundleSize uint64 `protobuf:"varint,14,opt,name=max_bundle_size,json=maxBundleSize,proto3" json:"max_bundle_size,omitempty"` + // disabled is true when the pool is disabled. + // Can only be done via governance. + Disabled bool `protobuf:"varint,15,opt,name=disabled,proto3" json:"disabled,omitempty"` + // funders ... + Funders []*Funder `protobuf:"bytes,16,rep,name=funders,proto3" json:"funders,omitempty"` + // total_funds ... + TotalFunds uint64 `protobuf:"varint,17,opt,name=total_funds,json=totalFunds,proto3" json:"total_funds,omitempty"` + // protocol ... + Protocol *Protocol `protobuf:"bytes,18,opt,name=protocol,proto3" json:"protocol,omitempty"` + // upgrade_plan ... + UpgradePlan *UpgradePlan `protobuf:"bytes,19,opt,name=upgrade_plan,json=upgradePlan,proto3" json:"upgrade_plan,omitempty"` + // storage_provider_id ... + CurrentStorageProviderId uint32 `protobuf:"varint,20,opt,name=current_storage_provider_id,json=currentStorageProviderId,proto3" json:"current_storage_provider_id,omitempty"` + // compression_id ... + CurrentCompressionId uint32 `protobuf:"varint,21,opt,name=current_compression_id,json=currentCompressionId,proto3" json:"current_compression_id,omitempty"` +} + +func (m *Pool) Reset() { *m = Pool{} } +func (m *Pool) String() string { return proto.CompactTextString(m) } +func (*Pool) ProtoMessage() {} +func (*Pool) Descriptor() ([]byte, []int) { + return fileDescriptor_40c1730f47ff2ef8, []int{3} +} + +func (m *Pool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *Pool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Pool.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} + +func (m *Pool) XXX_Merge(src proto.Message) { + xxx_messageInfo_Pool.Merge(m, src) +} + +func (m *Pool) XXX_Size() int { + return m.Size() +} + +func (m *Pool) XXX_DiscardUnknown() { + xxx_messageInfo_Pool.DiscardUnknown(m) +} + +var xxx_messageInfo_Pool proto.InternalMessageInfo + +func (m *Pool) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *Pool) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Pool) GetRuntime() string { + if m != nil { + return m.Runtime + } + return "" +} + +func (m *Pool) GetLogo() string { + if m != nil { + return m.Logo + } + return "" +} + +func (m *Pool) GetConfig() string { + if m != nil { + return m.Config + } + return "" +} + +func (m *Pool) GetStartKey() string { + if m != nil { + return m.StartKey + } + return "" +} + +func (m *Pool) GetCurrentKey() string { + if m != nil { + return m.CurrentKey + } + return "" +} + +func (m *Pool) GetCurrentSummary() string { + if m != nil { + return m.CurrentSummary + } + return "" +} + +func (m *Pool) GetCurrentIndex() uint64 { + if m != nil { + return m.CurrentIndex + } + return 0 +} + +func (m *Pool) GetTotalBundles() uint64 { + if m != nil { + return m.TotalBundles + } + return 0 +} + +func (m *Pool) GetUploadInterval() uint64 { + if m != nil { + return m.UploadInterval + } + return 0 +} + +func (m *Pool) GetOperatingCost() uint64 { + if m != nil { + return m.OperatingCost + } + return 0 +} + +func (m *Pool) GetMinDelegation() uint64 { + if m != nil { + return m.MinDelegation + } + return 0 +} + +func (m *Pool) GetMaxBundleSize() uint64 { + if m != nil { + return m.MaxBundleSize + } + return 0 +} + +func (m *Pool) GetDisabled() bool { + if m != nil { + return m.Disabled + } + return false +} + +func (m *Pool) GetFunders() []*Funder { + if m != nil { + return m.Funders + } + return nil +} + +func (m *Pool) GetTotalFunds() uint64 { + if m != nil { + return m.TotalFunds + } + return 0 +} + +func (m *Pool) GetProtocol() *Protocol { + if m != nil { + return m.Protocol + } + return nil +} + +func (m *Pool) GetUpgradePlan() *UpgradePlan { + if m != nil { + return m.UpgradePlan + } + return nil +} + +func (m *Pool) GetCurrentStorageProviderId() uint32 { + if m != nil { + return m.CurrentStorageProviderId + } + return 0 +} + +func (m *Pool) GetCurrentCompressionId() uint32 { + if m != nil { + return m.CurrentCompressionId + } + return 0 +} + +func init() { + // proto.RegisterEnum("kyve.pool.v1beta1.PoolStatus", PoolStatus_name, PoolStatus_value) + // proto.RegisterType((*Protocol)(nil), "kyve.pool.v1beta1.Protocol") + // proto.RegisterType((*UpgradePlan)(nil), "kyve.pool.v1beta1.UpgradePlan") + // proto.RegisterType((*Funder)(nil), "kyve.pool.v1beta1.Funder") + // proto.RegisterType((*Pool)(nil), "kyve.pool.v1beta1.Pool") +} + +func init() { proto.RegisterFile("kyve/pool/v1beta1/pool.proto", fileDescriptor_40c1730f47ff2ef8) } + +var fileDescriptor_40c1730f47ff2ef8 = []byte{ + // 818 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x41, 0x6f, 0xdb, 0x36, + 0x14, 0xc7, 0xad, 0xc4, 0x75, 0x6c, 0x3a, 0x71, 0x5c, 0x2e, 0xcd, 0xd8, 0x64, 0xf0, 0xdc, 0x0c, + 0xdd, 0xbc, 0x1d, 0x6c, 0xb4, 0x1d, 0x30, 0x60, 0xc0, 0x0e, 0x8e, 0xed, 0x64, 0x42, 0x03, 0xdb, + 0x90, 0xed, 0x02, 0xdb, 0x45, 0xa0, 0x45, 0x56, 0x21, 0x22, 0x91, 0x02, 0x49, 0x79, 0x71, 0x8f, + 0x3b, 0xed, 0xb8, 0xef, 0xd0, 0xcf, 0xb1, 0xfb, 0x8e, 0x3d, 0xee, 0x38, 0x24, 0x5f, 0x64, 0x20, + 0x25, 0x79, 0xee, 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0xff, 0xec, 0x2d, 0x4a, 0x94, 0xa0, 0x05, + 0x00, 0x00, +} + +func (m *Protocol) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Protocol) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Protocol) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LastUpgrade != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.LastUpgrade)) + i-- + dAtA[i] = 0x18 + } + if len(m.Binaries) > 0 { + i -= len(m.Binaries) + copy(dAtA[i:], m.Binaries) + i = encodeVarintPool(dAtA, i, uint64(len(m.Binaries))) + i-- + dAtA[i] = 0x12 + } + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintPool(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UpgradePlan) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UpgradePlan) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UpgradePlan) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Duration != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.Duration)) + i-- + dAtA[i] = 0x20 + } + if m.ScheduledAt != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.ScheduledAt)) + i-- + dAtA[i] = 0x18 + } + if len(m.Binaries) > 0 { + i -= len(m.Binaries) + copy(dAtA[i:], m.Binaries) + i = encodeVarintPool(dAtA, i, uint64(len(m.Binaries))) + i-- + dAtA[i] = 0x12 + } + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintPool(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Funder) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Funder) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Funder) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Amount != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x10 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintPool(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Pool) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Pool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CurrentCompressionId != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.CurrentCompressionId)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xa8 + } + if m.CurrentStorageProviderId != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.CurrentStorageProviderId)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xa0 + } + if m.UpgradePlan != nil { + { + size, err := m.UpgradePlan.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x9a + } + if m.Protocol != nil { + { + size, err := m.Protocol.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x92 + } + if m.TotalFunds != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.TotalFunds)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x88 + } + if len(m.Funders) > 0 { + for iNdEx := len(m.Funders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Funders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + } + if m.Disabled { + i-- + if m.Disabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x78 + } + if m.MaxBundleSize != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.MaxBundleSize)) + i-- + dAtA[i] = 0x70 + } + if m.MinDelegation != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.MinDelegation)) + i-- + dAtA[i] = 0x68 + } + if m.OperatingCost != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.OperatingCost)) + i-- + dAtA[i] = 0x60 + } + if m.UploadInterval != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.UploadInterval)) + i-- + dAtA[i] = 0x58 + } + if m.TotalBundles != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.TotalBundles)) + i-- + dAtA[i] = 0x50 + } + if m.CurrentIndex != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.CurrentIndex)) + i-- + dAtA[i] = 0x48 + } + if len(m.CurrentSummary) > 0 { + i -= len(m.CurrentSummary) + copy(dAtA[i:], m.CurrentSummary) + i = encodeVarintPool(dAtA, i, uint64(len(m.CurrentSummary))) + i-- + dAtA[i] = 0x42 + } + if len(m.CurrentKey) > 0 { + i -= len(m.CurrentKey) + copy(dAtA[i:], m.CurrentKey) + i = encodeVarintPool(dAtA, i, uint64(len(m.CurrentKey))) + i-- + dAtA[i] = 0x3a + } + if len(m.StartKey) > 0 { + i -= len(m.StartKey) + copy(dAtA[i:], m.StartKey) + i = encodeVarintPool(dAtA, i, uint64(len(m.StartKey))) + i-- + dAtA[i] = 0x32 + } + if len(m.Config) > 0 { + i -= len(m.Config) + copy(dAtA[i:], m.Config) + i = encodeVarintPool(dAtA, i, uint64(len(m.Config))) + i-- + dAtA[i] = 0x2a + } + if len(m.Logo) > 0 { + i -= len(m.Logo) + copy(dAtA[i:], m.Logo) + i = encodeVarintPool(dAtA, i, uint64(len(m.Logo))) + i-- + dAtA[i] = 0x22 + } + if len(m.Runtime) > 0 { + i -= len(m.Runtime) + copy(dAtA[i:], m.Runtime) + i = encodeVarintPool(dAtA, i, uint64(len(m.Runtime))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintPool(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintPool(dAtA []byte, offset int, v uint64) int { + offset -= sovPool(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} + +func (m *Protocol) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Version) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.Binaries) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + if m.LastUpgrade != 0 { + n += 1 + sovPool(uint64(m.LastUpgrade)) + } + return n +} + +func (m *UpgradePlan) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Version) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.Binaries) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + if m.ScheduledAt != 0 { + n += 1 + sovPool(uint64(m.ScheduledAt)) + } + if m.Duration != 0 { + n += 1 + sovPool(uint64(m.Duration)) + } + return n +} + +func (m *Funder) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + if m.Amount != 0 { + n += 1 + sovPool(uint64(m.Amount)) + } + return n +} + +func (m *Pool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovPool(uint64(m.Id)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.Runtime) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.Logo) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.Config) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.StartKey) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.CurrentKey) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.CurrentSummary) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + if m.CurrentIndex != 0 { + n += 1 + sovPool(uint64(m.CurrentIndex)) + } + if m.TotalBundles != 0 { + n += 1 + sovPool(uint64(m.TotalBundles)) + } + if m.UploadInterval != 0 { + n += 1 + sovPool(uint64(m.UploadInterval)) + } + if m.OperatingCost != 0 { + n += 1 + sovPool(uint64(m.OperatingCost)) + } + if m.MinDelegation != 0 { + n += 1 + sovPool(uint64(m.MinDelegation)) + } + if m.MaxBundleSize != 0 { + n += 1 + sovPool(uint64(m.MaxBundleSize)) + } + if m.Disabled { + n += 2 + } + if len(m.Funders) > 0 { + for _, e := range m.Funders { + l = e.Size() + n += 2 + l + sovPool(uint64(l)) + } + } + if m.TotalFunds != 0 { + n += 2 + sovPool(uint64(m.TotalFunds)) + } + if m.Protocol != nil { + l = m.Protocol.Size() + n += 2 + l + sovPool(uint64(l)) + } + if m.UpgradePlan != nil { + l = m.UpgradePlan.Size() + n += 2 + l + sovPool(uint64(l)) + } + if m.CurrentStorageProviderId != 0 { + n += 2 + sovPool(uint64(m.CurrentStorageProviderId)) + } + if m.CurrentCompressionId != 0 { + n += 2 + sovPool(uint64(m.CurrentCompressionId)) + } + return n +} + +func sovPool(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} + +func sozPool(x uint64) (n int) { + return sovPool(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} + +func (m *Protocol) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Protocol: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Protocol: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Binaries", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Binaries = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastUpgrade", wireType) + } + m.LastUpgrade = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastUpgrade |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipPool(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPool + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *UpgradePlan) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UpgradePlan: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpgradePlan: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Binaries", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Binaries = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ScheduledAt", wireType) + } + m.ScheduledAt = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ScheduledAt |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Duration", wireType) + } + m.Duration = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Duration |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipPool(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPool + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *Funder) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Funder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Funder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipPool(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPool + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *Pool) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Pool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Pool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Runtime", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Runtime = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Logo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Config = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StartKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CurrentKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentSummary", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CurrentSummary = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentIndex", wireType) + } + m.CurrentIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalBundles", wireType) + } + m.TotalBundles = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalBundles |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UploadInterval", wireType) + } + m.UploadInterval = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UploadInterval |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatingCost", wireType) + } + m.OperatingCost = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OperatingCost |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDelegation", wireType) + } + m.MinDelegation = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinDelegation |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxBundleSize", wireType) + } + m.MaxBundleSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxBundleSize |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Disabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Disabled = bool(v != 0) + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Funders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Funders = append(m.Funders, &Funder{}) + if err := m.Funders[len(m.Funders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 17: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalFunds", wireType) + } + m.TotalFunds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalFunds |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 18: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Protocol == nil { + m.Protocol = &Protocol{} + } + if err := m.Protocol.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 19: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpgradePlan", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UpgradePlan == nil { + m.UpgradePlan = &UpgradePlan{} + } + if err := m.UpgradePlan.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 20: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentStorageProviderId", wireType) + } + m.CurrentStorageProviderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentStorageProviderId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 21: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentCompressionId", wireType) + } + m.CurrentCompressionId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentCompressionId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipPool(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPool + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func skipPool(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPool + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPool + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPool + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthPool + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPool + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthPool + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthPool = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPool = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPool = fmt.Errorf("proto: unexpected end of group") +) diff --git a/proto/kyve/pool/v1beta1/pool.proto b/proto/kyve/pool/v1beta1/pool.proto index 1cb7020a..5d023982 100644 --- a/proto/kyve/pool/v1beta1/pool.proto +++ b/proto/kyve/pool/v1beta1/pool.proto @@ -90,16 +90,13 @@ message Pool { // Can only be done via governance. bool disabled = 15; - // old funders and total_funds fields - reserved 16, 17; - // protocol ... - Protocol protocol = 18; + Protocol protocol = 16; // upgrade_plan ... - UpgradePlan upgrade_plan = 19; + UpgradePlan upgrade_plan = 17; // storage_provider_id ... - uint32 current_storage_provider_id = 20; + uint32 current_storage_provider_id = 18; // compression_id ... - uint32 current_compression_id = 21; + uint32 current_compression_id = 19; } diff --git a/x/funders/client/cli/tx.go b/x/funders/client/cli/tx.go index 6ff358ec..b98cb825 100644 --- a/x/funders/client/cli/tx.go +++ b/x/funders/client/cli/tx.go @@ -2,6 +2,7 @@ package cli import ( "fmt" + "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" diff --git a/x/funders/keeper/msg_server_create_funder.go b/x/funders/keeper/msg_server_create_funder.go index 36bf8ae2..b29417ce 100644 --- a/x/funders/keeper/msg_server_create_funder.go +++ b/x/funders/keeper/msg_server_create_funder.go @@ -11,7 +11,6 @@ import ( // CreateFunder creates a new funder object and stores it in the store. // If the funder already exists, an error is returned. -// TODO(rapha): this can be spammed right now. Someone can just created a bunch of funders to get displayed on the funders page. We should probably add a fee to this. func (k msgServer) CreateFunder(goCtx context.Context, msg *types.MsgCreateFunder) (*types.MsgCreateFunderResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) diff --git a/x/pool/keeper/msg_server_cancel_runtime_upgrade_test.go b/x/pool/keeper/msg_server_cancel_runtime_upgrade_test.go index 6ed1db59..731dde43 100644 --- a/x/pool/keeper/msg_server_cancel_runtime_upgrade_test.go +++ b/x/pool/keeper/msg_server_cancel_runtime_upgrade_test.go @@ -30,6 +30,8 @@ var _ = Describe("msg_server_cancel_runtime_upgrade.go", Ordered, func() { gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() votingPeriod := s.App().GovKeeper.GetParams(s.Ctx()).VotingPeriod + var currentTime uint64 + BeforeEach(func() { s = i.NewCleanChain() @@ -43,6 +45,8 @@ var _ = Describe("msg_server_cancel_runtime_upgrade.go", Ordered, func() { } pool.Runtime = "@kyve/test" s.App().PoolKeeper.SetPool(s.Ctx(), pool) + + currentTime = uint64(time.Now().Unix()) }) AfterEach(func() { @@ -87,7 +91,7 @@ var _ = Describe("msg_server_cancel_runtime_upgrade.go", Ordered, func() { Version: "1.0.0", Binaries: "{}", Duration: 60, - ScheduledAt: uint64(time.Now().Unix()) + 7*24*3600, + ScheduledAt: currentTime + 7*24*3600, } p, v := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -139,7 +143,7 @@ var _ = Describe("msg_server_cancel_runtime_upgrade.go", Ordered, func() { Version: "1.0.0", Binaries: "{}", Duration: 60, - ScheduledAt: uint64(time.Now().Unix()), + ScheduledAt: currentTime, } p, v := BuildGovernanceTxs(s, []sdk.Msg{msg}) diff --git a/x/pool/keeper/msg_server_schedule_runtime_upgrade_test.go b/x/pool/keeper/msg_server_schedule_runtime_upgrade_test.go index bf0625b2..a6ff6619 100644 --- a/x/pool/keeper/msg_server_schedule_runtime_upgrade_test.go +++ b/x/pool/keeper/msg_server_schedule_runtime_upgrade_test.go @@ -33,6 +33,8 @@ var _ = Describe("msg_server_schedule_runtime_upgrade.go", Ordered, func() { gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() votingPeriod := s.App().GovKeeper.GetParams(s.Ctx()).VotingPeriod + var currentTime uint64 + BeforeEach(func() { s = i.NewCleanChain() @@ -46,6 +48,8 @@ var _ = Describe("msg_server_schedule_runtime_upgrade.go", Ordered, func() { } pool.Runtime = "@kyve/test" s.App().PoolKeeper.SetPool(s.Ctx(), pool) + + currentTime = uint64(time.Now().Unix()) }) AfterEach(func() { @@ -58,7 +62,7 @@ var _ = Describe("msg_server_schedule_runtime_upgrade.go", Ordered, func() { Authority: i.DUMMY[0], Runtime: "@kyve/test", Version: "1.0.0", - ScheduledAt: uint64(time.Now().Unix()), + ScheduledAt: currentTime, } // ACT @@ -76,7 +80,7 @@ var _ = Describe("msg_server_schedule_runtime_upgrade.go", Ordered, func() { Version: "1.0.0", Binaries: "{}", Duration: 60, - ScheduledAt: uint64(time.Now().Unix()), + ScheduledAt: currentTime, } proposal, _ := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -96,7 +100,7 @@ var _ = Describe("msg_server_schedule_runtime_upgrade.go", Ordered, func() { Version: "", Binaries: "{}", Duration: 60, - ScheduledAt: uint64(time.Now().Unix()), + ScheduledAt: currentTime, } p, v := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -125,7 +129,7 @@ var _ = Describe("msg_server_schedule_runtime_upgrade.go", Ordered, func() { Version: "1.0.0", Binaries: "", Duration: 60, - ScheduledAt: uint64(time.Now().Unix()), + ScheduledAt: currentTime, } p, v := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -154,7 +158,7 @@ var _ = Describe("msg_server_schedule_runtime_upgrade.go", Ordered, func() { Version: "1.0.0", Binaries: "{}", Duration: 60, - ScheduledAt: uint64(time.Now().Unix()) - 7*24*3600, + ScheduledAt: currentTime - 7*24*3600, } p, v := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -191,7 +195,7 @@ var _ = Describe("msg_server_schedule_runtime_upgrade.go", Ordered, func() { Version: "1.0.0", Binaries: "{}", Duration: 60, - ScheduledAt: uint64(time.Now().Unix()) + 7*24*3600, + ScheduledAt: currentTime + 7*24*3600, } p, v := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -215,7 +219,7 @@ var _ = Describe("msg_server_schedule_runtime_upgrade.go", Ordered, func() { Expect(pool.UpgradePlan).To(Equal(&types.UpgradePlan{ Version: "1.0.0", Binaries: "{}", - ScheduledAt: uint64(time.Now().Unix()) + 7*24*3600, + ScheduledAt: currentTime + 7*24*3600, Duration: 60, })) }) @@ -228,7 +232,7 @@ var _ = Describe("msg_server_schedule_runtime_upgrade.go", Ordered, func() { Version: "1.0.0", Binaries: "{}", Duration: 60, - ScheduledAt: uint64(time.Now().Unix()) + 7*24*3600, + ScheduledAt: currentTime + 7*24*3600, } p, v := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -251,7 +255,7 @@ var _ = Describe("msg_server_schedule_runtime_upgrade.go", Ordered, func() { Expect(pool.UpgradePlan).To(Equal(&types.UpgradePlan{ Version: "1.0.0", Binaries: "{}", - ScheduledAt: uint64(time.Now().Unix()) + 7*24*3600, + ScheduledAt: currentTime + 7*24*3600, Duration: 60, })) @@ -262,7 +266,7 @@ var _ = Describe("msg_server_schedule_runtime_upgrade.go", Ordered, func() { Version: "2.0.0", Binaries: "{}", Duration: 60, - ScheduledAt: uint64(time.Now().Unix()) + 7*24*3600, + ScheduledAt: currentTime + 7*24*3600, } p, v = BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -285,7 +289,7 @@ var _ = Describe("msg_server_schedule_runtime_upgrade.go", Ordered, func() { Expect(pool.UpgradePlan).To(Equal(&types.UpgradePlan{ Version: "1.0.0", Binaries: "{}", - ScheduledAt: uint64(time.Now().Unix()) + 7*24*3600, + ScheduledAt: currentTime + 7*24*3600, Duration: 60, })) }) diff --git a/x/pool/types/pool.pb.go b/x/pool/types/pool.pb.go index 8288cd4d..13175af2 100644 --- a/x/pool/types/pool.pb.go +++ b/x/pool/types/pool.pb.go @@ -244,13 +244,13 @@ type Pool struct { // Can only be done via governance. Disabled bool `protobuf:"varint,15,opt,name=disabled,proto3" json:"disabled,omitempty"` // protocol ... - Protocol *Protocol `protobuf:"bytes,18,opt,name=protocol,proto3" json:"protocol,omitempty"` + Protocol *Protocol `protobuf:"bytes,16,opt,name=protocol,proto3" json:"protocol,omitempty"` // upgrade_plan ... - UpgradePlan *UpgradePlan `protobuf:"bytes,19,opt,name=upgrade_plan,json=upgradePlan,proto3" json:"upgrade_plan,omitempty"` + UpgradePlan *UpgradePlan `protobuf:"bytes,17,opt,name=upgrade_plan,json=upgradePlan,proto3" json:"upgrade_plan,omitempty"` // storage_provider_id ... - CurrentStorageProviderId uint32 `protobuf:"varint,20,opt,name=current_storage_provider_id,json=currentStorageProviderId,proto3" json:"current_storage_provider_id,omitempty"` + CurrentStorageProviderId uint32 `protobuf:"varint,18,opt,name=current_storage_provider_id,json=currentStorageProviderId,proto3" json:"current_storage_provider_id,omitempty"` // compression_id ... - CurrentCompressionId uint32 `protobuf:"varint,21,opt,name=current_compression_id,json=currentCompressionId,proto3" json:"current_compression_id,omitempty"` + CurrentCompressionId uint32 `protobuf:"varint,19,opt,name=current_compression_id,json=currentCompressionId,proto3" json:"current_compression_id,omitempty"` } func (m *Pool) Reset() { *m = Pool{} } @@ -429,56 +429,55 @@ func init() { func init() { proto.RegisterFile("kyve/pool/v1beta1/pool.proto", fileDescriptor_40c1730f47ff2ef8) } var fileDescriptor_40c1730f47ff2ef8 = []byte{ - // 774 bytes of a gzipped FileDescriptorProto + // 763 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xcf, 0x73, 0xdb, 0x44, - 0x14, 0xc7, 0xad, 0x54, 0x49, 0xed, 0x75, 0xe2, 0x28, 0x8b, 0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0xb2, 0x6a, 0x54, 0xb3, 0xb1, 0x54, 0xe5, 0x41, 0x2e, 0x88, 0x54, 0x4f, 0x36, 0xb5, 0x5c, - 0xe7, 0x67, 0x7f, 0xee, 0x02, 0x73, 0xce, 0x79, 0x04, 0x3b, 0x60, 0x87, 0x05, 0xba, 0xb1, 0xe9, - 0xee, 0xb0, 0x00, 0x42, 0x60, 0x26, 0x24, 0xa6, 0x65, 0x3f, 0x1d, 0xab, 0x13, 0x8a, 0x3c, 0x91, - 0x2c, 0x2e, 0xee, 0xd3, 0x72, 0xab, 0x54, 0xb9, 0x23, 0x1e, 0x72, 0xfd, 0xf8, 0x96, 0xab, 0x63, - 0x78, 0x0c, 0xf6, 0x7c, 0x9e, 0xbc, 0x62, 0x21, 0xda, 0xd5, 0xb4, 0xcc, 0xe0, 0x29, 0x68, 0x65, - 0x92, 0x08, 0x89, 0xaf, 0xe9, 0x16, 0xed, 0x15, 0xd7, 0xd1, 0xe0, 0x05, 0xdd, 0xc2, 0x8f, 0x40, - 0xdb, 0xcf, 0x85, 0xa0, 0x49, 0x21, 0x3f, 0xd4, 0x32, 0x28, 0x91, 0x32, 0x7c, 0x0a, 0x0e, 0x2b, - 0x43, 0x96, 0xc7, 0x31, 0x11, 0x5b, 0xd4, 0xd4, 0xa6, 0x4e, 0x89, 0xbd, 0x82, 0xc2, 0x8f, 0xc1, - 0x41, 0x65, 0x64, 0x49, 0x40, 0x6f, 0x50, 0x4b, 0xdf, 0x6d, 0xbf, 0x84, 0x8e, 0x62, 0xca, 0x24, - 0xb9, 0x24, 0x11, 0x5e, 0xe5, 0x49, 0x10, 0xd1, 0x0c, 0x81, 0xc2, 0xa4, 0xe1, 0x79, 0xc1, 0x54, - 0xcb, 0x3c, 0x8d, 0x38, 0x09, 0x30, 0x4b, 0x24, 0x15, 0x1b, 0x12, 0xa1, 0xb6, 0xb6, 0x75, 0x0a, - 0xec, 0x94, 0x14, 0x7e, 0x05, 0x8e, 0x59, 0xf2, 0x2a, 0x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34, 0x78, 0xfe, 0xc3, 0x0b, 0x6b, 0x4a, 0xe5, 0x2b, 0x2e, 0x6e, 0x07, 0xde, 0x9a, 0xb0, 0x78, + 0xb0, 0xcd, 0xff, 0x81, 0x72, 0x97, 0xd0, 0x74, 0x75, 0xa4, 0xc7, 0xf8, 0xd5, 0xdf, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x55, 0xef, 0xbe, 0x88, 0x1d, 0x05, 0x00, 0x00, } func (m *Protocol) Marshal() (dAtA []byte, err error) { @@ -595,14 +594,14 @@ func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1 i-- - dAtA[i] = 0xa8 + dAtA[i] = 0x98 } if m.CurrentStorageProviderId != 0 { i = encodeVarintPool(dAtA, i, uint64(m.CurrentStorageProviderId)) i-- dAtA[i] = 0x1 i-- - dAtA[i] = 0xa0 + dAtA[i] = 0x90 } if m.UpgradePlan != nil { { @@ -616,7 +615,7 @@ func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1 i-- - dAtA[i] = 0x9a + dAtA[i] = 0x8a } if m.Protocol != nil { { @@ -630,7 +629,7 @@ func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1 i-- - dAtA[i] = 0x92 + dAtA[i] = 0x82 } if m.Disabled { i-- @@ -1555,7 +1554,7 @@ func (m *Pool) Unmarshal(dAtA []byte) error { } } m.Disabled = bool(v != 0) - case 18: + case 16: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) } @@ -1591,7 +1590,7 @@ func (m *Pool) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 19: + case 17: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field UpgradePlan", wireType) } @@ -1627,7 +1626,7 @@ func (m *Pool) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 20: + case 18: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field CurrentStorageProviderId", wireType) } @@ -1646,7 +1645,7 @@ func (m *Pool) Unmarshal(dAtA []byte) error { break } } - case 21: + case 19: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field CurrentCompressionId", wireType) } diff --git a/x/query/client/cli/query_funders.go b/x/query/client/cli/query_funders.go index 053e24a7..39a765ff 100644 --- a/x/query/client/cli/query_funders.go +++ b/x/query/client/cli/query_funders.go @@ -2,6 +2,7 @@ package cli import ( "context" + "github.com/KYVENetwork/chain/x/query/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" diff --git a/x/query/client/cli/query_fundings.go b/x/query/client/cli/query_fundings.go index 5903e5d0..324eb9d8 100644 --- a/x/query/client/cli/query_fundings.go +++ b/x/query/client/cli/query_fundings.go @@ -2,12 +2,13 @@ package cli import ( "context" + "strconv" + "github.com/KYVENetwork/chain/x/query/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/types/query" "github.com/spf13/cobra" - "strconv" ) func byFunder( diff --git a/x/query/keeper/grpc_query_fundings.go b/x/query/keeper/grpc_query_fundings.go index 1f6d7e66..225e3ae4 100644 --- a/x/query/keeper/grpc_query_fundings.go +++ b/x/query/keeper/grpc_query_fundings.go @@ -2,6 +2,7 @@ package keeper import ( "context" + fundersTypes "github.com/KYVENetwork/chain/x/funders/types" "github.com/KYVENetwork/chain/x/query/types" sdk "github.com/cosmos/cosmos-sdk/types" From b5ace00a4453b0f521209435bd5ea13d7295db6c Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 26 Oct 2023 14:49:32 +0200 Subject: [PATCH 089/109] fix: errors and queries --- x/funders/types/errors.go | 3 +-- x/query/keeper/grpc_params.go | 10 +++++++++- x/query/keeper/grpc_query_funders.go | 3 +-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/x/funders/types/errors.go b/x/funders/types/errors.go index 9ef4f4f9..34decf78 100644 --- a/x/funders/types/errors.go +++ b/x/funders/types/errors.go @@ -14,6 +14,5 @@ var ( ErrFundingDoesNotExist = errors.Register(ModuleName, 1105, "funding for pool %v and funder %v does not exist") ErrFundingIsUsedUp = errors.Register(ModuleName, 1106, "funding for pool %v and funder %v is used up") - ErrFundingStateDoesNotExist = errors.Register(ModuleName, 1107, "funding state for pool %v does not exist") - ErrFundingStateAlreadyExists = errors.Register(ModuleName, 1108, "funding state for pool %v already exists") + ErrFundingStateDoesNotExist = errors.Register(ModuleName, 1107, "funding state for pool %v does not exist") ) diff --git a/x/query/keeper/grpc_params.go b/x/query/keeper/grpc_params.go index 00a20994..5816707a 100644 --- a/x/query/keeper/grpc_params.go +++ b/x/query/keeper/grpc_params.go @@ -20,6 +20,14 @@ func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*t globalParams := k.globalKeeper.GetParams(ctx) govParams := k.govKeeper.GetParams(ctx) sp := k.stakerKeeper.GetParams(ctx) + fp := k.fundersKeeper.GetParams(ctx) - return &types.QueryParamsResponse{BundlesParams: &bp, DelegationParams: &dp, GlobalParams: &globalParams, GovParams: &govParams, StakersParams: &sp}, nil + return &types.QueryParamsResponse{ + BundlesParams: &bp, + DelegationParams: &dp, + GlobalParams: &globalParams, + GovParams: &govParams, + StakersParams: &sp, + FundersParams: &fp, + }, nil } diff --git a/x/query/keeper/grpc_query_funders.go b/x/query/keeper/grpc_query_funders.go index c1af3d8b..24cc27ec 100644 --- a/x/query/keeper/grpc_query_funders.go +++ b/x/query/keeper/grpc_query_funders.go @@ -6,7 +6,6 @@ import ( fundersTypes "github.com/KYVENetwork/chain/x/funders/types" sdk "github.com/cosmos/cosmos-sdk/types" - errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -41,7 +40,7 @@ func (k Keeper) Funder(c context.Context, req *types.QueryFunderRequest) (*types funder, found := k.fundersKeeper.GetFunder(ctx, req.Address) if !found { - return nil, errorsTypes.ErrKeyNotFound + return nil, status.Error(codes.NotFound, "funder not found") } fundings := k.fundersKeeper.GetFundingsOfFunder(ctx, funder.Address) From 3c30fc896be1104921b53fb2741ab9fa6c68812e Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 26 Oct 2023 15:11:37 +0200 Subject: [PATCH 090/109] fix: remove search from fundings queries --- docs/swagger.yml | 10 -- proto/kyve/query/v1beta1/funders.proto | 8 +- x/funders/keeper/getters_funding.go | 1 + x/query/types/funders.pb.go | 228 +++++++------------------ 4 files changed, 65 insertions(+), 182 deletions(-) diff --git a/docs/swagger.yml b/docs/swagger.yml index a45a5840..63be8fb0 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -8680,11 +8680,6 @@ paths: in: query required: false type: boolean - - name: search - description: search. - in: query - required: false - type: string - name: with_inactive_fundings description: with_inactive_fundings ... in: query @@ -9007,11 +9002,6 @@ paths: in: query required: false type: boolean - - name: search - description: search. - in: query - required: false - type: string - name: with_inactive_fundings description: with_inactive_fundings ... in: query diff --git a/proto/kyve/query/v1beta1/funders.proto b/proto/kyve/query/v1beta1/funders.proto index 6692963b..4e065eae 100644 --- a/proto/kyve/query/v1beta1/funders.proto +++ b/proto/kyve/query/v1beta1/funders.proto @@ -126,10 +126,8 @@ message QueryFundingsByFunderRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; // address ... string address = 2; - // search - string search = 3; // with_inactive_fundings ... - bool with_inactive_fundings = 4; + bool with_inactive_fundings = 3; } // QueryFundingsByFunderResponse is the response type for the Query/FundingsByFunder RPC method. @@ -150,10 +148,8 @@ message QueryFundingsByPoolRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; // pool_id ... uint64 pool_id = 2; - // search - string search = 3; // with_inactive_fundings ... - bool with_inactive_fundings = 4; + bool with_inactive_fundings = 3; } // QueryFundingsByPoolResponse is the response type for the Query/FundingsByPool RPC method. diff --git a/x/funders/keeper/getters_funding.go b/x/funders/keeper/getters_funding.go index 4952b99e..630c5c04 100644 --- a/x/funders/keeper/getters_funding.go +++ b/x/funders/keeper/getters_funding.go @@ -97,6 +97,7 @@ func (k Keeper) SetFunding(ctx sdk.Context, funding *types.Funding) { } // GetPaginatedFundingQuery performs a full search on all fundings with the given parameters. +// Requires either funderAddress or poolId to be provided. func (k Keeper) GetPaginatedFundingQuery( ctx sdk.Context, pagination *query.PageRequest, diff --git a/x/query/types/funders.pb.go b/x/query/types/funders.pb.go index ada27d2b..bdc67be4 100644 --- a/x/query/types/funders.pb.go +++ b/x/query/types/funders.pb.go @@ -511,10 +511,8 @@ type QueryFundingsByFunderRequest struct { Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` // address ... Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - // search - Search string `protobuf:"bytes,3,opt,name=search,proto3" json:"search,omitempty"` // with_inactive_fundings ... - WithInactiveFundings bool `protobuf:"varint,4,opt,name=with_inactive_fundings,json=withInactiveFundings,proto3" json:"with_inactive_fundings,omitempty"` + WithInactiveFundings bool `protobuf:"varint,3,opt,name=with_inactive_fundings,json=withInactiveFundings,proto3" json:"with_inactive_fundings,omitempty"` } func (m *QueryFundingsByFunderRequest) Reset() { *m = QueryFundingsByFunderRequest{} } @@ -564,13 +562,6 @@ func (m *QueryFundingsByFunderRequest) GetAddress() string { return "" } -func (m *QueryFundingsByFunderRequest) GetSearch() string { - if m != nil { - return m.Search - } - return "" -} - func (m *QueryFundingsByFunderRequest) GetWithInactiveFundings() bool { if m != nil { return m.WithInactiveFundings @@ -639,10 +630,8 @@ type QueryFundingsByPoolRequest struct { Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` // pool_id ... PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` - // search - Search string `protobuf:"bytes,3,opt,name=search,proto3" json:"search,omitempty"` // with_inactive_fundings ... - WithInactiveFundings bool `protobuf:"varint,4,opt,name=with_inactive_fundings,json=withInactiveFundings,proto3" json:"with_inactive_fundings,omitempty"` + WithInactiveFundings bool `protobuf:"varint,3,opt,name=with_inactive_fundings,json=withInactiveFundings,proto3" json:"with_inactive_fundings,omitempty"` } func (m *QueryFundingsByPoolRequest) Reset() { *m = QueryFundingsByPoolRequest{} } @@ -692,13 +681,6 @@ func (m *QueryFundingsByPoolRequest) GetPoolId() uint64 { return 0 } -func (m *QueryFundingsByPoolRequest) GetSearch() string { - if m != nil { - return m.Search - } - return "" -} - func (m *QueryFundingsByPoolRequest) GetWithInactiveFundings() bool { if m != nil { return m.WithInactiveFundings @@ -778,64 +760,64 @@ func init() { func init() { proto.RegisterFile("kyve/query/v1beta1/funders.proto", fileDescriptor_a182f068d9f0dba9) } var fileDescriptor_a182f068d9f0dba9 = []byte{ - // 905 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcd, 0x6b, 0x24, 0x45, - 0x14, 0x4f, 0x4d, 0x3a, 0x33, 0xf1, 0x4d, 0x8c, 0x6b, 0x6d, 0xdc, 0x6d, 0x26, 0xbb, 0xe3, 0x38, - 0x6a, 0x32, 0x04, 0xe9, 0x4e, 0x46, 0x5d, 0x44, 0xf0, 0xb0, 0x41, 0x57, 0x16, 0x41, 0x62, 0x8b, - 0x82, 0x5e, 0x9a, 0x9a, 0xee, 0xb2, 0x53, 0x64, 0xd2, 0x35, 0xdb, 0x55, 0x9d, 0x38, 0x2c, 0x7b, - 0xd0, 0x8b, 0x1e, 0x05, 0x8f, 0x9e, 0x45, 0xbc, 0xe9, 0x3f, 0x21, 0x0b, 0x82, 0x2c, 0x78, 0xf1, - 0x24, 0x92, 0x88, 0x7f, 0x85, 0x07, 0xa9, 0x8f, 0x99, 0xf4, 0x4c, 0xe6, 0x63, 0xc5, 0x39, 0x78, - 0xeb, 0xf7, 0xf1, 0xab, 0xf7, 0x7b, 0xaf, 0x7e, 0xaf,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 0xcb, 0xa9, 0x90, 0xf8, 0x0e, 0xc0, 0x85, 0x86, 0x35, 0xf3, - 0x6a, 0x7b, 0xcb, 0x33, 0x82, 0xf7, 0x94, 0xe0, 0xc7, 0xae, 0xf5, 0x80, 0x24, 0xd4, 0x62, 0x83, - 0x02, 0x52, 0x75, 0x21, 0x28, 0xc9, 0xa2, 0x43, 0xab, 0x4e, 0x6b, 0x35, 0xbf, 0x41, 0xb0, 0x31, - 0x5a, 0x57, 0xf4, 0x78, 0x2a, 0x28, 0x7e, 0x7b, 0x42, 0xe1, 0xed, 0xb9, 0x85, 0x0d, 0x78, 0xa4, - 0xf2, 0xeb, 0x50, 0xb1, 0x2b, 0xec, 0x96, 0x1a, 0xcb, 0xad, 0x6a, 0xbb, 0x36, 0x4d, 0x8e, 0x34, - 0xdb, 0x77, 0x1e, 0xfe, 0xfe, 0xec, 0x52, 0x30, 0x00, 0x34, 0x63, 0xc0, 0x05, 0x72, 0x83, 0x99, - 0x4c, 0x5f, 0xc2, 0x57, 0xe0, 0xda, 0x29, 0x93, 0x87, 0x21, 0x4b, 0x49, 0x24, 0xd9, 0x09, 0xd5, - 0xf3, 0x66, 0x69, 0x62, 0x64, 0xb8, 0x1a, 0x6c, 0xa8, 0xe8, 0x5d, 0x1b, 0xb4, 0x02, 0x11, 0xcd, - 0x2f, 0xd1, 0xc8, 0xec, 0x87, 0x23, 0x68, 0x43, 0xd9, 0x10, 0xb1, 0xed, 0xcf, 0x20, 0x1e, 0xd8, - 0x4c, 0xfc, 0x06, 0xac, 0x16, 0x6a, 0xaa, 0x76, 0x37, 0x67, 0x6c, 0x9f, 0xed, 0x77, 0x08, 0x69, - 0xfe, 0x82, 0xe0, 0xc6, 0x90, 0x8a, 0xf2, 0xec, 0x8f, 0xf5, 0xbe, 0x28, 0x3d, 0x14, 0x66, 0x58, - 0x1a, 0x9d, 0xe1, 0x85, 0x52, 0x96, 0x8b, 0x4a, 0x99, 0x31, 0x5b, 0x67, 0xc6, 0x6c, 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x56, 0x47, 0x7f, 0x9c, 0xd5, 0xd1, 0x57, 0xe7, 0xf5, 0xa5, 0x47, 0xe7, 0xf5, 0xa5, - 0xdf, 0xce, 0xeb, 0x4b, 0x1f, 0xef, 0x24, 0x4c, 0x1e, 0xe6, 0x1d, 0x2f, 0xe2, 0xc7, 0xfe, 0x3b, - 0x1f, 0x7d, 0xf8, 0xd6, 0xbb, 0x54, 0x9e, 0xf2, 0xec, 0xc8, 0x8f, 0x0e, 0x09, 0x4b, 0xfd, 0x4f, - 0x6d, 0x09, 0xd9, 0xef, 0x51, 0xd1, 0x29, 0xeb, 0xff, 0x89, 0x2f, 0xff, 0x13, 0x00, 0x00, 0xff, - 0xff, 0xac, 0x47, 0xbc, 0xca, 0xbf, 0x0a, 0x00, 0x00, + // 898 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0x38, 0x8e, 0x1d, 0x9e, 0x43, 0x28, 0xd3, 0xd0, 0xae, 0x9c, 0xd6, 0x18, 0x03, 0x89, + 0x15, 0xa1, 0xdd, 0xc4, 0x40, 0x85, 0x90, 0x38, 0x34, 0x82, 0xa2, 0x0a, 0x09, 0x85, 0x45, 0x20, + 0xc1, 0x65, 0x35, 0xde, 0x1d, 0x36, 0xa3, 0x38, 0x3b, 0xdb, 0x9d, 0xd9, 0x04, 0xab, 0xea, 0x01, + 0x2e, 0x70, 0x44, 0xe2, 0xc8, 0x19, 0x21, 0x6e, 0x20, 0x24, 0xfe, 0x04, 0xd4, 0x63, 0x25, 0x2e, + 0x9c, 0x10, 0x4a, 0x10, 0x7f, 0x05, 0x07, 0x34, 0x3f, 0xec, 0xac, 0x1d, 0xff, 0x08, 0x90, 0x43, + 0x6f, 0xfb, 0xde, 0xfb, 0xbe, 0x79, 0xdf, 0x7b, 0xf3, 0xde, 0xd8, 0xd0, 0x3c, 0xe8, 0x1f, 0x51, + 0xef, 0x5e, 0x4e, 0xb3, 0xbe, 0x77, 0xb4, 0xd3, 0xa5, 0x92, 0xec, 0x78, 0x9f, 0xe4, 0x49, 0x44, + 0x33, 0xe1, 0xa6, 0x19, 0x97, 0x1c, 0x63, 0x85, 0x70, 0x35, 0xc2, 0xb5, 0x88, 0xfa, 0x56, 0xc8, + 0xc5, 0x21, 0x17, 0x5e, 0x97, 0x88, 0x71, 0x72, 0x4a, 0x62, 0x96, 0x10, 0xc9, 0x78, 0x62, 0xf8, + 0xf5, 0xb5, 0x98, 0xc7, 0x5c, 0x7f, 0x7a, 0xea, 0xcb, 0x7a, 0x6f, 0xc4, 0x9c, 0xc7, 0x3d, 0xea, + 0x91, 0x94, 0x79, 0x24, 0x49, 0xb8, 0xd4, 0x14, 0x9b, 0xb3, 0xf5, 0x17, 0x82, 0xca, 0x1d, 0xad, + 0x02, 0x3b, 0x50, 0x25, 0x51, 0x94, 0x51, 0x21, 0x1c, 0xd4, 0x44, 0xed, 0x27, 0xfc, 0x81, 0xa9, + 0x22, 0x87, 0x3c, 0x61, 0x07, 0x34, 0x73, 0x4a, 0x26, 0x62, 0x4d, 0x5c, 0x87, 0x65, 0x16, 0xd1, + 0x44, 0x32, 0xd9, 0x77, 0x16, 0x75, 0x68, 0x68, 0x2b, 0xd6, 0x31, 0xed, 0x0a, 0x26, 0xa9, 0x53, + 0x36, 0x2c, 0x6b, 0xaa, 0x48, 0xc8, 0x13, 0x49, 0x42, 0xe9, 0x2c, 0x99, 0x88, 0x35, 0x71, 0x13, + 0x6a, 0x11, 0x15, 0x61, 0xc6, 0x52, 0x25, 0xd2, 0xa9, 0xe8, 0x68, 0xd1, 0x85, 0x6f, 0xc1, 0x92, + 0x90, 0x44, 0x0a, 0xa7, 0xda, 0x44, 0xed, 0x5a, 0xa7, 0xe9, 0x9e, 0x6f, 0x9a, 0xab, 0x0a, 0x62, + 0x49, 0xfc, 0xbe, 0xc2, 0xf9, 0x06, 0xde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0x3b, 0x6d, 0x2c, 0x7c, 0xbc, 0x15, + 0x33, 0xb9, 0x9f, 0x77, 0xdd, 0x90, 0x1f, 0x7a, 0xef, 0x7c, 0xf4, 0xe1, 0x5b, 0xef, 0x52, 0x79, + 0xcc, 0xb3, 0x03, 0x2f, 0xdc, 0x27, 0x2c, 0xf1, 0x3e, 0xb5, 0x29, 0x64, 0x3f, 0xa5, 0xa2, 0x5b, + 0xd1, 0xff, 0xfb, 0x5e, 0xfe, 0x27, 0x00, 0x00, 0xff, 0xff, 0xcc, 0x74, 0x3a, 0xcf, 0x8f, 0x0a, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1425,14 +1407,7 @@ func (m *QueryFundingsByFunderRequest) MarshalToSizedBuffer(dAtA []byte) (int, e dAtA[i] = 0 } i-- - dAtA[i] = 0x20 - } - if len(m.Search) > 0 { - i -= len(m.Search) - copy(dAtA[i:], m.Search) - i = encodeVarintFunders(dAtA, i, uint64(len(m.Search))) - i-- - dAtA[i] = 0x1a + dAtA[i] = 0x18 } if len(m.Address) > 0 { i -= len(m.Address) @@ -1533,14 +1508,7 @@ func (m *QueryFundingsByPoolRequest) MarshalToSizedBuffer(dAtA []byte) (int, err dAtA[i] = 0 } i-- - dAtA[i] = 0x20 - } - if len(m.Search) > 0 { - i -= len(m.Search) - copy(dAtA[i:], m.Search) - i = encodeVarintFunders(dAtA, i, uint64(len(m.Search))) - i-- - dAtA[i] = 0x1a + dAtA[i] = 0x18 } if m.PoolId != 0 { i = encodeVarintFunders(dAtA, i, uint64(m.PoolId)) @@ -1794,10 +1762,6 @@ func (m *QueryFundingsByFunderRequest) Size() (n int) { if l > 0 { n += 1 + l + sovFunders(uint64(l)) } - l = len(m.Search) - if l > 0 { - n += 1 + l + sovFunders(uint64(l)) - } if m.WithInactiveFundings { n += 2 } @@ -1836,10 +1800,6 @@ func (m *QueryFundingsByPoolRequest) Size() (n int) { if m.PoolId != 0 { n += 1 + sovFunders(uint64(m.PoolId)) } - l = len(m.Search) - if l > 0 { - n += 1 + l + sovFunders(uint64(l)) - } if m.WithInactiveFundings { n += 2 } @@ -3048,38 +3008,6 @@ func (m *QueryFundingsByFunderRequest) Unmarshal(dAtA []byte) error { m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Search", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFunders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthFunders - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthFunders - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Search = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field WithInactiveFundings", wireType) } @@ -3325,38 +3253,6 @@ func (m *QueryFundingsByPoolRequest) Unmarshal(dAtA []byte) error { } } case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Search", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFunders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthFunders - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthFunders - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Search = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field WithInactiveFundings", wireType) } From 3fed84bd2a8a7a71362d285669ff9532a06886af Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Fri, 27 Oct 2023 10:27:33 +0200 Subject: [PATCH 091/109] refactor: fund pool - ensure free slot --- app/upgrades/v1_4/upgrade.go | 1 - x/funders/keeper/logic_funders.go | 10 +-- x/funders/keeper/msg_server_defund_pool.go | 3 - x/funders/keeper/msg_server_fund_pool.go | 87 +++++++++++----------- 4 files changed, 47 insertions(+), 54 deletions(-) diff --git a/app/upgrades/v1_4/upgrade.go b/app/upgrades/v1_4/upgrade.go index d472c171..9ae077c2 100644 --- a/app/upgrades/v1_4/upgrade.go +++ b/app/upgrades/v1_4/upgrade.go @@ -198,7 +198,6 @@ func migrateFundersAndPools( fundersKeeper.SetFundingState(ctx, &fundersTypes.FundingState{ PoolId: oldPool.Id, ActiveFunderAddresses: []string{}, - TotalAmount: oldPool.TotalFunds, }) poolKeeper.SetPool(ctx, poolTypes.Pool{ diff --git a/x/funders/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go index c33e9bdc..705db393 100644 --- a/x/funders/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -89,11 +89,11 @@ func (k Keeper) GetLowestFunding(fundings []types.Funding) (lowestFunding *types return nil, fmt.Errorf("no active fundings") } - lowestFunding = &fundings[0] - for _, funding := range fundings { - if funding.Amount < lowestFunding.Amount { - lowestFunding = &funding + lowestFundingIndex := 0 + for i := range fundings { + if fundings[i].Amount < fundings[lowestFundingIndex].Amount { + lowestFundingIndex = i } } - return lowestFunding, nil + return &fundings[lowestFundingIndex], nil } diff --git a/x/funders/keeper/msg_server_defund_pool.go b/x/funders/keeper/msg_server_defund_pool.go index 060711a7..c2b413c2 100644 --- a/x/funders/keeper/msg_server_defund_pool.go +++ b/x/funders/keeper/msg_server_defund_pool.go @@ -50,9 +50,6 @@ func (k msgServer) DefundPool(goCtx context.Context, msg *types.MsgDefundPool) ( // Save funding and funding state k.SetFunding(ctx, &funding) - if funding.Amount == 0 { - fundingState.SetInactive(&funding) - } k.SetFundingState(ctx, &fundingState) // Emit a defund event. diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go index f473c136..edfbac11 100644 --- a/x/funders/keeper/msg_server_fund_pool.go +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -10,14 +10,37 @@ import ( errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) -func (k msgServer) defundLowestFunding( - ctx sdk.Context, - lowestFunding *types.Funding, - fundingState *types.FundingState, - poolId uint64, -) error { - err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, types.ModuleName, lowestFunding.FunderAddress, lowestFunding.Amount) - if err != nil { +// ensureFreeSlot makes sure that a funder can add funding to a given pool. +// If this is not possible an appropriate error is returned. +// A pool has a fixed amount of funding-slots. If there are still free slots +// a funder can just join (even with the smallest funding possible). +// If all slots are taken, it checks if the new funding has more funds +// than the current lowest funding in that pool. +// If so, the lowest funding gets removed from the pool, so that the +// new funding can be added. +// CONTRACT: no KV Writing on newFunding and fundingState +func (k Keeper) ensureFreeSlot(ctx sdk.Context, newFunding *types.Funding, fundingState *types.FundingState) error { + + activeFundings := k.GetActiveFundings(ctx, *fundingState) + // check if slots are still available + if len(activeFundings) < types.MaxFunders { + return nil + } + + lowestFunding, _ := k.GetLowestFunding(activeFundings) + + if lowestFunding.FunderAddress == newFunding.FunderAddress { + // Funder already has a funding slot + return nil + } + + // Check if lowest funding is lower than new funding based on amount (amount per bundle is ignored) + if newFunding.Amount < lowestFunding.Amount { + return errors.Wrapf(errorsTypes.ErrLogic, types.ErrFundsTooLow.Error(), lowestFunding.Amount) + } + + // Defund lowest funder + if err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, types.ModuleName, lowestFunding.FunderAddress, lowestFunding.Amount); err != nil { return err } @@ -27,10 +50,11 @@ func (k msgServer) defundLowestFunding( // Emit a defund event. _ = ctx.EventManager().EmitTypedEvent(&types.EventDefundPool{ - PoolId: poolId, + PoolId: fundingState.PoolId, Address: lowestFunding.FunderAddress, Amount: subtracted, }) + return nil } @@ -49,8 +73,7 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ } // Pool has to exist - err := k.poolKeeper.AssertPoolExists(ctx, msg.PoolId) - if err != nil { + if err := k.poolKeeper.AssertPoolExists(ctx, msg.PoolId); err != nil { return nil, err } @@ -80,6 +103,9 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ } } + // Check compatibility of updated funding with params + // i.e minimum funding per bundle + // and minimum funding amount params := k.GetParams(ctx) if funding.AmountPerBundle < params.MinFundingAmountPerBundle { return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrAmountPerBundleTooLow.Error(), params.MinFundingAmountPerBundle) @@ -88,48 +114,19 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrMinFundingAmount.Error(), params.MinFundingAmount) } - var defunding *types.Funding = nil - - activeFundings := k.GetActiveFundings(ctx, fundingState) - - // Check if funding limit is exceeded - if len(activeFundings) >= types.MaxFunders { - lowestFunding, err := k.GetLowestFunding(activeFundings) - if err != nil { - util.PanicHalt(k.upgradeKeeper, ctx, err.Error()) - } - - // Check if lowest funding is lower than new funding based on amount (amount per bundle is ignored) - if lowestFunding.Amount < funding.Amount { - // If so, check if lowest funding is from someone else - if lowestFunding.FunderAddress != funding.FunderAddress { - // Prepare to defund lowest funding - defunding = lowestFunding - } - } else { - return nil, errors.Wrapf(errorsTypes.ErrLogic, types.ErrFundsTooLow.Error(), lowestFunding.Amount) - } + // Kicks out lowest funder if all slots are taken and new funder is about to fund more. + // Otherwise, an error is thrown + // funding and fundingState are not written to the KV-Store. Everything else is handled safely. + if err := k.ensureFreeSlot(ctx, &funding, &fundingState); err != nil { + return nil, err } // User is allowed to fund // Let's see if he has enough funds if err := util.TransferFromAddressToModule(k.bankKeeper, ctx, msg.Creator, types.ModuleName, msg.Amount); err != nil { - // if err := util.TransferFromAddressToModule(k.bankKeeper, ctx, msg.Creator, "pool", msg.Amount); err != nil { return nil, err } - // Check if defunding is necessary - if defunding != nil { - err := k.defundLowestFunding(ctx, defunding, &fundingState, msg.PoolId) - if err != nil { - // TODO: should we panic here? - // This can only happen if: - // - we don't have enough funds which would be a corrupt state - // - the funder address is being blacklisted - util.PanicHalt(k.upgradeKeeper, ctx, err.Error()) - } - } - // Funding must be active fundingState.SetActive(&funding) From 07dd3b98bd568ab82c385c932e7bff923482f0b6 Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Fri, 27 Oct 2023 11:48:48 +0200 Subject: [PATCH 092/109] chore: add params compatibility check for defund --- x/funders/keeper/logic_funders.go | 64 +++++++++++++++++++ x/funders/keeper/msg_server_defund_pool.go | 8 ++- .../keeper/msg_server_defund_pool_test.go | 15 ++++- x/funders/keeper/msg_server_fund_pool.go | 63 ++---------------- 4 files changed, 87 insertions(+), 63 deletions(-) diff --git a/x/funders/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go index 705db393..7e850d84 100644 --- a/x/funders/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -97,3 +97,67 @@ func (k Keeper) GetLowestFunding(fundings []types.Funding) (lowestFunding *types } return &fundings[lowestFundingIndex], nil } + +// ensureParamsCompatibility checks compatibility of the provided funding with the pool params. +// i.e. minimum funding per bundle +// +// and minimum funding amount +func (k Keeper) ensureParamsCompatibility(ctx sdk.Context, funding types.Funding) error { + + params := k.GetParams(ctx) + if funding.AmountPerBundle < params.MinFundingAmountPerBundle { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrAmountPerBundleTooLow.Error(), params.MinFundingAmountPerBundle) + } + if funding.Amount < params.MinFundingAmount { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrMinFundingAmount.Error(), params.MinFundingAmount) + } + return nil +} + +// ensureFreeSlot makes sure that a funder can add funding to a given pool. +// If this is not possible an appropriate error is returned. +// A pool has a fixed amount of funding-slots. If there are still free slots +// a funder can just join (even with the smallest funding possible). +// If all slots are taken, it checks if the new funding has more funds +// than the current lowest funding in that pool. +// If so, the lowest funding gets removed from the pool, so that the +// new funding can be added. +// CONTRACT: no KV Writing on newFunding and fundingState +func (k Keeper) ensureFreeSlot(ctx sdk.Context, newFunding *types.Funding, fundingState *types.FundingState) error { + + activeFundings := k.GetActiveFundings(ctx, *fundingState) + // check if slots are still available + if len(activeFundings) < types.MaxFunders { + return nil + } + + lowestFunding, _ := k.GetLowestFunding(activeFundings) + + if lowestFunding.FunderAddress == newFunding.FunderAddress { + // Funder already has a funding slot + return nil + } + + // Check if lowest funding is lower than new funding based on amount (amount per bundle is ignored) + if newFunding.Amount < lowestFunding.Amount { + return errors.Wrapf(errorsTypes.ErrLogic, types.ErrFundsTooLow.Error(), lowestFunding.Amount) + } + + // Defund lowest funder + if err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, types.ModuleName, lowestFunding.FunderAddress, lowestFunding.Amount); err != nil { + return err + } + + subtracted := lowestFunding.SubtractAmount(lowestFunding.Amount) + fundingState.SetInactive(lowestFunding) + k.SetFunding(ctx, lowestFunding) + + // Emit a defund event. + _ = ctx.EventManager().EmitTypedEvent(&types.EventDefundPool{ + PoolId: fundingState.PoolId, + Address: lowestFunding.FunderAddress, + Amount: subtracted, + }) + + return nil +} diff --git a/x/funders/keeper/msg_server_defund_pool.go b/x/funders/keeper/msg_server_defund_pool.go index c2b413c2..1ad2c10c 100644 --- a/x/funders/keeper/msg_server_defund_pool.go +++ b/x/funders/keeper/msg_server_defund_pool.go @@ -12,9 +12,6 @@ import ( errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) -// TODO: Right now it is possible to fund a pool above the minimum funding amount and then defund it below the minimum funding amount. -// This should not be possible. We should probably add a check for this. - // DefundPool handles the logic to defund a pool. // If the user is a funder, it will subtract the provided amount // and send the tokens back. If there are no more funds left, the funding will get inactive. @@ -41,6 +38,11 @@ func (k msgServer) DefundPool(goCtx context.Context, msg *types.MsgDefundPool) ( amount := funding.SubtractAmount(msg.Amount) if funding.Amount == 0 { fundingState.SetInactive(&funding) + } else { + // If funding is not fully revoked, check if updated funding is still compatible with params. + if err := k.ensureParamsCompatibility(ctx, funding); err != nil { + return nil, err + } } // Transfer tokens from this module to sender. diff --git a/x/funders/keeper/msg_server_defund_pool_test.go b/x/funders/keeper/msg_server_defund_pool_test.go index 9bc5a204..4d738442 100644 --- a/x/funders/keeper/msg_server_defund_pool_test.go +++ b/x/funders/keeper/msg_server_defund_pool_test.go @@ -15,9 +15,10 @@ TEST CASES - msg_server_defund_pool.go * Defund 50 KYVE from a funder who has previously funded 100 KYVE * Defund more than actually funded * Defund full funding amount from a funder who has previously funded 100 KYVE -* Defund as highest funder 75 KYVE in order to be the lowest funder afterwards +* Defund as highest funder 75 KYVE in order to be the lowest funder afterward * Try to defund nonexistent fundings * Try to defund a funding twice +* Try to defund below minimum funding params (but not full defund) */ @@ -198,4 +199,16 @@ var _ = Describe("msg_server_defund_pool.go", Ordered, func() { Amount: 100 * i.KYVE, }) }) + + It("Try to defund below minimum funding params (but not full defund)", func() { + // ACT + _, err := s.RunTx(&types.MsgDefundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 100*i.KYVE - types.DefaultMinFundingAmount/2, + }) + + // ASSERT + Expect(err.Error()).To(Equal("minimum funding amount of 1000000000kyve not reached: invalid request")) + }) }) diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go index edfbac11..82a7736f 100644 --- a/x/funders/keeper/msg_server_fund_pool.go +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -10,54 +10,6 @@ import ( errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) -// ensureFreeSlot makes sure that a funder can add funding to a given pool. -// If this is not possible an appropriate error is returned. -// A pool has a fixed amount of funding-slots. If there are still free slots -// a funder can just join (even with the smallest funding possible). -// If all slots are taken, it checks if the new funding has more funds -// than the current lowest funding in that pool. -// If so, the lowest funding gets removed from the pool, so that the -// new funding can be added. -// CONTRACT: no KV Writing on newFunding and fundingState -func (k Keeper) ensureFreeSlot(ctx sdk.Context, newFunding *types.Funding, fundingState *types.FundingState) error { - - activeFundings := k.GetActiveFundings(ctx, *fundingState) - // check if slots are still available - if len(activeFundings) < types.MaxFunders { - return nil - } - - lowestFunding, _ := k.GetLowestFunding(activeFundings) - - if lowestFunding.FunderAddress == newFunding.FunderAddress { - // Funder already has a funding slot - return nil - } - - // Check if lowest funding is lower than new funding based on amount (amount per bundle is ignored) - if newFunding.Amount < lowestFunding.Amount { - return errors.Wrapf(errorsTypes.ErrLogic, types.ErrFundsTooLow.Error(), lowestFunding.Amount) - } - - // Defund lowest funder - if err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, types.ModuleName, lowestFunding.FunderAddress, lowestFunding.Amount); err != nil { - return err - } - - subtracted := lowestFunding.SubtractAmount(lowestFunding.Amount) - fundingState.SetInactive(lowestFunding) - k.SetFunding(ctx, lowestFunding) - - // Emit a defund event. - _ = ctx.EventManager().EmitTypedEvent(&types.EventDefundPool{ - PoolId: fundingState.PoolId, - Address: lowestFunding.FunderAddress, - Amount: subtracted, - }) - - return nil -} - // FundPool handles the logic to fund a pool. // A funder is added to the active funders list with the specified amount // If the funders list is full, it checks if the funder wants to fund @@ -103,15 +55,9 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ } } - // Check compatibility of updated funding with params - // i.e minimum funding per bundle - // and minimum funding amount - params := k.GetParams(ctx) - if funding.AmountPerBundle < params.MinFundingAmountPerBundle { - return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrAmountPerBundleTooLow.Error(), params.MinFundingAmountPerBundle) - } - if funding.Amount < params.MinFundingAmount { - return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrMinFundingAmount.Error(), params.MinFundingAmount) + // Check if updated (or new) funding is compatible with module params + if err := k.ensureParamsCompatibility(ctx, funding); err != nil { + return nil, err } // Kicks out lowest funder if all slots are taken and new funder is about to fund more. @@ -121,8 +67,7 @@ func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*typ return nil, err } - // User is allowed to fund - // Let's see if he has enough funds + // All checks passed, transfer funds from funder to module if err := util.TransferFromAddressToModule(k.bankKeeper, ctx, msg.Creator, types.ModuleName, msg.Amount); err != nil { return nil, err } From 2866707c57f0d6ed11a2a8c7ca31d718374b1943 Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Fri, 27 Oct 2023 16:19:58 +0200 Subject: [PATCH 093/109] feat: params upgrade message + new min_funding_multiple param --- docs/swagger.yml | 11 + proto/kyve/funders/v1beta1/events.proto | 15 +- proto/kyve/funders/v1beta1/params.proto | 4 + proto/kyve/funders/v1beta1/tx.proto | 18 + x/funders/keeper/msg_server_update_params.go | 35 ++ .../keeper/msg_server_update_params_test.go | 409 ++++++++++++++++ x/funders/types/events.pb.go | 347 ++++++++++++-- x/funders/types/msgs.go | 33 ++ x/funders/types/params.go | 14 +- x/funders/types/params.pb.go | 64 ++- x/funders/types/tx.pb.go | 451 ++++++++++++++++-- 11 files changed, 1324 insertions(+), 77 deletions(-) create mode 100644 x/funders/keeper/msg_server_update_params.go create mode 100644 x/funders/keeper/msg_server_update_params_test.go create mode 100644 x/funders/types/msgs.go diff --git a/docs/swagger.yml b/docs/swagger.yml index 63be8fb0..14b161cd 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -4518,6 +4518,17 @@ paths: type: string format: uint64 description: Minimum amount of tokens that can be funded per bundle. + min_funding_multiple: + type: string + format: uint64 + description: >- + Minimum ratio between the funded amount and the + amount_per_bundle. + + In other words this param ensures, that a funder provides + at least funding for + + `min_funding_multiple` bundles. description: QueryParamsResponse ... default: description: An unexpected error response. diff --git a/proto/kyve/funders/v1beta1/events.proto b/proto/kyve/funders/v1beta1/events.proto index 86e0feaf..a41f62d6 100644 --- a/proto/kyve/funders/v1beta1/events.proto +++ b/proto/kyve/funders/v1beta1/events.proto @@ -2,11 +2,22 @@ syntax = "proto3"; package kyve.funders.v1beta1; -//import "gogoproto/gogo.proto"; -//import "kyve/funders/v1beta1/params.proto"; +import "gogoproto/gogo.proto"; +import "kyve/funders/v1beta1/params.proto"; option go_package = "github.com/KYVENetwork/chain/x/funders/types"; +// EventUpdateParams is an event emitted when the module parameters are updated. +// emitted_by: MsgUpdateParams +message EventUpdateParams { + // old_params is the module's old parameters. + Params old_params = 1 [(gogoproto.nullable) = false]; + // new_params is the module's new parameters. + Params new_params = 2 [(gogoproto.nullable) = false]; + // payload is the parameter updates that were performed. + string payload = 3; +} + // EventCreateFunder is an event emitted when a funder is created. // emitted_by: MsgCreateFunder message EventCreateFunder { diff --git a/proto/kyve/funders/v1beta1/params.proto b/proto/kyve/funders/v1beta1/params.proto index eb8a1b4d..df0acccc 100644 --- a/proto/kyve/funders/v1beta1/params.proto +++ b/proto/kyve/funders/v1beta1/params.proto @@ -10,4 +10,8 @@ message Params { uint64 min_funding_amount = 1; // Minimum amount of tokens that can be funded per bundle. uint64 min_funding_amount_per_bundle = 2; + // Minimum ratio between the funded amount and the amount_per_bundle. + // In other words this param ensures, that a funder provides at least funding for + // `min_funding_multiple` bundles. + uint64 min_funding_multiple = 3; } diff --git a/proto/kyve/funders/v1beta1/tx.proto b/proto/kyve/funders/v1beta1/tx.proto index 7539a9ee..98baf0a9 100644 --- a/proto/kyve/funders/v1beta1/tx.proto +++ b/proto/kyve/funders/v1beta1/tx.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package kyve.funders.v1beta1; +import "cosmos_proto/cosmos.proto"; + option go_package = "github.com/KYVENetwork/chain/x/funders/types"; // Msg defines the Msg service. @@ -14,6 +16,10 @@ service Msg { rpc FundPool(MsgFundPool) returns (MsgFundPoolResponse); // DefundPool ... rpc DefundPool(MsgDefundPool) returns (MsgDefundPoolResponse); + + // UpdateParams defines a governance operation for updating the x/delegation module + // parameters. The authority is hard-coded to the x/gov module account. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgCreateFunder defines a SDK message for creating a funder. @@ -81,3 +87,15 @@ message MsgDefundPool { // MsgDefundPoolResponse defines the Msg/DefundPool response type. message MsgDefundPoolResponse {} + +// MsgUpdateParams defines a SDK message for updating the module parameters. +message MsgUpdateParams { + // authority is the address of the governance account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // payload defines the x/delegation parameters to update. + string payload = 2; +} + +// MsgUpdateParamsResponse defines the Msg/UpdateParams response type. +message MsgUpdateParamsResponse {} diff --git a/x/funders/keeper/msg_server_update_params.go b/x/funders/keeper/msg_server_update_params.go new file mode 100644 index 00000000..0872cc62 --- /dev/null +++ b/x/funders/keeper/msg_server_update_params.go @@ -0,0 +1,35 @@ +package keeper + +import ( + "context" + "encoding/json" + + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + // Delegation + "github.com/KYVENetwork/chain/x/funders/types" + // Gov + govTypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if k.authority != msg.Authority { + return nil, errors.Wrapf(govTypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + oldParams := k.GetParams(ctx) + + newParams := oldParams + _ = json.Unmarshal([]byte(msg.Payload), &newParams) + k.SetParams(ctx, newParams) + + _ = ctx.EventManager().EmitTypedEvent(&types.EventUpdateParams{ + OldParams: oldParams, + NewParams: newParams, + Payload: msg.Payload, + }) + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/funders/keeper/msg_server_update_params_test.go b/x/funders/keeper/msg_server_update_params_test.go new file mode 100644 index 00000000..c60aaccc --- /dev/null +++ b/x/funders/keeper/msg_server_update_params_test.go @@ -0,0 +1,409 @@ +package keeper_test + +import ( + i "github.com/KYVENetwork/chain/testutil/integration" + sdk "github.com/cosmos/cosmos-sdk/types" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + // Delegation + "github.com/KYVENetwork/chain/x/funders/types" + // Gov + govV1Types "github.com/cosmos/cosmos-sdk/x/gov/types/v1" +) + +/* + +TEST CASES - msg_server_update_params.go + +* Check default params +* Invalid authority (transaction) +* Invalid authority (proposal) +* Update every param at once +* Update no param +* Update with invalid formatted payload + +* Update min-funding-amount +* Update min-funding-amount with invalid value + +* Update min-funding-amount-per-bundle +* Update min-funding-amount-per-bundle with invalid value + +* Update min-funding-multiple +* Update min-funding-multiple with invalid value + +*/ + +var _ = Describe("msg_server_update_params.go", Ordered, func() { + s := i.NewCleanChain() + + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + + minDeposit := s.App().GovKeeper.GetParams(s.Ctx()).MinDeposit + votingPeriod := s.App().GovKeeper.GetParams(s.Ctx()).VotingPeriod + + delegations := s.App().StakingKeeper.GetAllDelegations(s.Ctx()) + voter := sdk.MustAccAddressFromBech32(delegations[0].DelegatorAddress) + + BeforeEach(func() { + s = i.NewCleanChain() + + delegations := s.App().StakingKeeper.GetAllDelegations(s.Ctx()) + voter = sdk.MustAccAddressFromBech32(delegations[0].DelegatorAddress) + }) + + AfterEach(func() { + s.PerformValidityChecks() + }) + + It("Check default params", func() { + // ASSERT + params := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(params.MinFundingAmount).To(Equal(types.DefaultMinFundingAmount)) + Expect(params.MinFundingAmountPerBundle).To(Equal(types.DefaultMinFundingAmountPerBundle)) + Expect(params.MinFundingMultiple).To(Equal(types.DefaultMinFundingMultiple)) + }) + + It("Invalid authority (transaction)", func() { + // ARRANGE + msg := &types.MsgUpdateParams{ + Authority: i.DUMMY[0], + Payload: "{}", + } + + // ACT + _, err := s.RunTx(msg) + + // ASSERT + Expect(err).To(HaveOccurred()) + }) + + It("Invalid authority (proposal)", func() { + // ARRANGE + msg := &types.MsgUpdateParams{ + Authority: i.DUMMY[0], + Payload: "{}", + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + // ACT + _, err := s.RunTx(proposal) + + // ASSERT + Expect(err).To(HaveOccurred()) + }) + + It("Update every param at once", func() { + // ARRANGE + payload := `{ + "min_funding_amount": 2000000000, + "min_funding_amount_per_bundle": 500000, + "min_funding_multiple": 25 + }` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + vote := govV1Types.NewMsgVote( + voter, 1, govV1Types.VoteOption_VOTE_OPTION_YES, "", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + _, voteErr := s.RunTx(vote) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).NotTo(HaveOccurred()) + Expect(voteErr).NotTo(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(uint64(2_000_000_000))) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(uint64(500_000))) + Expect(updatedParams.MinFundingMultiple).To(Equal(uint64(25))) + }) + + It("Update no param", func() { + // ARRANGE + payload := `{}` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + vote := govV1Types.NewMsgVote( + voter, 1, govV1Types.VoteOption_VOTE_OPTION_YES, "", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + _, voteErr := s.RunTx(vote) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).NotTo(HaveOccurred()) + Expect(voteErr).NotTo(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(types.DefaultMinFundingAmount)) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(types.DefaultMinFundingAmountPerBundle)) + Expect(updatedParams.MinFundingMultiple).To(Equal(types.DefaultMinFundingMultiple)) + }) + + It("Update with invalid formatted payload", func() { + // ARRANGE + payload := `{ + "min_funding_amount": abc, + }` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).To(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(types.DefaultMinFundingAmount)) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(types.DefaultMinFundingAmountPerBundle)) + Expect(updatedParams.MinFundingMultiple).To(Equal(types.DefaultMinFundingMultiple)) + }) + + It("Update min-funding-amount", func() { + // ARRANGE + payload := `{ + "min_funding_amount": 100000000 + }` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + vote := govV1Types.NewMsgVote( + voter, 1, govV1Types.VoteOption_VOTE_OPTION_YES, "", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + _, voteErr := s.RunTx(vote) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).NotTo(HaveOccurred()) + Expect(voteErr).NotTo(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(uint64(100_000_000))) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(types.DefaultMinFundingAmountPerBundle)) + Expect(updatedParams.MinFundingMultiple).To(Equal(types.DefaultMinFundingMultiple)) + }) + + It("Update min-funding-amount with invalid value", func() { + // ARRANGE + payload := `{ + "min_funding_amount": "invalid" + }` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).To(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(types.DefaultMinFundingAmount)) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(types.DefaultMinFundingAmountPerBundle)) + Expect(updatedParams.MinFundingMultiple).To(Equal(types.DefaultMinFundingMultiple)) + }) + + It("min-funding-amount-per-bundle", func() { + // ARRANGE + payload := `{ + "min_funding_amount_per_bundle": 300000 + }` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + vote := govV1Types.NewMsgVote( + voter, 1, govV1Types.VoteOption_VOTE_OPTION_YES, "", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + _, voteErr := s.RunTx(vote) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).NotTo(HaveOccurred()) + Expect(voteErr).NotTo(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(types.DefaultMinFundingAmount)) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(uint64(300000))) + Expect(updatedParams.MinFundingMultiple).To(Equal(types.DefaultMinFundingMultiple)) + }) + + It("Update min-funding-amount-per-bundle", func() { + // ARRANGE + payload := `{ + "min_funding_amount_per_bundle": "invalid" + }` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).To(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(types.DefaultMinFundingAmount)) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(types.DefaultMinFundingAmountPerBundle)) + Expect(updatedParams.MinFundingMultiple).To(Equal(types.DefaultMinFundingMultiple)) + }) + + It("Update min-funding-multiple", func() { + // ARRANGE + payload := `{ + "min_funding_multiple": 9 + }` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + vote := govV1Types.NewMsgVote( + voter, 1, govV1Types.VoteOption_VOTE_OPTION_YES, "", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + _, voteErr := s.RunTx(vote) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).NotTo(HaveOccurred()) + Expect(voteErr).NotTo(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(types.DefaultMinFundingAmount)) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(types.DefaultMinFundingAmountPerBundle)) + Expect(updatedParams.MinFundingMultiple).To(Equal(uint64(9))) + }) + + It("Update min-funding-multiple with invalid value", func() { + // ARRANGE + payload := `{ + "min_funding_multiple": -1 + }` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).To(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(types.DefaultMinFundingAmount)) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(types.DefaultMinFundingAmountPerBundle)) + Expect(updatedParams.MinFundingMultiple).To(Equal(types.DefaultMinFundingMultiple)) + }) +}) diff --git a/x/funders/types/events.pb.go b/x/funders/types/events.pb.go index a67955ab..d88c886d 100644 --- a/x/funders/types/events.pb.go +++ b/x/funders/types/events.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" math "math" @@ -22,6 +23,71 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// EventUpdateParams is an event emitted when the module parameters are updated. +// emitted_by: MsgUpdateParams +type EventUpdateParams struct { + // old_params is the module's old parameters. + OldParams Params `protobuf:"bytes,1,opt,name=old_params,json=oldParams,proto3" json:"old_params"` + // new_params is the module's new parameters. + NewParams Params `protobuf:"bytes,2,opt,name=new_params,json=newParams,proto3" json:"new_params"` + // payload is the parameter updates that were performed. + Payload string `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (m *EventUpdateParams) Reset() { *m = EventUpdateParams{} } +func (m *EventUpdateParams) String() string { return proto.CompactTextString(m) } +func (*EventUpdateParams) ProtoMessage() {} +func (*EventUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_1cf957abd56bbcb0, []int{0} +} +func (m *EventUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventUpdateParams.Merge(m, src) +} +func (m *EventUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *EventUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_EventUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_EventUpdateParams proto.InternalMessageInfo + +func (m *EventUpdateParams) GetOldParams() Params { + if m != nil { + return m.OldParams + } + return Params{} +} + +func (m *EventUpdateParams) GetNewParams() Params { + if m != nil { + return m.NewParams + } + return Params{} +} + +func (m *EventUpdateParams) GetPayload() string { + if m != nil { + return m.Payload + } + return "" +} + // EventCreateFunder is an event emitted when a funder is created. // emitted_by: MsgCreateFunder type EventCreateFunder struct { @@ -43,7 +109,7 @@ func (m *EventCreateFunder) Reset() { *m = EventCreateFunder{} } func (m *EventCreateFunder) String() string { return proto.CompactTextString(m) } func (*EventCreateFunder) ProtoMessage() {} func (*EventCreateFunder) Descriptor() ([]byte, []int) { - return fileDescriptor_1cf957abd56bbcb0, []int{0} + return fileDescriptor_1cf957abd56bbcb0, []int{1} } func (m *EventCreateFunder) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -135,7 +201,7 @@ func (m *EventUpdateFunder) Reset() { *m = EventUpdateFunder{} } func (m *EventUpdateFunder) String() string { return proto.CompactTextString(m) } func (*EventUpdateFunder) ProtoMessage() {} func (*EventUpdateFunder) Descriptor() ([]byte, []int) { - return fileDescriptor_1cf957abd56bbcb0, []int{1} + return fileDescriptor_1cf957abd56bbcb0, []int{2} } func (m *EventUpdateFunder) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -223,7 +289,7 @@ func (m *EventFundPool) Reset() { *m = EventFundPool{} } func (m *EventFundPool) String() string { return proto.CompactTextString(m) } func (*EventFundPool) ProtoMessage() {} func (*EventFundPool) Descriptor() ([]byte, []int) { - return fileDescriptor_1cf957abd56bbcb0, []int{2} + return fileDescriptor_1cf957abd56bbcb0, []int{3} } func (m *EventFundPool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -295,7 +361,7 @@ func (m *EventDefundPool) Reset() { *m = EventDefundPool{} } func (m *EventDefundPool) String() string { return proto.CompactTextString(m) } func (*EventDefundPool) ProtoMessage() {} func (*EventDefundPool) Descriptor() ([]byte, []int) { - return fileDescriptor_1cf957abd56bbcb0, []int{3} + return fileDescriptor_1cf957abd56bbcb0, []int{4} } func (m *EventDefundPool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -356,7 +422,7 @@ func (m *EventPoolOutOfFunds) Reset() { *m = EventPoolOutOfFunds{} } func (m *EventPoolOutOfFunds) String() string { return proto.CompactTextString(m) } func (*EventPoolOutOfFunds) ProtoMessage() {} func (*EventPoolOutOfFunds) Descriptor() ([]byte, []int) { - return fileDescriptor_1cf957abd56bbcb0, []int{4} + return fileDescriptor_1cf957abd56bbcb0, []int{5} } func (m *EventPoolOutOfFunds) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -393,6 +459,7 @@ func (m *EventPoolOutOfFunds) GetPoolId() uint64 { } func init() { + proto.RegisterType((*EventUpdateParams)(nil), "kyve.funders.v1beta1.EventUpdateParams") proto.RegisterType((*EventCreateFunder)(nil), "kyve.funders.v1beta1.EventCreateFunder") proto.RegisterType((*EventUpdateFunder)(nil), "kyve.funders.v1beta1.EventUpdateFunder") proto.RegisterType((*EventFundPool)(nil), "kyve.funders.v1beta1.EventFundPool") @@ -403,31 +470,86 @@ func init() { func init() { proto.RegisterFile("kyve/funders/v1beta1/events.proto", fileDescriptor_1cf957abd56bbcb0) } var fileDescriptor_1cf957abd56bbcb0 = []byte{ - // 373 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x92, 0xc1, 0x4a, 0xe3, 0x40, - 0x18, 0xc7, 0x9b, 0x6e, 0x36, 0xdd, 0x9d, 0x65, 0x29, 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4f, - 0x33, 0xfa, 0xd1, 0xdc, 0x6f, 0x2c, 0xf2, 0xdd, 0xb8, 0x6b, 0xeb, 0x81, 0x10, 0x53, 0xf7, 0x37, - 0xa9, 0x65, 0x42, 0x4c, 0x87, 0x8c, 0x1a, 0x6f, 0x3b, 0x72, 0x74, 0x3c, 0xa2, 0xbb, 0x03, 0x55, - 0x5f, 0x0f, 0xf4, 0x8b, 0x38, 0xf1, 0x4c, 0xe4, 0x1c, 0x8d, 0xb4, 0x1d, 0x95, 0xc9, 0xfd, 0x4f, - 0x1a, 0xc5, 0xd7, 0x30, 0x03, 0x39, 0x4c, 0x72, 0x4e, 0xa7, 0x85, 0xbc, 0x1d, 0xd5, 0x0b, 0x30, - 0x00, 0xd9, 0x31, 0xc7, 0xad, 0x4b, 0x52, 0x37, 0x1e, 0x87, 0x30, 0x7a, 0x7f, 0x93, 0x56, 0x40, - 0x7e, 0x98, 0xd7, 0xf5, 0xbb, 0xfd, 0x1c, 0xfb, 0x23, 0x3d, 0xae, 0x7a, 0xf3, 0x0f, 0x9d, 0xde, - 0xfd, 0xda, 0xb7, 0x56, 0x6b, 0xdf, 0x7a, 0x5c, 0xfb, 0xd6, 0xed, 0xc6, 0xaf, 0xac, 0x36, 0x7e, - 0xe5, 0x61, 0xe3, 0x57, 0x2e, 0xf6, 0xae, 0x18, 0x8e, 0xf3, 0x24, 0x48, 0xc5, 0x2c, 0x3c, 0x3e, - 0x3f, 0xeb, 0x9e, 0x00, 0x2e, 0x84, 0x9c, 0x84, 0xe9, 0x38, 0x66, 0x3c, 0xbc, 0xde, 0xee, 0x3e, - 0x2e, 0x33, 0x50, 0x89, 0x63, 0x76, 0x7e, 0xff, 0x29, 0x00, 0x00, 0xff, 0xff, 0x41, 0xe2, 0x8e, - 0xb0, 0x18, 0x03, 0x00, 0x00, + // 460 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x93, 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 0x27, 0x53, 0xbd, 0x6e, 0xf5, + 0xd7, 0x09, 0xa3, 0xe3, 0xb3, 0x75, 0xe4, 0x9d, 0xaf, 0x23, 0xef, 0xd7, 0x3a, 0xf2, 0xbe, 0x6e, + 0xa2, 0xce, 0xf9, 0x26, 0xea, 0xfc, 0xd8, 0x44, 0x9d, 0x8f, 0x4f, 0x67, 0x5c, 0x9d, 0xd6, 0x59, + 0x9c, 0xe3, 0x22, 0x79, 0xf3, 0xe1, 0xfd, 0xd1, 0x5b, 0x50, 0x2b, 0x94, 0xf3, 0x24, 0x3f, 0xa5, + 0x5c, 0x24, 0x9f, 0x2f, 0xde, 0xa6, 0x6a, 0x4a, 0xa8, 0xb2, 0xae, 0x79, 0x93, 0xcf, 0x7f, 0x07, + 0x00, 0x00, 0xff, 0xff, 0xfe, 0x83, 0x31, 0xec, 0x07, 0x04, 0x00, 0x00, +} + +func (m *EventUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0x1a + } + { + size, err := m.NewParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.OldParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *EventCreateFunder) Marshal() (dAtA []byte, err error) { @@ -684,6 +806,23 @@ func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *EventUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.OldParams.Size() + n += 1 + l + sovEvents(uint64(l)) + l = m.NewParams.Size() + n += 1 + l + sovEvents(uint64(l)) + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + func (m *EventCreateFunder) Size() (n int) { if m == nil { return 0 @@ -809,6 +948,154 @@ func sovEvents(x uint64) (n int) { func sozEvents(x uint64) (n int) { return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *EventUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OldParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OldParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.NewParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *EventCreateFunder) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/funders/types/msgs.go b/x/funders/types/msgs.go new file mode 100644 index 00000000..77d512f0 --- /dev/null +++ b/x/funders/types/msgs.go @@ -0,0 +1,33 @@ +package types + +import ( + "cosmossdk.io/errors" + "encoding/json" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errors.Wrap(err, "invalid authority address") + } + + params := DefaultParams() + if err := json.Unmarshal([]byte(msg.Payload), ¶ms); err != nil { + return err + } + + if err := params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/funders/types/params.go b/x/funders/types/params.go index 0a9047f1..c87c8599 100644 --- a/x/funders/types/params.go +++ b/x/funders/types/params.go @@ -7,15 +7,18 @@ import ( const ( // DefaultMinFundingAmount 1000 Kyve DefaultMinFundingAmount = uint64(1_000_000_000) - // DefaultMinFundingAmountPerBundle 1 Kyve - DefaultMinFundingAmountPerBundle = uint64(1_000_000) + // DefaultMinFundingAmountPerBundle 0.1 Kyve + DefaultMinFundingAmountPerBundle = uint64(100_000) + // DefaultMinFundingMultiple 20 + DefaultMinFundingMultiple = uint64(20) ) // NewParams creates a new Params instance -func NewParams(minFundingAmount uint64, minFundingAmountPerBundle uint64) Params { +func NewParams(minFundingAmount uint64, minFundingAmountPerBundle uint64, minFundingMultiple uint64) Params { return Params{ MinFundingAmount: minFundingAmount, MinFundingAmountPerBundle: minFundingAmountPerBundle, + MinFundingMultiple: minFundingMultiple, } } @@ -24,6 +27,7 @@ func DefaultParams() Params { return NewParams( DefaultMinFundingAmount, DefaultMinFundingAmountPerBundle, + DefaultMinFundingMultiple, ) } @@ -37,5 +41,9 @@ func (p *Params) Validate() error { return err } + if err := util.ValidateNumber(p.MinFundingAmountPerBundle); err != nil { + return err + } + return nil } diff --git a/x/funders/types/params.pb.go b/x/funders/types/params.pb.go index 89c13171..adf8da11 100644 --- a/x/funders/types/params.pb.go +++ b/x/funders/types/params.pb.go @@ -28,6 +28,10 @@ type Params struct { MinFundingAmount uint64 `protobuf:"varint,1,opt,name=min_funding_amount,json=minFundingAmount,proto3" json:"min_funding_amount,omitempty"` // Minimum amount of tokens that can be funded per bundle. MinFundingAmountPerBundle uint64 `protobuf:"varint,2,opt,name=min_funding_amount_per_bundle,json=minFundingAmountPerBundle,proto3" json:"min_funding_amount_per_bundle,omitempty"` + // Minimum ratio between the funded amount and the amount_per_bundle. + // In other words this param ensures, that a funder provides at least funding for + // `min_funding_multiple` bundles. + MinFundingMultiple uint64 `protobuf:"varint,3,opt,name=min_funding_multiple,json=minFundingMultiple,proto3" json:"min_funding_multiple,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -77,6 +81,13 @@ func (m *Params) GetMinFundingAmountPerBundle() uint64 { return 0 } +func (m *Params) GetMinFundingMultiple() uint64 { + if m != nil { + return m.MinFundingMultiple + } + return 0 +} + func init() { proto.RegisterType((*Params)(nil), "kyve.funders.v1beta1.Params") } @@ -84,21 +95,23 @@ func init() { func init() { proto.RegisterFile("kyve/funders/v1beta1/params.proto", fileDescriptor_906a9a55094dc984) } var fileDescriptor_906a9a55094dc984 = []byte{ - // 215 bytes of a gzipped FileDescriptorProto + // 241 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcc, 0xae, 0x2c, 0x4b, 0xd5, 0x4f, 0x2b, 0xcd, 0x4b, 0x49, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, - 0x29, 0xd1, 0x83, 0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, 0x94, 0x9b, 0x99, 0x17, 0x0f, 0x52, 0x91, 0x99, 0x97, 0x1e, 0x9f, 0x98, 0x9b, + 0x5f, 0x9a, 0x57, 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x12, 0x24, 0x90, 0x9b, 0x99, 0xe7, 0x06, + 0x91, 0x70, 0x04, 0x8b, 0x0b, 0x39, 0x70, 0xc9, 0x62, 0xaa, 0x8e, 0x2f, 0x48, 0x2d, 0x8a, 0x4f, + 0x2a, 0xcd, 0x4b, 0xc9, 0x49, 0x95, 0x60, 0x02, 0x6b, 0x94, 0x44, 0xd7, 0x18, 0x90, 0x5a, 0xe4, + 0x04, 0x56, 0x20, 0x64, 0xc0, 0x25, 0x82, 0x6c, 0x42, 0x6e, 0x69, 0x4e, 0x49, 0x66, 0x41, 0x4e, + 0xaa, 0x04, 0x33, 0x58, 0xa3, 0x10, 0x42, 0xa3, 0x2f, 0x54, 0xc6, 0xc9, 0xed, 0xc4, 0x23, 0x39, + 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, + 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x74, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, + 0xf3, 0x73, 0xf5, 0xbd, 0x23, 0xc3, 0x5c, 0xfd, 0x52, 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0xf5, 0x93, + 0x33, 0x12, 0x33, 0xf3, 0xf4, 0x2b, 0xe0, 0x21, 0x53, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, + 0x0e, 0x11, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x66, 0xb6, 0xfa, 0xe0, 0x36, 0x01, 0x00, + 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -121,6 +134,11 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.MinFundingMultiple != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MinFundingMultiple)) + i-- + dAtA[i] = 0x18 + } if m.MinFundingAmountPerBundle != 0 { i = encodeVarintParams(dAtA, i, uint64(m.MinFundingAmountPerBundle)) i-- @@ -157,6 +175,9 @@ func (m *Params) Size() (n int) { if m.MinFundingAmountPerBundle != 0 { n += 1 + sovParams(uint64(m.MinFundingAmountPerBundle)) } + if m.MinFundingMultiple != 0 { + n += 1 + sovParams(uint64(m.MinFundingMultiple)) + } return n } @@ -233,6 +254,25 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinFundingMultiple", wireType) + } + m.MinFundingMultiple = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinFundingMultiple |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/funders/types/tx.pb.go b/x/funders/types/tx.pb.go index 779d0930..93061955 100644 --- a/x/funders/types/tx.pb.go +++ b/x/funders/types/tx.pb.go @@ -6,6 +6,7 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" @@ -494,6 +495,98 @@ func (m *MsgDefundPoolResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDefundPoolResponse proto.InternalMessageInfo +// MsgUpdateParams defines a SDK message for updating the module parameters. +type MsgUpdateParams struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // payload defines the x/delegation parameters to update. + Payload string `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_5145d80c2db97f3d, []int{8} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetPayload() string { + if m != nil { + return m.Payload + } + return "" +} + +// MsgUpdateParamsResponse defines the Msg/UpdateParams response type. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5145d80c2db97f3d, []int{9} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgCreateFunder)(nil), "kyve.funders.v1beta1.MsgCreateFunder") proto.RegisterType((*MsgCreateFunderResponse)(nil), "kyve.funders.v1beta1.MsgCreateFunderResponse") @@ -503,41 +596,49 @@ func init() { proto.RegisterType((*MsgFundPoolResponse)(nil), "kyve.funders.v1beta1.MsgFundPoolResponse") proto.RegisterType((*MsgDefundPool)(nil), "kyve.funders.v1beta1.MsgDefundPool") proto.RegisterType((*MsgDefundPoolResponse)(nil), "kyve.funders.v1beta1.MsgDefundPoolResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "kyve.funders.v1beta1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "kyve.funders.v1beta1.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("kyve/funders/v1beta1/tx.proto", fileDescriptor_5145d80c2db97f3d) } var fileDescriptor_5145d80c2db97f3d = []byte{ - // 460 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0x8d, 0x49, 0x48, 0xcb, 0x14, 0x54, 0xb1, 0x50, 0x62, 0x22, 0x61, 0x95, 0x20, 0x24, 0x3e, - 0x6d, 0x15, 0xfe, 0x41, 0x81, 0x4a, 0x08, 0x19, 0x55, 0x96, 0x40, 0xd0, 0x03, 0x91, 0xed, 0x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c, 0x61, 0xfa, 0x20, 0x8b, 0xdc, - 0x58, 0x4c, 0xbc, 0x77, 0x9f, 0x3f, 0xbe, 0x79, 0x8f, 0xfa, 0x48, 0xc8, 0x91, 0x17, 0x1f, 0x84, - 0x8c, 0x7b, 0xc7, 0xf5, 0x3f, 0x4b, 0x4f, 0x53, 0x54, 0x51, 0xd7, 0xfc, 0xaf, 0x5e, 0xfe, 0x09, - 0x00, 0x00, 0xff, 0xff, 0x13, 0xc6, 0x11, 0x5c, 0xd0, 0x04, 0x00, 0x00, + // 547 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xdd, 0x6e, 0xd3, 0x30, + 0x18, 0x6d, 0x68, 0xe9, 0x36, 0x0f, 0x34, 0x11, 0x36, 0x9a, 0x55, 0x22, 0x1a, 0x45, 0x48, 0xfc, + 0x2d, 0xd1, 0x40, 0xe2, 0x9e, 0x02, 0x93, 0x10, 0x2a, 0xaa, 0x82, 0x40, 0xb0, 0x0b, 0x2a, 0x27, + 0xf6, 0x52, 0xab, 0x8d, 0x1d, 0xd9, 0xce, 0xb6, 0xde, 0xf3, 0x00, 0x3c, 0x0c, 0x12, 0xaf, 0xc0, + 0xe5, 0xc4, 0x15, 0x97, 0xa8, 0x7d, 0x02, 0xde, 0x00, 0xc5, 0x4e, 0xb2, 0x64, 0xac, 0xeb, 0x2e, + 0xb8, 0xd9, 0x5d, 0x8e, 0xcf, 0xf9, 0x72, 0xbe, 0xcf, 0xdf, 0x49, 0xc0, 0xed, 0xd1, 0xe4, 0x00, + 0xbb, 0xfb, 0x09, 0x45, 0x98, 0x0b, 0xf7, 0x60, 0xc7, 0xc7, 0x12, 0xee, 0xb8, 0xf2, 0xc8, 0x89, + 0x39, 0x93, 0xcc, 0x5c, 0x4f, 0x69, 0x27, 0xa3, 0x9d, 0x8c, 0x6e, 0x6f, 0x06, 0x4c, 0x44, 0x4c, + 0x0c, 0x94, 0xc6, 0xd5, 0x40, 0x17, 0x74, 0xbe, 0x1b, 0x60, 0xad, 0x27, 0xc2, 0x17, 0x1c, 0x43, + 0x89, 0x77, 0x55, 0x9d, 0x69, 0x81, 0xa5, 0x20, 0xc5, 0x8c, 0x5b, 0xc6, 0x96, 0x71, 0x7f, 0xc5, + 0xcb, 0x61, 0xca, 0x44, 0x8c, 0x92, 0x11, 0xe6, 0xd6, 0x15, 0xcd, 0x64, 0xd0, 0x6c, 0x83, 0x65, + 0x82, 0x30, 0x95, 0x44, 0x4e, 0xac, 0xba, 0xa2, 0x0a, 0x9c, 0x56, 0x1d, 0x62, 0x5f, 0x10, 0x89, + 0xad, 0x86, 0xae, 0xca, 0xa0, 0x72, 0x62, 0x54, 0xc2, 0x40, 0x5a, 0x57, 0x33, 0x27, 0x0d, 0xcd, + 0x2d, 0xb0, 0x8a, 0xb0, 0x08, 0x38, 0x89, 0x25, 0x61, 0xd4, 0x6a, 0x2a, 0xb6, 0x7c, 0xd4, 0xd9, + 0x04, 0xad, 0x53, 0x8d, 0x7b, 0x58, 0xc4, 0x8c, 0x0a, 0x9c, 0x0f, 0xf5, 0x3e, 0x46, 0x97, 0x73, + 0xa8, 0x72, 0xe3, 0xc5, 0x50, 0x5f, 0x0c, 0xb0, 0xda, 0x13, 0x61, 0x7a, 0xda, 0x67, 0x6c, 0x7c, + 0xce, 0x40, 0x2d, 0xb0, 0x14, 0x33, 0x36, 0x1e, 0x10, 0xa4, 0x06, 0x6a, 0x78, 0xcd, 0x14, 0xbe, + 0x46, 0xe6, 0x2d, 0xd0, 0x84, 0x11, 0x4b, 0xa8, 0x54, 0xd3, 0x34, 0xbc, 0x0c, 0x99, 0x0f, 0xc1, + 0x0d, 0xfd, 0x34, 0x88, 0x31, 0x1f, 0xf8, 0x09, 0x45, 0x63, 0x3d, 0x55, 0xc3, 0x5b, 0xd3, 0x44, + 0x1f, 0xf3, 0xae, 0x3a, 0xee, 0x6c, 0x80, 0x9b, 0xa5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33, 0xbb, 0xb6, + 0xf7, 0x38, 0x24, 0x72, 0x98, 0xf8, 0x4e, 0xc0, 0x22, 0xf7, 0xcd, 0xa7, 0x0f, 0xaf, 0xde, 0x62, + 0x79, 0xc8, 0xf8, 0xc8, 0x0d, 0x86, 0x90, 0x50, 0xf7, 0xa8, 0xf8, 0x69, 0xcb, 0x49, 0x8c, 0x85, + 0xdf, 0x54, 0xff, 0xdf, 0xa7, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x1d, 0xaa, 0xbb, 0x16, 0xd1, + 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -560,6 +661,9 @@ type MsgClient interface { FundPool(ctx context.Context, in *MsgFundPool, opts ...grpc.CallOption) (*MsgFundPoolResponse, error) // DefundPool ... DefundPool(ctx context.Context, in *MsgDefundPool, opts ...grpc.CallOption) (*MsgDefundPoolResponse, error) + // UpdateParams defines a governance operation for updating the x/delegation module + // parameters. The authority is hard-coded to the x/gov module account. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -606,6 +710,15 @@ func (c *msgClient) DefundPool(ctx context.Context, in *MsgDefundPool, opts ...g return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/kyve.funders.v1beta1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // CreateFunder ... @@ -616,6 +729,9 @@ type MsgServer interface { FundPool(context.Context, *MsgFundPool) (*MsgFundPoolResponse, error) // DefundPool ... DefundPool(context.Context, *MsgDefundPool) (*MsgDefundPoolResponse, error) + // UpdateParams defines a governance operation for updating the x/delegation module + // parameters. The authority is hard-coded to the x/gov module account. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -634,6 +750,9 @@ func (*UnimplementedMsgServer) FundPool(ctx context.Context, req *MsgFundPool) ( func (*UnimplementedMsgServer) DefundPool(ctx context.Context, req *MsgDefundPool) (*MsgDefundPoolResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DefundPool not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -711,6 +830,24 @@ func _Msg_DefundPool_Handler(srv interface{}, ctx context.Context, dec func(inte return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kyve.funders.v1beta1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kyve.funders.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -731,6 +868,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "DefundPool", Handler: _Msg_DefundPool_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "kyve/funders/v1beta1/tx.proto", @@ -1043,6 +1184,66 @@ func (m *MsgDefundPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintTx(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1197,6 +1398,32 @@ func (m *MsgDefundPoolResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2146,6 +2373,170 @@ func (m *MsgDefundPoolResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From de41f2a4b6986b1d899391650f908da3fa8b5dc4 Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Fri, 27 Oct 2023 17:27:20 +0200 Subject: [PATCH 094/109] chore: add logic for funding multiple --- .../keeper/keeper_suite_funding_bundles_test.go | 4 ++++ .../keeper_suite_inflation_splitting_test.go | 1 + x/funders/keeper/logic_funders.go | 5 +++-- x/funders/keeper/logic_funders_test.go | 4 ++++ x/funders/keeper/msg_server_fund_pool.go | 1 - x/funders/keeper/msg_server_fund_pool_test.go | 15 +++++++++++++++ x/funders/types/errors.go | 16 ++++++++-------- x/funders/types/msgs.go | 4 +++- 8 files changed, 38 insertions(+), 12 deletions(-) diff --git a/x/bundles/keeper/keeper_suite_funding_bundles_test.go b/x/bundles/keeper/keeper_suite_funding_bundles_test.go index 25bf36e7..7f5adafa 100644 --- a/x/bundles/keeper/keeper_suite_funding_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_funding_bundles_test.go @@ -33,6 +33,10 @@ var _ = Describe("funding bundles", Ordered, func() { // init new clean chain s = i.NewCleanChain() + params := s.App().FundersKeeper.GetParams(s.Ctx()) + params.MinFundingMultiple = 0 + s.App().FundersKeeper.SetParams(s.Ctx(), params) + // create clean pool for every test case gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() msg := &pooltypes.MsgCreatePool{ diff --git a/x/bundles/keeper/keeper_suite_inflation_splitting_test.go b/x/bundles/keeper/keeper_suite_inflation_splitting_test.go index 95b44312..65f650fc 100644 --- a/x/bundles/keeper/keeper_suite_inflation_splitting_test.go +++ b/x/bundles/keeper/keeper_suite_inflation_splitting_test.go @@ -63,6 +63,7 @@ var _ = Describe("inflation splitting", Ordered, func() { params := s.App().FundersKeeper.GetParams(s.Ctx()) params.MinFundingAmountPerBundle = 1_000 params.MinFundingAmount = 100 + params.MinFundingMultiple = 0 s.App().FundersKeeper.SetParams(s.Ctx(), params) // create funders diff --git a/x/funders/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go index 7e850d84..36582723 100644 --- a/x/funders/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -103,7 +103,6 @@ func (k Keeper) GetLowestFunding(fundings []types.Funding) (lowestFunding *types // // and minimum funding amount func (k Keeper) ensureParamsCompatibility(ctx sdk.Context, funding types.Funding) error { - params := k.GetParams(ctx) if funding.AmountPerBundle < params.MinFundingAmountPerBundle { return errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrAmountPerBundleTooLow.Error(), params.MinFundingAmountPerBundle) @@ -111,6 +110,9 @@ func (k Keeper) ensureParamsCompatibility(ctx sdk.Context, funding types.Funding if funding.Amount < params.MinFundingAmount { return errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrMinFundingAmount.Error(), params.MinFundingAmount) } + if funding.AmountPerBundle*params.MinFundingMultiple > funding.Amount { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrMinFundingMultiple.Error(), funding.AmountPerBundle, params.MinFundingAmount, funding.Amount) + } return nil } @@ -124,7 +126,6 @@ func (k Keeper) ensureParamsCompatibility(ctx sdk.Context, funding types.Funding // new funding can be added. // CONTRACT: no KV Writing on newFunding and fundingState func (k Keeper) ensureFreeSlot(ctx sdk.Context, newFunding *types.Funding, fundingState *types.FundingState) error { - activeFundings := k.GetActiveFundings(ctx, *fundingState) // check if slots are still available if len(activeFundings) < types.MaxFunders { diff --git a/x/funders/keeper/logic_funders_test.go b/x/funders/keeper/logic_funders_test.go index b2bf876c..d49dfff2 100644 --- a/x/funders/keeper/logic_funders_test.go +++ b/x/funders/keeper/logic_funders_test.go @@ -49,6 +49,10 @@ var _ = Describe("logic_funders.go", Ordered, func() { } s.RunTxPoolSuccess(msg) + params := s.App().FundersKeeper.GetParams(s.Ctx()) + params.MinFundingMultiple = 5 + s.App().FundersKeeper.SetParams(s.Ctx(), params) + // create funder s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ Creator: i.ALICE, diff --git a/x/funders/keeper/msg_server_fund_pool.go b/x/funders/keeper/msg_server_fund_pool.go index 82a7736f..8fd3cbcb 100644 --- a/x/funders/keeper/msg_server_fund_pool.go +++ b/x/funders/keeper/msg_server_fund_pool.go @@ -15,7 +15,6 @@ import ( // If the funders list is full, it checks if the funder wants to fund // more than the current lowest funder. If so, the current lowest funder // will get their tokens back and removed form the active funders list. -// TODO: what if amount_per_bundle is higher than the amount? A funder that knows that he is the next uploader could just fund a huge amount which gets payed to only himself. func (k msgServer) FundPool(goCtx context.Context, msg *types.MsgFundPool) (*types.MsgFundPoolResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) diff --git a/x/funders/keeper/msg_server_fund_pool_test.go b/x/funders/keeper/msg_server_fund_pool_test.go index 50a44e19..ab1d5ddc 100644 --- a/x/funders/keeper/msg_server_fund_pool_test.go +++ b/x/funders/keeper/msg_server_fund_pool_test.go @@ -1,6 +1,8 @@ package keeper_test import ( + "fmt" + i "github.com/KYVENetwork/chain/testutil/integration" funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" @@ -417,4 +419,17 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { AmountPerBundle: 1, }) }) + + It("Try to fund without fulfilling min_funding_multiple", func() { + // ASSERT + res, err := s.RunTx(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 2 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }) + fmt.Println(res) + fmt.Println(err.Error()) + Expect(err.Error()).To(Equal("per_bundle_amount (1000000000kyve) times min_funding_multiple (1000000000) is smaller than funded_amount (2000000000kyve): invalid request")) + }) }) diff --git a/x/funders/types/errors.go b/x/funders/types/errors.go index 34decf78..d37bfe95 100644 --- a/x/funders/types/errors.go +++ b/x/funders/types/errors.go @@ -6,13 +6,13 @@ import ( // x/funders module sentinel errors var ( - ErrFunderAlreadyExists = errors.Register(ModuleName, 1100, "funder with address %v already exists") - ErrFunderDoesNotExist = errors.Register(ModuleName, 1101, "funder with address %v does not exist") - ErrFundsTooLow = errors.Register(ModuleName, 1102, "minimum funding amount of %vkyve not reached") - ErrAmountPerBundleTooLow = errors.Register(ModuleName, 1103, "minimum amount per bundle of %vkyve not reached") - ErrMinFundingAmount = errors.Register(ModuleName, 1104, "minimum funding amount of %vkyve not reached") - ErrFundingDoesNotExist = errors.Register(ModuleName, 1105, "funding for pool %v and funder %v does not exist") - ErrFundingIsUsedUp = errors.Register(ModuleName, 1106, "funding for pool %v and funder %v is used up") - + ErrFunderAlreadyExists = errors.Register(ModuleName, 1100, "funder with address %v already exists") + ErrFunderDoesNotExist = errors.Register(ModuleName, 1101, "funder with address %v does not exist") + ErrFundsTooLow = errors.Register(ModuleName, 1102, "minimum funding amount of %vkyve not reached") + ErrAmountPerBundleTooLow = errors.Register(ModuleName, 1103, "minimum amount per bundle of %vkyve not reached") + ErrMinFundingAmount = errors.Register(ModuleName, 1104, "minimum funding amount of %vkyve not reached") + ErrFundingDoesNotExist = errors.Register(ModuleName, 1105, "funding for pool %v and funder %v does not exist") + ErrFundingIsUsedUp = errors.Register(ModuleName, 1106, "funding for pool %v and funder %v is used up") ErrFundingStateDoesNotExist = errors.Register(ModuleName, 1107, "funding state for pool %v does not exist") + ErrMinFundingMultiple = errors.Register(ModuleName, 1108, "per_bundle_amount (%dkyve) times min_funding_multiple (%d) is smaller than funded_amount (%vkyve)") ) diff --git a/x/funders/types/msgs.go b/x/funders/types/msgs.go index 77d512f0..e568d11e 100644 --- a/x/funders/types/msgs.go +++ b/x/funders/types/msgs.go @@ -1,8 +1,10 @@ package types import ( - "cosmossdk.io/errors" "encoding/json" + + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" ) From b58d0b407622c32bafbb7a540f4c94b153ddf8c6 Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Mon, 30 Oct 2023 10:51:19 +0100 Subject: [PATCH 095/109] refactor: remove unused args --- testutil/integration/checks.go | 4 ++-- x/query/keeper/grpc_account_funded.go | 6 +----- x/query/keeper/grpc_query_pool.go | 2 +- x/query/keeper/helper.go | 6 ++---- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/testutil/integration/checks.go b/testutil/integration/checks.go index 975df2df..373970b3 100644 --- a/testutil/integration/checks.go +++ b/testutil/integration/checks.go @@ -568,8 +568,8 @@ func (suite *KeeperTestSuite) verifyFullStaker(fullStaker querytypes.FullStaker, Expect(poolMembership.Pool.TotalFunds).To(Equal(suite.App().FundersKeeper.GetTotalActiveFunding(suite.Ctx(), fundingState.PoolId))) Expect(poolMembership.Pool.Name).To(Equal(pool.Name)) Expect(poolMembership.Pool.Runtime).To(Equal(pool.Runtime)) - Expect(poolMembership.Pool.Status).To(Equal(suite.App().QueryKeeper.GetPoolStatus(suite.Ctx(), &pool, &fundingState))) - Expect(poolMembership.Pool.Status).To(Equal(suite.App().QueryKeeper.GetPoolStatus(suite.Ctx(), &pool, nil))) + Expect(poolMembership.Pool.Status).To(Equal(suite.App().QueryKeeper.GetPoolStatus(suite.Ctx(), &pool))) + Expect(poolMembership.Pool.Status).To(Equal(suite.App().QueryKeeper.GetPoolStatus(suite.Ctx(), &pool))) } // Reverse check the pool memberships diff --git a/x/query/keeper/grpc_account_funded.go b/x/query/keeper/grpc_account_funded.go index 239c25da..de0dc6e9 100644 --- a/x/query/keeper/grpc_account_funded.go +++ b/x/query/keeper/grpc_account_funded.go @@ -25,10 +25,6 @@ func (k Keeper) AccountFundedList(goCtx context.Context, req *types.QueryAccount if !found { return nil, status.Error(codes.Internal, "pool not found") } - fundingState, found := k.fundersKeeper.GetFundingState(ctx, funding.PoolId) - if !found { - return nil, status.Error(codes.Internal, "funding state not found") - } funded = append(funded, types.Funded{ Amount: funding.Amount, Pool: &types.BasicPool{ @@ -40,7 +36,7 @@ func (k Keeper) AccountFundedList(goCtx context.Context, req *types.QueryAccount UploadInterval: pool.UploadInterval, TotalFunds: k.fundersKeeper.GetTotalActiveFunding(ctx, pool.Id), TotalDelegation: k.delegationKeeper.GetDelegationOfPool(ctx, pool.Id), - Status: k.GetPoolStatus(ctx, &pool, &fundingState), + Status: k.GetPoolStatus(ctx, &pool), }, }) } diff --git a/x/query/keeper/grpc_query_pool.go b/x/query/keeper/grpc_query_pool.go index 0f2ad33b..71c692c1 100644 --- a/x/query/keeper/grpc_query_pool.go +++ b/x/query/keeper/grpc_query_pool.go @@ -70,7 +70,7 @@ func (k Keeper) parsePoolResponse(ctx sdk.Context, pool *poolTypes.Pool) types.P Stakers: stakers, TotalSelfDelegation: totalSelfDelegation, TotalDelegation: totalDelegation, - Status: k.GetPoolStatus(ctx, pool, nil), + Status: k.GetPoolStatus(ctx, pool), Account: poolAccount.String(), AccountBalance: poolBalance, } diff --git a/x/query/keeper/helper.go b/x/query/keeper/helper.go index 033b8b0d..356812ef 100644 --- a/x/query/keeper/helper.go +++ b/x/query/keeper/helper.go @@ -1,7 +1,6 @@ package keeper import ( - funderstypes "github.com/KYVENetwork/chain/x/funders/types" globalTypes "github.com/KYVENetwork/chain/x/global/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" "github.com/KYVENetwork/chain/x/query/types" @@ -38,7 +37,6 @@ func (k Keeper) GetFullStaker(ctx sdk.Context, stakerAddress string) *types.Full for _, valaccount := range k.stakerKeeper.GetValaccountsFromStaker(ctx, staker.Address) { pool, _ := k.poolKeeper.GetPool(ctx, valaccount.PoolId) - fundingState, _ := k.fundersKeeper.GetFundingState(ctx, valaccount.PoolId) accountValaddress, _ := sdk.AccAddressFromBech32(valaccount.Valaddress) balanceValaccount := k.bankKeeper.GetBalance(ctx, accountValaddress, globalTypes.Denom).Amount.Uint64() @@ -54,7 +52,7 @@ func (k Keeper) GetFullStaker(ctx sdk.Context, stakerAddress string) *types.Full UploadInterval: pool.UploadInterval, TotalFunds: k.fundersKeeper.GetTotalActiveFunding(ctx, pool.Id), TotalDelegation: k.delegationKeeper.GetDelegationOfPool(ctx, pool.Id), - Status: k.GetPoolStatus(ctx, &pool, &fundingState), + Status: k.GetPoolStatus(ctx, &pool), }, Points: valaccount.Points, IsLeaving: valaccount.IsLeaving, @@ -83,7 +81,7 @@ func (k Keeper) GetFullStaker(ctx sdk.Context, stakerAddress string) *types.Full } } -func (k Keeper) GetPoolStatus(ctx sdk.Context, pool *pooltypes.Pool, fundingState *funderstypes.FundingState) pooltypes.PoolStatus { +func (k Keeper) GetPoolStatus(ctx sdk.Context, pool *pooltypes.Pool) pooltypes.PoolStatus { totalDelegation := k.delegationKeeper.GetDelegationOfPool(ctx, pool.Id) var poolStatus pooltypes.PoolStatus From 4845bd143f7c8227a00b0b7db01d3921b9a99cfc Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 30 Oct 2023 10:52:09 +0100 Subject: [PATCH 096/109] feat: add some more tests --- x/funders/keeper/logic_funders.go | 1 - x/funders/keeper/logic_funders_test.go | 28 ++++++ .../keeper/msg_server_create_funder_test.go | 17 ---- .../keeper/msg_server_update_funder_test.go | 99 +++++++++++++++++++ x/funders/types/message_update_funder.go | 3 + 5 files changed, 130 insertions(+), 18 deletions(-) create mode 100644 x/funders/keeper/msg_server_update_funder_test.go diff --git a/x/funders/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go index e464a48f..115b133f 100644 --- a/x/funders/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -12,7 +12,6 @@ import ( errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) -// TODO: should this be here or when we call the getter of the funding state? func (k Keeper) CreateFundingState(ctx sdk.Context, poolId uint64) { fundingState := types.FundingState{ PoolId: poolId, diff --git a/x/funders/keeper/logic_funders_test.go b/x/funders/keeper/logic_funders_test.go index 2b57091a..eaecec71 100644 --- a/x/funders/keeper/logic_funders_test.go +++ b/x/funders/keeper/logic_funders_test.go @@ -18,6 +18,7 @@ TEST CASES - logic_funders.go * Charge funders until all funders run out of funds * Charge funder with less funds than amount_per_bundle * Charge without fundings +* Check if the lowest funding is returned correctly */ @@ -201,4 +202,31 @@ var _ = Describe("logic_funders.go", Ordered, func() { Expect(fundersBalance).To(Equal(0 * i.KYVE)) Expect(poolBalance).To(Equal(0 * i.KYVE)) }) + + It("Check if the lowest funding is returned correctly", func() { + fundings := []funderstypes.Funding{ + { + FunderAddress: i.DUMMY[0], + PoolId: 0, + Amount: 1000 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }, + { + FunderAddress: i.DUMMY[1], + PoolId: 0, + Amount: 900 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }, + { + FunderAddress: i.DUMMY[2], + PoolId: 0, + Amount: 1100 * i.KYVE, + AmountPerBundle: 1 * i.KYVE, + }, + } + + getLowestFunding, err := s.App().FundersKeeper.GetLowestFunding(fundings) + Expect(err).NotTo(HaveOccurred()) + Expect(getLowestFunding.Amount).To(Equal(900 * i.KYVE)) + }) }) diff --git a/x/funders/keeper/msg_server_create_funder_test.go b/x/funders/keeper/msg_server_create_funder_test.go index 2f32103a..f06308fe 100644 --- a/x/funders/keeper/msg_server_create_funder_test.go +++ b/x/funders/keeper/msg_server_create_funder_test.go @@ -16,7 +16,6 @@ TEST CASES - msg_server_create_funder.go * Create a funder with empty values except moniker * Create a funder with all values set * Try to create a funder that already exists -* Create two funders with the same moniker // TODO: should this be allowed? * Create two funders */ @@ -94,22 +93,6 @@ var _ = Describe("msg_server_create_funder.go", Ordered, func() { }) }) - // TODO: should this be allowed? - PIt("Create two funders with the same moniker", func() { - // ARRANGE - moniker := "moniker" - s.RunTxFundersSuccess(&types.MsgCreateFunder{ - Creator: i.ALICE, - Moniker: moniker, - }) - - // ACT - s.RunTxFundersError(&types.MsgCreateFunder{ - Creator: i.BOB, - Moniker: moniker, - }) - }) - It("Create two funders", func() { // ARRANGE s.RunTxFundersSuccess(&types.MsgCreateFunder{ diff --git a/x/funders/keeper/msg_server_update_funder_test.go b/x/funders/keeper/msg_server_update_funder_test.go new file mode 100644 index 00000000..0722167e --- /dev/null +++ b/x/funders/keeper/msg_server_update_funder_test.go @@ -0,0 +1,99 @@ +package keeper_test + +import ( + "github.com/KYVENetwork/chain/x/funders/types" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + i "github.com/KYVENetwork/chain/testutil/integration" +) + +/* + +TEST CASES - msg_server_update_funder.go + +* Try to update a funder that does not exist +* Try to update a funder with empty moniker +* Update a funder with empty values except moniker +* Update a funder with all values set +*/ + +var _ = Describe("msg_server_create_funder.go", Ordered, func() { + s := i.NewCleanChain() + + BeforeEach(func() { + // init new clean chain + s = i.NewCleanChain() + + moniker, identity, website, contact, description := "AliceMoniker", "identity", "website", "contact", "description" + s.RunTxFundersSuccess(&types.MsgCreateFunder{ + Creator: i.ALICE, + Moniker: moniker, + Identity: identity, + Website: website, + Contact: contact, + Description: description, + }) + }) + + AfterEach(func() { + s.PerformValidityChecks() + }) + + It("Try to update a funder that does not exist", func() { + // ASSERT + s.RunTxFundersError(&types.MsgUpdateFunder{ + Creator: i.BOB, + Moniker: "moniker", + }) + }) + + It("Try to update a funder with empty moniker", func() { + // ASSERT + s.RunTxFundersError(&types.MsgUpdateFunder{ + Creator: i.BOB, + Moniker: "", + }) + }) + + It("Update a funder with empty values except moniker", func() { + // ACT + s.RunTxFundersSuccess(&types.MsgUpdateFunder{ + Creator: i.ALICE, + Moniker: "moniker", + }) + + // ASSERT + funder, found := s.App().FundersKeeper.GetFunder(s.Ctx(), i.ALICE) + Expect(found).To(BeTrue()) + Expect(funder.Address).To(Equal(i.ALICE)) + Expect(funder.Moniker).To(Equal("moniker")) + Expect(funder.Identity).To(BeEmpty()) + Expect(funder.Website).To(BeEmpty()) + Expect(funder.Contact).To(BeEmpty()) + Expect(funder.Description).To(BeEmpty()) + }) + + It("Update a funder with all values set", func() { + // ACT + moniker, identity, website, contact, description := "moniker", "identity", "website", "contact", "description" + s.RunTxFundersSuccess(&types.MsgUpdateFunder{ + Creator: i.ALICE, + Moniker: moniker, + Identity: identity, + Website: website, + Contact: contact, + Description: description, + }) + + // ASSERT + funder, found := s.App().FundersKeeper.GetFunder(s.Ctx(), i.ALICE) + Expect(found).To(BeTrue()) + Expect(funder.Address).To(Equal(i.ALICE)) + Expect(funder.Moniker).To(Equal(moniker)) + Expect(funder.Identity).To(Equal(identity)) + Expect(funder.Website).To(Equal(website)) + Expect(funder.Contact).To(Equal(contact)) + Expect(funder.Description).To(Equal(description)) + }) +}) diff --git a/x/funders/types/message_update_funder.go b/x/funders/types/message_update_funder.go index a6ce23f4..3b35b403 100644 --- a/x/funders/types/message_update_funder.go +++ b/x/funders/types/message_update_funder.go @@ -34,6 +34,9 @@ func (msg *MsgUpdateFunder) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) } + if msg.Moniker == "" { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "moniker cannot be empty") + } return nil } From bfaf2612c52eadcea5f5f46ba8ec61de883a574f Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 30 Oct 2023 12:05:09 +0100 Subject: [PATCH 097/109] feat: add status for funders queries --- docs/swagger.yml | 48 ++++- proto/kyve/query/v1beta1/funders.proto | 24 ++- x/funders/keeper/getters_funding.go | 10 + x/funders/types/funders.go | 8 + x/query/keeper/grpc_query_funders.go | 26 ++- x/query/keeper/grpc_query_fundings.go | 26 ++- x/query/types/funders.pb.go | 246 +++++++++++++------------ 7 files changed, 241 insertions(+), 147 deletions(-) diff --git a/docs/swagger.yml b/docs/swagger.yml index 14b161cd..f9dfc71e 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -8024,11 +8024,21 @@ paths: in: path required: true type: string - - name: with_inactive_fundings - description: with_inactive_fundings ... + - name: status + description: |- + status ... + + - FUNDING_STATUS_UNSPECIFIED: FundingStatusUnspecified ... + - FUNDING_STATUS_ACTIVE: FundingStatusActive status is set when the funding is active. + - FUNDING_STATUS_INACTIVE: FundingStatusInactive status is set when the funding has been used up or refunded. in: query required: false - type: boolean + type: string + enum: + - FUNDING_STATUS_UNSPECIFIED + - FUNDING_STATUS_ACTIVE + - FUNDING_STATUS_INACTIVE + default: FUNDING_STATUS_UNSPECIFIED tags: - QueryFunders /kyve/query/v1beta1/funders: @@ -8691,11 +8701,21 @@ paths: in: query required: false type: boolean - - name: with_inactive_fundings - description: with_inactive_fundings ... + - name: status + description: |- + status ... + + - FUNDING_STATUS_UNSPECIFIED: FundingStatusUnspecified ... + - FUNDING_STATUS_ACTIVE: FundingStatusActive status is set when the funding is active. + - FUNDING_STATUS_INACTIVE: FundingStatusInactive status is set when the funding has been used up or refunded. in: query required: false - type: boolean + type: string + enum: + - FUNDING_STATUS_UNSPECIFIED + - FUNDING_STATUS_ACTIVE + - FUNDING_STATUS_INACTIVE + default: FUNDING_STATUS_UNSPECIFIED tags: - QueryFunders /kyve/query/v1beta1/fundings_by_pool/{pool_id}: @@ -9013,11 +9033,21 @@ paths: in: query required: false type: boolean - - name: with_inactive_fundings - description: with_inactive_fundings ... + - name: status + description: |- + status ... + + - FUNDING_STATUS_UNSPECIFIED: FundingStatusUnspecified ... + - FUNDING_STATUS_ACTIVE: FundingStatusActive status is set when the funding is active. + - FUNDING_STATUS_INACTIVE: FundingStatusInactive status is set when the funding has been used up or refunded. in: query required: false - type: boolean + type: string + enum: + - FUNDING_STATUS_UNSPECIFIED + - FUNDING_STATUS_ACTIVE + - FUNDING_STATUS_INACTIVE + default: FUNDING_STATUS_UNSPECIFIED tags: - QueryFunders /kyve/stakers/v1beta1/params: diff --git a/proto/kyve/query/v1beta1/funders.proto b/proto/kyve/query/v1beta1/funders.proto index 4e065eae..54bd18c3 100644 --- a/proto/kyve/query/v1beta1/funders.proto +++ b/proto/kyve/query/v1beta1/funders.proto @@ -76,6 +76,18 @@ message Funding { uint64 total_funded = 5; } +// FundingStatus ... +enum FundingStatus { + option (gogoproto.goproto_enum_prefix) = false; + + // FundingStatusUnspecified ... + FUNDING_STATUS_UNSPECIFIED = 0; + // FundingStatusActive status is set when the funding is active. + FUNDING_STATUS_ACTIVE = 1; + // FundingStatusInactive status is set when the funding has been used up or refunded. + FUNDING_STATUS_INACTIVE = 2; +} + // ======== // /funders // ======== @@ -104,8 +116,8 @@ message QueryFundersResponse { message QueryFunderRequest { // address ... string address = 1; - // with_inactive_fundings ... - bool with_inactive_fundings = 2; + // status ... + FundingStatus status = 3; } // QueryFunderResponse is the response type for the Query/Funder RPC method. @@ -126,8 +138,8 @@ message QueryFundingsByFunderRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; // address ... string address = 2; - // with_inactive_fundings ... - bool with_inactive_fundings = 3; + // status ... + FundingStatus status = 3; } // QueryFundingsByFunderResponse is the response type for the Query/FundingsByFunder RPC method. @@ -148,8 +160,8 @@ message QueryFundingsByPoolRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; // pool_id ... uint64 pool_id = 2; - // with_inactive_fundings ... - bool with_inactive_fundings = 3; + // status ... + FundingStatus status = 3; } // QueryFundingsByPoolResponse is the response type for the Query/FundingsByPool RPC method. diff --git a/x/funders/keeper/getters_funding.go b/x/funders/keeper/getters_funding.go index 630c5c04..ce1ced54 100644 --- a/x/funders/keeper/getters_funding.go +++ b/x/funders/keeper/getters_funding.go @@ -2,6 +2,7 @@ package keeper import ( "github.com/KYVENetwork/chain/x/funders/types" + queryTypes "github.com/KYVENetwork/chain/x/query/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" @@ -103,6 +104,7 @@ func (k Keeper) GetPaginatedFundingQuery( pagination *query.PageRequest, funderAddress *string, poolId *uint64, + fundingStatus queryTypes.FundingStatus, ) ([]types.Funding, *query.PageResponse, error) { if funderAddress == nil && poolId == nil { return nil, nil, status.Error(codes.InvalidArgument, "either funderAddress or poolId must be provided") @@ -129,6 +131,14 @@ func (k Keeper) GetPaginatedFundingQuery( return false, nil } + if fundingStatus == queryTypes.FUNDING_STATUS_ACTIVE && funding.IsActive() { + return false, nil + } + + if fundingStatus == queryTypes.FUNDING_STATUS_INACTIVE && funding.IsInactive() { + return false, nil + } + if accumulate { fundings = append(fundings, funding) } diff --git a/x/funders/types/funders.go b/x/funders/types/funders.go index 8431a82f..906e258c 100644 --- a/x/funders/types/funders.go +++ b/x/funders/types/funders.go @@ -19,6 +19,14 @@ func (f *Funding) ChargeOneBundle() (amount uint64) { return amount } +func (f *Funding) IsActive() (isActive bool) { + return f.Amount > 0 +} + +func (f *Funding) IsInactive() (isInactive bool) { + return !f.IsActive() +} + // SetInactive removes a funding from active fundings func (fs *FundingState) SetInactive(funding *Funding) { for i, funderAddress := range fs.ActiveFunderAddresses { diff --git a/x/query/keeper/grpc_query_funders.go b/x/query/keeper/grpc_query_funders.go index 24cc27ec..167660a2 100644 --- a/x/query/keeper/grpc_query_funders.go +++ b/x/query/keeper/grpc_query_funders.go @@ -43,10 +43,11 @@ func (k Keeper) Funder(c context.Context, req *types.QueryFunderRequest) (*types return nil, status.Error(codes.NotFound, "funder not found") } - fundings := k.fundersKeeper.GetFundingsOfFunder(ctx, funder.Address) + allFundings := k.fundersKeeper.GetFundingsOfFunder(ctx, funder.Address) + fundings := k.filterFundingsOnStatus(allFundings, req.Status) - funderData := k.parseFunder(&funder, fundings) - fundingsData := k.parseFundings(fundings, req.WithInactiveFundings) + funderData := k.parseFunder(&funder, allFundings) + fundingsData := k.parseFundings(fundings) return &types.QueryFunderResponse{ Funder: &funderData, @@ -54,6 +55,23 @@ func (k Keeper) Funder(c context.Context, req *types.QueryFunderRequest) (*types }, nil } +func (k Keeper) filterFundingsOnStatus(fundings []fundersTypes.Funding, fundingStatus types.FundingStatus) []fundersTypes.Funding { + if fundingStatus == types.FUNDING_STATUS_UNSPECIFIED { + return fundings + } + + filtered := make([]fundersTypes.Funding, 0) + for _, funding := range fundings { + if fundingStatus == types.FUNDING_STATUS_ACTIVE && funding.Amount > 0 { + filtered = append(filtered, funding) + } + if fundingStatus == types.FUNDING_STATUS_INACTIVE && funding.Amount == 0 { + filtered = append(filtered, funding) + } + } + return filtered +} + func (k Keeper) parseFunder(funder *fundersTypes.Funder, fundings []fundersTypes.Funding) types.Funder { totalUsedFunds := uint64(0) totalAllocatedFunds := uint64(0) @@ -62,7 +80,7 @@ func (k Keeper) parseFunder(funder *fundersTypes.Funder, fundings []fundersTypes for _, funding := range fundings { // Only count active fundings for totalAmountPerBundle - if funding.Amount > 0 { + if funding.IsActive() { totalAmountPerBundle += funding.AmountPerBundle } diff --git a/x/query/keeper/grpc_query_fundings.go b/x/query/keeper/grpc_query_fundings.go index 225e3ae4..71d13468 100644 --- a/x/query/keeper/grpc_query_fundings.go +++ b/x/query/keeper/grpc_query_fundings.go @@ -16,12 +16,12 @@ func (k Keeper) FundingsByFunder(c context.Context, req *types.QueryFundingsByFu } ctx := sdk.UnwrapSDKContext(c) - fundings, pageRes, err := k.fundersKeeper.GetPaginatedFundingQuery(ctx, req.Pagination, &req.Address, nil) + fundings, pageRes, err := k.fundersKeeper.GetPaginatedFundingQuery(ctx, req.Pagination, &req.Address, nil, req.Status) if err != nil { return nil, err } - data := k.parseFundings(fundings, req.WithInactiveFundings) + data := k.parseFundings(fundings) return &types.QueryFundingsByFunderResponse{Fundings: data, Pagination: pageRes}, nil } @@ -32,28 +32,26 @@ func (k Keeper) FundingsByPool(c context.Context, req *types.QueryFundingsByPool } ctx := sdk.UnwrapSDKContext(c) - fundings, pageRes, err := k.fundersKeeper.GetPaginatedFundingQuery(ctx, req.Pagination, nil, &req.PoolId) + fundings, pageRes, err := k.fundersKeeper.GetPaginatedFundingQuery(ctx, req.Pagination, nil, &req.PoolId, req.Status) if err != nil { return nil, err } - data := k.parseFundings(fundings, req.WithInactiveFundings) + data := k.parseFundings(fundings) return &types.QueryFundingsByPoolResponse{Fundings: data, Pagination: pageRes}, nil } -func (k Keeper) parseFundings(fundings []fundersTypes.Funding, withInactiveFundings bool) []types.Funding { +func (k Keeper) parseFundings(fundings []fundersTypes.Funding) []types.Funding { fundingsData := make([]types.Funding, 0) for _, funding := range fundings { - if funding.Amount > 0 || withInactiveFundings { - fundingsData = append(fundingsData, types.Funding{ - FunderAddress: funding.FunderAddress, - PoolId: funding.PoolId, - Amount: funding.Amount, - AmountPerBundle: funding.AmountPerBundle, - TotalFunded: funding.TotalFunded, - }) - } + fundingsData = append(fundingsData, types.Funding{ + FunderAddress: funding.FunderAddress, + PoolId: funding.PoolId, + Amount: funding.Amount, + AmountPerBundle: funding.AmountPerBundle, + TotalFunded: funding.TotalFunded, + }) } return fundingsData } diff --git a/x/query/types/funders.pb.go b/x/query/types/funders.pb.go index bdc67be4..8b8da549 100644 --- a/x/query/types/funders.pb.go +++ b/x/query/types/funders.pb.go @@ -30,6 +30,38 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// FundingStatus ... +type FundingStatus int32 + +const ( + // FundingStatusUnspecified ... + FUNDING_STATUS_UNSPECIFIED FundingStatus = 0 + // FundingStatusActive status is set when the funding is active. + FUNDING_STATUS_ACTIVE FundingStatus = 1 + // FundingStatusInactive status is set when the funding has been used up or refunded. + FUNDING_STATUS_INACTIVE FundingStatus = 2 +) + +var FundingStatus_name = map[int32]string{ + 0: "FUNDING_STATUS_UNSPECIFIED", + 1: "FUNDING_STATUS_ACTIVE", + 2: "FUNDING_STATUS_INACTIVE", +} + +var FundingStatus_value = map[string]int32{ + "FUNDING_STATUS_UNSPECIFIED": 0, + "FUNDING_STATUS_ACTIVE": 1, + "FUNDING_STATUS_INACTIVE": 2, +} + +func (x FundingStatus) String() string { + return proto.EnumName(FundingStatus_name, int32(x)) +} + +func (FundingStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_a182f068d9f0dba9, []int{0} +} + // Funder ... type Funder struct { // address ... @@ -399,8 +431,8 @@ func (m *QueryFundersResponse) GetFunders() []Funder { type QueryFunderRequest struct { // address ... Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // with_inactive_fundings ... - WithInactiveFundings bool `protobuf:"varint,2,opt,name=with_inactive_fundings,json=withInactiveFundings,proto3" json:"with_inactive_fundings,omitempty"` + // status ... + Status FundingStatus `protobuf:"varint,3,opt,name=status,proto3,enum=kyve.query.v1beta1.FundingStatus" json:"status,omitempty"` } func (m *QueryFunderRequest) Reset() { *m = QueryFunderRequest{} } @@ -443,11 +475,11 @@ func (m *QueryFunderRequest) GetAddress() string { return "" } -func (m *QueryFunderRequest) GetWithInactiveFundings() bool { +func (m *QueryFunderRequest) GetStatus() FundingStatus { if m != nil { - return m.WithInactiveFundings + return m.Status } - return false + return FUNDING_STATUS_UNSPECIFIED } // QueryFunderResponse is the response type for the Query/Funder RPC method. @@ -511,8 +543,8 @@ type QueryFundingsByFunderRequest struct { Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` // address ... Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - // with_inactive_fundings ... - WithInactiveFundings bool `protobuf:"varint,3,opt,name=with_inactive_fundings,json=withInactiveFundings,proto3" json:"with_inactive_fundings,omitempty"` + // status ... + Status FundingStatus `protobuf:"varint,3,opt,name=status,proto3,enum=kyve.query.v1beta1.FundingStatus" json:"status,omitempty"` } func (m *QueryFundingsByFunderRequest) Reset() { *m = QueryFundingsByFunderRequest{} } @@ -562,11 +594,11 @@ func (m *QueryFundingsByFunderRequest) GetAddress() string { return "" } -func (m *QueryFundingsByFunderRequest) GetWithInactiveFundings() bool { +func (m *QueryFundingsByFunderRequest) GetStatus() FundingStatus { if m != nil { - return m.WithInactiveFundings + return m.Status } - return false + return FUNDING_STATUS_UNSPECIFIED } // QueryFundingsByFunderResponse is the response type for the Query/FundingsByFunder RPC method. @@ -630,8 +662,8 @@ type QueryFundingsByPoolRequest struct { Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` // pool_id ... PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` - // with_inactive_fundings ... - WithInactiveFundings bool `protobuf:"varint,3,opt,name=with_inactive_fundings,json=withInactiveFundings,proto3" json:"with_inactive_fundings,omitempty"` + // status ... + Status FundingStatus `protobuf:"varint,3,opt,name=status,proto3,enum=kyve.query.v1beta1.FundingStatus" json:"status,omitempty"` } func (m *QueryFundingsByPoolRequest) Reset() { *m = QueryFundingsByPoolRequest{} } @@ -681,11 +713,11 @@ func (m *QueryFundingsByPoolRequest) GetPoolId() uint64 { return 0 } -func (m *QueryFundingsByPoolRequest) GetWithInactiveFundings() bool { +func (m *QueryFundingsByPoolRequest) GetStatus() FundingStatus { if m != nil { - return m.WithInactiveFundings + return m.Status } - return false + return FUNDING_STATUS_UNSPECIFIED } // QueryFundingsByPoolResponse is the response type for the Query/FundingsByPool RPC method. @@ -744,6 +776,7 @@ func (m *QueryFundingsByPoolResponse) GetFundings() []Funding { } func init() { + proto.RegisterEnum("kyve.query.v1beta1.FundingStatus", FundingStatus_name, FundingStatus_value) proto.RegisterType((*Funder)(nil), "kyve.query.v1beta1.Funder") proto.RegisterType((*FundingStats)(nil), "kyve.query.v1beta1.FundingStats") proto.RegisterType((*Funding)(nil), "kyve.query.v1beta1.Funding") @@ -760,64 +793,67 @@ func init() { func init() { proto.RegisterFile("kyve/query/v1beta1/funders.proto", fileDescriptor_a182f068d9f0dba9) } var fileDescriptor_a182f068d9f0dba9 = []byte{ - // 898 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xce, 0x38, 0x8e, 0x1d, 0x9e, 0x43, 0x28, 0xd3, 0xd0, 0xae, 0x9c, 0xd6, 0x18, 0x03, 0x89, - 0x15, 0xa1, 0xdd, 0xc4, 0x40, 0x85, 0x90, 0x38, 0x34, 0x82, 0xa2, 0x0a, 0x09, 0x85, 0x45, 0x20, - 0xc1, 0x65, 0x35, 0xde, 0x1d, 0x36, 0xa3, 0x38, 0x3b, 0xdb, 0x9d, 0xd9, 0x04, 0xab, 0xea, 0x01, - 0x2e, 0x70, 0x44, 0xe2, 0xc8, 0x19, 0x21, 0x6e, 0x20, 0x24, 0xfe, 0x04, 0xd4, 0x63, 0x25, 0x2e, - 0x9c, 0x10, 0x4a, 0x10, 0x7f, 0x05, 0x07, 0x34, 0x3f, 0xec, 0xac, 0x1d, 0xff, 0x08, 0x90, 0x43, - 0x6f, 0xfb, 0xde, 0xfb, 0xbe, 0x79, 0xdf, 0x7b, 0xf3, 0xde, 0xd8, 0xd0, 0x3c, 0xe8, 0x1f, 0x51, - 0xef, 0x5e, 0x4e, 0xb3, 0xbe, 0x77, 0xb4, 0xd3, 0xa5, 0x92, 0xec, 0x78, 0x9f, 0xe4, 0x49, 0x44, - 0x33, 0xe1, 0xa6, 0x19, 0x97, 0x1c, 0x63, 0x85, 0x70, 0x35, 0xc2, 0xb5, 0x88, 0xfa, 0x56, 0xc8, - 0xc5, 0x21, 0x17, 0x5e, 0x97, 0x88, 0x71, 0x72, 0x4a, 0x62, 0x96, 0x10, 0xc9, 0x78, 0x62, 0xf8, - 0xf5, 0xb5, 0x98, 0xc7, 0x5c, 0x7f, 0x7a, 0xea, 0xcb, 0x7a, 0x6f, 0xc4, 0x9c, 0xc7, 0x3d, 0xea, - 0x91, 0x94, 0x79, 0x24, 0x49, 0xb8, 0xd4, 0x14, 0x9b, 0xb3, 0xf5, 0x17, 0x82, 0xca, 0x1d, 0xad, - 0x02, 0x3b, 0x50, 0x25, 0x51, 0x94, 0x51, 0x21, 0x1c, 0xd4, 0x44, 0xed, 0x27, 0xfc, 0x81, 0xa9, - 0x22, 0x87, 0x3c, 0x61, 0x07, 0x34, 0x73, 0x4a, 0x26, 0x62, 0x4d, 0x5c, 0x87, 0x65, 0x16, 0xd1, - 0x44, 0x32, 0xd9, 0x77, 0x16, 0x75, 0x68, 0x68, 0x2b, 0xd6, 0x31, 0xed, 0x0a, 0x26, 0xa9, 0x53, - 0x36, 0x2c, 0x6b, 0xaa, 0x48, 0xc8, 0x13, 0x49, 0x42, 0xe9, 0x2c, 0x99, 0x88, 0x35, 0x71, 0x13, - 0x6a, 0x11, 0x15, 0x61, 0xc6, 0x52, 0x25, 0xd2, 0xa9, 0xe8, 0x68, 0xd1, 0x85, 0x6f, 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x37, 0xed, 0xc1, 0xee, 0x9b, 0x0f, 0x4f, 0x1a, 0xe8, 0xd1, 0x49, 0x03, 0xfd, 0x71, 0xd2, - 0x40, 0x5f, 0x9d, 0x36, 0x16, 0x1e, 0x9d, 0x36, 0x16, 0x7e, 0x3b, 0x6d, 0x2c, 0x7c, 0xbc, 0x15, - 0x33, 0xb9, 0x9f, 0x77, 0xdd, 0x90, 0x1f, 0x7a, 0xef, 0x7c, 0xf4, 0xe1, 0x5b, 0xef, 0x52, 0x79, - 0xcc, 0xb3, 0x03, 0x2f, 0xdc, 0x27, 0x2c, 0xf1, 0x3e, 0xb5, 0x29, 0x64, 0x3f, 0xa5, 0xa2, 0x5b, - 0xd1, 0xff, 0xfb, 0x5e, 0xfe, 0x27, 0x00, 0x00, 0xff, 0xff, 0xcc, 0x74, 0x3a, 0xcf, 0x8f, 0x0a, - 0x00, 0x00, + // 952 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x96, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xc7, 0x3d, 0xce, 0xc6, 0x2e, 0xcf, 0x69, 0x08, 0xd3, 0x94, 0x2c, 0x9b, 0xd6, 0xb8, 0x06, + 0x12, 0x2b, 0x42, 0xbb, 0x89, 0x11, 0x15, 0x20, 0x71, 0x48, 0x9a, 0xa4, 0xb2, 0x90, 0xac, 0xb0, + 0x49, 0x2a, 0xc1, 0x65, 0xb5, 0xf6, 0x4e, 0x9d, 0x55, 0xec, 0x9d, 0xed, 0xce, 0x6c, 0x8b, 0x55, + 0xf5, 0x00, 0x17, 0x7a, 0x44, 0xe2, 0xc8, 0x11, 0x21, 0xc4, 0x0d, 0x6e, 0x48, 0xdc, 0x51, 0x8f, + 0x95, 0xb8, 0x70, 0x42, 0x28, 0x41, 0xfc, 0x15, 0x1c, 0xd0, 0xfc, 0xb0, 0x6b, 0x3b, 0x76, 0x5c, + 0xd4, 0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07, 0x85, 0xe6, 0x7c, 0x4f, 0x72, 0x56, 0xf1, 0xfa, + 0x24, 0x4e, 0xa1, 0xf2, 0x1a, 0x5d, 0xef, 0x0c, 0xf3, 0x0f, 0x08, 0xe6, 0x87, 0x97, 0x1c, 0xdb, + 0xcf, 0x91, 0x7f, 0xe0, 0x22, 0x5b, 0xce, 0x73, 0xc7, 0x6b, 0xda, 0x9b, 0x92, 0x76, 0x1d, 0xdb, + 0xd3, 0x68, 0xc5, 0x45, 0x76, 0x1e, 0xea, 0xdb, 0xfd, 0x68, 0x6b, 0xfb, 0xc9, 0x49, 0x11, 0x3d, + 0x3d, 0x29, 0xa2, 0x3f, 0x4f, 0x8a, 0xe8, 0xab, 0xd3, 0x62, 0xe6, 0xe9, 0x69, 0x31, 0xf3, 0xfb, + 0x69, 0x31, 0xf3, 0xe9, 0x5a, 0x2b, 0xe4, 0x47, 0x69, 0xc3, 0x6e, 0xd2, 0x8e, 0xf3, 0xd1, 0x27, + 0x77, 0x76, 0xea, 0x84, 0x3f, 0xa0, 0xc9, 0xb1, 0xd3, 0x3c, 0xf2, 0xc3, 0xc8, 0xf9, 0x4c, 0xa7, + 0xe0, 0xdd, 0x98, 0xb0, 0x46, 0x4e, 0x7e, 0x75, 0xbe, 0xf3, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x7e, 0x45, 0x8a, 0xda, 0x0d, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1310,15 +1346,10 @@ func (m *QueryFunderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.WithInactiveFundings { + if m.Status != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.Status)) i-- - if m.WithInactiveFundings { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 + dAtA[i] = 0x18 } if len(m.Address) > 0 { i -= len(m.Address) @@ -1399,13 +1430,8 @@ func (m *QueryFundingsByFunderRequest) MarshalToSizedBuffer(dAtA []byte) (int, e _ = i var l int _ = l - if m.WithInactiveFundings { - i-- - if m.WithInactiveFundings { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } + if m.Status != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.Status)) i-- dAtA[i] = 0x18 } @@ -1500,13 +1526,8 @@ func (m *QueryFundingsByPoolRequest) MarshalToSizedBuffer(dAtA []byte) (int, err _ = i var l int _ = l - if m.WithInactiveFundings { - i-- - if m.WithInactiveFundings { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } + if m.Status != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.Status)) i-- dAtA[i] = 0x18 } @@ -1723,8 +1744,8 @@ func (m *QueryFunderRequest) Size() (n int) { if l > 0 { n += 1 + l + sovFunders(uint64(l)) } - if m.WithInactiveFundings { - n += 2 + if m.Status != 0 { + n += 1 + sovFunders(uint64(m.Status)) } return n } @@ -1762,8 +1783,8 @@ func (m *QueryFundingsByFunderRequest) Size() (n int) { if l > 0 { n += 1 + l + sovFunders(uint64(l)) } - if m.WithInactiveFundings { - n += 2 + if m.Status != 0 { + n += 1 + sovFunders(uint64(m.Status)) } return n } @@ -1800,8 +1821,8 @@ func (m *QueryFundingsByPoolRequest) Size() (n int) { if m.PoolId != 0 { n += 1 + sovFunders(uint64(m.PoolId)) } - if m.WithInactiveFundings { - n += 2 + if m.Status != 0 { + n += 1 + sovFunders(uint64(m.Status)) } return n } @@ -2749,11 +2770,11 @@ func (m *QueryFunderRequest) Unmarshal(dAtA []byte) error { } m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field WithInactiveFundings", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } - var v int + m.Status = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowFunders @@ -2763,12 +2784,11 @@ func (m *QueryFunderRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + m.Status |= FundingStatus(b&0x7F) << shift if b < 0x80 { break } } - m.WithInactiveFundings = bool(v != 0) default: iNdEx = preIndex skippy, err := skipFunders(dAtA[iNdEx:]) @@ -3009,9 +3029,9 @@ func (m *QueryFundingsByFunderRequest) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field WithInactiveFundings", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } - var v int + m.Status = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowFunders @@ -3021,12 +3041,11 @@ func (m *QueryFundingsByFunderRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + m.Status |= FundingStatus(b&0x7F) << shift if b < 0x80 { break } } - m.WithInactiveFundings = bool(v != 0) default: iNdEx = preIndex skippy, err := skipFunders(dAtA[iNdEx:]) @@ -3254,9 +3273,9 @@ func (m *QueryFundingsByPoolRequest) Unmarshal(dAtA []byte) error { } case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field WithInactiveFundings", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } - var v int + m.Status = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowFunders @@ -3266,12 +3285,11 @@ func (m *QueryFundingsByPoolRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + m.Status |= FundingStatus(b&0x7F) << shift if b < 0x80 { break } } - m.WithInactiveFundings = bool(v != 0) default: iNdEx = preIndex skippy, err := skipFunders(dAtA[iNdEx:]) From e2ff6c2b8cb95a3470b3db2cd47e6e57e3761ec5 Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 30 Oct 2023 12:05:32 +0100 Subject: [PATCH 098/109] chore: update config.yml --- config.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/config.yml b/config.yml index 4017eef6..0bb29832 100644 --- a/config.yml +++ b/config.yml @@ -196,8 +196,8 @@ genesis: bond_denom: tkyve funders: params: - min_funding_amount: 1000 - min_funding_amount_per_bundle: 100 + min_funding_amount: 1000000000 + min_funding_amount_per_bundle: 10000000 funder_list: - address: "kyve1jq304cthpx0lwhpqzrdjrcza559ukyy3zsl2vd" contact: "https://twitter.com/kyvenetwork" @@ -205,7 +205,7 @@ genesis: description: "Alice is the first funder of the KYVE network." website: "https://kyve.network" identity: "0657A086E5201562" - - address: "kyve1e29j95xmsw3zmvtrk4st8e89z5n72v7nf70ma4" + - address: "kyve1ze3ncmkvat3t2mcj9e3uy8uktat4fq2vltcnat" contact: "https://twitter.com/kyvenetwork" moniker: "Otto" description: "Another funder of the KYVE network." @@ -218,22 +218,20 @@ genesis: amount_per_bundle: 230000000 total_funded: 2200400000000 - pool_id: 0 - funder_address: "kyve1e29j95xmsw3zmvtrk4st8e89z5n72v7nf70ma4" + funder_address: "kyve1ze3ncmkvat3t2mcj9e3uy8uktat4fq2vltcnat" amount: 200000000000 amount_per_bundle: 20000000 total_funded: 64500000000 - pool_id: 1 - funder_address: "kyve1jq304cthpx0lwhpqzrdjrcza559ukyy3zsl2vd" + funder_address: "kyve1ze3ncmkvat3t2mcj9e3uy8uktat4fq2vltcnat" amount: 100000000000 amount_per_bundle: 10000000 total_funded: 23000000000 funding_state_list: - pool_id: 0 active_funder_addresses: [] - total_amount: 5200000000000 - pool_id: 1 active_funder_addresses: [ ] - total_amount: 100000000000 chain_id: kyve-local validators: - name: alice From 455a04bfbca42aa30cfc8a26488ab696d7c8d6a9 Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 30 Oct 2023 13:28:07 +0100 Subject: [PATCH 099/109] feat: avoid permission issues in proto file generation --- Makefile | 3 ++- proto/Dockerfile | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 50784932..6f1f8824 100644 --- a/Makefile +++ b/Makefile @@ -171,7 +171,8 @@ proto-lint: proto-setup: @echo "🤖 Setting up protobuf environment..." - @docker build --rm --tag kyve-proto:latest --file proto/Dockerfile . + @docker build --rm --tag kyve-proto:latest --file proto/Dockerfile \ + --build-arg USER_ID=$$(id -u) --build-arg USER_GID=$$(id -g) . @echo "✅ Setup protobuf environment!" ############################################################################### diff --git a/proto/Dockerfile b/proto/Dockerfile index ea2150dc..c531581c 100644 --- a/proto/Dockerfile +++ b/proto/Dockerfile @@ -18,3 +18,19 @@ RUN git clone https://github.com/cosmos/gogoproto.git; \ RUN npm install -g swagger-combine COPY --from=BUILDER /usr/local/bin /usr/local/bin + +# Inject user id and group id to avoid permission issues +ARG USER_ID=1000 +ARG USER_GID=1000 + +# Create user and group if they don't exist +RUN if ! getent group $USER_GID; then \ + addgroup -g $USER_GID mygroup; \ +fi + +RUN if ! getent passwd $USER_ID; then \ + adduser -D -u $USER_ID -G mygroup myuser; \ +fi + +# Change to user +USER $USER_ID From 2383167acbe6e4354595f51f4c4e675ff4fb4f21 Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 30 Oct 2023 13:39:52 +0100 Subject: [PATCH 100/109] fix: cmd --- x/query/client/cli/query_funders.go | 3 +-- x/query/client/cli/query_fundings.go | 10 ++++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/x/query/client/cli/query_funders.go b/x/query/client/cli/query_funders.go index 39a765ff..a6cb9a3d 100644 --- a/x/query/client/cli/query_funders.go +++ b/x/query/client/cli/query_funders.go @@ -68,8 +68,7 @@ func CmdShowFunder() *cobra.Command { queryClient := types.NewQueryFundersClient(clientCtx) params := &types.QueryFunderRequest{ - Address: reqAddress, - WithInactiveFundings: true, + Address: reqAddress, } res, err := queryClient.Funder(context.Background(), params) diff --git a/x/query/client/cli/query_fundings.go b/x/query/client/cli/query_fundings.go index 324eb9d8..9d3a5b06 100644 --- a/x/query/client/cli/query_fundings.go +++ b/x/query/client/cli/query_fundings.go @@ -18,9 +18,8 @@ func byFunder( address string, ) error { params := &types.QueryFundingsByFunderRequest{ - Pagination: pageReq, - Address: address, - WithInactiveFundings: true, + Pagination: pageReq, + Address: address, } res, err := queryClient.FundingsByFunder(context.Background(), params) @@ -37,9 +36,8 @@ func byPool( poolId uint64, ) error { params := &types.QueryFundingsByPoolRequest{ - Pagination: pageReq, - PoolId: poolId, - WithInactiveFundings: true, + Pagination: pageReq, + PoolId: poolId, } res, err := queryClient.FundingsByPool(context.Background(), params) From 55cc64b1713580d6d7df1bca786c5277cdb82642 Mon Sep 17 00:00:00 2001 From: rapha Date: Mon, 30 Oct 2023 14:07:05 +0100 Subject: [PATCH 101/109] fix: funding status query --- x/funders/keeper/getters_funding.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/funders/keeper/getters_funding.go b/x/funders/keeper/getters_funding.go index ce1ced54..2ed77e1d 100644 --- a/x/funders/keeper/getters_funding.go +++ b/x/funders/keeper/getters_funding.go @@ -131,11 +131,11 @@ func (k Keeper) GetPaginatedFundingQuery( return false, nil } - if fundingStatus == queryTypes.FUNDING_STATUS_ACTIVE && funding.IsActive() { + if fundingStatus == queryTypes.FUNDING_STATUS_ACTIVE && funding.IsInactive() { return false, nil } - if fundingStatus == queryTypes.FUNDING_STATUS_INACTIVE && funding.IsInactive() { + if fundingStatus == queryTypes.FUNDING_STATUS_INACTIVE && funding.IsActive() { return false, nil } From 42e5738be6e2f664f6e8097550c9fc11e1efd777 Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 1 Nov 2023 17:23:18 +0100 Subject: [PATCH 102/109] fix: config.yml --- config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.yml b/config.yml index 0bb29832..c523cf25 100644 --- a/config.yml +++ b/config.yml @@ -229,9 +229,9 @@ genesis: total_funded: 23000000000 funding_state_list: - pool_id: 0 - active_funder_addresses: [] + active_funder_addresses: ["kyve1jq304cthpx0lwhpqzrdjrcza559ukyy3zsl2vd", "kyve1ze3ncmkvat3t2mcj9e3uy8uktat4fq2vltcnat"] - pool_id: 1 - active_funder_addresses: [ ] + active_funder_addresses: ["kyve1ze3ncmkvat3t2mcj9e3uy8uktat4fq2vltcnat"] chain_id: kyve-local validators: - name: alice From 8600cd36c2bf35da2942a44106433d765f63b436 Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Mon, 6 Nov 2023 14:52:16 +0100 Subject: [PATCH 103/109] chore: update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5606ef3a..c95875f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ An '!' indicates a state machine breaking change. ## [Unreleased] +### Features + +- ! (`x/funders`) [#141](https://github.com/KYVENetwork/chain/pull/141) Implementation of the new [funders concept](https://commonwealth.im/kyve/discussion/13420-enhancing-kyves-funders-concept). + ### Improvements - (deps) [#33](https://github.com/KYVENetwork/chain/pull/33) Upgrade Cosmos SDK to [v0.47.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.5) ([`v0.47.5-kyve`](https://github.com/KYVENetwork/cosmos-sdk/releases/tag/v0.47.5-kyve-rc0)). From 44209b0a43852e48128160a50371a9d19ddac544 Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Tue, 7 Nov 2023 17:55:48 +0100 Subject: [PATCH 104/109] chore: resolve merge conflicts --- docs/swagger.yml | 240 ++++++++++++------ .../keeper_suite_funding_bundles_test.go | 74 +++--- .../keeper/keeper_suite_valid_bundles_test.go | 5 +- x/bundles/keeper/logic_bundles_test.go | 92 +++---- x/pool/types/pool.pb.go | 123 +++++---- x/query/keeper/helper.go | 2 +- 6 files changed, 322 insertions(+), 214 deletions(-) diff --git a/docs/swagger.yml b/docs/swagger.yml index ada31b84..1e81aabf 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -346,7 +346,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -396,7 +399,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -406,7 +409,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -436,6 +439,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -824,7 +828,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -874,7 +881,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -884,7 +891,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -914,6 +921,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -1164,7 +1172,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -1214,7 +1225,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1224,7 +1235,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1254,6 +1265,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -1398,7 +1410,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -1448,7 +1463,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1458,7 +1473,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1488,6 +1503,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -1619,7 +1635,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -1669,7 +1688,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1679,7 +1698,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1709,6 +1728,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -1857,7 +1877,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -1907,7 +1930,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1917,7 +1940,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1947,6 +1970,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -2084,7 +2108,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -2134,7 +2161,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -2144,7 +2171,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -2174,6 +2201,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -2331,7 +2359,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -2381,7 +2412,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -2391,7 +2422,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -2421,6 +2452,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -2672,7 +2704,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -2722,7 +2757,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -2732,7 +2767,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -2762,6 +2797,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -3047,7 +3083,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -3097,7 +3136,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -3107,7 +3146,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -3137,6 +3176,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -3289,7 +3329,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -3339,7 +3382,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -3349,7 +3392,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -3379,6 +3422,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -3559,7 +3603,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -3609,7 +3656,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -3619,7 +3666,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -3649,6 +3696,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -4104,7 +4152,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -4154,7 +4205,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -4164,7 +4215,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -4194,6 +4245,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -4601,7 +4653,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -4651,7 +4706,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -4661,7 +4716,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -4691,6 +4746,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -5081,7 +5137,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -5131,7 +5190,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -5141,7 +5200,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -5171,6 +5230,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -5595,7 +5655,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -5645,7 +5708,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -5655,7 +5718,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -5685,6 +5748,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -6093,7 +6157,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -6143,7 +6210,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -6153,7 +6220,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -6183,6 +6250,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -6543,7 +6611,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -6593,7 +6664,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -6603,7 +6674,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -6633,6 +6704,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -7103,7 +7175,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -7153,7 +7228,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -7163,7 +7238,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -7193,6 +7268,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -7556,7 +7632,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -7606,7 +7685,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -7616,7 +7695,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -7646,6 +7725,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -7901,7 +7981,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -7951,7 +8034,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -7961,7 +8044,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -7991,6 +8074,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -8206,7 +8290,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -8256,7 +8343,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -8266,7 +8353,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -8296,6 +8383,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -8522,7 +8610,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -8572,7 +8663,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -8582,7 +8673,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -8612,6 +8703,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -8853,7 +8945,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -8903,7 +8998,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -8913,7 +9008,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -8943,6 +9038,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular diff --git a/x/bundles/keeper/keeper_suite_funding_bundles_test.go b/x/bundles/keeper/keeper_suite_funding_bundles_test.go index 6db9ac5c..841a17f1 100644 --- a/x/bundles/keeper/keeper_suite_funding_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_funding_bundles_test.go @@ -6,7 +6,6 @@ import ( funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" - sdk "github.com/cosmos/cosmos-sdk/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) @@ -19,7 +18,7 @@ TEST CASES - funding bundles * Produce a valid bundle with multiple funders and same funding amounts * Produce a valid bundle with multiple funders and different funding amounts * Produce a valid bundle with multiple funders and different funding amounts where not everyone can afford the funds -* Produce a valid bundle although the only funder can not pay for the bundle reward +* Produce a valid bundle although the only funder can not pay for the full bundle reward * Produce a valid bundle although multiple funders with same amount can not pay for the bundle reward * Produce a valid bundle although multiple funders with different amount can not pay for the bundle reward * Produce a valid bundle although there are no funders at all @@ -441,10 +440,11 @@ var _ = Describe("funding bundles", Ordered, func() { It("Produce a valid bundle although the only funder can not pay for the full bundle reward", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 10, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 10 * i.KYVE, + AmountPerBundle: 20 * i.KYVE, }) s.CommitAfterSeconds(60) @@ -495,27 +495,37 @@ var _ = Describe("funding bundles", Ordered, func() { Expect(pool.TotalBundles).To(Equal(uint64(1))) Expect(pool.CurrentKey).To(Equal("99")) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + // assert total pool funds - Expect(pool.TotalFunds).To(BeZero()) - Expect(pool.Funders).To(BeEmpty()) + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(0 * i.KYVE)) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(0)) + + fundingAlice, _ := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + + // assert individual funds + Expect(fundingAlice.Amount).To(Equal(0 * i.KYVE)) + Expect(fundingAlice.TotalFunded).To(Equal(10 * i.KYVE)) // assert individual balances balanceAlice := s.GetBalanceFromAddress(i.ALICE) - Expect(balanceAlice).To(Equal(initialBalanceAlice - 10)) + Expect(balanceAlice).To(Equal(initialBalanceAlice - 10*i.KYVE)) }) It("Produce a valid bundle although multiple funders with same amount can not pay for the bundle reward", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 10, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 10 * i.KYVE, + AmountPerBundle: 20 * i.KYVE, }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 10, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 10 * i.KYVE, + AmountPerBundle: 20 * i.KYVE, }) s.CommitAfterSeconds(60) @@ -542,7 +552,6 @@ var _ = Describe("funding bundles", Ordered, func() { Vote: 1, }) - s.CommitAfterSeconds(60) // ACT @@ -568,29 +577,34 @@ var _ = Describe("funding bundles", Ordered, func() { Expect(pool.CurrentKey).To(Equal("99")) // assert total pool funds - Expect(pool.TotalFunds).To(BeZero()) - Expect(pool.Funders).To(BeEmpty()) + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + + // assert total pool funds + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(Equal(uint64(0))) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(0)) // assert individual balances balanceAlice := s.GetBalanceFromAddress(i.ALICE) - Expect(balanceAlice).To(Equal(initialBalanceAlice - 10)) + Expect(balanceAlice).To(Equal(initialBalanceAlice - 10*i.KYVE)) balanceBob := s.GetBalanceFromAddress(i.BOB) - Expect(balanceBob).To(Equal(initialBalanceBob - 10)) + Expect(balanceBob).To(Equal(initialBalanceBob - 10*i.KYVE)) }) It("Produce a dropped bundle because multiple funders with different amount can not pay for the bundle reward", func() { // ARRANGE - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 10, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.ALICE, + PoolId: 0, + Amount: 10 * i.KYVE, + AmountPerBundle: 10 * i.KYVE, }) - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.BOB, - Id: 0, - Amount: 20, + s.RunTxFundersSuccess(&funderstypes.MsgFundPool{ + Creator: i.BOB, + PoolId: 0, + Amount: 20 * i.KYVE, + AmountPerBundle: 20 * i.KYVE, }) s.CommitAfterSeconds(60) diff --git a/x/bundles/keeper/keeper_suite_valid_bundles_test.go b/x/bundles/keeper/keeper_suite_valid_bundles_test.go index a4b7ca9f..d4517d80 100644 --- a/x/bundles/keeper/keeper_suite_valid_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_valid_bundles_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + fundersTypes "github.com/KYVENetwork/chain/x/funders/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -63,7 +64,7 @@ var _ = Describe("valid bundles", Ordered, func() { s.RunTxPoolSuccess(msg) // create funders - s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ + s.RunTxFundersSuccess(&fundersTypes.MsgCreateFunder{ Creator: i.ALICE, Moniker: "Alice", }) @@ -71,7 +72,7 @@ var _ = Describe("valid bundles", Ordered, func() { params := s.App().FundersKeeper.GetParams(s.Ctx()) params.MinFundingAmountPerBundle = amountPerBundle s.App().FundersKeeper.SetParams(s.Ctx(), params) - s.RunTxPoolSuccess(&funderstypes.MsgFundPool{ + s.RunTxPoolSuccess(&fundersTypes.MsgFundPool{ Creator: i.ALICE, Amount: 100 * i.KYVE, AmountPerBundle: amountPerBundle, diff --git a/x/bundles/keeper/logic_bundles_test.go b/x/bundles/keeper/logic_bundles_test.go index 10c3b9f4..ad8c585a 100644 --- a/x/bundles/keeper/logic_bundles_test.go +++ b/x/bundles/keeper/logic_bundles_test.go @@ -1,8 +1,9 @@ package keeper_test import ( + "cosmossdk.io/errors" i "github.com/KYVENetwork/chain/testutil/integration" - bundletypes "github.com/KYVENetwork/chain/x/bundles/types" + bundlesTypes "github.com/KYVENetwork/chain/x/bundles/types" funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" @@ -196,25 +197,24 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert pool can run while voting power of one node is too high", func() { // ASSERT - s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ - Name: "PoolTest", - UploadInterval: 60, - OperatingCost: 2 * i.KYVE, - MinDelegation: 100 * i.KYVE, - MaxBundleSize: 100, - Protocol: &pooltypes.Protocol{ - Version: "0.0.0", - Binaries: "{}", - LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), - }, - UpgradePlan: &pooltypes.UpgradePlan{}, - }) - - s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ - Creator: i.ALICE, - Id: 0, - Amount: 100 * i.KYVE, - }) + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: 10_000, + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, @@ -307,7 +307,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_0, - PoolId: 1, + PoolId: 0, Valaddress: i.VALADDRESS_0_A, Amount: 0, }) @@ -319,7 +319,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ Creator: i.STAKER_1, - PoolId: 1, + PoolId: 0, Valaddress: i.VALADDRESS_1_A, Amount: 0, }) @@ -359,7 +359,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, @@ -367,7 +367,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.CommitAfterSeconds(60) - s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ + s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ Creator: i.VALADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, @@ -421,7 +421,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, @@ -429,7 +429,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.CommitAfterSeconds(60) - s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ + s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ Creator: i.VALADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, @@ -480,7 +480,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, @@ -488,7 +488,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.CommitAfterSeconds(60) - s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ + s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ Creator: i.VALADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, @@ -537,7 +537,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, @@ -545,7 +545,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.CommitAfterSeconds(60) - s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ + s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ Creator: i.VALADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, @@ -602,7 +602,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, @@ -610,22 +610,6 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.CommitAfterSeconds(60) - s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_0_A, - Staker: i.STAKER_0, - PoolId: 0, - StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", - DataSize: 100, - DataHash: "test_hash", - FromIndex: 0, - BundleSize: 100, - FromKey: "0", - ToKey: "99", - BundleSummary: "test_value", - }) - - s.CommitAfterSeconds(60) - s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ Creator: i.VALADDRESS_0_A, Staker: i.STAKER_0, @@ -683,7 +667,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, @@ -691,7 +675,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.CommitAfterSeconds(60) - s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ + s.RunTxBundlesSuccess(&bundlesTypes.MsgSubmitBundleProposal{ Creator: i.VALADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, @@ -742,7 +726,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, @@ -824,7 +808,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, @@ -868,7 +852,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, @@ -877,7 +861,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { s.CommitAfterSeconds(60) // ACT - err := s.App().BundlesKeeper.AssertCanPropose(s.Ctx(), 0, i.STAKER_0, i.VALADDRESS_0, 1000) + err := s.App().BundlesKeeper.AssertCanPropose(s.Ctx(), 0, i.STAKER_0, i.VALADDRESS_0_A, 1000) // ASSERT Expect(err).To(HaveOccurred()) @@ -909,7 +893,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Amount: 0, }) - s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ + s.RunTxBundlesSuccess(&bundlesTypes.MsgClaimUploaderRole{ Creator: i.VALADDRESS_0_A, Staker: i.STAKER_0, PoolId: 0, diff --git a/x/pool/types/pool.pb.go b/x/pool/types/pool.pb.go index 13175af2..a02bd2e7 100644 --- a/x/pool/types/pool.pb.go +++ b/x/pool/types/pool.pb.go @@ -27,18 +27,28 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type PoolStatus int32 const ( - // POOL_STATUS_UNSPECIFIED ... + // POOL_STATUS_UNSPECIFIED indicates an unknown status, likely + // due to an error POOL_STATUS_UNSPECIFIED PoolStatus = 0 - // POOL_STATUS_ACTIVE ... + // POOL_STATUS_ACTIVE indicates, that the pool is running + // normally POOL_STATUS_ACTIVE PoolStatus = 1 - // POOL_STATUS_DISABLED ... + // POOL_STATUS_DISABLED indicates, that the pool was disabled + // by the governance and does not continue until it is enabled + // by the governance again POOL_STATUS_DISABLED PoolStatus = 2 - // POOL_STATUS_NO_FUNDS ... + // POOL_STATUS_NO_FUNDS indicates, that the pool currently has no + // funds, but is continuing normally anyway, due to inflation splitting POOL_STATUS_NO_FUNDS PoolStatus = 3 - // POOL_STATUS_NOT_ENOUGH_DELEGATION ... + // POOL_STATUS_NOT_ENOUGH_DELEGATION indicates, that the min delegation + // requirement has not been met and that the pool is halted POOL_STATUS_NOT_ENOUGH_DELEGATION PoolStatus = 4 - // POOL_STATUS_UPGRADING ... + // POOL_STATUS_UPGRADING indicates, that the runtime is currently + // being upgraded and that the pool is halted POOL_STATUS_UPGRADING PoolStatus = 5 + // POOL_STATUS_VOTING_POWER_TOO_HIGH indicates, that one validator + // has more than 50% voting power and that the pool is halted + POOL_STATUS_VOTING_POWER_TOO_HIGH PoolStatus = 6 ) var PoolStatus_name = map[int32]string{ @@ -48,6 +58,7 @@ var PoolStatus_name = map[int32]string{ 3: "POOL_STATUS_NO_FUNDS", 4: "POOL_STATUS_NOT_ENOUGH_DELEGATION", 5: "POOL_STATUS_UPGRADING", + 6: "POOL_STATUS_VOTING_POWER_TOO_HIGH", } var PoolStatus_value = map[string]int32{ @@ -57,6 +68,7 @@ var PoolStatus_value = map[string]int32{ "POOL_STATUS_NO_FUNDS": 3, "POOL_STATUS_NOT_ENOUGH_DELEGATION": 4, "POOL_STATUS_UPGRADING": 5, + "POOL_STATUS_VOTING_POWER_TOO_HIGH": 6, } func (x PoolStatus) String() string { @@ -429,55 +441,56 @@ func init() { func init() { proto.RegisterFile("kyve/pool/v1beta1/pool.proto", fileDescriptor_40c1730f47ff2ef8) } var fileDescriptor_40c1730f47ff2ef8 = []byte{ - // 763 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xcf, 0x73, 0xdb, 0x44, - 0x14, 0xc7, 0xad, 0xd4, 0x49, 0xed, 0x75, 0xe2, 0xb8, 0x4b, 0x08, 0x4b, 0xc2, 0x08, 0x37, 0x4c, - 0xc1, 0x70, 0xb0, 0xa7, 0xc0, 0x0c, 0x27, 0x0e, 0x8e, 0xad, 0x1a, 0x4d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bb, 0x8b, 0xe1, - 0x62, 0xe9, 0xe2, 0xe5, 0xd4, 0x9d, 0x5b, 0x23, 0xfb, 0x99, 0x6d, 0x8d, 0x3b, 0x35, 0x78, 0x0e, - 0xe0, 0xbe, 0x38, 0x1c, 0x2d, 0xec, 0x17, 0x56, 0xc7, 0x80, 0x08, 0x9c, 0xed, 0xf3, 0xb1, 0xed, - 0x0e, 0xaf, 0x6f, 0xac, 0x71, 0xe7, 0xe0, 0xdf, 0xca, 0x74, 0x86, 0x9f, 0x2d, 0xa7, 0x63, 0xb7, - 0xf3, 0x00, 0x3e, 0x01, 0x8f, 0xdf, 0x56, 0x16, 0xd8, 0x9a, 0xce, 0x96, 0x93, 0xef, 0xf0, 0xd8, - 0xba, 0xb1, 0x26, 0xc3, 0x85, 0x3d, 0x9b, 0x76, 0xea, 0xf0, 0x43, 0xf0, 0xfe, 0x5b, 0xe7, 0x99, - 0x4f, 0x9c, 0xe1, 0xd8, 0x9e, 0x4e, 0x3a, 0x87, 0x17, 0xf5, 0x9f, 0x7f, 0x35, 0x6b, 0xd7, 0xa3, - 0xdf, 0xef, 0x4c, 0xe3, 0xcd, 0x9d, 0x69, 0xfc, 0x75, 0x67, 0x1a, 0xbf, 0xdc, 0x9b, 0xb5, 0x37, - 0xf7, 0x66, 0xed, 0x8f, 0x7b, 0xb3, 0xf6, 0xe3, 0xe7, 0x01, 0x93, 0xeb, 0x6c, 0xd5, 0xf7, 0x78, - 0x34, 0x78, 0xfe, 0xc3, 0x0b, 0x6b, 0x4a, 0xe5, 0x2b, 0x2e, 0x6e, 0x07, 0xde, 0x9a, 0xb0, 0x78, - 0xb0, 0xcd, 0xff, 0x81, 0x72, 0x97, 0xd0, 0x74, 0x75, 0xa4, 0xc7, 0xf8, 0xd5, 0xdf, 0x01, 0x00, - 0x00, 0xff, 0xff, 0x55, 0xef, 0xbe, 0x88, 0x1d, 0x05, 0x00, 0x00, + // 784 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08,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 0x8b, 0x1c, 0x9d, 0xfd, 0x64, + 0x80, 0x56, 0x11, 0xcf, 0x42, 0x12, 0xff, 0xff, 0x46, 0xa9, 0xb7, 0xa2, 0x7e, 0x16, 0x52, 0x1f, + 0x13, 0x59, 0x36, 0xaa, 0xd8, 0x48, 0xaa, 0x72, 0x3f, 0x13, 0x44, 0xaa, 0x93, 0xeb, 0x5a, 0xae, + 0xf2, 0xb3, 0x3f, 0x76, 0x41, 0x7d, 0xc6, 0x79, 0x08, 0xdb, 0x60, 0x87, 0xf9, 0xba, 0x71, 0xdd, + 0xd9, 0x61, 0x3e, 0x84, 0xa0, 0x1e, 0x93, 0x88, 0x16, 0xfd, 0x74, 0xac, 0x6e, 0x28, 0xb2, 0x58, + 0xb2, 0x28, 0x7f, 0x4f, 0xd3, 0x29, 0x53, 0xe5, 0x0e, 0x79, 0xc0, 0xf5, 0xf1, 0x4d, 0x47, 0xc7, + 0xf0, 0x18, 0xec, 0x79, 0x3c, 0x7e, 0xcd, 0x02, 0xb4, 0xab, 0x69, 0x91, 0xc1, 0x53, 0xd0, 0x4c, + 0x25, 0x11, 0x12, 0xdf, 0xd0, 0x0d, 0xda, 0xcb, 0x9f, 0xa3, 0xc1, 0x4b, 0xba, 0x81, 0x9f, 0x82, + 0x96, 0x97, 0x09, 0x41, 0xe3, 0x5c, 0x7e, 0xac, 0x65, 0x50, 0x20, 0x65, 0xf8, 0x02, 0x1c, 0x96, + 0x86, 0x34, 0x8b, 0x22, 0x22, 0x36, 0xa8, 0xa1, 0x4d, 0xed, 0x02, 0xbb, 0x39, 0x85, 0x9f, 0x81, + 0x83, 0xd2, 0xc8, 0x62, 0x9f, 0xde, 0xa2, 0xa6, 0x7e, 0xdb, 0x7e, 0x01, 0x2d, 0xc5, 0x94, 0x49, + 0x72, 0x49, 0x42, 0xbc, 0xcc, 0x62, 0x3f, 0xa4, 0x29, 0x02, 0xb9, 0x49, 0xc3, 0xf3, 0x9c, 0xa9, + 0x96, 0x59, 0x12, 0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x7e, 0x19, 0x30, + 0xb9, 0xca, 0x96, 0x03, 0x8f, 0x47, 0xc3, 0x97, 0x3f, 0x5c, 0x9b, 0x53, 0x2a, 0xdf, 0x70, 0x71, + 0x33, 0xf4, 0x56, 0x84, 0xc5, 0xc3, 0xdb, 0xfc, 0xaf, 0x52, 0x6e, 0x12, 0x9a, 0x2e, 0xf7, 0xf4, + 0xb4, 0xbf, 0xf9, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x76, 0xe7, 0x4a, 0x49, 0x44, 0x05, 0x00, 0x00, } func (m *Protocol) Marshal() (dAtA []byte, err error) { diff --git a/x/query/keeper/helper.go b/x/query/keeper/helper.go index a1b2450e..8847f21e 100644 --- a/x/query/keeper/helper.go +++ b/x/query/keeper/helper.go @@ -97,7 +97,7 @@ func (k Keeper) GetPoolStatus(ctx sdk.Context, pool *pooltypes.Pool) pooltypes.P } else if highestDelegation*2 > totalDelegation { poolStatus = pooltypes.POOL_STATUS_VOTING_POWER_TOO_HIGH } else if k.fundersKeeper.GetTotalActiveFunding(ctx, pool.Id) == 0 { - poolStatus = pooltypes.POOL_STATUS_NO_FUNDS + poolStatus = pooltypes.POOL_STATUS_NO_FUNDS } return poolStatus From 13bc9d2c78921234b19ab351a14fc2fa40820e17 Mon Sep 17 00:00:00 2001 From: rapha Date: Tue, 7 Nov 2023 18:04:52 +0100 Subject: [PATCH 105/109] fix: Dockerfile --- proto/Dockerfile | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/proto/Dockerfile b/proto/Dockerfile index c531581c..cae2cc2d 100644 --- a/proto/Dockerfile +++ b/proto/Dockerfile @@ -19,18 +19,13 @@ RUN npm install -g swagger-combine COPY --from=BUILDER /usr/local/bin /usr/local/bin -# Inject user id and group id to avoid permission issues +# Inject user id and group id to avoid permission issues when running as a root user ARG USER_ID=1000 ARG USER_GID=1000 -# Create user and group if they don't exist -RUN if ! getent group $USER_GID; then \ - addgroup -g $USER_GID mygroup; \ -fi - -RUN if ! getent passwd $USER_ID; then \ - adduser -D -u $USER_ID -G mygroup myuser; \ -fi +# Create group and user +RUN addgroup -g $USER_GID mygroup && \ + adduser -D -u $USER_ID -G mygroup myuser # Change to user USER $USER_ID From c1ceb7a531fd0496bf9be45ab4b9fc47447c680f Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Tue, 7 Nov 2023 19:04:26 +0100 Subject: [PATCH 106/109] chore: small nits --- x/funders/keeper/logic_funders.go | 8 ++++---- x/funders/keeper/msg_server_fund_pool_test.go | 7 ++----- x/funders/keeper/msg_server_update_funder_test.go | 2 +- x/team/keeper/logic_team_test.go | 5 ----- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/x/funders/keeper/logic_funders.go b/x/funders/keeper/logic_funders.go index 381b4539..25d3ea44 100644 --- a/x/funders/keeper/logic_funders.go +++ b/x/funders/keeper/logic_funders.go @@ -51,7 +51,6 @@ func (k Keeper) ChargeFundersOfPool(ctx sdk.Context, poolId uint64) (payout uint } // This is the amount every funding will be charged - payout = 0 for _, funding := range activeFundings { payout += funding.ChargeOneBundle() if funding.Amount == 0 { @@ -98,9 +97,10 @@ func (k Keeper) GetLowestFunding(fundings []types.Funding) (lowestFunding *types } // ensureParamsCompatibility checks compatibility of the provided funding with the pool params. -// i.e. minimum funding per bundle -// -// and minimum funding amount +// i.e. +// - minimum funding per bundle +// - minimum funding amount +// - minimum funding multiple func (k Keeper) ensureParamsCompatibility(ctx sdk.Context, funding types.Funding) error { params := k.GetParams(ctx) if funding.AmountPerBundle < params.MinFundingAmountPerBundle { diff --git a/x/funders/keeper/msg_server_fund_pool_test.go b/x/funders/keeper/msg_server_fund_pool_test.go index ab1d5ddc..a6a251b8 100644 --- a/x/funders/keeper/msg_server_fund_pool_test.go +++ b/x/funders/keeper/msg_server_fund_pool_test.go @@ -1,8 +1,6 @@ package keeper_test import ( - "fmt" - i "github.com/KYVENetwork/chain/testutil/integration" funderstypes "github.com/KYVENetwork/chain/x/funders/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" @@ -26,6 +24,7 @@ TEST CASES - msg_server_fund_pool.go * Try to fund a non-existent pool * Try to fund below the minimum amount * Try to fund below the minimum amount per bundle +* Try to fund without fulfilling min_funding_multiple */ @@ -422,14 +421,12 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { It("Try to fund without fulfilling min_funding_multiple", func() { // ASSERT - res, err := s.RunTx(&funderstypes.MsgFundPool{ + _, err := s.RunTx(&funderstypes.MsgFundPool{ Creator: i.ALICE, PoolId: 0, Amount: 2 * i.KYVE, AmountPerBundle: 1 * i.KYVE, }) - fmt.Println(res) - fmt.Println(err.Error()) Expect(err.Error()).To(Equal("per_bundle_amount (1000000000kyve) times min_funding_multiple (1000000000) is smaller than funded_amount (2000000000kyve): invalid request")) }) }) diff --git a/x/funders/keeper/msg_server_update_funder_test.go b/x/funders/keeper/msg_server_update_funder_test.go index 0722167e..fd810a54 100644 --- a/x/funders/keeper/msg_server_update_funder_test.go +++ b/x/funders/keeper/msg_server_update_funder_test.go @@ -18,7 +18,7 @@ TEST CASES - msg_server_update_funder.go * Update a funder with all values set */ -var _ = Describe("msg_server_create_funder.go", Ordered, func() { +var _ = Describe("msg_server_update_funder.go", Ordered, func() { s := i.NewCleanChain() BeforeEach(func() { diff --git a/x/team/keeper/logic_team_test.go b/x/team/keeper/logic_team_test.go index 5554d862..7af1eef4 100644 --- a/x/team/keeper/logic_team_test.go +++ b/x/team/keeper/logic_team_test.go @@ -395,8 +395,3 @@ var _ = Describe("logic_team_test.go", Ordered, func() { Expect(uint64(0)).To(Equal(statusJCU.RemainingUnvestedAmount)) }) }) - -//func debugPrintStatus(status *types.VestingStatus) { -// fmt.Printf("TotalVestedAmount: %d\nTotalUnlocked: %d\nCurrentClaimable: %d\nLocked: %d\nRemainingUnvested: %d\n", -// status.TotalVestedAmount, status.TotalUnlockedAmount, status.CurrentClaimableAmount, status.LockedVestedAmount, status.RemainingUnvestedAmount) -//} From c4399b6f1564f468a1971c931d4d6f91c2bd9c24 Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 8 Nov 2023 09:21:39 +0100 Subject: [PATCH 107/109] fix: Dockerfile --- docs/swagger.yml | 240 ++++++++++++++--------------------------------- proto/Dockerfile | 12 ++- 2 files changed, 81 insertions(+), 171 deletions(-) diff --git a/docs/swagger.yml b/docs/swagger.yml index 1e81aabf..ada31b84 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -346,10 +346,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -399,7 +396,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -409,7 +406,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -439,7 +436,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -828,10 +824,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -881,7 +874,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -891,7 +884,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -921,7 +914,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -1172,10 +1164,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -1225,7 +1214,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1235,7 +1224,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1265,7 +1254,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -1410,10 +1398,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -1463,7 +1448,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1473,7 +1458,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1503,7 +1488,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -1635,10 +1619,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -1688,7 +1669,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1698,7 +1679,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1728,7 +1709,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -1877,10 +1857,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -1930,7 +1907,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1940,7 +1917,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1970,7 +1947,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -2108,10 +2084,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -2161,7 +2134,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -2171,7 +2144,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -2201,7 +2174,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -2359,10 +2331,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -2412,7 +2381,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -2422,7 +2391,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -2452,7 +2421,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -2704,10 +2672,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -2757,7 +2722,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -2767,7 +2732,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -2797,7 +2762,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -3083,10 +3047,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -3136,7 +3097,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -3146,7 +3107,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -3176,7 +3137,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -3329,10 +3289,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -3382,7 +3339,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -3392,7 +3349,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -3422,7 +3379,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -3603,10 +3559,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -3656,7 +3609,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -3666,7 +3619,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -3696,7 +3649,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -4152,10 +4104,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -4205,7 +4154,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -4215,7 +4164,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -4245,7 +4194,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -4653,10 +4601,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -4706,7 +4651,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -4716,7 +4661,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -4746,7 +4691,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -5137,10 +5081,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -5190,7 +5131,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -5200,7 +5141,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -5230,7 +5171,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -5655,10 +5595,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -5708,7 +5645,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -5718,7 +5655,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -5748,7 +5685,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -6157,10 +6093,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -6210,7 +6143,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -6220,7 +6153,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -6250,7 +6183,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -6611,10 +6543,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -6664,7 +6593,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -6674,7 +6603,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -6704,7 +6633,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -7175,10 +7103,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -7228,7 +7153,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -7238,7 +7163,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -7268,7 +7193,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -7632,10 +7556,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -7685,7 +7606,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -7695,7 +7616,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -7725,7 +7646,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -7981,10 +7901,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -8034,7 +7951,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -8044,7 +7961,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -8074,7 +7991,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -8290,10 +8206,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -8343,7 +8256,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -8353,7 +8266,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -8383,7 +8296,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -8610,10 +8522,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -8663,7 +8572,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -8673,7 +8582,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -8703,7 +8612,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -8945,10 +8853,7 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. + type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) @@ -8998,7 +8903,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -9008,7 +8913,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -9038,7 +8943,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular diff --git a/proto/Dockerfile b/proto/Dockerfile index cae2cc2d..8176c1b2 100644 --- a/proto/Dockerfile +++ b/proto/Dockerfile @@ -23,9 +23,15 @@ COPY --from=BUILDER /usr/local/bin /usr/local/bin ARG USER_ID=1000 ARG USER_GID=1000 -# Create group and user -RUN addgroup -g $USER_GID mygroup && \ - adduser -D -u $USER_ID -G mygroup myuser +# Create group if it doesn't exist +RUN if ! getent group $USER_GID; then \ + addgroup -g $USER_GID mygroup; \ +fi + +# Create user if it doesn't exist +RUN if ! getent passwd $USER_ID; then \ + adduser -D -u $USER_ID -G $(getent group $USER_GID | cut -d: -f1) myuser; \ +fi # Change to user USER $USER_ID From 099cac73981743e62e60145950a9977f94260bc7 Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Wed, 8 Nov 2023 10:12:00 +0100 Subject: [PATCH 108/109] test: improve logic_funders_test and msg_server_create_funder_test --- x/funders/keeper/logic_funders_test.go | 74 ++++++++++++++++++- .../keeper/msg_server_create_funder_test.go | 3 +- 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/x/funders/keeper/logic_funders_test.go b/x/funders/keeper/logic_funders_test.go index 27fade2b..adbd7d48 100644 --- a/x/funders/keeper/logic_funders_test.go +++ b/x/funders/keeper/logic_funders_test.go @@ -94,6 +94,21 @@ var _ = Describe("logic_funders.go", Ordered, func() { // ASSERT Expect(payout).To(Equal(11 * i.KYVE)) + fundingAlice, foundAlice := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + Expect(foundAlice).To(BeTrue()) + Expect(fundingAlice.Amount).To(Equal(99 * i.KYVE)) + Expect(fundingAlice.TotalFunded).To(Equal(1 * i.KYVE)) + + fundingBob, foundBob := s.App().FundersKeeper.GetFunding(s.Ctx(), i.BOB, 0) + Expect(foundBob).To(BeTrue()) + Expect(fundingBob.Amount).To(Equal(40 * i.KYVE)) + Expect(fundingBob.TotalFunded).To(Equal(10 * i.KYVE)) + + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(2)) + Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.ALICE)) + Expect(fundingState.ActiveFunderAddresses[1]).To(Equal(i.BOB)) + fundersBalance := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAcc, globaltypes.Denom).Amount.Uint64() poolBalance := s.App().BankKeeper.GetBalance(s.Ctx(), poolModuleAcc, globaltypes.Denom).Amount.Uint64() Expect(fundersBalance).To(Equal(139 * i.KYVE)) @@ -113,6 +128,16 @@ var _ = Describe("logic_funders.go", Ordered, func() { Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.ALICE)) + fundingAlice, foundAlice := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + Expect(foundAlice).To(BeTrue()) + Expect(fundingAlice.Amount).To(Equal(95 * i.KYVE)) + Expect(fundingAlice.TotalFunded).To(Equal(5 * i.KYVE)) + + fundingBob, foundBob := s.App().FundersKeeper.GetFunding(s.Ctx(), i.BOB, 0) + Expect(foundBob).To(BeTrue()) + Expect(fundingBob.Amount).To(Equal(0 * i.KYVE)) + Expect(fundingBob.TotalFunded).To(Equal(50 * i.KYVE)) + fundersBalance := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAcc, globaltypes.Denom).Amount.Uint64() poolBalance := s.App().BankKeeper.GetBalance(s.Ctx(), poolModuleAcc, globaltypes.Denom).Amount.Uint64() Expect(fundersBalance).To(Equal(95 * i.KYVE)) @@ -125,7 +150,7 @@ var _ = Describe("logic_funders.go", Ordered, func() { funding.AmountPerBundle = 10 * i.KYVE s.App().FundersKeeper.SetFunding(s.Ctx(), &funding) - // ACT + // ACT / ASSERT for range [5]struct{}{} { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(2)) @@ -136,6 +161,17 @@ var _ = Describe("logic_funders.go", Ordered, func() { } fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) + Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.ALICE)) + + fundingAlice, foundAlice := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + Expect(foundAlice).To(BeTrue()) + Expect(fundingAlice.Amount).To(Equal(50 * i.KYVE)) + Expect(fundingAlice.TotalFunded).To(Equal(50 * i.KYVE)) + + fundingBob, foundBob := s.App().FundersKeeper.GetFunding(s.Ctx(), i.BOB, 0) + Expect(foundBob).To(BeTrue()) + Expect(fundingBob.Amount).To(Equal(0 * i.KYVE)) + Expect(fundingBob.TotalFunded).To(Equal(50 * i.KYVE)) for range [5]struct{}{} { fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) @@ -148,10 +184,23 @@ var _ = Describe("logic_funders.go", Ordered, func() { fundingState, _ = s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(0)) + fundingAlice, foundAlice = s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + Expect(foundAlice).To(BeTrue()) + Expect(fundingAlice.Amount).To(Equal(0 * i.KYVE)) + Expect(fundingAlice.TotalFunded).To(Equal(100 * i.KYVE)) + + fundingBob, foundBob = s.App().FundersKeeper.GetFunding(s.Ctx(), i.BOB, 0) + Expect(foundBob).To(BeTrue()) + Expect(fundingBob.Amount).To(Equal(0 * i.KYVE)) + Expect(fundingBob.TotalFunded).To(Equal(50 * i.KYVE)) + payout, err := s.App().FundersKeeper.ChargeFundersOfPool(s.Ctx(), 0) Expect(err).NotTo(HaveOccurred()) Expect(payout).To(Equal(0 * i.KYVE)) + fundingState, _ = s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(0)) + fundersBalance := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAcc, globaltypes.Denom).Amount.Uint64() poolBalance := s.App().BankKeeper.GetBalance(s.Ctx(), poolModuleAcc, globaltypes.Denom).Amount.Uint64() Expect(fundersBalance).To(Equal(0 * i.KYVE)) @@ -174,6 +223,16 @@ var _ = Describe("logic_funders.go", Ordered, func() { Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) Expect(fundingState.ActiveFunderAddresses[0]).To(Equal(i.BOB)) + fundingAlice, foundAlice := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + Expect(foundAlice).To(BeTrue()) + Expect(fundingAlice.Amount).To(Equal(0 * i.KYVE)) + Expect(fundingAlice.TotalFunded).To(Equal(100 * i.KYVE)) + + fundingBob, foundBob := s.App().FundersKeeper.GetFunding(s.Ctx(), i.BOB, 0) + Expect(foundBob).To(BeTrue()) + Expect(fundingBob.Amount).To(Equal(40 * i.KYVE)) + Expect(fundingBob.TotalFunded).To(Equal(10 * i.KYVE)) + fundersBalance := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAcc, globaltypes.Denom).Amount.Uint64() poolBalance := s.App().BankKeeper.GetBalance(s.Ctx(), poolModuleAcc, globaltypes.Denom).Amount.Uint64() Expect(fundersBalance).To(Equal(40 * i.KYVE)) @@ -197,6 +256,19 @@ var _ = Describe("logic_funders.go", Ordered, func() { payout, err := s.App().FundersKeeper.ChargeFundersOfPool(s.Ctx(), 0) // ASSERT + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + Expect(fundingState.ActiveFunderAddresses).To(HaveLen(0)) + + fundingAlice, foundAlice := s.App().FundersKeeper.GetFunding(s.Ctx(), i.ALICE, 0) + Expect(foundAlice).To(BeTrue()) + Expect(fundingAlice.Amount).To(Equal(0 * i.KYVE)) + Expect(fundingAlice.TotalFunded).To(Equal(0 * i.KYVE)) + + fundingBob, foundBob := s.App().FundersKeeper.GetFunding(s.Ctx(), i.BOB, 0) + Expect(foundBob).To(BeTrue()) + Expect(fundingBob.Amount).To(Equal(0 * i.KYVE)) + Expect(fundingBob.TotalFunded).To(Equal(0 * i.KYVE)) + Expect(err).NotTo(HaveOccurred()) Expect(payout).To(Equal(0 * i.KYVE)) fundersBalance := s.App().BankKeeper.GetBalance(s.Ctx(), fundersModuleAcc, globaltypes.Denom).Amount.Uint64() diff --git a/x/funders/keeper/msg_server_create_funder_test.go b/x/funders/keeper/msg_server_create_funder_test.go index f06308fe..597725de 100644 --- a/x/funders/keeper/msg_server_create_funder_test.go +++ b/x/funders/keeper/msg_server_create_funder_test.go @@ -87,10 +87,11 @@ var _ = Describe("msg_server_create_funder.go", Ordered, func() { }) // ACT - s.RunTxFundersError(&types.MsgCreateFunder{ + _, err := s.RunTx(&types.MsgCreateFunder{ Creator: i.ALICE, Moniker: "moniker 2", }) + Expect(err.Error()).To(Equal("funder with address kyve1jq304cthpx0lwhpqzrdjrcza559ukyy3zsl2vd already exists: invalid request")) }) It("Create two funders", func() { From 648e1db051add3da9ae36181f1aed14fe9dd0495 Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Wed, 8 Nov 2023 10:41:41 +0100 Subject: [PATCH 109/109] chore: small nits --- docs/swagger.yml | 240 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 168 insertions(+), 72 deletions(-) diff --git a/docs/swagger.yml b/docs/swagger.yml index ada31b84..1e81aabf 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -346,7 +346,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -396,7 +399,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -406,7 +409,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -436,6 +439,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -824,7 +828,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -874,7 +881,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -884,7 +891,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -914,6 +921,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -1164,7 +1172,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -1214,7 +1225,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1224,7 +1235,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1254,6 +1265,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -1398,7 +1410,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -1448,7 +1463,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1458,7 +1473,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1488,6 +1503,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -1619,7 +1635,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -1669,7 +1688,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1679,7 +1698,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1709,6 +1728,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -1857,7 +1877,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -1907,7 +1930,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1917,7 +1940,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1947,6 +1970,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -2084,7 +2108,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -2134,7 +2161,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -2144,7 +2171,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -2174,6 +2201,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -2331,7 +2359,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -2381,7 +2412,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -2391,7 +2422,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -2421,6 +2452,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -2672,7 +2704,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -2722,7 +2757,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -2732,7 +2767,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -2762,6 +2797,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -3047,7 +3083,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -3097,7 +3136,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -3107,7 +3146,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -3137,6 +3176,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -3289,7 +3329,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -3339,7 +3382,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -3349,7 +3392,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -3379,6 +3422,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -3559,7 +3603,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -3609,7 +3656,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -3619,7 +3666,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -3649,6 +3696,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -4104,7 +4152,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -4154,7 +4205,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -4164,7 +4215,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -4194,6 +4245,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -4601,7 +4653,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -4651,7 +4706,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -4661,7 +4716,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -4691,6 +4746,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -5081,7 +5137,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -5131,7 +5190,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -5141,7 +5200,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -5171,6 +5230,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -5595,7 +5655,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -5645,7 +5708,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -5655,7 +5718,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -5685,6 +5748,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -6093,7 +6157,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -6143,7 +6210,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -6153,7 +6220,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -6183,6 +6250,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -6543,7 +6611,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -6593,7 +6664,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -6603,7 +6674,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -6633,6 +6704,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -7103,7 +7175,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -7153,7 +7228,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -7163,7 +7238,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -7193,6 +7268,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -7556,7 +7632,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -7606,7 +7685,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -7616,7 +7695,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -7646,6 +7725,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -7901,7 +7981,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -7951,7 +8034,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -7961,7 +8044,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -7991,6 +8074,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -8206,7 +8290,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -8256,7 +8343,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -8266,7 +8353,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -8296,6 +8383,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -8522,7 +8610,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -8572,7 +8663,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -8582,7 +8673,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -8612,6 +8703,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular @@ -8853,7 +8945,10 @@ paths: protobuf release, and it is not used for type URLs beginning with - type.googleapis.com. + type.googleapis.com. As of May 2023, there are no widely + used type server + + implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) @@ -8903,7 +8998,7 @@ paths: foo = any.unpack(Foo.getDefaultInstance()); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -8913,7 +9008,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -8943,6 +9038,7 @@ paths: JSON + ==== The JSON representation of an `Any` value uses the regular