@@ -12,7 +12,7 @@ use near_primitives::types::{
12
12
} ;
13
13
use near_primitives:: utils:: from_timestamp;
14
14
use near_primitives:: version:: PROTOCOL_VERSION ;
15
- use near_time:: { Clock , FakeClock } ;
15
+ use near_time:: Clock ;
16
16
use num_rational:: Rational32 ;
17
17
18
18
use crate :: {
@@ -628,80 +628,3 @@ fn derive_validator_setup(specs: ValidatorsSpec) -> DerivedValidatorSetup {
628
628
} ,
629
629
}
630
630
}
631
-
632
- pub struct GenesisAndEpochConfigParams < ' a > {
633
- pub epoch_length : BlockHeightDelta ,
634
- pub protocol_version : ProtocolVersion ,
635
- pub shard_layout : ShardLayout ,
636
- pub validators_spec : ValidatorsSpec ,
637
- pub accounts : & ' a Vec < AccountId > ,
638
- }
639
-
640
- /// Handy factory for building test genesis and epoch config store. Use it if it is enough to have
641
- /// one epoch config for your test. Otherwise, just use builders directly.
642
- ///
643
- /// ```
644
- /// use near_chain_configs::test_genesis::build_genesis_and_epoch_config_store;
645
- /// use near_chain_configs::test_genesis::GenesisAndEpochConfigParams;
646
- /// use near_chain_configs::test_genesis::ValidatorsSpec;
647
- /// use near_primitives::shard_layout::ShardLayout;
648
- /// use near_primitives::test_utils::create_test_signer;
649
- /// use near_primitives::types::AccountId;
650
- /// use near_primitives::types::AccountInfo;
651
- ///
652
- /// const ONE_NEAR: u128 = 1_000_000_000_000_000_000_000_000;
653
- ///
654
- /// let protocol_version = 73;
655
- /// let epoch_length = 10;
656
- /// let accounts = (0..6).map(|i| format!("test{}", i).parse().unwrap()).collect::<Vec<AccountId>>();
657
- /// let shard_layout = ShardLayout::multi_shard(6, 1);
658
- /// let validators = vec![
659
- /// AccountInfo {
660
- /// account_id: accounts[0].clone(),
661
- /// public_key: create_test_signer(accounts[0].as_str()).public_key(),
662
- /// amount: 62500 * ONE_NEAR,
663
- /// },
664
- /// ];
665
- /// let validators_spec = ValidatorsSpec::raw(validators, 3, 3, 3);
666
- /// let (genesis, epoch_config_store) = build_genesis_and_epoch_config_store(
667
- /// GenesisAndEpochConfigParams {
668
- /// protocol_version,
669
- /// epoch_length,
670
- /// accounts: &accounts,
671
- /// shard_layout,
672
- /// validators_spec,
673
- /// },
674
- /// |genesis_builder| genesis_builder.genesis_height(10000).transaction_validity_period(1000),
675
- /// |epoch_config_builder| epoch_config_builder.shuffle_shard_assignment_for_chunk_producers(true),
676
- /// );
677
- /// ```
678
- pub fn build_genesis_and_epoch_config_store < ' a > (
679
- params : GenesisAndEpochConfigParams < ' a > ,
680
- customize_genesis_builder : impl FnOnce ( TestGenesisBuilder ) -> TestGenesisBuilder ,
681
- customize_epoch_config_builder : impl FnOnce ( TestEpochConfigBuilder ) -> TestEpochConfigBuilder ,
682
- ) -> ( Genesis , EpochConfigStore ) {
683
- let GenesisAndEpochConfigParams {
684
- epoch_length,
685
- protocol_version,
686
- shard_layout,
687
- validators_spec,
688
- accounts,
689
- } = params;
690
-
691
- let genesis_builder = TestGenesisBuilder :: new ( )
692
- . genesis_time_from_clock ( & FakeClock :: default ( ) . clock ( ) )
693
- . protocol_version ( protocol_version)
694
- . epoch_length ( epoch_length)
695
- . shard_layout ( shard_layout)
696
- . validators_spec ( validators_spec)
697
- . add_user_accounts_simple ( accounts, 1_000_000 * ONE_NEAR )
698
- . gas_limit_one_petagas ( ) ;
699
- let genesis_builder = customize_genesis_builder ( genesis_builder) ;
700
- let genesis = genesis_builder. build ( ) ;
701
-
702
- let epoch_config_builder = TestEpochConfigBuilder :: from_genesis ( & genesis) ;
703
- let epoch_config_builder = customize_epoch_config_builder ( epoch_config_builder) ;
704
- let epoch_config_store = epoch_config_builder. build_store_for_single_version ( protocol_version) ;
705
-
706
- ( genesis, epoch_config_store)
707
- }
0 commit comments