diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 13f9bec0..8b31768f 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -530,132 +530,237 @@ paths: address: type: string title: address of the staker - metadata: - description: metadata as logo, moniker, etc. + validator: type: object properties: - commission: + operator_address: type: string - title: >- - commission is the percentage of the rewards that - will + description: >- + operator_address defines the address of the + validator's operator; bech encoded in JSON. + consensus_pubkey: + description: >- + consensus_pubkey is the consensus public key of + the validator, as a Protobuf Any. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies + the type of the serialized - get transferred to the staker before the - remaining + protocol buffer message. This string must + contain at least - rewards are split across all delegators - moniker: + one "/" character. The last segment of the + URL's path must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name + should be in a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into + the binary all types that they + + expect it to use in the context of Any. + However, for URLs which use the + + scheme `http`, `https`, or no scheme, one + can optionally set up a type + + server that maps type URLs to message + definitions as follows: + + + * If no scheme is provided, `https` is + assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup + results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently + available in the official + + protobuf release, and it is not used for + type URLs beginning with + + type.googleapis.com. As of May 2023, there + are no widely used type server + + implementations and no plans to implement + one. + + + Schemes other than `http`, `https` (or the + empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + jailed: + type: boolean + description: >- + jailed defined whether the validator has been + jailed from bonded status or not. + status: + description: >- + status is the validator status + (bonded/unbonding/unbonded). type: string - title: |- - moniker is a human-readable name for displaying - the staker in the UI - website: + enum: + - BOND_STATUS_UNSPECIFIED + - BOND_STATUS_UNBONDED + - BOND_STATUS_UNBONDING + - BOND_STATUS_BONDED + default: BOND_STATUS_UNSPECIFIED + tokens: type: string - title: >- - website is a https-link to the website of the - staker - identity: + description: >- + tokens define the delegated tokens (incl. + self-delegation). + delegator_shares: type: string - title: identity from keybase.io - security_contact: + description: >- + delegator_shares defines total shares issued to + a validator's delegators. + description: + description: >- + description defines the description terms for + the validator. + type: object + properties: + moniker: + type: string + description: >- + moniker defines a human-readable name for + the validator. + identity: + type: string + description: >- + identity defines an optional identity + signature (ex. UPort or Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: >- + security_contact defines an optional email + for security contact. + details: + type: string + description: details define other optional details. + unbonding_height: type: string - description: security_contact ... - details: + format: int64 + description: >- + unbonding_height defines, if unbonding, the + height at which this validator has begun + unbonding. + unbonding_time: type: string - description: details ... - pending_commission_change: + format: date-time description: >- - pending_commission_change shows if the staker - plans - - to change its commission. Delegators will see a - warning in - - the UI. A Commission change takes some time - until - - the commission is applied. Users have time to - redelegate - - if they not agree with the new commission. + unbonding_time defines, if unbonding, the min + time for the validator to complete unbonding. + commission: + description: commission defines the commission parameters. type: object properties: - commission: - type: string - title: |- - commission is the new commission that will - become active once the change-time is over - creation_date: + commission_rates: + description: >- + commission_rates defines the initial + commission rates to be used for creating a + validator. + type: object + properties: + rate: + type: string + description: >- + rate is the commission rate charged to + delegators, as a fraction. + max_rate: + type: string + description: >- + max_rate defines the maximum commission + rate which validator can ever charge, as + a fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum + daily increase of the validator + commission, as a fraction. + update_time: type: string - format: int64 + format: date-time description: >- - creation_date is the UNIX-timestamp (in - seconds) + update_time is the last time the commission + rate was changed. + min_self_delegation: + type: string + description: >- + min_self_delegation is the validator's self + declared minimum self delegation. - of when the entry was created. - title: >- - CommissionChangeEntry shows when the old - commission - of a staker will change to the new commission - commission_rewards: + Since: cosmos-sdk 0.46 + unbonding_on_hold_ref_count: + type: string + format: int64 + title: >- + strictly positive if this validator's unbonding + has been stopped by external modules + unbonding_ids: type: array items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and - an amount. - - - NOTE: The amount field is an Int which - implements the custom method - - signatures required by gogoproto. + type: string + format: uint64 title: >- - commission_rewards are the rewards through - commission and storage cost - title: >- - StakerMetadata contains static information for a - staker - self_delegation: - type: string - format: uint64 - title: amount the staker has delegated to himself - self_delegation_unbonding: - type: string - format: uint64 + list of unbonding ids, each uniquely identifing + an unbonding of this validator description: >- - unbonding_amount is the amount the staker is - currently unbonding + Validator defines a validator, together with the + total amount of the - from the self-delegation. + Validator's bond shares and their exchange rate to + coins. Slashing results in - This amount can be larger than `amount` when the - staker + a decrease in the exchange rate, allowing correct + calculation of future - got slashed during unbonding. However, at the end of + undelegations without iterating over delegators. + When coins are delegated to - the unbonding period this amount is double checked - with the + this validator, the validator is credited with a + delegation whose number of - remaining amount. - total_delegation: - type: string - format: uint64 - title: |- - total_delegation returns the sum of all $KYVE users - have delegated to this staker - delegator_count: + bond shares is based on the amount of coins + delegated divided by the current + + exchange rate. Voting power can be calculated as + total bonded shares + + multiplied by exchange rate. + total_pool_stake: type: string format: uint64 - description: |- - delegator_count is the total number of individual - delegator addresses for that user. + title: >- + total_pool_stake returns the amount the validator + has in total + + staked in all his pools pools: type: array items: @@ -716,10 +821,10 @@ paths: out of funds no more bundles will be produced - total_delegation: + total_stake: type: string format: uint64 - title: total_delegation of the pool + title: total_stake of the pool status: description: |- status of the pool if pool is able @@ -774,6 +879,108 @@ paths: funds to pay for gas fees + commission: + type: string + title: >- + commission is the commission the validator has + chosen for + + this specific pool + pending_commission_change: + description: >- + pending_commission_change shows if the staker + plans + + to change its commission. Delegators will see + a warning in + + the UI. A Commission change takes some time + until + + the commission is applied. Users have time to + redelegate + + if they not agree with the new commission. + type: object + properties: + commission: + type: string + title: |- + commission is the new commission that will + become active once the change-time is over + creation_date: + type: string + format: int64 + description: >- + creation_date is the UNIX-timestamp (in + seconds) + + of when the entry was created. + title: >- + CommissionChangeEntry shows when the old + commission + + of a staker will change to the new commission + stake_fraction: + type: string + title: >- + stake fraction is a percentage the validator + has chosen for + + this pool. It is the fraction of how much of + his total stake + + the validator wants to stake in this specific + pool + pending_stake_fraction_change: + description: >- + pending_stake_fraction_change shows if the + staker plans + + to change its stake fraction. Delegators will + see a warning in + + the UI. A stake fraction change takes some + time until + + the stake fraction is applied. Users have time + to redelegate + + if they not agree with the new stake fraction. + type: object + properties: + stake_fraction: + type: string + title: >- + stake_fraction is the new stake_fraction + that will + + become active once the change-time is over + creation_date: + type: string + format: int64 + description: >- + creation_date is the UNIX-timestamp (in + seconds) + + of when the entry was created. + title: >- + StakeFractionChangeEntry shows when the old + stake fraction + + of a staker will change to the new stake + fraction + pool_stake: + type: string + format: uint64 + title: >- + pool stake shows the actual amount the + validator has staked + + in this pool. It can be lower than the + specified stake fraction + + because of the max voting power limit title: |- PoolMembership shows in which pool the staker is participating @@ -1144,10 +1351,10 @@ paths: title: |- total_funds of the pool. If the pool runs out of funds no more bundles will be produced - total_delegation: + total_stake: type: string format: uint64 - title: total_delegation of the pool + title: total_stake of the pool status: description: |- status of the pool if pool is able @@ -3862,132 +4069,237 @@ paths: address: type: string title: address of the staker - metadata: - description: metadata as logo, moniker, etc. + validator: type: object properties: - commission: + operator_address: type: string - title: >- - commission is the percentage of the rewards that - will + description: >- + operator_address defines the address of the + validator's operator; bech encoded in JSON. + consensus_pubkey: + description: >- + consensus_pubkey is the consensus public key of + the validator, as a Protobuf Any. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies + the type of the serialized - get transferred to the staker before the - remaining + protocol buffer message. This string must + contain at least - rewards are split across all delegators - moniker: + one "/" character. The last segment of the + URL's path must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name + should be in a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into + the binary all types that they + + expect it to use in the context of Any. + However, for URLs which use the + + scheme `http`, `https`, or no scheme, one + can optionally set up a type + + server that maps type URLs to message + definitions as follows: + + + * If no scheme is provided, `https` is + assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup + results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently + available in the official + + protobuf release, and it is not used for + type URLs beginning with + + type.googleapis.com. As of May 2023, there + are no widely used type server + + implementations and no plans to implement + one. + + + Schemes other than `http`, `https` (or the + empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + jailed: + type: boolean + description: >- + jailed defined whether the validator has been + jailed from bonded status or not. + status: + description: >- + status is the validator status + (bonded/unbonding/unbonded). type: string - title: |- - moniker is a human-readable name for displaying - the staker in the UI - website: + enum: + - BOND_STATUS_UNSPECIFIED + - BOND_STATUS_UNBONDED + - BOND_STATUS_UNBONDING + - BOND_STATUS_BONDED + default: BOND_STATUS_UNSPECIFIED + tokens: type: string - title: >- - website is a https-link to the website of the - staker - identity: + description: >- + tokens define the delegated tokens (incl. + self-delegation). + delegator_shares: type: string - title: identity from keybase.io - security_contact: + description: >- + delegator_shares defines total shares issued to + a validator's delegators. + description: + description: >- + description defines the description terms for + the validator. + type: object + properties: + moniker: + type: string + description: >- + moniker defines a human-readable name for + the validator. + identity: + type: string + description: >- + identity defines an optional identity + signature (ex. UPort or Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: >- + security_contact defines an optional email + for security contact. + details: + type: string + description: details define other optional details. + unbonding_height: type: string - description: security_contact ... - details: + format: int64 + description: >- + unbonding_height defines, if unbonding, the + height at which this validator has begun + unbonding. + unbonding_time: type: string - description: details ... - pending_commission_change: + format: date-time description: >- - pending_commission_change shows if the staker - plans - - to change its commission. Delegators will see a - warning in - - the UI. A Commission change takes some time - until - - the commission is applied. Users have time to - redelegate - - if they not agree with the new commission. + unbonding_time defines, if unbonding, the min + time for the validator to complete unbonding. + commission: + description: commission defines the commission parameters. type: object properties: - commission: - type: string - title: |- - commission is the new commission that will - become active once the change-time is over - creation_date: + commission_rates: + description: >- + commission_rates defines the initial + commission rates to be used for creating a + validator. + type: object + properties: + rate: + type: string + description: >- + rate is the commission rate charged to + delegators, as a fraction. + max_rate: + type: string + description: >- + max_rate defines the maximum commission + rate which validator can ever charge, as + a fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum + daily increase of the validator + commission, as a fraction. + update_time: type: string - format: int64 + format: date-time description: >- - creation_date is the UNIX-timestamp (in - seconds) + update_time is the last time the commission + rate was changed. + min_self_delegation: + type: string + description: >- + min_self_delegation is the validator's self + declared minimum self delegation. - of when the entry was created. - title: >- - CommissionChangeEntry shows when the old - commission - of a staker will change to the new commission - commission_rewards: + Since: cosmos-sdk 0.46 + unbonding_on_hold_ref_count: + type: string + format: int64 + title: >- + strictly positive if this validator's unbonding + has been stopped by external modules + unbonding_ids: type: array items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and - an amount. - - - NOTE: The amount field is an Int which - implements the custom method - - signatures required by gogoproto. + type: string + format: uint64 title: >- - commission_rewards are the rewards through - commission and storage cost - title: >- - StakerMetadata contains static information for a - staker - self_delegation: - type: string - format: uint64 - title: amount the staker has delegated to himself - self_delegation_unbonding: - type: string - format: uint64 + list of unbonding ids, each uniquely identifing + an unbonding of this validator description: >- - unbonding_amount is the amount the staker is - currently unbonding + Validator defines a validator, together with the + total amount of the - from the self-delegation. + Validator's bond shares and their exchange rate to + coins. Slashing results in - This amount can be larger than `amount` when the - staker + a decrease in the exchange rate, allowing correct + calculation of future - got slashed during unbonding. However, at the end of + undelegations without iterating over delegators. + When coins are delegated to - the unbonding period this amount is double checked - with the + this validator, the validator is credited with a + delegation whose number of - remaining amount. - total_delegation: - type: string - format: uint64 - title: |- - total_delegation returns the sum of all $KYVE users - have delegated to this staker - delegator_count: + bond shares is based on the amount of coins + delegated divided by the current + + exchange rate. Voting power can be calculated as + total bonded shares + + multiplied by exchange rate. + total_pool_stake: type: string format: uint64 - description: |- - delegator_count is the total number of individual - delegator addresses for that user. + title: >- + total_pool_stake returns the amount the validator + has in total + + staked in all his pools pools: type: array items: @@ -4048,10 +4360,10 @@ paths: out of funds no more bundles will be produced - total_delegation: + total_stake: type: string format: uint64 - title: total_delegation of the pool + title: total_stake of the pool status: description: |- status of the pool if pool is able @@ -4106,7 +4418,109 @@ paths: funds to pay for gas fees - title: |- + commission: + type: string + title: >- + commission is the commission the validator has + chosen for + + this specific pool + pending_commission_change: + description: >- + pending_commission_change shows if the staker + plans + + to change its commission. Delegators will see + a warning in + + the UI. A Commission change takes some time + until + + the commission is applied. Users have time to + redelegate + + if they not agree with the new commission. + type: object + properties: + commission: + type: string + title: |- + commission is the new commission that will + become active once the change-time is over + creation_date: + type: string + format: int64 + description: >- + creation_date is the UNIX-timestamp (in + seconds) + + of when the entry was created. + title: >- + CommissionChangeEntry shows when the old + commission + + of a staker will change to the new commission + stake_fraction: + type: string + title: >- + stake fraction is a percentage the validator + has chosen for + + this pool. It is the fraction of how much of + his total stake + + the validator wants to stake in this specific + pool + pending_stake_fraction_change: + description: >- + pending_stake_fraction_change shows if the + staker plans + + to change its stake fraction. Delegators will + see a warning in + + the UI. A stake fraction change takes some + time until + + the stake fraction is applied. Users have time + to redelegate + + if they not agree with the new stake fraction. + type: object + properties: + stake_fraction: + type: string + title: >- + stake_fraction is the new stake_fraction + that will + + become active once the change-time is over + creation_date: + type: string + format: int64 + description: >- + creation_date is the UNIX-timestamp (in + seconds) + + of when the entry was created. + title: >- + StakeFractionChangeEntry shows when the old + stake fraction + + of a staker will change to the new stake + fraction + pool_stake: + type: string + format: uint64 + title: >- + pool stake shows the actual amount the + validator has staked + + in this pool. It can be lower than the + specified stake fraction + + because of the max voting power limit + title: |- PoolMembership shows in which pool the staker is participating description: |- @@ -6262,117 +6676,233 @@ paths: address: type: string title: address of the staker - metadata: - description: metadata as logo, moniker, etc. + validator: type: object properties: - commission: - type: string - title: |- - commission is the percentage of the rewards that will - get transferred to the staker before the remaining - rewards are split across all delegators - moniker: - type: string - title: |- - moniker is a human-readable name for displaying - the staker in the UI - website: - type: string - title: website is a https-link to the website of the staker - identity: - type: string - title: identity from keybase.io - security_contact: - type: string - description: security_contact ... - details: + operator_address: type: string - description: details ... - pending_commission_change: description: >- - pending_commission_change shows if the staker plans + operator_address defines the address of the + validator's operator; bech encoded in JSON. + consensus_pubkey: + description: >- + consensus_pubkey is the consensus public key of the + validator, as a Protobuf Any. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the + type of the serialized + + protocol buffer message. This string must contain + at least + + one "/" character. The last segment of the URL's + path must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should + be in a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the + binary all types that they + + expect it to use in the context of Any. However, + for URLs which use the + + scheme `http`, `https`, or no scheme, one can + optionally set up a type + + server that maps type URLs to message definitions + as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results + based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently + available in the official + + protobuf release, and it is not used for type URLs + beginning with - to change its commission. Delegators will see a - warning in + type.googleapis.com. As of May 2023, there are no + widely used type server + + implementations and no plans to implement one. - the UI. A Commission change takes some time until - the commission is applied. Users have time to - redelegate + Schemes other than `http`, `https` (or the empty + scheme) might be - if they not agree with the new commission. + used with implementation specific semantics. + additionalProperties: {} + jailed: + type: boolean + description: >- + jailed defined whether the validator has been jailed + from bonded status or not. + status: + description: >- + status is the validator status + (bonded/unbonding/unbonded). + type: string + enum: + - BOND_STATUS_UNSPECIFIED + - BOND_STATUS_UNBONDED + - BOND_STATUS_UNBONDING + - BOND_STATUS_BONDED + default: BOND_STATUS_UNSPECIFIED + tokens: + type: string + description: >- + tokens define the delegated tokens (incl. + self-delegation). + delegator_shares: + type: string + description: >- + delegator_shares defines total shares issued to a + validator's delegators. + description: + description: >- + description defines the description terms for the + validator. type: object properties: - commission: + moniker: type: string - title: |- - commission is the new commission that will - become active once the change-time is over - creation_date: + description: >- + moniker defines a human-readable name for the + validator. + identity: type: string - format: int64 - description: |- - creation_date is the UNIX-timestamp (in seconds) - of when the entry was created. - title: |- - CommissionChangeEntry shows when the old commission - of a staker will change to the new commission - commission_rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. - + description: >- + identity defines an optional identity signature + (ex. UPort or Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: >- + security_contact defines an optional email for + security contact. + details: + type: string + description: details define other optional details. + unbonding_height: + type: string + format: int64 + description: >- + unbonding_height defines, if unbonding, the height at + which this validator has begun unbonding. + unbonding_time: + type: string + format: date-time + description: >- + unbonding_time defines, if unbonding, the min time for + the validator to complete unbonding. + commission: + description: commission defines the commission parameters. + type: object + properties: + commission_rates: + description: >- + commission_rates defines the initial commission + rates to be used for creating a validator. + type: object + properties: + rate: + type: string + description: >- + rate is the commission rate charged to + delegators, as a fraction. + max_rate: + type: string + description: >- + max_rate defines the maximum commission rate + which validator can ever charge, as a + fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum daily + increase of the validator commission, as a + fraction. + update_time: + type: string + format: date-time + description: >- + update_time is the last time the commission rate + was changed. + min_self_delegation: + type: string + description: >- + min_self_delegation is the validator's self declared + minimum self delegation. - NOTE: The amount field is an Int which implements - the custom method - signatures required by gogoproto. + Since: cosmos-sdk 0.46 + unbonding_on_hold_ref_count: + type: string + format: int64 title: >- - commission_rewards are the rewards through commission - and storage cost - title: StakerMetadata contains static information for a staker - self_delegation: - type: string - format: uint64 - title: amount the staker has delegated to himself - self_delegation_unbonding: - type: string - format: uint64 + strictly positive if this validator's unbonding has + been stopped by external modules + unbonding_ids: + type: array + items: + type: string + format: uint64 + title: >- + list of unbonding ids, each uniquely identifing an + unbonding of this validator description: >- - unbonding_amount is the amount the staker is currently - unbonding + Validator defines a validator, together with the total + amount of the - from the self-delegation. + Validator's bond shares and their exchange rate to coins. + Slashing results in - This amount can be larger than `amount` when the staker + a decrease in the exchange rate, allowing correct + calculation of future - got slashed during unbonding. However, at the end of + undelegations without iterating over delegators. When + coins are delegated to - the unbonding period this amount is double checked with - the + this validator, the validator is credited with a + delegation whose number of - remaining amount. - total_delegation: - type: string - format: uint64 - title: |- - total_delegation returns the sum of all $KYVE users - have delegated to this staker - delegator_count: + bond shares is based on the amount of coins delegated + divided by the current + + exchange rate. Voting power can be calculated as total + bonded shares + + multiplied by exchange rate. + total_pool_stake: type: string format: uint64 - description: |- - delegator_count is the total number of individual - delegator addresses for that user. + title: >- + total_pool_stake returns the amount the validator has in + total + + staked in all his pools pools: type: array items: @@ -6429,10 +6959,10 @@ paths: title: |- total_funds of the pool. If the pool runs out of funds no more bundles will be produced - total_delegation: + total_stake: type: string format: uint64 - title: total_delegation of the pool + title: total_stake of the pool status: description: |- status of the pool if pool is able @@ -6482,60 +7012,152 @@ paths: to pay for gas fees - title: |- - PoolMembership shows in which pool the staker - is participating - description: |- - pools is a list of all pools the staker is currently - participating, i.e. allowed to vote and upload data. - title: >- - FullStaker aggregates information from the staker and its - delegators - - as well as pending queue entries into one object. - - It contains almost all needed information for a convenient - usage - description: >- - QueryStakerResponse is the response type for the Query/Staker RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent + commission: + type: string + title: >- + commission is the commission the validator has + chosen for - the fully qualified name of the type (as in + this specific pool + pending_commission_change: + description: >- + pending_commission_change shows if the staker plans - `path/google.protobuf.Duration`). The name should be in - a canonical form + to change its commission. Delegators will see a + warning in - (e.g., leading "." is not accepted). + the UI. A Commission change takes some time until + the commission is applied. Users have time to + redelegate + + if they not agree with the new commission. + type: object + properties: + commission: + type: string + title: |- + commission is the new commission that will + become active once the change-time is over + creation_date: + type: string + format: int64 + description: |- + creation_date is the UNIX-timestamp (in seconds) + of when the entry was created. + title: |- + CommissionChangeEntry shows when the old commission + of a staker will change to the new commission + stake_fraction: + type: string + title: >- + stake fraction is a percentage the validator has + chosen for + + this pool. It is the fraction of how much of his + total stake + + the validator wants to stake in this specific pool + pending_stake_fraction_change: + description: >- + pending_stake_fraction_change shows if the staker + plans + + to change its stake fraction. Delegators will see a + warning in + + the UI. A stake fraction change takes some time + until + + the stake fraction is applied. Users have time to + redelegate + + if they not agree with the new stake fraction. + type: object + properties: + stake_fraction: + type: string + title: >- + stake_fraction is the new stake_fraction that + will + + become active once the change-time is over + creation_date: + type: string + format: int64 + description: |- + creation_date is the UNIX-timestamp (in seconds) + of when the entry was created. + title: >- + StakeFractionChangeEntry shows when the old stake + fraction + + of a staker will change to the new stake fraction + pool_stake: + type: string + format: uint64 + title: >- + pool stake shows the actual amount the validator has + staked + + in this pool. It can be lower than the specified + stake fraction + + because of the max voting power limit + title: |- + PoolMembership shows in which pool the staker + is participating + description: |- + pools is a list of all pools the staker is currently + participating, i.e. allowed to vote and upload data. + title: >- + FullStaker aggregates information from the staker and its + delegators + + as well as pending queue entries into one object. + + It contains almost all needed information for a convenient + usage + description: >- + QueryStakerResponse is the response type for the Query/Staker RPC + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). - In practice, teams usually precompile into the binary - all types that they + + In practice, teams usually precompile into the binary + all types that they expect it to use in the context of Any. However, for URLs which use the @@ -6716,183 +7338,296 @@ paths: address: type: string title: address of the staker - metadata: - description: metadata as logo, moniker, etc. + validator: type: object properties: - commission: - type: string - title: >- - commission is the percentage of the rewards that - will - - get transferred to the staker before the remaining - - rewards are split across all delegators - moniker: - type: string - title: |- - moniker is a human-readable name for displaying - the staker in the UI - website: - type: string - title: website is a https-link to the website of the staker - identity: - type: string - title: identity from keybase.io - security_contact: - type: string - description: security_contact ... - details: + operator_address: type: string - description: details ... - pending_commission_change: description: >- - pending_commission_change shows if the staker plans - - to change its commission. Delegators will see a - warning in - - the UI. A Commission change takes some time until - - the commission is applied. Users have time to - redelegate - - if they not agree with the new commission. + operator_address defines the address of the + validator's operator; bech encoded in JSON. + consensus_pubkey: + description: >- + consensus_pubkey is the consensus public key of the + validator, as a Protobuf Any. type: object properties: - commission: - type: string - title: |- - commission is the new commission that will - become active once the change-time is over - creation_date: + '@type': type: string - format: int64 - description: |- - creation_date is the UNIX-timestamp (in seconds) - of when the entry was created. - title: |- - CommissionChangeEntry shows when the old commission - of a staker will change to the new commission - commission_rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. + description: >- + A URL/resource name that uniquely identifies the + type of the serialized + protocol buffer message. This string must + contain at least - NOTE: The amount field is an Int which implements - the custom method + one "/" character. The last segment of the URL's + path must represent - signatures required by gogoproto. - title: >- - commission_rewards are the rewards through - commission and storage cost - title: StakerMetadata contains static information for a staker - self_delegation: - type: string - format: uint64 - title: amount the staker has delegated to himself - self_delegation_unbonding: - type: string - format: uint64 - description: >- - unbonding_amount is the amount the staker is currently - unbonding + the fully qualified name of the type (as in - from the self-delegation. + `path/google.protobuf.Duration`). The name + should be in a canonical form - This amount can be larger than `amount` when the staker + (e.g., leading "." is not accepted). - got slashed during unbonding. However, at the end of - the unbonding period this amount is double checked with - the + In practice, teams usually precompile into the + binary all types that they - remaining amount. - total_delegation: - type: string - format: uint64 - title: |- - total_delegation returns the sum of all $KYVE users - have delegated to this staker - delegator_count: - type: string - format: uint64 - description: |- - delegator_count is the total number of individual - delegator addresses for that user. - pools: - type: array - items: - type: object - properties: - pool: - title: pool contains useful information about the pool - type: object - properties: - id: - type: string - format: uint64 - title: id is the ID of the pool - name: - type: string - title: name of the pool - runtime: - type: string - description: |- - runtime for the protocol nodes - like evm, bitcoin, etc. - logo: - type: string - title: logo of the pool - inflation_share_weight: - type: string - title: >- - inflation_share_weight is the base payout for - each bundle reward - upload_interval: - type: string - format: uint64 - title: >- - upload_interval is the interval bundles get - created - total_funds: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and - an amount. + expect it to use in the context of Any. However, + for URLs which use the + scheme `http`, `https`, or no scheme, one can + optionally set up a type - NOTE: The amount field is an Int which - implements the custom method + server that maps type URLs to message + definitions as follows: - signatures required by gogoproto. - title: |- - total_funds of the pool. If the pool runs - out of funds no more bundles will be produced - total_delegation: - type: string - format: uint64 - title: total_delegation of the pool - status: - description: |- - status of the pool if pool is able + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup + results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently + available in the official + + protobuf release, and it is not used for type + URLs beginning with + + type.googleapis.com. As of May 2023, there are + no widely used type server + + implementations and no plans to implement one. + + + Schemes other than `http`, `https` (or the empty + scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + jailed: + type: boolean + description: >- + jailed defined whether the validator has been jailed + from bonded status or not. + status: + description: >- + status is the validator status + (bonded/unbonding/unbonded). + type: string + enum: + - BOND_STATUS_UNSPECIFIED + - BOND_STATUS_UNBONDED + - BOND_STATUS_UNBONDING + - BOND_STATUS_BONDED + default: BOND_STATUS_UNSPECIFIED + tokens: + type: string + description: >- + tokens define the delegated tokens (incl. + self-delegation). + delegator_shares: + type: string + description: >- + delegator_shares defines total shares issued to a + validator's delegators. + description: + description: >- + description defines the description terms for the + validator. + type: object + properties: + moniker: + type: string + description: >- + moniker defines a human-readable name for the + validator. + identity: + type: string + description: >- + identity defines an optional identity signature + (ex. UPort or Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: >- + security_contact defines an optional email for + security contact. + details: + type: string + description: details define other optional details. + unbonding_height: + type: string + format: int64 + description: >- + unbonding_height defines, if unbonding, the height + at which this validator has begun unbonding. + unbonding_time: + type: string + format: date-time + description: >- + unbonding_time defines, if unbonding, the min time + for the validator to complete unbonding. + commission: + description: commission defines the commission parameters. + type: object + properties: + commission_rates: + description: >- + commission_rates defines the initial commission + rates to be used for creating a validator. + type: object + properties: + rate: + type: string + description: >- + rate is the commission rate charged to + delegators, as a fraction. + max_rate: + type: string + description: >- + max_rate defines the maximum commission rate + which validator can ever charge, as a + fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum daily + increase of the validator commission, as a + fraction. + update_time: + type: string + format: date-time + description: >- + update_time is the last time the commission rate + was changed. + min_self_delegation: + type: string + description: >- + min_self_delegation is the validator's self declared + minimum self delegation. + + + Since: cosmos-sdk 0.46 + unbonding_on_hold_ref_count: + type: string + format: int64 + title: >- + strictly positive if this validator's unbonding has + been stopped by external modules + unbonding_ids: + type: array + items: + type: string + format: uint64 + title: >- + list of unbonding ids, each uniquely identifing an + unbonding of this validator + description: >- + Validator defines a validator, together with the total + amount of the + + Validator's bond shares and their exchange rate to + coins. Slashing results in + + a decrease in the exchange rate, allowing correct + calculation of future + + undelegations without iterating over delegators. When + coins are delegated to + + this validator, the validator is credited with a + delegation whose number of + + bond shares is based on the amount of coins delegated + divided by the current + + exchange rate. Voting power can be calculated as total + bonded shares + + multiplied by exchange rate. + total_pool_stake: + type: string + format: uint64 + title: >- + total_pool_stake returns the amount the validator has in + total + + staked in all his pools + pools: + type: array + items: + type: object + properties: + pool: + title: pool contains useful information about the pool + type: object + properties: + id: + type: string + format: uint64 + title: id is the ID of the pool + name: + type: string + title: name of the pool + runtime: + type: string + description: |- + runtime for the protocol nodes + like evm, bitcoin, etc. + logo: + type: string + title: logo of the pool + inflation_share_weight: + type: string + title: >- + inflation_share_weight is the base payout for + each bundle reward + upload_interval: + type: string + format: uint64 + title: >- + upload_interval is the interval bundles get + created + total_funds: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and + an amount. + + + NOTE: The amount field is an Int which + implements the custom method + + signatures required by gogoproto. + title: |- + total_funds of the pool. If the pool runs + out of funds no more bundles will be produced + total_stake: + type: string + format: uint64 + title: total_stake of the pool + status: + description: |- + status of the pool if pool is able to produce bundles, etc. type: string enum: @@ -6939,22 +7674,121 @@ paths: funds to pay for gas fees - title: |- - PoolMembership shows in which pool the staker - is participating - description: |- - pools is a list of all pools the staker is currently - participating, i.e. allowed to vote and upload data. - title: >- - FullStaker aggregates information from the staker and its - delegators + commission: + type: string + title: >- + commission is the commission the validator has + chosen for - as well as pending queue entries into one object. + this specific pool + pending_commission_change: + description: >- + pending_commission_change shows if the staker + plans - It contains almost all needed information for a convenient - usage - description: stakers ... - pagination: + to change its commission. Delegators will see a + warning in + + the UI. A Commission change takes some time until + + the commission is applied. Users have time to + redelegate + + if they not agree with the new commission. + type: object + properties: + commission: + type: string + title: |- + commission is the new commission that will + become active once the change-time is over + creation_date: + type: string + format: int64 + description: >- + creation_date is the UNIX-timestamp (in + seconds) + + of when the entry was created. + title: >- + CommissionChangeEntry shows when the old + commission + + of a staker will change to the new commission + stake_fraction: + type: string + title: >- + stake fraction is a percentage the validator has + chosen for + + this pool. It is the fraction of how much of his + total stake + + the validator wants to stake in this specific pool + pending_stake_fraction_change: + description: >- + pending_stake_fraction_change shows if the staker + plans + + to change its stake fraction. Delegators will see + a warning in + + the UI. A stake fraction change takes some time + until + + the stake fraction is applied. Users have time to + redelegate + + if they not agree with the new stake fraction. + type: object + properties: + stake_fraction: + type: string + title: >- + stake_fraction is the new stake_fraction that + will + + become active once the change-time is over + creation_date: + type: string + format: int64 + description: >- + creation_date is the UNIX-timestamp (in + seconds) + + of when the entry was created. + title: >- + StakeFractionChangeEntry shows when the old stake + fraction + + of a staker will change to the new stake fraction + pool_stake: + type: string + format: uint64 + title: >- + pool stake shows the actual amount the validator + has staked + + in this pool. It can be lower than the specified + stake fraction + + because of the max voting power limit + title: |- + PoolMembership shows in which pool the staker + is participating + description: |- + pools is a list of all pools the staker is currently + participating, i.e. allowed to vote and upload data. + title: >- + FullStaker aggregates information from the staker and its + delegators + + as well as pending queue entries into one object. + + It contains almost all needed information for a convenient + usage + description: stakers ... + pagination: description: pagination defines the pagination in the response. type: object properties: @@ -7229,15 +8063,19 @@ paths: status looks whether a staker is participating in pools or not - STAKER_STATUS_UNSPECIFIED: STAKER_STATUS_UNSPECIFIED ... - - STAKER_STATUS_ACTIVE: STAKER_STATUS_ACTIVE ... - - STAKER_STATUS_INACTIVE: STAKER_STATUS_INACTIVE ... + - STAKER_STATUS_PROTOCOL_ACTIVE: STAKER_STATUS_PROTOCOL_ACTIVE ... + - STAKER_STATUS_PROTOCOL_INACTIVE: STAKER_STATUS_PROTOCOL_INACTIVE ... + - STAKER_STATUS_CHAIN_ACTIVE: STAKER_STATUS_CHAIN_ACTIVE ... + - STAKER_STATUS_CHAIN_INACTIVE: STAKER_STATUS_CHAIN_INACTIVE ... in: query required: false type: string enum: - STAKER_STATUS_UNSPECIFIED - - STAKER_STATUS_ACTIVE - - STAKER_STATUS_INACTIVE + - STAKER_STATUS_PROTOCOL_ACTIVE + - STAKER_STATUS_PROTOCOL_INACTIVE + - STAKER_STATUS_CHAIN_ACTIVE + - STAKER_STATUS_CHAIN_INACTIVE default: STAKER_STATUS_UNSPECIFIED - name: search description: search searches for moniker OR address @@ -7263,308 +8101,458 @@ paths: items: type: object properties: - staker: - description: staker ... + address: + type: string + title: address of the staker + validator: type: object properties: - address: + operator_address: type: string - title: address of the staker - metadata: - description: metadata as logo, moniker, etc. + description: >- + operator_address defines the address of the + validator's operator; bech encoded in JSON. + consensus_pubkey: + description: >- + consensus_pubkey is the consensus public key of the + validator, as a Protobuf Any. type: object properties: - commission: + '@type': type: string - title: >- - commission is the percentage of the rewards that - will + description: >- + A URL/resource name that uniquely identifies the + type of the serialized + + protocol buffer message. This string must + contain at least + + one "/" character. The last segment of the URL's + path must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name + should be in a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the + binary all types that they + + expect it to use in the context of Any. However, + for URLs which use the + + scheme `http`, `https`, or no scheme, one can + optionally set up a type + + server that maps type URLs to message + definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup + results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently + available in the official + + protobuf release, and it is not used for type + URLs beginning with + + type.googleapis.com. As of May 2023, there are + no widely used type server + + implementations and no plans to implement one. - get transferred to the staker before the - remaining - rewards are split across all delegators + Schemes other than `http`, `https` (or the empty + scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + jailed: + type: boolean + description: >- + jailed defined whether the validator has been jailed + from bonded status or not. + status: + description: >- + status is the validator status + (bonded/unbonding/unbonded). + type: string + enum: + - BOND_STATUS_UNSPECIFIED + - BOND_STATUS_UNBONDED + - BOND_STATUS_UNBONDING + - BOND_STATUS_BONDED + default: BOND_STATUS_UNSPECIFIED + tokens: + type: string + description: >- + tokens define the delegated tokens (incl. + self-delegation). + delegator_shares: + type: string + description: >- + delegator_shares defines total shares issued to a + validator's delegators. + description: + description: >- + description defines the description terms for the + validator. + type: object + properties: moniker: type: string - title: |- - moniker is a human-readable name for displaying - the staker in the UI - website: - type: string - title: >- - website is a https-link to the website of the - staker + description: >- + moniker defines a human-readable name for the + validator. identity: type: string - title: identity from keybase.io + description: >- + identity defines an optional identity signature + (ex. UPort or Keybase). + website: + type: string + description: website defines an optional website link. security_contact: type: string - description: security_contact ... + description: >- + security_contact defines an optional email for + security contact. details: type: string - description: details ... - pending_commission_change: + description: details define other optional details. + unbonding_height: + type: string + format: int64 + description: >- + unbonding_height defines, if unbonding, the height + at which this validator has begun unbonding. + unbonding_time: + type: string + format: date-time + description: >- + unbonding_time defines, if unbonding, the min time + for the validator to complete unbonding. + commission: + description: commission defines the commission parameters. + type: object + properties: + commission_rates: description: >- - pending_commission_change shows if the staker - plans - - to change its commission. Delegators will see a - warning in - - the UI. A Commission change takes some time - until - - the commission is applied. Users have time to - redelegate - - if they not agree with the new commission. + commission_rates defines the initial commission + rates to be used for creating a validator. type: object properties: - commission: + rate: type: string - title: |- - commission is the new commission that will - become active once the change-time is over - creation_date: + description: >- + rate is the commission rate charged to + delegators, as a fraction. + max_rate: type: string - format: int64 description: >- - creation_date is the UNIX-timestamp (in - seconds) + max_rate defines the maximum commission rate + which validator can ever charge, as a + fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum daily + increase of the validator commission, as a + fraction. + update_time: + type: string + format: date-time + description: >- + update_time is the last time the commission rate + was changed. + min_self_delegation: + type: string + description: >- + min_self_delegation is the validator's self declared + minimum self delegation. - of when the entry was created. - title: >- - CommissionChangeEntry shows when the old - commission - of a staker will change to the new commission - commission_rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and - an amount. + Since: cosmos-sdk 0.46 + unbonding_on_hold_ref_count: + type: string + format: int64 + title: >- + strictly positive if this validator's unbonding has + been stopped by external modules + unbonding_ids: + type: array + items: + type: string + format: uint64 + title: >- + list of unbonding ids, each uniquely identifing an + unbonding of this validator + description: >- + Validator defines a validator, together with the total + amount of the + Validator's bond shares and their exchange rate to + coins. Slashing results in - NOTE: The amount field is an Int which - implements the custom method + a decrease in the exchange rate, allowing correct + calculation of future - signatures required by gogoproto. - title: >- - commission_rewards are the rewards through - commission and storage cost - title: >- - StakerMetadata contains static information for a - staker - self_delegation: - type: string - format: uint64 - title: amount the staker has delegated to himself - self_delegation_unbonding: - type: string - format: uint64 - description: >- - unbonding_amount is the amount the staker is - currently unbonding + undelegations without iterating over delegators. When + coins are delegated to + + this validator, the validator is credited with a + delegation whose number of + + bond shares is based on the amount of coins delegated + divided by the current + + exchange rate. Voting power can be calculated as total + bonded shares + + multiplied by exchange rate. + total_pool_stake: + type: string + format: uint64 + title: >- + total_pool_stake returns the amount the validator has in + total + + staked in all his pools + pools: + type: array + items: + type: object + properties: + pool: + title: pool contains useful information about the pool + type: object + properties: + id: + type: string + format: uint64 + title: id is the ID of the pool + name: + type: string + title: name of the pool + runtime: + type: string + description: |- + runtime for the protocol nodes + like evm, bitcoin, etc. + logo: + type: string + title: logo of the pool + inflation_share_weight: + type: string + title: >- + inflation_share_weight is the base payout for + each bundle reward + upload_interval: + type: string + format: uint64 + title: >- + upload_interval is the interval bundles get + created + total_funds: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and + an amount. + + + NOTE: The amount field is an Int which + implements the custom method + + signatures required by gogoproto. + title: |- + total_funds of the pool. If the pool runs + out of funds no more bundles will be produced + total_stake: + type: string + format: uint64 + title: total_stake of the pool + status: + description: |- + status of the pool if pool is able + to produce bundles, etc. + type: string + enum: + - POOL_STATUS_UNSPECIFIED + - POOL_STATUS_ACTIVE + - POOL_STATUS_DISABLED + - POOL_STATUS_NO_FUNDS + - POOL_STATUS_NOT_ENOUGH_DELEGATION + - POOL_STATUS_UPGRADING + - POOL_STATUS_VOTING_POWER_TOO_HIGH + - POOL_STATUS_END_KEY_REACHED + default: POOL_STATUS_UNSPECIFIED + points: + type: string + format: uint64 + description: |- + points indicates if the staker is inactive + If the staker misses a vote, a point is added. + After 5 points the staker is removed from + the stakers set. + is_leaving: + type: boolean + title: |- + is_leaving indicates if a user has scheduled a + a PoolLeave entry. After the leave-time is over + the staker will no longer participate in that pool + valaddress: + type: string + description: >- + Valaddress is the address which is authorized to + vote + + and submit bundles. If the server gets compromised + + the staker can just change the valaddress. + balance: + type: string + format: uint64 + title: >- + balance is the valaddress account balance and + indicates + + whether or not the valaccount needs additional + funds to + + pay for gas fees + commission: + type: string + title: >- + commission is the commission the validator has + chosen for - from the self-delegation. + this specific pool + pending_commission_change: + description: >- + pending_commission_change shows if the staker + plans - This amount can be larger than `amount` when the - staker + to change its commission. Delegators will see a + warning in - got slashed during unbonding. However, at the end of + the UI. A Commission change takes some time until - the unbonding period this amount is double checked - with the + the commission is applied. Users have time to + redelegate - remaining amount. - total_delegation: - type: string - format: uint64 - title: |- - total_delegation returns the sum of all $KYVE users - have delegated to this staker - delegator_count: - type: string - format: uint64 - description: |- - delegator_count is the total number of individual - delegator addresses for that user. - pools: - type: array - items: + if they not agree with the new commission. type: object properties: - pool: - title: >- - pool contains useful information about the - pool - type: object - properties: - id: - type: string - format: uint64 - title: id is the ID of the pool - name: - type: string - title: name of the pool - runtime: - type: string - description: |- - runtime for the protocol nodes - like evm, bitcoin, etc. - logo: - type: string - title: logo of the pool - inflation_share_weight: - type: string - title: >- - inflation_share_weight is the base payout - for each bundle reward - upload_interval: - type: string - format: uint64 - title: >- - upload_interval is the interval bundles - get created - total_funds: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination - and an amount. + commission: + type: string + title: |- + commission is the new commission that will + become active once the change-time is over + creation_date: + type: string + format: int64 + description: >- + creation_date is the UNIX-timestamp (in + seconds) + of when the entry was created. + title: >- + CommissionChangeEntry shows when the old + commission - NOTE: The amount field is an Int which - implements the custom method + of a staker will change to the new commission + stake_fraction: + type: string + title: >- + stake fraction is a percentage the validator has + chosen for - signatures required by gogoproto. - title: >- - total_funds of the pool. If the pool runs + this pool. It is the fraction of how much of his + total stake - out of funds no more bundles will be - produced - total_delegation: - type: string - format: uint64 - title: total_delegation of the pool - status: - description: |- - status of the pool if pool is able - to produce bundles, etc. - type: string - enum: - - POOL_STATUS_UNSPECIFIED - - POOL_STATUS_ACTIVE - - POOL_STATUS_DISABLED - - POOL_STATUS_NO_FUNDS - - POOL_STATUS_NOT_ENOUGH_DELEGATION - - POOL_STATUS_UPGRADING - - POOL_STATUS_VOTING_POWER_TOO_HIGH - - POOL_STATUS_END_KEY_REACHED - default: POOL_STATUS_UNSPECIFIED - points: + the validator wants to stake in this specific pool + pending_stake_fraction_change: + description: >- + pending_stake_fraction_change shows if the staker + plans + + to change its stake fraction. Delegators will see + a warning in + + the UI. A stake fraction change takes some time + until + + the stake fraction is applied. Users have time to + redelegate + + if they not agree with the new stake fraction. + type: object + properties: + stake_fraction: type: string - format: uint64 - description: |- - points indicates if the staker is inactive - If the staker misses a vote, a point is added. - After 5 points the staker is removed from - the stakers set. - is_leaving: - type: boolean title: >- - is_leaving indicates if a user has scheduled a - - a PoolLeave entry. After the leave-time is - over + stake_fraction is the new stake_fraction that + will - the staker will no longer participate in that - pool - valaddress: + become active once the change-time is over + creation_date: type: string + format: int64 description: >- - Valaddress is the address which is authorized - to vote + creation_date is the UNIX-timestamp (in + seconds) - and submit bundles. If the server gets - compromised + of when the entry was created. + title: >- + StakeFractionChangeEntry shows when the old stake + fraction - the staker can just change the valaddress. - balance: - type: string - format: uint64 - title: >- - balance is the valaddress account balance and - indicates + of a staker will change to the new stake fraction + pool_stake: + type: string + format: uint64 + title: >- + pool stake shows the actual amount the validator + has staked - whether or not the valaccount needs additional - funds to + in this pool. It can be lower than the specified + stake fraction - pay for gas fees - title: |- - PoolMembership shows in which pool the staker - is participating - description: |- - pools is a list of all pools the staker is currently - participating, i.e. allowed to vote and upload data. - title: >- - FullStaker aggregates information from the staker and - its delegators + because of the max voting power limit + title: |- + PoolMembership shows in which pool the staker + is participating + description: |- + pools is a list of all pools the staker is currently + participating, i.e. allowed to vote and upload data. + title: >- + FullStaker aggregates information from the staker and its + delegators - as well as pending queue entries into one object. + as well as pending queue entries into one object. - It contains almost all needed information for a - convenient usage - valaccount: - description: valaccount ... - type: object - properties: - pool_id: - type: string - format: uint64 - description: |- - pool_id defines the pool in which the address - is allowed to vote in. - staker: - type: string - description: staker is the address the valaccount is voting for. - valaddress: - type: string - title: |- - valaddress is the account stored on the protocol - node which votes for the staker in the given pool - points: - type: string - format: uint64 - description: |- - When a node is inactive (does not vote at all) - A point is added, after a certain amount of points - is reached the node gets kicked out. - is_leaving: - type: boolean - description: >- - isLeaving indicates if a staker is leaving the given - pool. - commission: - type: string - description: commission ... - stake_fraction: - type: string - description: stake_fraction ... - description: StakerPoolResponse ... + It contains almost all needed information for a convenient + usage description: stakers ... description: >- QueryStakersByPoolResponse is the response type for the @@ -7775,136 +8763,249 @@ paths: StakersByPool queries for all stakers and sorted them first by number of pools participating and - then by delegation - operationId: StakersByPoolCount - responses: - '200': - description: A successful response. - schema: - type: object - properties: - stakers: - type: array - items: - type: object - properties: - address: - type: string - title: address of the staker - metadata: - description: metadata as logo, moniker, etc. - type: object - properties: - commission: - type: string - title: >- - commission is the percentage of the rewards that - will + then by delegation + operationId: StakersByPoolCount + responses: + '200': + description: A successful response. + schema: + type: object + properties: + stakers: + type: array + items: + type: object + properties: + address: + type: string + title: address of the staker + validator: + type: object + properties: + operator_address: + type: string + description: >- + operator_address defines the address of the + validator's operator; bech encoded in JSON. + consensus_pubkey: + description: >- + consensus_pubkey is the consensus public key of the + validator, as a Protobuf Any. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the + type of the serialized + + protocol buffer message. This string must + contain at least + + one "/" character. The last segment of the URL's + path must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name + should be in a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the + binary all types that they + + expect it to use in the context of Any. However, + for URLs which use the + + scheme `http`, `https`, or no scheme, one can + optionally set up a type + + server that maps type URLs to message + definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup + results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently + available in the official + + protobuf release, and it is not used for type + URLs beginning with + + type.googleapis.com. As of May 2023, there are + no widely used type server + + implementations and no plans to implement one. - get transferred to the staker before the remaining - rewards are split across all delegators - moniker: + Schemes other than `http`, `https` (or the empty + scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + jailed: + type: boolean + description: >- + jailed defined whether the validator has been jailed + from bonded status or not. + status: + description: >- + status is the validator status + (bonded/unbonding/unbonded). type: string - title: |- - moniker is a human-readable name for displaying - the staker in the UI - website: + enum: + - BOND_STATUS_UNSPECIFIED + - BOND_STATUS_UNBONDED + - BOND_STATUS_UNBONDING + - BOND_STATUS_BONDED + default: BOND_STATUS_UNSPECIFIED + tokens: type: string - title: website is a https-link to the website of the staker - identity: + description: >- + tokens define the delegated tokens (incl. + self-delegation). + delegator_shares: type: string - title: identity from keybase.io - security_contact: + description: >- + delegator_shares defines total shares issued to a + validator's delegators. + description: + description: >- + description defines the description terms for the + validator. + type: object + properties: + moniker: + type: string + description: >- + moniker defines a human-readable name for the + validator. + identity: + type: string + description: >- + identity defines an optional identity signature + (ex. UPort or Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: >- + security_contact defines an optional email for + security contact. + details: + type: string + description: details define other optional details. + unbonding_height: type: string - description: security_contact ... - details: + format: int64 + description: >- + unbonding_height defines, if unbonding, the height + at which this validator has begun unbonding. + unbonding_time: type: string - description: details ... - pending_commission_change: + format: date-time description: >- - pending_commission_change shows if the staker plans - - to change its commission. Delegators will see a - warning in - - the UI. A Commission change takes some time until - - the commission is applied. Users have time to - redelegate - - if they not agree with the new commission. + unbonding_time defines, if unbonding, the min time + for the validator to complete unbonding. + commission: + description: commission defines the commission parameters. type: object properties: - commission: - type: string - title: |- - commission is the new commission that will - become active once the change-time is over - creation_date: + commission_rates: + description: >- + commission_rates defines the initial commission + rates to be used for creating a validator. + type: object + properties: + rate: + type: string + description: >- + rate is the commission rate charged to + delegators, as a fraction. + max_rate: + type: string + description: >- + max_rate defines the maximum commission rate + which validator can ever charge, as a + fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum daily + increase of the validator commission, as a + fraction. + update_time: type: string - format: int64 - description: |- - creation_date is the UNIX-timestamp (in seconds) - of when the entry was created. - title: |- - CommissionChangeEntry shows when the old commission - of a staker will change to the new commission - commission_rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. - + format: date-time + description: >- + update_time is the last time the commission rate + was changed. + min_self_delegation: + type: string + description: >- + min_self_delegation is the validator's self declared + minimum self delegation. - NOTE: The amount field is an Int which implements - the custom method - signatures required by gogoproto. + Since: cosmos-sdk 0.46 + unbonding_on_hold_ref_count: + type: string + format: int64 title: >- - commission_rewards are the rewards through - commission and storage cost - title: StakerMetadata contains static information for a staker - self_delegation: - type: string - format: uint64 - title: amount the staker has delegated to himself - self_delegation_unbonding: - type: string - format: uint64 + strictly positive if this validator's unbonding has + been stopped by external modules + unbonding_ids: + type: array + items: + type: string + format: uint64 + title: >- + list of unbonding ids, each uniquely identifing an + unbonding of this validator description: >- - unbonding_amount is the amount the staker is currently - unbonding + Validator defines a validator, together with the total + amount of the + + Validator's bond shares and their exchange rate to + coins. Slashing results in + + a decrease in the exchange rate, allowing correct + calculation of future - from the self-delegation. + undelegations without iterating over delegators. When + coins are delegated to - This amount can be larger than `amount` when the staker + this validator, the validator is credited with a + delegation whose number of - got slashed during unbonding. However, at the end of + bond shares is based on the amount of coins delegated + divided by the current - the unbonding period this amount is double checked with - the + exchange rate. Voting power can be calculated as total + bonded shares - remaining amount. - total_delegation: - type: string - format: uint64 - title: |- - total_delegation returns the sum of all $KYVE users - have delegated to this staker - delegator_count: + multiplied by exchange rate. + total_pool_stake: type: string format: uint64 - description: |- - delegator_count is the total number of individual - delegator addresses for that user. + title: >- + total_pool_stake returns the amount the validator has in + total + + staked in all his pools pools: type: array items: @@ -7961,10 +9062,10 @@ paths: title: |- total_funds of the pool. If the pool runs out of funds no more bundles will be produced - total_delegation: + total_stake: type: string format: uint64 - title: total_delegation of the pool + title: total_stake of the pool status: description: |- status of the pool if pool is able @@ -8014,6 +9115,105 @@ paths: funds to pay for gas fees + commission: + type: string + title: >- + commission is the commission the validator has + chosen for + + this specific pool + pending_commission_change: + description: >- + pending_commission_change shows if the staker + plans + + to change its commission. Delegators will see a + warning in + + the UI. A Commission change takes some time until + + the commission is applied. Users have time to + redelegate + + if they not agree with the new commission. + type: object + properties: + commission: + type: string + title: |- + commission is the new commission that will + become active once the change-time is over + creation_date: + type: string + format: int64 + description: >- + creation_date is the UNIX-timestamp (in + seconds) + + of when the entry was created. + title: >- + CommissionChangeEntry shows when the old + commission + + of a staker will change to the new commission + stake_fraction: + type: string + title: >- + stake fraction is a percentage the validator has + chosen for + + this pool. It is the fraction of how much of his + total stake + + the validator wants to stake in this specific pool + pending_stake_fraction_change: + description: >- + pending_stake_fraction_change shows if the staker + plans + + to change its stake fraction. Delegators will see + a warning in + + the UI. A stake fraction change takes some time + until + + the stake fraction is applied. Users have time to + redelegate + + if they not agree with the new stake fraction. + type: object + properties: + stake_fraction: + type: string + title: >- + stake_fraction is the new stake_fraction that + will + + become active once the change-time is over + creation_date: + type: string + format: int64 + description: >- + creation_date is the UNIX-timestamp (in + seconds) + + of when the entry was created. + title: >- + StakeFractionChangeEntry shows when the old stake + fraction + + of a staker will change to the new stake fraction + pool_stake: + type: string + format: uint64 + title: >- + pool stake shows the actual amount the validator + has staked + + in this pool. It can be lower than the specified + stake fraction + + because of the max voting power limit title: |- PoolMembership shows in which pool the staker is participating diff --git a/proto/kyve/query/v1beta1/query.proto b/proto/kyve/query/v1beta1/query.proto index 18a0dd2b..dc35d847 100644 --- a/proto/kyve/query/v1beta1/query.proto +++ b/proto/kyve/query/v1beta1/query.proto @@ -4,6 +4,7 @@ package kyve.query.v1beta1; import "amino/amino.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/staking/v1beta1/staking.proto"; import "gogoproto/gogo.proto"; import "kyve/pool/v1beta1/pool.proto"; @@ -57,8 +58,8 @@ message BasicPool { (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; - // total_delegation of the pool - uint64 total_delegation = 8; + // total_stake of the pool + uint64 total_stake = 8; // status of the pool if pool is able // to produce bundles, etc. @@ -72,80 +73,38 @@ message FullStaker { // address of the staker string address = 1; - // metadata as logo, moniker, etc. - StakerMetadata metadata = 2; + cosmos.staking.v1beta1.Validator validator = 2; - // amount the staker has delegated to himself - uint64 self_delegation = 3; - - // unbonding_amount is the amount the staker is currently unbonding - // from the self-delegation. - // This amount can be larger than `amount` when the staker - // got slashed during unbonding. However, at the end of - // the unbonding period this amount is double checked with the - // remaining amount. - uint64 self_delegation_unbonding = 4; - - // total_delegation returns the sum of all $KYVE users - // have delegated to this staker - uint64 total_delegation = 5; - - // delegator_count is the total number of individual - // delegator addresses for that user. - uint64 delegator_count = 6; + // total_pool_stake returns the amount the validator has in total + // staked in all his pools + uint64 total_pool_stake = 3; // pools is a list of all pools the staker is currently // participating, i.e. allowed to vote and upload data. - repeated PoolMembership pools = 7; + repeated PoolMembership pools = 4; } -// StakerMetadata contains static information for a staker -message StakerMetadata { - // commission is the percentage of the rewards that will - // get transferred to the staker before the remaining - // rewards are split across all delegators +// CommissionChangeEntry shows when the old commission +// of a staker will change to the new commission +message CommissionChangeEntry { + // commission is the new commission that will + // become active once the change-time is over string commission = 1 [ (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; - // moniker is a human-readable name for displaying - // the staker in the UI - string moniker = 2; - - // website is a https-link to the website of the staker - string website = 3; - - // identity from keybase.io - string identity = 4; - - // security_contact ... - string security_contact = 5; - - // details ... - string details = 6; - - // pending_commission_change shows if the staker plans - // to change its commission. Delegators will see a warning in - // the UI. A Commission change takes some time until - // the commission is applied. Users have time to redelegate - // if they not agree with the new commission. - CommissionChangeEntry pending_commission_change = 7; - - // commission_rewards are the rewards through commission and storage cost - repeated cosmos.base.v1beta1.Coin commission_rewards = 8 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; + // creation_date is the UNIX-timestamp (in seconds) + // of when the entry was created. + int64 creation_date = 2; } -// CommissionChangeEntry shows when the old commission -// of a staker will change to the new commission -message CommissionChangeEntry { - // commission is the new commission that will +// StakeFractionChangeEntry shows when the old stake fraction +// of a staker will change to the new stake fraction +message StakeFractionChangeEntry { + // stake_fraction is the new stake_fraction that will // become active once the change-time is over - string commission = 1 [ + string stake_fraction = 1 [ (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; @@ -181,4 +140,38 @@ message PoolMembership { // whether or not the valaccount needs additional funds to // pay for gas fees uint64 balance = 5; + + // commission is the commission the validator has chosen for + // this specific pool + string commission = 6 [ + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + // pending_commission_change shows if the staker plans + // to change its commission. Delegators will see a warning in + // the UI. A Commission change takes some time until + // the commission is applied. Users have time to redelegate + // if they not agree with the new commission. + CommissionChangeEntry pending_commission_change = 7; + + // stake fraction is a percentage the validator has chosen for + // this pool. It is the fraction of how much of his total stake + // the validator wants to stake in this specific pool + string stake_fraction = 8 [ + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + // pending_stake_fraction_change shows if the staker plans + // to change its stake fraction. Delegators will see a warning in + // the UI. A stake fraction change takes some time until + // the stake fraction is applied. Users have time to redelegate + // if they not agree with the new stake fraction. + StakeFractionChangeEntry pending_stake_fraction_change = 9; + + // pool stake shows the actual amount the validator has staked + // in this pool. It can be lower than the specified stake fraction + // because of the max voting power limit + uint64 pool_stake = 10; } diff --git a/proto/kyve/query/v1beta1/stakers.proto b/proto/kyve/query/v1beta1/stakers.proto index 7bcfd3d5..876752c9 100644 --- a/proto/kyve/query/v1beta1/stakers.proto +++ b/proto/kyve/query/v1beta1/stakers.proto @@ -6,7 +6,6 @@ import "cosmos/base/query/v1beta1/pagination.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "kyve/query/v1beta1/query.proto"; -import "kyve/stakers/v1beta1/stakers.proto"; option go_package = "github.com/KYVENetwork/chain/x/query/types"; @@ -56,10 +55,14 @@ enum StakerStatus { // STAKER_STATUS_UNSPECIFIED ... STAKER_STATUS_UNSPECIFIED = 0; - // STAKER_STATUS_ACTIVE ... - STAKER_STATUS_ACTIVE = 1; - // STAKER_STATUS_INACTIVE ... - STAKER_STATUS_INACTIVE = 2; + // STAKER_STATUS_PROTOCOL_ACTIVE ... + STAKER_STATUS_PROTOCOL_ACTIVE = 1; + // STAKER_STATUS_PROTOCOL_INACTIVE ... + STAKER_STATUS_PROTOCOL_INACTIVE = 2; + // STAKER_STATUS_CHAIN_ACTIVE ... + STAKER_STATUS_CHAIN_ACTIVE = 3; + // STAKER_STATUS_CHAIN_INACTIVE ... + STAKER_STATUS_CHAIN_INACTIVE = 4; } // QueryStakersResponse is the response type for the Query/Stakers RPC method. @@ -99,19 +102,11 @@ message QueryStakersByPoolRequest { // QueryStakersByPoolResponse is the response type for the Query/Staker RPC method. message QueryStakersByPoolResponse { // stakers ... - repeated StakerPoolResponse stakers = 1 [(gogoproto.nullable) = false]; -} - -// StakerPoolResponse ... -message StakerPoolResponse { - // staker ... - FullStaker staker = 1; - // valaccount ... - kyve.stakers.v1beta1.Valaccount valaccount = 2; + repeated FullStaker stakers = 1 [(gogoproto.nullable) = false]; } // ========================= -// stakers_by_pool/{pool_id} +// stakers_by_pool_count // ========================= // QueryStakersByPoolCountRequest ... diff --git a/testutil/integration/checks.go b/testutil/integration/checks.go index b76c5fdf..a2ac0a4b 100644 --- a/testutil/integration/checks.go +++ b/testutil/integration/checks.go @@ -2,6 +2,7 @@ package integration import ( "fmt" + "sort" "time" "github.com/KYVENetwork/chain/util" @@ -123,19 +124,18 @@ func (suite *KeeperTestSuite) VerifyPoolQueries() { // test stakers by pool valaccounts := suite.App().StakersKeeper.GetAllValaccountsOfPool(suite.Ctx(), poolsState[i].Id) - stakersByPoolState := make([]querytypes.StakerPoolResponse, 0) + stakersByPoolState := make([]querytypes.FullStaker, 0) for _, valaccount := range valaccounts { - _, stakerFound := suite.App().StakersKeeper.GetValidator(suite.Ctx(), valaccount.Staker) - - if stakerFound { - stakersByPoolState = append(stakersByPoolState, querytypes.StakerPoolResponse{ - Staker: suite.App().QueryKeeper.GetFullStaker(suite.Ctx(), valaccount.Staker), - Valaccount: valaccount, - }) + if _, stakerFound := suite.App().StakersKeeper.GetValidator(suite.Ctx(), valaccount.Staker); stakerFound { + stakersByPoolState = append(stakersByPoolState, *suite.App().QueryKeeper.GetFullStaker(suite.Ctx(), valaccount.Staker)) } } + sort.SliceStable(stakersByPoolState, func(a, b int) bool { + return suite.App().StakersKeeper.GetValidatorPoolStake(suite.Ctx(), stakersByPoolState[a].Address, poolsState[i].Id) > suite.App().StakersKeeper.GetValidatorPoolStake(suite.Ctx(), stakersByPoolState[b].Address, poolsState[i].Id) + }) + stakersByPoolQuery, stakersByPoolQueryErr := suite.App().QueryKeeper.StakersByPool(suite.Ctx(), &querytypes.QueryStakersByPoolRequest{ PoolId: poolsState[i].Id, }) diff --git a/testutil/integration/helpers.go b/testutil/integration/helpers.go index 40db2fdb..afe0ab59 100644 --- a/testutil/integration/helpers.go +++ b/testutil/integration/helpers.go @@ -86,3 +86,9 @@ func (suite *KeeperTestSuite) GetNextUploader() (nextStaker string, nextValaddre return } + +func (suite *KeeperTestSuite) SetMaxVotingPower(maxVotingPower string) { + params := suite.App().PoolKeeper.GetParams(suite.Ctx()) + params.MaxVotingPowerPerPool = math.LegacyMustNewDecFromStr(maxVotingPower) + suite.App().PoolKeeper.SetParams(suite.Ctx(), params) +} diff --git a/x/bundles/keeper/keeper_suite_invalid_bundles_test.go b/x/bundles/keeper/keeper_suite_invalid_bundles_test.go index d6b270d0..64827c21 100644 --- a/x/bundles/keeper/keeper_suite_invalid_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_invalid_bundles_test.go @@ -64,9 +64,7 @@ var _ = Describe("invalid bundles", Ordered, func() { } s.RunTxPoolSuccess(msg) - params := s.App().PoolKeeper.GetParams(s.Ctx()) - params.MaxVotingPowerPerPool = math.LegacyMustNewDecFromStr("1") - s.App().PoolKeeper.SetParams(s.Ctx(), params) + s.SetMaxVotingPower("1") s.RunTxFundersSuccess(&funderstypes.MsgCreateFunder{ Creator: i.ALICE, diff --git a/x/bundles/keeper/keeper_suite_valid_bundles_test.go b/x/bundles/keeper/keeper_suite_valid_bundles_test.go index addc5630..69804fec 100644 --- a/x/bundles/keeper/keeper_suite_valid_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_valid_bundles_test.go @@ -966,9 +966,7 @@ var _ = Describe("valid bundles", Ordered, func() { It("Produce a valid bundle with multiple validators and foreign delegation although some voted invalid with maximum voting power", func() { // ARRANGE - params := s.App().PoolKeeper.GetParams(s.Ctx()) - params.MaxVotingPowerPerPool = math.LegacyMustNewDecFromStr("0.4") - s.App().PoolKeeper.SetParams(s.Ctx(), params) + s.SetMaxVotingPower("0.4") s.CreateValidator(i.STAKER_2, "Staker-2", int64(100*i.KYVE)) diff --git a/x/bundles/keeper/logic_bundles_test.go b/x/bundles/keeper/logic_bundles_test.go index 9d3a0885..e527a3ba 100644 --- a/x/bundles/keeper/logic_bundles_test.go +++ b/x/bundles/keeper/logic_bundles_test.go @@ -307,9 +307,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert pool can run while voting power of one node exceeds 40%", func() { // ARRANGE - params := s.App().PoolKeeper.GetParams(s.Ctx()) - params.MaxVotingPowerPerPool = math.LegacyMustNewDecFromStr("0.4") - s.App().PoolKeeper.SetParams(s.Ctx(), params) + s.SetMaxVotingPower("0.4") msg := &pooltypes.MsgCreatePool{ Authority: gov, @@ -371,9 +369,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { It("Assert pool can run with a single staker while voting power is 100%", func() { // ARRANGE - params := s.App().PoolKeeper.GetParams(s.Ctx()) - params.MaxVotingPowerPerPool = math.LegacyMustNewDecFromStr("1") - s.App().PoolKeeper.SetParams(s.Ctx(), params) + s.SetMaxVotingPower("1") msg := &pooltypes.MsgCreatePool{ Authority: gov, diff --git a/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go b/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go index bdb04f90..847aa16d 100644 --- a/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go +++ b/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go @@ -289,9 +289,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { PoolId: 0, }) - params := s.App().PoolKeeper.GetParams(s.Ctx()) - params.MaxVotingPowerPerPool = math.LegacyMustNewDecFromStr("0.2") - s.App().PoolKeeper.SetParams(s.Ctx(), params) + s.SetMaxVotingPower("0.2") // ACT s.CommitAfterSeconds(1) diff --git a/x/bundles/keeper/logic_round_robin_test.go b/x/bundles/keeper/logic_round_robin_test.go index bd5229c8..2cb3c442 100644 --- a/x/bundles/keeper/logic_round_robin_test.go +++ b/x/bundles/keeper/logic_round_robin_test.go @@ -101,9 +101,7 @@ var _ = Describe("logic_round_robin.go", Ordered, func() { } s.App().PoolKeeper.SetPool(s.Ctx(), pool) - params := s.App().PoolKeeper.GetParams(s.Ctx()) - params.MaxVotingPowerPerPool = math.LegacyMustNewDecFromStr("1") - s.App().PoolKeeper.SetParams(s.Ctx(), params) + s.SetMaxVotingPower("1") }) AfterEach(func() { @@ -269,9 +267,7 @@ var _ = Describe("logic_round_robin.go", Ordered, func() { It("Frequency analysis with maximum voting power cap", func() { // ARRANGE - params := s.App().PoolKeeper.GetParams(s.Ctx()) - params.MaxVotingPowerPerPool = math.LegacyMustNewDecFromStr("0.5") - s.App().PoolKeeper.SetParams(s.Ctx(), params) + s.SetMaxVotingPower("0.5") // NOTE that dummy with index 2 has more than 50% voting power, so his effective stake // will be lower diff --git a/x/query/keeper/grpc_account_funded.go b/x/query/keeper/grpc_account_funded.go index 6c562cf5..d2ad75e9 100644 --- a/x/query/keeper/grpc_account_funded.go +++ b/x/query/keeper/grpc_account_funded.go @@ -35,7 +35,7 @@ func (k Keeper) AccountFundedList(goCtx context.Context, req *types.QueryAccount InflationShareWeight: pool.InflationShareWeight, UploadInterval: pool.UploadInterval, TotalFunds: k.fundersKeeper.GetTotalActiveFunding(ctx, pool.Id), - TotalDelegation: k.delegationKeeper.GetDelegationOfPool(ctx, pool.Id), + TotalStake: k.stakerKeeper.GetTotalStakeOfPool(ctx, pool.Id), Status: k.GetPoolStatus(ctx, &pool), }, }) diff --git a/x/query/keeper/grpc_query_staker.go b/x/query/keeper/grpc_query_staker.go index 7dd1fe11..a72689ca 100644 --- a/x/query/keeper/grpc_query_staker.go +++ b/x/query/keeper/grpc_query_staker.go @@ -26,7 +26,7 @@ func (k Keeper) Stakers(c context.Context, req *types.QueryStakersRequest) (*typ fullStaker := k.GetFullStaker(ctx, address) searchAddress := strings.ToLower(fullStaker.Address) - searchMoniker := strings.ToLower(fullStaker.Metadata.Moniker) + searchMoniker := strings.ToLower(fullStaker.Validator.GetMoniker()) if strings.Contains(searchAddress, req.Search) || strings.Contains(searchMoniker, req.Search) { if accumulate { @@ -41,7 +41,7 @@ func (k Keeper) Stakers(c context.Context, req *types.QueryStakersRequest) (*typ var pageRes *query.PageResponse var err error - pageRes, err = k.stakerKeeper.GetPaginatedStakersByDelegation(ctx, req.Pagination, accumulator) + pageRes, err = k.stakerKeeper.GetPaginatedStakersByPoolStake(ctx, req.Pagination, req.Status, accumulator) if err != nil { return nil, err diff --git a/x/query/keeper/grpc_query_stakers_by_pool.go b/x/query/keeper/grpc_query_stakers_by_pool.go index 7d5d7199..d62aa750 100644 --- a/x/query/keeper/grpc_query_stakers_by_pool.go +++ b/x/query/keeper/grpc_query_stakers_by_pool.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "sort" "github.com/KYVENetwork/chain/x/query/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -15,24 +16,24 @@ func (k Keeper) StakersByPool(c context.Context, req *types.QueryStakersByPoolRe return nil, status.Error(codes.InvalidArgument, "invalid request") } - data := make([]types.StakerPoolResponse, 0) - ctx := sdk.UnwrapSDKContext(c) - _, found := k.poolKeeper.GetPool(ctx, req.PoolId) - if !found { + if _, found := k.poolKeeper.GetPool(ctx, req.PoolId); !found { return nil, sdkerrors.ErrKeyNotFound } + stakers := make([]types.FullStaker, 0) + valaccounts := k.stakerKeeper.GetAllValaccountsOfPool(ctx, req.PoolId) for _, valaccount := range valaccounts { - if _, exist := k.stakerKeeper.GetValidator(ctx, valaccount.Staker); exist { - data = append(data, types.StakerPoolResponse{ - Staker: k.GetFullStaker(ctx, valaccount.Staker), - Valaccount: valaccount, - }) - } + stakers = append(stakers, *k.GetFullStaker(ctx, valaccount.Staker)) } - return &types.QueryStakersByPoolResponse{Stakers: data}, nil + stakes := k.stakerKeeper.GetValidatorPoolStakes(ctx, req.PoolId) + + sort.SliceStable(stakers, func(i, j int) bool { + return stakes[stakers[i].Address] > stakes[stakers[j].Address] + }) + + return &types.QueryStakersByPoolResponse{Stakers: stakers}, nil } diff --git a/x/query/keeper/grpc_query_stakers_by_pool_count.go b/x/query/keeper/grpc_query_stakers_by_pool_count.go index 3fc2de68..868fbe1a 100644 --- a/x/query/keeper/grpc_query_stakers_by_pool_count.go +++ b/x/query/keeper/grpc_query_stakers_by_pool_count.go @@ -4,6 +4,8 @@ import ( "context" "github.com/KYVENetwork/chain/x/query/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -13,7 +15,25 @@ func (k Keeper) StakersByPoolCount(c context.Context, req *types.QueryStakersByP return nil, status.Error(codes.InvalidArgument, "invalid request") } - // ToDo no - op + ctx := sdk.UnwrapSDKContext(c) - return &types.QueryStakersByPoolCountResponse{}, nil + data := make([]types.FullStaker, 0) + + accumulator := func(address string, accumulate bool) bool { + if accumulate { + data = append(data, *k.GetFullStaker(ctx, address)) + } + return true + } + + var pageRes *query.PageResponse + var err error + + pageRes, err = k.stakerKeeper.GetPaginatedStakersByPoolCount(ctx, req.Pagination, accumulator) + + if err != nil { + return nil, err + } + + return &types.QueryStakersByPoolCountResponse{Stakers: data, Pagination: pageRes}, nil } diff --git a/x/query/keeper/helper.go b/x/query/keeper/helper.go index 364183c5..0105ff2f 100644 --- a/x/query/keeper/helper.go +++ b/x/query/keeper/helper.go @@ -8,28 +8,38 @@ import ( ) func (k Keeper) GetFullStaker(ctx sdk.Context, stakerAddress string) *types.FullStaker { - staker, _ := k.stakerKeeper.GetValidator(ctx, stakerAddress) - - stakerMetadata := types.StakerMetadata{ - Commission: staker.Commission.Rate, - Moniker: staker.GetMoniker(), - Website: staker.Description.Website, - Identity: staker.Description.Identity, - SecurityContact: staker.Description.SecurityContact, - Details: staker.Description.GetDetails(), - PendingCommissionChange: nil, - CommissionRewards: sdk.NewCoins(), - } + validator, _ := k.stakerKeeper.GetValidator(ctx, stakerAddress) var poolMemberships []*types.PoolMembership + totalPoolStake := uint64(0) for _, valaccount := range k.stakerKeeper.GetValaccountsFromStaker(ctx, stakerAddress) { - pool, _ := k.poolKeeper.GetPool(ctx, valaccount.PoolId) accountValaddress, _ := sdk.AccAddressFromBech32(valaccount.Valaddress) balanceValaccount := k.bankKeeper.GetBalance(ctx, accountValaddress, globalTypes.Denom).Amount.Uint64() + commissionChange, found := k.stakerKeeper.GetCommissionChangeEntryByIndex2(ctx, stakerAddress, valaccount.PoolId) + var commissionChangeEntry *types.CommissionChangeEntry = nil + if found { + commissionChangeEntry = &types.CommissionChangeEntry{ + Commission: commissionChange.Commission, + CreationDate: commissionChange.CreationDate, + } + } + + stakeFractionChange, found := k.stakerKeeper.GetStakeFractionChangeEntryByIndex2(ctx, stakerAddress, valaccount.PoolId) + var stakeFractionChangeEntry *types.StakeFractionChangeEntry = nil + if found { + stakeFractionChangeEntry = &types.StakeFractionChangeEntry{ + StakeFraction: stakeFractionChange.StakeFraction, + CreationDate: stakeFractionChange.CreationDate, + } + } + + poolStake := k.stakerKeeper.GetValidatorPoolStake(ctx, stakerAddress, pool.Id) + totalPoolStake += poolStake + poolMemberships = append( poolMemberships, &types.PoolMembership{ Pool: &types.BasicPool{ @@ -40,29 +50,27 @@ func (k Keeper) GetFullStaker(ctx sdk.Context, stakerAddress string) *types.Full InflationShareWeight: pool.InflationShareWeight, UploadInterval: pool.UploadInterval, TotalFunds: k.fundersKeeper.GetTotalActiveFunding(ctx, pool.Id), - TotalDelegation: k.stakerKeeper.GetTotalStakeOfPool(ctx, pool.Id), + TotalStake: k.stakerKeeper.GetTotalStakeOfPool(ctx, pool.Id), Status: k.GetPoolStatus(ctx, &pool), }, - Points: valaccount.Points, - IsLeaving: valaccount.IsLeaving, - Valaddress: valaccount.Valaddress, - Balance: balanceValaccount, + Points: valaccount.Points, + IsLeaving: valaccount.IsLeaving, + Valaddress: valaccount.Valaddress, + Balance: balanceValaccount, + Commission: valaccount.Commission, + PendingCommissionChange: commissionChangeEntry, + StakeFraction: valaccount.StakeFraction, + PendingStakeFractionChange: stakeFractionChangeEntry, + PoolStake: poolStake, }, ) } - // Iterate all UnbondingDelegation entries to get total delegation unbonding amount - selfDelegationUnbonding := uint64(0) - // TODO rework query spec - return &types.FullStaker{ - Address: stakerAddress, - Metadata: &stakerMetadata, - SelfDelegation: uint64(0), // TODO rework query spec - SelfDelegationUnbonding: selfDelegationUnbonding, - TotalDelegation: staker.Tokens.Uint64(), - DelegatorCount: 0, // TODO rework query spec - Pools: poolMemberships, + Address: stakerAddress, + Validator: &validator, + TotalPoolStake: totalPoolStake, + Pools: poolMemberships, } } diff --git a/x/query/types/query.pb.go b/x/query/types/query.pb.go index d1e5a6c1..40a905af 100644 --- a/x/query/types/query.pb.go +++ b/x/query/types/query.pb.go @@ -10,6 +10,7 @@ import ( github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + types2 "github.com/cosmos/cosmos-sdk/x/staking/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -47,8 +48,8 @@ type BasicPool struct { // total_funds of the pool. If the pool runs // out of funds no more bundles will be produced TotalFunds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,7,rep,name=total_funds,json=totalFunds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"total_funds"` - // total_delegation of the pool - TotalDelegation uint64 `protobuf:"varint,8,opt,name=total_delegation,json=totalDelegation,proto3" json:"total_delegation,omitempty"` + // total_stake of the pool + TotalStake uint64 `protobuf:"varint,8,opt,name=total_stake,json=totalStake,proto3" json:"total_stake,omitempty"` // status of the pool if pool is able // to produce bundles, etc. Status types1.PoolStatus `protobuf:"varint,9,opt,name=status,proto3,enum=kyve.pool.v1beta1.PoolStatus" json:"status,omitempty"` @@ -129,9 +130,9 @@ func (m *BasicPool) GetTotalFunds() github_com_cosmos_cosmos_sdk_types.Coins { return nil } -func (m *BasicPool) GetTotalDelegation() uint64 { +func (m *BasicPool) GetTotalStake() uint64 { if m != nil { - return m.TotalDelegation + return m.TotalStake } return 0 } @@ -148,27 +149,14 @@ func (m *BasicPool) GetStatus() types1.PoolStatus { // It contains almost all needed information for a convenient usage type FullStaker struct { // address of the staker - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // metadata as logo, moniker, etc. - Metadata *StakerMetadata `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"` - // amount the staker has delegated to himself - SelfDelegation uint64 `protobuf:"varint,3,opt,name=self_delegation,json=selfDelegation,proto3" json:"self_delegation,omitempty"` - // unbonding_amount is the amount the staker is currently unbonding - // from the self-delegation. - // This amount can be larger than `amount` when the staker - // got slashed during unbonding. However, at the end of - // the unbonding period this amount is double checked with the - // remaining amount. - SelfDelegationUnbonding uint64 `protobuf:"varint,4,opt,name=self_delegation_unbonding,json=selfDelegationUnbonding,proto3" json:"self_delegation_unbonding,omitempty"` - // total_delegation returns the sum of all $KYVE users - // have delegated to this staker - TotalDelegation uint64 `protobuf:"varint,5,opt,name=total_delegation,json=totalDelegation,proto3" json:"total_delegation,omitempty"` - // delegator_count is the total number of individual - // delegator addresses for that user. - DelegatorCount uint64 `protobuf:"varint,6,opt,name=delegator_count,json=delegatorCount,proto3" json:"delegator_count,omitempty"` + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Validator *types2.Validator `protobuf:"bytes,2,opt,name=validator,proto3" json:"validator,omitempty"` + // total_pool_stake returns the amount the validator has in total + // staked in all his pools + TotalPoolStake uint64 `protobuf:"varint,3,opt,name=total_pool_stake,json=totalPoolStake,proto3" json:"total_pool_stake,omitempty"` // pools is a list of all pools the staker is currently // participating, i.e. allowed to vote and upload data. - Pools []*PoolMembership `protobuf:"bytes,7,rep,name=pools,proto3" json:"pools,omitempty"` + Pools []*PoolMembership `protobuf:"bytes,4,rep,name=pools,proto3" json:"pools,omitempty"` } func (m *FullStaker) Reset() { *m = FullStaker{} } @@ -211,37 +199,16 @@ func (m *FullStaker) GetAddress() string { return "" } -func (m *FullStaker) GetMetadata() *StakerMetadata { +func (m *FullStaker) GetValidator() *types2.Validator { if m != nil { - return m.Metadata + return m.Validator } return nil } -func (m *FullStaker) GetSelfDelegation() uint64 { +func (m *FullStaker) GetTotalPoolStake() uint64 { if m != nil { - return m.SelfDelegation - } - return 0 -} - -func (m *FullStaker) GetSelfDelegationUnbonding() uint64 { - if m != nil { - return m.SelfDelegationUnbonding - } - return 0 -} - -func (m *FullStaker) GetTotalDelegation() uint64 { - if m != nil { - return m.TotalDelegation - } - return 0 -} - -func (m *FullStaker) GetDelegatorCount() uint64 { - if m != nil { - return m.DelegatorCount + return m.TotalPoolStake } return 0 } @@ -253,45 +220,29 @@ func (m *FullStaker) GetPools() []*PoolMembership { return nil } -// StakerMetadata contains static information for a staker -type StakerMetadata struct { - // commission is the percentage of the rewards that will - // get transferred to the staker before the remaining - // rewards are split across all delegators +// CommissionChangeEntry shows when the old commission +// of a staker will change to the new commission +type CommissionChangeEntry struct { + // commission is the new commission that will + // become active once the change-time is over Commission cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=commission,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"commission"` - // moniker is a human-readable name for displaying - // the staker in the UI - Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` - // website is a https-link to the website of the staker - Website string `protobuf:"bytes,3,opt,name=website,proto3" json:"website,omitempty"` - // identity from keybase.io - Identity string `protobuf:"bytes,4,opt,name=identity,proto3" json:"identity,omitempty"` - // security_contact ... - SecurityContact string `protobuf:"bytes,5,opt,name=security_contact,json=securityContact,proto3" json:"security_contact,omitempty"` - // details ... - Details string `protobuf:"bytes,6,opt,name=details,proto3" json:"details,omitempty"` - // pending_commission_change shows if the staker plans - // to change its commission. Delegators will see a warning in - // the UI. A Commission change takes some time until - // the commission is applied. Users have time to redelegate - // if they not agree with the new commission. - PendingCommissionChange *CommissionChangeEntry `protobuf:"bytes,7,opt,name=pending_commission_change,json=pendingCommissionChange,proto3" json:"pending_commission_change,omitempty"` - // commission_rewards are the rewards through commission and storage cost - CommissionRewards github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,8,rep,name=commission_rewards,json=commissionRewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"commission_rewards"` + // creation_date is the UNIX-timestamp (in seconds) + // of when the entry was created. + CreationDate int64 `protobuf:"varint,2,opt,name=creation_date,json=creationDate,proto3" json:"creation_date,omitempty"` } -func (m *StakerMetadata) Reset() { *m = StakerMetadata{} } -func (m *StakerMetadata) String() string { return proto.CompactTextString(m) } -func (*StakerMetadata) ProtoMessage() {} -func (*StakerMetadata) Descriptor() ([]byte, []int) { +func (m *CommissionChangeEntry) Reset() { *m = CommissionChangeEntry{} } +func (m *CommissionChangeEntry) String() string { return proto.CompactTextString(m) } +func (*CommissionChangeEntry) ProtoMessage() {} +func (*CommissionChangeEntry) Descriptor() ([]byte, []int) { return fileDescriptor_6b41255feae93a15, []int{2} } -func (m *StakerMetadata) XXX_Unmarshal(b []byte) error { +func (m *CommissionChangeEntry) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *StakerMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *CommissionChangeEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_StakerMetadata.Marshal(b, m, deterministic) + return xxx_messageInfo_CommissionChangeEntry.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -301,90 +252,48 @@ func (m *StakerMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } -func (m *StakerMetadata) XXX_Merge(src proto.Message) { - xxx_messageInfo_StakerMetadata.Merge(m, src) +func (m *CommissionChangeEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommissionChangeEntry.Merge(m, src) } -func (m *StakerMetadata) XXX_Size() int { +func (m *CommissionChangeEntry) XXX_Size() int { return m.Size() } -func (m *StakerMetadata) XXX_DiscardUnknown() { - xxx_messageInfo_StakerMetadata.DiscardUnknown(m) -} - -var xxx_messageInfo_StakerMetadata proto.InternalMessageInfo - -func (m *StakerMetadata) GetMoniker() string { - if m != nil { - return m.Moniker - } - return "" -} - -func (m *StakerMetadata) GetWebsite() string { - if m != nil { - return m.Website - } - return "" -} - -func (m *StakerMetadata) GetIdentity() string { - if m != nil { - return m.Identity - } - return "" -} - -func (m *StakerMetadata) GetSecurityContact() string { - if m != nil { - return m.SecurityContact - } - return "" -} - -func (m *StakerMetadata) GetDetails() string { - if m != nil { - return m.Details - } - return "" +func (m *CommissionChangeEntry) XXX_DiscardUnknown() { + xxx_messageInfo_CommissionChangeEntry.DiscardUnknown(m) } -func (m *StakerMetadata) GetPendingCommissionChange() *CommissionChangeEntry { - if m != nil { - return m.PendingCommissionChange - } - return nil -} +var xxx_messageInfo_CommissionChangeEntry proto.InternalMessageInfo -func (m *StakerMetadata) GetCommissionRewards() github_com_cosmos_cosmos_sdk_types.Coins { +func (m *CommissionChangeEntry) GetCreationDate() int64 { if m != nil { - return m.CommissionRewards + return m.CreationDate } - return nil + return 0 } -// CommissionChangeEntry shows when the old commission -// of a staker will change to the new commission -type CommissionChangeEntry struct { - // commission is the new commission that will +// StakeFractionChangeEntry shows when the old stake fraction +// of a staker will change to the new stake fraction +type StakeFractionChangeEntry struct { + // stake_fraction is the new stake_fraction that will // become active once the change-time is over - Commission cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=commission,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"commission"` + StakeFraction cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=stake_fraction,json=stakeFraction,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"stake_fraction"` // creation_date is the UNIX-timestamp (in seconds) // of when the entry was created. CreationDate int64 `protobuf:"varint,2,opt,name=creation_date,json=creationDate,proto3" json:"creation_date,omitempty"` } -func (m *CommissionChangeEntry) Reset() { *m = CommissionChangeEntry{} } -func (m *CommissionChangeEntry) String() string { return proto.CompactTextString(m) } -func (*CommissionChangeEntry) ProtoMessage() {} -func (*CommissionChangeEntry) Descriptor() ([]byte, []int) { +func (m *StakeFractionChangeEntry) Reset() { *m = StakeFractionChangeEntry{} } +func (m *StakeFractionChangeEntry) String() string { return proto.CompactTextString(m) } +func (*StakeFractionChangeEntry) ProtoMessage() {} +func (*StakeFractionChangeEntry) Descriptor() ([]byte, []int) { return fileDescriptor_6b41255feae93a15, []int{3} } -func (m *CommissionChangeEntry) XXX_Unmarshal(b []byte) error { +func (m *StakeFractionChangeEntry) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *CommissionChangeEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *StakeFractionChangeEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_CommissionChangeEntry.Marshal(b, m, deterministic) + return xxx_messageInfo_StakeFractionChangeEntry.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -394,19 +303,19 @@ func (m *CommissionChangeEntry) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *CommissionChangeEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_CommissionChangeEntry.Merge(m, src) +func (m *StakeFractionChangeEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_StakeFractionChangeEntry.Merge(m, src) } -func (m *CommissionChangeEntry) XXX_Size() int { +func (m *StakeFractionChangeEntry) XXX_Size() int { return m.Size() } -func (m *CommissionChangeEntry) XXX_DiscardUnknown() { - xxx_messageInfo_CommissionChangeEntry.DiscardUnknown(m) +func (m *StakeFractionChangeEntry) XXX_DiscardUnknown() { + xxx_messageInfo_StakeFractionChangeEntry.DiscardUnknown(m) } -var xxx_messageInfo_CommissionChangeEntry proto.InternalMessageInfo +var xxx_messageInfo_StakeFractionChangeEntry proto.InternalMessageInfo -func (m *CommissionChangeEntry) GetCreationDate() int64 { +func (m *StakeFractionChangeEntry) GetCreationDate() int64 { if m != nil { return m.CreationDate } @@ -435,6 +344,29 @@ type PoolMembership struct { // whether or not the valaccount needs additional funds to // pay for gas fees Balance uint64 `protobuf:"varint,5,opt,name=balance,proto3" json:"balance,omitempty"` + // commission is the commission the validator has chosen for + // this specific pool + Commission cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=commission,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"commission"` + // pending_commission_change shows if the staker plans + // to change its commission. Delegators will see a warning in + // the UI. A Commission change takes some time until + // the commission is applied. Users have time to redelegate + // if they not agree with the new commission. + PendingCommissionChange *CommissionChangeEntry `protobuf:"bytes,7,opt,name=pending_commission_change,json=pendingCommissionChange,proto3" json:"pending_commission_change,omitempty"` + // stake fraction is a percentage the validator has chosen for + // this pool. It is the fraction of how much of his total stake + // the validator wants to stake in this specific pool + StakeFraction cosmossdk_io_math.LegacyDec `protobuf:"bytes,8,opt,name=stake_fraction,json=stakeFraction,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"stake_fraction"` + // pending_stake_fraction_change shows if the staker plans + // to change its stake fraction. Delegators will see a warning in + // the UI. A stake fraction change takes some time until + // the stake fraction is applied. Users have time to redelegate + // if they not agree with the new stake fraction. + PendingStakeFractionChange *StakeFractionChangeEntry `protobuf:"bytes,9,opt,name=pending_stake_fraction_change,json=pendingStakeFractionChange,proto3" json:"pending_stake_fraction_change,omitempty"` + // pool stake shows the actual amount the validator has staked + // in this pool. It can be lower than the specified stake fraction + // because of the max voting power limit + PoolStake uint64 `protobuf:"varint,10,opt,name=pool_stake,json=poolStake,proto3" json:"pool_stake,omitempty"` } func (m *PoolMembership) Reset() { *m = PoolMembership{} } @@ -505,73 +437,91 @@ func (m *PoolMembership) GetBalance() uint64 { return 0 } +func (m *PoolMembership) GetPendingCommissionChange() *CommissionChangeEntry { + if m != nil { + return m.PendingCommissionChange + } + return nil +} + +func (m *PoolMembership) GetPendingStakeFractionChange() *StakeFractionChangeEntry { + if m != nil { + return m.PendingStakeFractionChange + } + return nil +} + +func (m *PoolMembership) GetPoolStake() uint64 { + if m != nil { + return m.PoolStake + } + return 0 +} + func init() { proto.RegisterType((*BasicPool)(nil), "kyve.query.v1beta1.BasicPool") proto.RegisterType((*FullStaker)(nil), "kyve.query.v1beta1.FullStaker") - proto.RegisterType((*StakerMetadata)(nil), "kyve.query.v1beta1.StakerMetadata") proto.RegisterType((*CommissionChangeEntry)(nil), "kyve.query.v1beta1.CommissionChangeEntry") + proto.RegisterType((*StakeFractionChangeEntry)(nil), "kyve.query.v1beta1.StakeFractionChangeEntry") proto.RegisterType((*PoolMembership)(nil), "kyve.query.v1beta1.PoolMembership") } func init() { proto.RegisterFile("kyve/query/v1beta1/query.proto", fileDescriptor_6b41255feae93a15) } var fileDescriptor_6b41255feae93a15 = []byte{ - // 871 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0xc6, 0x4e, 0x62, 0x4f, 0xc0, 0xa1, 0xa3, 0xd2, 0x6e, 0x02, 0xdd, 0x44, 0xee, 0xa1, - 0x6e, 0x25, 0x76, 0x95, 0xa0, 0x4a, 0x88, 0x03, 0x87, 0x38, 0xad, 0x84, 0x68, 0x11, 0x9a, 0x0a, - 0x50, 0xb9, 0xac, 0x66, 0x77, 0x5f, 0xd6, 0x23, 0xef, 0xce, 0xb8, 0x3b, 0xb3, 0x0e, 0x3e, 0x21, - 0xbe, 0x01, 0x1f, 0x03, 0x71, 0xe2, 0x80, 0xf8, 0x0c, 0x3d, 0x56, 0x9c, 0x80, 0x43, 0x41, 0xc9, - 0x81, 0xaf, 0x81, 0xe6, 0xcf, 0x6e, 0xed, 0xe2, 0x03, 0x07, 0xb8, 0xd8, 0xf3, 0x7e, 0xef, 0xef, - 0xfc, 0xde, 0x7b, 0xb3, 0x28, 0x98, 0x2e, 0xe6, 0x10, 0x3d, 0xab, 0xa1, 0x5a, 0x44, 0xf3, 0xe3, - 0x04, 0x14, 0x3d, 0xb6, 0x52, 0x38, 0xab, 0x84, 0x12, 0x18, 0x6b, 0x7d, 0x68, 0x11, 0xa7, 0x3f, - 0xb8, 0x46, 0x4b, 0xc6, 0x45, 0x64, 0x7e, 0xad, 0xd9, 0x41, 0x90, 0x0a, 0x59, 0x0a, 0x19, 0x25, - 0x54, 0x42, 0x1b, 0x27, 0x15, 0x8c, 0x3b, 0xfd, 0xf5, 0x5c, 0xe4, 0xc2, 0x1c, 0x23, 0x7d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b, 0xde, 0xde, 0x46, 0x6f, 0xa6, 0x15, 0xd8, 0xb1, 0xcf, 0xa8, 0xb2, 0x6f, 0x66, 0x87, 0xbc, - 0xd1, 0x80, 0x67, 0x54, 0xc1, 0xf0, 0x27, 0x0f, 0x0d, 0x56, 0x47, 0x0e, 0x1f, 0xa3, 0xae, 0x1e, - 0x3a, 0x93, 0x76, 0xb7, 0x59, 0xfe, 0x55, 0xa6, 0xdb, 0xf7, 0x99, 0x18, 0x53, 0x7c, 0x03, 0x6d, - 0xcf, 0x04, 0xe3, 0x4a, 0x9a, 0x1c, 0x5d, 0xe2, 0x24, 0x7c, 0x0b, 0x21, 0x26, 0xe3, 0x02, 0xe8, - 0x5c, 0x6f, 0x9c, 0x9e, 0xa3, 0x1e, 0xe9, 0x33, 0xf9, 0xc8, 0x02, 0x38, 0x40, 0x68, 0x4e, 0x8b, - 0xe6, 0x95, 0xb0, 0xb3, 0xb4, 0x84, 0xe8, 0x11, 0x49, 0x68, 0x41, 0x79, 0x0a, 0x6e, 0xf5, 0x1a, - 0xf1, 0xf4, 0xec, 0xf9, 0x65, 0xe0, 0xbd, 0xb8, 0x0c, 0xbc, 0x3f, 0x2f, 0x03, 0xef, 0xbb, 0xab, - 0x60, 0xe3, 0xc5, 0x55, 0xb0, 0xf1, 0xeb, 0x55, 0xb0, 0xf1, 0xd5, 0xbd, 0xa5, 0xb6, 0x7c, 0xf2, - 0xf4, 0x8b, 0x07, 0x9f, 0x82, 0xba, 0x10, 0xd5, 0x34, 0x4a, 0x27, 0x94, 0xf1, 0xe8, 0x6b, 0xf7, - 0xcd, 0x33, 0xed, 0x49, 0xb6, 0xcd, 0x17, 0xe7, 0xfd, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xea, - 0xce, 0x18, 0xb8, 0x0e, 0x07, 0x00, 0x00, + // 825 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0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, 0x49, 0xb9, 0x06, 0x20, 0x15, 0x5c, 0x79, 0x8f, 0x40, 0xa9, 0xe0, 0x55, + 0xf6, 0x29, 0x0e, 0xf7, 0x4f, 0x2f, 0x02, 0xe7, 0xec, 0x22, 0x70, 0xfe, 0xba, 0x08, 0x9c, 0x1f, + 0x2e, 0x83, 0xc6, 0xd9, 0x65, 0xd0, 0xf8, 0xfd, 0x32, 0x68, 0x7c, 0xf3, 0x64, 0xe5, 0xb7, 0xec, + 0xf3, 0x97, 0x2f, 0x9e, 0x7d, 0x89, 0xc5, 0x09, 0xab, 0xa7, 0x51, 0x3a, 0x41, 0x84, 0x46, 0xdf, + 0x9a, 0x4f, 0x98, 0xfa, 0x4d, 0x1b, 0xb7, 0xd4, 0xa7, 0xe1, 0xa3, 0x7f, 0x02, 0x00, 0x00, 0xff, + 0xff, 0x32, 0x03, 0xb7, 0x13, 0xdd, 0x06, 0x00, 0x00, } func (m *BasicPool) Marshal() (dAtA []byte, err error) { @@ -599,8 +549,8 @@ func (m *BasicPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x48 } - if m.TotalDelegation != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.TotalDelegation)) + if m.TotalStake != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.TotalStake)) i-- dAtA[i] = 0x40 } @@ -693,32 +643,17 @@ func (m *FullStaker) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x3a + dAtA[i] = 0x22 } } - if m.DelegatorCount != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.DelegatorCount)) - i-- - dAtA[i] = 0x30 - } - if m.TotalDelegation != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.TotalDelegation)) - i-- - dAtA[i] = 0x28 - } - if m.SelfDelegationUnbonding != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.SelfDelegationUnbonding)) - i-- - dAtA[i] = 0x20 - } - if m.SelfDelegation != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.SelfDelegation)) + if m.TotalPoolStake != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.TotalPoolStake)) i-- dAtA[i] = 0x18 } - if m.Metadata != nil { + if m.Validator != nil { { - size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Validator.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -738,7 +673,7 @@ func (m *FullStaker) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *StakerMetadata) Marshal() (dAtA []byte, err error) { +func (m *CommissionChangeEntry) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -748,76 +683,20 @@ func (m *StakerMetadata) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *StakerMetadata) MarshalTo(dAtA []byte) (int, error) { +func (m *CommissionChangeEntry) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *StakerMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *CommissionChangeEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.CommissionRewards) > 0 { - for iNdEx := len(m.CommissionRewards) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.CommissionRewards[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } - } - if m.PendingCommissionChange != nil { - { - size, err := m.PendingCommissionChange.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - if len(m.Details) > 0 { - i -= len(m.Details) - copy(dAtA[i:], m.Details) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Details))) - i-- - dAtA[i] = 0x32 - } - if len(m.SecurityContact) > 0 { - i -= len(m.SecurityContact) - copy(dAtA[i:], m.SecurityContact) - i = encodeVarintQuery(dAtA, i, uint64(len(m.SecurityContact))) - i-- - dAtA[i] = 0x2a - } - if len(m.Identity) > 0 { - i -= len(m.Identity) - copy(dAtA[i:], m.Identity) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Identity))) - i-- - dAtA[i] = 0x22 - } - if len(m.Website) > 0 { - i -= len(m.Website) - copy(dAtA[i:], m.Website) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Website))) - i-- - dAtA[i] = 0x1a - } - if len(m.Moniker) > 0 { - i -= len(m.Moniker) - copy(dAtA[i:], m.Moniker) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Moniker))) + if m.CreationDate != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.CreationDate)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } { size := m.Commission.Size() @@ -832,7 +711,7 @@ func (m *StakerMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *CommissionChangeEntry) Marshal() (dAtA []byte, err error) { +func (m *StakeFractionChangeEntry) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -842,12 +721,12 @@ func (m *CommissionChangeEntry) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *CommissionChangeEntry) MarshalTo(dAtA []byte) (int, error) { +func (m *StakeFractionChangeEntry) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *CommissionChangeEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *StakeFractionChangeEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -858,9 +737,9 @@ func (m *CommissionChangeEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x10 } { - size := m.Commission.Size() + size := m.StakeFraction.Size() i -= size - if _, err := m.Commission.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.StakeFraction.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintQuery(dAtA, i, uint64(size)) @@ -890,6 +769,55 @@ func (m *PoolMembership) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.PoolStake != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.PoolStake)) + i-- + dAtA[i] = 0x50 + } + if m.PendingStakeFractionChange != nil { + { + size, err := m.PendingStakeFractionChange.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + { + size := m.StakeFraction.Size() + i -= size + if _, err := m.StakeFraction.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + if m.PendingCommissionChange != nil { + { + size, err := m.PendingCommissionChange.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + { + size := m.Commission.Size() + i -= size + if _, err := m.Commission.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 if m.Balance != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.Balance)) i-- @@ -975,8 +903,8 @@ func (m *BasicPool) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) } } - if m.TotalDelegation != 0 { - n += 1 + sovQuery(uint64(m.TotalDelegation)) + if m.TotalStake != 0 { + n += 1 + sovQuery(uint64(m.TotalStake)) } if m.Status != 0 { n += 1 + sovQuery(uint64(m.Status)) @@ -994,21 +922,12 @@ func (m *FullStaker) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - if m.Metadata != nil { - l = m.Metadata.Size() + if m.Validator != nil { + l = m.Validator.Size() n += 1 + l + sovQuery(uint64(l)) } - if m.SelfDelegation != 0 { - n += 1 + sovQuery(uint64(m.SelfDelegation)) - } - if m.SelfDelegationUnbonding != 0 { - n += 1 + sovQuery(uint64(m.SelfDelegationUnbonding)) - } - if m.TotalDelegation != 0 { - n += 1 + sovQuery(uint64(m.TotalDelegation)) - } - if m.DelegatorCount != 0 { - n += 1 + sovQuery(uint64(m.DelegatorCount)) + if m.TotalPoolStake != 0 { + n += 1 + sovQuery(uint64(m.TotalPoolStake)) } if len(m.Pools) > 0 { for _, e := range m.Pools { @@ -1019,7 +938,7 @@ func (m *FullStaker) Size() (n int) { return n } -func (m *StakerMetadata) Size() (n int) { +func (m *CommissionChangeEntry) Size() (n int) { if m == nil { return 0 } @@ -1027,46 +946,19 @@ func (m *StakerMetadata) Size() (n int) { _ = l l = m.Commission.Size() n += 1 + l + sovQuery(uint64(l)) - l = len(m.Moniker) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Website) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Identity) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.SecurityContact) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Details) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.PendingCommissionChange != nil { - l = m.PendingCommissionChange.Size() - n += 1 + l + sovQuery(uint64(l)) - } - if len(m.CommissionRewards) > 0 { - for _, e := range m.CommissionRewards { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } + if m.CreationDate != 0 { + n += 1 + sovQuery(uint64(m.CreationDate)) } return n } -func (m *CommissionChangeEntry) Size() (n int) { +func (m *StakeFractionChangeEntry) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.Commission.Size() + l = m.StakeFraction.Size() n += 1 + l + sovQuery(uint64(l)) if m.CreationDate != 0 { n += 1 + sovQuery(uint64(m.CreationDate)) @@ -1097,6 +989,21 @@ func (m *PoolMembership) Size() (n int) { if m.Balance != 0 { n += 1 + sovQuery(uint64(m.Balance)) } + l = m.Commission.Size() + n += 1 + l + sovQuery(uint64(l)) + if m.PendingCommissionChange != nil { + l = m.PendingCommissionChange.Size() + n += 1 + l + sovQuery(uint64(l)) + } + l = m.StakeFraction.Size() + n += 1 + l + sovQuery(uint64(l)) + if m.PendingStakeFractionChange != nil { + l = m.PendingStakeFractionChange.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.PoolStake != 0 { + n += 1 + sovQuery(uint64(m.PoolStake)) + } return n } @@ -1339,9 +1246,9 @@ func (m *BasicPool) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 8: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalDelegation", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TotalStake", wireType) } - m.TotalDelegation = 0 + m.TotalStake = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1351,7 +1258,7 @@ func (m *BasicPool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TotalDelegation |= uint64(b&0x7F) << shift + m.TotalStake |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1459,7 +1366,7 @@ func (m *FullStaker) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1486,18 +1393,18 @@ func (m *FullStaker) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Metadata == nil { - m.Metadata = &StakerMetadata{} + if m.Validator == nil { + m.Validator = &types2.Validator{} } - if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Validator.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SelfDelegation", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TotalPoolStake", wireType) } - m.SelfDelegation = 0 + m.TotalPoolStake = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1507,16 +1414,16 @@ func (m *FullStaker) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.SelfDelegation |= uint64(b&0x7F) << shift + m.TotalPoolStake |= uint64(b&0x7F) << shift if b < 0x80 { break } } case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SelfDelegationUnbonding", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pools", wireType) } - m.SelfDelegationUnbonding = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1526,64 +1433,7 @@ func (m *FullStaker) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.SelfDelegationUnbonding |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalDelegation", wireType) - } - m.TotalDelegation = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalDelegation |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorCount", wireType) - } - m.DelegatorCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.DelegatorCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pools", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1624,7 +1474,7 @@ func (m *FullStaker) Unmarshal(dAtA []byte) error { } return nil } -func (m *StakerMetadata) Unmarshal(dAtA []byte) error { +func (m *CommissionChangeEntry) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1647,10 +1497,10 @@ func (m *StakerMetadata) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: StakerMetadata: wiretype end group for non-group") + return fmt.Errorf("proto: CommissionChangeEntry: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: StakerMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CommissionChangeEntry: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1688,206 +1538,10 @@ func (m *StakerMetadata) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Moniker = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Website = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Identity = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SecurityContact", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SecurityContact = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Details = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PendingCommissionChange", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PendingCommissionChange == nil { - m.PendingCommissionChange = &CommissionChangeEntry{} - } - if err := m.PendingCommissionChange.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CommissionRewards", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationDate", wireType) } - var msglen int + m.CreationDate = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1897,26 +1551,11 @@ func (m *StakerMetadata) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.CreationDate |= int64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CommissionRewards = append(m.CommissionRewards, types.Coin{}) - if err := m.CommissionRewards[len(m.CommissionRewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -1938,7 +1577,7 @@ func (m *StakerMetadata) Unmarshal(dAtA []byte) error { } return nil } -func (m *CommissionChangeEntry) Unmarshal(dAtA []byte) error { +func (m *StakeFractionChangeEntry) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1961,15 +1600,15 @@ func (m *CommissionChangeEntry) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CommissionChangeEntry: wiretype end group for non-group") + return fmt.Errorf("proto: StakeFractionChangeEntry: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CommissionChangeEntry: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: StakeFractionChangeEntry: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StakeFraction", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1997,7 +1636,7 @@ func (m *CommissionChangeEntry) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.StakeFraction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2196,6 +1835,165 @@ func (m *PoolMembership) Unmarshal(dAtA []byte) error { break } } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PendingCommissionChange", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PendingCommissionChange == nil { + m.PendingCommissionChange = &CommissionChangeEntry{} + } + if err := m.PendingCommissionChange.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StakeFraction", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.StakeFraction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PendingStakeFractionChange", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PendingStakeFractionChange == nil { + m.PendingStakeFractionChange = &StakeFractionChangeEntry{} + } + if err := m.PendingStakeFractionChange.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolStake", wireType) + } + m.PoolStake = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolStake |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/query/types/stakers.pb.go b/x/query/types/stakers.pb.go index 86d0d02d..77c2c5ee 100644 --- a/x/query/types/stakers.pb.go +++ b/x/query/types/stakers.pb.go @@ -6,7 +6,6 @@ package types import ( context "context" fmt "fmt" - types "github.com/KYVENetwork/chain/x/stakers/types" query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -37,22 +36,30 @@ type StakerStatus int32 const ( // STAKER_STATUS_UNSPECIFIED ... STAKER_STATUS_UNSPECIFIED StakerStatus = 0 - // STAKER_STATUS_ACTIVE ... - STAKER_STATUS_ACTIVE StakerStatus = 1 - // STAKER_STATUS_INACTIVE ... - STAKER_STATUS_INACTIVE StakerStatus = 2 + // STAKER_STATUS_PROTOCOL_ACTIVE ... + STAKER_STATUS_PROTOCOL_ACTIVE StakerStatus = 1 + // STAKER_STATUS_PROTOCOL_INACTIVE ... + STAKER_STATUS_PROTOCOL_INACTIVE StakerStatus = 2 + // STAKER_STATUS_CHAIN_ACTIVE ... + STAKER_STATUS_CHAIN_ACTIVE StakerStatus = 3 + // STAKER_STATUS_CHAIN_INACTIVE ... + STAKER_STATUS_CHAIN_INACTIVE StakerStatus = 4 ) var StakerStatus_name = map[int32]string{ 0: "STAKER_STATUS_UNSPECIFIED", - 1: "STAKER_STATUS_ACTIVE", - 2: "STAKER_STATUS_INACTIVE", + 1: "STAKER_STATUS_PROTOCOL_ACTIVE", + 2: "STAKER_STATUS_PROTOCOL_INACTIVE", + 3: "STAKER_STATUS_CHAIN_ACTIVE", + 4: "STAKER_STATUS_CHAIN_INACTIVE", } var StakerStatus_value = map[string]int32{ - "STAKER_STATUS_UNSPECIFIED": 0, - "STAKER_STATUS_ACTIVE": 1, - "STAKER_STATUS_INACTIVE": 2, + "STAKER_STATUS_UNSPECIFIED": 0, + "STAKER_STATUS_PROTOCOL_ACTIVE": 1, + "STAKER_STATUS_PROTOCOL_INACTIVE": 2, + "STAKER_STATUS_CHAIN_ACTIVE": 3, + "STAKER_STATUS_CHAIN_INACTIVE": 4, } func (x StakerStatus) String() string { @@ -323,7 +330,7 @@ func (m *QueryStakersByPoolRequest) GetPoolId() uint64 { // QueryStakersByPoolResponse is the response type for the Query/Staker RPC method. type QueryStakersByPoolResponse struct { // stakers ... - Stakers []StakerPoolResponse `protobuf:"bytes,1,rep,name=stakers,proto3" json:"stakers"` + Stakers []FullStaker `protobuf:"bytes,1,rep,name=stakers,proto3" json:"stakers"` } func (m *QueryStakersByPoolResponse) Reset() { *m = QueryStakersByPoolResponse{} } @@ -359,68 +366,13 @@ func (m *QueryStakersByPoolResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryStakersByPoolResponse proto.InternalMessageInfo -func (m *QueryStakersByPoolResponse) GetStakers() []StakerPoolResponse { +func (m *QueryStakersByPoolResponse) GetStakers() []FullStaker { if m != nil { return m.Stakers } return nil } -// StakerPoolResponse ... -type StakerPoolResponse struct { - // staker ... - Staker *FullStaker `protobuf:"bytes,1,opt,name=staker,proto3" json:"staker,omitempty"` - // valaccount ... - Valaccount *types.Valaccount `protobuf:"bytes,2,opt,name=valaccount,proto3" json:"valaccount,omitempty"` -} - -func (m *StakerPoolResponse) Reset() { *m = StakerPoolResponse{} } -func (m *StakerPoolResponse) String() string { return proto.CompactTextString(m) } -func (*StakerPoolResponse) ProtoMessage() {} -func (*StakerPoolResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6aa31a681566da33, []int{6} -} -func (m *StakerPoolResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StakerPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_StakerPoolResponse.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 *StakerPoolResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_StakerPoolResponse.Merge(m, src) -} -func (m *StakerPoolResponse) XXX_Size() int { - return m.Size() -} -func (m *StakerPoolResponse) XXX_DiscardUnknown() { - xxx_messageInfo_StakerPoolResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_StakerPoolResponse proto.InternalMessageInfo - -func (m *StakerPoolResponse) GetStaker() *FullStaker { - if m != nil { - return m.Staker - } - return nil -} - -func (m *StakerPoolResponse) GetValaccount() *types.Valaccount { - if m != nil { - return m.Valaccount - } - return nil -} - // QueryStakersByPoolCountRequest ... type QueryStakersByPoolCountRequest struct { // pagination defines an optional pagination for the request. @@ -431,7 +383,7 @@ func (m *QueryStakersByPoolCountRequest) Reset() { *m = QueryStakersByPo func (m *QueryStakersByPoolCountRequest) String() string { return proto.CompactTextString(m) } func (*QueryStakersByPoolCountRequest) ProtoMessage() {} func (*QueryStakersByPoolCountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6aa31a681566da33, []int{7} + return fileDescriptor_6aa31a681566da33, []int{6} } func (m *QueryStakersByPoolCountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -479,7 +431,7 @@ func (m *QueryStakersByPoolCountResponse) Reset() { *m = QueryStakersByP func (m *QueryStakersByPoolCountResponse) String() string { return proto.CompactTextString(m) } func (*QueryStakersByPoolCountResponse) ProtoMessage() {} func (*QueryStakersByPoolCountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6aa31a681566da33, []int{8} + return fileDescriptor_6aa31a681566da33, []int{7} } func (m *QueryStakersByPoolCountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -530,7 +482,6 @@ func init() { proto.RegisterType((*QueryStakerResponse)(nil), "kyve.query.v1beta1.QueryStakerResponse") proto.RegisterType((*QueryStakersByPoolRequest)(nil), "kyve.query.v1beta1.QueryStakersByPoolRequest") proto.RegisterType((*QueryStakersByPoolResponse)(nil), "kyve.query.v1beta1.QueryStakersByPoolResponse") - proto.RegisterType((*StakerPoolResponse)(nil), "kyve.query.v1beta1.StakerPoolResponse") proto.RegisterType((*QueryStakersByPoolCountRequest)(nil), "kyve.query.v1beta1.QueryStakersByPoolCountRequest") proto.RegisterType((*QueryStakersByPoolCountResponse)(nil), "kyve.query.v1beta1.QueryStakersByPoolCountResponse") } @@ -538,54 +489,52 @@ func init() { func init() { proto.RegisterFile("kyve/query/v1beta1/stakers.proto", fileDescriptor_6aa31a681566da33) } var fileDescriptor_6aa31a681566da33 = []byte{ - // 739 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x4f, 0x4f, 0x13, 0x4d, - 0x1c, 0xee, 0x94, 0xa6, 0x0d, 0x03, 0xef, 0x1b, 0x32, 0x2f, 0xe1, 0x2d, 0xab, 0x2c, 0xcd, 0x6a, - 0x4a, 0x45, 0xd9, 0x09, 0x45, 0x8d, 0x07, 0x63, 0xe4, 0x4f, 0x6b, 0x1a, 0x12, 0x82, 0xdb, 0x42, - 0xa2, 0x97, 0x66, 0xda, 0x4e, 0xb6, 0x9b, 0x96, 0x9d, 0xb2, 0xb3, 0x45, 0x1b, 0xc2, 0x41, 0x2f, - 0x7a, 0x32, 0x26, 0x7e, 0x00, 0x0f, 0xc6, 0x8b, 0x17, 0xfd, 0x18, 0x1c, 0x49, 0xbc, 0x78, 0x32, - 0x06, 0xfc, 0x0e, 0x5e, 0x4d, 0x67, 0x67, 0x71, 0x17, 0x5a, 0x5b, 0x12, 0x0f, 0xde, 0x66, 0x76, - 0x9e, 0x67, 0x7e, 0xcf, 0xf3, 0xcc, 0xfc, 0x66, 0x61, 0xaa, 0xd1, 0xd9, 0xa3, 0x78, 0xb7, 0x4d, - 0x9d, 0x0e, 0xde, 0x5b, 0xac, 0x50, 0x97, 0x2c, 0x62, 0xee, 0x92, 0x06, 0x75, 0xb8, 0xde, 0x72, - 0x98, 0xcb, 0x10, 0xea, 0x22, 0x74, 0x81, 0xd0, 0x25, 0x42, 0x99, 0xaf, 0x32, 0xbe, 0xc3, 0x38, - 0xae, 0x10, 0x7e, 0x96, 0xdc, 0x22, 0xa6, 0x65, 0x13, 0xd7, 0x62, 0xb6, 0xc7, 0x57, 0x26, 0x4d, - 0x66, 0x32, 0x31, 0xc4, 0xdd, 0x91, 0xfc, 0x7a, 0xd9, 0x64, 0xcc, 0x6c, 0x52, 0x4c, 0x5a, 0x16, - 0x26, 0xb6, 0xcd, 0x5c, 0x41, 0x91, 0x35, 0x15, 0xb5, 0x87, 0x2a, 0x4f, 0x81, 0xb7, 0xae, 0x89, - 0x75, 0xa9, 0xb3, 0xb7, 0x6e, 0xed, 0x23, 0x80, 0xff, 0x3d, 0xec, 0x72, 0x8a, 0xde, 0x67, 0x83, - 0xee, 0xb6, 0x29, 0x77, 0x51, 0x1e, 0xc2, 0x5f, 0x1a, 0x93, 0x20, 0x05, 0x32, 0x63, 0xd9, 0xb4, - 0xee, 0x19, 0xd2, 0xbb, 0x86, 0xc2, 0x5e, 0xf5, 0x4d, 0x62, 0x52, 0xc9, 0x35, 0x02, 0x4c, 0x74, - 0x07, 0xc6, 0xb9, 0x4b, 0xdc, 0x36, 0x4f, 0x46, 0x53, 0x20, 0xf3, 0x6f, 0x36, 0xa5, 0x9f, 0x0f, - 0x4a, 0xf7, 0x6a, 0x17, 0x05, 0xce, 0x90, 0x78, 0x34, 0x05, 0xe3, 0x9c, 0x12, 0xa7, 0x5a, 0x4f, - 0x8e, 0xa4, 0x40, 0x66, 0xd4, 0x90, 0x33, 0xed, 0x2d, 0x80, 0x93, 0x61, 0xc5, 0xbc, 0xc5, 0x6c, - 0x4e, 0xd1, 0x3d, 0x98, 0x90, 0xde, 0x92, 0x20, 0x35, 0x92, 0x19, 0xcb, 0xaa, 0xbd, 0x6a, 0xe5, - 0xdb, 0xcd, 0xa6, 0xc7, 0x5c, 0x89, 0x1d, 0x7e, 0x9d, 0x8d, 0x18, 0x3e, 0x09, 0x3d, 0x08, 0x59, - 0x8e, 0x0a, 0xcb, 0x73, 0x03, 0x2d, 0x7b, 0xc5, 0x83, 0x9e, 0x35, 0x1d, 0xa2, 0x80, 0x40, 0x3f, - 0xd1, 0x24, 0x4c, 0x90, 0x5a, 0xcd, 0xa1, 0x9c, 0x8b, 0x38, 0x47, 0x0d, 0x7f, 0xaa, 0x15, 0x43, - 0x47, 0x70, 0xea, 0xe7, 0xae, 0x88, 0xae, 0x41, 0x1d, 0x19, 0xff, 0x70, 0x76, 0x24, 0x47, 0xbb, - 0x09, 0xa7, 0x83, 0x29, 0xad, 0x74, 0x36, 0x19, 0x6b, 0xfa,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xf9, 0xfb, - 0x9b, 0xe8, 0x0c, 0xba, 0x84, 0xfb, 0x3f, 0xed, 0xe8, 0x05, 0x80, 0x71, 0x8f, 0x88, 0xd2, 0x03, - 0x76, 0xf6, 0x15, 0xcc, 0x0d, 0xc4, 0x49, 0x01, 0x37, 0x84, 0x80, 0x34, 0xba, 0xda, 0x5f, 0x00, - 0xde, 0x97, 0x2f, 0xc4, 0x01, 0x7a, 0x0f, 0xe0, 0x3f, 0xa1, 0x1b, 0x83, 0x16, 0x06, 0x59, 0x0d, - 0x75, 0xbc, 0xa2, 0x0f, 0x0b, 0x97, 0xf2, 0x6e, 0x09, 0x79, 0x18, 0x2d, 0xfc, 0x26, 0x9f, 0x72, - 0xa5, 0x53, 0xee, 0xbe, 0x1b, 0x78, 0x5f, 0x3e, 0x26, 0x07, 0xe8, 0xd3, 0x69, 0x67, 0x07, 0x6f, - 0x36, 0xca, 0x0e, 0x57, 0x3d, 0xd8, 0x71, 0xca, 0xd2, 0x85, 0x38, 0x52, 0xf6, 0xa2, 0x90, 0x7d, - 0x1d, 0x5d, 0x1b, 0x42, 0x76, 0x59, 0xf4, 0xfe, 0xca, 0xda, 0xe1, 0xb1, 0x0a, 0x8e, 0x8e, 0x55, - 0xf0, 0xed, 0x58, 0x05, 0xaf, 0x4f, 0xd4, 0xc8, 0xd1, 0x89, 0x1a, 0xf9, 0x72, 0xa2, 0x46, 0x1e, - 0xcf, 0x9b, 0x96, 0x5b, 0x6f, 0x57, 0xf4, 0x2a, 0xdb, 0xc1, 0xeb, 0x8f, 0xb6, 0x73, 0x1b, 0xd4, - 0x7d, 0xc2, 0x9c, 0x06, 0xae, 0xd6, 0x89, 0x65, 0xe3, 0xa7, 0x72, 0x77, 0xb7, 0xd3, 0xa2, 0xbc, - 0x12, 0x17, 0xbf, 0xd3, 0xa5, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x68, 0x64, 0xf5, 0xe3, 0x2a, - 0x08, 0x00, 0x00, + // 719 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x41, 0x4f, 0x13, 0x4d, + 0x18, 0xee, 0x94, 0xa6, 0x0d, 0x03, 0xdf, 0x17, 0x32, 0x1f, 0xf9, 0x2c, 0x2b, 0x2c, 0x75, 0x31, + 0x50, 0x51, 0x76, 0x42, 0xd1, 0xc4, 0x83, 0x31, 0x29, 0xa5, 0x68, 0x83, 0x29, 0x75, 0xb7, 0x90, + 0x68, 0x4c, 0x36, 0xdb, 0x76, 0xb2, 0x6d, 0x5a, 0x76, 0xca, 0xce, 0x16, 0x6d, 0x08, 0x07, 0xbd, + 0xe8, 0xd1, 0xc4, 0x1f, 0xe0, 0xc1, 0x78, 0xf1, 0xa2, 0x7f, 0xc0, 0x3b, 0x47, 0x12, 0x2f, 0x9e, + 0x8c, 0x01, 0xff, 0x83, 0x57, 0xb3, 0xbb, 0xb3, 0xb8, 0x2b, 0xad, 0xad, 0x09, 0x07, 0x6f, 0x33, + 0x9d, 0xe7, 0x79, 0xdf, 0xe7, 0x79, 0x3a, 0xef, 0x2c, 0x4c, 0x35, 0xbb, 0x7b, 0x04, 0xef, 0x76, + 0x88, 0xd5, 0xc5, 0x7b, 0xcb, 0x15, 0x62, 0xeb, 0xcb, 0x98, 0xd9, 0x7a, 0x93, 0x58, 0x4c, 0x6e, + 0x5b, 0xd4, 0xa6, 0x08, 0x39, 0x08, 0xd9, 0x45, 0xc8, 0x1c, 0x21, 0x2c, 0x56, 0x29, 0xdb, 0xa1, + 0x0c, 0x57, 0x74, 0xf6, 0x2b, 0xb9, 0xad, 0x1b, 0x0d, 0x53, 0xb7, 0x1b, 0xd4, 0xf4, 0xf8, 0xc2, + 0xa4, 0x41, 0x0d, 0xea, 0x2e, 0xb1, 0xb3, 0xe2, 0xbf, 0x4e, 0x1b, 0x94, 0x1a, 0x2d, 0x82, 0xf5, + 0x76, 0x03, 0xeb, 0xa6, 0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 0x45, 0xdc, 0xff, 0xc9, 0x45, 0xcf, 0x01, 0x8c, 0x7b, 0x44, 0x34, 0x3f, 0xa0, 0xb2, 0xaf, 0x60, + 0x61, 0x20, 0x8e, 0x0b, 0xb8, 0xe6, 0x0a, 0x98, 0x47, 0x97, 0xfb, 0x0b, 0xc0, 0xfb, 0x7c, 0xba, + 0x0f, 0xd0, 0x5b, 0x00, 0xff, 0x09, 0x5d, 0x43, 0xb4, 0x34, 0xc8, 0x6a, 0x68, 0x5a, 0x05, 0x79, + 0x58, 0x38, 0x97, 0x77, 0xc3, 0x95, 0x87, 0xd1, 0xd2, 0x6f, 0xf2, 0xd1, 0x2a, 0x5d, 0xcd, 0x99, + 0x79, 0xbc, 0xcf, 0x1f, 0x82, 0x03, 0xf4, 0x01, 0x40, 0x74, 0x76, 0x5c, 0x50, 0x66, 0xb8, 0xee, + 0xc1, 0x31, 0x16, 0x56, 0xfe, 0x88, 0xc3, 0x65, 0x2f, 0xbb, 0xb2, 0xaf, 0xa2, 0x2b, 0x43, 0xc8, + 0xd6, 0xaa, 0x0e, 0x75, 0x75, 0xed, 0xf0, 0x58, 0x04, 0x47, 0xc7, 0x22, 0xf8, 0x7a, 0x2c, 0x82, + 0x97, 0x27, 0x62, 0xe4, 0xe8, 0x44, 0x8c, 0x7c, 0x3e, 0x11, 0x23, 0x0f, 0x17, 0x8d, 0x86, 0x5d, + 0xef, 0x54, 0xe4, 0x2a, 0xdd, 0xc1, 0x1b, 0x0f, 0xb6, 0xf3, 0x45, 0x62, 0x3f, 0xa6, 0x56, 0x13, + 0x57, 0xeb, 0x7a, 0xc3, 0xc4, 0x4f, 0x78, 0x75, 0xbb, 0xdb, 0x26, 0xac, 0x12, 0x77, 0x3f, 0x85, + 0x2b, 0x3f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xce, 0x3c, 0x81, 0x37, 0xc2, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1011,53 +960,6 @@ func (m *QueryStakersByPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } -func (m *StakerPoolResponse) 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 *StakerPoolResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StakerPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Valaccount != nil { - { - size, err := m.Valaccount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStakers(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Staker != nil { - { - size, err := m.Staker.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStakers(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *QueryStakersByPoolCountRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1243,23 +1145,6 @@ func (m *QueryStakersByPoolResponse) Size() (n int) { return n } -func (m *StakerPoolResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Staker != nil { - l = m.Staker.Size() - n += 1 + l + sovStakers(uint64(l)) - } - if m.Valaccount != nil { - l = m.Valaccount.Size() - n += 1 + l + sovStakers(uint64(l)) - } - return n -} - func (m *QueryStakersByPoolCountRequest) Size() (n int) { if m == nil { return 0 @@ -1847,7 +1732,7 @@ func (m *QueryStakersByPoolResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Stakers = append(m.Stakers, StakerPoolResponse{}) + m.Stakers = append(m.Stakers, FullStaker{}) if err := m.Stakers[len(m.Stakers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1873,128 +1758,6 @@ func (m *QueryStakersByPoolResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *StakerPoolResponse) 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 ErrIntOverflowStakers - } - 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: StakerPoolResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StakerPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Staker", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStakers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStakers - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStakers - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Staker == nil { - m.Staker = &FullStaker{} - } - if err := m.Staker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Valaccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStakers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStakers - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStakers - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Valaccount == nil { - m.Valaccount = &types.Valaccount{} - } - if err := m.Valaccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStakers(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStakers - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *QueryStakersByPoolCountRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/stakers/keeper/exported_functions.go b/x/stakers/keeper/exported_functions.go index a695746f..ded6c72f 100644 --- a/x/stakers/keeper/exported_functions.go +++ b/x/stakers/keeper/exported_functions.go @@ -3,6 +3,10 @@ package keeper import ( "sort" + querytypes "github.com/KYVENetwork/chain/x/query/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "cosmossdk.io/errors" "cosmossdk.io/math" "github.com/KYVENetwork/chain/util" @@ -43,18 +47,73 @@ func (k Keeper) GetAllStakerAddressesOfPool(ctx sdk.Context, poolId uint64) (sta return stakers } -func (k Keeper) GetPaginatedStakersByDelegation(ctx sdk.Context, pagination *query.PageRequest, accumulator func(staker string, accumulate bool) bool) (*query.PageResponse, error) { +func (k Keeper) GetPaginatedStakersByPoolStake(ctx sdk.Context, pagination *query.PageRequest, stakerStatus querytypes.StakerStatus, accumulator func(validator string, accumulate bool) bool) (*query.PageResponse, error) { + validators, err := k.stakingKeeper.GetBondedValidatorsByPower(ctx) + if err != nil { + return nil, err + } + + addresses := make([]string, 0) + + for _, validator := range validators { + address := util.MustAccountAddressFromValAddress(validator.OperatorAddress) + + if stakerStatus == querytypes.STAKER_STATUS_PROTOCOL_ACTIVE && len(k.GetValaccountsFromStaker(ctx, address)) == 0 { + continue + } + + if stakerStatus == querytypes.STAKER_STATUS_PROTOCOL_INACTIVE && len(k.GetValaccountsFromStaker(ctx, address)) > 0 { + continue + } + + if stakerStatus == querytypes.STAKER_STATUS_CHAIN_ACTIVE && !validator.IsBonded() { + continue + } + + if stakerStatus == querytypes.STAKER_STATUS_CHAIN_INACTIVE && validator.IsBonded() { + continue + } + + addresses = append(addresses, address) + } + + if stakerStatus == querytypes.STAKER_STATUS_UNSPECIFIED || stakerStatus == querytypes.STAKER_STATUS_PROTOCOL_ACTIVE { + // TODO: consider optimization + sort.Slice(addresses, func(i, j int) bool { + return k.GetValidatorTotalPoolStake(ctx, addresses[i]) > k.GetValidatorTotalPoolStake(ctx, addresses[j]) + }) + } + + pageRes, err := arrayPaginationAccumulator(addresses, pagination, accumulator) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return pageRes, nil +} + +func (k Keeper) GetPaginatedStakersByPoolCount(ctx sdk.Context, pagination *query.PageRequest, accumulator func(validator string, accumulate bool) bool) (*query.PageResponse, error) { validators, err := k.stakingKeeper.GetBondedValidatorsByPower(ctx) if err != nil { return nil, err } + addresses := make([]string, 0) + for _, validator := range validators { - accumulator(util.MustAccountAddressFromValAddress(validator.OperatorAddress), true) + addresses = append(addresses, util.MustAccountAddressFromValAddress(validator.OperatorAddress)) } - res := query.PageResponse{} - return &res, nil + sort.Slice(addresses, func(i, j int) bool { + return len(k.GetValaccountsFromStaker(ctx, addresses[i])) > len(k.GetValaccountsFromStaker(ctx, addresses[j])) + }) + + pageRes, err := arrayPaginationAccumulator(addresses, pagination, accumulator) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return pageRes, nil } // AssertValaccountAuthorized checks if the given `valaddress` is allowed to vote in pool @@ -128,6 +187,16 @@ func (k Keeper) GetValidatorPoolStake(ctx sdk.Context, staker string, poolId uin return k.GetValidatorPoolStakes(ctx, poolId, staker)[staker] } +// GetValidatorTotalPoolStake returns the total stake the validator has combined in every pool +func (k Keeper) GetValidatorTotalPoolStake(ctx sdk.Context, staker string) (totalStake uint64) { + valaccounts := k.GetValaccountsFromStaker(ctx, staker) + for _, valaccount := range valaccounts { + totalStake += k.GetValidatorPoolStake(ctx, valaccount.Staker, valaccount.PoolId) + } + + return +} + // GetValidatorPoolStakes returns a map for all pool validators with their effective stake. Effective stake // is the actual amount which determines the validator's voting power and is the actual amount at risk for // slashing. The effective stake can be lower (never higher) than the specified stake by the validators by diff --git a/x/stakers/keeper/getters_staker.go b/x/stakers/keeper/getters_staker.go index ffa270e9..1ff6ba1a 100644 --- a/x/stakers/keeper/getters_staker.go +++ b/x/stakers/keeper/getters_staker.go @@ -2,6 +2,7 @@ package keeper import ( "encoding/binary" + "fmt" "cosmossdk.io/math" @@ -245,3 +246,33 @@ func (k Keeper) getAllActiveStakers(ctx sdk.Context) (list []string) { return } + +// arrayPaginationAccumulator helps to parse the query.PageRequest for an array +// instead of a KV-Store. +func arrayPaginationAccumulator(slice []string, pagination *query.PageRequest, accumulator func(address string, accumulate bool) bool) (*query.PageResponse, error) { + if pagination != nil && pagination.Key != nil { + return nil, fmt.Errorf("key pagination not supported") + } + + page, limit, err := query.ParsePagination(pagination) + if err != nil { + return nil, err + } + + count := 0 + minIndex := (page - 1) * limit + maxIndex := (page) * limit + + for i := 0; i < len(slice); i++ { + if accumulator(slice[i], count >= minIndex && count < maxIndex) { + count++ + } + } + + pageRes := &query.PageResponse{ + NextKey: nil, + Total: uint64(count), + } + + return pageRes, nil +} diff --git a/x/stakers/keeper/keeper_suite_effective_stake_test.go b/x/stakers/keeper/keeper_suite_effective_stake_test.go index e68ea9a4..4fdc412c 100644 --- a/x/stakers/keeper/keeper_suite_effective_stake_test.go +++ b/x/stakers/keeper/keeper_suite_effective_stake_test.go @@ -50,9 +50,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { } s.RunTxPoolSuccess(msg) - params := s.App().PoolKeeper.GetParams(s.Ctx()) - params.MaxVotingPowerPerPool = math.LegacyMustNewDecFromStr("0.5") - s.App().PoolKeeper.SetParams(s.Ctx(), params) + s.SetMaxVotingPower("0.5") }) AfterEach(func() { @@ -147,9 +145,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { It("Test effective stake with multiple validators above the max pool voting power", func() { // ARRANGE - params := s.App().PoolKeeper.GetParams(s.Ctx()) - params.MaxVotingPowerPerPool = math.LegacyMustNewDecFromStr("0.35") - s.App().PoolKeeper.SetParams(s.Ctx(), params) + s.SetMaxVotingPower("0.35") s.CreateValidator(i.STAKER_0, "Staker-0", int64(600*i.KYVE)) s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ @@ -193,9 +189,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { It("Test effective stake with fewer validators than required to undercut the max pool voting power", func() { // ARRANGE - params := s.App().PoolKeeper.GetParams(s.Ctx()) - params.MaxVotingPowerPerPool = math.LegacyMustNewDecFromStr("0.2") - s.App().PoolKeeper.SetParams(s.Ctx(), params) + s.SetMaxVotingPower("0.2") s.CreateValidator(i.STAKER_0, "Staker-0", int64(100*i.KYVE)) s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ @@ -315,9 +309,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { It("Test effective stake with 0% as max pool stake", func() { // ARRANGE - params := s.App().PoolKeeper.GetParams(s.Ctx()) - params.MaxVotingPowerPerPool = math.LegacyMustNewDecFromStr("0") - s.App().PoolKeeper.SetParams(s.Ctx(), params) + s.SetMaxVotingPower("0") s.CreateValidator(i.STAKER_0, "Staker-0", int64(100*i.KYVE)) s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ @@ -357,9 +349,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { It("Test effective stake with 100% as max pool stake", func() { // ARRANGE - params := s.App().PoolKeeper.GetParams(s.Ctx()) - params.MaxVotingPowerPerPool = math.LegacyMustNewDecFromStr("1") - s.App().PoolKeeper.SetParams(s.Ctx(), params) + s.SetMaxVotingPower("1") s.CreateValidator(i.STAKER_0, "Staker-0", int64(100*i.KYVE)) s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ @@ -467,9 +457,7 @@ var _ = Describe("keeper_suite_effective_stake_test.go", Ordered, func() { It("Test effective stake with multiple validators above the max pool voting power due to stake fractions", func() { // ARRANGE - params := s.App().PoolKeeper.GetParams(s.Ctx()) - params.MaxVotingPowerPerPool = math.LegacyMustNewDecFromStr("0.35") - s.App().PoolKeeper.SetParams(s.Ctx(), params) + s.SetMaxVotingPower("0.35") s.CreateValidator(i.STAKER_0, "Staker-0", int64(100*i.KYVE)) s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ diff --git a/x/stakers/keeper/msg_server_join_pool_test.go b/x/stakers/keeper/msg_server_join_pool_test.go index 92f7ffbd..e5998dff 100644 --- a/x/stakers/keeper/msg_server_join_pool_test.go +++ b/x/stakers/keeper/msg_server_join_pool_test.go @@ -71,9 +71,7 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { } s.RunTxPoolSuccess(msg) - params := s.App().PoolKeeper.GetParams(s.Ctx()) - params.MaxVotingPowerPerPool = math.LegacyMustNewDecFromStr("1") - s.App().PoolKeeper.SetParams(s.Ctx(), params) + s.SetMaxVotingPower("1") s.CreateValidator(i.STAKER_0, "Staker-0", int64(100*i.KYVE)) diff --git a/x/stakers/keeper/msg_server_leave_pool_test.go b/x/stakers/keeper/msg_server_leave_pool_test.go index ca33d3e5..045fdc7c 100644 --- a/x/stakers/keeper/msg_server_leave_pool_test.go +++ b/x/stakers/keeper/msg_server_leave_pool_test.go @@ -43,9 +43,7 @@ var _ = Describe("msg_server_leave_pool.go", Ordered, func() { // create staker s.CreateValidator(i.STAKER_0, "Staker-0", int64(100*i.KYVE)) - params := s.App().PoolKeeper.GetParams(s.Ctx()) - params.MaxVotingPowerPerPool = math.LegacyMustNewDecFromStr("1") - s.App().PoolKeeper.SetParams(s.Ctx(), params) + s.SetMaxVotingPower("1") // join pool s.RunTxStakersSuccess(&stakerstypes.MsgJoinPool{ diff --git a/x/stakers/keeper/msg_server_update_stake_fraction_test.go b/x/stakers/keeper/msg_server_update_stake_fraction_test.go index afb76ea5..9e266a33 100644 --- a/x/stakers/keeper/msg_server_update_stake_fraction_test.go +++ b/x/stakers/keeper/msg_server_update_stake_fraction_test.go @@ -50,9 +50,7 @@ var _ = Describe("msg_server_update_stake_fraction.go", Ordered, func() { } s.RunTxPoolSuccess(msg) - params := s.App().PoolKeeper.GetParams(s.Ctx()) - params.MaxVotingPowerPerPool = math.LegacyMustNewDecFromStr("1") - s.App().PoolKeeper.SetParams(s.Ctx(), params) + s.SetMaxVotingPower("1") s.CreateValidator(i.STAKER_0, "Staker-0", int64(100*i.KYVE))