Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Allow unbounded wallclock processing time in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
carllin committed Mar 17, 2021
1 parent 8a9b519 commit 5c0e13f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
11 changes: 3 additions & 8 deletions core/src/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1463,15 +1463,14 @@ mod tests {
}

#[test]
#[ignore]
fn test_banking_stage_entries_only() {
solana_logger::setup();
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(10);
let bank = Arc::new(Bank::new(&genesis_config));
let bank = Arc::new(Bank::new_no_wallclock_throttle(&genesis_config));
let start_hash = bank.last_blockhash();
let (verified_sender, verified_receiver) = unbounded();
let (vote_sender, vote_receiver) = unbounded();
Expand Down Expand Up @@ -1546,7 +1545,7 @@ mod tests {
drop(poh_recorder);

let mut blockhash = start_hash;
let bank = Bank::new(&genesis_config);
let bank = Arc::new(Bank::new_no_wallclock_throttle(&genesis_config));
bank.process_transaction(&fund_tx).unwrap();
//receive entries + ticks
loop {
Expand Down Expand Up @@ -1581,7 +1580,6 @@ mod tests {
}

#[test]
#[ignore]
fn test_banking_stage_entryfication() {
solana_logger::setup();
// In this attack we'll demonstrate that a verifier can interpret the ledger
Expand Down Expand Up @@ -2233,10 +2231,7 @@ mod tests {
mint_keypair,
..
} = create_genesis_config(10_000);
let mut bank = Bank::new(&genesis_config);
// Allow arbitrary transaction processing time for the purposes of this test
bank.ns_per_slot = std::u128::MAX;
let bank = Arc::new(Bank::new(&genesis_config));
let bank = Arc::new(Bank::new_no_wallclock_throttle(&genesis_config));

let pubkey = solana_sdk::pubkey::new_rand();

Expand Down
15 changes: 15 additions & 0 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,21 @@ impl Bank {
)
}

pub fn new_no_wallclock_throttle(genesis_config: &GenesisConfig) -> Self {
let mut bank = Self::new_with_paths(
&genesis_config,
Vec::new(),
&[],
None,
None,
HashSet::new(),
false,
);

bank.ns_per_slot = std::u128::MAX;
bank
}

#[cfg(test)]
pub(crate) fn new_with_config(
genesis_config: &GenesisConfig,
Expand Down

0 comments on commit 5c0e13f

Please sign in to comment.