Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use NightshadeRuntime in telemetry_info test #10811

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading