Skip to content

Commit

Permalink
[consensus] set stake threshold override for msim tests (MystenLabs#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
arun-koshy authored May 12, 2024
1 parent dd97d3d commit 7ac16a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion consensus/core/src/leader_schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,12 @@ impl LeaderSwapTable {
pub(crate) fn new(
context: Arc<Context>,
reputation_scores: ReputationScores,
swap_stake_threshold: u64,
// Needed to prevent linter warning in simtests
#[allow(unused_variables)] swap_stake_threshold: u64,
) -> Self {
#[cfg(msim)]
let swap_stake_threshold = 33;

assert!(
(0..=33).contains(&swap_stake_threshold),
"The swap_stake_threshold ({swap_stake_threshold}) should be in range [0 - 33], out of bounds parameter detected"
Expand Down
2 changes: 1 addition & 1 deletion consensus/core/src/leader_scoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl<'a> ReputationScoreCalculator<'a> {

pub(crate) fn calculate(&mut self) -> ReputationScores {
let leaders = self.unscored_subdag.committed_leaders.clone();
for leader in leaders.into_iter() {
for leader in leaders {
let leader_slot = Slot::from(leader);
tracing::trace!("Calculating score for leader {leader_slot}");
self.add_scores(
Expand Down

0 comments on commit 7ac16a8

Please sign in to comment.