From 1574c0dad9ad6b10ffd29e076482cf1421f54b02 Mon Sep 17 00:00:00 2001 From: Maximilian Breithecker <72022235+mbreithecker@users.noreply.github.com> Date: Mon, 10 Jul 2023 17:49:25 +0200 Subject: [PATCH] feat: improved schema for finalized bundles query (#104) (cherry picked from commit cf4857fcb9e58e9da992e2e212a294a2350ff278) # Conflicts: # CHANGELOG.md # app/upgrades/v1_3/upgrade.go # proto/kyve/bundles/v1beta1/bundles.proto # x/bundles/types/bundles.pb.go # x/bundles/types/keys.go --- CHANGELOG.md | 23 + app/upgrades/v1_3/upgrade.go | 74 + docs/swagger.yml | 822 +++----- proto/kyve/bundles/v1beta1/bundles.proto | 41 + proto/kyve/query/v1beta1/bundles.proto | 91 +- testutil/integration/checks.go | 26 +- x/bundles/keeper/getters_bundles.go | 169 +- x/bundles/types/bundles.pb.go | 1139 ++++++++++- x/bundles/types/keys.go | 21 +- x/bundles/types/types.go | 12 + x/query/client/cli/query_finalized_bundles.go | 4 +- x/query/keeper/grpc_query_finalized_bundle.go | 53 - .../keeper/grpc_query_finalized_bundles.go | 53 + x/query/spec/01_concept.md | 89 + x/query/types/bundles.pb.go | 1710 +++++++++++++---- x/query/types/bundles.pb.gw.go | 177 +- 16 files changed, 3249 insertions(+), 1255 deletions(-) create mode 100644 app/upgrades/v1_3/upgrade.go delete mode 100644 x/query/keeper/grpc_query_finalized_bundle.go create mode 100644 x/query/keeper/grpc_query_finalized_bundles.go create mode 100644 x/query/spec/01_concept.md diff --git a/CHANGELOG.md b/CHANGELOG.md index a23602a1..2b013eab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,29 @@ ## [Unreleased] +<<<<<<< HEAD +======= +### Features + +- (ibc) [#30](https://github.com/KYVENetwork/chain/pull/30) Integrate [Packet Forward Middleware](https://github.com/strangelove-ventures/packet-forward-middleware). +- (`x/bundles`) [#99](https://github.com/KYVENetwork/chain/pull/99) Use weighted round-robin approach for uploader selection. + +### Improvements + +- (`x/bundles`) [#62](https://github.com/KYVENetwork/chain/pull/62) Payout storage cost directly to the bundle uploader. +- (`x/pool`) [#74](https://github.com/KYVENetwork/chain/pull/74) Improve parameter validation in pool proposals. +- (`x/stakers`) [#46](https://github.com/KYVENetwork/chain/pull/46) Allow protocol validator commission rewards to be claimed. + +### Bug Fixes + +- [#96](https://github.com/KYVENetwork/chain/pull/96) Track investor delegation inside auth module. + +### Client Breaking + +- (`x/stakers`) [#46](https://github.com/KYVENetwork/chain/pull/46) Include `MsgClaimCommissionRewards` for claiming commission rewards. +- (`x/bundles`) [#104](https://github.com/KYVENetwork/chain/pull/104) Improve schema for finalized bundles query. + +>>>>>>> cf4857f (feat: improved schema for finalized bundles query (#104)) ### API Breaking - (`x/query`) [#87](https://github.com/KYVENetwork/chain/pull/87) Correctly return pools that an account has funded. diff --git a/app/upgrades/v1_3/upgrade.go b/app/upgrades/v1_3/upgrade.go new file mode 100644 index 00000000..3a33f26a --- /dev/null +++ b/app/upgrades/v1_3/upgrade.go @@ -0,0 +1,74 @@ +package v1_3 + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + "github.com/tendermint/tendermint/libs/log" + + // Auth + authKeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + vestingExported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported" + // Staking + stakingKeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + // Upgrade + upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + accountKeeper authKeeper.AccountKeeper, + bankKeeper bankKeeper.Keeper, + stakingKeeper stakingKeeper.Keeper, +) upgradeTypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradeTypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + logger := ctx.Logger().With("upgrade", UpgradeName) + + if ctx.ChainID() == MainnetChainID { + for _, address := range InvestorAccounts { + TrackInvestorDelegation(ctx, logger, sdk.MustAccAddressFromBech32(address), accountKeeper, bankKeeper, stakingKeeper) + } + } + + return mm.RunMigrations(ctx, configurator, vm) + } +} + +// TrackInvestorDelegation performs a correction of the delegation tracking inside the vesting account. +// The correction is done by performing a full untracking and then tracking the actual total delegated amount +// (including slashed amounts). +func TrackInvestorDelegation(ctx sdk.Context, logger log.Logger, address sdk.AccAddress, ak authKeeper.AccountKeeper, bk bankKeeper.Keeper, sk stakingKeeper.Keeper) { + denom := sk.BondDenom(ctx) + account, _ := ak.GetAccount(ctx, address).(vestingExported.VestingAccount) + + // Obtain total delegation of address + totalDelegation := sdk.NewInt(0) + for _, delegation := range sk.GetAllDelegatorDelegations(ctx, address) { + // We take the shares as the total delegation as this is the amount which is + // tracked inside the vesting account. (slashes are ignored, which is correct) + totalDelegation = totalDelegation.Add(delegation.GetShares().TruncateInt()) + } + + // Fetch current balance. + balanceCoin := bk.GetBalance(ctx, address, denom) + + // This is the balance a user would have if all tokens are unbonded (even the ones which got slashed). + maxPossibleBalance := balanceCoin.Amount.Add(totalDelegation) + maxPossibleBalanceCoins := sdk.NewCoins().Add(sdk.NewCoin(denom, maxPossibleBalance)) + + if totalDelegation.GT(sdk.ZeroInt()) { + + // Untrack entire vesting delegation using maximum amount. This will set both `delegated_free` + // and `delegated_vesting` back to zero. + account.TrackUndelegation(sdk.NewCoins(sdk.NewCoin("ukyve", maxPossibleBalance))) + + // Track the delegation using the total delegation + account.TrackDelegation(ctx.BlockTime(), maxPossibleBalanceCoins, sdk.NewCoins(sdk.NewCoin("ukyve", totalDelegation))) + + logger.Info(fmt.Sprintf("tracked delegation of %s with %s", address.String(), totalDelegation.String())) + ak.SetAccount(ctx, account) + } +} diff --git a/docs/swagger.yml b/docs/swagger.yml index 97a9c6e4..2e1beef1 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -2458,101 +2458,143 @@ paths: format: uint64 tags: - QueryBundles - /kyve/query/v1beta1/finalized_bundle/{pool_id}/{id}: + /kyve/v1/bundles/{pool_id}: get: - summary: FinalizedBundle ... - operationId: FinalizedBundle + summary: FinalizedBundles ... + operationId: FinalizedBundlesQuery responses: '200': description: A successful response. schema: type: object properties: - finalized_bundle: - description: finalized_bundle ... + finalized_bundles: + type: array + items: + type: object + properties: + pool_id: + type: string + format: uint64 + title: pool_id in which the bundle was created + id: + type: string + format: uint64 + description: id is is integrated with each valid bundle produced. + storage_id: + type: string + title: >- + storage_id is the id with which the data can be + retrieved from the configured data provider + uploader: + type: string + title: >- + uploader is the address of the staker who submitted this + bundle + from_index: + type: string + format: uint64 + title: >- + from_index is the index from where the bundle starts + (inclusive) + to_index: + type: string + format: uint64 + title: >- + to_index is the index to which the bundle goes + (exclusive) + from_key: + type: string + title: >- + from_key is the key of the first data item in the bundle + proposal + to_key: + type: string + title: to_key the key of the last data item in the bundle + bundle_summary: + type: string + description: bundle_summary is a summary of the bundle. + data_hash: + type: string + description: data_hash is a sha256 hash of the uploaded data. + finalized_at: + description: >- + finalized_at contains details of the block that + finalized this bundle. + type: object + properties: + height: + type: string + description: >- + height is the block height in which the bundle got + finalized. + timestamp: + type: string + description: >- + timestamp is the UNIX timestamp of the block in + which the bundle got finalized. + storage_provider_id: + type: string + format: uint64 + title: >- + storage_provider_id the id of the storage provider where + the bundle is stored + compression_id: + type: string + format: uint64 + title: >- + compression_id the id of the compression type with which + the data was compressed + stake_security: + description: >- + stake_security defines the amount of stake which was + present in the pool during the finalization of the + bundle. + + This field was added in schema version 2. Bundles + finalized before that return `null`. + type: object + properties: + valid_vote_power: + type: string + description: >- + valid_vote_power gives the amount of $KYVE stake + that voted `valid`. + total_vote_power: + type: string + description: >- + total_vote_power gives the amount of total $KYVE + stake that was present in the pool + + during finalization. + title: >- + StakeSecurity represents the relative security of a + finalized bundle + title: >- + FinalizedBundle represents the latest version of a valid + bundle of a pool + description: finalized_bundles ... + pagination: + description: pagination defines the pagination in the response. type: object properties: - pool_id: - type: string - format: uint64 - title: >- - pool_id is the id of the pool for which this proposal is - for - id: - type: string - format: uint64 - title: >- - id is a unique identifier for each finalized bundle in a - pool - storage_id: - type: string - title: >- - storage_id is the id with which the data can be retrieved - from - uploader: - type: string - title: >- - uploader is the address of the staker who submitted this - bundle - from_index: + next_key: type: string - format: uint64 - title: >- - from_index is the index from where the bundle starts - (inclusive) - to_index: + 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: to_index is the index to which the bundle goes (exclusive) - to_key: - type: string - title: >- - to_key the key of the last data item in the bundle - proposal - bundle_summary: - type: string - title: bundle_summary a string summary of the current proposal - data_hash: - type: string - title: data_hash a sha256 hash of the raw compressed data - finalized_at: - description: >- - finalized_at contains details of the block that finalized - this bundle. - type: object - properties: - height: - type: string - format: uint64 - description: height ... - timestamp: - type: string - format: uint64 - description: timestamp ... - from_key: - type: string - title: >- - from_key the key of the first data item in the bundle - proposal - storage_provider_id: - type: integer - format: int64 - title: >- - storage_provider_id the id of the storage provider where - the bundle is stored - compression_id: - type: integer - format: int64 title: >- - compression_id the id of the compression type with which - the data was compressed - title: >- - FinalizedBundle represents a bundle proposal where the - majority + total is total number of results available if + PageRequest.count_total - agreed on its validity + was set, its value is undefined otherwise description: >- - QueryFinalizedBundleResponse is the response type for the + QueryStakersByPoolResponse is the response type for the Query/Staker RPC method. default: description: An unexpected error response. @@ -2755,110 +2797,180 @@ paths: required: true type: string format: uint64 - - name: id - description: id ... - in: path - required: true + - 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: index + description: >- + index is an optional parameter which tells the server to only show + + the bundle with the given index. This can not be combined with + pagination. + in: query + required: false + type: string tags: - QueryBundles - /kyve/query/v1beta1/finalized_bundle_by_height/{pool_id}/{height}: + /kyve/v1/bundles/{pool_id}/{id}: get: - summary: Queries the bundle which contains the data given height - operationId: FinalizedBundlesByHeight + summary: FinalizedBundle ... + operationId: FinalizedBundleQuery responses: '200': description: A successful response. schema: type: object properties: - finalized_bundle: - description: finalized_bundle ... + pool_id: + type: string + format: uint64 + title: pool_id in which the bundle was created + id: + type: string + format: uint64 + description: id is is integrated with each valid bundle produced. + storage_id: + type: string + title: >- + storage_id is the id with which the data can be retrieved from + the configured data provider + uploader: + type: string + title: >- + uploader is the address of the staker who submitted this + bundle + from_index: + type: string + format: uint64 + title: >- + from_index is the index from where the bundle starts + (inclusive) + to_index: + type: string + format: uint64 + title: to_index is the index to which the bundle goes (exclusive) + from_key: + type: string + title: >- + from_key is the key of the first data item in the bundle + proposal + to_key: + type: string + title: to_key the key of the last data item in the bundle + bundle_summary: + type: string + description: bundle_summary is a summary of the bundle. + data_hash: + type: string + description: data_hash is a sha256 hash of the uploaded data. + finalized_at: + description: >- + finalized_at contains details of the block that finalized this + bundle. type: object properties: - pool_id: - type: string - format: uint64 - title: >- - pool_id is the id of the pool for which this proposal is - for - id: - type: string - format: uint64 - title: >- - id is a unique identifier for each finalized bundle in a - pool - storage_id: - type: string - title: >- - storage_id is the id with which the data can be retrieved - from - uploader: - type: string - title: >- - uploader is the address of the staker who submitted this - bundle - from_index: - type: string - format: uint64 - title: >- - from_index is the index from where the bundle starts - (inclusive) - to_index: - type: string - format: uint64 - title: to_index is the index to which the bundle goes (exclusive) - to_key: + height: type: string - title: >- - to_key the key of the last data item in the bundle - proposal - bundle_summary: + description: >- + height is the block height in which the bundle got + finalized. + timestamp: type: string - title: bundle_summary a string summary of the current proposal - data_hash: + description: >- + timestamp is the UNIX timestamp of the block in which the + bundle got finalized. + storage_provider_id: + type: string + format: uint64 + title: >- + storage_provider_id the id of the storage provider where the + bundle is stored + compression_id: + type: string + format: uint64 + title: >- + compression_id the id of the compression type with which the + data was compressed + stake_security: + description: >- + stake_security defines the amount of stake which was present + in the pool during the finalization of the bundle. + + This field was added in schema version 2. Bundles finalized + before that return `null`. + type: object + properties: + valid_vote_power: type: string - title: data_hash a sha256 hash of the raw compressed data - finalized_at: description: >- - finalized_at contains details of the block that finalized - this bundle. - type: object - properties: - height: - type: string - format: uint64 - description: height ... - timestamp: - type: string - format: uint64 - description: timestamp ... - from_key: + valid_vote_power gives the amount of $KYVE stake that + voted `valid`. + total_vote_power: type: string - title: >- - from_key the key of the first data item in the bundle - proposal - storage_provider_id: - type: integer - format: int64 - title: >- - storage_provider_id the id of the storage provider where - the bundle is stored - compression_id: - type: integer - format: int64 - title: >- - compression_id the id of the compression type with which - the data was compressed - title: >- - FinalizedBundle represents a bundle proposal where the - majority + description: >- + total_vote_power gives the amount of total $KYVE stake + that was present in the pool - agreed on its validity - description: >- - QueryFinalizedBundleResponse is the response type for the - Query/Staker RPC method. + during finalization. + title: >- + StakeSecurity represents the relative security of a finalized + bundle + title: >- + FinalizedBundle represents the latest version of a valid bundle of + a pool default: description: An unexpected error response. schema: @@ -3060,7 +3172,7 @@ paths: required: true type: string format: uint64 - - name: height + - name: id description: id ... in: path required: true @@ -3068,384 +3180,6 @@ paths: format: uint64 tags: - QueryBundles - /kyve/query/v1beta1/finalized_bundles/{pool_id}: - get: - summary: FinalizedBundles ... - operationId: FinalizedBundles - responses: - '200': - description: A successful response. - schema: - type: object - properties: - finalized_bundles: - type: array - items: - type: object - properties: - pool_id: - type: string - format: uint64 - title: >- - pool_id is the id of the pool for which this proposal is - for - id: - type: string - format: uint64 - title: >- - id is a unique identifier for each finalized bundle in a - pool - storage_id: - type: string - title: >- - storage_id is the id with which the data can be - retrieved from - uploader: - type: string - title: >- - uploader is the address of the staker who submitted this - bundle - from_index: - type: string - format: uint64 - title: >- - from_index is the index from where the bundle starts - (inclusive) - to_index: - type: string - format: uint64 - title: >- - to_index is the index to which the bundle goes - (exclusive) - to_key: - type: string - title: >- - to_key the key of the last data item in the bundle - proposal - bundle_summary: - type: string - title: bundle_summary a string summary of the current proposal - data_hash: - type: string - title: data_hash a sha256 hash of the raw compressed data - finalized_at: - description: >- - finalized_at contains details of the block that - finalized this bundle. - type: object - properties: - height: - type: string - format: uint64 - description: height ... - timestamp: - type: string - format: uint64 - description: timestamp ... - from_key: - type: string - title: >- - from_key the key of the first data item in the bundle - proposal - storage_provider_id: - type: integer - format: int64 - title: >- - storage_provider_id the id of the storage provider where - the bundle is stored - compression_id: - type: integer - format: int64 - title: >- - compression_id the id of the compression type with which - the data was compressed - title: >- - FinalizedBundle represents a bundle proposal where the - majority - - agreed on its validity - description: finalized_bundles ... - 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: >- - QueryStakersByPoolResponse is the response type for the - Query/Staker 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 - tags: - - QueryBundles /kyve/query/v1beta1/delegator/{staker}/{delegator}: get: summary: >- diff --git a/proto/kyve/bundles/v1beta1/bundles.proto b/proto/kyve/bundles/v1beta1/bundles.proto index cefd8b25..aca75779 100644 --- a/proto/kyve/bundles/v1beta1/bundles.proto +++ b/proto/kyve/bundles/v1beta1/bundles.proto @@ -100,3 +100,44 @@ message FinalizedAt { // timestamp ... uint64 timestamp = 2; } +<<<<<<< HEAD +======= + +// FinalizedAt ... +message StakeSecurity { + // valid_vote_power ... + uint64 valid_vote_power = 1; + // total_vote_power ... + uint64 total_vote_power = 2; +} + +// BundleVersionEntry ... +message BundleVersionEntry { + // height ... + uint64 height = 1; + // version ... + int32 version = 2; +} + +// BundleVersionMap ... +message BundleVersionMap { + // versions ... + repeated BundleVersionEntry versions = 1; +} + +// RoundRobinSingleValidatorProgress ... +message RoundRobinSingleValidatorProgress { + // address ... + string address = 1; + // progress ... + int64 progress = 2; +} + +// RoundRobinProgress ... +message RoundRobinProgress { + // pool_id ... + uint64 pool_id = 1; + // progress_list ... + repeated RoundRobinSingleValidatorProgress progress_list = 2; +} +>>>>>>> cf4857f (feat: improved schema for finalized bundles query (#104)) diff --git a/proto/kyve/query/v1beta1/bundles.proto b/proto/kyve/query/v1beta1/bundles.proto index 60b731f3..8e685589 100644 --- a/proto/kyve/query/v1beta1/bundles.proto +++ b/proto/kyve/query/v1beta1/bundles.proto @@ -5,25 +5,19 @@ package kyve.query.v1beta1; import "cosmos/base/query/v1beta1/pagination.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "kyve/bundles/v1beta1/bundles.proto"; option go_package = "github.com/KYVENetwork/chain/x/query/types"; // QueryDelegation contains all rpc requests related to direct delegation data service QueryBundles { // FinalizedBundles ... - rpc FinalizedBundles(QueryFinalizedBundlesRequest) returns (QueryFinalizedBundlesResponse) { - option (google.api.http).get = "/kyve/query/v1beta1/finalized_bundles/{pool_id}"; + rpc FinalizedBundlesQuery(QueryFinalizedBundlesRequest) returns (QueryFinalizedBundlesResponse) { + option (google.api.http).get = "/kyve/v1/bundles/{pool_id}"; } // FinalizedBundle ... - rpc FinalizedBundle(QueryFinalizedBundleRequest) returns (QueryFinalizedBundleResponse) { - option (google.api.http).get = "/kyve/query/v1beta1/finalized_bundle/{pool_id}/{id}"; - } - - // Queries the bundle which contains the data given height - rpc FinalizedBundlesByHeight(QueryFinalizedBundlesByHeightRequest) returns (QueryFinalizedBundlesByHeightResponse) { - option (google.api.http).get = "/kyve/query/v1beta1/finalized_bundle_by_height/{pool_id}/{height}"; + rpc FinalizedBundleQuery(QueryFinalizedBundleRequest) returns (FinalizedBundle) { + option (google.api.http).get = "/kyve/v1/bundles/{pool_id}/{id}"; } // CurrentVoteStatus ... @@ -47,6 +41,56 @@ service QueryBundles { } } +// FinalizedBundle represents the latest version of a valid bundle of a pool +message FinalizedBundle { + // pool_id in which the bundle was created + uint64 pool_id = 1; + // id is is integrated with each valid bundle produced. + uint64 id = 2; + // storage_id is the id with which the data can be retrieved from the configured data provider + string storage_id = 3; + // uploader is the address of the staker who submitted this bundle + string uploader = 4; + // from_index is the index from where the bundle starts (inclusive) + uint64 from_index = 5; + // to_index is the index to which the bundle goes (exclusive) + uint64 to_index = 6; + // from_key is the key of the first data item in the bundle proposal + string from_key = 11; + // to_key the key of the last data item in the bundle + string to_key = 7; + // bundle_summary is a summary of the bundle. + string bundle_summary = 8; + // data_hash is a sha256 hash of the uploaded data. + string data_hash = 9; + // finalized_at contains details of the block that finalized this bundle. + FinalizedAt finalized_at = 10; + // storage_provider_id the id of the storage provider where the bundle is stored + uint64 storage_provider_id = 12; + // compression_id the id of the compression type with which the data was compressed + uint64 compression_id = 13; + // stake_security defines the amount of stake which was present in the pool during the finalization of the bundle. + // This field was added in schema version 2. Bundles finalized before that return `null`. + StakeSecurity stake_security = 14; +} + +// FinalizedAt stores information about finalization block and time. +message FinalizedAt { + // height is the block height in which the bundle got finalized. + string height = 1 [(gogoproto.customtype) = "cosmossdk.io/math.Int"]; + // timestamp is the UNIX timestamp of the block in which the bundle got finalized. + string timestamp = 2 [(gogoproto.customtype) = "cosmossdk.io/math.Int"]; +} + +// StakeSecurity represents the relative security of a finalized bundle +message StakeSecurity { + // valid_vote_power gives the amount of $KYVE stake that voted `valid`. + string valid_vote_power = 1 [(gogoproto.customtype) = "cosmossdk.io/math.Int"]; + // total_vote_power gives the amount of total $KYVE stake that was present in the pool + // during finalization. + string total_vote_power = 2 [(gogoproto.customtype) = "cosmossdk.io/math.Int"]; +} + // =========================== // finalized_bundles/{pool_id} // =========================== @@ -57,12 +101,15 @@ message QueryFinalizedBundlesRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; // pool_id ... uint64 pool_id = 2; + // index is an optional parameter which tells the server to only show + // the bundle with the given index. This can not be combined with pagination. + string index = 3; } // QueryStakersByPoolResponse is the response type for the Query/Staker RPC method. message QueryFinalizedBundlesResponse { // finalized_bundles ... - repeated kyve.bundles.v1beta1.FinalizedBundle finalized_bundles = 1 [(gogoproto.nullable) = false]; + repeated FinalizedBundle finalized_bundles = 1 [(gogoproto.nullable) = false]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; } @@ -81,26 +128,8 @@ message QueryFinalizedBundleRequest { // QueryFinalizedBundleResponse is the response type for the Query/Staker RPC method. message QueryFinalizedBundleResponse { - // finalized_bundle ... - kyve.bundles.v1beta1.FinalizedBundle finalized_bundle = 1 [(gogoproto.nullable) = false]; -} - -// =================================== -// finalized_bundle_by_height/{height} -// =================================== - -// QueryFinalizedBundleRequest is the request type for the Query/Staker RPC method. -message QueryFinalizedBundlesByHeightRequest { - // pool_id ... - uint64 pool_id = 1; - // id ... - uint64 height = 2; -} - -// QueryFinalizedBundleResponse is the response type for the Query/Staker RPC method. -message QueryFinalizedBundlesByHeightResponse { - // finalized_bundle ... - kyve.bundles.v1beta1.FinalizedBundle finalized_bundle = 1 [(gogoproto.nullable) = false]; + // finalized_bundles ... + FinalizedBundle finalized_bundles = 1 [(gogoproto.nullable) = false]; } // =============================== diff --git a/testutil/integration/checks.go b/testutil/integration/checks.go index 0a3ff216..eb294b1c 100644 --- a/testutil/integration/checks.go +++ b/testutil/integration/checks.go @@ -2,6 +2,7 @@ package integration import ( "github.com/KYVENetwork/chain/x/bundles" + bundlesTypes "github.com/KYVENetwork/chain/x/bundles/types" "github.com/KYVENetwork/chain/x/delegation" delegationtypes "github.com/KYVENetwork/chain/x/delegation/types" globalTypes "github.com/KYVENetwork/chain/x/global/types" @@ -260,12 +261,29 @@ func (suite *KeeperTestSuite) VerifyStakersGenesisImportExport() { // bundles module checks // ===================== +func checkFinalizedBundle(queryBundle querytypes.FinalizedBundle, rawBundle bundlesTypes.FinalizedBundle) { + Expect(queryBundle.Id).To(Equal(rawBundle.Id)) + Expect(queryBundle.PoolId).To(Equal(rawBundle.PoolId)) + Expect(queryBundle.StorageId).To(Equal(rawBundle.StorageId)) + Expect(queryBundle.Uploader).To(Equal(rawBundle.Uploader)) + Expect(queryBundle.FromIndex).To(Equal(rawBundle.FromIndex)) + Expect(queryBundle.ToIndex).To(Equal(rawBundle.ToIndex)) + Expect(queryBundle.ToKey).To(Equal(rawBundle.ToKey)) + Expect(queryBundle.BundleSummary).To(Equal(rawBundle.BundleSummary)) + Expect(queryBundle.DataHash).To(Equal(rawBundle.DataHash)) + Expect(queryBundle.FinalizedAt.Height.Uint64()).To(Equal(rawBundle.FinalizedAt.Height)) + Expect(queryBundle.FinalizedAt.Timestamp.Uint64()).To(Equal(rawBundle.FinalizedAt.Timestamp)) + Expect(queryBundle.FromKey).To(Equal(rawBundle.FromKey)) + Expect(queryBundle.StorageProviderId).To(Equal(uint64(rawBundle.StorageProviderId))) + Expect(queryBundle.CompressionId).To(Equal(uint64(rawBundle.CompressionId))) +} + func (suite *KeeperTestSuite) VerifyBundlesQueries() { pools := suite.App().PoolKeeper.GetAllPools(suite.Ctx()) for _, pool := range pools { finalizedBundlesState := suite.App().BundlesKeeper.GetFinalizedBundlesByPool(suite.Ctx(), pool.Id) - finalizedBundlesQuery, finalizedBundlesQueryErr := suite.App().QueryKeeper.FinalizedBundles(sdk.WrapSDKContext(suite.Ctx()), &querytypes.QueryFinalizedBundlesRequest{ + finalizedBundlesQuery, finalizedBundlesQueryErr := suite.App().QueryKeeper.FinalizedBundlesQuery(sdk.WrapSDKContext(suite.Ctx()), &querytypes.QueryFinalizedBundlesRequest{ PoolId: pool.Id, }) @@ -273,15 +291,15 @@ func (suite *KeeperTestSuite) VerifyBundlesQueries() { Expect(finalizedBundlesQuery.FinalizedBundles).To(HaveLen(len(finalizedBundlesState))) for i := range finalizedBundlesState { - Expect(finalizedBundlesQuery.FinalizedBundles[i]).To(Equal(finalizedBundlesState[i])) - finalizedBundleQuery, finalizedBundleQueryErr := suite.App().QueryKeeper.FinalizedBundle(sdk.WrapSDKContext(suite.Ctx()), &querytypes.QueryFinalizedBundleRequest{ + finalizedBundle, finalizedBundleQueryErr := suite.App().QueryKeeper.FinalizedBundleQuery(sdk.WrapSDKContext(suite.Ctx()), &querytypes.QueryFinalizedBundleRequest{ PoolId: pool.Id, Id: finalizedBundlesState[i].Id, }) Expect(finalizedBundleQueryErr).To(BeNil()) - Expect(finalizedBundleQuery.FinalizedBundle).To(Equal(finalizedBundlesState[i])) + + checkFinalizedBundle(*finalizedBundle, finalizedBundlesState[i]) } } } diff --git a/x/bundles/keeper/getters_bundles.go b/x/bundles/keeper/getters_bundles.go index 060bdb4f..5b82d54b 100644 --- a/x/bundles/keeper/getters_bundles.go +++ b/x/bundles/keeper/getters_bundles.go @@ -2,14 +2,18 @@ package keeper import ( "encoding/binary" + "fmt" + + cosmossdk_io_math "cosmossdk.io/math" + + queryTypes "github.com/KYVENetwork/chain/x/query/types" + storeTypes "github.com/cosmos/cosmos-sdk/store/types" "github.com/KYVENetwork/chain/util" "github.com/KYVENetwork/chain/x/bundles/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" ) // SetBundleProposal stores a current bundle proposal in the KV-Store. @@ -69,9 +73,9 @@ func (k Keeper) SetFinalizedBundle(ctx sdk.Context, finalizedBundle types.Finali // SetFinalizedBundleIndexes sets an in-memory reference for every bundle sorted by pool/fromIndex // to allow querying for specific bundle ranges. func (k Keeper) SetFinalizedBundleIndexes(ctx sdk.Context, finalizedBundle types.FinalizedBundle) { - indexByStorageHeight := prefix.NewStore(ctx.KVStore(k.memKey), types.FinalizedBundleByHeightPrefix) - indexByStorageHeight.Set( - types.FinalizedBundleByHeightKey(finalizedBundle.PoolId, finalizedBundle.FromIndex), + indexByStorageIndex := prefix.NewStore(ctx.KVStore(k.memKey), types.FinalizedBundleByIndexPrefix) + indexByStorageIndex.Set( + types.FinalizedBundleByIndexKey(finalizedBundle.PoolId, finalizedBundle.FromIndex), util.GetByteKey(finalizedBundle.Id)) } @@ -114,34 +118,126 @@ func (k Keeper) GetFinalizedBundle(ctx sdk.Context, poolId, id uint64) (val type return val, true } -// TODO(postAudit,@max) consider performance improvement -func (k Keeper) GetPaginatedFinalizedBundleQuery(ctx sdk.Context, pagination *query.PageRequest, poolId uint64) ([]types.FinalizedBundle, *query.PageResponse, error) { - var data []types.FinalizedBundle +func RawBundleToQueryBundle(rawFinalizedBundle types.FinalizedBundle, versionMap map[int32]uint64) (queryBundle queryTypes.FinalizedBundle) { + finalizedHeight := cosmossdk_io_math.NewInt(int64(rawFinalizedBundle.FinalizedAt.Height)) + finalizedTimestamp := cosmossdk_io_math.NewInt(int64(rawFinalizedBundle.FinalizedAt.Timestamp)) + + finalizedBundle := queryTypes.FinalizedBundle{ + PoolId: rawFinalizedBundle.PoolId, + Id: rawFinalizedBundle.Id, + StorageId: rawFinalizedBundle.StorageId, + Uploader: rawFinalizedBundle.Uploader, + FromIndex: rawFinalizedBundle.FromIndex, + ToIndex: rawFinalizedBundle.ToIndex, + ToKey: rawFinalizedBundle.ToKey, + BundleSummary: rawFinalizedBundle.BundleSummary, + DataHash: rawFinalizedBundle.DataHash, + FinalizedAt: &queryTypes.FinalizedAt{ + Height: &finalizedHeight, + Timestamp: &finalizedTimestamp, + }, + FromKey: rawFinalizedBundle.FromKey, + StorageProviderId: uint64(rawFinalizedBundle.StorageProviderId), + CompressionId: uint64(rawFinalizedBundle.CompressionId), + StakeSecurity: &queryTypes.StakeSecurity{ + ValidVotePower: nil, + TotalVotePower: nil, + }, + } + + // Check for version 2 + // TODO will be done by separate PR + + return finalizedBundle +} + +// GetPaginatedFinalizedBundleQuery parses a paginated request and builds a valid response out of the +// raw finalized bundles. It uses the fact that the ID of a bundle increases incrementally (starting with 0) +// and allows therefore for efficient queries using `offset`. +func (k Keeper) GetPaginatedFinalizedBundleQuery(ctx sdk.Context, pagination *query.PageRequest, poolId uint64) ([]queryTypes.FinalizedBundle, *query.PageResponse, error) { + // Parse basic pagination + if pagination == nil { + pagination = &query.PageRequest{CountTotal: true} + } + offset := pagination.Offset + key := pagination.Key + limit := pagination.Limit + reverse := pagination.Reverse + + if limit == 0 { + limit = query.DefaultLimit + } + + pageResponse := query.PageResponse{} + + // user has to use either offset or key, not both + if offset > 0 && key != nil { + return nil, nil, fmt.Errorf("invalid request, either offset or key is expected, got both") + } + + // Init Bundles Store store := prefix.NewStore(ctx.KVStore(k.storeKey), util.GetByteKey(types.FinalizedBundlePrefix, poolId)) - pageRes, err := query.FilteredPaginate(store, pagination, func(key []byte, value []byte, accumulate bool) (bool, error) { - if accumulate { - var finalizedBundle types.FinalizedBundle - if err := k.cdc.Unmarshal(value, &finalizedBundle); err != nil { - return false, err - } + // Get latest bundle id by obtaining last item from the iterator + reverseIterator := store.ReverseIterator(nil, nil) + if reverseIterator.Valid() { + // Current bundle_id equals the total amount of bundles - 1 + bundleId := binary.BigEndian.Uint64(reverseIterator.Key()) + pageResponse.Total = bundleId + 1 + } + _ = reverseIterator.Close() - data = append(data, finalizedBundle) + // Translate offset to next page keys + if len(key) == 0 { + if reverse { + pagination.Key = util.GetByteKey(pageResponse.Total - offset) + } else { + pagination.Key = util.GetByteKey(offset) } + } - return true, nil - }) - if err != nil { - return nil, nil, status.Error(codes.Internal, err.Error()) + var iterator storeTypes.Iterator + // Use correct iterator depending on the request + if reverse { + iterator = store.ReverseIterator(nil, pagination.Key) + } else { + iterator = store.Iterator(pagination.Key, nil) } - return data, pageRes, nil + var data []queryTypes.FinalizedBundle + versionMap := k.GetBundleVersionMap(ctx).GetMap() + + // Iterate bundle store and build actual response + for i := uint64(0); i < limit; i++ { + if iterator.Valid() { + var rawFinalizedBundle types.FinalizedBundle + if err := k.cdc.Unmarshal(iterator.Value(), &rawFinalizedBundle); err != nil { + return nil, nil, err + } + data = append(data, RawBundleToQueryBundle(rawFinalizedBundle, versionMap)) + pageResponse.NextKey = iterator.Key() + iterator.Next() + } else { + break + } + } + // Fetch next key (if there is one) + if iterator.Valid() { + if !reverse { + pageResponse.NextKey = iterator.Key() + } + } else { + pageResponse.NextKey = nil + } + _ = iterator.Close() + + return data, &pageResponse, nil } -func (k Keeper) GetFinalizedBundleByHeight(ctx sdk.Context, poolId, height uint64) (val types.FinalizedBundle, found bool) { - proposalIndexStore := prefix.NewStore(ctx.KVStore(k.memKey), util.GetByteKey(types.FinalizedBundleByHeightPrefix, poolId)) - proposalIndexIterator := proposalIndexStore.ReverseIterator(nil, util.GetByteKey(height+1)) +func (k Keeper) GetFinalizedBundleByIndex(ctx sdk.Context, poolId, index uint64) (val queryTypes.FinalizedBundle, found bool) { + proposalIndexStore := prefix.NewStore(ctx.KVStore(k.memKey), util.GetByteKey(types.FinalizedBundleByIndexPrefix, poolId)) + proposalIndexIterator := proposalIndexStore.ReverseIterator(nil, util.GetByteKey(index+1)) defer proposalIndexIterator.Close() if proposalIndexIterator.Valid() { @@ -149,10 +245,33 @@ func (k Keeper) GetFinalizedBundleByHeight(ctx sdk.Context, poolId, height uint6 bundle, bundleFound := k.GetFinalizedBundle(ctx, poolId, bundleId) if bundleFound { - if bundle.FromIndex <= height && bundle.ToIndex > height { - return bundle, true + if bundle.FromIndex <= index && bundle.ToIndex > index { + versionMap := k.GetBundleVersionMap(ctx).GetMap() + return RawBundleToQueryBundle(bundle, versionMap), true } } } return } + +// Finalized Bundle Version Map + +// SetBundleVersionMap stores the bundle version map +func (k Keeper) SetBundleVersionMap(ctx sdk.Context, bundleVersionMap types.BundleVersionMap) { + store := ctx.KVStore(k.storeKey) + b := k.cdc.MustMarshal(&bundleVersionMap) + store.Set(types.FinalizedBundleVersionMapKey, b) +} + +// GetBundleVersionMap returns the bundle version map +func (k Keeper) GetBundleVersionMap(ctx sdk.Context) (val types.BundleVersionMap) { + store := ctx.KVStore(k.storeKey) + b := store.Get(types.FinalizedBundleVersionMapKey) + if b == nil { + val.Versions = make([]*types.BundleVersionEntry, 0) + return val + } + + k.cdc.MustUnmarshal(b, &val) + return val +} diff --git a/x/bundles/types/bundles.pb.go b/x/bundles/types/bundles.pb.go index 9343757f..3d06dcf3 100644 --- a/x/bundles/types/bundles.pb.go +++ b/x/bundles/types/bundles.pb.go @@ -460,11 +460,288 @@ func (m *FinalizedAt) GetTimestamp() uint64 { return 0 } +<<<<<<< HEAD +======= +// FinalizedAt ... +type StakeSecurity struct { + // valid_vote_power ... + ValidVotePower uint64 `protobuf:"varint,1,opt,name=valid_vote_power,json=validVotePower,proto3" json:"valid_vote_power,omitempty"` + // total_vote_power ... + TotalVotePower uint64 `protobuf:"varint,2,opt,name=total_vote_power,json=totalVotePower,proto3" json:"total_vote_power,omitempty"` +} + +func (m *StakeSecurity) Reset() { *m = StakeSecurity{} } +func (m *StakeSecurity) String() string { return proto.CompactTextString(m) } +func (*StakeSecurity) ProtoMessage() {} +func (*StakeSecurity) Descriptor() ([]byte, []int) { + return fileDescriptor_889cf76d77a4de2b, []int{3} +} +func (m *StakeSecurity) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StakeSecurity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StakeSecurity.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 *StakeSecurity) XXX_Merge(src proto.Message) { + xxx_messageInfo_StakeSecurity.Merge(m, src) +} +func (m *StakeSecurity) XXX_Size() int { + return m.Size() +} +func (m *StakeSecurity) XXX_DiscardUnknown() { + xxx_messageInfo_StakeSecurity.DiscardUnknown(m) +} + +var xxx_messageInfo_StakeSecurity proto.InternalMessageInfo + +func (m *StakeSecurity) GetValidVotePower() uint64 { + if m != nil { + return m.ValidVotePower + } + return 0 +} + +func (m *StakeSecurity) GetTotalVotePower() uint64 { + if m != nil { + return m.TotalVotePower + } + return 0 +} + +// BundleVersionEntry ... +type BundleVersionEntry struct { + // height ... + Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + // version ... + Version int32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` +} + +func (m *BundleVersionEntry) Reset() { *m = BundleVersionEntry{} } +func (m *BundleVersionEntry) String() string { return proto.CompactTextString(m) } +func (*BundleVersionEntry) ProtoMessage() {} +func (*BundleVersionEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_889cf76d77a4de2b, []int{4} +} +func (m *BundleVersionEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BundleVersionEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BundleVersionEntry.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 *BundleVersionEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_BundleVersionEntry.Merge(m, src) +} +func (m *BundleVersionEntry) XXX_Size() int { + return m.Size() +} +func (m *BundleVersionEntry) XXX_DiscardUnknown() { + xxx_messageInfo_BundleVersionEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_BundleVersionEntry proto.InternalMessageInfo + +func (m *BundleVersionEntry) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *BundleVersionEntry) GetVersion() int32 { + if m != nil { + return m.Version + } + return 0 +} + +// BundleVersionMap ... +type BundleVersionMap struct { + // versions ... + Versions []*BundleVersionEntry `protobuf:"bytes,1,rep,name=versions,proto3" json:"versions,omitempty"` +} + +func (m *BundleVersionMap) Reset() { *m = BundleVersionMap{} } +func (m *BundleVersionMap) String() string { return proto.CompactTextString(m) } +func (*BundleVersionMap) ProtoMessage() {} +func (*BundleVersionMap) Descriptor() ([]byte, []int) { + return fileDescriptor_889cf76d77a4de2b, []int{5} +} +func (m *BundleVersionMap) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BundleVersionMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BundleVersionMap.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 *BundleVersionMap) XXX_Merge(src proto.Message) { + xxx_messageInfo_BundleVersionMap.Merge(m, src) +} +func (m *BundleVersionMap) XXX_Size() int { + return m.Size() +} +func (m *BundleVersionMap) XXX_DiscardUnknown() { + xxx_messageInfo_BundleVersionMap.DiscardUnknown(m) +} + +var xxx_messageInfo_BundleVersionMap proto.InternalMessageInfo + +func (m *BundleVersionMap) GetVersions() []*BundleVersionEntry { + if m != nil { + return m.Versions + } + return nil +} + +// RoundRobinSingleValidatorProgress ... +type RoundRobinSingleValidatorProgress struct { + // address ... + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // progress ... + Progress int64 `protobuf:"varint,2,opt,name=progress,proto3" json:"progress,omitempty"` +} + +func (m *RoundRobinSingleValidatorProgress) Reset() { *m = RoundRobinSingleValidatorProgress{} } +func (m *RoundRobinSingleValidatorProgress) String() string { return proto.CompactTextString(m) } +func (*RoundRobinSingleValidatorProgress) ProtoMessage() {} +func (*RoundRobinSingleValidatorProgress) Descriptor() ([]byte, []int) { + return fileDescriptor_889cf76d77a4de2b, []int{6} +} +func (m *RoundRobinSingleValidatorProgress) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RoundRobinSingleValidatorProgress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RoundRobinSingleValidatorProgress.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 *RoundRobinSingleValidatorProgress) XXX_Merge(src proto.Message) { + xxx_messageInfo_RoundRobinSingleValidatorProgress.Merge(m, src) +} +func (m *RoundRobinSingleValidatorProgress) XXX_Size() int { + return m.Size() +} +func (m *RoundRobinSingleValidatorProgress) XXX_DiscardUnknown() { + xxx_messageInfo_RoundRobinSingleValidatorProgress.DiscardUnknown(m) +} + +var xxx_messageInfo_RoundRobinSingleValidatorProgress proto.InternalMessageInfo + +func (m *RoundRobinSingleValidatorProgress) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *RoundRobinSingleValidatorProgress) GetProgress() int64 { + if m != nil { + return m.Progress + } + return 0 +} + +// RoundRobinProgress ... +type RoundRobinProgress struct { + // pool_id ... + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // progress_list ... + ProgressList []*RoundRobinSingleValidatorProgress `protobuf:"bytes,2,rep,name=progress_list,json=progressList,proto3" json:"progress_list,omitempty"` +} + +func (m *RoundRobinProgress) Reset() { *m = RoundRobinProgress{} } +func (m *RoundRobinProgress) String() string { return proto.CompactTextString(m) } +func (*RoundRobinProgress) ProtoMessage() {} +func (*RoundRobinProgress) Descriptor() ([]byte, []int) { + return fileDescriptor_889cf76d77a4de2b, []int{7} +} +func (m *RoundRobinProgress) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RoundRobinProgress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RoundRobinProgress.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 *RoundRobinProgress) XXX_Merge(src proto.Message) { + xxx_messageInfo_RoundRobinProgress.Merge(m, src) +} +func (m *RoundRobinProgress) XXX_Size() int { + return m.Size() +} +func (m *RoundRobinProgress) XXX_DiscardUnknown() { + xxx_messageInfo_RoundRobinProgress.DiscardUnknown(m) +} + +var xxx_messageInfo_RoundRobinProgress proto.InternalMessageInfo + +func (m *RoundRobinProgress) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *RoundRobinProgress) GetProgressList() []*RoundRobinSingleValidatorProgress { + if m != nil { + return m.ProgressList + } + return nil +} + +>>>>>>> cf4857f (feat: improved schema for finalized bundles query (#104)) func init() { proto.RegisterEnum("kyve.bundles.v1beta1.BundleStatus", BundleStatus_name, BundleStatus_value) proto.RegisterType((*BundleProposal)(nil), "kyve.bundles.v1beta1.BundleProposal") proto.RegisterType((*FinalizedBundle)(nil), "kyve.bundles.v1beta1.FinalizedBundle") proto.RegisterType((*FinalizedAt)(nil), "kyve.bundles.v1beta1.FinalizedAt") +<<<<<<< HEAD +======= + proto.RegisterType((*StakeSecurity)(nil), "kyve.bundles.v1beta1.StakeSecurity") + proto.RegisterType((*BundleVersionEntry)(nil), "kyve.bundles.v1beta1.BundleVersionEntry") + proto.RegisterType((*BundleVersionMap)(nil), "kyve.bundles.v1beta1.BundleVersionMap") + proto.RegisterType((*RoundRobinSingleValidatorProgress)(nil), "kyve.bundles.v1beta1.RoundRobinSingleValidatorProgress") + proto.RegisterType((*RoundRobinProgress)(nil), "kyve.bundles.v1beta1.RoundRobinProgress") +>>>>>>> cf4857f (feat: improved schema for finalized bundles query (#104)) } func init() { @@ -472,6 +749,7 @@ func init() { } var fileDescriptor_889cf76d77a4de2b = []byte{ +<<<<<<< HEAD // 710 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0xcd, 0x6e, 0x1a, 0x49, 0x14, 0x85, 0x69, 0xc0, 0x40, 0x5f, 0x7e, 0xcc, 0x94, 0xff, 0xda, 0x78, 0xcc, 0x60, 0x8f, 0x46, @@ -518,6 +796,65 @@ var fileDescriptor_889cf76d77a4de2b = []byte{ 0xdb, 0x84, 0xbf, 0x61, 0xde, 0x55, 0xf5, 0x62, 0x88, 0xa9, 0x53, 0xbd, 0x9e, 0xbf, 0xb9, 0x7c, 0xe6, 0x12, 0xbf, 0x9f, 0x90, 0xcf, 0xe7, 0x3f, 0xdf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xed, 0x76, 0x9f, 0x61, 0x90, 0x05, 0x00, 0x00, +======= + // 895 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x4d, 0x6f, 0xe2, 0x46, + 0x18, 0xc6, 0x40, 0xf8, 0x78, 0xf9, 0x58, 0x3a, 0xfb, 0x11, 0x27, 0xdb, 0x50, 0x42, 0x55, 0x09, + 0x55, 0x15, 0x68, 0xb7, 0x87, 0x9e, 0xc9, 0x02, 0xaa, 0xb5, 0x59, 0x96, 0xda, 0x0b, 0xea, 0x56, + 0x95, 0xac, 0x01, 0x4f, 0x60, 0x14, 0xe3, 0xb1, 0xec, 0x81, 0x0d, 0xf9, 0x05, 0x95, 0x7a, 0xe9, + 0x7f, 0x68, 0x7f, 0x46, 0x4f, 0x3d, 0xf5, 0xb8, 0xc7, 0x1e, 0xab, 0xe4, 0x8f, 0x54, 0x33, 0x63, + 0x3b, 0xb0, 0x49, 0xda, 0xbd, 0xf4, 0xe6, 0xf7, 0x79, 0x9e, 0x79, 0xe7, 0xfd, 0x78, 0x46, 0x86, + 0xe6, 0xf9, 0x66, 0x4d, 0x3a, 0xd3, 0x95, 0xe7, 0xb8, 0x24, 0xec, 0xac, 0x9f, 0x4d, 0x09, 0xc7, + 0xcf, 0xe2, 0xb8, 0xed, 0x07, 0x8c, 0x33, 0xf4, 0x48, 0x68, 0xda, 0x31, 0x16, 0x69, 0x0e, 0x1f, + 0xcd, 0xd9, 0x9c, 0x49, 0x41, 0x47, 0x7c, 0x29, 0x6d, 0xf3, 0xb7, 0x2c, 0x54, 0x4f, 0xa4, 0x72, + 0x14, 0x30, 0x9f, 0x85, 0xd8, 0x45, 0xfb, 0x90, 0xf7, 0x19, 0x73, 0x6d, 0xea, 0xe8, 0x5a, 0x43, + 0x6b, 0x65, 0xcd, 0x9c, 0x08, 0x0d, 0x07, 0x1d, 0x01, 0x84, 0x9c, 0x05, 0x78, 0x4e, 0x04, 0x97, + 0x6e, 0x68, 0xad, 0xa2, 0x59, 0x8c, 0x10, 0xc3, 0x41, 0x87, 0x50, 0x58, 0xf9, 0x2e, 0xc3, 0x0e, + 0x09, 0xf4, 0x8c, 0x24, 0x93, 0x18, 0x7d, 0x0e, 0x15, 0x8f, 0x5c, 0x70, 0x3b, 0x11, 0x64, 0xa5, + 0xa0, 0x2c, 0xc0, 0x71, 0x2c, 0x7a, 0x0a, 0x45, 0x07, 0x73, 0x6c, 0x87, 0xf4, 0x92, 0xe8, 0x7b, + 0xf2, 0xea, 0x82, 0x00, 0x2c, 0x7a, 0x49, 0xd0, 0x67, 0x50, 0x52, 0x1d, 0x29, 0x3a, 0x27, 0x69, + 0x50, 0x90, 0x14, 0x3c, 0x86, 0x1c, 0x67, 0xf6, 0x39, 0xd9, 0xe8, 0x79, 0x99, 0x7b, 0x8f, 0xb3, + 0x97, 0x64, 0x83, 0xbe, 0x80, 0x6a, 0x7c, 0x6e, 0xb5, 0x5c, 0xe2, 0x60, 0xa3, 0x17, 0x24, 0x5d, + 0x89, 0x8e, 0x2a, 0x30, 0xb9, 0x7b, 0x81, 0xc3, 0x85, 0x5e, 0x54, 0xd5, 0x0b, 0xe0, 0x5b, 0x1c, + 0x2e, 0x44, 0xe3, 0x2b, 0xdf, 0xc1, 0x9c, 0x38, 0x36, 0xe6, 0x3a, 0xc8, 0xab, 0x8b, 0x11, 0xd2, + 0xe5, 0xe8, 0x18, 0xca, 0x6b, 0xc6, 0x49, 0x10, 0xda, 0x6b, 0xec, 0x52, 0x47, 0x2f, 0x35, 0x32, + 0xad, 0xa2, 0x59, 0x52, 0xd8, 0x44, 0x40,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c7, 0xf2, 0x8d, 0x4f, 0xc2, 0x69, 0x4e, 0xfe, 0x2e, + 0xbf, 0xfe, 0x27, 0x00, 0x00, 0xff, 0xff, 0x4b, 0x5b, 0xbb, 0x33, 0x80, 0x07, 0x00, 0x00, +>>>>>>> cf4857f (feat: improved schema for finalized bundles query (#104)) } func (m *BundleProposal) Marshal() (dAtA []byte, err error) { @@ -791,51 +1128,234 @@ func (m *FinalizedAt) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintBundles(dAtA []byte, offset int, v uint64) int { - offset -= sovBundles(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +<<<<<<< HEAD +======= +func (m *StakeSecurity) 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[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *BundleProposal) Size() (n int) { - if m == nil { - return 0 - } + +func (m *StakeSecurity) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StakeSecurity) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.PoolId != 0 { - n += 1 + sovBundles(uint64(m.PoolId)) - } - l = len(m.StorageId) - if l > 0 { - n += 1 + l + sovBundles(uint64(l)) + if m.TotalVotePower != 0 { + i = encodeVarintBundles(dAtA, i, uint64(m.TotalVotePower)) + i-- + dAtA[i] = 0x10 } - l = len(m.Uploader) - if l > 0 { - n += 1 + l + sovBundles(uint64(l)) + if m.ValidVotePower != 0 { + i = encodeVarintBundles(dAtA, i, uint64(m.ValidVotePower)) + i-- + dAtA[i] = 0x8 } - l = len(m.NextUploader) - if l > 0 { - n += 1 + l + sovBundles(uint64(l)) + return len(dAtA) - i, nil +} + +func (m *BundleVersionEntry) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - if m.DataSize != 0 { - n += 1 + sovBundles(uint64(m.DataSize)) + return dAtA[:n], nil +} + +func (m *BundleVersionEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BundleVersionEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Version != 0 { + i = encodeVarintBundles(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x10 } - if m.BundleSize != 0 { - n += 1 + sovBundles(uint64(m.BundleSize)) + if m.Height != 0 { + i = encodeVarintBundles(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 } - l = len(m.ToKey) - if l > 0 { - n += 1 + l + sovBundles(uint64(l)) + return len(dAtA) - i, nil +} + +func (m *BundleVersionMap) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - l = len(m.BundleSummary) - if l > 0 { - n += 1 + l + sovBundles(uint64(l)) + return dAtA[:n], nil +} + +func (m *BundleVersionMap) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BundleVersionMap) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Versions) > 0 { + for iNdEx := len(m.Versions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Versions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBundles(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *RoundRobinSingleValidatorProgress) 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 *RoundRobinSingleValidatorProgress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RoundRobinSingleValidatorProgress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Progress != 0 { + i = encodeVarintBundles(dAtA, i, uint64(m.Progress)) + i-- + dAtA[i] = 0x10 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintBundles(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RoundRobinProgress) 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 *RoundRobinProgress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RoundRobinProgress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ProgressList) > 0 { + for iNdEx := len(m.ProgressList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ProgressList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBundles(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.PoolId != 0 { + i = encodeVarintBundles(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +>>>>>>> cf4857f (feat: improved schema for finalized bundles query (#104)) +func encodeVarintBundles(dAtA []byte, offset int, v uint64) int { + offset -= sovBundles(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *BundleProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovBundles(uint64(m.PoolId)) + } + l = len(m.StorageId) + if l > 0 { + n += 1 + l + sovBundles(uint64(l)) + } + l = len(m.Uploader) + if l > 0 { + n += 1 + l + sovBundles(uint64(l)) + } + l = len(m.NextUploader) + if l > 0 { + n += 1 + l + sovBundles(uint64(l)) + } + if m.DataSize != 0 { + n += 1 + sovBundles(uint64(m.DataSize)) + } + if m.BundleSize != 0 { + n += 1 + sovBundles(uint64(m.BundleSize)) + } + l = len(m.ToKey) + if l > 0 { + n += 1 + l + sovBundles(uint64(l)) + } + l = len(m.BundleSummary) + if l > 0 { + n += 1 + l + sovBundles(uint64(l)) } l = len(m.DataHash) if l > 0 { @@ -945,6 +1465,88 @@ func (m *FinalizedAt) Size() (n int) { return n } +<<<<<<< HEAD +======= +func (m *StakeSecurity) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ValidVotePower != 0 { + n += 1 + sovBundles(uint64(m.ValidVotePower)) + } + if m.TotalVotePower != 0 { + n += 1 + sovBundles(uint64(m.TotalVotePower)) + } + return n +} + +func (m *BundleVersionEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovBundles(uint64(m.Height)) + } + if m.Version != 0 { + n += 1 + sovBundles(uint64(m.Version)) + } + return n +} + +func (m *BundleVersionMap) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Versions) > 0 { + for _, e := range m.Versions { + l = e.Size() + n += 1 + l + sovBundles(uint64(l)) + } + } + return n +} + +func (m *RoundRobinSingleValidatorProgress) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovBundles(uint64(l)) + } + if m.Progress != 0 { + n += 1 + sovBundles(uint64(m.Progress)) + } + return n +} + +func (m *RoundRobinProgress) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovBundles(uint64(m.PoolId)) + } + if len(m.ProgressList) > 0 { + for _, e := range m.ProgressList { + l = e.Size() + n += 1 + l + sovBundles(uint64(l)) + } + } + return n +} + +>>>>>>> cf4857f (feat: improved schema for finalized bundles query (#104)) func sovBundles(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1915,6 +2517,473 @@ func (m *FinalizedAt) Unmarshal(dAtA []byte) error { } return nil } +<<<<<<< HEAD +======= +func (m *StakeSecurity) 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 ErrIntOverflowBundles + } + 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: StakeSecurity: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StakeSecurity: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidVotePower", wireType) + } + m.ValidVotePower = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidVotePower |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalVotePower", wireType) + } + m.TotalVotePower = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalVotePower |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipBundles(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBundles + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BundleVersionEntry) 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 ErrIntOverflowBundles + } + 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: BundleVersionEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BundleVersionEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipBundles(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBundles + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BundleVersionMap) 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 ErrIntOverflowBundles + } + 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: BundleVersionMap: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BundleVersionMap: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Versions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBundles + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBundles + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Versions = append(m.Versions, &BundleVersionEntry{}) + if err := m.Versions[len(m.Versions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBundles(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBundles + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RoundRobinSingleValidatorProgress) 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 ErrIntOverflowBundles + } + 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: RoundRobinSingleValidatorProgress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RoundRobinSingleValidatorProgress: 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 ErrIntOverflowBundles + } + 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 ErrInvalidLengthBundles + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBundles + } + 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 Progress", wireType) + } + m.Progress = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Progress |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipBundles(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBundles + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RoundRobinProgress) 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 ErrIntOverflowBundles + } + 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: RoundRobinProgress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RoundRobinProgress: 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 ErrIntOverflowBundles + } + 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 ProgressList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBundles + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBundles + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProgressList = append(m.ProgressList, &RoundRobinSingleValidatorProgress{}) + if err := m.ProgressList[len(m.ProgressList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBundles(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBundles + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +>>>>>>> cf4857f (feat: improved schema for finalized bundles query (#104)) func skipBundles(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/bundles/types/keys.go b/x/bundles/types/keys.go index 0c5597bf..ff3f17eb 100644 --- a/x/bundles/types/keys.go +++ b/x/bundles/types/keys.go @@ -25,8 +25,15 @@ var ( BundleKeyPrefix = []byte{1} // FinalizedBundlePrefix ... FinalizedBundlePrefix = []byte{2} - - FinalizedBundleByHeightPrefix = []byte{11} +<<<<<<< HEAD +======= + // FinalizedBundleVersionMapKey ... + FinalizedBundleVersionMapKey = []byte{3} + // RoundRobinProgressPrefix ... + RoundRobinProgressPrefix = []byte{4} +>>>>>>> cf4857f (feat: improved schema for finalized bundles query (#104)) + + FinalizedBundleByIndexPrefix = []byte{11} ) // BundleProposalKey ... @@ -39,7 +46,17 @@ func FinalizedBundleKey(poolId uint64, id uint64) []byte { return util.GetByteKey(poolId, id) } +<<<<<<< HEAD // FinalizedBundleByHeightKey ... func FinalizedBundleByHeightKey(poolId uint64, height uint64) []byte { +======= +// RoundRobinProgressKey ... +func RoundRobinProgressKey(poolId uint64) []byte { + return util.GetByteKey(poolId) +} + +// FinalizedBundleByIndexKey ... +func FinalizedBundleByIndexKey(poolId uint64, height uint64) []byte { +>>>>>>> cf4857f (feat: improved schema for finalized bundles query (#104)) return util.GetByteKey(poolId, height) } diff --git a/x/bundles/types/types.go b/x/bundles/types/types.go index d26d4556..64ed1d6b 100644 --- a/x/bundles/types/types.go +++ b/x/bundles/types/types.go @@ -23,3 +23,15 @@ type BundleReward struct { // total ... Total uint64 } + +// GetMap converts to array to a go map which return the upgrade-height for each version. +// e.g. the schema changed from v1 to v2 at block 1,000. +// then: GetMap()[2] = 1000 +// Version 1 start at 0 and is not encoded in the map +func (bundleVersionMap BundleVersionMap) GetMap() (versionMap map[int32]uint64) { + versionMap = make(map[int32]uint64, 0) + for _, entry := range bundleVersionMap.Versions { + versionMap[entry.Version] = entry.Height + } + return +} diff --git a/x/query/client/cli/query_finalized_bundles.go b/x/query/client/cli/query_finalized_bundles.go index 1e3e2688..1b8b99e5 100644 --- a/x/query/client/cli/query_finalized_bundles.go +++ b/x/query/client/cli/query_finalized_bundles.go @@ -39,7 +39,7 @@ func CmdListFinalizedBundles() *cobra.Command { Pagination: pageReq, } - res, err := queryClient.FinalizedBundles(context.Background(), params) + res, err := queryClient.FinalizedBundlesQuery(context.Background(), params) if err != nil { return err } @@ -79,7 +79,7 @@ func CmdShowFinalizedBundle() *cobra.Command { Id: bundleId, } - res, err := queryClient.FinalizedBundle(context.Background(), params) + res, err := queryClient.FinalizedBundleQuery(context.Background(), params) if err != nil { return err } diff --git a/x/query/keeper/grpc_query_finalized_bundle.go b/x/query/keeper/grpc_query_finalized_bundle.go deleted file mode 100644 index a5af464d..00000000 --- a/x/query/keeper/grpc_query_finalized_bundle.go +++ /dev/null @@ -1,53 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/KYVENetwork/chain/x/query/types" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func (k Keeper) FinalizedBundles(c context.Context, req *types.QueryFinalizedBundlesRequest) (*types.QueryFinalizedBundlesResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - - finalizedBundles, pageRes, err := k.bundleKeeper.GetPaginatedFinalizedBundleQuery(ctx, req.Pagination, req.PoolId) - if err != nil { - return nil, err - } - - return &types.QueryFinalizedBundlesResponse{FinalizedBundles: finalizedBundles, Pagination: pageRes}, nil -} - -func (k Keeper) FinalizedBundle(c context.Context, req *types.QueryFinalizedBundleRequest) (*types.QueryFinalizedBundleResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - finalizedBundle, found := k.bundleKeeper.GetFinalizedBundle(ctx, req.PoolId, req.Id) - if !found { - return nil, sdkerrors.ErrKeyNotFound - } - - return &types.QueryFinalizedBundleResponse{FinalizedBundle: finalizedBundle}, nil -} - -func (k Keeper) FinalizedBundlesByHeight(goCtx context.Context, req *types.QueryFinalizedBundlesByHeightRequest) (*types.QueryFinalizedBundlesByHeightResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - finalizedBundle, found := k.bundleKeeper.GetFinalizedBundleByHeight(ctx, req.PoolId, req.Height) - if !found { - return nil, sdkerrors.ErrKeyNotFound - } - - return &types.QueryFinalizedBundlesByHeightResponse{FinalizedBundle: finalizedBundle}, nil -} diff --git a/x/query/keeper/grpc_query_finalized_bundles.go b/x/query/keeper/grpc_query_finalized_bundles.go new file mode 100644 index 00000000..f792bd92 --- /dev/null +++ b/x/query/keeper/grpc_query_finalized_bundles.go @@ -0,0 +1,53 @@ +package keeper + +import ( + "context" + "strconv" + + bundlesKeeper "github.com/KYVENetwork/chain/x/bundles/keeper" + "github.com/KYVENetwork/chain/x/query/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) FinalizedBundlesQuery(c context.Context, req *types.QueryFinalizedBundlesRequest) (*types.QueryFinalizedBundlesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(c) + + if req.Index != "" { + index, err := strconv.ParseUint(req.Index, 10, 64) + if err != nil { + return nil, status.Error(codes.InvalidArgument, "index needs to be an unsigned integer") + } + bundle, found := k.bundleKeeper.GetFinalizedBundleByIndex(ctx, req.PoolId, index) + data := make([]types.FinalizedBundle, 0) + if found { + data = append(data, bundle) + } + return &types.QueryFinalizedBundlesResponse{FinalizedBundles: data, Pagination: nil}, nil + } else { + finalizedBundles, pageRes, err := k.bundleKeeper.GetPaginatedFinalizedBundleQuery(ctx, req.Pagination, req.PoolId) + return &types.QueryFinalizedBundlesResponse{FinalizedBundles: finalizedBundles, Pagination: pageRes}, err + } +} + +func (k Keeper) FinalizedBundleQuery(c context.Context, req *types.QueryFinalizedBundleRequest) (*types.FinalizedBundle, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(c) + finalizedBundle, found := k.bundleKeeper.GetFinalizedBundle(ctx, req.PoolId, req.Id) + if !found { + return nil, sdkerrors.ErrKeyNotFound + } + + versionMap := k.bundleKeeper.GetBundleVersionMap(ctx).GetMap() + response := bundlesKeeper.RawBundleToQueryBundle(finalizedBundle, versionMap) + return &response, nil +} diff --git a/x/query/spec/01_concept.md b/x/query/spec/01_concept.md new file mode 100644 index 00000000..550ba284 --- /dev/null +++ b/x/query/spec/01_concept.md @@ -0,0 +1,89 @@ + + +# Concepts + +The queries module is a little different from the other modules. It does +not maintain a state. Its purpose is to have one place to manage all queries. +A lot of queries require interaction with multiple modules and often do not +belong to a single module. + +Most queries align with the cosmos convention. Api documentation can be found +in the generated swagger file or in the proto files. + +## Finalized Bundles + +Finalized bundles are one of the main features of KYVE. This query will also be +the main query for people building applications on top of KYVE and using +KYVE's data. + +### Bundles query + +The basic structure of the bundles query works as follows. +For the field `finalized_bundles` always the latest schema version is +returned. The different version are explained below. + +**Query**: `/kyve/v1/bundles/{poolId}` + +**Params**: + +| Name | Type | Description | +|-------------------|---------|-------------------------------------------------------| +| pagination.limit | number | Defines the amount of bundles returned | +| pagination.offset | number | The amount of bundles to skip | +| pagination.key | string | Define key if next_key iteration should be used. | +| pagination.revers | boolean | Reverse order | +| index | number | Filters for the bundle which contains the given index | + + +**Response**: +```yaml +{ + "finalized_bundles": "[]FinalizedBundle", + "pagination": { + next_key: "string", + total: number + } +} +``` + + +#### Version 1 + +```yaml +{ + "pool_id": "number", + "id": "number", + "storage_id": "string", + "uploader": "string", + "from_index": "number", + "to_index": "number", + "to_key": "number", + "bundle_summary": "string", + "data_hash": "string", + "finalized_at": { + "height": "number", + "timestamp": "number" + }, + "from_key": "number", + "storage_provider_id": "number", + "compression_id": "number", +} +``` + +#### Version 2 + +For version 2 the field `stake_security` was added. Bundles which +were finalized before the field existed return null. + +```yaml +{ + "stake_security": "number"|null +} +``` + +### Query by Id +To obtain a specific bundle specified by its Id use + +**Query**: `/kyve/v1/bundles/{poolId}/{id}` diff --git a/x/query/types/bundles.pb.go b/x/query/types/bundles.pb.go index 94991af3..ca389cb0 100644 --- a/x/query/types/bundles.pb.go +++ b/x/query/types/bundles.pb.go @@ -5,8 +5,8 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" - 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" @@ -31,19 +31,269 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// FinalizedBundle represents the latest version of a valid bundle of a pool +type FinalizedBundle struct { + // pool_id in which the bundle was created + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // id is is integrated with each valid bundle produced. + Id uint64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` + // storage_id is the id with which the data can be retrieved from the configured data provider + StorageId string `protobuf:"bytes,3,opt,name=storage_id,json=storageId,proto3" json:"storage_id,omitempty"` + // uploader is the address of the staker who submitted this bundle + Uploader string `protobuf:"bytes,4,opt,name=uploader,proto3" json:"uploader,omitempty"` + // from_index is the index from where the bundle starts (inclusive) + FromIndex uint64 `protobuf:"varint,5,opt,name=from_index,json=fromIndex,proto3" json:"from_index,omitempty"` + // to_index is the index to which the bundle goes (exclusive) + ToIndex uint64 `protobuf:"varint,6,opt,name=to_index,json=toIndex,proto3" json:"to_index,omitempty"` + // from_key is the key of the first data item in the bundle proposal + FromKey string `protobuf:"bytes,11,opt,name=from_key,json=fromKey,proto3" json:"from_key,omitempty"` + // to_key the key of the last data item in the bundle + ToKey string `protobuf:"bytes,7,opt,name=to_key,json=toKey,proto3" json:"to_key,omitempty"` + // bundle_summary is a summary of the bundle. + BundleSummary string `protobuf:"bytes,8,opt,name=bundle_summary,json=bundleSummary,proto3" json:"bundle_summary,omitempty"` + // data_hash is a sha256 hash of the uploaded data. + DataHash string `protobuf:"bytes,9,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"` + // finalized_at contains details of the block that finalized this bundle. + FinalizedAt *FinalizedAt `protobuf:"bytes,10,opt,name=finalized_at,json=finalizedAt,proto3" json:"finalized_at,omitempty"` + // storage_provider_id the id of the storage provider where the bundle is stored + StorageProviderId uint64 `protobuf:"varint,12,opt,name=storage_provider_id,json=storageProviderId,proto3" json:"storage_provider_id,omitempty"` + // compression_id the id of the compression type with which the data was compressed + CompressionId uint64 `protobuf:"varint,13,opt,name=compression_id,json=compressionId,proto3" json:"compression_id,omitempty"` + // stake_security defines the amount of stake which was present in the pool during the finalization of the bundle. + // This field was added in schema version 2. Bundles finalized before that return `null`. + StakeSecurity *StakeSecurity `protobuf:"bytes,14,opt,name=stake_security,json=stakeSecurity,proto3" json:"stake_security,omitempty"` +} + +func (m *FinalizedBundle) Reset() { *m = FinalizedBundle{} } +func (m *FinalizedBundle) String() string { return proto.CompactTextString(m) } +func (*FinalizedBundle) ProtoMessage() {} +func (*FinalizedBundle) Descriptor() ([]byte, []int) { + return fileDescriptor_b49b126c38ac815c, []int{0} +} +func (m *FinalizedBundle) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FinalizedBundle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FinalizedBundle.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 *FinalizedBundle) XXX_Merge(src proto.Message) { + xxx_messageInfo_FinalizedBundle.Merge(m, src) +} +func (m *FinalizedBundle) XXX_Size() int { + return m.Size() +} +func (m *FinalizedBundle) XXX_DiscardUnknown() { + xxx_messageInfo_FinalizedBundle.DiscardUnknown(m) +} + +var xxx_messageInfo_FinalizedBundle proto.InternalMessageInfo + +func (m *FinalizedBundle) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *FinalizedBundle) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *FinalizedBundle) GetStorageId() string { + if m != nil { + return m.StorageId + } + return "" +} + +func (m *FinalizedBundle) GetUploader() string { + if m != nil { + return m.Uploader + } + return "" +} + +func (m *FinalizedBundle) GetFromIndex() uint64 { + if m != nil { + return m.FromIndex + } + return 0 +} + +func (m *FinalizedBundle) GetToIndex() uint64 { + if m != nil { + return m.ToIndex + } + return 0 +} + +func (m *FinalizedBundle) GetFromKey() string { + if m != nil { + return m.FromKey + } + return "" +} + +func (m *FinalizedBundle) GetToKey() string { + if m != nil { + return m.ToKey + } + return "" +} + +func (m *FinalizedBundle) GetBundleSummary() string { + if m != nil { + return m.BundleSummary + } + return "" +} + +func (m *FinalizedBundle) GetDataHash() string { + if m != nil { + return m.DataHash + } + return "" +} + +func (m *FinalizedBundle) GetFinalizedAt() *FinalizedAt { + if m != nil { + return m.FinalizedAt + } + return nil +} + +func (m *FinalizedBundle) GetStorageProviderId() uint64 { + if m != nil { + return m.StorageProviderId + } + return 0 +} + +func (m *FinalizedBundle) GetCompressionId() uint64 { + if m != nil { + return m.CompressionId + } + return 0 +} + +func (m *FinalizedBundle) GetStakeSecurity() *StakeSecurity { + if m != nil { + return m.StakeSecurity + } + return nil +} + +// FinalizedAt stores information about finalization block and time. +type FinalizedAt struct { + // height is the block height in which the bundle got finalized. + Height *cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=height,proto3,customtype=cosmossdk.io/math.Int" json:"height,omitempty"` + // timestamp is the UNIX timestamp of the block in which the bundle got finalized. + Timestamp *cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=timestamp,proto3,customtype=cosmossdk.io/math.Int" json:"timestamp,omitempty"` +} + +func (m *FinalizedAt) Reset() { *m = FinalizedAt{} } +func (m *FinalizedAt) String() string { return proto.CompactTextString(m) } +func (*FinalizedAt) ProtoMessage() {} +func (*FinalizedAt) Descriptor() ([]byte, []int) { + return fileDescriptor_b49b126c38ac815c, []int{1} +} +func (m *FinalizedAt) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FinalizedAt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FinalizedAt.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 *FinalizedAt) XXX_Merge(src proto.Message) { + xxx_messageInfo_FinalizedAt.Merge(m, src) +} +func (m *FinalizedAt) XXX_Size() int { + return m.Size() +} +func (m *FinalizedAt) XXX_DiscardUnknown() { + xxx_messageInfo_FinalizedAt.DiscardUnknown(m) +} + +var xxx_messageInfo_FinalizedAt proto.InternalMessageInfo + +// StakeSecurity represents the relative security of a finalized bundle +type StakeSecurity struct { + // valid_vote_power gives the amount of $KYVE stake that voted `valid`. + ValidVotePower *cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=valid_vote_power,json=validVotePower,proto3,customtype=cosmossdk.io/math.Int" json:"valid_vote_power,omitempty"` + // total_vote_power gives the amount of total $KYVE stake that was present in the pool + // during finalization. + TotalVotePower *cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=total_vote_power,json=totalVotePower,proto3,customtype=cosmossdk.io/math.Int" json:"total_vote_power,omitempty"` +} + +func (m *StakeSecurity) Reset() { *m = StakeSecurity{} } +func (m *StakeSecurity) String() string { return proto.CompactTextString(m) } +func (*StakeSecurity) ProtoMessage() {} +func (*StakeSecurity) Descriptor() ([]byte, []int) { + return fileDescriptor_b49b126c38ac815c, []int{2} +} +func (m *StakeSecurity) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StakeSecurity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StakeSecurity.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 *StakeSecurity) XXX_Merge(src proto.Message) { + xxx_messageInfo_StakeSecurity.Merge(m, src) +} +func (m *StakeSecurity) XXX_Size() int { + return m.Size() +} +func (m *StakeSecurity) XXX_DiscardUnknown() { + xxx_messageInfo_StakeSecurity.DiscardUnknown(m) +} + +var xxx_messageInfo_StakeSecurity proto.InternalMessageInfo + // QueryFinalizedBundlesRequest is the request type for the Query/Staker RPC method. type QueryFinalizedBundlesRequest 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"` + // index is an optional parameter which tells the server to only show + // the bundle with the given index. This can not be combined with pagination. + Index string `protobuf:"bytes,3,opt,name=index,proto3" json:"index,omitempty"` } func (m *QueryFinalizedBundlesRequest) Reset() { *m = QueryFinalizedBundlesRequest{} } func (m *QueryFinalizedBundlesRequest) String() string { return proto.CompactTextString(m) } func (*QueryFinalizedBundlesRequest) ProtoMessage() {} func (*QueryFinalizedBundlesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b49b126c38ac815c, []int{0} + return fileDescriptor_b49b126c38ac815c, []int{3} } func (m *QueryFinalizedBundlesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -86,10 +336,17 @@ func (m *QueryFinalizedBundlesRequest) GetPoolId() uint64 { return 0 } +func (m *QueryFinalizedBundlesRequest) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + // QueryStakersByPoolResponse is the response type for the Query/Staker RPC method. type QueryFinalizedBundlesResponse struct { // finalized_bundles ... - FinalizedBundles []types.FinalizedBundle `protobuf:"bytes,1,rep,name=finalized_bundles,json=finalizedBundles,proto3" json:"finalized_bundles"` + FinalizedBundles []FinalizedBundle `protobuf:"bytes,1,rep,name=finalized_bundles,json=finalizedBundles,proto3" json:"finalized_bundles"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -98,7 +355,7 @@ func (m *QueryFinalizedBundlesResponse) Reset() { *m = QueryFinalizedBun func (m *QueryFinalizedBundlesResponse) String() string { return proto.CompactTextString(m) } func (*QueryFinalizedBundlesResponse) ProtoMessage() {} func (*QueryFinalizedBundlesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b49b126c38ac815c, []int{1} + return fileDescriptor_b49b126c38ac815c, []int{4} } func (m *QueryFinalizedBundlesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -127,7 +384,7 @@ func (m *QueryFinalizedBundlesResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryFinalizedBundlesResponse proto.InternalMessageInfo -func (m *QueryFinalizedBundlesResponse) GetFinalizedBundles() []types.FinalizedBundle { +func (m *QueryFinalizedBundlesResponse) GetFinalizedBundles() []FinalizedBundle { if m != nil { return m.FinalizedBundles } @@ -153,7 +410,7 @@ func (m *QueryFinalizedBundleRequest) Reset() { *m = QueryFinalizedBundl func (m *QueryFinalizedBundleRequest) String() string { return proto.CompactTextString(m) } func (*QueryFinalizedBundleRequest) ProtoMessage() {} func (*QueryFinalizedBundleRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b49b126c38ac815c, []int{2} + return fileDescriptor_b49b126c38ac815c, []int{5} } func (m *QueryFinalizedBundleRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -198,15 +455,15 @@ func (m *QueryFinalizedBundleRequest) GetId() uint64 { // QueryFinalizedBundleResponse is the response type for the Query/Staker RPC method. type QueryFinalizedBundleResponse struct { - // finalized_bundle ... - FinalizedBundle types.FinalizedBundle `protobuf:"bytes,1,opt,name=finalized_bundle,json=finalizedBundle,proto3" json:"finalized_bundle"` + // finalized_bundles ... + FinalizedBundles FinalizedBundle `protobuf:"bytes,1,opt,name=finalized_bundles,json=finalizedBundles,proto3" json:"finalized_bundles"` } func (m *QueryFinalizedBundleResponse) Reset() { *m = QueryFinalizedBundleResponse{} } func (m *QueryFinalizedBundleResponse) String() string { return proto.CompactTextString(m) } func (*QueryFinalizedBundleResponse) ProtoMessage() {} func (*QueryFinalizedBundleResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b49b126c38ac815c, []int{3} + return fileDescriptor_b49b126c38ac815c, []int{6} } func (m *QueryFinalizedBundleResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -235,112 +492,11 @@ func (m *QueryFinalizedBundleResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryFinalizedBundleResponse proto.InternalMessageInfo -func (m *QueryFinalizedBundleResponse) GetFinalizedBundle() types.FinalizedBundle { - if m != nil { - return m.FinalizedBundle - } - return types.FinalizedBundle{} -} - -// QueryFinalizedBundleRequest is the request type for the Query/Staker RPC method. -type QueryFinalizedBundlesByHeightRequest struct { - // pool_id ... - PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` - // id ... - Height uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` -} - -func (m *QueryFinalizedBundlesByHeightRequest) Reset() { *m = QueryFinalizedBundlesByHeightRequest{} } -func (m *QueryFinalizedBundlesByHeightRequest) String() string { return proto.CompactTextString(m) } -func (*QueryFinalizedBundlesByHeightRequest) ProtoMessage() {} -func (*QueryFinalizedBundlesByHeightRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b49b126c38ac815c, []int{4} -} -func (m *QueryFinalizedBundlesByHeightRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryFinalizedBundlesByHeightRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryFinalizedBundlesByHeightRequest.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 *QueryFinalizedBundlesByHeightRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFinalizedBundlesByHeightRequest.Merge(m, src) -} -func (m *QueryFinalizedBundlesByHeightRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryFinalizedBundlesByHeightRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFinalizedBundlesByHeightRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryFinalizedBundlesByHeightRequest proto.InternalMessageInfo - -func (m *QueryFinalizedBundlesByHeightRequest) GetPoolId() uint64 { - if m != nil { - return m.PoolId - } - return 0 -} - -func (m *QueryFinalizedBundlesByHeightRequest) GetHeight() uint64 { - if m != nil { - return m.Height - } - return 0 -} - -// QueryFinalizedBundleResponse is the response type for the Query/Staker RPC method. -type QueryFinalizedBundlesByHeightResponse struct { - // finalized_bundle ... - FinalizedBundle types.FinalizedBundle `protobuf:"bytes,1,opt,name=finalized_bundle,json=finalizedBundle,proto3" json:"finalized_bundle"` -} - -func (m *QueryFinalizedBundlesByHeightResponse) Reset() { *m = QueryFinalizedBundlesByHeightResponse{} } -func (m *QueryFinalizedBundlesByHeightResponse) String() string { return proto.CompactTextString(m) } -func (*QueryFinalizedBundlesByHeightResponse) ProtoMessage() {} -func (*QueryFinalizedBundlesByHeightResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b49b126c38ac815c, []int{5} -} -func (m *QueryFinalizedBundlesByHeightResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryFinalizedBundlesByHeightResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryFinalizedBundlesByHeightResponse.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 *QueryFinalizedBundlesByHeightResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFinalizedBundlesByHeightResponse.Merge(m, src) -} -func (m *QueryFinalizedBundlesByHeightResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryFinalizedBundlesByHeightResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFinalizedBundlesByHeightResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryFinalizedBundlesByHeightResponse proto.InternalMessageInfo - -func (m *QueryFinalizedBundlesByHeightResponse) GetFinalizedBundle() types.FinalizedBundle { +func (m *QueryFinalizedBundleResponse) GetFinalizedBundles() FinalizedBundle { if m != nil { - return m.FinalizedBundle + return m.FinalizedBundles } - return types.FinalizedBundle{} + return FinalizedBundle{} } // QueryCurrentVoteStatusRequest is the request type for the Query/Staker RPC method. @@ -353,7 +509,7 @@ func (m *QueryCurrentVoteStatusRequest) Reset() { *m = QueryCurrentVoteS func (m *QueryCurrentVoteStatusRequest) String() string { return proto.CompactTextString(m) } func (*QueryCurrentVoteStatusRequest) ProtoMessage() {} func (*QueryCurrentVoteStatusRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b49b126c38ac815c, []int{6} + return fileDescriptor_b49b126c38ac815c, []int{7} } func (m *QueryCurrentVoteStatusRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -405,7 +561,7 @@ func (m *QueryCurrentVoteStatusResponse) Reset() { *m = QueryCurrentVote func (m *QueryCurrentVoteStatusResponse) String() string { return proto.CompactTextString(m) } func (*QueryCurrentVoteStatusResponse) ProtoMessage() {} func (*QueryCurrentVoteStatusResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b49b126c38ac815c, []int{7} + return fileDescriptor_b49b126c38ac815c, []int{8} } func (m *QueryCurrentVoteStatusResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -474,7 +630,7 @@ func (m *QueryCanValidateRequest) Reset() { *m = QueryCanValidateRequest func (m *QueryCanValidateRequest) String() string { return proto.CompactTextString(m) } func (*QueryCanValidateRequest) ProtoMessage() {} func (*QueryCanValidateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b49b126c38ac815c, []int{8} + return fileDescriptor_b49b126c38ac815c, []int{9} } func (m *QueryCanValidateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -529,7 +685,7 @@ func (m *QueryCanValidateResponse) Reset() { *m = QueryCanValidateRespon func (m *QueryCanValidateResponse) String() string { return proto.CompactTextString(m) } func (*QueryCanValidateResponse) ProtoMessage() {} func (*QueryCanValidateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b49b126c38ac815c, []int{9} + return fileDescriptor_b49b126c38ac815c, []int{10} } func (m *QueryCanValidateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -588,7 +744,7 @@ func (m *QueryCanProposeRequest) Reset() { *m = QueryCanProposeRequest{} func (m *QueryCanProposeRequest) String() string { return proto.CompactTextString(m) } func (*QueryCanProposeRequest) ProtoMessage() {} func (*QueryCanProposeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b49b126c38ac815c, []int{10} + return fileDescriptor_b49b126c38ac815c, []int{11} } func (m *QueryCanProposeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -657,7 +813,7 @@ func (m *QueryCanProposeResponse) Reset() { *m = QueryCanProposeResponse func (m *QueryCanProposeResponse) String() string { return proto.CompactTextString(m) } func (*QueryCanProposeResponse) ProtoMessage() {} func (*QueryCanProposeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b49b126c38ac815c, []int{11} + return fileDescriptor_b49b126c38ac815c, []int{12} } func (m *QueryCanProposeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -716,7 +872,7 @@ func (m *QueryCanVoteRequest) Reset() { *m = QueryCanVoteRequest{} } func (m *QueryCanVoteRequest) String() string { return proto.CompactTextString(m) } func (*QueryCanVoteRequest) ProtoMessage() {} func (*QueryCanVoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b49b126c38ac815c, []int{12} + return fileDescriptor_b49b126c38ac815c, []int{13} } func (m *QueryCanVoteRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -785,7 +941,7 @@ func (m *QueryCanVoteResponse) Reset() { *m = QueryCanVoteResponse{} } func (m *QueryCanVoteResponse) String() string { return proto.CompactTextString(m) } func (*QueryCanVoteResponse) ProtoMessage() {} func (*QueryCanVoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b49b126c38ac815c, []int{13} + return fileDescriptor_b49b126c38ac815c, []int{14} } func (m *QueryCanVoteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -829,12 +985,13 @@ func (m *QueryCanVoteResponse) GetReason() string { } func init() { + proto.RegisterType((*FinalizedBundle)(nil), "kyve.query.v1beta1.FinalizedBundle") + proto.RegisterType((*FinalizedAt)(nil), "kyve.query.v1beta1.FinalizedAt") + proto.RegisterType((*StakeSecurity)(nil), "kyve.query.v1beta1.StakeSecurity") proto.RegisterType((*QueryFinalizedBundlesRequest)(nil), "kyve.query.v1beta1.QueryFinalizedBundlesRequest") proto.RegisterType((*QueryFinalizedBundlesResponse)(nil), "kyve.query.v1beta1.QueryFinalizedBundlesResponse") proto.RegisterType((*QueryFinalizedBundleRequest)(nil), "kyve.query.v1beta1.QueryFinalizedBundleRequest") proto.RegisterType((*QueryFinalizedBundleResponse)(nil), "kyve.query.v1beta1.QueryFinalizedBundleResponse") - proto.RegisterType((*QueryFinalizedBundlesByHeightRequest)(nil), "kyve.query.v1beta1.QueryFinalizedBundlesByHeightRequest") - proto.RegisterType((*QueryFinalizedBundlesByHeightResponse)(nil), "kyve.query.v1beta1.QueryFinalizedBundlesByHeightResponse") proto.RegisterType((*QueryCurrentVoteStatusRequest)(nil), "kyve.query.v1beta1.QueryCurrentVoteStatusRequest") proto.RegisterType((*QueryCurrentVoteStatusResponse)(nil), "kyve.query.v1beta1.QueryCurrentVoteStatusResponse") proto.RegisterType((*QueryCanValidateRequest)(nil), "kyve.query.v1beta1.QueryCanValidateRequest") @@ -848,67 +1005,82 @@ func init() { func init() { proto.RegisterFile("kyve/query/v1beta1/bundles.proto", fileDescriptor_b49b126c38ac815c) } var fileDescriptor_b49b126c38ac815c = []byte{ - // 960 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xce, 0xb8, 0x21, 0xa9, 0x5f, 0x10, 0x4d, 0x87, 0xa8, 0xb5, 0x96, 0xd6, 0x44, 0x2b, 0x4a, - 0xa3, 0x14, 0xed, 0xd4, 0x89, 0x50, 0x1b, 0x71, 0x40, 0xa4, 0x25, 0x90, 0x52, 0xaa, 0xb2, 0x48, - 0xe1, 0xc7, 0xc5, 0x1a, 0x67, 0x27, 0x9b, 0x55, 0x9c, 0x1d, 0x77, 0x67, 0x6c, 0x6a, 0x2c, 0xab, - 0x08, 0xf1, 0x07, 0x20, 0xf1, 0x07, 0x70, 0x86, 0x13, 0x1c, 0x38, 0x70, 0xe5, 0xd4, 0x63, 0x24, - 0x2e, 0x88, 0x03, 0x42, 0x09, 0x7f, 0x08, 0x9a, 0x1f, 0x6b, 0xaf, 0x7f, 0xc5, 0x9b, 0x20, 0x6e, -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 0xab, 0x5a, 0xf4, 0x25, 0xb4, 0x7c, 0x61, 0x65, 0x61, 0xed, 0x86, - 0xa7, 0x65, 0x4d, 0x29, 0xa5, 0x20, 0x86, 0x5a, 0x6d, 0xce, 0x3e, 0xff, 0xeb, 0xd5, 0x19, 0x7f, - 0x71, 0x6f, 0x68, 0x02, 0x7e, 0x6f, 0x80, 0x5c, 0x41, 0x93, 0xbb, 0x39, 0x95, 0x9c, 0x81, 0x95, - 0x65, 0xe7, 0x6e, 0xc1, 0x2b, 0xe3, 0x38, 0xa4, 0x22, 0x66, 0xc8, 0xa3, 0x2c, 0x79, 0xfc, 0x12, - 0x14, 0x7a, 0x82, 0x14, 0xa2, 0xc0, 0x6d, 0x8d, 0x3f, 0x8d, 0x9e, 0x14, 0x3b, 0xb0, 0x38, 0x2c, - 0x85, 0x3d, 0x93, 0x33, 0x29, 0x71, 0x69, 0x48, 0x09, 0xf7, 0x13, 0x78, 0x6d, 0xec, 0x19, 0x6c, - 0xb6, 0xdf, 0x67, 0x51, 0xb8, 0x2f, 0xa7, 0x12, 0xb9, 0x02, 0x73, 0xfb, 0x7a, 0x67, 0x7a, 0xba, - 0x26, 0x72, 0x9f, 0xc1, 0x8d, 0x29, 0x8d, 0xff, 0x67, 0x66, 0x77, 0xed, 0xed, 0xba, 0xd7, 0x4c, - 0x12, 0x16, 0xcb, 0x1d, 0x2e, 0xd9, 0xc7, 0x92, 0xca, 0xa6, 0x98, 0x46, 0xc9, 0xfd, 0x0a, 0x41, - 0x79, 0x52, 0xa9, 0x05, 0xbd, 0x04, 0x2f, 0xb4, 0x68, 0xbd, 0x57, 0x69, 0x02, 0x5c, 0x82, 0xf9, - 0x28, 0x36, 0x79, 0x23, 0x46, 0x1a, 0xaa, 0x15, 0x5a, 0x13, 0x92, 0x46, 0x71, 0xe9, 0x82, 0x59, - 0xb1, 0xa1, 0xea, 0x24, 0xb9, 0xa4, 0xf5, 0xd2, 0xac, 0xe9, 0xa4, 0x03, 0xd7, 0x87,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0x12, 0x50, 0xeb, 0xc0, 0x59, 0x9c, - 0xc6, 0xdc, 0xba, 0xa4, 0x93, 0xba, 0x73, 0x97, 0x74, 0xfa, 0xe6, 0xdc, 0xc5, 0x3f, 0x22, 0x98, - 0xb7, 0xe6, 0x85, 0x6f, 0x9e, 0x2a, 0x5b, 0xdf, 0x5b, 0x9d, 0x95, 0xe9, 0x1b, 0x2d, 0xe4, 0x87, - 0x1a, 0xf2, 0x16, 0xbe, 0x3f, 0x51, 0x5b, 0x2e, 0xc7, 0xe3, 0xd5, 0xf6, 0xab, 0x13, 0xa9, 0xfb, - 0x76, 0x37, 0xef, 0x3f, 0x3f, 0x2e, 0xa3, 0xa3, 0xe3, 0x32, 0xfa, 0xfb, 0xb8, 0x8c, 0xbe, 0x3d, - 0x29, 0xcf, 0x1c, 0x9d, 0x94, 0x67, 0xfe, 0x38, 0x29, 0xcf, 0x7c, 0xbe, 0x1a, 0x46, 0x72, 0xbf, - 0x59, 0xf3, 0x76, 0xf9, 0x21, 0xf9, 0xe0, 0xb3, 0x9d, 0x77, 0x1f, 0x31, 0xf9, 0x05, 0x4f, 0x0e, - 0xc8, 0xee, 0x3e, 0x8d, 0x62, 0xf2, 0xd4, 0x0e, 0x96, 0xed, 0x06, 0x13, 0xb5, 0x39, 0xfd, 0x77, - 0x7a, 0xfd, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x01, 0xbd, 0xf0, 0x82, 0x0a, 0x0c, 0x00, 0x00, + // 1193 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0xba, 0x8e, 0x7f, 0x3c, 0x37, 0xa6, 0x9d, 0xa6, 0xe9, 0xd6, 0x4d, 0x9d, 0x74, 0x11, + 0x24, 0x4a, 0xd1, 0x2e, 0x49, 0x0f, 0xa5, 0x27, 0x44, 0x5a, 0x42, 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f7, 0x51, 0x79, 0xe6, 0xab, 0xb5, 0x86, 0xcf, 0x9b, 0x9d, 0x9a, 0x5d, 0xa7, 0x6d, 0xe7, 0xe1, + 0x97, 0xbb, 0x9f, 0x3e, 0x26, 0xfc, 0x29, 0x8d, 0xf6, 0x9d, 0x7a, 0x13, 0xfb, 0x81, 0xf3, 0x4c, + 0x5f, 0xcc, 0x7b, 0x21, 0x61, 0xb5, 0x8c, 0xfc, 0x93, 0x72, 0xeb, 0xff, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xe4, 0x7c, 0xc1, 0xfb, 0x3c, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -924,11 +1096,9 @@ 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 QueryBundlesClient interface { // FinalizedBundles ... - FinalizedBundles(ctx context.Context, in *QueryFinalizedBundlesRequest, opts ...grpc.CallOption) (*QueryFinalizedBundlesResponse, error) + FinalizedBundlesQuery(ctx context.Context, in *QueryFinalizedBundlesRequest, opts ...grpc.CallOption) (*QueryFinalizedBundlesResponse, error) // FinalizedBundle ... - FinalizedBundle(ctx context.Context, in *QueryFinalizedBundleRequest, opts ...grpc.CallOption) (*QueryFinalizedBundleResponse, error) - // Queries the bundle which contains the data given height - FinalizedBundlesByHeight(ctx context.Context, in *QueryFinalizedBundlesByHeightRequest, opts ...grpc.CallOption) (*QueryFinalizedBundlesByHeightResponse, error) + FinalizedBundleQuery(ctx context.Context, in *QueryFinalizedBundleRequest, opts ...grpc.CallOption) (*FinalizedBundle, error) // CurrentVoteStatus ... CurrentVoteStatus(ctx context.Context, in *QueryCurrentVoteStatusRequest, opts ...grpc.CallOption) (*QueryCurrentVoteStatusResponse, error) // CanValidate ... @@ -947,27 +1117,18 @@ func NewQueryBundlesClient(cc grpc1.ClientConn) QueryBundlesClient { return &queryBundlesClient{cc} } -func (c *queryBundlesClient) FinalizedBundles(ctx context.Context, in *QueryFinalizedBundlesRequest, opts ...grpc.CallOption) (*QueryFinalizedBundlesResponse, error) { +func (c *queryBundlesClient) FinalizedBundlesQuery(ctx context.Context, in *QueryFinalizedBundlesRequest, opts ...grpc.CallOption) (*QueryFinalizedBundlesResponse, error) { out := new(QueryFinalizedBundlesResponse) - err := c.cc.Invoke(ctx, "/kyve.query.v1beta1.QueryBundles/FinalizedBundles", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryBundlesClient) FinalizedBundle(ctx context.Context, in *QueryFinalizedBundleRequest, opts ...grpc.CallOption) (*QueryFinalizedBundleResponse, error) { - out := new(QueryFinalizedBundleResponse) - err := c.cc.Invoke(ctx, "/kyve.query.v1beta1.QueryBundles/FinalizedBundle", in, out, opts...) + err := c.cc.Invoke(ctx, "/kyve.query.v1beta1.QueryBundles/FinalizedBundlesQuery", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryBundlesClient) FinalizedBundlesByHeight(ctx context.Context, in *QueryFinalizedBundlesByHeightRequest, opts ...grpc.CallOption) (*QueryFinalizedBundlesByHeightResponse, error) { - out := new(QueryFinalizedBundlesByHeightResponse) - err := c.cc.Invoke(ctx, "/kyve.query.v1beta1.QueryBundles/FinalizedBundlesByHeight", in, out, opts...) +func (c *queryBundlesClient) FinalizedBundleQuery(ctx context.Context, in *QueryFinalizedBundleRequest, opts ...grpc.CallOption) (*FinalizedBundle, error) { + out := new(FinalizedBundle) + err := c.cc.Invoke(ctx, "/kyve.query.v1beta1.QueryBundles/FinalizedBundleQuery", in, out, opts...) if err != nil { return nil, err } @@ -1013,11 +1174,9 @@ func (c *queryBundlesClient) CanVote(ctx context.Context, in *QueryCanVoteReques // QueryBundlesServer is the server API for QueryBundles service. type QueryBundlesServer interface { // FinalizedBundles ... - FinalizedBundles(context.Context, *QueryFinalizedBundlesRequest) (*QueryFinalizedBundlesResponse, error) + FinalizedBundlesQuery(context.Context, *QueryFinalizedBundlesRequest) (*QueryFinalizedBundlesResponse, error) // FinalizedBundle ... - FinalizedBundle(context.Context, *QueryFinalizedBundleRequest) (*QueryFinalizedBundleResponse, error) - // Queries the bundle which contains the data given height - FinalizedBundlesByHeight(context.Context, *QueryFinalizedBundlesByHeightRequest) (*QueryFinalizedBundlesByHeightResponse, error) + FinalizedBundleQuery(context.Context, *QueryFinalizedBundleRequest) (*FinalizedBundle, error) // CurrentVoteStatus ... CurrentVoteStatus(context.Context, *QueryCurrentVoteStatusRequest) (*QueryCurrentVoteStatusResponse, error) // CanValidate ... @@ -1032,14 +1191,11 @@ type QueryBundlesServer interface { type UnimplementedQueryBundlesServer struct { } -func (*UnimplementedQueryBundlesServer) FinalizedBundles(ctx context.Context, req *QueryFinalizedBundlesRequest) (*QueryFinalizedBundlesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FinalizedBundles not implemented") +func (*UnimplementedQueryBundlesServer) FinalizedBundlesQuery(ctx context.Context, req *QueryFinalizedBundlesRequest) (*QueryFinalizedBundlesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FinalizedBundlesQuery not implemented") } -func (*UnimplementedQueryBundlesServer) FinalizedBundle(ctx context.Context, req *QueryFinalizedBundleRequest) (*QueryFinalizedBundleResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FinalizedBundle not implemented") -} -func (*UnimplementedQueryBundlesServer) FinalizedBundlesByHeight(ctx context.Context, req *QueryFinalizedBundlesByHeightRequest) (*QueryFinalizedBundlesByHeightResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FinalizedBundlesByHeight not implemented") +func (*UnimplementedQueryBundlesServer) FinalizedBundleQuery(ctx context.Context, req *QueryFinalizedBundleRequest) (*FinalizedBundle, error) { + return nil, status.Errorf(codes.Unimplemented, "method FinalizedBundleQuery not implemented") } func (*UnimplementedQueryBundlesServer) CurrentVoteStatus(ctx context.Context, req *QueryCurrentVoteStatusRequest) (*QueryCurrentVoteStatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CurrentVoteStatus not implemented") @@ -1058,56 +1214,38 @@ func RegisterQueryBundlesServer(s grpc1.Server, srv QueryBundlesServer) { s.RegisterService(&_QueryBundles_serviceDesc, srv) } -func _QueryBundles_FinalizedBundles_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _QueryBundles_FinalizedBundlesQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryFinalizedBundlesRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryBundlesServer).FinalizedBundles(ctx, in) + return srv.(QueryBundlesServer).FinalizedBundlesQuery(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/kyve.query.v1beta1.QueryBundles/FinalizedBundles", + FullMethod: "/kyve.query.v1beta1.QueryBundles/FinalizedBundlesQuery", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryBundlesServer).FinalizedBundles(ctx, req.(*QueryFinalizedBundlesRequest)) + return srv.(QueryBundlesServer).FinalizedBundlesQuery(ctx, req.(*QueryFinalizedBundlesRequest)) } return interceptor(ctx, in, info, handler) } -func _QueryBundles_FinalizedBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _QueryBundles_FinalizedBundleQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryFinalizedBundleRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryBundlesServer).FinalizedBundle(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/kyve.query.v1beta1.QueryBundles/FinalizedBundle", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryBundlesServer).FinalizedBundle(ctx, req.(*QueryFinalizedBundleRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _QueryBundles_FinalizedBundlesByHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryFinalizedBundlesByHeightRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryBundlesServer).FinalizedBundlesByHeight(ctx, in) + return srv.(QueryBundlesServer).FinalizedBundleQuery(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/kyve.query.v1beta1.QueryBundles/FinalizedBundlesByHeight", + FullMethod: "/kyve.query.v1beta1.QueryBundles/FinalizedBundleQuery", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryBundlesServer).FinalizedBundlesByHeight(ctx, req.(*QueryFinalizedBundlesByHeightRequest)) + return srv.(QueryBundlesServer).FinalizedBundleQuery(ctx, req.(*QueryFinalizedBundleRequest)) } return interceptor(ctx, in, info, handler) } @@ -1189,16 +1327,12 @@ var _QueryBundles_serviceDesc = grpc.ServiceDesc{ HandlerType: (*QueryBundlesServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "FinalizedBundles", - Handler: _QueryBundles_FinalizedBundles_Handler, - }, - { - MethodName: "FinalizedBundle", - Handler: _QueryBundles_FinalizedBundle_Handler, + MethodName: "FinalizedBundlesQuery", + Handler: _QueryBundles_FinalizedBundlesQuery_Handler, }, { - MethodName: "FinalizedBundlesByHeight", - Handler: _QueryBundles_FinalizedBundlesByHeight_Handler, + MethodName: "FinalizedBundleQuery", + Handler: _QueryBundles_FinalizedBundleQuery_Handler, }, { MethodName: "CurrentVoteStatus", @@ -1221,7 +1355,7 @@ var _QueryBundles_serviceDesc = grpc.ServiceDesc{ Metadata: "kyve/query/v1beta1/bundles.proto", } -func (m *QueryFinalizedBundlesRequest) Marshal() (dAtA []byte, err error) { +func (m *FinalizedBundle) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1231,28 +1365,154 @@ func (m *QueryFinalizedBundlesRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryFinalizedBundlesRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *FinalizedBundle) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryFinalizedBundlesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *FinalizedBundle) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if m.StakeSecurity != nil { + { + size, err := m.StakeSecurity.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBundles(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x72 + } + if m.CompressionId != 0 { + i = encodeVarintBundles(dAtA, i, uint64(m.CompressionId)) + i-- + dAtA[i] = 0x68 + } + if m.StorageProviderId != 0 { + i = encodeVarintBundles(dAtA, i, uint64(m.StorageProviderId)) + i-- + dAtA[i] = 0x60 + } + if len(m.FromKey) > 0 { + i -= len(m.FromKey) + copy(dAtA[i:], m.FromKey) + i = encodeVarintBundles(dAtA, i, uint64(len(m.FromKey))) + i-- + dAtA[i] = 0x5a + } + if m.FinalizedAt != nil { + { + size, err := m.FinalizedAt.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBundles(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + } + if len(m.DataHash) > 0 { + i -= len(m.DataHash) + copy(dAtA[i:], m.DataHash) + i = encodeVarintBundles(dAtA, i, uint64(len(m.DataHash))) + i-- + dAtA[i] = 0x4a + } + if len(m.BundleSummary) > 0 { + i -= len(m.BundleSummary) + copy(dAtA[i:], m.BundleSummary) + i = encodeVarintBundles(dAtA, i, uint64(len(m.BundleSummary))) + i-- + dAtA[i] = 0x42 + } + if len(m.ToKey) > 0 { + i -= len(m.ToKey) + copy(dAtA[i:], m.ToKey) + i = encodeVarintBundles(dAtA, i, uint64(len(m.ToKey))) + i-- + dAtA[i] = 0x3a + } + if m.ToIndex != 0 { + i = encodeVarintBundles(dAtA, i, uint64(m.ToIndex)) + i-- + dAtA[i] = 0x30 + } + if m.FromIndex != 0 { + i = encodeVarintBundles(dAtA, i, uint64(m.FromIndex)) + i-- + dAtA[i] = 0x28 + } + if len(m.Uploader) > 0 { + i -= len(m.Uploader) + copy(dAtA[i:], m.Uploader) + i = encodeVarintBundles(dAtA, i, uint64(len(m.Uploader))) + i-- + dAtA[i] = 0x22 + } + if len(m.StorageId) > 0 { + i -= len(m.StorageId) + copy(dAtA[i:], m.StorageId) + i = encodeVarintBundles(dAtA, i, uint64(len(m.StorageId))) + i-- + dAtA[i] = 0x1a + } + if m.Id != 0 { + i = encodeVarintBundles(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x10 + } if m.PoolId != 0 { i = encodeVarintBundles(dAtA, i, uint64(m.PoolId)) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x8 } - if m.Pagination != nil { + return len(dAtA) - i, nil +} + +func (m *FinalizedAt) 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 *FinalizedAt) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FinalizedAt) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Timestamp != nil { { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { + size := m.Timestamp.Size() + i -= size + if _, err := m.Timestamp.MarshalTo(dAtA[i:]); err != nil { return 0, err } + i = encodeVarintBundles(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Height != nil { + { + size := m.Height.Size() i -= size + if _, err := m.Height.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } i = encodeVarintBundles(dAtA, i, uint64(size)) } i-- @@ -1261,7 +1521,7 @@ func (m *QueryFinalizedBundlesRequest) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } -func (m *QueryFinalizedBundlesResponse) Marshal() (dAtA []byte, err error) { +func (m *StakeSecurity) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1271,46 +1531,44 @@ func (m *QueryFinalizedBundlesResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryFinalizedBundlesResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *StakeSecurity) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryFinalizedBundlesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *StakeSecurity) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Pagination != nil { + if m.TotalVotePower != nil { { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { + size := m.TotalVotePower.Size() + i -= size + if _, err := m.TotalVotePower.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i -= size i = encodeVarintBundles(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } - if len(m.FinalizedBundles) > 0 { - for iNdEx := len(m.FinalizedBundles) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.FinalizedBundles[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintBundles(dAtA, i, uint64(size)) + if m.ValidVotePower != nil { + { + size := m.ValidVotePower.Size() + i -= size + if _, err := m.ValidVotePower.MarshalTo(dAtA[i:]); err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i = encodeVarintBundles(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryFinalizedBundleRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryFinalizedBundlesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1320,30 +1578,44 @@ func (m *QueryFinalizedBundleRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryFinalizedBundleRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryFinalizedBundlesRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryFinalizedBundleRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryFinalizedBundlesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Id != 0 { - i = encodeVarintBundles(dAtA, i, uint64(m.Id)) + if len(m.Index) > 0 { + i -= len(m.Index) + copy(dAtA[i:], m.Index) + i = encodeVarintBundles(dAtA, i, uint64(len(m.Index))) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x1a } if m.PoolId != 0 { i = encodeVarintBundles(dAtA, i, uint64(m.PoolId)) i-- - dAtA[i] = 0x8 + dAtA[i] = 0x10 + } + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBundles(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryFinalizedBundleResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryFinalizedBundlesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1353,30 +1625,46 @@ func (m *QueryFinalizedBundleResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryFinalizedBundleResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryFinalizedBundlesResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryFinalizedBundleResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryFinalizedBundlesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size, err := m.FinalizedBundle.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBundles(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.FinalizedBundles) > 0 { + for iNdEx := len(m.FinalizedBundles) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FinalizedBundles[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBundles(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - i -= size - i = encodeVarintBundles(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *QueryFinalizedBundlesByHeightRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryFinalizedBundleRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1386,18 +1674,18 @@ func (m *QueryFinalizedBundlesByHeightRequest) Marshal() (dAtA []byte, err error return dAtA[:n], nil } -func (m *QueryFinalizedBundlesByHeightRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryFinalizedBundleRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryFinalizedBundlesByHeightRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryFinalizedBundleRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Height != 0 { - i = encodeVarintBundles(dAtA, i, uint64(m.Height)) + if m.Id != 0 { + i = encodeVarintBundles(dAtA, i, uint64(m.Id)) i-- dAtA[i] = 0x10 } @@ -1409,7 +1697,7 @@ func (m *QueryFinalizedBundlesByHeightRequest) MarshalToSizedBuffer(dAtA []byte) return len(dAtA) - i, nil } -func (m *QueryFinalizedBundlesByHeightResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryFinalizedBundleResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1419,18 +1707,18 @@ func (m *QueryFinalizedBundlesByHeightResponse) Marshal() (dAtA []byte, err erro return dAtA[:n], nil } -func (m *QueryFinalizedBundlesByHeightResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryFinalizedBundleResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryFinalizedBundlesByHeightResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryFinalizedBundleResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.FinalizedBundle.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.FinalizedBundles.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1775,6 +2063,99 @@ func encodeVarintBundles(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *FinalizedBundle) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovBundles(uint64(m.PoolId)) + } + if m.Id != 0 { + n += 1 + sovBundles(uint64(m.Id)) + } + l = len(m.StorageId) + if l > 0 { + n += 1 + l + sovBundles(uint64(l)) + } + l = len(m.Uploader) + if l > 0 { + n += 1 + l + sovBundles(uint64(l)) + } + if m.FromIndex != 0 { + n += 1 + sovBundles(uint64(m.FromIndex)) + } + if m.ToIndex != 0 { + n += 1 + sovBundles(uint64(m.ToIndex)) + } + l = len(m.ToKey) + if l > 0 { + n += 1 + l + sovBundles(uint64(l)) + } + l = len(m.BundleSummary) + if l > 0 { + n += 1 + l + sovBundles(uint64(l)) + } + l = len(m.DataHash) + if l > 0 { + n += 1 + l + sovBundles(uint64(l)) + } + if m.FinalizedAt != nil { + l = m.FinalizedAt.Size() + n += 1 + l + sovBundles(uint64(l)) + } + l = len(m.FromKey) + if l > 0 { + n += 1 + l + sovBundles(uint64(l)) + } + if m.StorageProviderId != 0 { + n += 1 + sovBundles(uint64(m.StorageProviderId)) + } + if m.CompressionId != 0 { + n += 1 + sovBundles(uint64(m.CompressionId)) + } + if m.StakeSecurity != nil { + l = m.StakeSecurity.Size() + n += 1 + l + sovBundles(uint64(l)) + } + return n +} + +func (m *FinalizedAt) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != nil { + l = m.Height.Size() + n += 1 + l + sovBundles(uint64(l)) + } + if m.Timestamp != nil { + l = m.Timestamp.Size() + n += 1 + l + sovBundles(uint64(l)) + } + return n +} + +func (m *StakeSecurity) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ValidVotePower != nil { + l = m.ValidVotePower.Size() + n += 1 + l + sovBundles(uint64(l)) + } + if m.TotalVotePower != nil { + l = m.TotalVotePower.Size() + n += 1 + l + sovBundles(uint64(l)) + } + return n +} + func (m *QueryFinalizedBundlesRequest) Size() (n int) { if m == nil { return 0 @@ -1788,6 +2169,10 @@ func (m *QueryFinalizedBundlesRequest) Size() (n int) { if m.PoolId != 0 { n += 1 + sovBundles(uint64(m.PoolId)) } + l = len(m.Index) + if l > 0 { + n += 1 + l + sovBundles(uint64(l)) + } return n } @@ -1831,12 +2216,12 @@ func (m *QueryFinalizedBundleResponse) Size() (n int) { } var l int _ = l - l = m.FinalizedBundle.Size() + l = m.FinalizedBundles.Size() n += 1 + l + sovBundles(uint64(l)) return n } -func (m *QueryFinalizedBundlesByHeightRequest) Size() (n int) { +func (m *QueryCurrentVoteStatusRequest) Size() (n int) { if m == nil { return 0 } @@ -1845,36 +2230,10 @@ func (m *QueryFinalizedBundlesByHeightRequest) Size() (n int) { if m.PoolId != 0 { n += 1 + sovBundles(uint64(m.PoolId)) } - if m.Height != 0 { - n += 1 + sovBundles(uint64(m.Height)) - } return n } -func (m *QueryFinalizedBundlesByHeightResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.FinalizedBundle.Size() - n += 1 + l + sovBundles(uint64(l)) - return n -} - -func (m *QueryCurrentVoteStatusRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PoolId != 0 { - n += 1 + sovBundles(uint64(m.PoolId)) - } - return n -} - -func (m *QueryCurrentVoteStatusResponse) Size() (n int) { +func (m *QueryCurrentVoteStatusResponse) Size() (n int) { if m == nil { return 0 } @@ -1987,32 +2346,460 @@ func (m *QueryCanVoteRequest) Size() (n int) { if l > 0 { n += 1 + l + sovBundles(uint64(l)) } - return n -} + return n +} + +func (m *QueryCanVoteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Possible { + n += 2 + } + l = len(m.Reason) + if l > 0 { + n += 1 + l + sovBundles(uint64(l)) + } + return n +} + +func sovBundles(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozBundles(x uint64) (n int) { + return sovBundles(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *FinalizedBundle) 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 ErrIntOverflowBundles + } + 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: FinalizedBundle: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FinalizedBundle: 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 ErrIntOverflowBundles + } + 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 Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StorageId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + 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 ErrInvalidLengthBundles + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBundles + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StorageId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Uploader", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + 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 ErrInvalidLengthBundles + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBundles + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Uploader = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FromIndex", wireType) + } + m.FromIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FromIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ToIndex", wireType) + } + m.ToIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ToIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ToKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + 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 ErrInvalidLengthBundles + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBundles + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ToKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BundleSummary", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + 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 ErrInvalidLengthBundles + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBundles + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BundleSummary = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DataHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + 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 ErrInvalidLengthBundles + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBundles + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DataHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FinalizedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBundles + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBundles + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.FinalizedAt == nil { + m.FinalizedAt = &FinalizedAt{} + } + if err := m.FinalizedAt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + 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 ErrInvalidLengthBundles + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBundles + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StorageProviderId", wireType) + } + m.StorageProviderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StorageProviderId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CompressionId", wireType) + } + m.CompressionId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CompressionId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StakeSecurity", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBundles + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBundles + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.StakeSecurity == nil { + m.StakeSecurity = &StakeSecurity{} + } + if err := m.StakeSecurity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBundles(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBundles + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } -func (m *QueryCanVoteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Possible { - n += 2 - } - l = len(m.Reason) - if l > 0 { - n += 1 + l + sovBundles(uint64(l)) + if iNdEx > l { + return io.ErrUnexpectedEOF } - return n -} - -func sovBundles(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozBundles(x uint64) (n int) { - return sovBundles(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *QueryFinalizedBundlesRequest) Unmarshal(dAtA []byte) error { +func (m *FinalizedAt) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2035,17 +2822,17 @@ func (m *QueryFinalizedBundlesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFinalizedBundlesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: FinalizedAt: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFinalizedBundlesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: FinalizedAt: 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) + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowBundles @@ -2055,33 +2842,33 @@ func (m *QueryFinalizedBundlesRequest) 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 ErrInvalidLengthBundles } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthBundles } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + var v cosmossdk_io_math.Int + m.Height = &v + if err := m.Height.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) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } - m.PoolId = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowBundles @@ -2091,11 +2878,28 @@ func (m *QueryFinalizedBundlesRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.PoolId |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBundles + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBundles + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v cosmossdk_io_math.Int + m.Timestamp = &v + if err := m.Timestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipBundles(dAtA[iNdEx:]) @@ -2117,7 +2921,7 @@ func (m *QueryFinalizedBundlesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryFinalizedBundlesResponse) Unmarshal(dAtA []byte) error { +func (m *StakeSecurity) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2140,17 +2944,17 @@ func (m *QueryFinalizedBundlesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFinalizedBundlesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: StakeSecurity: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFinalizedBundlesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: StakeSecurity: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FinalizedBundles", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValidVotePower", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowBundles @@ -2160,31 +2964,33 @@ func (m *QueryFinalizedBundlesResponse) 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 ErrInvalidLengthBundles } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthBundles } if postIndex > l { return io.ErrUnexpectedEOF } - m.FinalizedBundles = append(m.FinalizedBundles, types.FinalizedBundle{}) - if err := m.FinalizedBundles[len(m.FinalizedBundles)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + var v cosmossdk_io_math.Int + m.ValidVotePower = &v + if err := m.ValidVotePower.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 TotalVotePower", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowBundles @@ -2194,25 +3000,25 @@ func (m *QueryFinalizedBundlesResponse) 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 ErrInvalidLengthBundles } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthBundles } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + var v cosmossdk_io_math.Int + m.TotalVotePower = &v + if err := m.TotalVotePower.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2237,7 +3043,7 @@ func (m *QueryFinalizedBundlesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryFinalizedBundleRequest) Unmarshal(dAtA []byte) error { +func (m *QueryFinalizedBundlesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2260,13 +3066,49 @@ func (m *QueryFinalizedBundleRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFinalizedBundleRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryFinalizedBundlesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFinalizedBundleRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryFinalizedBundlesRequest: 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 ErrIntOverflowBundles + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBundles + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBundles + } + 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) } @@ -2285,11 +3127,11 @@ func (m *QueryFinalizedBundleRequest) Unmarshal(dAtA []byte) error { break } } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) } - m.Id = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowBundles @@ -2299,11 +3141,24 @@ func (m *QueryFinalizedBundleRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Id |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBundles + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBundles + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Index = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipBundles(dAtA[iNdEx:]) @@ -2325,7 +3180,7 @@ func (m *QueryFinalizedBundleRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryFinalizedBundleResponse) Unmarshal(dAtA []byte) error { +func (m *QueryFinalizedBundlesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2348,15 +3203,49 @@ func (m *QueryFinalizedBundleResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFinalizedBundleResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryFinalizedBundlesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFinalizedBundleResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryFinalizedBundlesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FinalizedBundle", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FinalizedBundles", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBundles + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBundles + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBundles + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FinalizedBundles = append(m.FinalizedBundles, FinalizedBundle{}) + if err := m.FinalizedBundles[len(m.FinalizedBundles)-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 { @@ -2383,7 +3272,10 @@ func (m *QueryFinalizedBundleResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.FinalizedBundle.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 @@ -2408,7 +3300,7 @@ func (m *QueryFinalizedBundleResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryFinalizedBundlesByHeightRequest) Unmarshal(dAtA []byte) error { +func (m *QueryFinalizedBundleRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2431,10 +3323,10 @@ func (m *QueryFinalizedBundlesByHeightRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFinalizedBundlesByHeightRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryFinalizedBundleRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFinalizedBundlesByHeightRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryFinalizedBundleRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2458,9 +3350,9 @@ func (m *QueryFinalizedBundlesByHeightRequest) Unmarshal(dAtA []byte) error { } case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) } - m.Height = 0 + m.Id = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowBundles @@ -2470,7 +3362,7 @@ func (m *QueryFinalizedBundlesByHeightRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= uint64(b&0x7F) << shift + m.Id |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2496,7 +3388,7 @@ func (m *QueryFinalizedBundlesByHeightRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryFinalizedBundlesByHeightResponse) Unmarshal(dAtA []byte) error { +func (m *QueryFinalizedBundleResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2519,15 +3411,15 @@ func (m *QueryFinalizedBundlesByHeightResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFinalizedBundlesByHeightResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryFinalizedBundleResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFinalizedBundlesByHeightResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryFinalizedBundleResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FinalizedBundle", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FinalizedBundles", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2554,7 +3446,7 @@ func (m *QueryFinalizedBundlesByHeightResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.FinalizedBundle.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.FinalizedBundles.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/query/types/bundles.pb.gw.go b/x/query/types/bundles.pb.gw.go index ab4ed045..a9b34985 100644 --- a/x/query/types/bundles.pb.gw.go +++ b/x/query/types/bundles.pb.gw.go @@ -34,10 +34,10 @@ var _ = descriptor.ForMessage var _ = metadata.Join var ( - filter_QueryBundles_FinalizedBundles_0 = &utilities.DoubleArray{Encoding: map[string]int{"pool_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_QueryBundles_FinalizedBundlesQuery_0 = &utilities.DoubleArray{Encoding: map[string]int{"pool_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) -func request_QueryBundles_FinalizedBundles_0(ctx context.Context, marshaler runtime.Marshaler, client QueryBundlesClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_QueryBundles_FinalizedBundlesQuery_0(ctx context.Context, marshaler runtime.Marshaler, client QueryBundlesClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryFinalizedBundlesRequest var metadata runtime.ServerMetadata @@ -62,16 +62,16 @@ func request_QueryBundles_FinalizedBundles_0(ctx context.Context, marshaler runt if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryBundles_FinalizedBundles_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryBundles_FinalizedBundlesQuery_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.FinalizedBundles(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.FinalizedBundlesQuery(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_QueryBundles_FinalizedBundles_0(ctx context.Context, marshaler runtime.Marshaler, server QueryBundlesServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_QueryBundles_FinalizedBundlesQuery_0(ctx context.Context, marshaler runtime.Marshaler, server QueryBundlesServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryFinalizedBundlesRequest var metadata runtime.ServerMetadata @@ -96,16 +96,16 @@ func local_request_QueryBundles_FinalizedBundles_0(ctx context.Context, marshale if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryBundles_FinalizedBundles_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueryBundles_FinalizedBundlesQuery_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.FinalizedBundles(ctx, &protoReq) + msg, err := server.FinalizedBundlesQuery(ctx, &protoReq) return msg, metadata, err } -func request_QueryBundles_FinalizedBundle_0(ctx context.Context, marshaler runtime.Marshaler, client QueryBundlesClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_QueryBundles_FinalizedBundleQuery_0(ctx context.Context, marshaler runtime.Marshaler, client QueryBundlesClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryFinalizedBundleRequest var metadata runtime.ServerMetadata @@ -138,12 +138,12 @@ func request_QueryBundles_FinalizedBundle_0(ctx context.Context, marshaler runti return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } - msg, err := client.FinalizedBundle(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.FinalizedBundleQuery(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_QueryBundles_FinalizedBundle_0(ctx context.Context, marshaler runtime.Marshaler, server QueryBundlesServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_QueryBundles_FinalizedBundleQuery_0(ctx context.Context, marshaler runtime.Marshaler, server QueryBundlesServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryFinalizedBundleRequest var metadata runtime.ServerMetadata @@ -176,83 +176,7 @@ func local_request_QueryBundles_FinalizedBundle_0(ctx context.Context, marshaler return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } - msg, err := server.FinalizedBundle(ctx, &protoReq) - return msg, metadata, err - -} - -func request_QueryBundles_FinalizedBundlesByHeight_0(ctx context.Context, marshaler runtime.Marshaler, client QueryBundlesClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryFinalizedBundlesByHeightRequest - 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) - } - - val, ok = pathParams["height"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") - } - - protoReq.Height, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) - } - - msg, err := client.FinalizedBundlesByHeight(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_QueryBundles_FinalizedBundlesByHeight_0(ctx context.Context, marshaler runtime.Marshaler, server QueryBundlesServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryFinalizedBundlesByHeightRequest - 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) - } - - val, ok = pathParams["height"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") - } - - protoReq.Height, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) - } - - msg, err := server.FinalizedBundlesByHeight(ctx, &protoReq) + msg, err := server.FinalizedBundleQuery(ctx, &protoReq) return msg, metadata, err } @@ -633,30 +557,7 @@ func local_request_QueryBundles_CanVote_0(ctx context.Context, marshaler runtime // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryBundlesHandlerFromEndpoint instead. func RegisterQueryBundlesHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryBundlesServer) error { - mux.Handle("GET", pattern_QueryBundles_FinalizedBundles_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_QueryBundles_FinalizedBundles_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_QueryBundles_FinalizedBundles_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_QueryBundles_FinalizedBundle_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_QueryBundles_FinalizedBundlesQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -667,7 +568,7 @@ func RegisterQueryBundlesHandlerServer(ctx context.Context, mux *runtime.ServeMu runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_QueryBundles_FinalizedBundle_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_QueryBundles_FinalizedBundlesQuery_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 { @@ -675,11 +576,11 @@ func RegisterQueryBundlesHandlerServer(ctx context.Context, mux *runtime.ServeMu return } - forward_QueryBundles_FinalizedBundle_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_QueryBundles_FinalizedBundlesQuery_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_QueryBundles_FinalizedBundlesByHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_QueryBundles_FinalizedBundleQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -690,7 +591,7 @@ func RegisterQueryBundlesHandlerServer(ctx context.Context, mux *runtime.ServeMu runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_QueryBundles_FinalizedBundlesByHeight_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_QueryBundles_FinalizedBundleQuery_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 { @@ -698,7 +599,7 @@ func RegisterQueryBundlesHandlerServer(ctx context.Context, mux *runtime.ServeMu return } - forward_QueryBundles_FinalizedBundlesByHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_QueryBundles_FinalizedBundleQuery_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -835,7 +736,7 @@ func RegisterQueryBundlesHandler(ctx context.Context, mux *runtime.ServeMux, con // "QueryBundlesClient" to call the correct interceptors. func RegisterQueryBundlesHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryBundlesClient) error { - mux.Handle("GET", pattern_QueryBundles_FinalizedBundles_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_QueryBundles_FinalizedBundlesQuery_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) @@ -844,18 +745,18 @@ func RegisterQueryBundlesHandlerClient(ctx context.Context, mux *runtime.ServeMu runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_QueryBundles_FinalizedBundles_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_QueryBundles_FinalizedBundlesQuery_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_QueryBundles_FinalizedBundles_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_QueryBundles_FinalizedBundlesQuery_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_QueryBundles_FinalizedBundle_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_QueryBundles_FinalizedBundleQuery_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) @@ -864,34 +765,14 @@ func RegisterQueryBundlesHandlerClient(ctx context.Context, mux *runtime.ServeMu runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_QueryBundles_FinalizedBundle_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_QueryBundles_FinalizedBundleQuery_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_QueryBundles_FinalizedBundle_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_QueryBundles_FinalizedBundlesByHeight_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_QueryBundles_FinalizedBundlesByHeight_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_QueryBundles_FinalizedBundlesByHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_QueryBundles_FinalizedBundleQuery_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -979,11 +860,9 @@ func RegisterQueryBundlesHandlerClient(ctx context.Context, mux *runtime.ServeMu } var ( - pattern_QueryBundles_FinalizedBundles_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", "finalized_bundles", "pool_id"}, "", runtime.AssumeColonVerbOpt(true))) - - pattern_QueryBundles_FinalizedBundle_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"kyve", "query", "v1beta1", "finalized_bundle", "pool_id", "id"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_QueryBundles_FinalizedBundlesQuery_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"kyve", "v1", "bundles", "pool_id"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_QueryBundles_FinalizedBundlesByHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"kyve", "query", "v1beta1", "finalized_bundle_by_height", "pool_id", "height"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_QueryBundles_FinalizedBundleQuery_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"kyve", "v1", "bundles", "pool_id", "id"}, "", runtime.AssumeColonVerbOpt(true))) pattern_QueryBundles_CurrentVoteStatus_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", "current_vote_status", "pool_id"}, "", runtime.AssumeColonVerbOpt(true))) @@ -995,11 +874,9 @@ var ( ) var ( - forward_QueryBundles_FinalizedBundles_0 = runtime.ForwardResponseMessage - - forward_QueryBundles_FinalizedBundle_0 = runtime.ForwardResponseMessage + forward_QueryBundles_FinalizedBundlesQuery_0 = runtime.ForwardResponseMessage - forward_QueryBundles_FinalizedBundlesByHeight_0 = runtime.ForwardResponseMessage + forward_QueryBundles_FinalizedBundleQuery_0 = runtime.ForwardResponseMessage forward_QueryBundles_CurrentVoteStatus_0 = runtime.ForwardResponseMessage