@@ -16,7 +16,8 @@ await describeBspNet(
1616 {
1717 initialised : true ,
1818 networkConfig : "standard" ,
19- extrinsicRetryTimeout : 10
19+ extrinsicRetryTimeout : 10 ,
20+ logLevel : "debug" // This test must execute with debug logs to verify the transaction watcher logs
2021 } ,
2122 ( { before, createUserApi, createBspApi, it } ) => {
2223 let userApi : EnrichedBspApi ;
@@ -46,13 +47,6 @@ await describeBspNet(
4647 finalised : false
4748 } ) ;
4849
49- // Check for "Watching transaction" log
50- await bspApi . docker . waitForLog ( {
51- containerName : "storage-hub-sh-bsp-1" ,
52- searchString : "Watching transaction with nonce" ,
53- timeout : 10000
54- } ) ;
55-
5650 // Verify that the submit proof extrinsic is now present in the tx pool
5751 const extrinsics = await userApi . assert . extrinsicPresent ( {
5852 module : "proofsDealer" ,
@@ -300,7 +294,7 @@ await describeBspNet(
300294 checkTxPool : true
301295 } ) ;
302296
303- // Get the volunteer transaction nonce
297+ // Get the volunteer transaction nonce and hash
304298 const volunteerExtrinsics = await userApi . assert . extrinsicPresent ( {
305299 module : "fileSystem" ,
306300 method : "bspVolunteer" ,
@@ -310,6 +304,7 @@ await describeBspNet(
310304
311305 const txPool1 = await userApi . rpc . author . pendingExtrinsics ( ) ;
312306 const volunteerNonce = txPool1 [ volunteerExtrinsics [ 0 ] . extIndex ] . nonce . toNumber ( ) ;
307+ const volunteerHash = txPool1 [ volunteerExtrinsics [ 0 ] . extIndex ] . hash . toString ( ) ;
313308
314309 // And the submit proof transaction nonce
315310 const submitProofExtrinsics = await userApi . assert . extrinsicPresent ( {
@@ -328,24 +323,8 @@ await describeBspNet(
328323 ) ;
329324
330325 // Drop the volunteer transaction (creates the gap at nonce n)
331- await bspApi . node . dropTxn ( { module : "fileSystem" , method : "bspVolunteer" } ) ;
332- await userApi . node . dropTxn ( { module : "fileSystem" , method : "bspVolunteer" } ) ;
333-
334- // Verify the volunteer was dropped
335- await userApi . assert . extrinsicPresent ( {
336- module : "fileSystem" ,
337- method : "bspVolunteer" ,
338- checkTxPool : true ,
339- assertLength : 0 ,
340- exactLength : true
341- } ) ;
342- await bspApi . assert . extrinsicPresent ( {
343- module : "fileSystem" ,
344- method : "bspVolunteer" ,
345- checkTxPool : true ,
346- assertLength : 0 ,
347- exactLength : true
348- } ) ;
326+ await bspApi . node . dropTxn ( volunteerHash as `0x${string } `) ;
327+ await userApi . node . dropTxn ( volunteerHash as `0x${string } `) ;
349328
350329 // Verify the Invalid log was emitted
351330 await bspApi . docker . waitForLog ( {
@@ -377,6 +356,49 @@ await describeBspNet(
377356 timeout : 10000
378357 } ) ;
379358
359+ // Wait for the BSP to retry submitting the volunteer (automatic retry mechanism)
360+ await userApi . wait . bspVolunteerInTxPool ( 1 ) ;
361+ await bspApi . wait . bspVolunteerInTxPool ( 1 ) ;
362+
363+ // Get the retry volunteer transaction hash
364+ const retryVolunteerExtrinsics = await userApi . assert . extrinsicPresent ( {
365+ module : "fileSystem" ,
366+ method : "bspVolunteer" ,
367+ checkTxPool : true ,
368+ assertLength : 1
369+ } ) ;
370+ const txPoolRetry = await userApi . rpc . author . pendingExtrinsics ( ) ;
371+ const retryVolunteerHash = txPoolRetry [ retryVolunteerExtrinsics [ 0 ] . extIndex ] . hash . toString ( ) ;
372+ const retryVolunteerNonce =
373+ txPoolRetry [ retryVolunteerExtrinsics [ 0 ] . extIndex ] . nonce . toNumber ( ) ;
374+
375+ // Verify the retry uses the same nonce (gap filling)
376+ strictEqual (
377+ retryVolunteerNonce ,
378+ volunteerNonce ,
379+ "Retry volunteer should use the same nonce to fill the gap"
380+ ) ;
381+
382+ // Drop the retry volunteer transaction to exhaust the retry mechanism
383+ await bspApi . node . dropTxn ( retryVolunteerHash as `0x${string } `) ;
384+ await userApi . node . dropTxn ( retryVolunteerHash as `0x${string } `) ;
385+
386+ // Verify the retry volunteer was dropped
387+ await userApi . assert . extrinsicPresent ( {
388+ module : "fileSystem" ,
389+ method : "bspVolunteer" ,
390+ checkTxPool : true ,
391+ assertLength : 0 ,
392+ exactLength : true
393+ } ) ;
394+ await bspApi . assert . extrinsicPresent ( {
395+ module : "fileSystem" ,
396+ method : "bspVolunteer" ,
397+ checkTxPool : true ,
398+ assertLength : 0 ,
399+ exactLength : true
400+ } ) ;
401+
380402 // Create a second storage request which should trigger the gap filling and use the same nonce as the first one
381403 const source2 = "res/adolphus.jpg" ;
382404 const destination2 = "test/gap-test-2.jpg" ;
0 commit comments