Skip to content

Commit

Permalink
finished valaccount renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
troykessler committed Dec 23, 2024
1 parent 8aebdd1 commit 71e7a13
Show file tree
Hide file tree
Showing 25 changed files with 284 additions and 284 deletions.
18 changes: 9 additions & 9 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -875,8 +875,8 @@ paths:
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 @@ -4414,8 +4414,8 @@ paths:
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 @@ -7008,8 +7008,8 @@ paths:
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 @@ -7670,7 +7670,7 @@ paths:
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 @@ -8436,7 +8436,7 @@ paths:
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 @@ -9111,7 +9111,7 @@ paths:
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
2 changes: 1 addition & 1 deletion proto/kyve/query/v1beta1/bundles.proto
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ message QueryCurrentVoteStatusResponse {
}

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

// QueryCanProposeRequest is the request type for the Query/CanPropose RPC method.
Expand Down
2 changes: 1 addition & 1 deletion proto/kyve/query/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ message PoolMembership {
string pool_address = 4;

// 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
uint64 balance = 5;

Expand Down
20 changes: 10 additions & 10 deletions testutil/integration/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ func (suite *KeeperTestSuite) VerifyPoolQueries() {
valaccounts := 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 valaccounts {
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.GetPoolAccount(suite.Ctx(), stakerAddress, poolMembership.Pool.Id)
poolAccount, active := suite.App().StakersKeeper.GetPoolAccount(suite.Ctx(), stakerAddress, poolMembership.Pool.Id)
Expect(active).To(BeTrue())

Expect(poolMembership.PoolAddress).To(Equal(valaccount.PoolAddress))
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.GetPoolAccountsFromStaker(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
42 changes: 21 additions & 21 deletions x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() {
Expect(poolStakers).To(HaveLen(2))

// check if next uploader received a point
valaccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0)
Expect(valaccount.Points).To(Equal(uint64(1)))
poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0)
Expect(poolAccount.Points).To(Equal(uint64(1)))

_, found := s.App().StakersKeeper.GetValidator(s.Ctx(), i.STAKER_0)
Expect(found).To(BeTrue())
Expand Down Expand Up @@ -561,12 +561,12 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() {
Expect(poolStakers).To(HaveLen(2))

// check that staker 0 has no points
valaccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0)
Expect(valaccount.Points).To(Equal(uint64(0)))
poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0)
Expect(poolAccount.Points).To(Equal(uint64(0)))

// check that staker 1 (next uploader) received a point for not uploading
valaccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0)
Expect(valaccount.Points).To(Equal(uint64(1)))
poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0)
Expect(poolAccount.Points).To(Equal(uint64(1)))

// check that nobody got slashed
expectedBalance := 100 * i.KYVE
Expand Down Expand Up @@ -621,12 +621,12 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() {
Expect(poolStakers).To(ContainElements(i.STAKER_0, i.STAKER_1))

// check that staker 0 (uploader) has no points
valaccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0)
Expect(valaccount.Points).To(Equal(uint64(0)))
poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_0, 0)
Expect(poolAccount.Points).To(Equal(uint64(0)))

// check that staker 1 received a point for not voting
valaccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0)
Expect(valaccount.Points).To(Equal(uint64(1)))
poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0)
Expect(poolAccount.Points).To(Equal(uint64(1)))

// check that nobody got slashed
expectedBalance := 100 * i.KYVE
Expand Down Expand Up @@ -715,12 +715,12 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() {
Expect(poolStakers).To(ContainElements(i.STAKER_1, i.STAKER_2))

// check that staker 1 (next uploader) received a point for missing the upload
valaccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0)
Expect(valaccount.Points).To(Equal(uint64(1)))
poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0)
Expect(poolAccount.Points).To(Equal(uint64(1)))

// check that staker 2 has a no points
valaccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0)
Expect(valaccount.Points).To(Equal(uint64(0)))
poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0)
Expect(poolAccount.Points).To(Equal(uint64(0)))

