Skip to content

Commit

Permalink
chore: pool account renaming (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
troykessler authored Dec 23, 2024
1 parent 9425f41 commit 37f0e06
Show file tree
Hide file tree
Showing 79 changed files with 2,057 additions and 2,051 deletions.
80 changes: 40 additions & 40 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -858,25 +858,25 @@ paths:

the staker will no longer participate in that
pool
valaddress:
pool_address:
type: string
description: >-
Valaddress is the address which is authorized
to vote
pool address is the address which is
authorized to vote

and submit bundles. If the server gets
compromised

the staker can just change the valaddress.
the staker can just change the pool address .
balance:
type: string
format: uint64
title: >-
balance is the valaddress account balance and
indicates
balance is the pool address account balance
and indicates

whether or not the valaccount needs additional
funds to
whether or not the pool account needs
additional funds to

pay for gas fees
commission:
Expand Down Expand Up @@ -2053,7 +2053,7 @@ paths:
format: uint64
tags:
- QueryBundles
/kyve/query/v1beta1/can_validate/{pool_id}/{valaddress}:
/kyve/query/v1beta1/can_validate/{pool_id}/{pool_address}:
get:
summary: CanValidate ...
operationId: CanValidate
Expand Down Expand Up @@ -2270,8 +2270,8 @@ paths:
required: true
type: string
format: uint64
- name: valaddress
description: valaddress ...
- name: pool_address
description: pool_address ...
in: path
required: true
type: string
Expand Down Expand Up @@ -4397,25 +4397,25 @@ paths:

the staker will no longer participate in that
pool
valaddress:
pool_address:
type: string
description: >-
Valaddress is the address which is authorized
to vote
pool address is the address which is
authorized to vote

and submit bundles. If the server gets
compromised

the staker can just change the valaddress.
the staker can just change the pool address .
balance:
type: string
format: uint64
title: >-
balance is the valaddress account balance and
indicates
balance is the pool address account balance
and indicates

whether or not the valaccount needs additional
funds to
whether or not the pool account needs
additional funds to

pay for gas fees
commission:
Expand Down Expand Up @@ -6992,24 +6992,24 @@ paths:
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:
pool_address:
type: string
description: >-
Valaddress is the address which is authorized to
pool address is the address which is authorized to
vote

and submit bundles. If the server gets compromised

the staker can just change the valaddress.
the staker can just change the pool address .
balance:
type: string
format: uint64
title: >-
balance is the valaddress account balance and
balance is the pool address account balance and
indicates

whether or not the valaccount needs additional funds
to
whether or not the pool account needs additional
funds to

pay for gas fees
commission:
Expand Down Expand Up @@ -7654,23 +7654,23 @@ paths:
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:
pool_address:
type: string
description: >-
Valaddress is the address which is authorized to
pool address is the address which is authorized to
vote

and submit bundles. If the server gets compromised

the staker can just change the valaddress.
the staker can just change the pool address .
balance:
type: string
format: uint64
title: >-
balance is the valaddress account balance and
balance is the pool address account balance and
indicates

whether or not the valaccount needs additional
whether or not the pool account needs additional
funds to

pay for gas fees
Expand Down Expand Up @@ -8420,23 +8420,23 @@ paths:
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:
pool_address:
type: string
description: >-
Valaddress is the address which is authorized to
pool address is the address which is authorized to
vote

and submit bundles. If the server gets compromised

the staker can just change the valaddress.
the staker can just change the pool address .
balance:
type: string
format: uint64
title: >-
balance is the valaddress account balance and
balance is the pool address account balance and
indicates

whether or not the valaccount needs additional
whether or not the pool account needs additional
funds to

pay for gas fees
Expand Down Expand Up @@ -9095,23 +9095,23 @@ paths:
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:
pool_address:
type: string
description: >-
Valaddress is the address which is authorized to
pool address is the address which is authorized to
vote

and submit bundles. If the server gets compromised

the staker can just change the valaddress.
the staker can just change the pool address .
balance:
type: string
format: uint64
title: >-
balance is the valaddress account balance and
balance is the pool address account balance and
indicates

whether or not the valaccount needs additional
whether or not the pool account needs additional
funds to

pay for gas fees
Expand Down
8 changes: 4 additions & 4 deletions proto/kyve/query/v1beta1/bundles.proto
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ service QueryBundles {

// CanValidate ...
rpc CanValidate(QueryCanValidateRequest) returns (QueryCanValidateResponse) {
option (google.api.http).get = "/kyve/query/v1beta1/can_validate/{pool_id}/{valaddress}";
option (google.api.http).get = "/kyve/query/v1beta1/can_validate/{pool_id}/{pool_address}";
}

// CanPropose ...
Expand Down Expand Up @@ -182,15 +182,15 @@ message QueryCurrentVoteStatusResponse {
}

// ===================================
// can_validate/{pool_id}/{valaddress}
// can_validate/{pool_id}/{pool_address}
// ===================================

// QueryCanProposeRequest is the request type for the Query/CanPropose RPC method.
message QueryCanValidateRequest {
// pool_id defines the unique ID of the pool.
uint64 pool_id = 1;
// valaddress ...
string valaddress = 2;
// pool_address ...
string pool_address = 2;
}

// QueryCanProposeResponse is the response type for the Query/CanPropose RPC method.
Expand Down
10 changes: 5 additions & 5 deletions proto/kyve/query/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ message PoolMembership {
// the staker will no longer participate in that pool
bool is_leaving = 3;

// Valaddress is the address which is authorized to vote
// pool address is the address which is authorized to vote
// and submit bundles. If the server gets compromised
// the staker can just change the valaddress.
string valaddress = 4;
// the staker can just change the pool address .
string pool_address = 4;

// balance is the valaddress account balance and indicates
// whether or not the valaccount needs additional funds to
// balance is the pool address account balance and indicates
// whether or not the pool account needs additional funds to
// pay for gas fees
uint64 balance = 5;

Expand Down
6 changes: 3 additions & 3 deletions proto/kyve/stakers/v1beta1/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ message EventJoinPool {
uint64 pool_id = 1;
// staker is the address of the staker
string staker = 2;
// valaddress is the address of the protocol node which
// pool_address is the address of the protocol node which
// votes in favor of the staker
string valaddress = 3;
// amount is the amount of funds transferred to the valaddress
string pool_address = 3;
// amount is the amount of funds transferred to the pool address
uint64 amount = 4;
// commission ...
string commission = 5 [
Expand Down
4 changes: 2 additions & 2 deletions proto/kyve/stakers/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ message GenesisState {
Params params = 1 [(gogoproto.nullable) = false];
// staker_list ...
repeated Staker staker_list = 2 [(gogoproto.nullable) = false];
// valaccount_list ...
repeated Valaccount valaccount_list = 3 [(gogoproto.nullable) = false];
// pool_account_list ...
repeated PoolAccount pool_account_list = 3 [(gogoproto.nullable) = false];
// commission_change_entries ...
repeated CommissionChangeEntry commission_change_entries = 4 [(gogoproto.nullable) = false];
// queue_state_commission ...
Expand Down
16 changes: 10 additions & 6 deletions proto/kyve/stakers/v1beta1/stakers.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,21 @@ message Staker {
];
}

// Valaccount gets authorized by a staker to
// vote in a given pool by favor of the staker.
message Valaccount {
// PoolAccount gets authorized by a validator to
// vote in a given pool by favor of the validator.
// The pool account basically acts like an operator
// here so the validator private key can be stored
// securely and not on a remote server where
// the pool account will operate
message PoolAccount {
// pool_id defines the pool in which the address
// is allowed to vote in.
uint64 pool_id = 1;
// staker is the address the valaccount is voting for.
// staker is the address validator
string staker = 2;
// valaddress is the account stored on the protocol
// pool_address is the account stored on the protocol
// node which votes for the staker in the given pool
string valaddress = 3;
string pool_address = 3;
// 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.
Expand Down
4 changes: 2 additions & 2 deletions proto/kyve/stakers/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ message MsgJoinPool {
string creator = 1;
// pool_id ...
uint64 pool_id = 2;
// valaddress ...
string valaddress = 3;
// pool_address ...
string pool_address = 3;
// amount ...
uint64 amount = 4;
// commission ...
Expand Down
22 changes: 11 additions & 11 deletions testutil/integration/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ func (suite *KeeperTestSuite) VerifyPoolQueries() {
Expect(poolByIdQuery.Pool.TotalDelegation).To(Equal(totalDelegationState))

// test stakers by pool
valaccounts := suite.App().StakersKeeper.GetAllValaccountsOfPool(suite.Ctx(), poolsState[i].Id)
poolAccounts := suite.App().StakersKeeper.GetAllPoolAccountsOfPool(suite.Ctx(), poolsState[i].Id)
stakersByPoolState := make([]querytypes.FullStaker, 0)

for _, valaccount := range valaccounts {
if _, stakerFound := suite.App().StakersKeeper.GetValidator(suite.Ctx(), valaccount.Staker); stakerFound {
stakersByPoolState = append(stakersByPoolState, *suite.App().QueryKeeper.GetFullStaker(suite.Ctx(), valaccount.Staker))
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))
}
}

Expand Down Expand Up @@ -474,14 +474,14 @@ func (suite *KeeperTestSuite) verifyFullStaker(fullStaker querytypes.FullStaker,

for _, poolMembership := range fullStaker.Pools {
poolIds[poolMembership.Pool.Id] = true
valaccount, active := suite.App().StakersKeeper.GetValaccount(suite.Ctx(), poolMembership.Pool.Id, stakerAddress)
poolAccount, active := suite.App().StakersKeeper.GetPoolAccount(suite.Ctx(), stakerAddress, poolMembership.Pool.Id)
Expect(active).To(BeTrue())

Expect(poolMembership.Valaddress).To(Equal(valaccount.Valaddress))
Expect(poolMembership.IsLeaving).To(Equal(valaccount.IsLeaving))
Expect(poolMembership.Points).To(Equal(valaccount.Points))
Expect(poolMembership.PoolAddress).To(Equal(poolAccount.PoolAddress))
Expect(poolMembership.IsLeaving).To(Equal(poolAccount.IsLeaving))
Expect(poolMembership.Points).To(Equal(poolAccount.Points))

pool, found := suite.App().PoolKeeper.GetPool(suite.Ctx(), valaccount.PoolId)
pool, found := suite.App().PoolKeeper.GetPool(suite.Ctx(), poolAccount.PoolId)
Expect(found).To(BeTrue())
Expect(poolMembership.Pool.Id).To(Equal(pool.Id))
Expect(poolMembership.Pool.Logo).To(Equal(pool.Logo))
Expand All @@ -496,8 +496,8 @@ func (suite *KeeperTestSuite) verifyFullStaker(fullStaker querytypes.FullStaker,
}

// Reverse check the pool memberships
for _, valaccount := range suite.App().StakersKeeper.GetValaccountsFromStaker(suite.Ctx(), stakerAddress) {
Expect(poolIds[valaccount.PoolId]).To(BeTrue())
for _, poolAccount := range suite.App().StakersKeeper.GetPoolAccountsFromStaker(suite.Ctx(), stakerAddress) {
Expect(poolIds[poolAccount.PoolId]).To(BeTrue())
}
}

Expand Down
10 changes: 5 additions & 5 deletions testutil/integration/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,22 @@ func (suite *KeeperTestSuite) GetCoinsFromModule(moduleName string) sdk.Coins {
return suite.App().BankKeeper.GetAllBalances(suite.Ctx(), moduleAcc)
}

func (suite *KeeperTestSuite) GetNextUploader() (nextStaker string, nextValaddress string) {
func (suite *KeeperTestSuite) GetNextUploader() (nextStaker string, nextPoolAddress string) {
bundleProposal, _ := suite.App().BundlesKeeper.GetBundleProposal(suite.Ctx(), 0)

switch bundleProposal.NextUploader {
case STAKER_0:
nextStaker = STAKER_0
nextValaddress = VALADDRESS_0_A
nextPoolAddress = POOL_ADDRESS_0_A
case STAKER_1:
nextStaker = STAKER_1
nextValaddress = VALADDRESS_1_A
nextPoolAddress = POOL_ADDRESS_1_A
case STAKER_2:
nextStaker = STAKER_2
nextValaddress = VALADDRESS_2_A
nextPoolAddress = POOL_ADDRESS_2_A
default:
nextStaker = ""
nextValaddress = ""
nextPoolAddress = ""
}

return
Expand Down
Loading

0 comments on commit 37f0e06

Please sign in to comment.