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

feat: max pool voting power #211

Merged
merged 16 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 15 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ An '!' indicates a state machine breaking change.

- ! (`x/stakers`) [#209](https://github.com/KYVENetwork/chain/pull/209) Shared Staking: Consensus-validator stake is now used for the protocol.
- ! (`x/stakers`) [#210](https://github.com/KYVENetwork/chain/pull/210) Shared Staking: Pool specific commission and stake fraction.
- ! (`x/stakers`) [#211](https://github.com/KYVENetwork/chain/pull/211) Shared Staking: Maximum voting power per pool.

### Bug Fixes

Expand Down
10 changes: 8 additions & 2 deletions proto/kyve/stakers/v1beta1/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,14 @@ message EventSlash {
uint64 pool_id = 1;
// staker is the account address of the protocol node.
string staker = 2;
// amount ...
// amount is the total amount that got slashed
uint64 amount = 3;
// slash_type
// slash_type is the type of the protocol slash
SlashType slash_type = 4;
// stake_fraction is the percentage of how much of the validators total
// bonded amount was under risk for slashing
string stake_fraction = 5 [
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
];
}
4 changes: 2 additions & 2 deletions testutil/integration/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (suite *KeeperTestSuite) VerifyPoolQueries() {
for i := range poolsState {
bundleProposalState, _ := suite.App().BundlesKeeper.GetBundleProposal(suite.Ctx(), poolsState[i].Id)
stakersState := suite.App().StakersKeeper.GetAllStakerAddressesOfPool(suite.Ctx(), poolsState[i].Id)
totalDelegationState := suite.App().StakersKeeper.GetDelegationOfPool(suite.Ctx(), poolsState[i].Id)
totalDelegationState := suite.App().StakersKeeper.GetTotalStakeOfPool(suite.Ctx(), poolsState[i].Id)

Expect(poolsQuery[i].Id).To(Equal(poolsState[i].Id))
Expect(*poolsQuery[i].Data).To(Equal(poolsState[i]))
Expand Down Expand Up @@ -175,7 +175,7 @@ func (suite *KeeperTestSuite) VerifyStakersModuleAssetsIntegrity() {
func (suite *KeeperTestSuite) VerifyPoolTotalStake() {
for _, pool := range suite.App().PoolKeeper.GetAllPools(suite.Ctx()) {
expectedBalance := uint64(0)
actualBalance := suite.App().StakersKeeper.GetDelegationOfPool(suite.Ctx(), pool.Id)
actualBalance := suite.App().StakersKeeper.GetTotalStakeOfPool(suite.Ctx(), pool.Id)

for _, stakerAddress := range suite.App().StakersKeeper.GetAllStakerAddressesOfPool(suite.Ctx(), pool.Id) {
expectedBalance += suite.App().StakersKeeper.GetValidatorPoolStake(suite.Ctx(), stakerAddress, pool.Id)
Expand Down
12 changes: 12 additions & 0 deletions util/arrays.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,15 @@ func ContainsString(array []string, match string) bool {
}
return false
}

func RemoveDuplicateStrings(strSlice []string) []string {
allKeys := make(map[string]bool)
list := []string{}
for _, item := range strSlice {
if _, value := allKeys[item]; !value {
allKeys[item] = true
list = append(list, item)
}
}
return list
}
Loading
Loading