Skip to content

Commit 3023220

Browse files
fix rewards tests to reflect param changes
1 parent b0c93c8 commit 3023220

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration-tests/src/gigahdx_rewards.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,13 @@ fn rewards_should_ignore_split_votes() {
462462
},
463463
));
464464

465-
// Split votes are dropped silently by `on_before_vote` — no record,
466-
// no live-tally entry.
467-
assert!(pallet_gigahdx_rewards::UserVoteRecords::<Runtime>::get(&alice, r).is_none());
468-
assert!(pallet_gigahdx_rewards::ReferendaTotalWeightedVotes::<Runtime>::get(r).is_none());
465+
// Split votes ARE recorded (with weighted=0) so liquidation's
466+
// clearance adapter can find them — but they earn no rewards.
467+
let rec = pallet_gigahdx_rewards::UserVoteRecords::<Runtime>::get(&alice, r).unwrap();
468+
assert_eq!(rec.weighted, 0);
469+
let tally = pallet_gigahdx_rewards::ReferendaTotalWeightedVotes::<Runtime>::get(r).unwrap();
470+
assert_eq!(tally.total_weighted, 0);
471+
assert_eq!(tally.voters_count, 1);
469472

470473
end_referendum();
471474
let accumulator_before = Balances::free_balance(&GigaHdxRewards::reward_accumulator_pot());
@@ -474,11 +477,11 @@ fn rewards_should_ignore_split_votes() {
474477
Some(ROOT_TRACK_CLASS),
475478
r,
476479
));
480+
// Allocation briefly fires (pot moves out), but every voter has
481+
// weighted=0 so all of `remaining_reward` is refunded back to the
482+
// accumulator → net change is zero.
477483
let accumulator_after = Balances::free_balance(&GigaHdxRewards::reward_accumulator_pot());
478-
assert_eq!(
479-
accumulator_after, accumulator_before,
480-
"split votes must not trigger a pool allocation",
481-
);
484+
assert_eq!(accumulator_after, accumulator_before);
482485
assert_eq!(pallet_gigahdx_rewards::PendingRewards::<Runtime>::get(&alice), 0);
483486
assert!(pallet_gigahdx_rewards::ReferendaRewardPool::<Runtime>::get(r).is_none());
484487
});
@@ -691,8 +694,11 @@ fn rewards_should_ignore_split_abstain_votes() {
691694
},
692695
));
693696

694-
assert!(pallet_gigahdx_rewards::UserVoteRecords::<Runtime>::get(&alice, r).is_none());
695-
assert!(pallet_gigahdx_rewards::ReferendaTotalWeightedVotes::<Runtime>::get(r).is_none());
697+
let rec = pallet_gigahdx_rewards::UserVoteRecords::<Runtime>::get(&alice, r).unwrap();
698+
assert_eq!(rec.weighted, 0);
699+
let tally = pallet_gigahdx_rewards::ReferendaTotalWeightedVotes::<Runtime>::get(r).unwrap();
700+
assert_eq!(tally.total_weighted, 0);
701+
assert_eq!(tally.voters_count, 1);
696702

697703
end_referendum();
698704
let accumulator_before = Balances::free_balance(&GigaHdxRewards::reward_accumulator_pot());

0 commit comments

Comments
 (0)