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

NPG 1368 Drepp rewards #173

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all 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
18 changes: 17 additions & 1 deletion catalyst-toolbox/src/rewards/dreps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,18 @@ mod tests {
use std::collections::HashMap;
use test_strategy::proptest;

const DEFAULT_SNAPSHOT_THRESHOLD: u64 = 1;

#[proptest]
fn test_small(snapshot: Snapshot) {
fn test_small(raw_snapshot: RawSnapshot) {

let snapshot = Snapshot::from_raw_snapshot(
raw_snapshot,
DEFAULT_SNAPSHOT_THRESHOLD.into(),
Fraction::from(1),
&|_vk: &Identifier| String::new(),
).unwrap();

let voting_keys = snapshot.voting_keys().collect::<Vec<_>>();

let votes_count = voting_keys
Expand All @@ -113,7 +123,11 @@ mod tests {
)
})
.collect::<VoteCount>();

//println!("Vote count: {:?}", votes_count);

let voters = snapshot.to_full_snapshot_info();

let voters_active = voters
.clone()
.into_iter()
Expand All @@ -131,6 +145,7 @@ mod tests {
Rewards::ONE,
)
.unwrap();

let rewards_no_inactive = calc_dreps_rewards(
voters_active,
votes_count,
Expand All @@ -140,6 +155,7 @@ mod tests {
Rewards::ONE,
)
.unwrap();

// Rewards should ignore inactive voters
prop_assert_eq!(rewards, rewards_no_inactive);
}
Expand Down