Skip to content

Commit

Permalink
refactor: use NightshadeRuntime in telemetry_info test (#10811)
Browse files Browse the repository at this point in the history
Part of #10678 and #10634.
  • Loading branch information
pugachAG authored Mar 18, 2024
1 parent fa8b74f commit 7b03a6c
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions chain/client/src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -863,13 +863,14 @@ mod tests {
use near_async::messaging::{noop, IntoSender};
use near_async::time::Clock;
use near_chain::rayon_spawner::RayonAsyncComputationSpawner;
use near_chain::test_utils::{KeyValueRuntime, MockEpochManager, ValidatorSchedule};
use near_chain::runtime::NightshadeRuntime;
use near_chain::types::ChainConfig;
use near_chain::{Chain, ChainGenesis, DoomslugThresholdMode};
use near_chain_configs::Genesis;
use near_epoch_manager::shard_tracker::ShardTracker;
use near_epoch_manager::EpochManager;
use near_network::test_utils::peer_id_from_seed;
use near_primitives::version::PROTOCOL_VERSION;
use num_rational::Ratio;
use near_store::genesis::initialize_genesis_state;

#[test]
fn test_pretty_number() {
Expand Down Expand Up @@ -897,23 +898,15 @@ mod tests {
let info_helper = InfoHelper::new(Clock::real(), noop().into_sender(), &config, None);

let store = near_store::test_utils::create_test_store();
let vs =
ValidatorSchedule::new().block_producers_per_epoch(vec![vec!["test".parse().unwrap()]]);
let epoch_manager = MockEpochManager::new_with_validators(store.clone(), vs, 123);
let mut genesis = Genesis::test(vec!["test".parse::<AccountId>().unwrap()], 1);
genesis.config.epoch_length = 123;
let tempdir = tempfile::tempdir().unwrap();
initialize_genesis_state(store.clone(), &genesis, Some(tempdir.path()));
let epoch_manager = EpochManager::new_arc_handle(store.clone(), &genesis.config);
let shard_tracker = ShardTracker::new_empty(epoch_manager.clone());
let runtime = KeyValueRuntime::new(store, epoch_manager.as_ref());
let chain_genesis = ChainGenesis {
time: Clock::real().now_utc(),
height: 0,
gas_limit: 1_000_000,
min_gas_price: 100,
max_gas_price: 1_000_000_000,
total_supply: 3_000_000_000_000_000_000_000_000_000_000_000,
gas_price_adjustment_rate: Ratio::from_integer(0),
transaction_validity_period: 123123,
epoch_length: 123,
protocol_version: PROTOCOL_VERSION,
};
let runtime =
NightshadeRuntime::test(tempdir.path(), store, &genesis.config, epoch_manager.clone());
let chain_genesis = ChainGenesis::new(&genesis.config);
let doomslug_threshold_mode = DoomslugThresholdMode::TwoThirds;
let chain = Chain::new(
Clock::real(),
Expand Down

0 comments on commit 7b03a6c

Please sign in to comment.