Skip to content

Commit

Permalink
fix: added test case for points
Browse files Browse the repository at this point in the history
  • Loading branch information
troykessler committed Jul 24, 2024
1 parent 3910277 commit 43dd958
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
12 changes: 6 additions & 6 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,25 +141,25 @@ genesis:
max_voting_power_per_pool: "1"
pool_count: "1"
pool_list:
- config: "{\"network\":\"kyve-1\",\"rpc\":\"https://rpc.kyve.network\"}"
- config: "{\"network\":\"archway-1\",\"rpc\":\"http://ovh-protocol-4:21002\"}"
current_compression_id: "1"
current_index: "0"
current_key: ""
current_storage_provider_id: "3"
current_summary: ""
id: "0"
logo: "ar://WOiYR7qF7G_dp6eO0bFC7AorS7601qgek3X_IeAZook"
logo: "ar://hKb8dVx4E1NCUJ_BlhNOcyfQEta5r38SBXqsfPnAsWE"
max_bundle_size: "100"
min_delegation: "100000000"
name: "KYVE"
name: "Archway"
inflation_share_weight: "1"
disabled: false
runtime: '@kyvejs/tendermint'
start_key: "1"
start_key: "5626500"
total_bundles: "0"
upload_interval: "60"
protocol:
version: "1.1.6"
version: "1.2.0"
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 @@ -224,4 +224,4 @@ validators:
config:
consensus:
timeout_commit: "2s"
timeout_propose: "2s"
timeout_propose: "2s"
7 changes: 5 additions & 2 deletions x/bundles/keeper/logic_bundles.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,12 @@ func (k Keeper) GetVoteDistribution(ctx sdk.Context, poolId uint64) (voteDistrib

// tallyBundleProposal evaluates the votes of a bundle proposal and determines the outcome
func (k Keeper) tallyBundleProposal(ctx sdk.Context, bundleProposal types.BundleProposal, poolId uint64) (types.TallyResult, error) {
// Increase points of stakers who did not vote at all + slash + remove if necessary.
// Increase points of stakers who did not vote at all + slash + remove if there is a bundle proposal.
// The protocol requires everybody to stay always active.
k.handleNonVoters(ctx, poolId)
// TODO why does this not fix the unit test?
if bundleProposal.StorageId != "" {
k.handleNonVoters(ctx, poolId)
}

// evaluate all votes and determine status based on the votes weighted with stake + delegation
voteDistribution := k.GetVoteDistribution(ctx, poolId)
Expand Down
7 changes: 7 additions & 0 deletions x/bundles/keeper/msg_server_skip_uploader_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() {
// check that the bundle is not finalized
_, found = s.App().BundlesKeeper.GetFinalizedBundle(s.Ctx(), 0, 0)
Expect(found).To(BeFalse())

// check if no validator got a point
// TODO: make this work
valaccounts := s.App().StakersKeeper.GetAllValaccountsOfPool(s.Ctx(), 0)
for _, valaccount := range valaccounts {
Expect(valaccount.Points).To(BeZero())
}
})

It("Skip uploader role on data bundle with current round containing a valid bundle", func() {
Expand Down

0 comments on commit 43dd958

Please sign in to comment.