@@ -930,12 +930,13 @@ pub(crate) async fn fake_valid_block_proposal_from_tx(
930930pub ( crate ) async fn fake_valid_block_from_tx_for_tests (
931931 predecessor : & Block ,
932932 tx : Transaction ,
933- nonce : Digest ,
933+ seed : [ u8 ; 32 ] ,
934934) -> Block {
935935 let mut block = fake_valid_block_proposal_from_tx ( predecessor, tx) . await ;
936936
937+ let mut rng = <rand:: rngs:: StdRng as rand:: SeedableRng >:: from_seed ( seed) ;
937938 while !block. has_proof_of_work ( predecessor. header ( ) ) {
938- mine_iteration_for_tests ( & mut block, nonce ) ;
939+ mine_iteration_for_tests ( & mut block, & mut rng ) ;
939940 }
940941
941942 block
@@ -1032,7 +1033,7 @@ async fn fake_block_successor(
10321033 predecessor : & Block ,
10331034 timestamp : Timestamp ,
10341035 with_valid_pow : bool ,
1035- rness : Randomness < 1 , 3 > ,
1036+ rness : Randomness < 2 , 2 > ,
10361037 network : Network ,
10371038) -> Block {
10381039 fake_block_successor_with_merged_tx (
@@ -1051,7 +1052,7 @@ pub async fn fake_block_successor_with_merged_tx(
10511052 timestamp : Timestamp ,
10521053 with_valid_pow : bool ,
10531054 txs : Vec < Transaction > ,
1054- rness : Randomness < 1 , 3 > ,
1055+ rness : Randomness < 2 , 2 > ,
10551056 network : Network ,
10561057) -> Block {
10571058 let ( mut seed_bytes, mut seed_digests) = ( rness. bytes_arr . to_vec ( ) , rness. digests . to_vec ( ) ) ;
@@ -1074,7 +1075,7 @@ pub async fn fake_block_successor_with_merged_tx(
10741075 . unwrap ( ) ;
10751076
10761077 if with_valid_pow {
1077- fake_valid_block_from_tx_for_tests ( predecessor, block_tx, seed_digests . pop ( ) . unwrap ( ) ) . await
1078+ fake_valid_block_from_tx_for_tests ( predecessor, block_tx, seed_bytes . pop ( ) . unwrap ( ) ) . await
10781079 } else {
10791080 fake_valid_block_proposal_from_tx ( predecessor, block_tx) . await
10801081 }
@@ -1083,7 +1084,7 @@ pub async fn fake_block_successor_with_merged_tx(
10831084pub ( crate ) async fn fake_valid_block_proposal_successor_for_test (
10841085 predecessor : & Block ,
10851086 timestamp : Timestamp ,
1086- rness : Randomness < 1 , 3 > ,
1087+ rness : Randomness < 2 , 2 > ,
10871088 network : Network ,
10881089) -> Block {
10891090 fake_block_successor ( predecessor, timestamp, false , rness, network) . await
@@ -1092,7 +1093,7 @@ pub(crate) async fn fake_valid_block_proposal_successor_for_test(
10921093pub ( crate ) async fn fake_valid_successor_for_tests (
10931094 predecessor : & Block ,
10941095 timestamp : Timestamp ,
1095- rness : Randomness < 1 , 3 > ,
1096+ rness : Randomness < 2 , 2 > ,
10961097 network : Network ,
10971098) -> Block {
10981099 fake_block_successor ( predecessor, timestamp, true , rness, network) . await
@@ -1105,7 +1106,7 @@ pub(crate) async fn fake_valid_successor_for_tests(
11051106/// will not pass `triton_vm::verify`, as its validity is only mocked.
11061107pub ( crate ) async fn fake_valid_block_for_tests (
11071108 state_lock : & GlobalStateLock ,
1108- rness : Randomness < 1 , 3 > ,
1109+ rness : Randomness < 2 , 2 > ,
11091110) -> Block {
11101111 let current_tip = state_lock. lock_guard ( ) . await . chain . light_state ( ) . clone ( ) ;
11111112 fake_valid_successor_for_tests (
@@ -1126,7 +1127,7 @@ pub(crate) async fn fake_valid_block_for_tests(
11261127pub ( crate ) async fn fake_valid_sequence_of_blocks_for_tests < const N : usize > (
11271128 predecessor : & Block ,
11281129 block_interval : Timestamp ,
1129- rness : [ Randomness < 1 , 3 > ; N ] ,
1130+ rness : [ Randomness < 2 , 2 > ; N ] ,
11301131 network : Network ,
11311132) -> [ Block ; N ] {
11321133 fake_valid_sequence_of_blocks_for_tests_dyn (
@@ -1149,7 +1150,7 @@ pub(crate) async fn fake_valid_sequence_of_blocks_for_tests<const N: usize>(
11491150pub ( crate ) async fn fake_valid_sequence_of_blocks_for_tests_dyn (
11501151 mut predecessor : & Block ,
11511152 block_interval : Timestamp ,
1152- mut rness_vec : Vec < Randomness < 1 , 3 > > ,
1153+ mut rness_vec : Vec < Randomness < 2 , 2 > > ,
11531154 network : Network ,
11541155) -> Vec < Block > {
11551156 let mut blocks = vec ! [ ] ;
@@ -1194,9 +1195,7 @@ pub(crate) async fn wallet_state_has_all_valid_mps(
11941195// recursively copy source dir to destination
11951196pub fn copy_dir_recursive ( source : & PathBuf , destination : & PathBuf ) -> std:: io:: Result < ( ) > {
11961197 if !source. is_dir ( ) {
1197- return Err ( std:: io:: Error :: other (
1198- "Source is not a directory" ,
1199- ) ) ;
1198+ return Err ( std:: io:: Error :: other ( "Source is not a directory" ) ) ;
12001199 }
12011200 std:: fs:: create_dir_all ( destination) ?;
12021201 for entry in std:: fs:: read_dir ( source) ? {
0 commit comments