Browse Source

runtime: storage: Refactoring.

Shamil Gadelshin 3 years ago
parent
commit
7999fcced0
2 changed files with 160 additions and 130 deletions
  1. 89 59
      runtime-modules/storage/src/tests/fixtures.rs
  2. 71 71
      runtime-modules/storage/src/tests/mod.rs

+ 89 - 59
runtime-modules/storage/src/tests/fixtures.rs

@@ -1297,7 +1297,7 @@ impl CreateDistributionBucketFixture {
     }
 
     pub fn call_and_assert(&self, expected_result: DispatchResult) -> Option<u64> {
-        let next_bucket_id = Storage::distribution_bucket_family_by_id(self.family_id)
+        let next_bucket_index = Storage::distribution_bucket_family_by_id(self.family_id)
             .next_distribution_bucket_index;
         let actual_result = Storage::create_distribution_bucket(
             self.origin.clone().into(),
@@ -1309,20 +1309,23 @@ impl CreateDistributionBucketFixture {
 
         if actual_result.is_ok() {
             assert_eq!(
-                next_bucket_id + 1,
+                next_bucket_index + 1,
                 Storage::distribution_bucket_family_by_id(self.family_id)
                     .next_distribution_bucket_index
             );
 
             let bucket: DistributionBucket<Test> =
-                Storage::distribution_bucket_by_family_id_by_index(self.family_id, next_bucket_id);
+                Storage::distribution_bucket_by_family_id_by_index(
+                    self.family_id,
+                    next_bucket_index,
+                );
 
             assert_eq!(bucket.accepting_new_bags, self.accept_new_bags);
 
-            Some(next_bucket_id)
+            Some(next_bucket_index)
         } else {
             assert_eq!(
-                next_bucket_id,
+                next_bucket_index,
                 Storage::distribution_bucket_family_by_id(self.family_id)
                     .next_distribution_bucket_index
             );
@@ -1335,7 +1338,7 @@ impl CreateDistributionBucketFixture {
 pub struct UpdateDistributionBucketStatusFixture {
     origin: RawOrigin<u64>,
     family_id: u64,
-    distribution_bucket_id: u64,
+    distribution_bucket_index: u64,
     new_status: bool,
 }
 
@@ -1344,13 +1347,13 @@ impl UpdateDistributionBucketStatusFixture {
         Self {
             origin: RawOrigin::Signed(DEFAULT_MEMBER_ACCOUNT_ID),
             family_id: Default::default(),
-            distribution_bucket_id: Default::default(),
+            distribution_bucket_index: Default::default(),
             new_status: false,
         }
     }
-    pub fn with_bucket_id(self, bucket_id: u64) -> Self {
+    pub fn with_bucket_index(self, bucket_index: u64) -> Self {
         Self {
-            distribution_bucket_id: bucket_id,
+            distribution_bucket_index: bucket_index,
             ..self
         }
     }
@@ -1370,7 +1373,7 @@ impl UpdateDistributionBucketStatusFixture {
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
         let actual_result = Storage::update_distribution_bucket_status(
             self.origin.clone().into(),
-            Storage::create_distribution_bucket_id(self.family_id, self.distribution_bucket_id),
+            Storage::create_distribution_bucket_id(self.family_id, self.distribution_bucket_index),
             self.new_status,
         );
 
@@ -1381,7 +1384,7 @@ impl UpdateDistributionBucketStatusFixture {
 pub struct DeleteDistributionBucketFixture {
     origin: RawOrigin<u64>,
     family_id: u64,
-    distribution_bucket_id: u64,
+    distribution_bucket_index: u64,
 }
 
 impl DeleteDistributionBucketFixture {
@@ -1389,13 +1392,13 @@ impl DeleteDistributionBucketFixture {
         Self {
             origin: RawOrigin::Signed(DEFAULT_MEMBER_ACCOUNT_ID),
             family_id: Default::default(),
-            distribution_bucket_id: Default::default(),
+            distribution_bucket_index: Default::default(),
         }
     }
 
-    pub fn with_bucket_id(self, bucket_id: u64) -> Self {
+    pub fn with_bucket_index(self, bucket_index: u64) -> Self {
         Self {
-            distribution_bucket_id: bucket_id,
+            distribution_bucket_index: bucket_index,
             ..self
         }
     }
@@ -1411,7 +1414,7 @@ impl DeleteDistributionBucketFixture {
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
         let actual_result = Storage::delete_distribution_bucket(
             self.origin.clone().into(),
-            Storage::create_distribution_bucket_id(self.family_id, self.distribution_bucket_id),
+            Storage::create_distribution_bucket_id(self.family_id, self.distribution_bucket_index),
         );
 
         assert_eq!(actual_result, expected_result);
@@ -1422,8 +1425,8 @@ pub struct UpdateDistributionBucketForBagsFixture {
     origin: RawOrigin<u64>,
     bag_id: BagId<Test>,
     family_id: u64,
-    add_bucket_ids: BTreeSet<u64>,
-    remove_bucket_ids: BTreeSet<u64>,
+    add_bucket_indices: BTreeSet<u64>,
+    remove_bucket_indices: BTreeSet<u64>,
 }
 
 impl UpdateDistributionBucketForBagsFixture {
@@ -1432,8 +1435,8 @@ impl UpdateDistributionBucketForBagsFixture {
             origin: RawOrigin::Signed(DEFAULT_ACCOUNT_ID),
             bag_id: Default::default(),
             family_id: Default::default(),
-            add_bucket_ids: Default::default(),
-            remove_bucket_ids: Default::default(),
+            add_bucket_indices: Default::default(),
+            remove_bucket_indices: Default::default(),
         }
     }
 
@@ -1441,16 +1444,16 @@ impl UpdateDistributionBucketForBagsFixture {
         Self { origin, ..self }
     }
 
-    pub fn with_add_bucket_ids(self, add_bucket_ids: BTreeSet<u64>) -> Self {
+    pub fn with_add_bucket_indices(self, add_bucket_indices: BTreeSet<u64>) -> Self {
         Self {
-            add_bucket_ids,
+            add_bucket_indices,
             ..self
         }
     }
 
-    pub fn with_remove_bucket_ids(self, remove_bucket_ids: BTreeSet<u64>) -> Self {
+    pub fn with_remove_bucket_indices(self, remove_bucket_indices: BTreeSet<u64>) -> Self {
         Self {
-            remove_bucket_ids,
+            remove_bucket_indices,
             ..self
         }
     }
@@ -1468,8 +1471,8 @@ impl UpdateDistributionBucketForBagsFixture {
             self.origin.clone().into(),
             self.bag_id.clone(),
             self.family_id,
-            self.add_bucket_ids.clone(),
-            self.remove_bucket_ids.clone(),
+            self.add_bucket_indices.clone(),
+            self.remove_bucket_indices.clone(),
         );
 
         assert_eq!(actual_result, expected_result);
@@ -1521,7 +1524,7 @@ impl UpdateDistributionBucketsPerBagLimitFixture {
 pub struct UpdateDistributionBucketModeFixture {
     origin: RawOrigin<u64>,
     family_id: u64,
-    distribution_bucket_id: u64,
+    distribution_bucket_index: u64,
     distributing: bool,
 }
 
@@ -1530,13 +1533,13 @@ impl UpdateDistributionBucketModeFixture {
         Self {
             origin: RawOrigin::Signed(DEFAULT_MEMBER_ACCOUNT_ID),
             family_id: Default::default(),
-            distribution_bucket_id: Default::default(),
+            distribution_bucket_index: Default::default(),
             distributing: true,
         }
     }
-    pub fn with_bucket_id(self, bucket_id: u64) -> Self {
+    pub fn with_bucket_index(self, bucket_index: u64) -> Self {
         Self {
-            distribution_bucket_id: bucket_id,
+            distribution_bucket_index: bucket_index,
             ..self
         }
     }
@@ -1559,7 +1562,7 @@ impl UpdateDistributionBucketModeFixture {
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
         let actual_result = Storage::update_distribution_bucket_mode(
             self.origin.clone().into(),
-            Storage::create_distribution_bucket_id(self.family_id, self.distribution_bucket_id),
+            Storage::create_distribution_bucket_id(self.family_id, self.distribution_bucket_index),
             self.distributing,
         );
 
@@ -1621,7 +1624,7 @@ pub struct InviteDistributionBucketOperatorFixture {
     origin: RawOrigin<u64>,
     operator_worker_id: u64,
     family_id: u64,
-    bucket_id: u64,
+    bucket_index: u64,
 }
 
 impl InviteDistributionBucketOperatorFixture {
@@ -1629,7 +1632,7 @@ impl InviteDistributionBucketOperatorFixture {
         Self {
             origin: RawOrigin::Signed(DEFAULT_ACCOUNT_ID),
             operator_worker_id: DEFAULT_WORKER_ID,
-            bucket_id: Default::default(),
+            bucket_index: Default::default(),
             family_id: Default::default(),
         }
     }
@@ -1645,8 +1648,11 @@ impl InviteDistributionBucketOperatorFixture {
         }
     }
 
-    pub fn with_bucket_id(self, bucket_id: u64) -> Self {
-        Self { bucket_id, ..self }
+    pub fn with_bucket_index(self, bucket_index: u64) -> Self {
+        Self {
+            bucket_index,
+            ..self
+        }
     }
 
     pub fn with_family_id(self, family_id: u64) -> Self {
@@ -1656,7 +1662,7 @@ impl InviteDistributionBucketOperatorFixture {
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
         let actual_result = Storage::invite_distribution_bucket_operator(
             self.origin.clone().into(),
-            Storage::create_distribution_bucket_id(self.family_id, self.bucket_id),
+            Storage::create_distribution_bucket_id(self.family_id, self.bucket_index),
             self.operator_worker_id,
         );
 
@@ -1664,7 +1670,10 @@ impl InviteDistributionBucketOperatorFixture {
 
         if actual_result.is_ok() {
             let new_bucket: DistributionBucket<Test> =
-                Storage::distribution_bucket_by_family_id_by_index(self.family_id, self.bucket_id);
+                Storage::distribution_bucket_by_family_id_by_index(
+                    self.family_id,
+                    self.bucket_index,
+                );
 
             assert!(new_bucket
                 .pending_invitations
@@ -1675,7 +1684,7 @@ impl InviteDistributionBucketOperatorFixture {
 
 pub struct CancelDistributionBucketInvitationFixture {
     origin: RawOrigin<u64>,
-    bucket_id: u64,
+    bucket_index: u64,
     family_id: u64,
     operator_worker_id: u64,
 }
@@ -1684,7 +1693,7 @@ impl CancelDistributionBucketInvitationFixture {
     pub fn default() -> Self {
         Self {
             origin: RawOrigin::Signed(DEFAULT_DISTRIBUTION_PROVIDER_ACCOUNT_ID),
-            bucket_id: Default::default(),
+            bucket_index: Default::default(),
             family_id: Default::default(),
             operator_worker_id: Default::default(),
         }
@@ -1694,8 +1703,11 @@ impl CancelDistributionBucketInvitationFixture {
         Self { origin, ..self }
     }
 
-    pub fn with_bucket_id(self, bucket_id: u64) -> Self {
-        Self { bucket_id, ..self }
+    pub fn with_bucket_index(self, bucket_index: u64) -> Self {
+        Self {
+            bucket_index,
+            ..self
+        }
     }
 
     pub fn with_family_id(self, family_id: u64) -> Self {
@@ -1712,7 +1724,7 @@ impl CancelDistributionBucketInvitationFixture {
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
         let actual_result = Storage::cancel_distribution_bucket_operator_invite(
             self.origin.clone().into(),
-            Storage::create_distribution_bucket_id(self.family_id, self.bucket_id),
+            Storage::create_distribution_bucket_id(self.family_id, self.bucket_index),
             self.operator_worker_id,
         );
 
@@ -1720,7 +1732,10 @@ impl CancelDistributionBucketInvitationFixture {
 
         if actual_result.is_ok() {
             let new_bucket: DistributionBucket<Test> =
-                Storage::distribution_bucket_by_family_id_by_index(self.family_id, self.bucket_id);
+                Storage::distribution_bucket_by_family_id_by_index(
+                    self.family_id,
+                    self.bucket_index,
+                );
 
             assert!(!new_bucket
                 .pending_invitations
@@ -1731,7 +1746,7 @@ impl CancelDistributionBucketInvitationFixture {
 
 pub struct AcceptDistributionBucketInvitationFixture {
     origin: RawOrigin<u64>,
-    bucket_id: u64,
+    bucket_index: u64,
     family_id: u64,
     worker_id: u64,
 }
@@ -1740,7 +1755,7 @@ impl AcceptDistributionBucketInvitationFixture {
     pub fn default() -> Self {
         Self {
             origin: RawOrigin::Signed(DEFAULT_DISTRIBUTION_PROVIDER_ACCOUNT_ID),
-            bucket_id: Default::default(),
+            bucket_index: Default::default(),
             family_id: Default::default(),
             worker_id: Default::default(),
         }
@@ -1750,8 +1765,11 @@ impl AcceptDistributionBucketInvitationFixture {
         Self { origin, ..self }
     }
 
-    pub fn with_bucket_id(self, bucket_id: u64) -> Self {
-        Self { bucket_id, ..self }
+    pub fn with_bucket_index(self, bucket_index: u64) -> Self {
+        Self {
+            bucket_index,
+            ..self
+        }
     }
 
     pub fn with_family_id(self, family_id: u64) -> Self {
@@ -1766,14 +1784,17 @@ impl AcceptDistributionBucketInvitationFixture {
         let actual_result = Storage::accept_distribution_bucket_invitation(
             self.origin.clone().into(),
             self.worker_id,
-            Storage::create_distribution_bucket_id(self.family_id, self.bucket_id),
+            Storage::create_distribution_bucket_id(self.family_id, self.bucket_index),
         );
 
         assert_eq!(actual_result, expected_result);
 
         if actual_result.is_ok() {
             let new_bucket: DistributionBucket<Test> =
-                Storage::distribution_bucket_by_family_id_by_index(self.family_id, self.bucket_id);
+                Storage::distribution_bucket_by_family_id_by_index(
+                    self.family_id,
+                    self.bucket_index,
+                );
 
             assert!(!new_bucket.pending_invitations.contains(&self.worker_id));
 
@@ -1784,7 +1805,7 @@ impl AcceptDistributionBucketInvitationFixture {
 
 pub struct SetDistributionBucketMetadataFixture {
     origin: RawOrigin<u64>,
-    bucket_id: u64,
+    bucket_index: u64,
     family_id: u64,
     worker_id: u64,
     metadata: Vec<u8>,
@@ -1794,7 +1815,7 @@ impl SetDistributionBucketMetadataFixture {
     pub fn default() -> Self {
         Self {
             origin: RawOrigin::Signed(DEFAULT_DISTRIBUTION_PROVIDER_ACCOUNT_ID),
-            bucket_id: Default::default(),
+            bucket_index: Default::default(),
             family_id: Default::default(),
             worker_id: Default::default(),
             metadata: Default::default(),
@@ -1809,8 +1830,11 @@ impl SetDistributionBucketMetadataFixture {
         Self { origin, ..self }
     }
 
-    pub fn with_bucket_id(self, bucket_id: u64) -> Self {
-        Self { bucket_id, ..self }
+    pub fn with_bucket_index(self, bucket_index: u64) -> Self {
+        Self {
+            bucket_index,
+            ..self
+        }
     }
 
     pub fn with_family_id(self, family_id: u64) -> Self {
@@ -1825,7 +1849,7 @@ impl SetDistributionBucketMetadataFixture {
         let actual_result = Storage::set_distribution_operator_metadata(
             self.origin.clone().into(),
             self.worker_id,
-            Storage::create_distribution_bucket_id(self.family_id, self.bucket_id),
+            Storage::create_distribution_bucket_id(self.family_id, self.bucket_index),
             self.metadata.clone(),
         );
 
@@ -1835,7 +1859,7 @@ impl SetDistributionBucketMetadataFixture {
 
 pub struct RemoveDistributionBucketOperatorFixture {
     origin: RawOrigin<u64>,
-    bucket_id: u64,
+    bucket_index: u64,
     family_id: u64,
     operator_worker_id: u64,
 }
@@ -1844,7 +1868,7 @@ impl RemoveDistributionBucketOperatorFixture {
     pub fn default() -> Self {
         Self {
             origin: RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID),
-            bucket_id: Default::default(),
+            bucket_index: Default::default(),
             family_id: Default::default(),
             operator_worker_id: Default::default(),
         }
@@ -1854,8 +1878,11 @@ impl RemoveDistributionBucketOperatorFixture {
         Self { origin, ..self }
     }
 
-    pub fn with_bucket_id(self, bucket_id: u64) -> Self {
-        Self { bucket_id, ..self }
+    pub fn with_bucket_index(self, bucket_index: u64) -> Self {
+        Self {
+            bucket_index,
+            ..self
+        }
     }
 
     pub fn with_family_id(self, family_id: u64) -> Self {
@@ -1872,14 +1899,17 @@ impl RemoveDistributionBucketOperatorFixture {
     pub fn call_and_assert(&self, expected_result: DispatchResult) {
         let actual_result = Storage::remove_distribution_bucket_operator(
             self.origin.clone().into(),
-            Storage::create_distribution_bucket_id(self.family_id, self.bucket_id),
+            Storage::create_distribution_bucket_id(self.family_id, self.bucket_index),
             self.operator_worker_id,
         );
 
         assert_eq!(actual_result, expected_result);
         if actual_result.is_ok() {
             let new_bucket: DistributionBucket<Test> =
-                Storage::distribution_bucket_by_family_id_by_index(self.family_id, self.bucket_id);
+                Storage::distribution_bucket_by_family_id_by_index(
+                    self.family_id,
+                    self.bucket_index,
+                );
 
             assert!(!new_bucket.operators.contains(&self.operator_worker_id));
         }

+ 71 - 71
runtime-modules/storage/src/tests/mod.rs

@@ -3527,7 +3527,7 @@ fn delete_distribution_bucket_family_fails_with_assgined_bags() {
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .with_bag_id(bag_id.clone())
             .with_family_id(family_id)
-            .with_add_bucket_ids(add_buckets_ids.clone())
+            .with_add_bucket_indices(add_buckets_ids.clone())
             .call_and_assert(Ok(()));
 
         let add_buckets = add_buckets_ids
@@ -3681,7 +3681,7 @@ fn update_distribution_bucket_status_succeeded() {
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
@@ -3690,19 +3690,19 @@ fn update_distribution_bucket_status_succeeded() {
         let new_status = true;
         UpdateDistributionBucketStatusFixture::default()
             .with_family_id(family_id)
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .with_new_status(new_status)
             .call_and_assert(Ok(()));
 
         assert_eq!(
-            Storage::distribution_bucket_by_family_id_by_index(family_id, &bucket_id)
+            Storage::distribution_bucket_by_family_id_by_index(family_id, &bucket_index)
                 .accepting_new_bags,
             new_status
         );
 
         EventFixture::assert_last_crate_event(RawEvent::DistributionBucketStatusUpdated(
-            Storage::create_distribution_bucket_id(family_id, bucket_id),
+            Storage::create_distribution_bucket_id(family_id, bucket_index),
             new_status,
         ));
     });
@@ -3743,20 +3743,20 @@ fn delete_distribution_bucket_succeeded() {
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
             .unwrap();
 
         DeleteDistributionBucketFixture::default()
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()));
 
         EventFixture::assert_last_crate_event(RawEvent::DistributionBucketDeleted(
-            Storage::create_distribution_bucket_id(family_id, bucket_id),
+            Storage::create_distribution_bucket_id(family_id, bucket_index),
         ));
     });
 }
@@ -3774,23 +3774,23 @@ fn delete_distribution_bucket_fails_with_assgined_bags() {
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_accept_new_bags(true)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let add_buckets_ids = BTreeSet::from_iter(vec![bucket_id]);
+        let add_buckets_indices = BTreeSet::from_iter(vec![bucket_index]);
 
         UpdateDistributionBucketForBagsFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .with_bag_id(bag_id.clone())
             .with_family_id(family_id)
-            .with_add_bucket_ids(add_buckets_ids.clone())
+            .with_add_bucket_indices(add_buckets_indices.clone())
             .call_and_assert(Ok(()));
 
-        let add_buckets = add_buckets_ids
+        let add_buckets = add_buckets_indices
             .iter()
             .map(|idx| Storage::create_distribution_bucket_id(family_id, *idx))
             .collect::<BTreeSet<_>>();
@@ -3798,7 +3798,7 @@ fn delete_distribution_bucket_fails_with_assgined_bags() {
         assert_eq!(bag.distributed_by, add_buckets);
 
         DeleteDistributionBucketFixture::default()
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Err(Error::<Test>::DistributionBucketIsBoundToBag.into()));
@@ -3813,7 +3813,7 @@ fn delete_distribution_bucket_failed_with_existing_operators() {
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
@@ -3821,7 +3821,7 @@ fn delete_distribution_bucket_failed_with_existing_operators() {
 
         InviteDistributionBucketOperatorFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_operator_worker_id(DEFAULT_DISTRIBUTION_PROVIDER_ID)
             .call_and_assert(Ok(()));
@@ -3829,12 +3829,12 @@ fn delete_distribution_bucket_failed_with_existing_operators() {
         AcceptDistributionBucketInvitationFixture::default()
             .with_origin(RawOrigin::Signed(DEFAULT_DISTRIBUTION_PROVIDER_ACCOUNT_ID))
             .with_family_id(family_id)
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_worker_id(DEFAULT_DISTRIBUTION_PROVIDER_ID)
             .call_and_assert(Ok(()));
 
         DeleteDistributionBucketFixture::default()
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Err(Error::<Test>::DistributionProviderOperatorSet.into()));
@@ -3896,7 +3896,7 @@ fn update_distribution_buckets_for_bags_succeeded() {
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .with_bag_id(bag_id.clone())
             .with_family_id(family_id)
-            .with_add_bucket_ids(add_buckets_ids.clone())
+            .with_add_bucket_indices(add_buckets_ids.clone())
             .call_and_assert(Ok(()));
 
         let add_buckets = add_buckets_ids
@@ -3941,7 +3941,7 @@ fn update_distribution_buckets_for_bags_succeeded_with_additioonal_checks_on_add
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .with_bag_id(bag_id.clone())
             .with_family_id(family_id)
-            .with_add_bucket_ids(add_buckets_ids.clone())
+            .with_add_bucket_indices(add_buckets_ids.clone())
             .call_and_assert(Ok(()));
 
         // Add check
@@ -3961,7 +3961,7 @@ fn update_distribution_buckets_for_bags_succeeded_with_additioonal_checks_on_add
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .with_bag_id(bag_id.clone())
             .with_family_id(family_id)
-            .with_remove_bucket_ids(add_buckets_ids.clone())
+            .with_remove_bucket_indices(add_buckets_ids.clone())
             .call_and_assert(Ok(()));
 
         let bag = Storage::bag(&bag_id);
@@ -3995,7 +3995,7 @@ fn update_distribution_buckets_for_bags_fails_with_non_existing_dynamic_bag() {
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .with_family_id(family_id)
             .with_bag_id(bag_id.clone())
-            .with_add_bucket_ids(add_buckets.clone())
+            .with_add_bucket_indices(add_buckets.clone())
             .call_and_assert(Err(Error::<Test>::DynamicBagDoesntExist.into()));
     });
 }
@@ -4026,7 +4026,7 @@ fn update_distribution_buckets_for_bags_fails_with_non_accepting_new_bags_bucket
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .with_family_id(family_id)
             .with_bag_id(bag_id.clone())
-            .with_add_bucket_ids(add_buckets.clone())
+            .with_add_bucket_indices(add_buckets.clone())
             .call_and_assert(Err(
                 Error::<Test>::DistributionBucketDoesntAcceptNewBags.into()
             ));
@@ -4074,7 +4074,7 @@ fn update_distribution_buckets_for_bags_fails_with_non_existing_distribution_buc
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .with_bag_id(bag_id.clone())
             .with_family_id(family_id)
-            .with_add_bucket_ids(buckets.clone())
+            .with_add_bucket_indices(buckets.clone())
             .call_and_assert(Err(Error::<Test>::DistributionBucketDoesntExist.into()));
 
         // Invalid removed bucket ID.
@@ -4082,7 +4082,7 @@ fn update_distribution_buckets_for_bags_fails_with_non_existing_distribution_buc
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .with_bag_id(bag_id.clone())
             .with_family_id(family_id)
-            .with_remove_bucket_ids(buckets.clone())
+            .with_remove_bucket_indices(buckets.clone())
             .call_and_assert(Err(Error::<Test>::DistributionBucketDoesntExist.into()));
     });
 }
@@ -4155,7 +4155,7 @@ fn update_distribution_bucket_mode_succeeded() {
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
@@ -4164,19 +4164,19 @@ fn update_distribution_bucket_mode_succeeded() {
         let distributing = false;
         UpdateDistributionBucketModeFixture::default()
             .with_family_id(family_id)
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .with_distributing(distributing)
             .call_and_assert(Ok(()));
 
         assert_eq!(
-            Storage::distribution_bucket_by_family_id_by_index(family_id, &bucket_id)
+            Storage::distribution_bucket_by_family_id_by_index(family_id, &bucket_index)
                 .accepting_new_bags,
             distributing
         );
 
         EventFixture::assert_last_crate_event(RawEvent::DistributionBucketModeUpdated(
-            Storage::create_distribution_bucket_id(family_id, bucket_id),
+            Storage::create_distribution_bucket_id(family_id, bucket_index),
             distributing,
         ));
     });
@@ -4358,7 +4358,7 @@ fn invite_distribution_bucket_operator_succeeded() {
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
@@ -4366,13 +4366,13 @@ fn invite_distribution_bucket_operator_succeeded() {
 
         InviteDistributionBucketOperatorFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_operator_worker_id(provider_id)
             .call_and_assert(Ok(()));
 
         EventFixture::assert_last_crate_event(RawEvent::DistributionBucketOperatorInvited(
-            Storage::create_distribution_bucket_id(family_id, bucket_id),
+            Storage::create_distribution_bucket_id(family_id, bucket_index),
             provider_id,
         ));
     });
@@ -4414,7 +4414,7 @@ fn invite_distribution_bucket_operator_fails_with_non_missing_invitation() {
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
@@ -4422,14 +4422,14 @@ fn invite_distribution_bucket_operator_fails_with_non_missing_invitation() {
 
         InviteDistributionBucketOperatorFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_operator_worker_id(invited_worker_id)
             .call_and_assert(Ok(()));
 
         InviteDistributionBucketOperatorFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_operator_worker_id(invited_worker_id)
             .call_and_assert(Err(
@@ -4449,7 +4449,7 @@ fn invite_distribution_bucket_operator_fails_with_exceeding_the_limit_of_pending
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
@@ -4457,14 +4457,14 @@ fn invite_distribution_bucket_operator_fails_with_exceeding_the_limit_of_pending
 
         InviteDistributionBucketOperatorFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_operator_worker_id(invited_worker_id)
             .call_and_assert(Ok(()));
 
         InviteDistributionBucketOperatorFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_operator_worker_id(another_worker_id)
             .call_and_assert(Err(
@@ -4484,7 +4484,7 @@ fn invite_distribution_bucket_operator_fails_with_already_set_operator() {
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
@@ -4492,21 +4492,21 @@ fn invite_distribution_bucket_operator_fails_with_already_set_operator() {
 
         InviteDistributionBucketOperatorFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_operator_worker_id(invited_worker_id)
             .call_and_assert(Ok(()));
 
         AcceptDistributionBucketInvitationFixture::default()
             .with_origin(RawOrigin::Signed(DEFAULT_DISTRIBUTION_PROVIDER_ACCOUNT_ID))
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_worker_id(invited_worker_id)
             .call_and_assert(Ok(()));
 
         InviteDistributionBucketOperatorFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_operator_worker_id(invited_worker_id)
             .call_and_assert(Err(Error::<Test>::DistributionProviderOperatorSet.into()));
@@ -4523,7 +4523,7 @@ fn invite_distribution_bucket_operator_fails_with_invalid_distribution_provider_
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
@@ -4531,7 +4531,7 @@ fn invite_distribution_bucket_operator_fails_with_invalid_distribution_provider_
 
         InviteDistributionBucketOperatorFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_operator_worker_id(invalid_provider_id)
             .call_and_assert(Err(
@@ -4553,7 +4553,7 @@ fn cancel_distribution_bucket_operator_invite_succeeded() {
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
@@ -4561,7 +4561,7 @@ fn cancel_distribution_bucket_operator_invite_succeeded() {
 
         InviteDistributionBucketOperatorFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_operator_worker_id(provider_id)
             .call_and_assert(Ok(()));
@@ -4569,12 +4569,12 @@ fn cancel_distribution_bucket_operator_invite_succeeded() {
         CancelDistributionBucketInvitationFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .with_family_id(family_id)
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_operator_worker_id(provider_id)
             .call_and_assert(Ok(()));
 
         EventFixture::assert_last_crate_event(RawEvent::DistributionBucketInvitationCancelled(
-            Storage::create_distribution_bucket_id(family_id, bucket_id),
+            Storage::create_distribution_bucket_id(family_id, bucket_index),
             provider_id,
         ));
     });
@@ -4614,7 +4614,7 @@ fn cancel_distribution_bucket_operator_invite_fails_with_non_invited_distributio
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
@@ -4623,7 +4623,7 @@ fn cancel_distribution_bucket_operator_invite_fails_with_non_invited_distributio
         CancelDistributionBucketInvitationFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .with_family_id(family_id)
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .call_and_assert(Err(Error::<Test>::NoDistributionBucketInvitation.into()));
     });
 }
@@ -4641,7 +4641,7 @@ fn accept_distribution_bucket_operator_invite_succeeded() {
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
@@ -4649,7 +4649,7 @@ fn accept_distribution_bucket_operator_invite_succeeded() {
 
         InviteDistributionBucketOperatorFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_operator_worker_id(provider_id)
             .call_and_assert(Ok(()));
@@ -4657,13 +4657,13 @@ fn accept_distribution_bucket_operator_invite_succeeded() {
         AcceptDistributionBucketInvitationFixture::default()
             .with_origin(RawOrigin::Signed(DEFAULT_DISTRIBUTION_PROVIDER_ACCOUNT_ID))
             .with_family_id(family_id)
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_worker_id(provider_id)
             .call_and_assert(Ok(()));
 
         EventFixture::assert_last_crate_event(RawEvent::DistributionBucketInvitationAccepted(
             provider_id,
-            Storage::create_distribution_bucket_id(family_id, bucket_id),
+            Storage::create_distribution_bucket_id(family_id, bucket_index),
         ));
     });
 }
@@ -4702,7 +4702,7 @@ fn accept_distribution_bucket_operator_invite_fails_with_non_invited_distributio
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
@@ -4711,7 +4711,7 @@ fn accept_distribution_bucket_operator_invite_fails_with_non_invited_distributio
         AcceptDistributionBucketInvitationFixture::default()
             .with_origin(RawOrigin::Signed(DEFAULT_DISTRIBUTION_PROVIDER_ACCOUNT_ID))
             .with_family_id(family_id)
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .call_and_assert(Err(Error::<Test>::NoDistributionBucketInvitation.into()));
     });
 }
@@ -4730,7 +4730,7 @@ fn set_distribution_operator_metadata_succeeded() {
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
@@ -4738,7 +4738,7 @@ fn set_distribution_operator_metadata_succeeded() {
 
         InviteDistributionBucketOperatorFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_operator_worker_id(provider_id)
             .call_and_assert(Ok(()));
@@ -4746,21 +4746,21 @@ fn set_distribution_operator_metadata_succeeded() {
         AcceptDistributionBucketInvitationFixture::default()
             .with_origin(RawOrigin::Signed(DEFAULT_DISTRIBUTION_PROVIDER_ACCOUNT_ID))
             .with_family_id(family_id)
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_worker_id(provider_id)
             .call_and_assert(Ok(()));
 
         SetDistributionBucketMetadataFixture::default()
             .with_origin(RawOrigin::Signed(DEFAULT_DISTRIBUTION_PROVIDER_ACCOUNT_ID))
             .with_family_id(family_id)
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_worker_id(provider_id)
             .with_metadata(metadata.clone())
             .call_and_assert(Ok(()));
 
         EventFixture::assert_last_crate_event(RawEvent::DistributionBucketMetadataSet(
             provider_id,
-            Storage::create_distribution_bucket_id(family_id, bucket_id),
+            Storage::create_distribution_bucket_id(family_id, bucket_index),
             metadata,
         ));
     });
@@ -4800,7 +4800,7 @@ fn set_distribution_operator_metadata_fails_with_non_distribution_provider() {
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
@@ -4809,7 +4809,7 @@ fn set_distribution_operator_metadata_fails_with_non_distribution_provider() {
         SetDistributionBucketMetadataFixture::default()
             .with_origin(RawOrigin::Signed(DEFAULT_DISTRIBUTION_PROVIDER_ACCOUNT_ID))
             .with_family_id(family_id)
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .call_and_assert(Err(
                 Error::<Test>::MustBeDistributionProviderOperatorForBucket.into(),
             ));
@@ -4829,7 +4829,7 @@ fn remove_distribution_bucket_operator_succeeded() {
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
@@ -4837,7 +4837,7 @@ fn remove_distribution_bucket_operator_succeeded() {
 
         InviteDistributionBucketOperatorFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_operator_worker_id(operator_id)
             .call_and_assert(Ok(()));
@@ -4845,19 +4845,19 @@ fn remove_distribution_bucket_operator_succeeded() {
         AcceptDistributionBucketInvitationFixture::default()
             .with_origin(RawOrigin::Signed(DEFAULT_DISTRIBUTION_PROVIDER_ACCOUNT_ID))
             .with_family_id(family_id)
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_worker_id(operator_id)
             .call_and_assert(Ok(()));
 
         RemoveDistributionBucketOperatorFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .with_family_id(family_id)
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_operator_worker_id(operator_id)
             .call_and_assert(Ok(()));
 
         EventFixture::assert_last_crate_event(RawEvent::DistributionBucketOperatorRemoved(
-            Storage::create_distribution_bucket_id(family_id, bucket_id),
+            Storage::create_distribution_bucket_id(family_id, bucket_index),
             operator_id,
         ));
     });
@@ -4897,7 +4897,7 @@ fn remove_distribution_bucket_operator_fails_with_non_accepted_distribution_prov
             .call_and_assert(Ok(()))
             .unwrap();
 
-        let bucket_id = CreateDistributionBucketFixture::default()
+        let bucket_index = CreateDistributionBucketFixture::default()
             .with_family_id(family_id)
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .call_and_assert(Ok(()))
@@ -4906,7 +4906,7 @@ fn remove_distribution_bucket_operator_fails_with_non_accepted_distribution_prov
         RemoveDistributionBucketOperatorFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .with_family_id(family_id)
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_operator_worker_id(operator_id)
             .call_and_assert(Err(
                 Error::<Test>::MustBeDistributionProviderOperatorForBucket.into(),
@@ -4914,7 +4914,7 @@ fn remove_distribution_bucket_operator_fails_with_non_accepted_distribution_prov
 
         InviteDistributionBucketOperatorFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_family_id(family_id)
             .with_operator_worker_id(operator_id)
             .call_and_assert(Ok(()));
@@ -4922,7 +4922,7 @@ fn remove_distribution_bucket_operator_fails_with_non_accepted_distribution_prov
         RemoveDistributionBucketOperatorFixture::default()
             .with_origin(RawOrigin::Signed(DISTRIBUTION_WG_LEADER_ACCOUNT_ID))
             .with_family_id(family_id)
-            .with_bucket_id(bucket_id)
+            .with_bucket_index(bucket_index)
             .with_operator_worker_id(operator_id)
             .call_and_assert(Err(
                 Error::<Test>::MustBeDistributionProviderOperatorForBucket.into(),