From df1c3e9e23984039b5e7d8bd0ef50b2beaf46fbb Mon Sep 17 00:00:00 2001 From: Michael Assaf Date: Thu, 9 Jan 2025 12:35:18 -0500 Subject: [PATCH] sign up bsp before testing --- pallets/file-system/src/tests.rs | 261 ++++++++++++++++--------------- 1 file changed, 131 insertions(+), 130 deletions(-) diff --git a/pallets/file-system/src/tests.rs b/pallets/file-system/src/tests.rs index dc8e4586..ade73ad6 100644 --- a/pallets/file-system/src/tests.rs +++ b/pallets/file-system/src/tests.rs @@ -2049,7 +2049,7 @@ mod request_storage { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -2179,7 +2179,7 @@ mod request_storage { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id: bucket_id.clone(), location: file_1_location.clone(), @@ -2217,7 +2217,7 @@ mod request_storage { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: file_2_location.clone(), @@ -2334,7 +2334,7 @@ mod request_storage { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -2709,6 +2709,13 @@ mod revoke_storage_request { let bucket_id = create_bucket(&owner_account.clone(), name.clone(), msp_id, value_prop_id); + let bsp_account_id = Keyring::Bob.to_account_id(); + let bsp_signed = RuntimeOrigin::signed(bsp_account_id.clone()); + + let storage_amount: StorageData = 100; + + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + assert_ok!(FileSystem::issue_storage_request( owner.clone(), bucket_id, @@ -2720,13 +2727,6 @@ mod revoke_storage_request { None )); - let bsp_account_id = Keyring::Bob.to_account_id(); - let bsp_signed = RuntimeOrigin::signed(bsp_account_id.clone()); - - let storage_amount: StorageData = 100; - - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let bsp_id = Providers::get_provider_id(bsp_account_id).unwrap(); let file_key = FileSystem::compute_file_key( @@ -2775,6 +2775,13 @@ mod revoke_storage_request { let bucket_id = create_bucket(&owner_account.clone(), name.clone(), msp_id, value_prop_id); + let bsp_account_id = Keyring::Bob.to_account_id(); + let bsp_signed = RuntimeOrigin::signed(bsp_account_id.clone()); + + let storage_amount: StorageData = 100; + + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch a signed extrinsic. assert_ok!(FileSystem::issue_storage_request( owner.clone(), @@ -2787,13 +2794,6 @@ mod revoke_storage_request { None )); - let bsp_account_id = Keyring::Bob.to_account_id(); - let bsp_signed = RuntimeOrigin::signed(bsp_account_id.clone()); - - let storage_amount: StorageData = 100; - - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let file_key = FileSystem::compute_file_key( owner_account.clone(), bucket_id, @@ -3334,6 +3334,13 @@ mod msp_respond_storage_request { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + let bsp_account_id = Keyring::Bob.to_account_id(); + let bsp_signed = RuntimeOrigin::signed(bsp_account_id.clone()); + + let storage_amount: StorageData = 100; + + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch a storage request. assert_ok!(FileSystem::issue_storage_request( owner_signed.clone(), @@ -3355,13 +3362,6 @@ mod msp_respond_storage_request { fingerprint, ); - let bsp_account_id = Keyring::Bob.to_account_id(); - let bsp_signed = RuntimeOrigin::signed(bsp_account_id.clone()); - - let storage_amount: StorageData = 100; - - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - // Dispatch the BSP volunteer assert_ok!(FileSystem::bsp_volunteer(bsp_signed.clone(), file_key,)); @@ -3540,6 +3540,9 @@ mod msp_respond_storage_request { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch a storage request. assert_ok!(FileSystem::issue_storage_request( owner_signed.clone(), @@ -3560,9 +3563,6 @@ mod msp_respond_storage_request { fingerprint, ); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - assert_noop!( FileSystem::msp_respond_storage_requests_multiple_buckets( bsp_signed.clone(), @@ -3617,7 +3617,7 @@ mod msp_respond_storage_request { StorageRequests::::insert( file_key, StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -3685,7 +3685,7 @@ mod msp_respond_storage_request { StorageRequests::::insert( file_key, StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -3917,7 +3917,7 @@ mod msp_respond_storage_request { StorageRequests::::insert( file_key, StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -3989,7 +3989,7 @@ mod msp_respond_storage_request { StorageRequests::::insert( file_key, StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -4193,6 +4193,9 @@ mod bsp_volunteer { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount,)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner_signed.clone(), @@ -4205,9 +4208,6 @@ mod bsp_volunteer { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount,)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -4248,6 +4248,9 @@ mod bsp_volunteer { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount,)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner_signed.clone(), @@ -4260,9 +4263,6 @@ mod bsp_volunteer { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount,)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -4308,6 +4308,9 @@ mod bsp_volunteer { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount,)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner_signed.clone(), @@ -4320,9 +4323,6 @@ mod bsp_volunteer { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount,)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -4440,6 +4440,9 @@ mod bsp_volunteer { let name = BoundedVec::try_from(b"bucket".to_vec()).unwrap(); let bucket_id = create_bucket(&owner.clone(), name.clone(), msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( origin, @@ -4452,9 +4455,6 @@ mod bsp_volunteer { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let bsp_id = Providers::get_provider_id(bsp_account_id.clone()).unwrap(); pallet_storage_providers::BackupStorageProviders::::mutate(bsp_id, |bsp| { @@ -4504,6 +4504,9 @@ mod bsp_volunteer { let name = BoundedVec::try_from(b"bucket".to_vec()).unwrap(); let bucket_id = create_bucket(&owner.clone(), name.clone(), msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( origin, @@ -4516,9 +4519,6 @@ mod bsp_volunteer { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let file_key = FileSystem::compute_file_key( owner.clone(), bucket_id, @@ -4781,6 +4781,9 @@ mod bsp_confirm { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount,)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner_signed.clone(), @@ -4793,9 +4796,6 @@ mod bsp_confirm { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount,)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -4843,6 +4843,10 @@ mod bsp_confirm { let (msp_id, value_prop_id) = add_msp_to_provider_storage(&msp); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_bob_signed.clone(), storage_amount,)); + assert_ok!(bsp_sign_up(bsp_charlie_signed.clone(), storage_amount,)); + let name = BoundedVec::try_from(vec![1]).unwrap(); let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); @@ -4895,10 +4899,6 @@ mod bsp_confirm { Some((msp_id, true)) ); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_bob_signed.clone(), storage_amount,)); - assert_ok!(bsp_sign_up(bsp_charlie_signed.clone(), storage_amount,)); - // Dispatch BSP volunteer. assert_ok!(FileSystem::bsp_volunteer(bsp_bob_signed.clone(), file_key,)); @@ -5174,6 +5174,9 @@ mod bsp_confirm { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner_signed.clone(), @@ -5186,9 +5189,6 @@ mod bsp_confirm { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -5255,6 +5255,9 @@ mod bsp_confirm { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner_signed.clone(), @@ -5267,9 +5270,6 @@ mod bsp_confirm { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -5305,7 +5305,7 @@ mod bsp_confirm { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -5551,6 +5551,9 @@ mod bsp_confirm { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner_signed.clone(), @@ -5563,9 +5566,6 @@ mod bsp_confirm { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -5601,7 +5601,7 @@ mod bsp_confirm { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -5862,6 +5862,9 @@ mod bsp_stop_storing { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner.clone(), @@ -5874,9 +5877,6 @@ mod bsp_stop_storing { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -5919,7 +5919,7 @@ mod bsp_stop_storing { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -5982,6 +5982,9 @@ mod bsp_stop_storing { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner.clone(), @@ -5994,9 +5997,6 @@ mod bsp_stop_storing { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -6039,7 +6039,7 @@ mod bsp_stop_storing { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -6105,6 +6105,9 @@ mod bsp_stop_storing { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner.clone(), @@ -6117,9 +6120,6 @@ mod bsp_stop_storing { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -6162,7 +6162,7 @@ mod bsp_stop_storing { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -6243,6 +6243,9 @@ mod bsp_stop_storing { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner.clone(), @@ -6255,9 +6258,6 @@ mod bsp_stop_storing { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -6300,7 +6300,7 @@ mod bsp_stop_storing { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -6344,7 +6344,7 @@ mod bsp_stop_storing { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -6414,6 +6414,9 @@ mod bsp_stop_storing { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner.clone(), @@ -6426,9 +6429,6 @@ mod bsp_stop_storing { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -6471,7 +6471,7 @@ mod bsp_stop_storing { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -6521,7 +6521,7 @@ mod bsp_stop_storing { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -6572,6 +6572,9 @@ mod bsp_stop_storing { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner.clone(), @@ -6584,9 +6587,6 @@ mod bsp_stop_storing { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -6629,7 +6629,7 @@ mod bsp_stop_storing { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -6690,7 +6690,7 @@ mod bsp_stop_storing { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -6784,6 +6784,9 @@ mod bsp_stop_storing { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner.clone(), @@ -6796,8 +6799,6 @@ mod bsp_stop_storing { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); let file_key = FileSystem::compute_file_key( owner_account_id.clone(), @@ -6863,7 +6864,7 @@ mod bsp_stop_storing { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -6907,7 +6908,7 @@ mod bsp_stop_storing { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -6995,6 +6996,9 @@ mod bsp_stop_storing { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch first storage request. assert_ok!(FileSystem::issue_storage_request( owner.clone(), @@ -7019,9 +7023,6 @@ mod bsp_stop_storing { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let first_file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -7120,7 +7121,7 @@ mod bsp_stop_storing { assert_eq!( file_system::StorageRequests::::get(first_file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: first_file_location.clone(), @@ -7136,7 +7137,7 @@ mod bsp_stop_storing { assert_eq!( file_system::StorageRequests::::get(second_file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: second_file_location.clone(), @@ -7172,7 +7173,7 @@ mod bsp_stop_storing { assert_eq!( file_system::StorageRequests::::get(first_file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: first_file_location.clone(), @@ -7266,6 +7267,9 @@ mod bsp_stop_storing { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner.clone(), @@ -7278,9 +7282,6 @@ mod bsp_stop_storing { None, )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -7339,7 +7340,7 @@ mod bsp_stop_storing { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -7385,6 +7386,9 @@ mod bsp_stop_storing { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner.clone(), @@ -7397,9 +7401,6 @@ mod bsp_stop_storing { None, )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let bsp_id = Providers::get_provider_id(bsp_account_id).unwrap(); let file_key = FileSystem::compute_file_key( @@ -7435,7 +7436,7 @@ mod bsp_stop_storing { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -9122,6 +9123,9 @@ mod stop_storing_for_insolvent_user { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner_signed.clone(), @@ -9134,9 +9138,6 @@ mod stop_storing_for_insolvent_user { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -9172,7 +9173,7 @@ mod stop_storing_for_insolvent_user { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -9316,6 +9317,9 @@ mod stop_storing_for_insolvent_user { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner_signed.clone(), @@ -9328,9 +9332,6 @@ mod stop_storing_for_insolvent_user { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -9388,7 +9389,7 @@ mod stop_storing_for_insolvent_user { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -9481,6 +9482,9 @@ mod stop_storing_for_insolvent_user { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner_signed.clone(), @@ -9493,9 +9497,6 @@ mod stop_storing_for_insolvent_user { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -9531,7 +9532,7 @@ mod stop_storing_for_insolvent_user { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -9717,6 +9718,9 @@ mod stop_storing_for_insolvent_user { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner_signed.clone(), @@ -9729,9 +9733,6 @@ mod stop_storing_for_insolvent_user { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -9767,7 +9768,7 @@ mod stop_storing_for_insolvent_user { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(), @@ -9928,6 +9929,9 @@ mod stop_storing_for_insolvent_user { let bucket_id = create_bucket(&owner_account_id.clone(), name, msp_id, value_prop_id); + // Sign up account as a Backup Storage Provider + assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); + // Dispatch storage request. assert_ok!(FileSystem::issue_storage_request( owner_signed.clone(), @@ -9940,9 +9944,6 @@ mod stop_storing_for_insolvent_user { None )); - // Sign up account as a Backup Storage Provider - assert_ok!(bsp_sign_up(bsp_signed.clone(), storage_amount)); - let file_key = FileSystem::compute_file_key( owner_account_id.clone(), bucket_id, @@ -9978,7 +9979,7 @@ mod stop_storing_for_insolvent_user { assert_eq!( file_system::StorageRequests::::get(file_key), Some(StorageRequestMetadata { - requested_at: 1, + requested_at: System::block_number(), owner: owner_account_id.clone(), bucket_id, location: location.clone(),