Skip to content

Commit

Permalink
remove prints
Browse files Browse the repository at this point in the history
  • Loading branch information
Longarithm committed Jun 6, 2024
1 parent 30ab403 commit 66d9c8d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
3 changes: 0 additions & 3 deletions chain/epoch-manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@ impl EpochManager {
let mut chunk_stats = ChunkValidatorStats::default();
for (_, tracker) in chunk_validator_tracker.iter() {
if let Some(stat) = tracker.get(&(i as u64)) {
println!("{i} FOUND STAT {stat:?}");
*chunk_stats.expected_mut() += stat.expected();
*chunk_stats.produced_mut() += stat.produced();
chunk_stats.endorsement_stats_mut().produced +=
Expand All @@ -508,7 +507,6 @@ impl EpochManager {
stat.endorsement_stats().expected;
}
}
println!("{i} {:?}", chunk_stats);
total_stake += v.stake();
let is_already_kicked_out = prev_validator_kickout.contains_key(account_id);
if (max_validator.is_none() || block_stats.produced > maximum_block_prod)
Expand Down Expand Up @@ -601,7 +599,6 @@ impl EpochManager {
version_tracker,
..
} = self.get_epoch_info_aggregator_upto_last(last_block_hash)?;
println!("{:?}", chunk_validator_tracker);
let mut proposals = vec![];
let mut validator_kickout = HashMap::new();

Expand Down
18 changes: 12 additions & 6 deletions chain/epoch-manager/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,7 @@ fn test_chunk_validator_kickout() {
let total_supply = stake_amount * validators.len() as u128;
let num_shards = 2;
let epoch_config =
epoch_config_with_production_config(epoch_length, num_shards, 2, 2, 0, 0, 75, false);
epoch_config_with_production_config(epoch_length, num_shards, 2, 2, 90, 40, 75, false);
let mut em = EpochManager::new(
create_test_store(),
epoch_config,
Expand All @@ -1553,10 +1553,6 @@ fn test_chunk_validator_kickout() {
for (prev_block, (height, curr_block)) in hashes.iter().zip(hashes.iter().enumerate().skip(1)) {
let height = height as u64;
let epoch_id = em.get_epoch_id_from_prev_block(prev_block).unwrap();
let ei = em.get_epoch_info(&epoch_id).unwrap();
println!("{:?}", ei.block_producers_settlement());
println!("{:?}", ei.chunk_producers_settlement());
println!("{:?}", ei.validator_mandates());
let chunk_mask = if height < epoch_length {
(0..num_shards).map(|i| (height + i) % 2 == 0).collect()
} else {
Expand All @@ -1579,11 +1575,21 @@ fn test_chunk_validator_kickout() {
}

let last_epoch_info = hashes.iter().filter_map(|x| em.get_epoch_info(&EpochId(*x)).ok()).last();
let total_expected_chunks = num_shards * (epoch_length - 1);
// Every second chunk is skipped.
let total_produced_chunks = total_expected_chunks / 2;

// Chunk producers skip only every second chunk and pass the threshold.
// Chunk validator validates all chunks, so its performance is determined
// by the chunk production ratio, which is not enough.
assert_eq!(
last_epoch_info.unwrap().validator_kickout(),
&[(
"test2".parse().unwrap(),
NotEnoughChunkEndorsements { produced: 0, expected: num_shards * epoch_length }
NotEnoughChunkEndorsements {
produced: total_produced_chunks,
expected: total_expected_chunks
}
)]
.into_iter()
.collect::<HashMap<_, _>>(),
Expand Down

0 comments on commit 66d9c8d

Please sign in to comment.