Skip to content

Commit

Permalink
audit fixes unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
psorinionut committed Nov 22, 2024
1 parent b7064ef commit 1225e73
Show file tree
Hide file tree
Showing 3 changed files with 457 additions and 1 deletion.
4 changes: 4 additions & 0 deletions launchpad-common/src/winner_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ pub trait WinnerSelectionModule:

let (mut rng, mut ticket_position) = self.load_select_winners_operation();
let run_result = self.run_while_it_has_gas(|| {
if nr_winning_tickets == 0 {
return STOP_OP;
}

self.shuffle_single_ticket(&mut rng, ticket_position, last_ticket_position);

if ticket_position == nr_winning_tickets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ where
);
sc.add_tickets_endpoint(args);

// 1 ticket for the max tier gets removed
// 1 ticket for the guaranteed entry gets removed
assert_eq!(sc.nr_winning_tickets().get(), nr_winning_tickets - 1);
assert_eq!(sc.users_with_guaranteed_ticket().len(), 1);
assert!(sc
Expand Down
Loading

0 comments on commit 1225e73

Please sign in to comment.