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 (#15961)
Browse files Browse the repository at this point in the history
(cherry picked from commit f548a04)
  • Loading branch information
carllin authored and mergify-bot committed Mar 17, 2021
1 parent f5d56ea commit 38557da
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
15 changes: 5 additions & 10 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 @@ -1625,7 +1623,7 @@ mod tests {

let entry_receiver = {
// start a banking_stage to eat verified receiver
let bank = Arc::new(Bank::new(&genesis_config));
let bank = Arc::new(Bank::new_no_wallclock_throttle(&genesis_config));
let blockstore = Arc::new(
Blockstore::open(&ledger_path)
.expect("Expected to be able to open database ledger"),
Expand Down Expand Up @@ -1669,7 +1667,7 @@ mod tests {
.map(|(_bank, (entry, _tick_height))| entry)
.collect();

let bank = Bank::new(&genesis_config);
let bank = Bank::new_no_wallclock_throttle(&genesis_config);
for entry in &entries {
bank.process_transactions(&entry.transactions)
.iter()
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 38557da

Please sign in to comment.