@@ -39,8 +39,12 @@ pub struct SignetEthBundle {
3939 pub bundle : EthSendBundle ,
4040 /// Host fills to be applied with the bundle, represented as a signed
4141 /// permit2 fill.
42- #[ serde( default ) ]
42+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
4343 pub host_fills : Option < SignedFill > ,
44+
45+ /// Host transactions to be included in the host bundle.
46+ #[ serde( default , skip_serializing_if = "Vec::is_empty" ) ]
47+ pub host_txs : Vec < Bytes > ,
4448}
4549
4650impl SignetEthBundle {
@@ -194,6 +198,7 @@ mod test {
194198 chainId: 100 ,
195199 } ] ,
196200 } ) ,
201+ host_txs : vec ! [ b"host_tx1" . into( ) , b"host_tx2" . into( ) ] ,
197202 } ;
198203
199204 let serialized = serde_json:: to_string ( & bundle) . unwrap ( ) ;
@@ -202,6 +207,39 @@ mod test {
202207 assert_eq ! ( bundle, deserialized) ;
203208 }
204209
210+ #[ test]
211+ fn send_bundle_ser_roundtrip_no_host_no_fills ( ) {
212+ let bundle = SignetEthBundle {
213+ bundle : EthSendBundle {
214+ txs : vec ! [ b"tx1" . into( ) , b"tx2" . into( ) ] ,
215+ block_number : 1 ,
216+ min_timestamp : Some ( 2 ) ,
217+ max_timestamp : Some ( 3 ) ,
218+ reverting_tx_hashes : vec ! [ B256 :: repeat_byte( 4 ) , B256 :: repeat_byte( 5 ) ] ,
219+ replacement_uuid : Some ( "uuid" . to_owned ( ) ) ,
220+ ..Default :: default ( )
221+ } ,
222+ host_fills : None ,
223+ host_txs : vec ! [ ] ,
224+ } ;
225+
226+ let serialized = serde_json:: to_string ( & bundle) . unwrap ( ) ;
227+ let deserialized: SignetEthBundle = serde_json:: from_str ( & serialized) . unwrap ( ) ;
228+
229+ assert_eq ! ( bundle, deserialized) ;
230+ }
231+
232+ #[ test]
233+ fn test_deser_bundle_no_host_no_fills ( ) {
234+ let json = r#"
235+ {"txs":["0x747831","0x747832"],"blockNumber":"0x1","minTimestamp":2,"maxTimestamp":3,"revertingTxHashes":["0x0404040404040404040404040404040404040404040404040404040404040404","0x0505050505050505050505050505050505050505050505050505050505050505"],"replacementUuid":"uuid"}"# ;
236+
237+ let deserialized: SignetEthBundle = serde_json:: from_str ( json) . unwrap ( ) ;
238+
239+ assert ! ( deserialized. host_fills. is_none( ) ) ;
240+ assert ! ( deserialized. host_txs. is_empty( ) ) ;
241+ }
242+
205243 #[ test]
206244 fn send_bundle_resp_ser_roundtrip ( ) {
207245 let resp = SignetEthBundleResponse { bundle_hash : B256 :: repeat_byte ( 1 ) } ;
0 commit comments