Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: stakers queries #232

Merged
merged 8 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ genesis:
total_bundles: "0"
upload_interval: "60"
protocol:
version: "1.1.6"
version: "1.2.8"
binaries: "{\"kyve-linux-arm64\":\"https://github.com/KYVENetwork/kyvejs/releases/download/%40kyvejs%2Ftendermint%401.1.6/kyve-linux-arm64.zip\",\"kyve-linux-x64\":\"https://github.com/KYVENetwork/kyvejs/releases/download/%40kyvejs%2Ftendermint%401.1.6/kyve-linux-x64.zip\",\"kyve-macos-x64\":\"https://github.com/KYVENetwork/kyvejs/releases/download/%40kyvejs%2Ftendermint%401.1.6/kyve-macos-x64.zip\"}"
last_upgrade: "0"
upgrade_plan:
Expand Down Expand Up @@ -226,4 +226,4 @@ validators:
config:
consensus:
timeout_commit: "2s"
timeout_propose: "2s"
timeout_propose: "2s"
225 changes: 209 additions & 16 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,36 @@ paths:
delegation:
type: string
format: uint64
description: protocol_staking ...
description: >-
delegation is the amount in $KYVE this account has in total
delegated ...
delegation_unbonding:
type: string
format: uint64
description: protocol_staking_unbonding ...
outstanding_rewards:
description: >-
delegation_unbonding is the amount in $KYVE this account has
in total currently unbonding ...
delegation_rewards:
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: >-
delegation_rewards are the current unclaimed delegation
rewards
commission_rewards:
type: array
items:
type: object
Expand All @@ -213,7 +237,9 @@ paths:
method

signatures required by gogoproto.
description: protocol_rewards ...
title: >-
commission_rewards are the current unclaimed commission
rewards
protocol_funding:
type: array
items:
Expand Down Expand Up @@ -4427,14 +4453,55 @@ paths:
bonded shares

multiplied by exchange rate.
total_pool_stake:
validator_delegators:
type: string
format: uint64
title: >-
total_pool_stake returns the amount the validator has in
total
validator_delegators returns the amount of delegators
which have delegated

into this validator
validator_self_delegation:
type: string
format: uint64
title: >-
validator_self_delegation returns the amount in $KYVE the
validator has

personally delegated
validator_unbonding:
type: string
format: uint64
title: >-
validator_unbonding returns the amount in $KYVE the
validator is currently

unbonding from his validator
validator_total_pool_stake:
type: string
format: uint64
title: >-
validator_total_pool_stake returns the amount the
validator has in total

staked in all his pools
validator_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.


NOTE: The amount field is an Int which implements the
custom method

signatures required by gogoproto.
troykessler marked this conversation as resolved.
Show resolved Hide resolved
pools:
type: array
items:
Expand Down Expand Up @@ -5089,14 +5156,56 @@ paths:
bonded shares

multiplied by exchange rate.
total_pool_stake:
validator_delegators:
type: string
format: uint64
title: >-
validator_delegators returns the amount of delegators
which have delegated

into this validator
validator_self_delegation:
type: string
format: uint64
title: >-
validator_self_delegation returns the amount in $KYVE
the validator has

personally delegated
validator_unbonding:
type: string
format: uint64
title: >-
validator_unbonding returns the amount in $KYVE the
validator is currently

unbonding from his validator
validator_total_pool_stake:
type: string
format: uint64
title: >-
total_pool_stake returns the amount the validator has in
total
validator_total_pool_stake returns the amount the
validator has in total

staked in all his pools
validator_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.


NOTE: The amount field is an Int which implements the
custom method

signatures required by gogoproto.
pools:
type: array
items:
Expand Down Expand Up @@ -5855,14 +5964,56 @@ paths:
bonded shares

multiplied by exchange rate.
total_pool_stake:
validator_delegators:
type: string
format: uint64
title: >-
validator_delegators returns the amount of delegators
which have delegated

into this validator
validator_self_delegation:
type: string
format: uint64
title: >-
validator_self_delegation returns the amount in $KYVE
the validator has

personally delegated
validator_unbonding:
type: string
format: uint64
title: >-
total_pool_stake returns the amount the validator has in
total
validator_unbonding returns the amount in $KYVE the
validator is currently

unbonding from his validator
validator_total_pool_stake:
type: string
format: uint64
title: >-
validator_total_pool_stake returns the amount the
validator has in total

staked in all his pools
validator_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.


NOTE: The amount field is an Int which implements the
custom method

signatures required by gogoproto.
pools:
type: array
items:
Expand Down Expand Up @@ -6530,14 +6681,56 @@ paths:
bonded shares

