Browse Source

runtime: blog-module: remove length constraints

conectado 4 years ago
parent
commit
9afc1ef398

+ 0 - 15
runtime-modules/blog-module/src/error_messages.rs

@@ -1,15 +0,0 @@
-pub const BLOG_NOT_FOUND: &str = "Blog, associated with given blog id does not found";
-pub const BLOG_OWNERSHIP_ERROR: &str = "You don`t own blog, associated with this identifier";
-pub const BLOG_LOCKED_ERROR: &str = "Please, unlock your blog before any new actions";
-pub const POST_NOT_FOUND: &str = "Post, associated with given blog and post ids does not found";
-pub const POST_LOCKED_ERROR: &str = "Please, unlock post before this action!";
-pub const REPLY_NOT_FOUND: &str =
-    "Reply, associated with given blog, post and reply ids does not found";
-pub const REPLY_OWNERSHIP_ERROR: &str = "You don`t own reply, associated with this identifier";
-pub const POST_TITLE_TOO_LONG: &str = "Post title too long";
-pub const POST_BODY_TOO_LONG: &str = "Post body too long";
-pub const REPLY_TEXT_TOO_LONG: &str = "ReplyById text too long";
-pub const POSTS_LIMIT_REACHED: &str = "Posts limit in a blog reached";
-pub const REPLIES_LIMIT_REACHED: &str = "Replies limit in a post reached";
-pub const INVALID_REACTION_INDEX: &str =
-    "Reaction index is not valid or reaction under given index does not exists";

+ 0 - 9
runtime-modules/blog-module/src/errors.rs

