diff --git a/client/blockchain-service/src/handler.rs b/client/blockchain-service/src/handler.rs index 61a4a8d7a..027bbbb03 100644 --- a/client/blockchain-service/src/handler.rs +++ b/client/blockchain-service/src/handler.rs @@ -1401,35 +1401,6 @@ where } } } - RuntimeEvent::FileSystem( - pallet_file_system::Event::MoveBucketRequested { - who: _, - bucket_id, - new_msp_id, - new_value_prop_id, - }, - ) => { - match self.provider_id { - // As a BSP, this node is interested in the event to allow the new MSP to request files from it. - Some(StorageProviderId::BackupStorageProvider(_)) => { - self.emit(MoveBucketRequested { - bucket_id, - new_msp_id, - }); - } - // As an MSP, this node is interested in the event only if this node is the new MSP. - Some(StorageProviderId::MainStorageProvider(msp_id)) - if msp_id == new_msp_id => - { - self.emit(MoveBucketRequestedForMsp { - bucket_id, - value_prop_id: new_value_prop_id, - }); - } - // Otherwise, ignore the event. - _ => {} - } - } RuntimeEvent::FileSystem( pallet_file_system::Event::MoveBucketRejected { bucket_id, diff --git a/test/suites/integration/msp/move-bucket-reject.test.ts b/test/suites/integration/msp/move-bucket-reject.test.ts index f85c95612..36a6830ee 100644 --- a/test/suites/integration/msp/move-bucket-reject.test.ts +++ b/test/suites/integration/msp/move-bucket-reject.test.ts @@ -164,6 +164,8 @@ describeMspNet( throw new Error(`Expected ${source.length} NewStorageRequest events`); } + await userApi.wait.bspVolunteerInTxPool(); + // Wait for the MSP to receive and store all files by polling until they are all in storage await waitFor({ lambda: async () => { @@ -206,8 +208,11 @@ describeMspNet( // also prioritise a fast response, so if the Forest Write Lock is available, it will send // the first response it can immediately. await userApi.wait.mspResponseInTxPool(); + // This includes BSP volunteers await userApi.block.seal(); + await userApi.wait.bspStoredInTxPool(); + // Wait for the MSP to update its local forest root by polling until it matches the on-chain root await waitFor({ lambda: async () => { @@ -358,14 +363,11 @@ describeMspNet( await userApi.wait.waitForTxInPool({ module: "fileSystem", method: "mspRespondMoveBucketRequest", - timeout: 45000 // Increased timeout to account for DB connection timeout + expectedEvent: "MoveBucketRejected", + timeout: 45000, + shouldSeal: true }); - const { events } = await userApi.block.seal(); - - // Verify that the move request was rejected - assertEventPresent(userApi, "fileSystem", "MoveBucketRejected", events); - // Resume postgres await postgresContainer.unpause(); @@ -410,20 +412,17 @@ describeMspNet( // Finalising the block in the BSP node as well, to trigger the reorg in the BSP node too. const finalisedBlockHash = await userApi.rpc.chain.getFinalizedHead(); - // Wait for BSP node to have imported the finalised block built by the user node. + // Wait for MSP2 node to have imported the finalised block built by the user node. await msp2Api.wait.blockImported(finalisedBlockHash.toString()); await msp2Api.block.finaliseBlock(finalisedBlockHash.toString()); // Wait for the rejection response from MSP2 await userApi.wait.waitForTxInPool({ module: "fileSystem", - method: "mspRespondMoveBucketRequest" + method: "mspRespondMoveBucketRequest", + expectedEvent: "MoveBucketRejected", + shouldSeal: true }); - - const { events } = await userApi.block.seal(); - - // Verify that the move request was rejected - assertEventPresent(userApi, "fileSystem", "MoveBucketRejected", events); }); } );