@@ -515,6 +515,7 @@ macro_rules! load_bundled {
515
515
} ;
516
516
}
517
517
518
+ #[ cfg( any( test, feature="test-helpers" ) ) ]
518
519
macro_rules! load_machine_bundled {
519
520
( $e: expr) => {
520
521
Spec :: load_machine(
@@ -838,59 +839,68 @@ impl Spec {
838
839
self . engine . genesis_epoch_data ( & genesis, & call)
839
840
}
840
841
842
+ /// Create a new Spec with InstantSeal consensus which does internal sealing (not requiring
843
+ /// work).
844
+ pub fn new_instant ( ) -> Spec {
845
+ load_bundled ! ( "instant_seal" )
846
+ }
847
+
841
848
/// Create a new Spec which conforms to the Frontier-era Morden chain except that it's a
842
849
/// NullEngine consensus.
850
+ #[ cfg( any( test, feature="test-helpers" ) ) ]
843
851
pub fn new_test ( ) -> Spec {
844
852
load_bundled ! ( "null_morden" )
845
853
}
846
854
847
855
/// Create the EthereumMachine corresponding to Spec::new_test.
856
+ #[ cfg( any( test, feature="test-helpers" ) ) ]
848
857
pub fn new_test_machine ( ) -> EthereumMachine { load_machine_bundled ! ( "null_morden" ) }
849
858
850
859
/// Create a new Spec which conforms to the Frontier-era Morden chain except that it's a NullEngine consensus with applying reward on block close.
860
+ #[ cfg( any( test, feature="test-helpers" ) ) ]
851
861
pub fn new_test_with_reward ( ) -> Spec { load_bundled ! ( "null_morden_with_reward" ) }
852
862
853
863
/// Create a new Spec which is a NullEngine consensus with a premine of address whose
854
864
/// secret is keccak('').
865
+ #[ cfg( any( test, feature="test-helpers" ) ) ]
855
866
pub fn new_null ( ) -> Spec {
856
867
load_bundled ! ( "null" )
857
868
}
858
869
859
870
/// Create a new Spec which constructs a contract at address 5 with storage at 0 equal to 1.
871
+ #[ cfg( any( test, feature="test-helpers" ) ) ]
860
872
pub fn new_test_constructor ( ) -> Spec {
861
873
load_bundled ! ( "constructor" )
862
874
}
863
875
864
- /// Create a new Spec with InstantSeal consensus which does internal sealing (not requiring
865
- /// work).
866
- pub fn new_instant ( ) -> Spec {
867
- load_bundled ! ( "instant_seal" )
868
- }
869
-
870
876
/// Create a new Spec with AuthorityRound consensus which does internal sealing (not
871
877
/// requiring work).
872
878
/// Accounts with secrets keccak("0") and keccak("1") are the validators.
879
+ #[ cfg( any( test, feature="test-helpers" ) ) ]
873
880
pub fn new_test_round ( ) -> Self {
874
881
load_bundled ! ( "authority_round" )
875
882
}
876
883
877
884
/// Create a new Spec with AuthorityRound consensus which does internal sealing (not
878
885
/// requiring work) with empty step messages enabled.
879
886
/// Accounts with secrets keccak("0") and keccak("1") are the validators.
887
+ #[ cfg( any( test, feature="test-helpers" ) ) ]
880
888
pub fn new_test_round_empty_steps ( ) -> Self {
881
889
load_bundled ! ( "authority_round_empty_steps" )
882
890
}
883
891
884
892
/// Create a new Spec with AuthorityRound consensus (with empty steps) using a block reward
885
893
/// contract. The contract source code can be found at:
886
894
/// https://github.com/parity-contracts/block-reward/blob/daf7d44383b6cdb11cb6b953b018648e2b027cfb/contracts/ExampleBlockReward.sol
895
+ #[ cfg( any( test, feature="test-helpers" ) ) ]
887
896
pub fn new_test_round_block_reward_contract ( ) -> Self {
888
897
load_bundled ! ( "authority_round_block_reward_contract" )
889
898
}
890
899
891
900
/// Create a new Spec with Tendermint consensus which does internal sealing (not requiring
892
901
/// work).
893
902
/// Account keccak("0") and keccak("1") are a authorities.
903
+ #[ cfg( any( test, feature="test-helpers" ) ) ]
894
904
pub fn new_test_tendermint ( ) -> Self {
895
905
load_bundled ! ( "tendermint" )
896
906
}
@@ -903,13 +913,15 @@ impl Spec {
903
913
/// "0xbfc708a000000000000000000000000082a978b3f5962a5b0957d9ee9eef472ee55b42f1" and added
904
914
/// back in using
905
915
/// "0x4d238c8e00000000000000000000000082a978b3f5962a5b0957d9ee9eef472ee55b42f1".
916
+ #[ cfg( any( test, feature="test-helpers" ) ) ]
906
917
pub fn new_validator_safe_contract ( ) -> Self {
907
918
load_bundled ! ( "validator_safe_contract" )
908
919
}
909
920
910
921
/// The same as the `safeContract`, but allows reporting and uses AuthorityRound.
911
922
/// Account is marked with `reportBenign` it can be checked as disliked with "0xd8f2e0bf".
912
923
/// Validator can be removed with `reportMalicious`.
924
+ #[ cfg( any( test, feature="test-helpers" ) ) ]
913
925
pub fn new_validator_contract ( ) -> Self {
914
926
load_bundled ! ( "validator_contract" )
915
927
}
@@ -918,6 +930,7 @@ impl Spec {
918
930
/// height.
919
931
/// Account with secrets keccak("0") is the validator for block 1 and with keccak("1")
920
932
/// onwards.
933
+ #[ cfg( any( test, feature="test-helpers" ) ) ]
921
934
pub fn new_validator_multi ( ) -> Self {
922
935
load_bundled ! ( "validator_multi" )
923
936
}
0 commit comments