@@ -19,15 +19,6 @@ decl_error! {
         /// A non-owner of a reply is trying to do a privileged action.
         ReplyOwnershipError,
 
-        /// Post title exceeds limitations.
-        PostTitleTooLong,
-
-        /// Post body exceeds limitations.
-        PostBodyTooLong,
-
-        /// Reply text exceeds limitations.
-        ReplyTextTooLong,
-
         /// Number of posts exceeds limits.
         PostLimitReached,
 

+ 8 - 82
runtime-modules/blog-module/src/lib.rs

@@ -54,8 +54,6 @@ mod errors;
 mod mock;
 mod tests;
 
-type MaxLength = u64;
-
 type MaxNumber = u64;
 
 /// Type, representing reactions number
@@ -75,17 +73,6 @@ pub trait Trait<I: Instance = DefaultInstance>: frame_system::Trait {
     /// The overarching event type.
     type Event: From<Event<Self, I>> + Into<<Self as frame_system::Trait>::Event>;
 
-    /// Security/configuration constraints
-
-    /// The maximum length of each post`s title.
-    type PostTitleMaxLength: Get<MaxLength>;
-
-    /// The maximum length of each post`s body.
-    type PostBodyMaxLength: Get<MaxLength>;
-
-    /// The maximum length of each reply.
-    type ReplyMaxLength: Get<MaxLength>;
-
     /// The maximum number of posts in a blog.
     type PostsMaxNumber: Get<MaxNumber>;
 
@@ -297,11 +284,6 @@ decl_module! {
 
             // Check security/configuration constraints
 
-            // Ensure post title length is valid
-            Self::ensure_post_title_is_valid(&title)?;
-
-            // Ensure post body length is valid
-            Self::ensure_post_body_is_valid(&body)?;
             let posts_count = Self::ensure_posts_limit_not_reached()?;
 
             //
@@ -385,19 +367,6 @@ decl_module! {
             // Ensure post unlocked, so mutations can be performed
             Self::ensure_post_unlocked(&post)?;
 
-            // Check security/configuration constraints
-
-            // Ensure post title length is valid
-            if let Some(ref new_title) = new_title {
-                Self::ensure_post_title_is_valid(&new_title)?;
-            }
-
-            // Ensure post body length is valid
-            if let Some(ref new_body) = new_body {
-                Self::ensure_post_body_is_valid(&new_body)?;
-            }
-
-            //
             // == MUTATION SAFE ==
             //
 
@@ -426,9 +395,6 @@ decl_module! {
             // Ensure post unlocked, so mutations can be performed
             Self::ensure_post_unlocked(&post)?;
 
-            // Ensure reply text length is valid
-            Self::ensure_reply_text_is_valid(&text)?;
-
             // Ensure root replies limit not reached
             Self::ensure_replies_limit_not_reached(&post)?;
 
@@ -485,9 +451,6 @@ decl_module! {
             // Ensure reply -> owner relation exists
             Self::ensure_reply_ownership(&reply, &reply_owner)?;
 
-            // Check security/configuration constraint
-            Self::ensure_reply_text_is_valid(&new_text)?;
-
             //
             // == MUTATION SAFE ==
             //
@@ -530,16 +493,12 @@ decl_module! {
             // == MUTATION SAFE ==
             //
 
-            // Update reply`s reactions
-            <Reactions<T, I>>::mutate((post_id, reply_id), owner, |inner_reactions| {
-                let reaction_status = Self::mutate_reactions(inner_reactions, index);
-                // Trigger event
-                if let Some(reply_id) = reply_id {
-                    Self::deposit_event(RawEvent::ReplyReactionsUpdated(owner, post_id, reply_id, index, reaction_status));
-                } else {
-                    Self::deposit_event(RawEvent::PostReactionsUpdated(owner, post_id, index, reaction_status));
-                }
-            });
+            // Trigger event
+            if let Some(reply_id) = reply_id {
+                Self::deposit_event(RawEvent::ReplyReactionsUpdated(owner, post_id, reply_id, index));
+            } else {
+                Self::deposit_event(RawEvent::PostReactionsUpdated(owner, post_id, index));
+            }
         }
 
     }
@@ -551,14 +510,6 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
         Ok(T::ParticipantEnsureOrigin::ensure_origin(origin)?)
     }
 
-    // Flip reaction status under given index and returns the result of that flip.
-    // If there is no reactions under this AccountId entry yet,
-    // initialize a new reactions array and set reaction under given index
-    fn mutate_reactions(reactions: &mut [bool], index: ReactionsNumber) -> bool {
-        reactions[index as usize] ^= true;
-        reactions[index as usize]
-    }
-
     fn ensure_post_exists(post_id: T::PostId) -> Result<Post<T, I>, DispatchError> {
         ensure!(
             <PostById<T, I>>::contains_key(post_id),
@@ -603,22 +554,6 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
         Ok(())
     }
 
-    fn ensure_post_title_is_valid(title: &[u8]) -> Result<(), DispatchError> {
-        ensure!(
-            title.len() <= T::PostTitleMaxLength::get() as usize,
-            Error::<T, I>::PostTitleTooLong
-        );
-        Ok(())
-    }
-
-    fn ensure_post_body_is_valid(body: &[u8]) -> Result<(), DispatchError> {
-        ensure!(
-            body.len() <= T::PostBodyMaxLength::get() as usize,
-            Error::<T, I>::PostBodyTooLong
-        );
-        Ok(())
-    }
-
     fn ensure_posts_limit_not_reached() -> Result<T::PostId, DispatchError> {
         // Get posts count, associated with given blog
         let posts_count = Self::post_count();
@@ -643,14 +578,6 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
         Ok(())
     }
 
-    fn ensure_reply_text_is_valid(reply_text: &[u8]) -> Result<(), DispatchError> {
-        ensure!(
-            reply_text.len() <= T::ReplyMaxLength::get() as usize,
-            Error::<T, I>::ReplyTextTooLong
-        );
-        Ok(())
-    }
-
     fn ensure_reaction_index_is_valid(index: ReactionsNumber) -> Result<(), DispatchError> {
         ensure!(
             index < REACTIONS_MAX_NUMBER,
@@ -667,7 +594,6 @@ decl_event!(
         PostId = <T as Trait<I>>::PostId,
         ReplyId = <T as Trait<I>>::ReplyId,
         ReactionIndex = ReactionsNumber,
-        Status = bool,
     {
         /// A post was created
         PostCreated(PostId),
@@ -691,9 +617,9 @@ decl_event!(
         ReplyEdited(PostId, ReplyId),
 
         /// A post reaction was created or changed
-        PostReactionsUpdated(ParticipantId, PostId, ReactionIndex, Status),
+        PostReactionsUpdated(ParticipantId, PostId, ReactionIndex),
 
         /// A reply creation was created or changed
-        ReplyReactionsUpdated(ParticipantId, PostId, ReplyId, ReactionIndex, Status),
+        ReplyReactionsUpdated(ParticipantId, PostId, ReplyId, ReactionIndex),
     }
 );

+ 12 - 77
runtime-modules/blog-module/src/mock.rs

@@ -69,9 +69,6 @@ ord_parameter_types! {
 }
 
 parameter_types! {
-    pub const PostTitleMaxLength: u64 = 200;
-    pub const PostBodyMaxLength: u64 = 10_000;
-    pub const ReplyMaxLength: u64 = 2_000;
     pub const PostsMaxNumber: u64 = 20;
     pub const RepliesMaxNumber: u64 = 100;
 }
@@ -79,10 +76,6 @@ parameter_types! {
 impl Trait for Runtime {
     type Event = TestEvent;
 
-    type PostTitleMaxLength = PostTitleMaxLength;
-    type PostBodyMaxLength = PostBodyMaxLength;
-    type ReplyMaxLength = ReplyMaxLength;
-
     type PostsMaxNumber = PostsMaxNumber;
     type RepliesMaxNumber = RepliesMaxNumber;
 
@@ -127,17 +120,6 @@ impl ExtBuilder {
 pub type System = frame_system::Module<Runtime>;
 pub type TestBlogModule = Module<Runtime>;
 
-pub enum PostType {
-    Valid,
-    PostTitleInvalid,
-    PostBodyInvalid,
-}
-
-pub enum ReplyType {
-    Valid,
-    Invalid,
-}
-
 pub fn generate_text(len: usize) -> Vec<u8> {
     vec![b'x'; len]
 }
@@ -147,7 +129,6 @@ type RawTestEvent = RawEvent<
     <Runtime as Trait>::PostId,
     <Runtime as Trait>::ReplyId,
     ReactionsNumber,
-    bool,
     DefaultInstance,
 >;
 
@@ -167,31 +148,9 @@ pub fn post_by_id(post_id: <Runtime as Trait>::PostId) -> Option<Post<Runtime, D
     }
 }
 
-pub fn get_post(
-    post_type: PostType,
-    editing: bool,
-    locked: bool,
-) -> Post<Runtime, DefaultInstance> {
-    let (title, body);
-    match post_type {
-        // Make them different
-        PostType::Valid if editing => {
-            title = generate_text((PostTitleMaxLength::get() - 1) as usize);
-            body = generate_text((PostBodyMaxLength::get() - 1) as usize);
-        }
-        PostType::Valid => {
-            title = generate_text(PostTitleMaxLength::get() as usize);
-            body = generate_text(PostBodyMaxLength::get() as usize);
-        }
-        PostType::PostTitleInvalid => {
-            title = generate_text((PostTitleMaxLength::get() + 1) as usize);
-            body = generate_text(PostBodyMaxLength::get() as usize);
-        }
-        PostType::PostBodyInvalid => {
-            title = generate_text(PostTitleMaxLength::get() as usize);
-            body = generate_text((PostBodyMaxLength::get() + 1) as usize);
-        }
-    }
+pub fn get_post(locked: bool) -> Post<Runtime, DefaultInstance> {
+    let title = generate_text(10);
+    let body = generate_text(100);
     let mut post = Post::new(title, body);
     if locked {
         post.lock()
@@ -199,8 +158,8 @@ pub fn get_post(
     post
 }
 
-pub fn create_post(origin_id: u64, post_type: PostType) -> DispatchResult {
-    let post = get_post(post_type, false, false);
+pub fn create_post(origin_id: u64) -> DispatchResult {
+    let post = get_post(false);
     TestBlogModule::create_post(Origin::signed(origin_id), post.title, post.body)
 }
 
@@ -212,12 +171,8 @@ pub fn unlock_post(origin_id: u64, post_id: <Runtime as Trait>::PostId) -> Dispa
     TestBlogModule::unlock_post(Origin::signed(origin_id), post_id)
 }
 
-pub fn edit_post(
-    origin_id: u64,
-    post_id: <Runtime as Trait>::PostId,
-    post_type: PostType,
-) -> DispatchResult {
-    let post = get_post(post_type, true, false);
+pub fn edit_post(origin_id: u64, post_id: <Runtime as Trait>::PostId) -> DispatchResult {
+    let post = get_post(false);
     TestBlogModule::edit_post(
         Origin::signed(origin_id),
         post_id,
@@ -237,21 +192,15 @@ pub fn reply_by_id(
     }
 }
 
-pub fn get_reply_text(reply_type: ReplyType, editing: bool) -> Vec<u8> {
-    match reply_type {
-        ReplyType::Valid if editing => generate_text(ReplyMaxLength::get() as usize),
-        ReplyType::Valid => generate_text(ReplyMaxLength::get() as usize),
-        ReplyType::Invalid => generate_text((ReplyMaxLength::get() + 1) as usize),
-    }
+pub fn get_reply_text() -> Vec<u8> {
+    generate_text(100)
 }
 
 pub fn get_reply(
-    reply_type: ReplyType,
     owner: <Runtime as frame_system::Trait>::AccountId,
     parent_id: ParentId<Runtime, DefaultInstance>,
-    editing: bool,
 ) -> Reply<Runtime, DefaultInstance> {
-    let reply_text = get_reply_text(reply_type, editing);
+    let reply_text = get_reply_text();
     Reply::new(reply_text, owner, parent_id)
 }
 
@@ -259,9 +208,8 @@ pub fn create_reply(
     origin_id: u64,
     post_id: <Runtime as Trait>::PostId,
     reply_id: Option<<Runtime as Trait>::ReplyId>,
-    reply_type: ReplyType,
 ) -> DispatchResult {
-    let reply = get_reply_text(reply_type, false);
+    let reply = get_reply_text();
     TestBlogModule::create_reply(Origin::signed(origin_id), post_id, reply_id, reply)
 }
 
@@ -269,9 +217,8 @@ pub fn edit_reply(
     origin_id: u64,
     post_id: <Runtime as Trait>::PostId,
     reply_id: <Runtime as Trait>::ReplyId,
-    reply_type: ReplyType,
 ) -> DispatchResult {
-    let reply = get_reply_text(reply_type, true);
+    let reply = get_reply_text();
     TestBlogModule::edit_reply(Origin::signed(origin_id), post_id, reply_id, reply)
 }
 
@@ -285,15 +232,3 @@ pub fn react(
 ) -> DispatchResult {
     TestBlogModule::react(Origin::signed(origin_id), index, post_id, reply_id)
 }
-
-pub fn get_reactions(
-    post_id: <Runtime as Trait>::PostId,
-    reply_id: Option<<Runtime as Trait>::ReplyId>,
-    owner: <Runtime as Trait>::ParticipantId,
-) -> Option<[bool; REACTIONS_MAX_NUMBER as usize]> {
-    if Reactions::<Runtime>::contains_key((post_id, reply_id), owner) {
-        Some(TestBlogModule::reactions((post_id, reply_id), owner))
-    } else {
-        None
-    }
-}

+ 55 - 278
runtime-modules/blog-module/src/tests.rs

@@ -41,36 +41,19 @@ fn ensure_replies_equality(
     reply: Option<Reply<Runtime, DefaultInstance>>,
     reply_owner_id: <Runtime as frame_system::Trait>::AccountId,
     parent: ParentId<Runtime, DefaultInstance>,
-    editing: bool,
 ) {
     // Ensure  stored reply is equal to expected one
     assert!(matches!(
         reply,
-        Some(reply) if reply == get_reply(ReplyType::Valid, reply_owner_id, parent, editing)
+        Some(reply) if reply == get_reply(reply_owner_id, parent)
     ));
 }
 
-fn ensure_posts_equality(
-    post: Option<Post<Runtime, DefaultInstance>>,
-    editing: bool,
-    locked: bool,
-) {
+fn ensure_posts_equality(post: Option<Post<Runtime, DefaultInstance>>, locked: bool) {
     // Ensure  stored post is equal to expected one
     assert!(matches!(
         post,
-        Some(post) if post == get_post(PostType::Valid, editing, locked)
-    ));
-}
-
-fn ensure_reaction_status(
-    reactions: Option<[bool; REACTIONS_MAX_NUMBER as usize]>,
-    index: ReactionsNumber,
-    status: bool,
-) {
-    // Ensure  reaction status at given index is equal to expected one
-    assert!(matches!(
-        reactions,
-        Some(reactions) if reactions[index as usize] == status
+        Some(post) if post == get_post(locked)
     ));
 }
 
@@ -82,14 +65,14 @@ fn post_creation_success() {
         let number_of_events_before_call = System::events().len();
 
         // Create post
-        assert_ok!(create_post(FIRST_OWNER_ORIGIN, PostType::Valid));
+        assert_ok!(create_post(FIRST_OWNER_ORIGIN));
 
         // Check related state after extrinsic performed
 
         // Posts storage updated succesfully
         let post = post_by_id(FIRST_ID);
 
-        ensure_posts_equality(post, false, false);
+        ensure_posts_equality(post, false);
 
         // Post counter, related to given blog updated succesfully
         assert_eq!(post_count(), 1);
@@ -106,7 +89,7 @@ fn post_creation_blog_ownership_error() {
         // Events number before tested call
         let number_of_events_before_call = System::events().len();
 
-        let create_result = create_post(SECOND_OWNER_ORIGIN, PostType::Valid);
+        let create_result = create_post(SECOND_OWNER_ORIGIN);
 
         // Check if related runtime storage left unchanged
         // assert!(post_storage_unchanged(FIRST_ID, FIRST_ID));
@@ -120,46 +103,6 @@ fn post_creation_blog_ownership_error() {
     })
 }
 
-#[test]
-fn post_creation_title_too_long() {
-    ExtBuilder::default().build().execute_with(|| {
-        // Events number before tested call
-        let number_of_events_before_call = System::events().len();
-
-        let create_result = create_post(FIRST_OWNER_ORIGIN, PostType::PostTitleInvalid);
-
-        // Check if related runtime storage left unchanged
-        //assert!(post_storage_unchanged(FIRST_ID, FIRST_ID));
-
-        // Failure checked
-        assert_failure(
-            create_result,
-            Error::PostTitleTooLong,
-            number_of_events_before_call,
-        );
-    })
-}
-
-#[test]
-fn post_creation_body_too_long() {
-    ExtBuilder::default().build().execute_with(|| {
-        // Events number before tested call
-        let number_of_events_before_call = System::events().len();
-
-        let create_result = create_post(FIRST_OWNER_ORIGIN, PostType::PostBodyInvalid);
-
-        // Check if related runtime storage left unchanged
-        //assert!(post_storage_unchanged(FIRST_ID, FIRST_ID));
-
-        // Failure checked
-        assert_failure(
-            create_result,
-            Error::PostBodyTooLong,
-            number_of_events_before_call,
-        );
-    })
-}
-
 #[test]
 fn post_creation_limit_reached() {
     ExtBuilder::default().build().execute_with(|| {
@@ -167,7 +110,7 @@ fn post_creation_limit_reached() {
             // Events number before tested call
             let number_of_events_before_call = System::events().len();
 
-            if let Err(create_post_err) = create_post(FIRST_OWNER_ORIGIN, PostType::Valid) {
+            if let Err(create_post_err) = create_post(FIRST_OWNER_ORIGIN) {
                 // Post counter & post max number contraint equality checked
                 assert_eq!(post_count(), PostsMaxNumber::get());
 
@@ -186,7 +129,7 @@ fn post_creation_limit_reached() {
 #[test]
 fn post_locking_success() {
     ExtBuilder::default().build().execute_with(|| {
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         let post = post_by_id(FIRST_ID).unwrap();
 
@@ -231,7 +174,7 @@ fn post_locking_post_not_found() {
 #[test]
 fn post_locking_ownership_error() {
     ExtBuilder::default().build().execute_with(|| {
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         // Events number before tested call
         let number_of_events_before_call = System::events().len();
@@ -257,7 +200,7 @@ fn post_locking_ownership_error() {
 #[test]
 fn post_unlocking_success() {
     ExtBuilder::default().build().execute_with(|| {
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         // Lock post firstly
         lock_post(FIRST_OWNER_ORIGIN, FIRST_ID).unwrap();
@@ -287,7 +230,7 @@ fn post_unlocking_success() {
 #[test]
 fn post_unlocking_owner_not_found() {
     ExtBuilder::default().build().execute_with(|| {
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         // Lock post firstly
         lock_post(FIRST_OWNER_ORIGIN, FIRST_ID).unwrap();
@@ -333,7 +276,7 @@ fn post_unlocking_post_not_found() {
 #[test]
 fn post_unlocking_ownership_error() {
     ExtBuilder::default().build().execute_with(|| {
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         // Lock post firstly
         lock_post(FIRST_OWNER_ORIGIN, FIRST_ID).unwrap();
@@ -362,17 +305,17 @@ fn post_unlocking_ownership_error() {
 fn post_editing_success() {
     ExtBuilder::default().build().execute_with(|| {
         // Create blog for future posts
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         // Events number before tested call
         let number_of_events_before_call = System::events().len();
 
-        assert_ok!(edit_post(FIRST_OWNER_ORIGIN, FIRST_ID, PostType::Valid));
+        assert_ok!(edit_post(FIRST_OWNER_ORIGIN, FIRST_ID));
 
         // Post after editing checked
         let post_after_editing = post_by_id(FIRST_ID);
 
-        ensure_posts_equality(post_after_editing, true, false);
+        ensure_posts_equality(post_after_editing, false);
 
         let post_edited_event = TestEvent::crate_DefaultInstance(RawEvent::PostEdited(FIRST_ID));
 
@@ -384,18 +327,18 @@ fn post_editing_success() {
 #[test]
 fn post_editing_ownership_error() {
     ExtBuilder::default().build().execute_with(|| {
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         // Events number before tested call
         let number_of_events_before_call = System::events().len();
 
-        let edit_result = edit_post(SECOND_OWNER_ORIGIN, FIRST_ID, PostType::Valid);
+        let edit_result = edit_post(SECOND_OWNER_ORIGIN, FIRST_ID);
 
         // Remain unedited
         let post = post_by_id(FIRST_ID);
 
         // Compare with default unedited post
-        ensure_posts_equality(post, false, false);
+        ensure_posts_equality(post, false);
 
         // Failure checked
         assert_failure(
@@ -413,7 +356,7 @@ fn post_editing_post_not_found() {
         let number_of_events_before_call = System::events().len();
 
         // Try to unlock not existing post
-        let edit_result = edit_post(FIRST_OWNER_ORIGIN, FIRST_ID, PostType::Valid);
+        let edit_result = edit_post(FIRST_OWNER_ORIGIN, FIRST_ID);
 
         // Failure checked
         assert_failure(
@@ -427,7 +370,7 @@ fn post_editing_post_not_found() {
 #[test]
 fn post_editing_post_locked_error() {
     ExtBuilder::default().build().execute_with(|| {
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         // Lock post to make all related data immutable
         lock_post(FIRST_OWNER_ORIGIN, FIRST_ID).unwrap();
@@ -435,13 +378,13 @@ fn post_editing_post_locked_error() {
         // Events number before tested call
         let number_of_events_before_call = System::events().len();
 
-        let edit_result = edit_post(FIRST_OWNER_ORIGIN, FIRST_ID, PostType::Valid);
+        let edit_result = edit_post(FIRST_OWNER_ORIGIN, FIRST_ID);
 
         // Remain unedited
         let post = post_by_id(FIRST_ID);
 
         // Compare with default unedited locked post
-        ensure_posts_equality(post, false, true);
+        ensure_posts_equality(post, true);
 
         // Failure checked
         assert_failure(
@@ -452,74 +395,19 @@ fn post_editing_post_locked_error() {
     })
 }
 
-#[test]
-fn post_editing_title_invalid_error() {
-    ExtBuilder::default().build().execute_with(|| {
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
-
-        // Events number before tested call
-        let number_of_events_before_call = System::events().len();
-
-        let edit_result = edit_post(FIRST_OWNER_ORIGIN, FIRST_ID, PostType::PostTitleInvalid);
-
-        // Remain unedited
-        let post = post_by_id(FIRST_ID);
-
-        // Compare with default unedited post
-        ensure_posts_equality(post, false, false);
-
-        // Failure checked
-        assert_failure(
-            edit_result,
-            Error::PostTitleTooLong,
-            number_of_events_before_call,
-        );
-    })
-}
-
-#[test]
-fn post_editing_body_invalid_error() {
-    ExtBuilder::default().build().execute_with(|| {
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
-
-        // Events number before tested call
-        let number_of_events_before_call = System::events().len();
-
-        let edit_result = edit_post(FIRST_OWNER_ORIGIN, FIRST_ID, PostType::PostBodyInvalid);
-
-        // Remain unedited
-        let post = post_by_id(FIRST_ID);
-
-        // Compare with default unedited post
-        ensure_posts_equality(post, false, false);
-
-        // Failure checked
-        assert_failure(
-            edit_result,
-            Error::PostBodyTooLong,
-            number_of_events_before_call,
-        );
-    })
-}
-
 // Replies
 #[test]
 fn reply_creation_success() {
     ExtBuilder::default().build().execute_with(|| {
         // Create post for future replies
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         let reply_owner_id = ensure_signed(Origin::signed(SECOND_OWNER_ORIGIN)).unwrap();
 
         // Events number before tested call
         let number_of_events_before_call = System::events().len();
 
-        assert_ok!(create_reply(
-            SECOND_OWNER_ORIGIN,
-            FIRST_ID,
-            None,
-            ReplyType::Valid
-        ));
+        assert_ok!(create_reply(SECOND_OWNER_ORIGIN, FIRST_ID, None));
 
         // Check reply related state after extrinsic performed
 
@@ -528,7 +416,7 @@ fn reply_creation_success() {
         // Replies related storage updated succesfully
         let reply = reply_by_id(FIRST_ID, FIRST_ID);
 
-        ensure_replies_equality(reply, reply_owner_id, ParentId::Post(FIRST_ID), false);
+        ensure_replies_equality(reply, reply_owner_id, ParentId::Post(FIRST_ID));
 
         // Overall post replies count
         assert_eq!(post.replies_count(), 1);
@@ -547,26 +435,16 @@ fn reply_creation_success() {
 fn direct_reply_creation_success() {
     ExtBuilder::default().build().execute_with(|| {
         // Create post for future replies
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
         let direct_reply_owner_id = ensure_signed(Origin::signed(SECOND_OWNER_ORIGIN)).unwrap();
 
-        assert_ok!(create_reply(
-            FIRST_OWNER_ORIGIN,
-            FIRST_ID,
-            None,
-            ReplyType::Valid
-        ));
+        assert_ok!(create_reply(FIRST_OWNER_ORIGIN, FIRST_ID, None));
 
         // Events number before tested call
         let number_of_events_before_call = System::events().len();
 
         // Create reply for direct replying
-        assert_ok!(create_reply(
-            SECOND_OWNER_ORIGIN,
-            FIRST_ID,
-            Some(FIRST_ID),
-            ReplyType::Valid
-        ));
+        assert_ok!(create_reply(SECOND_OWNER_ORIGIN, FIRST_ID, Some(FIRST_ID)));
 
         // Check reply related state after extrinsic performed
 
@@ -592,7 +470,7 @@ fn direct_reply_creation_success() {
 #[test]
 fn reply_creation_post_locked_error() {
     ExtBuilder::default().build().execute_with(|| {
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         // Lock post to make all related data immutable
         lock_post(FIRST_OWNER_ORIGIN, FIRST_ID).unwrap();
@@ -600,8 +478,7 @@ fn reply_creation_post_locked_error() {
         // Events number before tested call
         let number_of_events_before_call = System::events().len();
 
-        let reply_creation_result =
-            create_reply(SECOND_OWNER_ORIGIN, FIRST_ID, None, ReplyType::Valid);
+        let reply_creation_result = create_reply(SECOND_OWNER_ORIGIN, FIRST_ID, None);
 
         // Check if related replies storage left unchanged
         assert!(replies_storage_unchanged(FIRST_ID, FIRST_ID));
@@ -615,37 +492,13 @@ fn reply_creation_post_locked_error() {
     })
 }
 
-#[test]
-fn reply_creation_text_too_long_error() {
-    ExtBuilder::default().build().execute_with(|| {
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
-
-        // Events number before tested call
-        let number_of_events_before_call = System::events().len();
-
-        let reply_creation_result =
-            create_reply(SECOND_OWNER_ORIGIN, FIRST_ID, None, ReplyType::Invalid);
-
-        // Check if related replies storage left unchanged
-        assert!(replies_storage_unchanged(FIRST_ID, FIRST_ID));
-
-        // Failure checked
-        assert_failure(
-            reply_creation_result,
-            Error::ReplyTextTooLong,
-            number_of_events_before_call,
-        );
-    })
-}
-
 #[test]
 fn reply_creation_post_not_found() {
     ExtBuilder::default().build().execute_with(|| {
         // Events number before tested call
         let number_of_events_before_call = System::events().len();
 
-        let reply_creation_result =
-            create_reply(SECOND_OWNER_ORIGIN, FIRST_ID, None, ReplyType::Valid);
+        let reply_creation_result = create_reply(SECOND_OWNER_ORIGIN, FIRST_ID, None);
 
         // Check if related replies storage left unchanged
         assert!(replies_storage_unchanged(FIRST_ID, FIRST_ID));
@@ -663,13 +516,11 @@ fn reply_creation_post_not_found() {
 fn reply_creation_limit_reached() {
     ExtBuilder::default().build().execute_with(|| {
         // Create post for future replies
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
         loop {
             // Events number before tested call
             let number_of_events_before_call = System::events().len();
-            if let Err(create_reply_err) =
-                create_reply(FIRST_OWNER_ORIGIN, FIRST_ID, None, ReplyType::Valid)
-            {
+            if let Err(create_reply_err) = create_reply(FIRST_OWNER_ORIGIN, FIRST_ID, None) {
                 let post = post_by_id(FIRST_ID).unwrap();
 
                 // Root post replies counter & reply root max number contraint equality checked
@@ -691,18 +542,13 @@ fn reply_creation_limit_reached() {
 fn direct_reply_creation_reply_not_found() {
     ExtBuilder::default().build().execute_with(|| {
         // Create post for future replies
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         // Events number before tested call
         let number_of_events_before_call = System::events().len();
 
         // Attempt to create direct reply for nonexistent reply
-        let reply_creation_result = create_reply(
-            SECOND_OWNER_ORIGIN,
-            FIRST_ID,
-            Some(FIRST_ID),
-            ReplyType::Valid,
-        );
+        let reply_creation_result = create_reply(SECOND_OWNER_ORIGIN, FIRST_ID, Some(FIRST_ID));
 
         // Check if related runtime storage left unchanged
         assert!(replies_storage_unchanged(FIRST_ID, SECOND_ID));
@@ -720,21 +566,21 @@ fn direct_reply_creation_reply_not_found() {
 fn reply_editing_success() {
     ExtBuilder::default().build().execute_with(|| {
         // Create post for future replies
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         let reply_owner_id = ensure_signed(Origin::signed(SECOND_OWNER_ORIGIN)).unwrap();
 
-        create_reply(SECOND_OWNER_ORIGIN, FIRST_ID, None, ReplyType::Valid).unwrap();
+        create_reply(SECOND_OWNER_ORIGIN, FIRST_ID, None).unwrap();
 
         // Events number before tested call
         let number_of_events_before_call = System::events().len();
 
-        edit_reply(SECOND_OWNER_ORIGIN, FIRST_ID, FIRST_ID, ReplyType::Valid).unwrap();
+        edit_reply(SECOND_OWNER_ORIGIN, FIRST_ID, FIRST_ID).unwrap();
 
         // Reply after editing checked
         let reply = reply_by_id(FIRST_ID, FIRST_ID);
 
-        ensure_replies_equality(reply, reply_owner_id, ParentId::Post(FIRST_ID), true);
+        ensure_replies_equality(reply, reply_owner_id, ParentId::Post(FIRST_ID));
 
         // Event checked
         let reply_edited_event = get_test_event(RawEvent::ReplyEdited(FIRST_ID, FIRST_ID));
@@ -746,11 +592,11 @@ fn reply_editing_success() {
 fn reply_editing_post_locked_error() {
     ExtBuilder::default().build().execute_with(|| {
         // Create post for future replies
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         let reply_owner_id = ensure_signed(Origin::signed(SECOND_OWNER_ORIGIN)).unwrap();
 
-        create_reply(SECOND_OWNER_ORIGIN, FIRST_ID, None, ReplyType::Valid).unwrap();
+        create_reply(SECOND_OWNER_ORIGIN, FIRST_ID, None).unwrap();
 
         // Lock blog to make all related data immutable
         lock_post(FIRST_OWNER_ORIGIN, FIRST_ID).unwrap();
@@ -758,14 +604,13 @@ fn reply_editing_post_locked_error() {
         // Events number before tested call
         let number_of_events_before_call = System::events().len();
 
-        let reply_editing_result =
-            edit_reply(SECOND_OWNER_ORIGIN, FIRST_ID, FIRST_ID, ReplyType::Valid);
+        let reply_editing_result = edit_reply(SECOND_OWNER_ORIGIN, FIRST_ID, FIRST_ID);
 
         // Reply after editing checked
         let reply = reply_by_id(FIRST_ID, FIRST_ID);
 
         // Compare with default unedited reply
-        ensure_replies_equality(reply, reply_owner_id, ParentId::Post(FIRST_ID), true);
+        ensure_replies_equality(reply, reply_owner_id, ParentId::Post(FIRST_ID));
 
         // Failure checked
         assert_failure(
@@ -780,13 +625,12 @@ fn reply_editing_post_locked_error() {
 fn reply_editing_not_found() {
     ExtBuilder::default().build().execute_with(|| {
         // Create post for future replies
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         // Events number before tested call
         let number_of_events_before_call = System::events().len();
 
-        let reply_editing_result =
-            edit_reply(SECOND_OWNER_ORIGIN, FIRST_ID, FIRST_ID, ReplyType::Valid);
+        let reply_editing_result = edit_reply(SECOND_OWNER_ORIGIN, FIRST_ID, FIRST_ID);
 
         // Failure checked
         assert_failure(
@@ -797,58 +641,26 @@ fn reply_editing_not_found() {
     })
 }
 
-#[test]
-fn reply_editing_text_too_long_error() {
-    ExtBuilder::default().build().execute_with(|| {
-        // Create post for future replies
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
-
-        let reply_owner_id = ensure_signed(Origin::signed(SECOND_OWNER_ORIGIN)).unwrap();
-
-        create_reply(SECOND_OWNER_ORIGIN, FIRST_ID, None, ReplyType::Valid).unwrap();
-
-        // Events number before tested call
-        let number_of_events_before_call = System::events().len();
-
-        let reply_editing_result =
-            edit_reply(SECOND_OWNER_ORIGIN, FIRST_ID, FIRST_ID, ReplyType::Invalid);
-
-        // Reply after editing checked
-        let reply = reply_by_id(FIRST_ID, FIRST_ID);
-
-        // Compare with default unedited reply
-        ensure_replies_equality(reply, reply_owner_id, ParentId::Post(FIRST_ID), true);
-
-        // Failure checked
-        assert_failure(
-            reply_editing_result,
-            Error::ReplyTextTooLong,
-            number_of_events_before_call,
-        );
-    })
-}
-
 #[test]
 fn reply_editing_ownership_error() {
     ExtBuilder::default().build().execute_with(|| {
         // Create post for future replies
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         let reply_owner_id = ensure_signed(Origin::signed(SECOND_OWNER_ORIGIN)).unwrap();
 
-        create_reply(SECOND_OWNER_ORIGIN, FIRST_ID, None, ReplyType::Valid).unwrap();
+        create_reply(SECOND_OWNER_ORIGIN, FIRST_ID, None).unwrap();
 
         // Events number before tested call
         let number_of_events_before_call = System::events().len();
 
-        let reply_editing_result =
-            edit_reply(FIRST_OWNER_ORIGIN, FIRST_ID, FIRST_ID, ReplyType::Valid);
+        let reply_editing_result = edit_reply(FIRST_OWNER_ORIGIN, FIRST_ID, FIRST_ID);
 
         // Reply after editing checked
         let reply = reply_by_id(FIRST_ID, FIRST_ID);
 
         // Compare with default unedited reply
-        ensure_replies_equality(reply, reply_owner_id, ParentId::Post(FIRST_ID), true);
+        ensure_replies_equality(reply, reply_owner_id, ParentId::Post(FIRST_ID));
 
         // Failure checked
         assert_failure(
@@ -865,7 +677,7 @@ fn reaction_success() {
 
     ExtBuilder::default().build().execute_with(|| {
         // Create post for future replies
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         let reaction_owner_id = ensure_signed(Origin::signed(SECOND_OWNER_ORIGIN)).unwrap();
 
@@ -875,26 +687,19 @@ fn reaction_success() {
         // React to a post
         assert_ok!(react(SECOND_OWNER_ORIGIN, REACTION_INDEX, FIRST_ID, None,));
 
-        // Reactions state after react to post extrinsic performed
-        ensure_reaction_status(
-            get_reactions(FIRST_ID, None, reaction_owner_id),
-            REACTION_INDEX,
-            true,
-        );
-
         // Event checked
         let post_reactions_updated_event = get_test_event(RawEvent::PostReactionsUpdated(
             reaction_owner_id,
             FIRST_ID,
             REACTION_INDEX,
-            true,
         ));
+
         assert_event_success(
             post_reactions_updated_event,
             number_of_events_before_call + 1,
         );
 
-        create_reply(FIRST_OWNER_ORIGIN, FIRST_ID, None, ReplyType::Valid).unwrap();
+        create_reply(FIRST_OWNER_ORIGIN, FIRST_ID, None).unwrap();
 
         // Events number before tested call
         let number_of_events_before_call = System::events().len();
@@ -909,20 +714,12 @@ fn reaction_success() {
             ));
         }
 
-        // Reactions state after react to reply extrinsic performed
-        ensure_reaction_status(
-            get_reactions(FIRST_ID, Some(FIRST_ID), reaction_owner_id),
-            REACTION_INDEX,
-            false,
-        );
-
         // Event checked
         let reply_reactions_updated_event = get_test_event(RawEvent::ReplyReactionsUpdated(
             reaction_owner_id,
             FIRST_ID,
             FIRST_ID,
             REACTION_INDEX,
-            false,
         ));
         assert_event_success(
             reply_reactions_updated_event,
@@ -936,7 +733,7 @@ fn reaction_invalid_index() {
     const REACTIONS_MAX_NUMBER: ReactionsNumber = 5;
 
     ExtBuilder::default().build().execute_with(|| {
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         // Events number before tested call
         let number_of_events_before_call = System::events().len();
@@ -945,11 +742,6 @@ fn reaction_invalid_index() {
         // Should fail, as last index in configured reactions array is less by one than array length
         let react_result = react(SECOND_OWNER_ORIGIN, REACTIONS_MAX_NUMBER, FIRST_ID, None);
 
-        let reaction_owner_id = ensure_signed(Origin::signed(SECOND_OWNER_ORIGIN)).unwrap();
-
-        // Ensure  reactions related state left unchanged
-        assert!(get_reactions(FIRST_ID, None, reaction_owner_id).is_none());
-
         // Failure checked
         assert_failure(
             react_result,
@@ -970,11 +762,6 @@ fn reaction_post_not_found() {
         // React to a post
         let react_result = react(SECOND_OWNER_ORIGIN, REACTION_INDEX, FIRST_ID, None);
 
-        let reaction_owner_id = ensure_signed(Origin::signed(SECOND_OWNER_ORIGIN)).unwrap();
-
-        // Ensure  reactions related state left unchanged
-        assert!(get_reactions(FIRST_ID, None, reaction_owner_id).is_none());
-
         // Failure checked
         assert_failure(
             react_result,
@@ -989,7 +776,7 @@ fn reaction_reply_not_found() {
     const REACTION_INDEX: ReactionsNumber = 4;
 
     ExtBuilder::default().build().execute_with(|| {
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         // Events number before tested call
         let number_of_events_before_call = System::events().len();
@@ -1002,11 +789,6 @@ fn reaction_reply_not_found() {
             Some(FIRST_ID),
         );
 
-        let reaction_owner_id = ensure_signed(Origin::signed(SECOND_OWNER_ORIGIN)).unwrap();
-
-        // Ensure  reactions related state left unchanged
-        assert!(get_reactions(FIRST_ID, Some(FIRST_ID), reaction_owner_id).is_none());
-
         // Failure checked
         assert_failure(
             react_result,
@@ -1021,7 +803,7 @@ fn reaction_post_locked_error() {
     const REACTION_INDEX: ReactionsNumber = 4;
 
     ExtBuilder::default().build().execute_with(|| {
-        create_post(FIRST_OWNER_ORIGIN, PostType::Valid).unwrap();
+        create_post(FIRST_OWNER_ORIGIN).unwrap();
 
         // Lock block to forbid mutations
         lock_post(FIRST_OWNER_ORIGIN, FIRST_ID).unwrap();
@@ -1032,11 +814,6 @@ fn reaction_post_locked_error() {
         // React to a post
         let react_result = react(SECOND_OWNER_ORIGIN, REACTION_INDEX, FIRST_ID, None);
 
-        let reaction_owner_id = ensure_signed(Origin::signed(SECOND_OWNER_ORIGIN)).unwrap();
-
-        // Ensure  reactions related state left unchanged
-        assert!(get_reactions(FIRST_ID, None, reaction_owner_id).is_none());
-
         // Failure checked
         assert_failure(
             react_result,