@@ -6,7 +6,7 @@ use alloy_rlp::{
6
6
} ;
7
7
8
8
use derive_more:: { Constructor , Deref , DerefMut , From , IntoIterator } ;
9
- use reth_codecs_derive:: derive_arbitrary ;
9
+ use reth_codecs_derive:: add_arbitrary_tests ;
10
10
use reth_primitives:: {
11
11
Block , Bytes , PooledTransactionsElement , TransactionSigned , TxHash , B256 , U128 ,
12
12
} ;
@@ -23,9 +23,10 @@ use proptest::{collection::vec, prelude::*};
23
23
use proptest_arbitrary_interop:: arb;
24
24
25
25
/// This informs peers of new blocks that have appeared on the network.
26
- #[ derive_arbitrary( rlp) ]
27
26
#[ derive( Clone , Debug , PartialEq , Eq , RlpEncodableWrapper , RlpDecodableWrapper , Default ) ]
28
27
#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
28
+ #[ cfg_attr( any( test, feature = "arbitrary" ) , derive( arbitrary:: Arbitrary ) ) ]
29
+ #[ add_arbitrary_tests( rlp) ]
29
30
pub struct NewBlockHashes (
30
31
/// New block hashes and the block number for each blockhash.
31
32
/// Clients should request blocks using a [`GetBlockBodies`](crate::GetBlockBodies) message.
@@ -47,9 +48,10 @@ impl NewBlockHashes {
47
48
}
48
49
49
50
/// A block hash _and_ a block number.
50
- #[ derive_arbitrary( rlp) ]
51
51
#[ derive( Clone , Debug , PartialEq , Eq , RlpEncodable , RlpDecodable , Default ) ]
52
52
#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
53
+ #[ cfg_attr( any( test, feature = "arbitrary" ) , derive( arbitrary:: Arbitrary ) ) ]
54
+ #[ add_arbitrary_tests( rlp) ]
53
55
pub struct BlockHashNumber {
54
56
/// The block hash
55
57
pub hash : B256 ,
@@ -73,7 +75,8 @@ impl From<NewBlockHashes> for Vec<BlockHashNumber> {
73
75
/// block.
74
76
#[ derive( Clone , Debug , PartialEq , Eq , RlpEncodable , RlpDecodable , Default ) ]
75
77
#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
76
- #[ derive_arbitrary( rlp, 25 ) ]
78
+ #[ cfg_attr( any( test, feature = "arbitrary" ) , derive( arbitrary:: Arbitrary ) ) ]
79
+ #[ add_arbitrary_tests( rlp, 25 ) ]
77
80
pub struct NewBlock {
78
81
/// A new block.
79
82
pub block : Block ,
@@ -83,9 +86,10 @@ pub struct NewBlock {
83
86
84
87
/// This informs peers of transactions that have appeared on the network and are not yet included
85
88
/// in a block.
86
- #[ derive_arbitrary( rlp, 10 ) ]
87
89
#[ derive( Clone , Debug , PartialEq , Eq , RlpEncodableWrapper , RlpDecodableWrapper , Default ) ]
88
90
#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
91
+ #[ cfg_attr( any( test, feature = "arbitrary" ) , derive( arbitrary:: Arbitrary ) ) ]
92
+ #[ add_arbitrary_tests( rlp, 10 ) ]
89
93
pub struct Transactions (
90
94
/// New transactions for the peer to include in its mempool.
91
95
pub Vec < TransactionSigned > ,
@@ -114,8 +118,9 @@ impl From<Transactions> for Vec<TransactionSigned> {
114
118
///
115
119
/// The list of transactions is constructed on per-peers basis, but the underlying transaction
116
120
/// objects are shared.
117
- #[ derive_arbitrary( rlp, 20 ) ]
118
121
#[ derive( Clone , Debug , PartialEq , Eq , RlpEncodableWrapper , RlpDecodableWrapper ) ]
122
+ #[ cfg_attr( any( test, feature = "arbitrary" ) , derive( arbitrary:: Arbitrary ) ) ]
123
+ #[ add_arbitrary_tests( rlp, 20 ) ]
119
124
pub struct SharedTransactions (
120
125
/// New transactions for the peer to include in its mempool.
121
126
pub Vec < Arc < TransactionSigned > > ,
@@ -288,9 +293,10 @@ impl From<NewPooledTransactionHashes68> for NewPooledTransactionHashes {
288
293
289
294
/// This informs peers of transaction hashes for transactions that have appeared on the network,
290
295
/// but have not been included in a block.
291
- #[ derive_arbitrary( rlp) ]
292
296
#[ derive( Clone , Debug , PartialEq , Eq , RlpEncodableWrapper , RlpDecodableWrapper , Default ) ]
293
297
#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
298
+ #[ cfg_attr( any( test, feature = "arbitrary" ) , derive( arbitrary:: Arbitrary ) ) ]
299
+ #[ add_arbitrary_tests( rlp) ]
294
300
pub struct NewPooledTransactionHashes66 (
295
301
/// Transaction hashes for new transactions that have appeared on the network.
296
302
/// Clients should request the transactions with the given hashes using a
0 commit comments