Browse Source

Storage: renamings

iorveth 4 years ago
parent
commit
eff2489ca1

+ 34 - 34
node/src/chain_spec/content_config.rs

@@ -15,16 +15,16 @@ struct Content {
     content_id: ContentId,
     data_object: DataObject<Runtime>,
     storage_object_owner: StorageObjectOwner<MemberId, ChannelId, DAOId>,
-    quota: Quota,
+    voucher: Voucher,
 }
 
 #[derive(Decode)]
 struct ContentData {
     /// DataObject(s) and ContentId
     data_objects: Vec<Content>,
-    quota_size_limit_upper_bound: u64,
-    quota_objects_limit_upper_bound: u64,
-    global_quota: Quota,
+    voucher_size_limit_upper_bound: u64,
+    voucher_objects_limit_upper_bound: u64,
+    global_voucher: Voucher,
     uploading_blocked: bool,
 }
 
@@ -36,8 +36,8 @@ struct EncodedContent {
     data_object: String,
     /// hex encoded StorageObjectOwner
     storage_object_owner: String,
-    /// hex encoded Quota
-    quota: String,
+    /// hex encoded Voucher
+    voucher: String,
 }
 
 impl EncodedContent {
@@ -49,14 +49,14 @@ impl EncodedContent {
             .expect("failed to parse data_object hex string");
         let encoded_storage_object_owner = hex::decode(&self.storage_object_owner[2..].as_bytes())
             .expect("failed to parse content_id hex string");
-        let encoded_quota = hex::decode(&self.quota[2..].as_bytes())
+        let encoded_voucher = hex::decode(&self.voucher[2..].as_bytes())
             .expect("failed to parse data_object hex string");
         Content {
             content_id: Decode::decode(&mut encoded_content_id.as_slice()).unwrap(),
             data_object: Decode::decode(&mut encoded_data_object.as_slice()).unwrap(),
             storage_object_owner: Decode::decode(&mut encoded_storage_object_owner.as_slice())
                 .unwrap(),
-            quota: Decode::decode(&mut encoded_quota.as_slice()).unwrap(),
+            voucher: Decode::decode(&mut encoded_voucher.as_slice()).unwrap(),
         }
     }
 }
