Browse Source

removed num assets from channel and updated tests

ignazio-bovo 3 years ago
parent
commit
52e9023ea9

+ 49 - 52
runtime-modules/content/src/lib.rs

@@ -166,8 +166,6 @@ pub struct ChannelRecord<MemberId, CuratorGroupId, AccountId> {
     reward_account: Option<AccountId>,
     /// Account for withdrawing deletion prize funds
     deletion_prize_source_account_id: AccountId,
-    /// Number of asset held in storage
-    num_assets: u64,
 }
 
 // Channel alias type for simplification.
@@ -276,7 +274,7 @@ pub struct VideoCreationParametersRecord<StorageAssets> {
     /// Asset collection for the video
     assets: Option<StorageAssets>,
     /// Metadata for the video.
-    meta: Vec<u8>,
+    meta: Option<Vec<u8>>,
 }
 
 type VideoCreationParameters<T> = VideoCreationParametersRecord<StorageAssets<T>>;
@@ -638,7 +636,7 @@ decl_module! {
             let channel_id = NextChannelId::<T>::get();
 
             // atomically upload to storage and return the # of uploaded assets
-            let num_assets_uploaded = params.assets.as_ref().map_or(0u64,|assets| Self::upload_assets_to_storage(assets, &channel_id, &sender));
+            let _num_assets_uploaded = params.assets.as_ref().map_or(0u64,|assets| Self::upload_assets_to_storage(assets, &channel_id, &sender));
 
             //
             // == MUTATION SAFE ==
@@ -656,7 +654,6 @@ decl_module! {
                 reward_account: params.reward_account.clone(),
                 // setting the channel owner account as the prize funds account
                 deletion_prize_source_account_id: sender,
-                num_assets: num_assets_uploaded,
             };
 
             // add channel to onchain state
@@ -745,53 +742,53 @@ decl_module! {
             Ok(())
         }
 
-        /// Remove assets of a channel from storage
-        #[weight = 10_000_000] // TODO: adjust weight
-        pub fn remove_channel_assets(
-            origin,
-            actor: ContentActor<T::CuratorGroupId, T::CuratorId, T::MemberId>,
-            channel_id: T::ChannelId,
-            assets: BTreeSet<<T as storage::Trait>::DataObjectId>,
-        ) {
-            // check that channel exists
-            let channel = Self::ensure_channel_exists(&channel_id)?;
-
-            ensure_actor_authorized_to_update_channel::<T>(
-                origin,
-                &actor,
-                &channel.owner,
-            )?;
-
-            // ensure that the provided assets are not empty
-            ensure!(!assets.is_empty(), Error::<T>::NoAssetsSpecified);
-
-            let num_assets_to_remove = assets.len() as u64;
-
-            // cannot remove more asset than those already present
-            ensure!(
-                num_assets_to_remove <= channel.num_assets,
-                Error::<T>::InvalidAssetsProvided
-            );
-
-            // remove assets from storage
-            Storage::<T>::delete_data_objects(
-                channel.deletion_prize_source_account_id.clone(),
-                Self::bag_id_for_channel(&channel_id),
-                assets.clone(),
-            )?;
-
-            //
-            // == MUTATION SAFE ==
-            //
-
-            // update onchain channel status
-            let mut channel = channel;
-            channel.num_assets = channel.num_assets.saturating_sub(num_assets_to_remove);
-            ChannelById::<T>::insert(channel_id, channel.clone());
-
-
-            Self::deposit_event(RawEvent::ChannelAssetsRemoved(actor, channel_id, assets, channel));
-        }
+        // /// Remove assets of a channel from storage
+        // #[weight = 10_000_000] // TODO: adjust weight
+        // pub fn remove_channel_assets(
+        //     origin,
+        //     actor: ContentActor<T::CuratorGroupId, T::CuratorId, T::MemberId>,
+        //     channel_id: T::ChannelId,
+        //     assets: BTreeSet<<T as storage::Trait>::DataObjectId>,
+        // ) {
+        //     // check that channel exists
+        //     let channel = Self::ensure_channel_exists(&channel_id)?;
+
+        //     ensure_actor_authorized_to_update_channel::<T>(
+        //         origin,
+        //         &actor,
+        //         &channel.owner,
+        //     )?;
+
+        //     // ensure that the provided assets are not empty
+        //     ensure!(!assets.is_empty(), Error::<T>::NoAssetsSpecified);
+
+        //     let num_assets_to_remove = assets.len() as u64;
+
+        //     // cannot remove more asset than those already present
+        //     ensure!(
+        //         num_assets_to_remove <= channel.num_assets,
+        //         Error::<T>::InvalidAssetsProvided
+        //     );
+
+        //     // remove assets from storage
+        //     Storage::<T>::delete_data_objects(
+        //         channel.deletion_prize_source_account_id.clone(),
+        //         Self::bag_id_for_channel(&channel_id),
+        //         assets.clone(),
+        //     )?;
+
+        //     //
+        //     // == MUTATION SAFE ==
+        //     //
+
+        //     // update onchain channel status
+        //     let mut channel = channel;
+        //     channel.num_assets = channel.num_assets.saturating_sub(num_assets_to_remove);
+        //     ChannelById::<T>::insert(channel_id, channel.clone());
+
+
+        //     Self::deposit_event(RawEvent::ChannelAssetsRemoved(actor, channel_id, assets, channel));
+        // }
 
         #[weight = 10_000_000] // TODO: adjust weight
         pub fn update_channel_censorship_status(

+ 56 - 50
runtime-modules/content/src/tests/channels.rs

@@ -19,7 +19,7 @@ fn successful_channel_deletion() {
         );
 
         // 3 assets
-        let assets = NewAssets::<Test>::Upload(CreationUploadParameters {
+        let assets = StorageAssetsRecord {
             object_creation_list: vec![
                 DataObjectCreationParameters {
                     size: 3,
@@ -35,7 +35,7 @@ fn successful_channel_deletion() {
                 },
             ],
             expected_data_size_fee: storage::DataObjectPerMegabyteFee::<Test>::get(),
-        });
+        };
 
         let channel_id = NextChannelId::<Test>::get();
 
@@ -56,7 +56,8 @@ fn successful_channel_deletion() {
             FIRST_MEMBER_ORIGIN,
             ContentActor::Member(FIRST_MEMBER_ID),
             channel_id,
-            Err(Error::<Test>::ChannelContainsAssets.into()),
+            BTreeSet::new(),
+            Err(storage::Error::<Test>::CannotDeleteNonEmptyDynamicBag.into()),
         );
 
         // delete assets
@@ -65,20 +66,12 @@ fn successful_channel_deletion() {
             .map(|&x| x)
             .collect::<BTreeSet<_>>();
 
-        // delete channel assets
-        delete_channel_assets_mock(
-            FIRST_MEMBER_ORIGIN,
-            ContentActor::Member(FIRST_MEMBER_ID),
-            channel_id,
-            assets_to_delete,
-            Ok(()),
-        );
-
         // successful deletion
         delete_channel_mock(
             FIRST_MEMBER_ORIGIN,
             ContentActor::Member(FIRST_MEMBER_ID),
             channel_id,
+            assets_to_delete,
             Ok(()),
         );
     })
@@ -97,7 +90,7 @@ fn successful_channel_assets_deletion() {
         );
 
         // 3 assets
-        let assets = NewAssets::<Test>::Upload(CreationUploadParameters {
+        let assets = StorageAssetsRecord {
             object_creation_list: vec![
                 DataObjectCreationParameters {
                     size: 3,
@@ -113,7 +106,7 @@ fn successful_channel_assets_deletion() {
                 },
             ],
             expected_data_size_fee: storage::DataObjectPerMegabyteFee::<Test>::get(),
-        });
+        };
 
         let channel_id = NextChannelId::<Test>::get();
         // create channel
@@ -132,13 +125,17 @@ fn successful_channel_assets_deletion() {
         let assets_to_delete = [0u64, 1u64].iter().map(|&x| x).collect::<BTreeSet<_>>();
 
         // delete channel assets
-        delete_channel_assets_mock(
-            FIRST_MEMBER_ORIGIN,
+        assert_ok!(Content::update_channel(
+            Origin::signed(FIRST_MEMBER_ORIGIN),
             ContentActor::Member(FIRST_MEMBER_ID),
             channel_id,
+            ChannelUpdateParametersRecord {
+                assets: None,
+                new_meta: None,
+                reward_account: None,
+            },
             assets_to_delete,
-            Ok(()),
-        );
+        ));
     })
 }
 
@@ -155,7 +152,8 @@ fn succesful_channel_update() {
         );
 
         // 2 + 1 assets to be uploaded
-        let assets = NewAssets::<Test>::Upload(CreationUploadParameters {
+        let first_obj_id = Storage::<Test>::next_data_object_id();
+        let first_batch = StorageAssetsRecord {
             object_creation_list: vec![
                 DataObjectCreationParameters {
                     size: 3,
@@ -167,9 +165,11 @@ fn succesful_channel_update() {
                 },
             ],
             expected_data_size_fee: storage::DataObjectPerMegabyteFee::<Test>::get(),
-        });
+        };
+        let first_batch_ids =
+            (first_obj_id..Storage::<Test>::next_data_object_id()).collect::<BTreeSet<_>>();
 
-        let new_assets = NewAssets::<Test>::Upload(CreationUploadParameters {
+        let second_batch = StorageAssetsRecord {
             object_creation_list: vec![
                 DataObjectCreationParameters {
                     size: 3,
@@ -181,35 +181,37 @@ fn succesful_channel_update() {
                 },
             ],
             expected_data_size_fee: storage::DataObjectPerMegabyteFee::<Test>::get(),
-        });
+        };
 
         let channel_id = NextChannelId::<Test>::get();
-        // create channel
+
+        // create channel with first batch of assets
         create_channel_mock(
             FIRST_MEMBER_ORIGIN,
             ContentActor::Member(FIRST_MEMBER_ID),
             ChannelCreationParametersRecord {
-                assets: Some(assets),
+                assets: Some(first_batch),
                 meta: Some(vec![]),
                 reward_account: None,
             },
             Ok(()),
         );
 
-        // update channel
+        // update channel by adding the second batch of assets
         update_channel_mock(
             FIRST_MEMBER_ORIGIN,
             ContentActor::Member(FIRST_MEMBER_ID),
             channel_id,
             ChannelUpdateParametersRecord {
-                assets: Some(new_assets),
+                assets: Some(second_batch),
                 new_meta: Some(vec![]),
                 reward_account: None,
             },
+            BTreeSet::new(),
             Ok(()),
         );
 
-        // update with 0 assets
+        // update channel by removing the first batch of assets
         update_channel_mock(
             FIRST_MEMBER_ORIGIN,
             ContentActor::Member(FIRST_MEMBER_ID),
@@ -219,6 +221,7 @@ fn succesful_channel_update() {
                 new_meta: None,
                 reward_account: None,
             },
+            first_batch_ids,
             Ok(()),
         );
     })
@@ -237,7 +240,7 @@ fn succesful_channel_creation() {
         );
 
         // 3 assets to be uploaded
-        let assets = NewAssets::<Test>::Upload(CreationUploadParameters {
+        let assets = StorageAssetsRecord {
             object_creation_list: vec![
                 DataObjectCreationParameters {
                     size: 3,
@@ -253,7 +256,7 @@ fn succesful_channel_creation() {
                 },
             ],
             expected_data_size_fee: storage::DataObjectPerMegabyteFee::<Test>::get(),
-        });
+        };
 
         // create channel
         create_channel_mock(
@@ -277,7 +280,7 @@ fn lead_cannot_create_channel() {
                 Origin::signed(LEAD_ORIGIN),
                 ContentActor::Lead,
                 ChannelCreationParametersRecord {
-                    assets: Some(NewAssets::<Test>::Urls(vec![])),
+                    assets: None,
                     meta: Some(vec![]),
                     reward_account: None,
                 }
@@ -299,7 +302,7 @@ fn curator_owned_channels() {
                 Origin::signed(FIRST_CURATOR_ORIGIN),
                 ContentActor::Curator(FIRST_CURATOR_GROUP_ID, FIRST_CURATOR_ID),
                 ChannelCreationParametersRecord {
-                    assets: Some(NewAssets::<Test>::Urls(vec![])),
+                    assets: None,
                     meta: Some(vec![]),
                     reward_account: None,
                 }
@@ -316,7 +319,7 @@ fn curator_owned_channels() {
                 Origin::signed(SECOND_CURATOR_ORIGIN),
                 ContentActor::Curator(FIRST_CURATOR_GROUP_ID, SECOND_CURATOR_ID),
                 ChannelCreationParametersRecord {
-                    assets: Some(NewAssets::<Test>::Urls(vec![])),
+                    assets: None,
                     meta: Some(vec![]),
                     reward_account: None,
                 }
@@ -330,7 +333,7 @@ fn curator_owned_channels() {
                 Origin::signed(SECOND_CURATOR_ORIGIN),
                 ContentActor::Curator(FIRST_CURATOR_GROUP_ID, FIRST_CURATOR_ID),
                 ChannelCreationParametersRecord {
-                    assets: Some(NewAssets::<Test>::Urls(vec![])),
+                    assets: None,
                     meta: Some(vec![]),
                     reward_account: None,
                 }
@@ -345,7 +348,7 @@ fn curator_owned_channels() {
             Origin::signed(FIRST_CURATOR_ORIGIN),
             ContentActor::Curator(FIRST_CURATOR_GROUP_ID, FIRST_CURATOR_ID),
             ChannelCreationParametersRecord {
-                assets: Some(NewAssets::<Test>::Urls(vec![])),
+                assets: None,
                 meta: Some(vec![]),
                 reward_account: None,
             }
@@ -361,11 +364,10 @@ fn curator_owned_channels() {
                     is_censored: false,
                     reward_account: None,
                     deletion_prize_source_account_id: FIRST_CURATOR_ORIGIN,
-                    num_assets: 0,
                     num_videos: 0,
                 },
                 ChannelCreationParametersRecord {
-                    assets: Some(NewAssets::<Test>::Urls(vec![])),
+                    assets: None,
                     meta: Some(vec![]),
                     reward_account: None,
                 }
@@ -381,7 +383,8 @@ fn curator_owned_channels() {
                 assets: None,
                 new_meta: None,
                 reward_account: None,
-            }
+            },
+            BTreeSet::new(),
         ));
 
         // Lead can update curator owned channels
@@ -393,7 +396,8 @@ fn curator_owned_channels() {
                 assets: None,
                 new_meta: None,
                 reward_account: None,
-            }
+            },
+            BTreeSet::new(),
         ));
     })
 }