multiplied by exchange rate.
total_pool_stake:
validator_delegators:
type: string
format: uint64
title: >-
total_pool_stake returns the amount the validator has in
total
validator_delegators returns the amount of delegators
which have delegated

into this validator
validator_self_delegation:
type: string
format: uint64
title: >-
validator_self_delegation returns the amount in $KYVE
the validator has

personally delegated
validator_unbonding:
type: string
format: uint64
title: >-
validator_unbonding returns the amount in $KYVE the
validator is currently

unbonding from his validator
validator_total_pool_stake:
type: string
format: uint64
title: >-
validator_total_pool_stake returns the amount the
validator has in total

staked in all his pools
validator_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.


NOTE: The amount field is an Int which implements the
custom method

signatures required by gogoproto.
pools:
type: array
items:
Expand Down
16 changes: 11 additions & 5 deletions proto/kyve/query/v1beta1/account.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,24 @@ message QueryAccountAssetsRequest {
message QueryAccountAssetsResponse {
// balance ...
uint64 balance = 1;
// protocol_staking ...
// delegation is the amount in $KYVE this account has in total delegated ...
uint64 delegation = 2;
// protocol_staking_unbonding ...
// delegation_unbonding is the amount in $KYVE this account has in total currently unbonding ...
uint64 delegation_unbonding = 3;
// protocol_rewards ...
repeated cosmos.base.v1beta1.Coin outstanding_rewards = 6 [
// delegation_rewards are the current unclaimed delegation rewards
repeated cosmos.base.v1beta1.Coin delegation_rewards = 6 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
// commission_rewards are the current unclaimed commission rewards
repeated cosmos.base.v1beta1.Coin commission_rewards = 7 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
// protocol_funding ...
repeated cosmos.base.v1beta1.Coin protocol_funding = 7 [
repeated cosmos.base.v1beta1.Coin protocol_funding = 8 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
Expand Down
24 changes: 21 additions & 3 deletions proto/kyve/query/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,31 @@ message FullStaker {

cosmos.staking.v1beta1.Validator validator = 2;

// total_pool_stake returns the amount the validator has in total
// validator_delegators returns the amount of delegators which have delegated
// into this validator
uint64 validator_delegators = 3;

// validator_self_delegation returns the amount in $KYVE the validator has
// personally delegated
uint64 validator_self_delegation = 4;

// validator_unbonding returns the amount in $KYVE the validator is currently
// unbonding from his validator
uint64 validator_unbonding = 5;

// validator_total_pool_stake returns the amount the validator has in total
// staked in all his pools
uint64 total_pool_stake = 3;
uint64 validator_total_pool_stake = 6;

repeated cosmos.base.v1beta1.Coin validator_commission_rewards = 7 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];

// pools is a list of all pools the staker is currently
// participating, i.e. allowed to vote and upload data.
repeated PoolMembership pools = 4;
repeated PoolMembership pools = 8;
}

// CommissionChangeEntry shows when the old commission
Expand Down
5 changes: 4 additions & 1 deletion testutil/integration/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ func (suite *KeeperTestSuite) VerifyPoolQueries() {

for _, poolAccount := range poolAccounts {
if _, stakerFound := suite.App().StakersKeeper.GetValidator(suite.Ctx(), poolAccount.Staker); stakerFound {
stakersByPoolState = append(stakersByPoolState, *suite.App().QueryKeeper.GetFullStaker(suite.Ctx(), poolAccount.Staker))
fullStaker, err := suite.App().QueryKeeper.GetFullStaker(suite.Ctx(), poolAccount.Staker)
if err == nil {
stakersByPoolState = append(stakersByPoolState, *fullStaker)
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions util/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ type StakingKeeper interface {
GetDelegatorBonded(ctx context.Context, delegator sdk.AccAddress) (math.Int, error)
GetDelegatorValidators(ctx context.Context, delegatorAddr sdk.AccAddress, maxRetrieve uint32) (stakingtypes.Validators, error)
GetDelegatorUnbonding(ctx context.Context, delegator sdk.AccAddress) (math.Int, error)
IterateDelegatorUnbondingDelegations(ctx context.Context, delegator sdk.AccAddress, cb func(ubd stakingtypes.UnbondingDelegation) (stop bool)) error
GetValidatorDelegations(ctx context.Context, valAddr sdk.ValAddress) (delegations []stakingtypes.Delegation, err error)
GetDelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (stakingtypes.Delegation, error)
}

type UpgradeKeeper interface {
Expand Down
Loading
Loading