11#[ cfg( any( feature = "testing" , test) ) ]
22use crate :: testing:: TestRng ;
3- #[ cfg( any( feature = "std" , feature = " testing", test) ) ]
3+ #[ cfg( any( feature = "testing" , test) ) ]
44use crate :: {
55 bytesrepr:: { Bytes , ToBytes } ,
66 transaction:: transaction_v1:: * ,
77 TransactionEntryPoint , TransactionScheduling , TransactionTarget ,
88} ;
99#[ cfg( any( feature = "testing" , test) ) ]
10- use crate :: {
11- PublicKey , RuntimeArgs , TransactionInvocationTarget , TransferTarget , AUCTION_LANE_ID ,
12- INSTALL_UPGRADE_LANE_ID , MINT_LANE_ID ,
13- } ;
14- #[ cfg( any( feature = "std" , feature = "testing" , test) ) ]
10+ use crate :: { PublicKey , RuntimeArgs , TransactionInvocationTarget , TransferTarget } ;
11+ #[ cfg( any( all( feature = "std" , feature = "testing" ) , test) ) ]
12+ use crate :: { AUCTION_LANE_ID , INSTALL_UPGRADE_LANE_ID , MINT_LANE_ID } ;
13+ #[ cfg( any( feature = "testing" , test) ) ]
1514use alloc:: collections:: BTreeMap ;
1615#[ cfg( any( feature = "testing" , test) ) ]
1716use rand:: { Rng , RngCore } ;
1817
19- #[ cfg( any( feature = "std" , feature = " testing", feature = "gens" , test) ) ]
18+ #[ cfg( any( feature = "testing" , feature = "gens" , test) ) ]
2019pub ( crate ) const ARGS_MAP_KEY : u16 = 0 ;
21- #[ cfg( any( feature = "std" , feature = " testing", feature = "gens" , test) ) ]
20+ #[ cfg( any( feature = "testing" , feature = "gens" , test) ) ]
2221pub ( crate ) const TARGET_MAP_KEY : u16 = 1 ;
23- #[ cfg( any( feature = "std" , feature = " testing", feature = "gens" , test) ) ]
22+ #[ cfg( any( feature = "testing" , feature = "gens" , test) ) ]
2423pub ( crate ) const ENTRY_POINT_MAP_KEY : u16 = 2 ;
25- #[ cfg( any( feature = "std" , feature = " testing", feature = "gens" , test) ) ]
24+ #[ cfg( any( feature = "testing" , feature = "gens" , test) ) ]
2625pub ( crate ) const SCHEDULING_MAP_KEY : u16 = 3 ;
2726
28- #[ cfg( any( feature = "std" , feature = " testing", feature = "gens" , test) ) ]
27+ #[ cfg( any( feature = "testing" , feature = "gens" , test) ) ]
2928#[ derive( Clone , Eq , PartialEq , Debug ) ]
3029pub ( crate ) enum FieldsContainerError {
3130 CouldNotSerializeField { field_index : u16 } ,
3231}
3332
34- #[ cfg( any( feature = "std" , feature = " testing", feature = "gens" , test) ) ]
33+ #[ cfg( any( feature = "testing" , feature = "gens" , test) ) ]
3534pub ( crate ) struct FieldsContainer {
3635 pub ( super ) args : TransactionArgs ,
3736 pub ( super ) target : TransactionTarget ,
3837 pub ( super ) entry_point : TransactionEntryPoint ,
3938 pub ( super ) scheduling : TransactionScheduling ,
4039}
4140
42- #[ cfg( any( feature = "std" , feature = " testing", feature = "gens" , test) ) ]
41+ #[ cfg( any( feature = "testing" , feature = "gens" , test) ) ]
4342impl FieldsContainer {
4443 pub ( crate ) fn new (
4544 args : TransactionArgs ,
@@ -208,7 +207,7 @@ impl FieldsContainer {
208207 }
209208
210209 /// Returns a random `FieldsContainer`.
211- #[ cfg( any( feature = "testing" , test) ) ]
210+ #[ cfg( any( all ( feature = "std" , feature = " testing") , test) ) ]
212211 pub fn random_of_lane ( rng : & mut TestRng , lane_id : u8 ) -> Self {
213212 match lane_id {
214213 MINT_LANE_ID => Self :: random_transfer ( rng) ,
@@ -218,7 +217,7 @@ impl FieldsContainer {
218217 }
219218 }
220219
221- #[ cfg( any( feature = "testing" , test) ) ]
220+ #[ cfg( any( all ( feature = "std" , feature = " testing") , test) ) ]
222221 fn random_transfer ( rng : & mut TestRng ) -> Self {
223222 let amount = rng. gen_range ( 2_500_000_000 ..=u64:: MAX ) ;
224223 let maybe_source = if rng. gen ( ) { Some ( rng. gen ( ) ) } else { None } ;
@@ -233,7 +232,7 @@ impl FieldsContainer {
233232 )
234233 }
235234
236- #[ cfg( any( feature = "testing" , test) ) ]
235+ #[ cfg( any( all ( feature = "std" , feature = " testing") , test) ) ]
237236 fn random_install_upgrade ( rng : & mut TestRng ) -> Self {
238237 let target = TransactionTarget :: Session {
239238 module_bytes : Bytes :: from ( rng. random_vec ( 0 ..100 ) ) ,
@@ -248,7 +247,7 @@ impl FieldsContainer {
248247 )
249248 }
250249
251- #[ cfg( any( feature = "testing" , test) ) ]
250+ #[ cfg( any( all ( feature = "std" , feature = " testing") , test) ) ]
252251 fn random_staking ( rng : & mut TestRng ) -> Self {
253252 let public_key = PublicKey :: random ( rng) ;
254253 let delegation_rate = rng. gen ( ) ;
0 commit comments