// check that staker 0 (uploader) got slashed
expectedBalance := 100*i.KYVE - uint64(s.App().StakersKeeper.GetUploadSlash(s.Ctx()).Mul(math.LegacyNewDec(int64(100*i.KYVE))).TruncateInt64())
Expand Down Expand Up @@ -845,12 +845,12 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() {
Expect(poolStakers).To(ContainElements(i.STAKER_0, i.STAKER_1))

// check that staker 0 (uploader) has no points
valaccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0)
Expect(valaccount.Points).To(Equal(uint64(0)))
poolAccount, _ := s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_1, 0)
Expect(poolAccount.Points).To(Equal(uint64(0)))

// check that staker 2 has a no points
valaccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0)
Expect(valaccount.Points).To(Equal(uint64(0)))
poolAccount, _ = s.App().StakersKeeper.GetPoolAccount(s.Ctx(), i.STAKER_2, 0)
Expect(poolAccount.Points).To(Equal(uint64(0)))

// check that staker 0 (uploader) didn't get slashed
expectedBalance := 100 * i.KYVE
Expand Down Expand Up @@ -1004,7 +1004,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() {
BundleSummary: "test_value",
})

// remove valaccount directly from pool
// remove pool account directly from pool
s.App().StakersKeeper.RemovePoolAccountFromPool(s.Ctx(), i.STAKER_1, 0)

// ACT
Expand Down Expand Up @@ -1086,7 +1086,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() {
Vote: bundletypes.VOTE_TYPE_VALID,
})

// remove valaccount directly from pool
// remove pool account directly from pool
s.App().StakersKeeper.RemovePoolAccountFromPool(s.Ctx(), i.STAKER_1, 0)

// ACT
Expand Down Expand Up @@ -1174,7 +1174,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() {
Vote: bundletypes.VOTE_TYPE_INVALID,
})

// remove valaccount directly from pool
// remove pool account directly from pool
s.App().StakersKeeper.RemovePoolAccountFromPool(s.Ctx(), i.STAKER_0, 0)

// ACT
Expand Down
8 changes: 4 additions & 4 deletions x/bundles/keeper/msg_server_claim_uploader_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ TEST CASES - msg_server_claim_uploader_role.go
* Try to claim uploader role without pool being funded
* Try to claim uploader role without being a staker
* Try to claim uploader role if the next uploader is not set yet
* Try to claim uploader role with non-existing valaccount
* Try to claim uploader role with valaccount that belongs to another pool
* Try to claim uploader role with non-existing pool account
* Try to claim uploader role with pool account that belongs to another pool
*/

Expand Down Expand Up @@ -155,7 +155,7 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() {
Expect(bundleProposal.VotersAbstain).To(BeEmpty())
})