@@ -410,7 +414,7 @@ fn member_owned_channels() {
                 Origin::signed(UNKNOWN_ORIGIN),
                 ContentActor::Member(MEMBERS_COUNT + 1),
                 ChannelCreationParametersRecord {
-                    assets: Some(NewAssets::<Test>::Urls(vec![])),
+                    assets: None,
                     meta: Some(vec![]),
                     reward_account: None,
                 }
@@ -425,7 +429,7 @@ fn member_owned_channels() {
             Origin::signed(FIRST_MEMBER_ORIGIN),
             ContentActor::Member(FIRST_MEMBER_ID),
             ChannelCreationParametersRecord {
-                assets: Some(NewAssets::<Test>::Urls(vec![])),
+                assets: None,
                 meta: Some(vec![]),
                 reward_account: None,
             }
@@ -441,11 +445,11 @@ fn member_owned_channels() {
                     is_censored: false,
                     reward_account: None,
                     deletion_prize_source_account_id: FIRST_MEMBER_ORIGIN,
-                    num_assets: 0,
+
                     num_videos: 0,
                 },
                 ChannelCreationParametersRecord {
-                    assets: Some(NewAssets::<Test>::Urls(vec![])),
+                    assets: None,
                     meta: Some(vec![]),
                     reward_account: None,
                 }
@@ -459,7 +463,7 @@ fn member_owned_channels() {
             Origin::signed(SECOND_MEMBER_ORIGIN),
             ContentActor::Member(SECOND_MEMBER_ID),
             ChannelCreationParametersRecord {
-                assets: Some(NewAssets::<Test>::Urls(vec![])),
+                assets: None,
                 meta: Some(vec![]),
                 reward_account: None,
             }
@@ -475,11 +479,11 @@ fn member_owned_channels() {
                     is_censored: false,
                     reward_account: None,
                     deletion_prize_source_account_id: SECOND_MEMBER_ORIGIN,
-                    num_assets: 0,
+
                     num_videos: 0,
                 },
                 ChannelCreationParametersRecord {
-                    assets: Some(NewAssets::<Test>::Urls(vec![])),
+                    assets: None,
                     meta: Some(vec![]),
                     reward_account: None,
                 }
@@ -495,7 +499,8 @@ fn member_owned_channels() {
                 assets: None,
                 new_meta: None,
                 reward_account: None,
-            }
+            },
+            BTreeSet::new(),
         ));
 
         assert_eq!(
@@ -508,7 +513,7 @@ fn member_owned_channels() {
                     is_censored: false,
                     reward_account: None,
                     deletion_prize_source_account_id: FIRST_MEMBER_ORIGIN,
-                    num_assets: 0,
+
                     num_videos: 0,
                 },
                 ChannelUpdateParametersRecord {
@@ -529,7 +534,8 @@ fn member_owned_channels() {
                     assets: None,
                     new_meta: None,
                     reward_account: None,
-                }
+                },
+                BTreeSet::new(),
             ),
             Error::<Test>::ActorNotAuthorized
         );
