@@ -173,3 +173,49 @@ func TestDatabaseBlockInsertion(t *testing.T) {
173173 Inserted : usedSbundle .Success ,
174174 }, usedSbundles [0 ])
175175}
176+
177+ func simpleTx (nonce uint64 ) * types.Transaction {
178+ value := big .NewInt (1000000000000000 ) // in wei (0.001 eth)
179+ gasLimit := uint64 (21000 ) // in units
180+ gasPrice := big .NewInt (1000000000 )
181+
182+ toAddress := common .HexToAddress ("0x7777492a736CD894Cb12DFE5e944047499AEF7a0" )
183+ var data []byte
184+ return types .NewTx (& types.LegacyTx {
185+ Nonce : nonce ,
186+ To : & toAddress ,
187+ Value : value ,
188+ Gas : gasLimit ,
189+ GasPrice : gasPrice ,
190+ Data : data ,
191+ })
192+ }
193+
194+ func TestBundleUUIDHash (t * testing.T ) {
195+ tx1 := simpleTx (1 )
196+ tx2 := simpleTx (2 )
197+ bts1 , err := tx1 .MarshalBinary ()
198+ require .Nil (t , err )
199+ bts2 , err := tx2 .MarshalBinary ()
200+ require .Nil (t , err )
201+ _ , _ = bts1 , bts2
202+ t .Run ("no reverts" , func (t * testing.T ) {
203+ b := types.MevBundle {
204+ BlockNumber : big .NewInt (1 ),
205+ Hash : common .HexToHash ("0x135a7f22459b2102d51de2d6704512a03e1e2d2059c34bcbb659f4ba65e9f92c" ),
206+ }
207+
208+ require .Equal (t , "82624e95-741e-5a60-9198-b2f7b2ed973f" , b .ComputeUUID ().String ())
209+ })
210+ t .Run ("one revert" , func (t * testing.T ) {
211+ b := types.MevBundle {
212+ BlockNumber : big .NewInt (1 ),
213+ Hash : common .HexToHash ("0x135a7f22459b2102d51de2d6704512a03e1e2d2059c34bcbb659f4ba65e9f92c" ),
214+ RevertingTxHashes : []common.Hash {
215+ tx1 .Hash (),
216+ },
217+ }
218+
219+ require .Equal (t , "19f6e9a2-04a1-5616-9bb3-5c9f81653e4f" , b .ComputeUUID ().String ())
220+ })
221+ }
0 commit comments