It("Try to claim uploader role with non existing valaccount", func() {
It("Try to claim uploader role with non existing pool account", func() {
// ARRANGE
s.RunTxPoolSuccess(&funderstypes.MsgFundPool{
Creator: i.ALICE,
Expand All @@ -176,7 +176,7 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() {
Expect(found).To(BeFalse())
})

It("Try to claim uploader role with valaccount that belongs to another pool", func() {
It("Try to claim uploader role with pool account that belongs to another pool", func() {
// ARRANGE
s.RunTxPoolSuccess(&funderstypes.MsgFundPool{
Creator: i.ALICE,
Expand Down
34 changes: 17 additions & 17 deletions x/bundles/keeper/msg_server_skip_uploader_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() {
Expect(found).To(BeFalse())

// check that no validator got a point for the second round
valaccounts := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0)
for _, valaccount := range valaccounts {
Expect(valaccount.Points).To(BeZero())
poolAccounts := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0)
for _, poolAccount := range poolAccounts {
Expect(poolAccount.Points).To(BeZero())
}
})

Expand Down Expand Up @@ -248,9 +248,9 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() {
Expect(found).To(BeFalse())

// check that no validator got a point for the second round
valaccounts := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0)
for _, valaccount := range valaccounts {
Expect(valaccount.Points).To(BeZero())
poolAccounts := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0)
for _, poolAccount := range poolAccounts {
Expect(poolAccount.Points).To(BeZero())
}
})

Expand Down Expand Up @@ -297,13 +297,13 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() {
Expect(found).To(BeFalse())

// check that no validator got a point for the second round
valaccounts := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0)
for _, valaccount := range valaccounts {
if valaccount.Staker == i.STAKER_0 {
Expect(valaccount.Points).To(BeZero())
poolAccounts := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0)
for _, poolAccount := range poolAccounts {
if poolAccount.Staker == i.STAKER_0 {
Expect(poolAccount.Points).To(BeZero())
} else {
// All others have one point because they did not vote at all
Expect(valaccount.Points).To(Equal(uint64(1)))
Expect(poolAccount.Points).To(Equal(uint64(1)))
}
}
})
Expand Down Expand Up @@ -364,9 +364,9 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() {
Expect(finalizedBundle.Uploader).To(Equal(i.STAKER_0))

// check if no validator got a point for the second round
valaccounts := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0)
for _, valaccount := range valaccounts {
Expect(valaccount.Points).To(BeZero())
poolAccounts := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0)
for _, poolAccount := range poolAccounts {
Expect(poolAccount.Points).To(BeZero())
}
})

Expand Down Expand Up @@ -423,9 +423,9 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() {
Expect(found).To(BeFalse())

// check that no validator got a point
valaccounts := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0)
for _, valaccount := range valaccounts {
Expect(valaccount.Points).To(BeZero())
poolAccounts := s.App().StakersKeeper.GetAllPoolAccountsOfPool(s.Ctx(), 0)
for _, poolAccount := range poolAccounts {
Expect(poolAccount.Points).To(BeZero())
}
})
})
2 changes: 1 addition & 1 deletion x/bundles/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type StakerKeeper interface {
GetAllStakerAddressesOfPool(ctx sdk.Context, poolId uint64) (stakers []string)
AssertPoolAccountAuthorized(ctx sdk.Context, stakerAddress string, poolId uint64, poolAddress string) error

GetPoolAccount(ctx sdk.Context, stakerAddress string, poolId uint64) (valaccount stakersTypes.PoolAccount, active bool)
GetPoolAccount(ctx sdk.Context, stakerAddress string, poolId uint64) (poolAccount stakersTypes.PoolAccount, active bool)

LeavePool(ctx sdk.Context, stakerAddress string, poolId uint64)

Expand Down
4 changes: 2 additions & 2 deletions x/query/keeper/grpc_query_can_propose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ TEST CASES - grpc_query_can_propose.go
* Call can propose if pool is disabled
* Call can propose if pool is out of funds
* Call can propose if pool has not reached the minimum stake
* Call can propose with a valaccount which does not exist
* Call can propose with a pool account which does not exist
* Call can propose as a staker who is not the next uploader
* Call can propose before the upload interval passed
* Call can propose with an invalid from height
Expand Down Expand Up @@ -280,7 +280,7 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() {
Expect(txErr.Error()).To(Equal(canPropose.Reason))
})

It("Call can propose with a valaccount which does not exist", func() {
It("Call can propose with a pool account which does not exist", func() {
// ACT
canPropose, err := s.App().QueryKeeper.CanPropose(s.Ctx(), &querytypes.QueryCanProposeRequest{
PoolId: 0,
Expand Down
4 changes: 2 additions & 2 deletions x/query/keeper/grpc_query_can_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (k Keeper) CanValidate(c context.Context, req *types.QueryCanValidateReques

var staker string

// Check if valaddress has a valaccount in pool
// Check if pool address has a pool account in pool
for _, poolAccount := range k.stakerKeeper.GetAllPoolAccountsOfPool(ctx, req.PoolId) {
if poolAccount.PoolAddress == req.PoolAddress {
staker = poolAccount.Staker
Expand All @@ -36,7 +36,7 @@ func (k Keeper) CanValidate(c context.Context, req *types.QueryCanValidateReques
if staker == "" {
return &types.QueryCanValidateResponse{
Possible: false,
Reason: "no valaccount found",
Reason: "no pool account found",
}, nil
}

Expand Down
Loading

0 comments on commit 71e7a13

Please sign in to comment.