@@ -223,6 +223,42 @@ async fn bundle_min_block_number() -> eyre::Result<()> {
223223 Ok ( ( ) )
224224}
225225
226+ /// Test the behaviour of the revert protection bundle with a min timestamp.
227+ #[ tokio:: test]
228+ async fn revert_protection_bundle_min_timestamp ( ) -> eyre:: Result < ( ) > {
229+ let rbuilder = LocalInstance :: new :: < StandardBuilder > ( OpRbuilderArgs {
230+ enable_revert_protection : true ,
231+ ..Default :: default ( )
232+ } )
233+ . await ?;
234+
235+ // The timestamp starts at 0
236+ let driver = rbuilder. driver ( ) . await ?;
237+
238+ // The bundle is valid when the min timestamp is equal to the current block's timestamp
239+ let bundle_with_min_timestamp = driver
240+ . create_transaction ( )
241+ . with_revert ( ) // the transaction reverts but it is included in the block
242+ . with_reverted_hash ( )
243+ . with_bundle ( BundleOpts {
244+ block_number_max : None ,
245+ block_number_min : None ,
246+ min_timestamp : Some ( 2 ) ,
247+ max_timestamp : None ,
248+ } )
249+ . send ( )
250+ . await ?;
251+
252+ // Each block advances the timestamp by block_time_secs which is 1 when chain_block_time isn't set
253+ let block = driver. build_new_block ( ) . await ?; // Block 1, timestamp = 1
254+ assert ! ( !block. includes( bundle_with_min_timestamp. tx_hash( ) ) ) ;
255+
256+ let block = driver. build_new_block ( ) . await ?; // Block 2, timestamp = 2, so bundle is valid
257+ assert ! ( block. includes( bundle_with_min_timestamp. tx_hash( ) ) ) ;
258+
259+ Ok ( ( ) )
260+ }
261+
226262/// Test the range limits for the revert protection bundle.
227263#[ tokio:: test]
228264async fn bundle_range_limits ( ) -> eyre:: Result < ( ) > {
0 commit comments