@@ -107,25 +107,13 @@ impl<T, H> From<Block<T, H>> for BlockBody<T> {
107
107
}
108
108
109
109
#[ cfg( any( test, feature = "arbitrary" ) ) ]
110
- impl < ' a , T > arbitrary:: Arbitrary < ' a > for Block < T >
110
+ impl < ' a , T , H > arbitrary:: Arbitrary < ' a > for Block < T , H >
111
111
where
112
112
T : arbitrary:: Arbitrary < ' a > ,
113
+ H : arbitrary:: Arbitrary < ' a > ,
113
114
{
114
115
fn arbitrary ( u : & mut arbitrary:: Unstructured < ' a > ) -> arbitrary:: Result < Self > {
115
- // first generate a reasonable amount of txs
116
- let transactions = ( 0 ..u. int_in_range ( 0 ..=100 ) ?)
117
- . map ( |_| T :: arbitrary ( u) )
118
- . collect :: < arbitrary:: Result < Vec < _ > > > ( ) ?;
119
-
120
- // then generate up to 2 ommers
121
- let ommers = ( 0 ..u. int_in_range ( 0 ..=1 ) ?)
122
- . map ( |_| Header :: arbitrary ( u) )
123
- . collect :: < arbitrary:: Result < Vec < _ > > > ( ) ?;
124
-
125
- Ok ( Self {
126
- header : u. arbitrary ( ) ?,
127
- body : BlockBody { transactions, ommers, withdrawals : u. arbitrary ( ) ? } ,
128
- } )
116
+ Ok ( Self { header : u. arbitrary ( ) ?, body : u. arbitrary ( ) ? } )
129
117
}
130
118
}
131
119
@@ -253,3 +241,24 @@ mod block_rlp {
253
241
}
254
242
}
255
243
}
244
+
245
+ #[ cfg( any( test, feature = "arbitrary" ) ) ]
246
+ impl < ' a , T > arbitrary:: Arbitrary < ' a > for BlockBody < T >
247
+ where
248
+ T : arbitrary:: Arbitrary < ' a > ,
249
+ {
250
+ fn arbitrary ( u : & mut arbitrary:: Unstructured < ' a > ) -> arbitrary:: Result < Self > {
251
+ // first generate up to 100 txs
252
+ // first generate a reasonable amount of txs
253
+ let transactions = ( 0 ..u. int_in_range ( 0 ..=100 ) ?)
254
+ . map ( |_| T :: arbitrary ( u) )
255
+ . collect :: < arbitrary:: Result < Vec < _ > > > ( ) ?;
256
+
257
+ // then generate up to 2 ommers
258
+ let ommers = ( 0 ..u. int_in_range ( 0 ..=1 ) ?)
259
+ . map ( |_| Header :: arbitrary ( u) )
260
+ . collect :: < arbitrary:: Result < Vec < _ > > > ( ) ?;
261
+
262
+ Ok ( Self { transactions, ommers, withdrawals : u. arbitrary ( ) ? } )
263
+ }
264
+ }
0 commit comments