@@ -65,12 +65,12 @@ impl EncodedContent {
 struct EncodedContentData {
     /// EncodedContent
     data_objects: Vec<EncodedContent>,
-    /// hex encoded QuotaSizeLimitUpperBound
-    quota_size_limit_upper_bound: String,
-    /// hex encoded QuotaObjectsLimitUpperBound
-    quota_objects_limit_upper_bound: String,
-    /// hex encoded GlobalQuota
-    global_quota: String,
+    /// hex encoded VoucherSizeLimitUpperBound
+    voucher_size_limit_upper_bound: String,
+    /// hex encoded VoucherObjectsLimitUpperBound
+    voucher_objects_limit_upper_bound: String,
+    /// hex encoded GlobalVoucher
+    global_voucher: String,
     /// hex encoded UploadingBlocked flag
     uploading_blocked: String,
 }
@@ -88,25 +88,25 @@ impl EncodedContentData {
                 .iter()
                 .map(|data_objects| data_objects.decode())
                 .collect(),
-            quota_size_limit_upper_bound: {
-                let encoded_quota_size_limit_upper_bound =
-                    hex::decode(&self.quota_size_limit_upper_bound[2..].as_bytes())
+            voucher_size_limit_upper_bound: {
+                let encoded_voucher_size_limit_upper_bound =
+                    hex::decode(&self.voucher_size_limit_upper_bound[2..].as_bytes())
                         .expect("failed to parse data_object hex string");
 
-                Decode::decode(&mut encoded_quota_size_limit_upper_bound.as_slice()).unwrap()
+                Decode::decode(&mut encoded_voucher_size_limit_upper_bound.as_slice()).unwrap()
             },
-            quota_objects_limit_upper_bound: {
-                let encoded_quota_objects_limit_upper_bound =
-                    hex::decode(&self.quota_objects_limit_upper_bound[2..].as_bytes())
+            voucher_objects_limit_upper_bound: {
+                let encoded_voucher_objects_limit_upper_bound =
+                    hex::decode(&self.voucher_objects_limit_upper_bound[2..].as_bytes())
                         .expect("failed to parse data_object hex string");
 
-                Decode::decode(&mut encoded_quota_objects_limit_upper_bound.as_slice()).unwrap()
+                Decode::decode(&mut encoded_voucher_objects_limit_upper_bound.as_slice()).unwrap()
             },
-            global_quota: {
-                let encoded_global_quota = hex::decode(&self.global_quota[2..].as_bytes())
+            global_voucher: {
+                let encoded_global_voucher = hex::decode(&self.global_voucher[2..].as_bytes())
                     .expect("failed to parse data_object hex string");
 
-                Decode::decode(&mut encoded_global_quota.as_slice()).unwrap()
+                Decode::decode(&mut encoded_global_voucher.as_slice()).unwrap()
             },
             uploading_blocked: {
                 let encoded_uploading_blocked =
@@ -123,10 +123,10 @@ impl EncodedContentData {
 pub fn empty_data_directory_config() -> DataDirectoryConfig {
     DataDirectoryConfig {
         data_object_by_content_id: vec![],
-        quotas: vec![],
-        quota_size_limit_upper_bound: DEFAULT_QUOTA_SIZE_LIMIT_UPPER_BOUND,
-        quota_objects_limit_upper_bound: DEFAULT_QUOTA_OBJECTS_LIMIT_UPPER_BOUND,
-        global_quota: DEFAULT_GLOBAL_QUOTA,
+        vouchers: vec![],
+        voucher_size_limit_upper_bound: DEFAULT_VOUCHER_SIZE_LIMIT_UPPER_BOUND,
+        voucher_objects_limit_upper_bound: DEFAULT_VOUCHER_OBJECTS_LIMIT_UPPER_BOUND,
+        global_voucher: DEFAULT_GLOBAL_VOUCHER,
         uploading_blocked: DEFAULT_UPLOADING_BLOCKED_STATUS,
     }
 }
@@ -143,14 +143,14 @@ pub fn data_directory_config_from_json(data_file: &Path) -> DataDirectoryConfig
             .iter()
             .map(|object| (object.content_id, object.data_object.clone()))
             .collect(),
-        quotas: content
+        vouchers: content
             .data_objects
             .iter()
-            .map(|object| (object.storage_object_owner.clone(), object.quota))
+            .map(|object| (object.storage_object_owner.clone(), object.voucher))
             .collect(),
-        quota_size_limit_upper_bound: content.quota_size_limit_upper_bound,
-        quota_objects_limit_upper_bound: content.quota_objects_limit_upper_bound,
-        global_quota: content.global_quota,
+        voucher_size_limit_upper_bound: content.voucher_size_limit_upper_bound,
+        voucher_objects_limit_upper_bound: content.voucher_objects_limit_upper_bound,
+        global_voucher: content.global_voucher,
         uploading_blocked: content.uploading_blocked,
     }
 }

+ 1 - 1
runtime-modules/common/src/storage.rs

@@ -24,7 +24,7 @@ pub enum StorageObjectOwner<MemberId, ChannelId, DAOId> {
     WorkingGroup(WorkingGroup), // acts through new extrinsic in working group
 }
 
-impl <MemberId, ChannelId, DAOId> Default for StorageObjectOwner<MemberId, ChannelId, DAOId> {
+impl<MemberId, ChannelId, DAOId> Default for StorageObjectOwner<MemberId, ChannelId, DAOId> {
     fn default() -> Self {
         Self::Council
     }

+ 135 - 133
runtime-modules/storage/src/data_directory.rs

@@ -40,9 +40,9 @@ use crate::data_object_type_registry;
 use crate::data_object_type_registry::IsActiveDataObjectType;
 use crate::*;
 
-pub const DEFAULT_QUOTA_SIZE_LIMIT_UPPER_BOUND: u64 = 20000;
-pub const DEFAULT_QUOTA_OBJECTS_LIMIT_UPPER_BOUND: u64 = 200;
-pub const DEFAULT_GLOBAL_QUOTA: Quota = Quota::new(2000000, 2000);
+pub const DEFAULT_VOUCHER_SIZE_LIMIT_UPPER_BOUND: u64 = 20000;
+pub const DEFAULT_VOUCHER_OBJECTS_LIMIT_UPPER_BOUND: u64 = 200;
+pub const DEFAULT_GLOBAL_VOUCHER: Voucher = Voucher::new(2000000, 2000);
 pub const DEFAULT_UPLOADING_BLOCKED_STATUS: bool = false;
 
 /// The _Data directory_ main _Trait_.
@@ -67,8 +67,8 @@ pub trait Trait:
     /// Validates member id and origin combination.
     type MemberOriginValidator: ActorOriginValidator<Self::Origin, MemberId<Self>, Self::AccountId>;
 
-    /// Default content quota for all actors.
-    type DefaultQuota: Get<Quota>;
+    /// Default content voucher for all actors.
+    type DefaultVoucher: Get<Voucher>;
 }
 
 decl_error! {
@@ -92,23 +92,23 @@ decl_error! {
         /// DataObject Injection Failed. Too Many DataObjects.
         DataObjectsInjectionExceededLimit,
 
-        /// Contant uploading failed. Actor quota objects limit exceeded.
-        QuotaObjectsLimitExceeded,
+        /// Contant uploading failed. Actor voucher objects limit exceeded.
+        VoucherObjectsLimitExceeded,
 
-        /// Contant uploading failed. Actor quota size limit exceeded.
-        QuotaSizeLimitExceeded,
+        /// Contant uploading failed. Actor voucher size limit exceeded.
+        VoucherSizeLimitExceeded,
 
-        /// Quota size limit upper bound exceeded
-        QuotaSizeLimitUpperBoundExceeded,
+        /// Voucher size limit upper bound exceeded
+        VoucherSizeLimitUpperBoundExceeded,
 
-        /// Quota objects limit upper bound exceeded
-        QuotaObjectsLimitUpperBoundExceeded,
+        /// Voucher objects limit upper bound exceeded
+        VoucherObjectsLimitUpperBoundExceeded,
 
-        /// Contant uploading failed. Actor quota size limit exceeded.
-        GlobalQuotaSizeLimitExceeded,
+        /// Contant uploading failed. Actor voucher size limit exceeded.
+        GlobalVoucherSizeLimitExceeded,
 
-        /// Contant uploading failed. Actor quota objects limit exceeded.
-        GlobalQuotaObjectsLimitExceeded,
+        /// Contant uploading failed. Actor voucher objects limit exceeded.
+        GlobalVoucherObjectsLimitExceeded,
 
         /// Content uploading blocked.
         ContentUploadingBlocked,
@@ -184,15 +184,15 @@ pub struct DataObjectInternal<
 }
 
 #[derive(Clone, Copy)]
-pub struct Voucher {
+pub struct Delta {
     pub size: u64,
     pub objects: u64,
 }
 
-/// Uploading quota for StorageObjectOwner
+/// Uploading voucher for StorageObjectOwner
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 #[derive(Clone, Copy, Encode, Decode, PartialEq, Eq, Debug, Default)]
-pub struct Quota {
+pub struct Voucher {
     // Total objects size limit per StorageObjectOwner
     pub size_limit: u64,
     // Total objects number limit per StorageObjectOwner
@@ -201,8 +201,8 @@ pub struct Quota {
     pub objects_used: u64,
 }
 
-impl Quota {
-    /// Create new quota with provided size & objects limits
+impl Voucher {
+    /// Create new voucher with provided size & objects limits
     pub const fn new(size_limit: u64, objects_limit: u64) -> Self {
         Self {
             size_limit,
@@ -212,26 +212,26 @@ impl Quota {
         }
     }
 
-    /// Calculate free quota
-    pub fn calculate_voucher(&self) -> Voucher {
-        Voucher {
+    /// Calculate voucher delta
+    pub fn calculate_delta(&self) -> Delta {
+        Delta {
             size: self.size_limit - self.size_used,
             objects: self.objects_limit - self.objects_used,
         }
     }
 
-    pub fn fill_quota(self, voucher: Voucher) -> Self {
+    pub fn fill_voucher(self, voucher_delta: Delta) -> Self {
         Self {
-            size_used: self.size_used + voucher.size,
-            objects_used: self.objects_used + voucher.objects,
+            size_used: self.size_used + voucher_delta.size,
+            objects_used: self.objects_used + voucher_delta.objects,
             ..self
         }
     }
 
-    pub fn release_quota(self, voucher: Voucher) -> Self {
+    pub fn release_voucher(self, voucher_delta: Delta) -> Self {
         Self {
-            size_used: self.size_used - voucher.size,
-            objects_used: self.objects_used - voucher.objects,
+            size_used: self.size_used - voucher_delta.size,
+            objects_used: self.objects_used - voucher_delta.objects,
             ..self
         }
     }
@@ -255,18 +255,18 @@ decl_storage! {
         pub DataByContentId get(fn data_object_by_content_id) config():
             map hasher(blake2_128_concat) T::ContentId => DataObject<T>;
 
-        /// Maps storage owner to it`s quota. Created when the first upload by the new actor occured.
-        pub Quotas get(fn quotas) config():
-            map hasher(blake2_128_concat) StorageObjectOwner<MemberId<T>, ChannelId<T>, DAOId<T>> => Quota;
+        /// Maps storage owner to it`s voucher. Created when the first upload by the new actor occured.
+        pub Vouchers get(fn vouchers) config():
+            map hasher(blake2_128_concat) StorageObjectOwner<MemberId<T>, ChannelId<T>, DAOId<T>> => Voucher;
 
-        /// Upper bound for the Quota size limit.
-        pub QuotaSizeLimitUpperBound get(fn quota_size_limit_upper_bound) config(): u64 = DEFAULT_QUOTA_SIZE_LIMIT_UPPER_BOUND;
+        /// Upper bound for the Voucher size limit.
+        pub VoucherSizeLimitUpperBound get(fn voucher_size_limit_upper_bound) config(): u64 = DEFAULT_VOUCHER_SIZE_LIMIT_UPPER_BOUND;
 
-        /// Upper bound for the Quota objects number limit.
-        pub QuotaObjectsLimitUpperBound get(fn quota_objects_limit_upper_bound) config(): u64 = DEFAULT_QUOTA_OBJECTS_LIMIT_UPPER_BOUND;
+        /// Upper bound for the Voucher objects number limit.
+        pub VoucherObjectsLimitUpperBound get(fn voucher_objects_limit_upper_bound) config(): u64 = DEFAULT_VOUCHER_OBJECTS_LIMIT_UPPER_BOUND;
 
-        /// Global quota.
-        pub GlobalQuota get(fn global_quota) config(): Quota = DEFAULT_GLOBAL_QUOTA;
+        /// Global voucher.
+        pub GlobalVoucher get(fn global_voucher) config(): Voucher = DEFAULT_GLOBAL_VOUCHER;
 
         /// If all new uploads blocked
         pub UploadingBlocked get(fn uploading_blocked) config(): bool = DEFAULT_UPLOADING_BLOCKED_STATUS;
@@ -281,7 +281,7 @@ decl_event! {
         Content = Vec<ContentParameters<ContentId<T>, DataObjectTypeId<T>>>,
         ContentId = ContentId<T>,
         ContentIds = Vec<ContentId<T>>,
-        QuotaLimit = u64,
+        VoucherLimit = u64,
         UploadingStatus = bool
     {
         /// Emits on adding of the content.
@@ -308,17 +308,17 @@ decl_event! {
         /// - Id of the storage provider.
         ContentRejected(ContentId, StorageProviderId),
 
-        /// Emits when the storage object owner quota size limit update performed.
+        /// Emits when the storage object owner voucher size limit update performed.
         /// Params:
         /// - StorageObjectOwner enum.
-        /// - quota size limit.
-        StorageObjectOwnerQuotaSizeLimitUpdated(StorageObjectOwner, QuotaLimit),
+        /// - voucher size limit.
+        StorageObjectOwnerVoucherSizeLimitUpdated(StorageObjectOwner, VoucherLimit),
 
-        /// Emits when the storage object owner quota objects limit update performed.
+        /// Emits when the storage object owner voucher objects limit update performed.
         /// Params:
         /// - StorageObjectOwner enum.
-        /// - quota objects limit.
-        StorageObjectOwnerQuotaObjectsLimitUpdated(StorageObjectOwner, QuotaLimit),
+        /// - voucher objects limit.
+        StorageObjectOwnerVoucherObjectsLimitUpdated(StorageObjectOwner, VoucherLimit),
 
         /// Emits when the content uploading status update performed.
         /// Params:
@@ -352,14 +352,14 @@ decl_module! {
 
             Self::ensure_content_is_valid(&content)?;
 
-            let owner_quota = Self::get_quota(&owner);
+            let owner_voucher = Self::get_voucher(&owner);
 
-            // Ensure owner quota constraints satisfied.
-            // Calculate upload voucher
-            let upload_voucher = Self::ensure_owner_quota_constraints_satisfied(owner_quota, &content)?;
+            // Ensure owner voucher constraints satisfied.
+            // Calculate upload voucher delta
+            let upload_voucher_delta = Self::ensure_owner_voucher_constraints_satisfied(owner_voucher, &content)?;
 
-            // Ensure global quota constraints satisfied.
-            Self::ensure_global_quota_constraints_satisfied(upload_voucher)?;
+            // Ensure global voucher constraints satisfied.
+            Self::ensure_global_voucher_constraints_satisfied(upload_voucher_delta)?;
 
             let liaison = T::StorageProviderHelper::get_random_storage_provider()?;
 
@@ -368,7 +368,7 @@ decl_module! {
             //
 
             // Let's create the entry then
-            Self::upload_content(owner_quota, upload_voucher, liaison, content.clone(), owner.clone());
+            Self::upload_content(owner_voucher, upload_voucher_delta, liaison, content.clone(), owner.clone());
 
             Self::deposit_event(RawEvent::ContentAdded(content, owner));
         }
@@ -397,58 +397,58 @@ decl_module! {
             Self::deposit_event(RawEvent::ContentRemoved(content_ids, owner));
         }
 
-        /// Updates storage object owner quota objects limit. Requires leader privileges.
+        /// Updates storage object owner voucher objects limit. Requires leader privileges.
         #[weight = 10_000_000] // TODO: adjust weight
-        pub fn update_storage_object_owner_quota_objects_limit(
+        pub fn update_storage_object_owner_voucher_objects_limit(
             origin,
             abstract_owner: StorageObjectOwner<MemberId<T>, ChannelId<T>, DAOId<T>>,
-            new_quota_objects_limit: u64
+            new_voucher_objects_limit: u64
         ) {
             <StorageWorkingGroup<T>>::ensure_origin_is_active_leader(origin)?;
-            ensure!(new_quota_objects_limit <= Self::quota_objects_limit_upper_bound(), Error::<T>::QuotaObjectsLimitUpperBoundExceeded);
+            ensure!(new_voucher_objects_limit <= Self::voucher_objects_limit_upper_bound(), Error::<T>::VoucherObjectsLimitUpperBoundExceeded);
 
             //
             // == MUTATION SAFE ==
             //
 
-            if <Quotas<T>>::contains_key(&abstract_owner) {
-                <Quotas<T>>::mutate(&abstract_owner, |quota| {
-                    quota.set_new_objects_limit(new_quota_objects_limit);
+            if <Vouchers<T>>::contains_key(&abstract_owner) {
+                <Vouchers<T>>::mutate(&abstract_owner, |voucher| {
+                    voucher.set_new_objects_limit(new_voucher_objects_limit);
                 });
             } else {
-                let mut quota = T::DefaultQuota::get();
-                quota.set_new_objects_limit(new_quota_objects_limit);
-                <Quotas<T>>::insert(&abstract_owner, quota);
+                let mut voucher = T::DefaultVoucher::get();
+                voucher.set_new_objects_limit(new_voucher_objects_limit);
+                <Vouchers<T>>::insert(&abstract_owner, voucher);
             };
 
-            Self::deposit_event(RawEvent::StorageObjectOwnerQuotaObjectsLimitUpdated(abstract_owner, new_quota_objects_limit));
+            Self::deposit_event(RawEvent::StorageObjectOwnerVoucherObjectsLimitUpdated(abstract_owner, new_voucher_objects_limit));
         }
 
-        /// Updates storage object owner quota size limit. Requires leader privileges.
+        /// Updates storage object owner voucher size limit. Requires leader privileges.
         #[weight = 10_000_000] // TODO: adjust weight
-        pub fn update_storage_object_owner_quota_size_limit(
+        pub fn update_storage_object_owner_voucher_size_limit(
             origin,
             abstract_owner: StorageObjectOwner<MemberId<T>, ChannelId<T>, DAOId<T>>,
-            new_quota_size_limit: u64
+            new_voucher_size_limit: u64
         ) {
             <StorageWorkingGroup<T>>::ensure_origin_is_active_leader(origin)?;
-            ensure!(new_quota_size_limit <= Self::quota_size_limit_upper_bound(), Error::<T>::QuotaSizeLimitUpperBoundExceeded);
+            ensure!(new_voucher_size_limit <= Self::voucher_size_limit_upper_bound(), Error::<T>::VoucherSizeLimitUpperBoundExceeded);
 
             //
             // == MUTATION SAFE ==
             //
 
-            if <Quotas<T>>::contains_key(&abstract_owner) {
-                <Quotas<T>>::mutate(&abstract_owner, |quota| {
-                    quota.set_new_size_limit(new_quota_size_limit);
+            if <Vouchers<T>>::contains_key(&abstract_owner) {
+                <Vouchers<T>>::mutate(&abstract_owner, |voucher| {
+                    voucher.set_new_size_limit(new_voucher_size_limit);
                 });
             } else {
-                let mut quota = T::DefaultQuota::get();
-                quota.set_new_size_limit(new_quota_size_limit);
-                <Quotas<T>>::insert(&abstract_owner, quota);
+                let mut voucher = T::DefaultVoucher::get();
+                voucher.set_new_size_limit(new_voucher_size_limit);
+                <Vouchers<T>>::insert(&abstract_owner, voucher);
             };
 
-            Self::deposit_event(RawEvent::StorageObjectOwnerQuotaSizeLimitUpdated(abstract_owner, new_quota_size_limit));
+            Self::deposit_event(RawEvent::StorageObjectOwnerVoucherSizeLimitUpdated(abstract_owner, new_voucher_size_limit));
         }
 
         /// Storage provider accepts a content. Requires signed storage provider account and its id.
@@ -499,22 +499,22 @@ decl_module! {
 
 impl<T: Trait> Module<T> {
     pub fn initialize_data_directory(
-        quotas: Vec<(
+        vouchers: Vec<(
             StorageObjectOwner<MemberId<T>, ChannelId<T>, DAOId<T>>,
-            Quota,
+            Voucher,
         )>,
-        quota_size_limit_upper_bound: u64,
-        quota_objects_limit_upper_bound: u64,
-        global_quota: Quota,
+        voucher_size_limit_upper_bound: u64,
+        voucher_objects_limit_upper_bound: u64,
+        global_voucher: Voucher,
         uploading_blocked: bool,
     ) {
-        for (storage_object_owner, quota) in quotas {
-            <Quotas<T>>::insert(storage_object_owner, quota);
+        for (storage_object_owner, voucher) in vouchers {
+            <Vouchers<T>>::insert(storage_object_owner, voucher);
         }
 
-        <QuotaSizeLimitUpperBound>::put(quota_size_limit_upper_bound);
-        <QuotaObjectsLimitUpperBound>::put(quota_objects_limit_upper_bound);
-        <GlobalQuota>::put(global_quota);
+        <VoucherSizeLimitUpperBound>::put(voucher_size_limit_upper_bound);
+        <VoucherObjectsLimitUpperBound>::put(voucher_objects_limit_upper_bound);
+        <GlobalVoucher>::put(global_voucher);
         <UploadingBlocked>::put(uploading_blocked);
     }
 
@@ -531,12 +531,12 @@ impl<T: Trait> Module<T> {
         Ok(())
     }
 
-    // Get owner quota if exists, otherwise return default one.
-    fn get_quota(owner: &StorageObjectOwner<MemberId<T>, ChannelId<T>, DAOId<T>>) -> Quota {
-        if <Quotas<T>>::contains_key(owner) {
-            Self::quotas(owner)
+    // Get owner voucher if exists, otherwise return default one.
+    fn get_voucher(owner: &StorageObjectOwner<MemberId<T>, ChannelId<T>, DAOId<T>>) -> Voucher {
+        if <Vouchers<T>>::contains_key(owner) {
+            Self::vouchers(owner)
         } else {
-            T::DefaultQuota::get()
+            T::DefaultVoucher::get()
         }
     }
 
@@ -549,32 +549,32 @@ impl<T: Trait> Module<T> {
         Ok(())
     }
 
-    // Ensure owner quota constraints satisfied, returns total object length and total size voucher for this upload.
-    fn ensure_owner_quota_constraints_satisfied(
-        owner_quota: Quota,
+    // Ensure owner voucher constraints satisfied, returns total object length and total size voucher delta for this upload.
+    fn ensure_owner_voucher_constraints_satisfied(
+        owner_voucher: Voucher,
         content: &[ContentParameters<T::ContentId, DataObjectTypeId<T>>],
-    ) -> Result<Voucher, Error<T>> {
-        let owner_quota_voucher = owner_quota.calculate_voucher();
+    ) -> Result<Delta, Error<T>> {
+        let owner_voucher_delta = owner_voucher.calculate_delta();
 
-        // Ensure total content length is less or equal then available per given owner quota
+        // Ensure total content length is less or equal then available per given owner voucher
         let content_length = content.len() as u64;
 
         ensure!(
-            owner_quota_voucher.objects >= content_length,
-            Error::<T>::QuotaObjectsLimitExceeded
+            owner_voucher_delta.objects >= content_length,
+            Error::<T>::VoucherObjectsLimitExceeded
         );
 
-        // Ensure total content size is less or equal then available per given owner quota
+        // Ensure total content size is less or equal then available per given owner voucher
         let content_size = content
             .iter()
             .fold(0, |total_size, content| total_size + content.size);
 
         ensure!(
-            owner_quota_voucher.size >= content_size,
-            Error::<T>::QuotaSizeLimitExceeded
+            owner_voucher_delta.size >= content_size,
+            Error::<T>::VoucherSizeLimitExceeded
         );
 
-        Ok(Voucher {
+        Ok(Delta {
             size: content_size,
             objects: content_length,
         })
@@ -595,40 +595,41 @@ impl<T: Trait> Module<T> {
         Ok(content)
     }
 
-    fn calculate_content_voucher(content: Vec<DataObject<T>>) -> Voucher {
+    // Calculates content voucher delta
+    fn calculate_content_voucher(content: Vec<DataObject<T>>) -> Delta {
         let content_length = content.len() as u64;
 
         let content_size = content
             .into_iter()
             .fold(0, |total_size, content| total_size + content.size);
 
-        Voucher {
+        Delta {
             size: content_size,
             objects: content_length,
         }
     }
 
-    // Ensures global quota constraints satisfied.
-    fn ensure_global_quota_constraints_satisfied(upload_voucher: Voucher) -> DispatchResult {
-        let global_quota_voucher = Self::global_quota().calculate_voucher();
+    // Ensures global voucher constraints satisfied.
+    fn ensure_global_voucher_constraints_satisfied(upload_voucher_delta: Delta) -> DispatchResult {
+        let global_voucher_voucher = Self::global_voucher().calculate_delta();
 
         ensure!(
-            global_quota_voucher.objects >= upload_voucher.objects,
-            Error::<T>::GlobalQuotaObjectsLimitExceeded
+            global_voucher_voucher.objects >= upload_voucher_delta.objects,
+            Error::<T>::GlobalVoucherObjectsLimitExceeded
         );
 
         ensure!(
-            global_quota_voucher.size >= upload_voucher.size,
-            Error::<T>::GlobalQuotaSizeLimitExceeded
+            global_voucher_voucher.size >= upload_voucher_delta.size,
+            Error::<T>::GlobalVoucherSizeLimitExceeded
         );
 
         Ok(())
     }
 
-    // Complete content upload, update quotas
+    // Complete content upload, update vouchers
     fn upload_content(
-        owner_quota: Quota,
-        upload_voucher: Voucher,
+        owner_voucher: Voucher,
+        upload_voucher_delta: Delta,
         liaison: StorageProviderId<T>,
         multi_content: Vec<ContentParameters<T::ContentId, DataObjectTypeId<T>>>,
         owner: StorageObjectOwner<MemberId<T>, ChannelId<T>, DAOId<T>>,
@@ -647,11 +648,11 @@ impl<T: Trait> Module<T> {
             <DataByContentId<T>>::insert(content.content_id, data);
         }
 
-        // Updade or create owner quota.
-        <Quotas<T>>::insert(owner, owner_quota.fill_quota(upload_voucher));
+        // Updade or create owner voucher.
+        <Vouchers<T>>::insert(owner, owner_voucher.fill_voucher(upload_voucher_delta));
 
-        // Update global quota
-        <GlobalQuota>::put(Self::global_quota().fill_quota(upload_voucher));
+        // Update global voucher
+        <GlobalVoucher>::put(Self::global_voucher().fill_voucher(upload_voucher_delta));
     }
 
     // Complete content removal
@@ -666,13 +667,13 @@ impl<T: Trait> Module<T> {
             <DataByContentId<T>>::remove(content_id);
         }
 
-        // Updade owner quota.
-        <Quotas<T>>::mutate(owner, |owner_quota| {
-            owner_quota.release_quota(removal_voucher)
+        // Updade owner voucher.
+        <Vouchers<T>>::mutate(owner, |owner_voucher| {
+            owner_voucher.release_voucher(removal_voucher)
         });
 
-        // Update global quota
-        <GlobalQuota>::put(Self::global_quota().release_quota(removal_voucher));
+        // Update global voucher
+        <GlobalVoucher>::put(Self::global_voucher().release_voucher(removal_voucher));
     }
 
     fn ensure_content_is_valid(
@@ -750,14 +751,15 @@ impl<T: Trait> common::storage::StorageSystem<T> for Module<T> {
 
         Self::ensure_uploading_is_not_blocked()?;
 
-        let owner_quota = Self::get_quota(&owner);
+        let owner_voucher = Self::get_voucher(&owner);
 
-        // Ensure owner quota constraints satisfied.
+        // Ensure owner voucher constraints satisfied.
         // Calculate upload voucher
-        let upload_voucher = Self::ensure_owner_quota_constraints_satisfied(owner_quota, &content)?;
+        let upload_voucher =
+            Self::ensure_owner_voucher_constraints_satisfied(owner_voucher, &content)?;
 
-        // Ensure global quota constraints satisfied.
-        Self::ensure_global_quota_constraints_satisfied(upload_voucher)?;
+        // Ensure global voucher constraints satisfied.
+        Self::ensure_global_voucher_constraints_satisfied(upload_voucher)?;
 
         let liaison = T::StorageProviderHelper::get_random_storage_provider()?;
 
@@ -767,7 +769,7 @@ impl<T: Trait> common::storage::StorageSystem<T> for Module<T> {
 
         // Let's create the entry then
 
-        Self::upload_content(owner_quota, upload_voucher, liaison, content, owner);
+        Self::upload_content(owner_voucher, upload_voucher, liaison, content, owner);
         Ok(())
     }
 
@@ -794,10 +796,10 @@ impl<T: Trait> common::storage::StorageSystem<T> for Module<T> {
         Self::ensure_uploading_is_not_blocked()?;
 
         T::StorageProviderHelper::get_random_storage_provider()?;
-        let owner_quota = Self::get_quota(&owner);
+        let owner_voucher = Self::get_voucher(&owner);
 
-        // Ensure owner quota constraints satisfied.
-        Self::ensure_owner_quota_constraints_satisfied(owner_quota, &content)?;
+        // Ensure owner voucher constraints satisfied.
+        Self::ensure_owner_voucher_constraints_satisfied(owner_voucher, &content)?;
         Self::ensure_content_is_valid(&content)
     }
 

+ 36 - 33
runtime-modules/storage/src/tests/data_directory.rs

@@ -91,14 +91,14 @@ fn add_content_size_limit_reached() {
         let content_parameters = ContentParameters {
             content_id: 1,
             type_id: 1234,
-            size: DefaultQuota::get().size_limit + 1,
+            size: DefaultVoucher::get().size_limit + 1,
             ipfs_content_id: vec![1, 2, 3, 4],
         };
 
         // Make an attempt to register a content, when uploading is blocked.
         let res =
             TestDataDirectory::add_content(Origin::signed(sender), owner, vec![content_parameters]);
-        assert_eq!(res, Err(Error::<Test>::QuotaSizeLimitExceeded.into()));
+        assert_eq!(res, Err(Error::<Test>::VoucherSizeLimitExceeded.into()));
     });
 }
 
@@ -111,7 +111,7 @@ fn add_content_objects_limit_reached() {
 
         let mut content = vec![];
 
-        for i in 0..=DefaultQuota::get().objects_limit {
+        for i in 0..=DefaultVoucher::get().objects_limit {
             let content_parameters = ContentParameters {
                 content_id: i + 1,
                 type_id: 1234,
@@ -123,19 +123,19 @@ fn add_content_objects_limit_reached() {
 
         // Make an attempt to register a content, when uploading is blocked.
         let res = TestDataDirectory::add_content(Origin::signed(sender), owner, content);
-        assert_eq!(res, Err(Error::<Test>::QuotaObjectsLimitExceeded.into()));
+        assert_eq!(res, Err(Error::<Test>::VoucherObjectsLimitExceeded.into()));
     });
 }
 
 #[test]
 fn add_content_global_size_limit_reached() {
-    let global_quota_size_limit = 0;
-    let global_quota_objects_limit = 50;
+    let global_voucher_size_limit = 0;
+    let global_voucher_objects_limit = 50;
 
     ExtBuilder::default()
-        .global_quota(Quota::new(
-            global_quota_size_limit,
-            global_quota_objects_limit,
+        .global_voucher(Voucher::new(
+            global_voucher_size_limit,
+            global_voucher_objects_limit,
         ))
         .build()
         .execute_with(|| {
@@ -146,7 +146,7 @@ fn add_content_global_size_limit_reached() {
             let content_parameters = ContentParameters {
                 content_id: 1,
                 type_id: 1234,
-                size: global_quota_size_limit + 1,
+                size: global_voucher_size_limit + 1,
                 ipfs_content_id: vec![1, 2, 3, 4],
             };
 
@@ -156,19 +156,22 @@ fn add_content_global_size_limit_reached() {
                 owner,
                 vec![content_parameters],
             );
-            assert_eq!(res, Err(Error::<Test>::GlobalQuotaSizeLimitExceeded.into()));
+            assert_eq!(
+                res,
+                Err(Error::<Test>::GlobalVoucherSizeLimitExceeded.into())
+            );
         });
 }
 
 #[test]
 fn add_content_global_objects_limit_reached() {
-    let global_quota_size_limit = 50000;
-    let global_quota_objects_limit = 0;
+    let global_voucher_size_limit = 50000;
+    let global_voucher_objects_limit = 0;
 
     ExtBuilder::default()
-        .global_quota(Quota::new(
-            global_quota_size_limit,
-            global_quota_objects_limit,
+        .global_voucher(Voucher::new(
+            global_voucher_size_limit,
+            global_voucher_objects_limit,
         ))
         .build()
         .execute_with(|| {
@@ -191,7 +194,7 @@ fn add_content_global_objects_limit_reached() {
             );
             assert_eq!(
                 res,
-                Err(Error::<Test>::GlobalQuotaObjectsLimitExceeded.into())
+                Err(Error::<Test>::GlobalVoucherObjectsLimitExceeded.into())
             );
         });
 }
@@ -300,7 +303,7 @@ fn update_content_uploading_status() {
 }
 
 #[test]
-fn update_storage_object_owner_quota_objects_limit() {
+fn update_storage_object_owner_voucher_objects_limit() {
     with_default_mock_builder(|| {
         SetLeadFixture::set_default_lead();
 
@@ -308,7 +311,7 @@ fn update_storage_object_owner_quota_objects_limit() {
 
         let new_objects_limit = 20;
 
-        let res = TestDataDirectory::update_storage_object_owner_quota_objects_limit(
+        let res = TestDataDirectory::update_storage_object_owner_voucher_objects_limit(
             Origin::signed(DEFAULT_LEADER_ACCOUNT_ID),
             owner.clone(),
             new_objects_limit,
@@ -317,23 +320,23 @@ fn update_storage_object_owner_quota_objects_limit() {
         assert!(res.is_ok());
 
         assert_eq!(
-            TestDataDirectory::quotas(owner).objects_limit,
+            TestDataDirectory::vouchers(owner).objects_limit,
             new_objects_limit
         );
     });
 }
 
 #[test]
-fn update_storage_object_owner_quota_objects_limit_upper_bound_exceeded() {
+fn update_storage_object_owner_voucher_objects_limit_upper_bound_exceeded() {
     with_default_mock_builder(|| {
         SetLeadFixture::set_default_lead();
 
         let owner = StorageObjectOwner::Member(1u64);
 
-        let new_objects_limit = TestDataDirectory::quota_objects_limit_upper_bound() + 1;
+        let new_objects_limit = TestDataDirectory::voucher_objects_limit_upper_bound() + 1;
 
-        // Make an attempt to update storage object owner quota objects limit, providing value, which exceeds upper bound.
-        let res = TestDataDirectory::update_storage_object_owner_quota_objects_limit(
+        // Make an attempt to update storage object owner voucher objects limit, providing value, which exceeds upper bound.
+        let res = TestDataDirectory::update_storage_object_owner_voucher_objects_limit(
             Origin::signed(DEFAULT_LEADER_ACCOUNT_ID),
             owner.clone(),
             new_objects_limit,
@@ -341,13 +344,13 @@ fn update_storage_object_owner_quota_objects_limit_upper_bound_exceeded() {
 
         assert_eq!(
             res,
-            Err(Error::<Test>::QuotaObjectsLimitUpperBoundExceeded.into())
+            Err(Error::<Test>::VoucherObjectsLimitUpperBoundExceeded.into())
         );
     });
 }
 
 #[test]
-fn update_storage_object_owner_quota_size_limit() {
+fn update_storage_object_owner_voucher_size_limit() {
     with_default_mock_builder(|| {
         SetLeadFixture::set_default_lead();
 
@@ -355,7 +358,7 @@ fn update_storage_object_owner_quota_size_limit() {
 
         let new_objects_total_size_limit = 1500;
 
-        let res = TestDataDirectory::update_storage_object_owner_quota_size_limit(
+        let res = TestDataDirectory::update_storage_object_owner_voucher_size_limit(
             Origin::signed(DEFAULT_LEADER_ACCOUNT_ID),
             owner.clone(),
             new_objects_total_size_limit,
@@ -364,23 +367,23 @@ fn update_storage_object_owner_quota_size_limit() {
         assert!(res.is_ok());
 
         assert_eq!(
-            TestDataDirectory::quotas(owner).size_limit,
+            TestDataDirectory::vouchers(owner).size_limit,
             new_objects_total_size_limit
         );
     });
 }
 
 #[test]
-fn update_storage_object_owner_quota_size_limit_upper_bound_exceeded() {
+fn update_storage_object_owner_voucher_size_limit_upper_bound_exceeded() {
     with_default_mock_builder(|| {
         SetLeadFixture::set_default_lead();
 
         let owner = StorageObjectOwner::Member(1u64);
 
-        let new_objects_total_size_limit = TestDataDirectory::quota_size_limit_upper_bound() + 1;
+        let new_objects_total_size_limit = TestDataDirectory::voucher_size_limit_upper_bound() + 1;
 
-        // Make an attempt to update storage object owner quota size limit, providing value, which exceeds upper bound.
-        let res = TestDataDirectory::update_storage_object_owner_quota_size_limit(
+        // Make an attempt to update storage object owner voucher size limit, providing value, which exceeds upper bound.
+        let res = TestDataDirectory::update_storage_object_owner_voucher_size_limit(
             Origin::signed(DEFAULT_LEADER_ACCOUNT_ID),
             owner.clone(),
             new_objects_total_size_limit,
@@ -388,7 +391,7 @@ fn update_storage_object_owner_quota_size_limit_upper_bound_exceeded() {
 
         assert_eq!(
             res,
-            Err(Error::<Test>::QuotaSizeLimitUpperBoundExceeded.into())
+            Err(Error::<Test>::VoucherSizeLimitUpperBoundExceeded.into())
         );
     });
 }

+ 15 - 15
runtime-modules/storage/src/tests/mock.rs

@@ -11,7 +11,7 @@ use sp_runtime::{
 };
 
 use crate::data_directory::ContentIdExists;
-pub use crate::data_directory::Quota;
+pub use crate::data_directory::Voucher;
 pub use crate::data_directory::{ContentParameters, StorageObjectOwner};
 use crate::data_object_type_registry::IsActiveDataObjectType;
 use crate::ContentId;
@@ -124,7 +124,7 @@ parameter_types! {
     pub const MaximumBlockLength: u32 = 2 * 1024;
     pub const AvailableBlockRatio: Perbill = Perbill::one();
     pub const MinimumPeriod: u64 = 5;
-    pub const DefaultQuota: Quota = Quota::new(5000, 50);
+    pub const DefaultVoucher: Voucher = Voucher::new(5000, 50);
 }
 
 impl system::Trait for Test {
@@ -207,7 +207,7 @@ impl data_directory::Trait for Test {
     type StorageProviderHelper = ();
     type IsActiveDataObjectType = AnyDataObjectTypeIsActive;
     type MemberOriginValidator = ();
-    type DefaultQuota = DefaultQuota;
+    type DefaultVoucher = DefaultVoucher;
 }
 
 impl crate::data_directory::StorageProviderHelper<Test> for () {
@@ -265,9 +265,9 @@ impl hiring::Trait for Test {
 }
 
 pub struct ExtBuilder {
-    quota_objects_limit_upper_bound: u64,
-    quota_size_limit_upper_bound: u64,
-    global_quota: Quota,
+    voucher_objects_limit_upper_bound: u64,
+    voucher_size_limit_upper_bound: u64,
+    global_voucher: Voucher,
     first_data_object_type_id: u64,
     first_content_id: u64,
     first_relationship_id: u64,
@@ -278,9 +278,9 @@ pub struct ExtBuilder {
 impl Default for ExtBuilder {
     fn default() -> Self {
         Self {
-            quota_objects_limit_upper_bound: DEFAULT_QUOTA_SIZE_LIMIT_UPPER_BOUND,
-            quota_size_limit_upper_bound: DEFAULT_QUOTA_OBJECTS_LIMIT_UPPER_BOUND,
-            global_quota: DEFAULT_GLOBAL_QUOTA,
+            voucher_objects_limit_upper_bound: DEFAULT_VOUCHER_SIZE_LIMIT_UPPER_BOUND,
+            voucher_size_limit_upper_bound: DEFAULT_VOUCHER_OBJECTS_LIMIT_UPPER_BOUND,
+            global_voucher: DEFAULT_GLOBAL_VOUCHER,
             first_data_object_type_id: 1,
             first_content_id: 2,
             first_relationship_id: 3,
@@ -316,8 +316,8 @@ impl ExtBuilder {
         self
     }
 
-    pub fn global_quota(mut self, global_quota: Quota) -> Self {
-        self.global_quota = global_quota;
+    pub fn global_voucher(mut self, global_voucher: Voucher) -> Self {
+        self.global_voucher = global_voucher;
         self
     }
 
@@ -327,11 +327,11 @@ impl ExtBuilder {
             .unwrap();
 
         data_directory::GenesisConfig::<Test> {
-            quota_size_limit_upper_bound: self.quota_size_limit_upper_bound,
-            quota_objects_limit_upper_bound: self.quota_objects_limit_upper_bound,
-            global_quota: self.global_quota,
+            voucher_size_limit_upper_bound: self.voucher_size_limit_upper_bound,
+            voucher_objects_limit_upper_bound: self.voucher_objects_limit_upper_bound,
+            global_voucher: self.global_voucher,
             data_object_by_content_id: vec![],
-            quotas: vec![],
+            vouchers: vec![],
             uploading_blocked: self.uploading_blocked,
         }
         .assimilate_storage(&mut t)

+ 3 - 3
runtime/src/lib.rs

@@ -59,7 +59,7 @@ pub use membership;
 pub use pallet_balances::Call as BalancesCall;
 pub use pallet_staking::StakerStatus;
 pub use proposals_codex::ProposalsConfigParameters;
-use storage::data_directory::Quota;
+use storage::data_directory::Voucher;
 pub use storage::{data_directory, data_object_type_registry};
 pub use working_group;
 
@@ -453,7 +453,7 @@ impl memo::Trait for Runtime {
 }
 
 parameter_types! {
-    pub const DefaultQuota: Quota = Quota::new(5000, 50);
+    pub const DefaultVoucher: Voucher = Voucher::new(5000, 50);
 }
 
 impl storage::data_object_type_registry::Trait for Runtime {
@@ -465,7 +465,7 @@ impl storage::data_directory::Trait for Runtime {
     type StorageProviderHelper = integration::storage::StorageProviderHelper;
     type IsActiveDataObjectType = DataObjectTypeRegistry;
     type MemberOriginValidator = MembershipOriginValidator<Self>;
-    type DefaultQuota = DefaultQuota;
+    type DefaultVoucher = DefaultVoucher;
 }
 
 impl storage::data_object_storage_registry::Trait for Runtime {

+ 3 - 3
runtime/src/runtime_api.rs

@@ -89,9 +89,9 @@ impl OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
 
         DataDirectory::initialize_data_directory(
             Vec::new(),
-            data_directory::DEFAULT_QUOTA_SIZE_LIMIT_UPPER_BOUND,
-            data_directory::DEFAULT_QUOTA_OBJECTS_LIMIT_UPPER_BOUND,
-            data_directory::DEFAULT_GLOBAL_QUOTA,
+            data_directory::DEFAULT_VOUCHER_SIZE_LIMIT_UPPER_BOUND,
+            data_directory::DEFAULT_VOUCHER_OBJECTS_LIMIT_UPPER_BOUND,
+            data_directory::DEFAULT_GLOBAL_VOUCHER,
             data_directory::DEFAULT_UPLOADING_BLOCKED_STATUS,
         );
 

File diff suppressed because it is too large
+ 1 - 1
types/augment-codec/all.ts


+ 9 - 9
types/augment-codec/augment-api-query.ts

@@ -4,7 +4,7 @@
 import { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
 import { Option, Vec } from '@polkadot/types/codec';
 import { Bytes, bool, u32, u64 } from '@polkadot/types/primitive';
-import { Application, ApplicationId, ApplicationOf, Category, CategoryId, Channel, ChannelCategory, ChannelCategoryId, ChannelId, ChannelOwnershipTransferRequest, ChannelOwnershipTransferRequestId, ContentId, CuratorGroup, CuratorGroupId, DataObject, DataObjectStorageRelationship, DataObjectStorageRelationshipId, DataObjectType, DataObjectTypeId, DiscussionPost, DiscussionThread, ElectionStage, ElectionStake, HiringApplicationId, InputValidationLengthConstraint, MemberId, Membership, MemoText, Mint, MintId, Opening, OpeningId, OpeningOf, PaidMembershipTerms, PaidTermId, Person, PersonId, Playlist, PlaylistId, Post, PostId, ProposalDetailsOf, ProposalId, ProposalOf, Quota, Recipient, RecipientId, RewardRelationship, RewardRelationshipId, SealedVote, Seats, Series, SeriesId, ServiceProviderRecord, Stake, StakeId, StorageObjectOwner, StorageProviderId, Thread, ThreadCounter, ThreadId, TransferableStake, Url, Video, VideoCategory, VideoCategoryId, VideoId, VoteKind, WorkerId, WorkerOf } from './all';
+import { Application, ApplicationId, ApplicationOf, Category, CategoryId, Channel, ChannelCategory, ChannelCategoryId, ChannelId, ChannelOwnershipTransferRequest, ChannelOwnershipTransferRequestId, ContentId, CuratorGroup, CuratorGroupId, DataObject, DataObjectStorageRelationship, DataObjectStorageRelationshipId, DataObjectType, DataObjectTypeId, DiscussionPost, DiscussionThread, ElectionStage, ElectionStake, HiringApplicationId, InputValidationLengthConstraint, MemberId, Membership, MemoText, Mint, MintId, Opening, OpeningId, OpeningOf, PaidMembershipTerms, PaidTermId, Person, PersonId, Playlist, PlaylistId, Post, PostId, ProposalDetailsOf, ProposalId, ProposalOf, Voucher, Recipient, RecipientId, RewardRelationship, RewardRelationshipId, SealedVote, Seats, Series, SeriesId, ServiceProviderRecord, Stake, StakeId, StorageObjectOwner, StorageProviderId, Thread, ThreadCounter, ThreadId, TransferableStake, Url, Video, VideoCategory, VideoCategoryId, VideoId, VoteKind, WorkerId, WorkerOf } from './all';
 import { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
 import { BabeAuthorityWeight, MaybeRandomness, NextConfigDescriptor, Randomness } from '@polkadot/types/interfaces/babe';
 import { AccountData, BalanceLock } from '@polkadot/types/interfaces/balances';
@@ -256,25 +256,25 @@ declare module '@polkadot/api/types/storage' {
        **/
       DataByContentId: AugmentedQuery<ApiType, (arg: ContentId | string | Uint8Array) => Observable<Option<DataObject>>>;
       /**
-       * Global quota.
+       * Global voucher.
        **/
-      globalQuota: AugmentedQuery<ApiType, () => Observable<Quota>>;
+      globalVoucher: AugmentedQuery<ApiType, () => Observable<Voucher>>;
       /**
        * List of ids known to the system.
        **/
       knownContentIds: AugmentedQuery<ApiType, () => Observable<Vec<ContentId>>>;
       /**
-       * Upper bound for the Quota objects number limit.
+       * Upper bound for the Voucher objects number limit.
        **/
-      quotaObjectsLimitUpperBound: AugmentedQuery<ApiType, () => Observable<u64>>;
+      voucherObjectsLimitUpperBound: AugmentedQuery<ApiType, () => Observable<u64>>;
       /**
-       * Maps storage owner to it`s quota. Created when the first upload by the new actor occured.
+       * Maps storage owner to it`s voucher. Created when the first upload by the new actor occured.
        **/
-      quotas: AugmentedQuery<ApiType, (arg: StorageObjectOwner | { Member: any } | { Channel: any } | { DAO: any } | { Council: any } | { WorkingGroup: any } | string | Uint8Array) => Observable<Quota>>;
+      vouchers: AugmentedQuery<ApiType, (arg: StorageObjectOwner | { Member: any } | { Channel: any } | { DAO: any } | { Council: any } | { WorkingGroup: any } | string | Uint8Array) => Observable<Voucher>>;
       /**
-       * Upper bound for the Quota size limit.
+       * Upper bound for the Voucher size limit.
        **/
-      quotaSizeLimitUpperBound: AugmentedQuery<ApiType, () => Observable<u64>>;
+      voucherSizeLimitUpperBound: AugmentedQuery<ApiType, () => Observable<u64>>;
       /**
        * If all new uploads blocked
        **/

+ 4 - 4
types/augment-codec/augment-api-tx.ts

@@ -314,13 +314,13 @@ declare module '@polkadot/api/types/submittable' {
        **/
       updateContentUploadingStatus: AugmentedSubmittable<(isBlocked: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>>;
       /**
-       * Updates storage object owner quota objects limit. Requires leader privileges.
+       * Updates storage object owner voucher objects limit. Requires leader privileges.
        **/
-      updateStorageObjectOwnerQuotaObjectsLimit: AugmentedSubmittable<(abstractOwner: StorageObjectOwner | { Member: any } | { Channel: any } | { DAO: any } | { Council: any } | { WorkingGroup: any } | string | Uint8Array, newQuotaObjectsLimit: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
+      updateStorageObjectOwnerVoucherObjectsLimit: AugmentedSubmittable<(abstractOwner: StorageObjectOwner | { Member: any } | { Channel: any } | { DAO: any } | { Council: any } | { WorkingGroup: any } | string | Uint8Array, newVoucherObjectsLimit: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
       /**
-       * Updates storage object owner quota size limit. Requires leader privileges.
+       * Updates storage object owner voucher size limit. Requires leader privileges.
        **/
-      updateStorageObjectOwnerQuotaSizeLimit: AugmentedSubmittable<(abstractOwner: StorageObjectOwner | { Member: any } | { Channel: any } | { DAO: any } | { Council: any } | { WorkingGroup: any } | string | Uint8Array, newQuotaSizeLimit: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
+      updateStorageObjectOwnerVoucherSizeLimit: AugmentedSubmittable<(abstractOwner: StorageObjectOwner | { Member: any } | { Channel: any } | { DAO: any } | { Council: any } | { WorkingGroup: any } | string | Uint8Array, newVoucherSizeLimit: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
     };
     dataObjectStorageRegistry: {
       /**

File diff suppressed because it is too large
+ 0 - 0
types/augment-codec/augment-types.ts


+ 2 - 2
types/augment/all/defs.json

@@ -527,13 +527,13 @@
         }
     },
     "Content": "Vec<ContentParameters>",
-    "Quota": {
+    "Voucher": {
         "size_limit": "u64",
         "objects_limit": "u64",
         "size_used": "u64",
         "objects_used": "u64"
     },
-    "QuotaLimit": "u64",
+    "VoucherLimit": "u64",
     "UploadingStatus": "bool",
     "ProposalId": "u32",
     "ProposalStatus": {

+ 4 - 4
types/augment/all/types.ts

@@ -907,16 +907,16 @@ export interface ProposalStatus extends Enum {
   readonly asFinalized: Finalized;
 }
 
-/** @name Quota */
-export interface Quota extends Struct {
+/** @name Voucher */
+export interface Voucher extends Struct {
   readonly size_limit: u64;
   readonly objects_limit: u64;
   readonly size_used: u64;
   readonly objects_used: u64;
 }
 
-/** @name QuotaLimit */
-export interface QuotaLimit extends u64 {}
+/** @name VoucherLimit */
+export interface VoucherLimit extends u64 {}
 
 /** @name RationaleText */
 export interface RationaleText extends Bytes {}

+ 9 - 9
types/augment/augment-api-query.ts

@@ -4,7 +4,7 @@
 import { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
 import { Option, Vec } from '@polkadot/types/codec';
 import { Bytes, bool, u32, u64 } from '@polkadot/types/primitive';
-import { Application, ApplicationId, ApplicationOf, Category, CategoryId, Channel, ChannelCategory, ChannelCategoryId, ChannelId, ChannelOwnershipTransferRequest, ChannelOwnershipTransferRequestId, ContentId, CuratorGroup, CuratorGroupId, DataObject, DataObjectStorageRelationship, DataObjectStorageRelationshipId, DataObjectType, DataObjectTypeId, DiscussionPost, DiscussionThread, ElectionStage, ElectionStake, HiringApplicationId, InputValidationLengthConstraint, MemberId, Membership, MemoText, Mint, MintId, Opening, OpeningId, OpeningOf, PaidMembershipTerms, PaidTermId, Person, PersonId, Playlist, PlaylistId, Post, PostId, ProposalDetailsOf, ProposalId, ProposalOf, Quota, Recipient, RecipientId, RewardRelationship, RewardRelationshipId, SealedVote, Seats, Series, SeriesId, ServiceProviderRecord, Stake, StakeId, StorageObjectOwner, StorageProviderId, Thread, ThreadCounter, ThreadId, TransferableStake, Url, Video, VideoCategory, VideoCategoryId, VideoId, VoteKind, WorkerId, WorkerOf } from './all';
+import { Application, ApplicationId, ApplicationOf, Category, CategoryId, Channel, ChannelCategory, ChannelCategoryId, ChannelId, ChannelOwnershipTransferRequest, ChannelOwnershipTransferRequestId, ContentId, CuratorGroup, CuratorGroupId, DataObject, DataObjectStorageRelationship, DataObjectStorageRelationshipId, DataObjectType, DataObjectTypeId, DiscussionPost, DiscussionThread, ElectionStage, ElectionStake, HiringApplicationId, InputValidationLengthConstraint, MemberId, Membership, MemoText, Mint, MintId, Opening, OpeningId, OpeningOf, PaidMembershipTerms, PaidTermId, Person, PersonId, Playlist, PlaylistId, Post, PostId, ProposalDetailsOf, ProposalId, ProposalOf, Voucher, Recipient, RecipientId, RewardRelationship, RewardRelationshipId, SealedVote, Seats, Series, SeriesId, ServiceProviderRecord, Stake, StakeId, StorageObjectOwner, StorageProviderId, Thread, ThreadCounter, ThreadId, TransferableStake, Url, Video, VideoCategory, VideoCategoryId, VideoId, VoteKind, WorkerId, WorkerOf } from './all';
 import { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
 import { BabeAuthorityWeight, MaybeRandomness, NextConfigDescriptor, Randomness } from '@polkadot/types/interfaces/babe';
 import { AccountData, BalanceLock } from '@polkadot/types/interfaces/balances';
@@ -256,25 +256,25 @@ declare module '@polkadot/api/types/storage' {
        **/
       DataByContentId: AugmentedQuery<ApiType, (arg: ContentId | string | Uint8Array) => Observable<Option<DataObject>>>;
       /**
-       * Global quota.
+       * Global voucher.
        **/
-      globalQuota: AugmentedQuery<ApiType, () => Observable<Quota>>;
+      globalVoucher: AugmentedQuery<ApiType, () => Observable<Voucher>>;
       /**
        * List of ids known to the system.
        **/
       knownContentIds: AugmentedQuery<ApiType, () => Observable<Vec<ContentId>>>;
       /**
-       * Upper bound for the Quota objects number limit.
+       * Upper bound for the Voucher objects number limit.
        **/
-      quotaObjectsLimitUpperBound: AugmentedQuery<ApiType, () => Observable<u64>>;
+      voucherObjectsLimitUpperBound: AugmentedQuery<ApiType, () => Observable<u64>>;
       /**
-       * Maps storage owner to it`s quota. Created when the first upload by the new actor occured.
+       * Maps storage owner to it`s voucher. Created when the first upload by the new actor occured.
        **/
-      quotas: AugmentedQuery<ApiType, (arg: StorageObjectOwner | { Member: any } | { Channel: any } | { DAO: any } | { Council: any } | { WorkingGroup: any } | string | Uint8Array) => Observable<Quota>>;
+      vouchers: AugmentedQuery<ApiType, (arg: StorageObjectOwner | { Member: any } | { Channel: any } | { DAO: any } | { Council: any } | { WorkingGroup: any } | string | Uint8Array) => Observable<Voucher>>;
       /**
-       * Upper bound for the Quota size limit.
+       * Upper bound for the Voucher size limit.
        **/
-      quotaSizeLimitUpperBound: AugmentedQuery<ApiType, () => Observable<u64>>;
+      voucherSizeLimitUpperBound: AugmentedQuery<ApiType, () => Observable<u64>>;
       /**
        * If all new uploads blocked
        **/

+ 4 - 4
types/augment/augment-api-tx.ts

@@ -314,13 +314,13 @@ declare module '@polkadot/api/types/submittable' {
        **/
       updateContentUploadingStatus: AugmentedSubmittable<(isBlocked: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>>;
       /**
-       * Updates storage object owner quota objects limit. Requires leader privileges.
+       * Updates storage object owner voucher objects limit. Requires leader privileges.
        **/
-      updateStorageObjectOwnerQuotaObjectsLimit: AugmentedSubmittable<(abstractOwner: StorageObjectOwner | { Member: any } | { Channel: any } | { DAO: any } | { Council: any } | { WorkingGroup: any } | string | Uint8Array, newQuotaObjectsLimit: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
+      updateStorageObjectOwnerVoucherObjectsLimit: AugmentedSubmittable<(abstractOwner: StorageObjectOwner | { Member: any } | { Channel: any } | { DAO: any } | { Council: any } | { WorkingGroup: any } | string | Uint8Array, newVoucherObjectsLimit: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
       /**
-       * Updates storage object owner quota size limit. Requires leader privileges.
+       * Updates storage object owner voucher size limit. Requires leader privileges.
        **/
-      updateStorageObjectOwnerQuotaSizeLimit: AugmentedSubmittable<(abstractOwner: StorageObjectOwner | { Member: any } | { Channel: any } | { DAO: any } | { Council: any } | { WorkingGroup: any } | string | Uint8Array, newQuotaSizeLimit: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
+      updateStorageObjectOwnerVoucherSizeLimit: AugmentedSubmittable<(abstractOwner: StorageObjectOwner | { Member: any } | { Channel: any } | { DAO: any } | { Council: any } | { WorkingGroup: any } | string | Uint8Array, newVoucherSizeLimit: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
     };
     dataObjectStorageRegistry: {
       /**

File diff suppressed because it is too large
+ 0 - 0
types/augment/augment-types.ts


+ 4 - 4
types/src/storage.ts

@@ -90,7 +90,7 @@ export class DataObjectType extends JoyStructDecorated({
 
 export class DataObjectsMap extends BTreeMap.with(ContentId, DataObject) {}
 
-export class Quota extends JoyStructDecorated({
+export class Voucher extends JoyStructDecorated({
   // Total objects size limit per StorageObjectOwner
   size_limit: u64,
   // Total objects number limit per StorageObjectOwner
@@ -99,7 +99,7 @@ export class Quota extends JoyStructDecorated({
   objects_used: u64,
 }) {}
 
-export class QuotaLimit extends u64 {}
+export class VoucherLimit extends u64 {}
 export class UploadingStatus extends bool {}
 
 export const mediaTypes: RegistryTypes = {
@@ -114,8 +114,8 @@ export const mediaTypes: RegistryTypes = {
   ContentParameters,
   StorageObjectOwner,
   Content,
-  Quota,
-  QuotaLimit,
+  Voucher,
+  VoucherLimit,
   UploadingStatus,
 }
 

Some files were not shown because too many files changed in this diff