@@ -547,7 +553,7 @@ fn channel_censoring() {
             Origin::signed(FIRST_MEMBER_ORIGIN),
             ContentActor::Member(FIRST_MEMBER_ID),
             ChannelCreationParametersRecord {
-                assets: Some(NewAssets::<Test>::Urls(vec![])),
+                assets: None,
                 meta: Some(vec![]),
                 reward_account: None,
             }
@@ -623,7 +629,7 @@ fn channel_censoring() {
             Origin::signed(FIRST_CURATOR_ORIGIN),
             ContentActor::Curator(group_id, FIRST_CURATOR_ID),
             ChannelCreationParametersRecord {
-                assets: Some(NewAssets::<Test>::Urls(vec![])),
+                assets: None,
                 meta: Some(vec![]),
                 reward_account: None,
             }

+ 22 - 64
runtime-modules/content/src/tests/mock.rs

@@ -447,69 +447,19 @@ pub fn create_channel_mock(
     );
 
     if result.is_ok() {
-        if let Some(assets) = params.assets.as_ref() {
-            let num_assets = match &assets {
-                NewAssets::<Test>::Urls(v) => v.len() as u64,
-                NewAssets::<Test>::Upload(c) => c.object_creation_list.len() as u64,
-            };
-            let owner = Content::actor_to_channel_owner(&actor).unwrap();
-
-            assert_eq!(
-                System::events().last().unwrap().event,
-                MetaEvent::content(RawEvent::ChannelCreated(
-                    actor.clone(),
-                    channel_id,
-                    ChannelRecord {
-                        owner: owner,
-                        is_censored: false,
-                        reward_account: params.reward_account,
-                        deletion_prize_source_account_id: sender,
-                        num_assets: num_assets,
-                        num_videos: 0,
-                    },
-                    params.clone(),
-                ))
-            );
-        }
-    }
-}
-
-pub fn update_channel_mock(
-    sender: u64,
-    actor: ContentActor<CuratorGroupId, CuratorId, MemberId>,
-    channel_id: ChannelId,
-    params: ChannelUpdateParameters<Test>,
-    result: DispatchResult,
-) {
-    let channel_pre = ChannelById::<Test>::get(channel_id.clone());
-
-    assert_eq!(
-        Content::update_channel(
-            Origin::signed(sender),
-            actor.clone(),
-            channel_id.clone(),
-            params.clone()
-        ),
-        result.clone(),
-    );
+        let owner = Content::actor_to_channel_owner(&actor).unwrap();
 
-    if result.is_ok() {
-        let maybe_num_assets = params.assets.clone().map_or(None, |assets| match assets {
-            NewAssets::<Test>::Urls(v) => Some(v.len() as u64),
-            NewAssets::<Test>::Upload(c) => Some(c.object_creation_list.len() as u64),
-        });
         assert_eq!(
             System::events().last().unwrap().event,
-            MetaEvent::content(RawEvent::ChannelUpdated(
+            MetaEvent::content(RawEvent::ChannelCreated(
                 actor.clone(),
                 channel_id,
                 ChannelRecord {
-                    owner: channel_pre.owner.clone(),
-                    is_censored: channel_pre.is_censored,
-                    reward_account: channel_pre.reward_account.clone(),
+                    owner: owner,
+                    is_censored: false,
+                    reward_account: params.reward_account,
                     deletion_prize_source_account_id: sender,
-                    num_assets: channel_pre.num_assets + maybe_num_assets.unwrap_or(0),
-                    num_videos: channel_pre.num_videos,
+                    num_videos: 0,
                 },
                 params.clone(),
             ))
@@ -517,41 +467,41 @@ pub fn update_channel_mock(
     }
 }
 
-pub fn delete_channel_assets_mock(
+pub fn update_channel_mock(
     sender: u64,
     actor: ContentActor<CuratorGroupId, CuratorId, MemberId>,
     channel_id: ChannelId,
+    params: ChannelUpdateParameters<Test>,
     assets: BTreeSet<<Test as storage::Trait>::DataObjectId>,
     result: DispatchResult,
 ) {
     let channel_pre = ChannelById::<Test>::get(channel_id.clone());
 
     assert_eq!(
-        Content::remove_channel_assets(
+        Content::update_channel(
             Origin::signed(sender),
             actor.clone(),
             channel_id.clone(),
+            params.clone(),
             assets.clone(),
         ),
         result.clone(),
     );
 
     if result.is_ok() {
-        let num_assets_removed = assets.len();
         assert_eq!(
             System::events().last().unwrap().event,
-            MetaEvent::content(RawEvent::ChannelAssetsRemoved(
+            MetaEvent::content(RawEvent::ChannelUpdated(
                 actor.clone(),
                 channel_id,
-                assets.clone(),
                 ChannelRecord {
                     owner: channel_pre.owner.clone(),
                     is_censored: channel_pre.is_censored,
                     reward_account: channel_pre.reward_account.clone(),
                     deletion_prize_source_account_id: sender,
-                    num_assets: channel_pre.num_assets - (num_assets_removed as u64),
                     num_videos: channel_pre.num_videos,
                 },
+                params.clone(),
             ))
         );
     }
@@ -561,10 +511,16 @@ pub fn delete_channel_mock(
     sender: u64,
     actor: ContentActor<CuratorGroupId, CuratorId, MemberId>,
     channel_id: ChannelId,
+    assets: BTreeSet<<Test as storage::Trait>::DataObjectId>,
     result: DispatchResult,
 ) {
     assert_eq!(
-        Content::delete_channel(Origin::signed(sender), actor.clone(), channel_id.clone()),
+        Content::delete_channel(
+            Origin::signed(sender),
+            actor.clone(),
+            channel_id.clone(),
+            assets.clone()
+        ),
         result.clone(),
     );
 
@@ -617,6 +573,7 @@ pub fn update_video_mock(
     actor: ContentActor<CuratorGroupId, CuratorId, MemberId>,
     video_id: <Test as Trait>::VideoId,
     params: VideoUpdateParameters<Test>,
+    assets: BTreeSet<<Test as storage::Trait>::DataObjectId>,
     result: DispatchResult,
 ) {
     // let channel_id = Content::video_by_id(video_id.clone()).in_channel;
@@ -627,7 +584,8 @@ pub fn update_video_mock(
             Origin::signed(sender),
             actor.clone(),
             video_id.clone(),
-            params.clone()
+            params.clone(),
+            assets.clone()
         ),
         result.clone(),
     );

+ 30 - 29
runtime-modules/content/src/tests/videos.rs

@@ -14,7 +14,7 @@ fn create_member_channel() -> ChannelId {
         Origin::signed(FIRST_MEMBER_ORIGIN),
         ContentActor::Member(FIRST_MEMBER_ID),
         ChannelCreationParametersRecord {
-            assets: Some(NewAssets::<Test>::Urls(vec![])),
+            assets: None,
             meta: Some(vec![]),
             reward_account: None,
         }
@@ -40,7 +40,7 @@ fn video_creation_successful() {
             FIRST_MEMBER_ORIGIN,
             ContentActor::Member(FIRST_MEMBER_ID),
             ChannelCreationParametersRecord {
-                assets: Some(NewAssets::<Test>::Urls(vec![])),
+                assets: None,
                 meta: Some(vec![]),
                 reward_account: None,
             },
@@ -48,7 +48,7 @@ fn video_creation_successful() {
         );
 
         let params = VideoCreationParametersRecord {
-            assets: NewAssets::<Test>::Upload(CreationUploadParameters {
+            assets: Some(StorageAssetsRecord {
                 object_creation_list: vec![
                     DataObjectCreationParameters {
                         size: 3,
@@ -65,7 +65,7 @@ fn video_creation_successful() {
                 ],
                 expected_data_size_fee: storage::DataObjectPerMegabyteFee::<Test>::get(),
             }),
-            meta: b"test".to_vec(),
+            meta: Some(b"test".to_vec()),
         };
 
         create_video_mock(
@@ -94,7 +94,7 @@ fn video_update_successful() {
             FIRST_MEMBER_ORIGIN,
             ContentActor::Member(FIRST_MEMBER_ID),
             ChannelCreationParametersRecord {
-                assets: Some(NewAssets::<Test>::Urls(vec![])),
+                assets: None,
                 meta: Some(vec![]),
                 reward_account: None,
             },
@@ -102,7 +102,7 @@ fn video_update_successful() {
         );
 
         let params = VideoCreationParametersRecord {
-            assets: NewAssets::<Test>::Upload(CreationUploadParameters {
+            assets: Some(StorageAssetsRecord {
                 object_creation_list: vec![
                     DataObjectCreationParameters {
                         size: 3,
@@ -119,7 +119,7 @@ fn video_update_successful() {
                 ],
                 expected_data_size_fee: storage::DataObjectPerMegabyteFee::<Test>::get(),
             }),
-            meta: b"test".to_vec(),
+            meta: Some(b"test".to_vec()),
         };
 
         let video_id = Content::next_video_id();
@@ -133,13 +133,13 @@ fn video_update_successful() {
         );
 
         let update_params = VideoUpdateParametersRecord {
-            assets: Some(NewAssets::<Test>::Upload(CreationUploadParameters {
+            assets: Some(StorageAssetsRecord {
                 object_creation_list: vec![DataObjectCreationParameters {
                     size: 3,
                     ipfs_content_id: b"first".to_vec(),
                 }],
                 expected_data_size_fee: storage::DataObjectPerMegabyteFee::<Test>::get(),
-            })),
+            }),
             new_meta: None,
         };
 
@@ -148,6 +148,7 @@ fn video_update_successful() {
             ContentActor::Member(FIRST_MEMBER_ID),
             video_id,
             update_params,
+            BTreeSet::new(),
             Ok(()),
         );
     })
@@ -166,8 +167,8 @@ fn member_can_create_videos() {
             ContentActor::Member(FIRST_MEMBER_ID),
             channel_id,
             VideoCreationParametersRecord {
-                assets: NewAssets::<Test>::Urls(vec![vec![b"https://somewhere.com/".to_vec()]]),
-                meta: b"metablob".to_vec(),
+                assets: None,
+                meta: None,
             }
         ));
 
@@ -178,8 +179,8 @@ fn member_can_create_videos() {
                 channel_id,
                 video_id,
                 VideoCreationParametersRecord {
-                    assets: NewAssets::<Test>::Urls(vec![vec![b"https://somewhere.com/".to_vec()]]),
-                    meta: b"metablob".to_vec(),
+                    assets: None,
+                    meta: None,
                 }
             ))
         );
@@ -194,11 +195,10 @@ fn member_can_create_videos() {
             ContentActor::Member(FIRST_MEMBER_ID),
             video_id,
             VideoUpdateParametersRecord {
-                assets: Some(NewAssets::<Test>::Urls(vec![vec![
-                    b"https://somewhere-else.com/".to_vec()
-                ]])),
-                new_meta: Some(b"newmetablob".to_vec()),
-            }
+                assets: None,
+                new_meta: None,
+            },
+            BTreeSet::new(),
         ));
 
         assert_eq!(
@@ -207,10 +207,8 @@ fn member_can_create_videos() {
                 ContentActor::Member(FIRST_MEMBER_ID),
                 video_id,
                 VideoUpdateParametersRecord {
-                    assets: Some(NewAssets::<Test>::Urls(vec![vec![
-                        b"https://somewhere-else.com/".to_vec()
-                    ]])),
-                    new_meta: Some(b"newmetablob".to_vec()),
+                    assets: None,
+                    new_meta: None,
                 }
             ))
         );
@@ -222,8 +220,8 @@ fn member_can_create_videos() {
                 ContentActor::Member(SECOND_MEMBER_ID),
                 channel_id,
                 VideoCreationParametersRecord {
-                    assets: NewAssets::<Test>::Urls(vec![]),
-                    meta: vec![],
+                    assets: None,
+                    meta: None,
                 }
             ),
             Error::<Test>::ActorNotAuthorized
@@ -238,7 +236,8 @@ fn member_can_create_videos() {
                 VideoUpdateParametersRecord {
                     assets: None,
                     new_meta: None,
-                }
+                },
+                BTreeSet::new(),
             ),
             Error::<Test>::ActorNotAuthorized
         );
@@ -248,7 +247,8 @@ fn member_can_create_videos() {
             Content::delete_video(
                 Origin::signed(SECOND_MEMBER_ORIGIN),
                 ContentActor::Member(SECOND_MEMBER_ID),
-                video_id
+                video_id,
+                BTreeSet::new(),
             ),
             Error::<Test>::ActorNotAuthorized
         );
@@ -257,7 +257,8 @@ fn member_can_create_videos() {
         assert_ok!(Content::delete_video(
             Origin::signed(FIRST_MEMBER_ORIGIN),
             ContentActor::Member(FIRST_MEMBER_ID),
-            video_id
+            video_id,
+            BTreeSet::new(),
         ));
 
         assert_eq!(
@@ -283,8 +284,8 @@ fn curators_can_censor_videos() {
             ContentActor::Member(FIRST_MEMBER_ID),
             channel_id,
             VideoCreationParametersRecord {
-                assets: NewAssets::<Test>::Urls(vec![vec![b"https://somewhere.com/".to_vec()]]),
-                meta: b"metablob".to_vec(),
+                assets: None,
+                meta: None,
             }
         ));