Browse Source

runtime: events: add all extrinsic parameters to events

This commit includes the events for the pallets:
* constitution
* council
* forum
* membership
* proposals/discussion
* proposals/engine
* referendum
* working-group
conectado 4 years ago
parent
commit
205e3d247e

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

@@ -29,7 +29,7 @@ pub trait Trait: frame_system::Trait {
         + Copy
         + MaybeSerialize
         + Ord
-        + PartialEq;
+        + Eq;
 
     /// Describes the common type for the working group members (workers).
     type ActorId: Parameter

+ 1 - 1
runtime-modules/constitution/src/benchmarking.rs

@@ -36,7 +36,7 @@ benchmarks! {
             };
 
             assert_eq!(Module::<T>::constitution(), constitution_info);
-            assert_last_event::<T>(Event::ConstutionAmended(hash).into());
+            assert_last_event::<T>(Event::ConstutionAmended(hash, text).into());
     }
 }
 

+ 3 - 2
runtime-modules/constitution/src/lib.rs

@@ -56,7 +56,8 @@ decl_event! {
         /// Emits on constitution amendment.
         /// Parameters:
         /// - constitution text hash
-        ConstutionAmended(Vec<u8>),
+        /// - constitution text
+        ConstutionAmended(Vec<u8>, Vec<u8>),
     }
 }
 
@@ -87,7 +88,7 @@ decl_module! {
 
             Constitution::put(constitution);
 
-            Self::deposit_event(Event::ConstutionAmended(hash));
+            Self::deposit_event(Event::ConstutionAmended(hash, constitution_text));
         }
     }
 }

+ 3 - 2
runtime-modules/constitution/src/tests/mod.rs

@@ -92,10 +92,11 @@ fn amend_contitution_succeeds() {
         let hashed = <Test as frame_system::Trait>::Hashing::hash(&text);
         let hash = hashed.as_ref().to_vec();
 
-        let amend_constitution_fixture = AmendConstitutionFixture::default().with_text(text);
+        let amend_constitution_fixture =
+            AmendConstitutionFixture::default().with_text(text.clone());
         amend_constitution_fixture.call_and_assert(Ok(()));
 
-        EventFixture::assert_last_crate_event(Event::ConstutionAmended(hash));
+        EventFixture::assert_last_crate_event(Event::ConstutionAmended(hash, text));
     });
 }
 

+ 6 - 1
runtime-modules/council/src/benchmarking.rs

@@ -655,7 +655,12 @@ benchmarks! {
         );
 
         assert_last_event::<T>(
-            RawEvent::NewCandidate(member_id, T::MinCandidateStake::get()).into()
+            RawEvent::NewCandidate(
+                member_id,
+                account_id.clone(),
+                account_id.clone(),
+                T::MinCandidateStake::get()
+            ).into()
         );
     }
 

+ 12 - 3
runtime-modules/council/src/lib.rs

@@ -341,7 +341,7 @@ decl_event! {
         VotingPeriodStarted(u64),
 
         /// New candidate announced
-        NewCandidate(MemberId, Balance),
+        NewCandidate(MemberId, AccountId, AccountId, Balance),
 
         /// New council was elected and appointed
         NewCouncilElected(Vec<MemberId>),
@@ -530,7 +530,11 @@ decl_module! {
 
             // prepare candidate
             let candidate =
-                Self::prepare_new_candidate(staking_account_id, reward_account_id, stake);
+                Self::prepare_new_candidate(
+                    staking_account_id.clone(),
+                    reward_account_id.clone(),
+                    stake
+                );
 
             //
             // == MUTATION SAFE ==
@@ -543,7 +547,12 @@ decl_module! {
             Mutations::<T>::announce_candidacy(&stage_data, &membership_id, &candidate, &stake);
 
             // emit event
-            Self::deposit_event(RawEvent::NewCandidate(membership_id, stake));
+            Self::deposit_event(RawEvent::NewCandidate(
+                    membership_id,
+                    staking_account_id,
+                    reward_account_id,
+                    stake
+                ));
 
             Ok(())
         }

+ 8 - 3
runtime-modules/council/src/mock.rs

@@ -989,8 +989,8 @@ where
             Module::<T>::announce_candidacy(
                 InstanceMockUtils::<T>::mock_origin(origin),
                 member_id,
-                staking_account_id,
-                reward_account_id,
+                staking_account_id.clone(),
+                reward_account_id.clone(),
                 stake
             ),
             expected_result,
@@ -1005,7 +1005,12 @@ where
                 .last()
                 .unwrap()
                 .event,
-            TestEvent::event_mod(RawEvent::NewCandidate(member_id.into(), stake.into())),
+            TestEvent::event_mod(RawEvent::NewCandidate(
+                member_id.into(),
+                staking_account_id.into(),
+                reward_account_id.into(),
+                stake.into()
+            )),
         );
     }
 

+ 177 - 24
runtime-modules/forum/src/benchmarking.rs

@@ -422,7 +422,14 @@ benchmarks! {
                     parent_category.num_direct_subcategories + 1
                 );
             }
-            assert_last_event::<T>(RawEvent::CategoryCreated(category_id).into());
+            assert_last_event::<T>(
+                RawEvent::CategoryCreated(
+                    category_id,
+                    parent_category_id,
+                    title,
+                    description
+                ).into()
+            );
     }
 
     update_category_membership_of_moderator_new{
@@ -541,7 +548,13 @@ benchmarks! {
         };
 
         assert_eq!(Module::<T>::category_by_id(category_id), new_category);
-        assert_last_event::<T>(RawEvent::CategoryUpdated(category_id, new_archival_status).into());
+        assert_last_event::<T>(
+            RawEvent::CategoryUpdated(
+                category_id,
+                new_archival_status,
+                PrivilegedActor::Lead
+            ).into()
+        );
     }
 
     update_category_archival_status_moderator{
@@ -580,7 +593,13 @@ benchmarks! {
         };
 
         assert_eq!(Module::<T>::category_by_id(category_id), new_category);
-        assert_last_event::<T>(RawEvent::CategoryUpdated(category_id, new_archival_status).into());
+        assert_last_event::<T>(
+            RawEvent::CategoryUpdated(
+                category_id,
+                new_archival_status,
+                PrivilegedActor::Moderator(moderator_id)
+            ).into()
+        );
     }
 
     delete_category_lead {
@@ -622,7 +641,9 @@ benchmarks! {
         // Ensure category removed successfully
         assert!(!<CategoryById<T>>::contains_key(category_id));
 
-        assert_last_event::<T>(RawEvent::CategoryDeleted(category_id).into());
+        assert_last_event::<T>(
+            RawEvent::CategoryDeleted(category_id, PrivilegedActor::Lead).into()
+        );
     }
 
     delete_category_moderator {
@@ -666,7 +687,9 @@ benchmarks! {
         // Ensure category removed successfully
         assert!(!<CategoryById<T>>::contains_key(category_id));
 
-        assert_last_event::<T>(RawEvent::CategoryDeleted(category_id).into());
+        assert_last_event::<T>(
+            RawEvent::CategoryDeleted(category_id, PrivilegedActor::Moderator(moderator_id)).into()
+        );
     }
 
     create_thread {
@@ -715,7 +738,7 @@ benchmarks! {
             title_hash: T::calculate_hash(&title),
             author_id: forum_user_id.saturated_into(),
             archived: false,
-            poll,
+            poll: poll.clone(),
             // initial posts number
             num_direct_posts: 1,
         };
@@ -732,7 +755,16 @@ benchmarks! {
         assert_eq!(Module::<T>::post_by_id(next_thread_id, next_post_id), new_post);
         assert_eq!(Module::<T>::next_post_id(), next_post_id + T::PostId::one());
 
-        assert_last_event::<T>(RawEvent::ThreadCreated(next_thread_id).into());
+        assert_last_event::<T>(
+            RawEvent::ThreadCreated(
+                next_thread_id,
+                forum_user_id.saturated_into(),
+                category_id,
+                title,
+                text,
+                poll,
+            ).into()
+        );
     }
 
     edit_thread_title {
@@ -762,7 +794,14 @@ benchmarks! {
         thread.title_hash = T::calculate_hash(&text);
         assert_eq!(Module::<T>::thread_by_id(category_id, thread_id), thread);
 
-        assert_last_event::<T>(RawEvent::ThreadTitleUpdated(thread_id).into());
+        assert_last_event::<T>(
+            RawEvent::ThreadTitleUpdated(
+                thread_id,
+                forum_user_id.saturated_into(),
+                category_id,
+                text
+            ).into()
+        );
     }
 
     update_thread_archival_status_lead {
@@ -787,7 +826,14 @@ benchmarks! {
 
         assert_eq!(Module::<T>::thread_by_id(category_id, thread_id), thread);
 
-        assert_last_event::<T>(RawEvent::ThreadUpdated(thread_id, new_archival_status).into());
+        assert_last_event::<T>(
+            RawEvent::ThreadUpdated(
+                thread_id,
+                new_archival_status,
+                PrivilegedActor::Lead,
+                category_id
+            ).into()
+        );
     }
 
     update_thread_archival_status_moderator {
@@ -823,7 +869,14 @@ benchmarks! {
 
         assert_eq!(Module::<T>::thread_by_id(category_id, thread_id), thread);
 
-        assert_last_event::<T>(RawEvent::ThreadUpdated(thread_id, new_archival_status).into());
+        assert_last_event::<T>(
+            RawEvent::ThreadUpdated(
+                thread_id,
+                new_archival_status,
+                PrivilegedActor::Moderator(moderator_id),
+                category_id
+            ).into()
+        );
     }
 
     delete_thread_lead {
@@ -864,7 +917,13 @@ benchmarks! {
         assert!(!<ThreadById<T>>::contains_key(category_id, thread_id));
         assert_eq!(<PostById<T>>::iter_prefix_values(thread_id).count(), 0);
 
-        assert_last_event::<T>(RawEvent::ThreadDeleted(thread_id).into());
+        assert_last_event::<T>(
+            RawEvent::ThreadDeleted(
+                thread_id,
+                PrivilegedActor::Lead,
+                category_id
+            ).into()
+        );
     }
 
     delete_thread_moderator {
@@ -912,7 +971,13 @@ benchmarks! {
         assert!(!<ThreadById<T>>::contains_key(category_id, thread_id));
         assert_eq!(<PostById<T>>::iter_prefix_values(thread_id).count(), 0);
 
-        assert_last_event::<T>(RawEvent::ThreadDeleted(thread_id).into());
+        assert_last_event::<T>(
+            RawEvent::ThreadDeleted(
+                thread_id,
+                PrivilegedActor::Moderator(moderator_id),
+                category_id
+            ).into()
+        );
     }
 
     move_thread_to_category_lead {
@@ -967,7 +1032,14 @@ benchmarks! {
         assert!(!<ThreadById<T>>::contains_key(category_id, thread_id));
         assert_eq!(Module::<T>::thread_by_id(new_category_id, thread_id), thread);
 
-        assert_last_event::<T>(RawEvent::ThreadMoved(thread_id, new_category_id).into());
+        assert_last_event::<T>(
+            RawEvent::ThreadMoved(
+                thread_id,
+                new_category_id,
+                PrivilegedActor::Lead,
+                category_id
+            ).into()
+        );
     }
 
     move_thread_to_category_moderator {
@@ -1034,7 +1106,14 @@ benchmarks! {
         assert!(!<ThreadById<T>>::contains_key(category_id, thread_id));
         assert_eq!(Module::<T>::thread_by_id(new_category_id, thread_id), thread);
 
-        assert_last_event::<T>(RawEvent::ThreadMoved(thread_id, new_category_id).into());
+        assert_last_event::<T>(
+            RawEvent::ThreadMoved(
+                thread_id,
+                new_category_id,
+                PrivilegedActor::Moderator(moderator_id),
+                category_id
+            ).into()
+        );
     }
 
     vote_on_poll {
@@ -1083,7 +1162,14 @@ benchmarks! {
 
         assert_eq!(Module::<T>::thread_by_id(category_id, thread_id), thread);
 
-        assert_last_event::<T>(RawEvent::VoteOnPoll(thread_id, j - 1).into());
+        assert_last_event::<T>(
+            RawEvent::VoteOnPoll(
+                thread_id,
+                j - 1,
+                forum_user_id.saturated_into(),
+                category_id
+            ).into()
+        );
     }
 
     moderate_thread_lead {
@@ -1130,7 +1216,14 @@ benchmarks! {
         assert!(!<ThreadById<T>>::contains_key(category_id, thread_id));
         assert_eq!(<PostById<T>>::iter_prefix_values(thread_id).count(), 0);
 
-        assert_last_event::<T>(RawEvent::ThreadModerated(thread_id, rationale).into());
+        assert_last_event::<T>(
+            RawEvent::ThreadModerated(
+                thread_id,
+                rationale,
+                PrivilegedActor::Lead,
+                category_id
+            ).into()
+        );
     }
 
     moderate_thread_moderator {
@@ -1184,7 +1277,14 @@ benchmarks! {
         assert!(!<ThreadById<T>>::contains_key(category_id, thread_id));
         assert_eq!(<PostById<T>>::iter_prefix_values(thread_id).count(), 0);
 
-        assert_last_event::<T>(RawEvent::ThreadModerated(thread_id, rationale).into());
+        assert_last_event::<T>(
+            RawEvent::ThreadModerated(
+                thread_id,
+                rationale,
+                PrivilegedActor::Moderator(moderator_id),
+                category_id
+            ).into()
+        );
     }
 
     add_post {
@@ -1226,7 +1326,15 @@ benchmarks! {
         assert_eq!(Module::<T>::post_by_id(thread_id, post_id), new_post);
         assert_eq!(Module::<T>::next_post_id(), post_id + T::PostId::one());
 
-        assert_last_event::<T>(RawEvent::PostAdded(post_id).into());
+        assert_last_event::<T>(
+            RawEvent::PostAdded(
+                post_id,
+                forum_user_id.saturated_into(),
+                category_id,
+                thread_id,
+                text
+            ).into()
+        );
     }
 
     react_post {
@@ -1258,7 +1366,15 @@ benchmarks! {
 
     }: _ (RawOrigin::Signed(caller_id), forum_user_id.saturated_into(), category_id, thread_id, post_id, react)
     verify {
-        assert_last_event::<T>(RawEvent::PostReacted(forum_user_id.saturated_into(), post_id, react).into());
+        assert_last_event::<T>(
+            RawEvent::PostReacted(
+                forum_user_id.saturated_into(),
+                post_id,
+                react,
+                category_id,
+                thread_id
+            ).into()
+        );
     }
 
     edit_post_text {
@@ -1298,7 +1414,16 @@ benchmarks! {
         post.text_hash = T::calculate_hash(&new_text);
         assert_eq!(Module::<T>::post_by_id(thread_id, post_id), post);
 
-        assert_last_event::<T>(RawEvent::PostTextUpdated(post_id).into());
+        assert_last_event::<T>(
+            RawEvent::PostTextUpdated(
+                post_id,
+                forum_user_id.saturated_into(),
+                category_id,
+                thread_id,
+                post_id,
+                new_text
+            ).into()
+        );
 
     }
 
@@ -1338,7 +1463,15 @@ benchmarks! {
         assert_eq!(Module::<T>::thread_by_id(category_id, thread_id), thread);
         assert!(!<PostById<T>>::contains_key(thread_id, post_id));
 
-        assert_last_event::<T>(RawEvent::PostModerated(post_id, rationale).into());
+        assert_last_event::<T>(
+            RawEvent::PostModerated(
+                post_id,
+                rationale,
+                PrivilegedActor::Lead,
+                category_id,
+                thread_id
+            ).into()
+        );
     }
 
     moderate_post_moderator {
@@ -1384,7 +1517,15 @@ benchmarks! {
         assert_eq!(Module::<T>::thread_by_id(category_id, thread_id), thread);
         assert!(!<PostById<T>>::contains_key(thread_id, post_id));
 
-        assert_last_event::<T>(RawEvent::PostModerated(post_id, rationale).into());
+        assert_last_event::<T>(
+            RawEvent::PostModerated(
+                post_id,
+                rationale,
+                PrivilegedActor::Moderator(moderator_id),
+                category_id,
+                thread_id
+            ).into()
+        );
     }
 
     set_stickied_threads_lead {
@@ -1421,7 +1562,13 @@ benchmarks! {
         category.sticky_thread_ids = stickied_ids;
         assert_eq!(Module::<T>::category_by_id(category_id), category);
 
-        assert_last_event::<T>(RawEvent::CategoryStickyThreadUpdate(category_id, category.sticky_thread_ids).into());
+        assert_last_event::<T>(
+            RawEvent::CategoryStickyThreadUpdate(
+                category_id,
+                category.sticky_thread_ids,
+                PrivilegedActor::Lead
+            ).into()
+        );
     }
 
     set_stickied_threads_moderator {
@@ -1465,7 +1612,13 @@ benchmarks! {
         category.sticky_thread_ids = stickied_ids;
         assert_eq!(Module::<T>::category_by_id(category_id), category);
 
-        assert_last_event::<T>(RawEvent::CategoryStickyThreadUpdate(category_id, category.sticky_thread_ids).into());
+        assert_last_event::<T>(
+            RawEvent::CategoryStickyThreadUpdate(
+                category_id,
+                category.sticky_thread_ids,
+                PrivilegedActor::Moderator(moderator_id)
+            ).into()
+        );
     }
 }
 

+ 87 - 32
runtime-modules/forum/src/lib.rs

@@ -415,54 +415,56 @@ decl_event!(
         <T as Trait>::PostId,
         ForumUserId = ForumUserId<T>,
         <T as Trait>::PostReactionId,
+        PrivilegedActor = PrivilegedActor<T>,
+        Poll = Poll<<T as pallet_timestamp::Trait>::Moment, <T as frame_system::Trait>::Hash>,
     {
         /// A category was introduced
-        CategoryCreated(CategoryId),
+        CategoryCreated(CategoryId, Option<CategoryId>, Vec<u8>, Vec<u8>),
 
         /// A category with given id was updated.
         /// The second argument reflects the new archival status of the category.
-        CategoryUpdated(CategoryId, bool),
+        CategoryUpdated(CategoryId, bool, PrivilegedActor),
 
-        // A category was deleted
-        CategoryDeleted(CategoryId),
+        /// A category was deleted
+        CategoryDeleted(CategoryId, PrivilegedActor),
 
         /// A thread with given id was created.
-        ThreadCreated(ThreadId),
+        ThreadCreated(ThreadId, ForumUserId, CategoryId, Vec<u8>, Vec<u8>, Option<Poll>),
 
         /// A thread with given id was moderated.
-        ThreadModerated(ThreadId, Vec<u8>),
+        ThreadModerated(ThreadId, Vec<u8>, PrivilegedActor, CategoryId),
 
         /// A thread with given id was updated.
         /// The second argument reflects the new archival status of the thread.
-        ThreadUpdated(ThreadId, bool),
+        ThreadUpdated(ThreadId, bool, PrivilegedActor, CategoryId),
 
         /// A thread with given id was moderated.
-        ThreadTitleUpdated(ThreadId),
+        ThreadTitleUpdated(ThreadId, ForumUserId, CategoryId, Vec<u8>),
 
         /// A thread was deleted.
-        ThreadDeleted(ThreadId),
+        ThreadDeleted(ThreadId, PrivilegedActor, CategoryId),
 
         /// A thread was moved to new category
-        ThreadMoved(ThreadId, CategoryId),
+        ThreadMoved(ThreadId, CategoryId, PrivilegedActor, CategoryId),
 
         /// Post with given id was created.
-        PostAdded(PostId),
+        PostAdded(PostId, ForumUserId, CategoryId, ThreadId, Vec<u8>),
 
         /// Post with givne id was moderated.
-        PostModerated(PostId, Vec<u8>),
+        PostModerated(PostId, Vec<u8>, PrivilegedActor, CategoryId, ThreadId),
 
         /// Post with given id had its text updated.
         /// The second argument reflects the number of total edits when the text update occurs.
-        PostTextUpdated(PostId),
+        PostTextUpdated(PostId, ForumUserId, CategoryId, ThreadId, PostId, Vec<u8>),
 
         /// Thumb up post
-        PostReacted(ForumUserId, PostId, PostReactionId),
+        PostReacted(ForumUserId, PostId, PostReactionId, CategoryId, ThreadId),
 
         /// Vote on poll
-        VoteOnPoll(ThreadId, u32),
+        VoteOnPoll(ThreadId, u32, ForumUserId, CategoryId),
 
         /// Sticky thread updated for category
-        CategoryStickyThreadUpdate(CategoryId, Vec<ThreadId>),
+        CategoryStickyThreadUpdate(CategoryId, Vec<ThreadId>, PrivilegedActor),
 
         /// An moderator ability to moderate a category and its subcategories updated
         CategoryMembershipOfModeratorUpdated(ModeratorId, CategoryId, bool),
@@ -578,7 +580,12 @@ decl_module! {
             }
 
             // Generate event
-            Self::deposit_event(RawEvent::CategoryCreated(next_category_id));
+            Self::deposit_event(RawEvent::CategoryCreated(
+                    next_category_id,
+                    parent_category_id,
+                    title,
+                    description
+                ));
 
             Ok(())
         }
@@ -620,7 +627,9 @@ decl_module! {
             <CategoryById<T>>::mutate(category_id, |c| c.archived = new_archival_status);
 
             // Generate event
-            Self::deposit_event(RawEvent::CategoryUpdated(category_id, new_archival_status));
+            Self::deposit_event(
+                RawEvent::CategoryUpdated(category_id, new_archival_status, actor)
+            );
 
             Ok(())
         }
@@ -662,7 +671,7 @@ decl_module! {
             <CategoryCounter<T>>::mutate(|value| *value -= One::one());
 
             // Store the event
-            Self::deposit_event(RawEvent::CategoryDeleted(category_id));
+            Self::deposit_event(RawEvent::CategoryDeleted(category_id, actor));
 
             Ok(())
         }
@@ -728,7 +737,7 @@ decl_module! {
                 title_hash: T::calculate_hash(&title),
                 author_id: forum_user_id,
                 archived: false,
-                poll,
+                poll: poll.clone(),
                 num_direct_posts: 1,
             };
 
@@ -744,7 +753,16 @@ decl_module! {
             <CategoryById<T>>::mutate(category_id, |c| c.num_direct_threads += 1);
 
             // Generate event
-            Self::deposit_event(RawEvent::ThreadCreated(new_thread_id));
+            Self::deposit_event(
+                RawEvent::ThreadCreated(
+                    new_thread_id,
+                    forum_user_id,
+                    category_id,
+                    title,
+                    text,
+                    poll,
+                )
+            );
 
             Ok(())
         }
@@ -781,7 +799,14 @@ decl_module! {
             <ThreadById<T>>::mutate(thread.category_id, thread_id, |thread| thread.title_hash = title_hash);
 
             // Store the event
-            Self::deposit_event(RawEvent::ThreadTitleUpdated(thread_id));
+            Self::deposit_event(
+                RawEvent::ThreadTitleUpdated(
+                    thread_id,
+                    forum_user_id,
+                    category_id,
+                    new_title,
+                )
+            );
 
             Ok(())
         }
@@ -823,7 +848,12 @@ decl_module! {
             <ThreadById<T>>::mutate(thread.category_id, thread_id, |c| c.archived = new_archival_status);
 
             // Generate event
-            Self::deposit_event(RawEvent::ThreadUpdated(thread_id, new_archival_status));
+            Self::deposit_event(RawEvent::ThreadUpdated(
+                    thread_id,
+                    new_archival_status,
+                    actor,
+                    category_id
+                ));
 
             Ok(())
         }
@@ -859,7 +889,11 @@ decl_module! {
             Self::delete_thread_inner(thread.category_id, thread_id);
 
             // Store the event
-            Self::deposit_event(RawEvent::ThreadDeleted(thread_id));
+            Self::deposit_event(RawEvent::ThreadDeleted(
+                    thread_id,
+                    actor,
+                    category_id
+                ));
 
             Ok(())
         }
@@ -898,7 +932,9 @@ decl_module! {
             <CategoryById<T>>::mutate(new_category_id, |category| category.num_direct_threads += 1);
 
             // Store the event
-            Self::deposit_event(RawEvent::ThreadMoved(thread_id, new_category_id));
+            Self::deposit_event(
+                RawEvent::ThreadMoved(thread_id, new_category_id, actor, category_id)
+            );
 
             Ok(())
         }
@@ -967,7 +1003,9 @@ decl_module! {
             });
 
             // Store the event
-            Self::deposit_event(RawEvent::VoteOnPoll(thread_id, index));
+            Self::deposit_event(
+                RawEvent::VoteOnPoll(thread_id, index, forum_user_id, category_id)
+            );
 
             Ok(())
         }
@@ -1012,7 +1050,9 @@ decl_module! {
             Self::delete_thread_inner(thread.category_id, thread_id);
 
             // Generate event
-            Self::deposit_event(RawEvent::ThreadModerated(thread_id, rationale));
+            Self::deposit_event(
+                RawEvent::ThreadModerated(thread_id, rationale, actor, category_id)
+            );
 
             Ok(())
         }
@@ -1057,7 +1097,9 @@ decl_module! {
             <ThreadById<T>>::mutate(thread.category_id, thread_id, |c| c.num_direct_posts += 1);
 
             // Generate event
-            Self::deposit_event(RawEvent::PostAdded(post_id));
+            Self::deposit_event(
+                RawEvent::PostAdded(post_id, forum_user_id, category_id, thread_id, text)
+            );
 
             Ok(())
         }
@@ -1091,7 +1133,9 @@ decl_module! {
             // == MUTATION SAFE ==
             //
 
-            Self::deposit_event(RawEvent::PostReacted(forum_user_id, post_id, react));
+            Self::deposit_event(
+                RawEvent::PostReacted(forum_user_id, post_id, react, category_id, thread_id)
+            );
 
             Ok(())
         }
@@ -1135,7 +1179,14 @@ decl_module! {
             <PostById<T>>::mutate(post.thread_id, post_id, |p| p.text_hash = text_hash);
 
             // Generate event
-            Self::deposit_event(RawEvent::PostTextUpdated(post_id));
+            Self::deposit_event(RawEvent::PostTextUpdated(
+                    post_id,
+                    forum_user_id,
+                    category_id,
+                    thread_id,
+                    post_id,
+                    new_text
+                ));
 
             Ok(())
         }
@@ -1174,7 +1225,9 @@ decl_module! {
             Self::delete_post_inner(category_id, thread_id, post_id);
 
             // Generate event
-            Self::deposit_event(RawEvent::PostModerated(post_id, rationale));
+            Self::deposit_event(
+                RawEvent::PostModerated(post_id, rationale, actor, category_id, thread_id)
+            );
 
             Ok(())
         }
@@ -1215,7 +1268,9 @@ decl_module! {
             <CategoryById<T>>::mutate(category_id, |category| category.sticky_thread_ids = stickied_ids.clone());
 
             // Generate event
-            Self::deposit_event(RawEvent::CategoryStickyThreadUpdate(category_id, stickied_ids));
+            Self::deposit_event(
+                RawEvent::CategoryStickyThreadUpdate(category_id, stickied_ids, actor)
+            );
 
             Ok(())
         }

+ 86 - 19
runtime-modules/forum/src/mock.rs

@@ -614,7 +614,12 @@ pub fn create_category_mock(
         assert_eq!(TestForumModule::next_category_id(), category_id + 1);
         assert_eq!(
             System::events().last().unwrap().event,
-            TestEvent::forum_mod(RawEvent::CategoryCreated(category_id))
+            TestEvent::forum_mod(RawEvent::CategoryCreated(
+                category_id,
+                parent,
+                title.clone(),
+                description.clone()
+            ))
         );
     }
     category_id
@@ -637,8 +642,8 @@ pub fn create_thread_mock(
             mock_origin(origin.clone()),
             forum_user_id,
             category_id,
-            title,
-            text,
+            title.clone(),
+            text.clone(),
             poll_data.clone(),
         ),
         result
@@ -647,7 +652,14 @@ pub fn create_thread_mock(
         assert_eq!(TestForumModule::next_thread_id(), thread_id + 1);
         assert_eq!(
             System::events().last().unwrap().event,
-            TestEvent::forum_mod(RawEvent::ThreadCreated(thread_id))
+            TestEvent::forum_mod(RawEvent::ThreadCreated(
+                thread_id,
+                forum_user_id,
+                category_id,
+                title.clone(),
+                text.clone(),
+                poll_data.clone()
+            ))
         );
     }
     thread_id
@@ -678,7 +690,12 @@ pub fn edit_thread_title_mock(
         );
         assert_eq!(
             System::events().last().unwrap().event,
-            TestEvent::forum_mod(RawEvent::ThreadTitleUpdated(thread_id,))
+            TestEvent::forum_mod(RawEvent::ThreadTitleUpdated(
+                thread_id,
+                forum_user_id,
+                category_id,
+                new_title.clone()
+            ))
         );
     }
     thread_id
@@ -712,7 +729,11 @@ pub fn delete_thread_mock(
         );
         assert_eq!(
             System::events().last().unwrap().event,
-            TestEvent::forum_mod(RawEvent::ThreadDeleted(thread_id))
+            TestEvent::forum_mod(RawEvent::ThreadDeleted(
+                thread_id,
+                PrivilegedActor::Moderator(moderator_id),
+                category_id
+            ))
         );
     }
 }
@@ -742,7 +763,12 @@ pub fn move_thread_mock(
         ),);
         assert_eq!(
             System::events().last().unwrap().event,
-            TestEvent::forum_mod(RawEvent::ThreadMoved(thread_id, new_category_id))
+            TestEvent::forum_mod(RawEvent::ThreadMoved(
+                thread_id,
+                new_category_id,
+                PrivilegedActor::Moderator(moderator_id),
+                category_id
+            ))
         );
     }
 }
@@ -758,7 +784,7 @@ pub fn update_thread_archival_status_mock(
     assert_eq!(
         TestForumModule::update_thread_archival_status(
             mock_origin(origin),
-            actor,
+            actor.clone(),
             category_id,
             thread_id,
             new_archival_status
@@ -768,7 +794,12 @@ pub fn update_thread_archival_status_mock(
     if result.is_ok() {
         assert_eq!(
             System::events().last().unwrap().event,
-            TestEvent::forum_mod(RawEvent::ThreadUpdated(thread_id, new_archival_status))
+            TestEvent::forum_mod(RawEvent::ThreadUpdated(
+                thread_id,
+                new_archival_status,
+                actor,
+                category_id
+            ))
         );
     }
 }
@@ -788,7 +819,7 @@ pub fn create_post_mock(
             forum_user_id,
             category_id,
             thread_id,
-            text
+            text.clone()
         ),
         result
     );
@@ -796,7 +827,13 @@ pub fn create_post_mock(
         assert_eq!(TestForumModule::next_post_id(), post_id + 1);
         assert_eq!(
             System::events().last().unwrap().event,
-            TestEvent::forum_mod(RawEvent::PostAdded(post_id))
+            TestEvent::forum_mod(RawEvent::PostAdded(
+                post_id,
+                forum_user_id,
+                category_id,
+                thread_id,
+                text
+            ))
         );
     };
     post_id
@@ -829,7 +866,14 @@ pub fn edit_post_text_mock(
         );
         assert_eq!(
             System::events().last().unwrap().event,
-            TestEvent::forum_mod(RawEvent::PostTextUpdated(post_id))
+            TestEvent::forum_mod(RawEvent::PostTextUpdated(
+                post_id,
+                forum_user_id,
+                category_id,
+                thread_id,
+                post_id,
+                new_text
+            ))
         );
     }
     post_id
@@ -903,7 +947,12 @@ pub fn vote_on_poll_mock(
         );
         assert_eq!(
             System::events().last().unwrap().event,
-            TestEvent::forum_mod(RawEvent::VoteOnPoll(thread_id, index,))
+            TestEvent::forum_mod(RawEvent::VoteOnPoll(
+                thread_id,
+                index,
+                forum_user_id,
+                category_id
+            ))
         );
     };
     thread_id
@@ -919,7 +968,7 @@ pub fn update_category_archival_status_mock(
     assert_eq!(
         TestForumModule::update_category_archival_status(
             mock_origin(origin),
-            actor,
+            actor.clone(),
             category_id,
             new_archival_status
         ),
@@ -928,7 +977,11 @@ pub fn update_category_archival_status_mock(
     if result.is_ok() {
         assert_eq!(
             System::events().last().unwrap().event,
-            TestEvent::forum_mod(RawEvent::CategoryUpdated(category_id, new_archival_status))
+            TestEvent::forum_mod(RawEvent::CategoryUpdated(
+                category_id,
+                new_archival_status,
+                actor
+            ))
         );
     }
 }
@@ -940,14 +993,14 @@ pub fn delete_category_mock(
     result: DispatchResult,
 ) -> () {
     assert_eq!(
-        TestForumModule::delete_category(mock_origin(origin), moderator_id, category_id),
+        TestForumModule::delete_category(mock_origin(origin), moderator_id.clone(), category_id),
         result,
     );
     if result.is_ok() {
         assert!(!<CategoryById<Runtime>>::contains_key(category_id));
         assert_eq!(
             System::events().last().unwrap().event,
-            TestEvent::forum_mod(RawEvent::CategoryDeleted(category_id))
+            TestEvent::forum_mod(RawEvent::CategoryDeleted(category_id, moderator_id))
         );
     };
 }
@@ -974,7 +1027,12 @@ pub fn moderate_thread_mock(
         assert!(!<ThreadById<Runtime>>::contains_key(category_id, thread_id));
         assert_eq!(
             System::events().last().unwrap().event,
-            TestEvent::forum_mod(RawEvent::ThreadModerated(thread_id, rationale))
+            TestEvent::forum_mod(RawEvent::ThreadModerated(
+                thread_id,
+                rationale,
+                PrivilegedActor::Moderator(moderator_id),
+                category_id
+            ))
         );
     }
     thread_id
@@ -1004,7 +1062,13 @@ pub fn moderate_post_mock(
         assert!(!<PostById<Runtime>>::contains_key(thread_id, post_id));
         assert_eq!(
             System::events().last().unwrap().event,
-            TestEvent::forum_mod(RawEvent::PostModerated(post_id, rationale))
+            TestEvent::forum_mod(RawEvent::PostModerated(
+                post_id,
+                rationale,
+                PrivilegedActor::Moderator(moderator_id),
+                category_id,
+                thread_id
+            ))
         );
     }
 
@@ -1037,6 +1101,7 @@ pub fn set_stickied_threads_mock(
             TestEvent::forum_mod(RawEvent::CategoryStickyThreadUpdate(
                 category_id,
                 stickied_ids.clone(),
+                PrivilegedActor::Moderator(moderator_id)
             ))
         );
     };
@@ -1070,6 +1135,8 @@ pub fn react_post_mock(
                 forum_user_id,
                 post_id,
                 post_reaction_id,
+                category_id,
+                thread_id
             ))
         );
     };

+ 39 - 12
runtime-modules/membership/src/benchmarking.rs

@@ -129,7 +129,7 @@ benchmarks! {
             referrer_id: None,
         };
 
-    }: buy_membership(RawOrigin::Signed(account_id.clone()), params)
+    }: buy_membership(RawOrigin::Signed(account_id.clone()), params.clone())
     verify {
 
         // Ensure membership for given member_id is successfully bought
@@ -152,7 +152,7 @@ benchmarks! {
 
         assert_eq!(MembershipById::<T>::get(member_id), membership);
 
-        assert_last_event::<T>(RawEvent::MembershipBought(member_id).into());
+        assert_last_event::<T>(RawEvent::MembershipBought(member_id, params).into());
     }
 
     buy_membership_with_referrer{
@@ -206,7 +206,7 @@ benchmarks! {
 
         let free_balance = Balances::<T>::free_balance(&account_id);
 
-    }: buy_membership(RawOrigin::Signed(account_id.clone()), params)
+    }: buy_membership(RawOrigin::Signed(account_id.clone()), params.clone())
     verify {
 
         // Ensure membership for given member_id is successfully bought
@@ -232,7 +232,7 @@ benchmarks! {
 
         assert_eq!(MembershipById::<T>::get(second_member_id), membership);
 
-        assert_last_event::<T>(RawEvent::MembershipBought(second_member_id).into());
+        assert_last_event::<T>(RawEvent::MembershipBought(second_member_id, params).into());
     }
 
     update_profile{
@@ -271,9 +271,16 @@ benchmarks! {
 
         assert!(!MemberIdByHandleHash::<T>::contains_key(handle));
 
-        assert_eq!(MemberIdByHandleHash::<T>::get(handle_updated), member_id);
+        assert_eq!(MemberIdByHandleHash::<T>::get(handle_updated.clone()), member_id);
 
-        assert_last_event::<T>(RawEvent::MemberProfileUpdated(member_id).into());
+        assert_last_event::<T>(RawEvent::MemberProfileUpdated(
+                member_id,
+                None,
+                Some(handle_updated),
+                None,
+                None,
+            ).into()
+        );
     }
 
     update_accounts_none{
@@ -312,7 +319,12 @@ benchmarks! {
 
         assert_eq!(MembershipById::<T>::get(member_id), membership);
 
-        assert_last_event::<T>(RawEvent::MemberAccountsUpdated(member_id).into());
+        assert_last_event::<T>(RawEvent::MemberAccountsUpdated(
+                member_id,
+                Some(new_root_account_id),
+                None
+            ).into()
+        );
     }
 
     update_accounts_controller{
@@ -343,7 +355,12 @@ benchmarks! {
 
         assert_eq!(MembershipById::<T>::get(member_id), membership);
 
-        assert_last_event::<T>(RawEvent::MemberAccountsUpdated(member_id).into());
+        assert_last_event::<T>(RawEvent::MemberAccountsUpdated(
+                member_id,
+                None,
+                Some(new_controller_account_id)
+            ).into()
+        );
     }
 
     update_accounts_both{
@@ -376,7 +393,12 @@ benchmarks! {
 
         assert_eq!(MembershipById::<T>::get(member_id), membership);
 
-        assert_last_event::<T>(RawEvent::MemberAccountsUpdated(member_id).into());
+        assert_last_event::<T>(RawEvent::MemberAccountsUpdated(
+                member_id,
+                Some(new_root_account_id),
+                Some(new_controller_account_id),
+            ).into()
+        );
     }
 
     set_referral_cut {
@@ -478,7 +500,7 @@ benchmarks! {
 
         let current_wg_budget = T::WorkingGroup::get_budget();
 
-    }: _(RawOrigin::Signed(account_id.clone()), invite_params)
+    }: _(RawOrigin::Signed(account_id.clone()), invite_params.clone())
 
     verify {
 
@@ -503,7 +525,7 @@ benchmarks! {
 
         assert_eq!(MembershipById::<T>::get(invited_member_id), invited_membership);
 
-        assert_last_event::<T>(RawEvent::MemberInvited(invited_member_id).into());
+        assert_last_event::<T>(RawEvent::MemberInvited(invited_member_id, invite_params).into());
 
     }
 
@@ -559,7 +581,12 @@ benchmarks! {
 
         assert_eq!(MembershipById::<T>::get(member_id), membership);
 
-        assert_last_event::<T>(RawEvent::MemberVerificationStatusUpdated(member_id, is_verified).into());
+        assert_last_event::<T>(RawEvent::MemberVerificationStatusUpdated(
+                member_id,
+                is_verified,
+                leader_id,
+            ).into()
+        );
     }
 
     set_leader_invitation_quota {

+ 48 - 21
runtime-modules/membership/src/lib.rs

@@ -162,7 +162,7 @@ pub struct StakingAccountMemberBinding<MemberId> {
 }
 
 /// Parameters for the buy_membership extrinsic.
-#[derive(Encode, Decode, Default, Clone, PartialEq, Debug)]
+#[derive(Encode, Decode, Default, Clone, PartialEq, Debug, Eq)]
 pub struct BuyMembershipParameters<AccountId, MemberId> {
     /// New member root account.
     pub root_account: AccountId,
@@ -187,7 +187,7 @@ pub struct BuyMembershipParameters<AccountId, MemberId> {
 }
 
 /// Parameters for the invite_member extrinsic.
-#[derive(Encode, Decode, Default, Clone, PartialEq, Debug)]
+#[derive(Encode, Decode, Default, Clone, PartialEq, Debug, Eq)]
 pub struct InviteMembershipParameters<AccountId, MemberId> {
     /// Inviting member id.
     pub inviting_member_id: MemberId,
@@ -301,7 +301,7 @@ decl_storage! {
         build(|config: &GenesisConfig<T>| {
             for member in &config.members {
                 let handle_hash = <Module<T>>::get_handle_hash(
-                    Some(member.handle.clone().into_bytes()),
+                    &Some(member.handle.clone().into_bytes()),
                 ).expect("Importing Member Failed");
 
                 let member_id = <Module<T>>::insert_member(
@@ -323,12 +323,27 @@ decl_event! {
       <T as common::Trait>::MemberId,
       Balance = BalanceOf<T>,
       <T as frame_system::Trait>::AccountId,
+      BuyMembershipParameters = BuyMembershipParameters<
+          <T as frame_system::Trait>::AccountId,
+          <T as common::Trait>::MemberId,
+        >,
+      <T as common::Trait>::ActorId,
+      InviteMembershipParameters = InviteMembershipParameters<
+          <T as frame_system::Trait>::AccountId,
+          <T as common::Trait>::MemberId,
+        >,
     {
-        MemberInvited(MemberId),
-        MembershipBought(MemberId),
-        MemberProfileUpdated(MemberId),
-        MemberAccountsUpdated(MemberId),
-        MemberVerificationStatusUpdated(MemberId, bool),
+        MemberInvited(MemberId, InviteMembershipParameters),
+        MembershipBought(MemberId, BuyMembershipParameters),
+        MemberProfileUpdated(
+            MemberId,
+            Option<Vec<u8>>,
+            Option<Vec<u8>>,
+            Option<Vec<u8>>,
+            Option<Vec<u8>>,
+        ),
+        MemberAccountsUpdated(MemberId, Option<AccountId>, Option<AccountId>),
+        MemberVerificationStatusUpdated(MemberId, bool, ActorId),
         ReferralCutUpdated(Balance),
         InvitesTransferred(MemberId, MemberId, u32),
         MembershipPriceUpdated(Balance),
@@ -377,7 +392,7 @@ decl_module! {
             );
 
             let handle_hash = Self::get_handle_hash(
-                params.handle,
+                &params.handle,
             )?;
 
             let referrer = params
@@ -414,7 +429,7 @@ decl_module! {
             }
 
             // Fire the event.
-            Self::deposit_event(RawEvent::MembershipBought(member_id));
+            Self::deposit_event(RawEvent::MembershipBought(member_id, params));
         }
 
         /// Update member's all or some of name, handle, avatar and about text.
@@ -450,8 +465,8 @@ decl_module! {
 
             let membership = Self::ensure_membership(member_id)?;
 
-            let new_handle_hash = handle
-                .map(|handle| Self::get_handle_hash(Some(handle)))
+            let new_handle_hash = handle.clone()
+                .map(|handle| Self::get_handle_hash(&Some(handle)))
                 .transpose()?;
 
             //
@@ -468,7 +483,13 @@ decl_module! {
 
                 <MemberIdByHandleHash<T>>::insert(new_handle_hash, member_id);
 
-                Self::deposit_event(RawEvent::MemberProfileUpdated(member_id));
+                Self::deposit_event(RawEvent::MemberProfileUpdated(
+                        member_id,
+                        name,
+                        handle,
+                        avatar_uri,
+                        about
+                    ));
             }
         }
 
@@ -504,16 +525,20 @@ decl_module! {
             // == MUTATION SAFE ==
             //
 
-            if let Some(root_account) = new_root_account {
+            if let Some(root_account) = new_root_account.clone() {
                 membership.root_account = root_account;
             }
 
-            if let Some(controller_account) = new_controller_account {
+            if let Some(controller_account) = new_controller_account.clone() {
                 membership.controller_account = controller_account;
             }
 
             <MembershipById<T>>::insert(member_id, membership);
-            Self::deposit_event(RawEvent::MemberAccountsUpdated(member_id));
+            Self::deposit_event(RawEvent::MemberAccountsUpdated(
+                    member_id,
+                    new_root_account,
+                    new_controller_account
+                ));
         }
 
         /// Updates member profile verification status. Requires working group member origin.
@@ -545,7 +570,7 @@ decl_module! {
             });
 
             Self::deposit_event(
-                RawEvent::MemberVerificationStatusUpdated(target_member_id, is_verified)
+                RawEvent::MemberVerificationStatusUpdated(target_member_id, is_verified, worker_id)
             );
         }
 
@@ -649,7 +674,7 @@ decl_module! {
             ensure!(membership.invites > Zero::zero(), Error::<T>::NotEnoughInvites);
 
             let handle_hash = Self::get_handle_hash(
-                params.handle,
+                &params.handle,
             )?;
 
             let current_wg_budget = T::WorkingGroup::get_budget();
@@ -694,7 +719,7 @@ decl_module! {
             );
 
             // Fire the event.
-            Self::deposit_event(RawEvent::MemberInvited(member_id));
+            Self::deposit_event(RawEvent::MemberInvited(member_id, params));
         }
 
         /// Updates membership price. Requires root origin.
@@ -970,9 +995,11 @@ impl<T: Trait> Module<T> {
     }
 
     // Validate handle and return its hash.
-    fn get_handle_hash(handle: Option<Vec<u8>>) -> Result<Vec<u8>, Error<T>> {
+    fn get_handle_hash(handle: &Option<Vec<u8>>) -> Result<Vec<u8>, Error<T>> {
         // Handle is required during registration
-        let handle = handle.ok_or(Error::<T>::HandleMustBeProvidedDuringRegistration)?;
+        let handle = handle
+            .as_ref()
+            .ok_or(Error::<T>::HandleMustBeProvidedDuringRegistration)?;
 
         if handle.is_empty() {
             return Err(Error::<T>::HandleMustBeProvidedDuringRegistration);

+ 13 - 6
runtime-modules/membership/src/tests/fixtures.rs

@@ -92,10 +92,10 @@ pub const BOB_ACCOUNT_ID: u64 = 2;
 pub const ALICE_MEMBER_ID: u64 = 0;
 pub const BOB_MEMBER_ID: u64 = 1;
 
-pub fn buy_default_membership_as_alice() -> DispatchResult {
+pub fn get_alice_membership_parameters() -> BuyMembershipParameters<u64, u64> {
     let info = get_alice_info();
 
-    let params = BuyMembershipParameters {
+    BuyMembershipParameters {
         root_account: ALICE_ACCOUNT_ID,
         controller_account: ALICE_ACCOUNT_ID,
         name: info.name,
@@ -103,8 +103,11 @@ pub fn buy_default_membership_as_alice() -> DispatchResult {
         avatar_uri: info.avatar_uri,
         about: info.about,
         referrer_id: None,
-    };
+    }
+}
 
+pub fn buy_default_membership_as_alice() -> DispatchResult {
+    let params = get_alice_membership_parameters();
     Membership::buy_membership(Origin::signed(ALICE_ACCOUNT_ID), params)
 }
 
@@ -352,8 +355,8 @@ impl Default for InviteMembershipFixture {
 }
 
 impl InviteMembershipFixture {
-    pub fn call_and_assert(&self, expected_result: DispatchResult) {
-        let params = InviteMembershipParameters {
+    pub fn get_invite_membership_parameters(&self) -> InviteMembershipParameters<u64, u64> {
+        InviteMembershipParameters {
             inviting_member_id: self.member_id.clone(),
             root_account: self.root_account.clone(),
             controller_account: self.controller_account.clone(),
@@ -361,7 +364,11 @@ impl InviteMembershipFixture {
             handle: self.handle.clone(),
             avatar_uri: self.avatar_uri.clone(),
             about: self.about.clone(),
-        };
+        }
+    }
+
+    pub fn call_and_assert(&self, expected_result: DispatchResult) {
+        let params = self.get_invite_membership_parameters();
 
         let actual_result = Membership::invite_member(self.origin.clone().into(), params);
 

+ 22 - 7
runtime-modules/membership/src/tests/mod.rs

@@ -39,7 +39,10 @@ fn buy_membership_succeeds() {
         // controller account initially set to primary account
         assert_eq!(profile.controller_account, ALICE_ACCOUNT_ID);
 
-        EventFixture::assert_last_crate_event(Event::<Test>::MembershipBought(next_member_id));
+        EventFixture::assert_last_crate_event(Event::<Test>::MembershipBought(
+            next_member_id,
+            get_alice_membership_parameters(),
+        ));
     });
 }
 
@@ -104,10 +107,10 @@ fn update_profile_succeeds() {
         assert_ok!(Membership::update_profile(
             Origin::signed(ALICE_ACCOUNT_ID),
             next_member_id,
-            info.name,
-            info.handle,
-            info.avatar_uri,
-            info.about,
+            info.name.clone(),
+            info.handle.clone(),
+            info.avatar_uri.clone(),
+            info.about.clone(),
         ));
 
         let profile = get_membership_by_id(next_member_id);
@@ -118,7 +121,13 @@ fn update_profile_succeeds() {
             get_bob_info().handle_hash.unwrap()
         ));
 
-        EventFixture::assert_last_crate_event(Event::<Test>::MemberProfileUpdated(next_member_id));
+        EventFixture::assert_last_crate_event(Event::<Test>::MemberProfileUpdated(
+            next_member_id,
+            info.name,
+            info.handle,
+            info.avatar_uri,
+            info.about,
+        ));
     });
 }
 
@@ -174,6 +183,8 @@ fn update_profile_accounts_succeeds() {
 
         EventFixture::assert_last_crate_event(Event::<Test>::MemberAccountsUpdated(
             ALICE_MEMBER_ID,
+            Some(ALICE_NEW_ACCOUNT_ID),
+            Some(ALICE_NEW_ACCOUNT_ID),
         ));
     });
 }
@@ -216,6 +227,7 @@ fn update_verification_status_succeeds() {
         EventFixture::assert_last_crate_event(Event::<Test>::MemberVerificationStatusUpdated(
             next_member_id,
             true,
+            UpdateMembershipVerificationFixture::default().worker_id,
         ));
     });
 }
@@ -485,7 +497,10 @@ fn invite_member_succeeds() {
         // Invited member balance locked.
         assert_eq!(0, Balances::usable_balance(&profile.controller_account));
 
-        EventFixture::assert_last_crate_event(Event::<Test>::MemberInvited(bob_member_id));
+        EventFixture::assert_last_crate_event(Event::<Test>::MemberInvited(
+            bob_member_id,
+            InviteMembershipFixture::default().get_invite_membership_parameters(),
+        ));
     });
 }
 

+ 16 - 5
runtime-modules/proposals/discussion/src/benchmarking.rs

@@ -253,7 +253,7 @@ benchmarks! {
 
         let text = vec![0u8; j.try_into().unwrap()];
 
-    }: _ (RawOrigin::Signed(account_id), caller_member_id, thread_id, text)
+    }: _ (RawOrigin::Signed(account_id), caller_member_id, thread_id, text.clone())
     verify {
         let post_id = T::PostId::from(1);
 
@@ -264,7 +264,13 @@ benchmarks! {
             "Post author isn't correct"
         );
 
-        assert_last_event::<T>(RawEvent::PostCreated(post_id, caller_member_id).into());
+        assert_last_event::<T>(RawEvent::PostCreated(
+                post_id,
+                caller_member_id,
+                thread_id,
+                text
+            ).into()
+        );
     }
 
     update_post {
@@ -297,9 +303,9 @@ benchmarks! {
         assert!(PostThreadIdByPostId::<T>::contains_key(thread_id, post_id), "Post not created");
 
         let new_text = vec![0u8; j.try_into().unwrap()];
-    }: _ (RawOrigin::Signed(account_id), thread_id, post_id, new_text)
+    }: _ (RawOrigin::Signed(account_id), thread_id, post_id, new_text.clone())
     verify {
-        assert_last_event::<T>(RawEvent::PostUpdated(post_id, caller_member_id).into());
+        assert_last_event::<T>(RawEvent::PostUpdated(post_id, caller_member_id, thread_id, new_text).into());
     }
 
     change_thread_mode {
@@ -338,7 +344,12 @@ benchmarks! {
             "Thread not correctly updated"
         );
 
-        assert_last_event::<T>(RawEvent::ThreadModeChanged(thread_id, mode).into());
+        assert_last_event::<T>(RawEvent::ThreadModeChanged(
+                thread_id,
+                mode,
+                caller_member_id
+            ).into()
+        );
     }
 }
 

+ 8 - 8
runtime-modules/proposals/discussion/src/lib.rs

@@ -90,13 +90,13 @@ decl_event!(
         ThreadCreated(ThreadId, MemberId),
 
         /// Emits on post creation.
-        PostCreated(PostId, MemberId),
+        PostCreated(PostId, MemberId, ThreadId, Vec<u8>),
 
         /// Emits on post update.
-        PostUpdated(PostId, MemberId),
+        PostUpdated(PostId, MemberId, ThreadId, Vec<u8>),
 
         /// Emits on thread mode change.
-        ThreadModeChanged(ThreadId, ThreadMode<MemberId>),
+        ThreadModeChanged(ThreadId, ThreadMode<MemberId>, MemberId),
     }
 );
 
@@ -203,7 +203,7 @@ decl_module! {
             origin,
             post_author_id: MemberId<T>,
             thread_id : T::ThreadId,
-            _text : Vec<u8>
+            text : Vec<u8>
         ) {
             T::AuthorOriginValidator::ensure_member_controller_account_origin(
                 origin.clone(),
@@ -226,7 +226,7 @@ decl_module! {
             let post_id = T::PostId::from(new_post_id);
             <PostThreadIdByPostId<T>>::insert(thread_id, post_id, new_post);
             PostCount::put(next_post_count_value);
-            Self::deposit_event(RawEvent::PostCreated(post_id, post_author_id));
+            Self::deposit_event(RawEvent::PostCreated(post_id, post_author_id, thread_id, text));
        }
 
         /// Updates a post with author origin check. Update attempts number is limited.
@@ -243,7 +243,7 @@ decl_module! {
             origin,
             thread_id: T::ThreadId,
             post_id : T::PostId,
-            _text : Vec<u8>
+            text : Vec<u8>
         ){
             ensure!(<ThreadById<T>>::contains_key(thread_id), Error::<T>::ThreadDoesntExist);
             ensure!(
@@ -260,7 +260,7 @@ decl_module! {
 
             // mutation
 
-            Self::deposit_event(RawEvent::PostUpdated(post_id, post_author_id));
+            Self::deposit_event(RawEvent::PostUpdated(post_id, post_author_id, thread_id, text));
        }
 
         /// Changes thread permission mode.
@@ -312,7 +312,7 @@ decl_module! {
                 thread.mode = mode.clone();
             });
 
-            Self::deposit_event(RawEvent::ThreadModeChanged(thread_id, mode));
+            Self::deposit_event(RawEvent::ThreadModeChanged(thread_id, mode, member_id));
        }
     }
 }

+ 3 - 3
runtime-modules/proposals/discussion/src/tests/mod.rs

@@ -247,8 +247,8 @@ fn update_post_call_succeeds() {
 
         EventFixture::assert_events(vec![
             RawEvent::ThreadCreated(1, 1),
-            RawEvent::PostCreated(1, 1),
-            RawEvent::PostUpdated(1, 1),
+            RawEvent::PostCreated(1, 1, post_fixture.thread_id, post_fixture.text.clone()),
+            RawEvent::PostUpdated(1, 1, post_fixture.thread_id, post_fixture.text.clone()),
         ]);
     });
 }
@@ -395,7 +395,7 @@ fn change_thread_mode_succeeds() {
 
         EventFixture::assert_events(vec![
             RawEvent::ThreadCreated(1, 1),
-            RawEvent::ThreadModeChanged(1, thread_mode),
+            RawEvent::ThreadModeChanged(1, thread_mode, change_thread_mode_fixture.member_id),
         ]);
     });
 }

+ 4 - 3
runtime-modules/proposals/engine/src/benchmarking.rs

@@ -364,12 +364,13 @@ benchmarks! {
         let (council, last_id) = elect_council::<T>(1);
         let (account_voter_id, member_voter_id) = council[0].clone();
         let (_, _, proposal_id) = create_proposal::<T>(last_id + 1, 1, 0, 0);
+        let rationale = vec![0u8; i.try_into().unwrap()];
     }: _ (
             RawOrigin::Signed(account_voter_id),
             member_voter_id,
             proposal_id,
             VoteKind::Approve,
-            vec![0u8; i.try_into().unwrap()]
+            rationale.clone()
         )
     verify {
         assert!(Proposals::<T>::contains_key(proposal_id), "Proposal should still exist");
@@ -394,7 +395,7 @@ benchmarks! {
         );
 
         assert_last_event::<T>(
-            RawEvent::Voted(member_voter_id, proposal_id, VoteKind::Approve).into()
+            RawEvent::Voted(member_voter_id, proposal_id, VoteKind::Approve, rationale).into()
         );
     }
 
@@ -426,7 +427,7 @@ benchmarks! {
         );
 
         assert_last_event::<T>(
-            RawEvent::ProposalDecisionMade(proposal_id, ProposalDecision::Canceled).into()
+            RawEvent::ProposalCancelled(member_id, proposal_id).into()
         );
     }
 

+ 12 - 4
runtime-modules/proposals/engine/src/lib.rs

@@ -280,7 +280,14 @@ decl_event!(
         /// - Voter - member id of a voter.
         /// - Id of a proposal.
         /// - Kind of vote.
-        Voted(MemberId, ProposalId, VoteKind),
+        /// - Rationale.
+        Voted(MemberId, ProposalId, VoteKind, Vec<u8>),
+
+        /// Emits on a proposal being cancelled
+        /// Params:
+        /// - Member Id of the proposer
+        /// - Id of the proposal
+        ProposalCancelled(MemberId, ProposalId),
     }
 );
 
@@ -437,13 +444,13 @@ decl_module! {
         /// - DB:
         ///    - O(1) doesn't depend on the state or paraemters
         /// # </weight>
-        #[weight = WeightInfoEngine::<T>::vote(_rationale.len().saturated_into())]
+        #[weight = WeightInfoEngine::<T>::vote(rationale.len().saturated_into())]
         pub fn vote(
             origin,
             voter_id: MemberId<T>,
             proposal_id: T::ProposalId,
             vote: VoteKind,
-            _rationale: Vec<u8>, // we use it on the query node side.
+            rationale: Vec<u8>, // we use it on the query node side.
         ) {
             T::CouncilOriginValidator::ensure_member_consulate(origin, voter_id)?;
 
@@ -470,7 +477,7 @@ decl_module! {
 
             <Proposals<T>>::insert(proposal_id, proposal);
             <VoteExistsByProposalByVoter<T>>::insert(proposal_id, voter_id, vote.clone());
-            Self::deposit_event(RawEvent::Voted(voter_id, proposal_id, vote));
+            Self::deposit_event(RawEvent::Voted(voter_id, proposal_id, vote, rationale));
         }
 
         /// Cancel a proposal by its original proposer.
@@ -502,6 +509,7 @@ decl_module! {
             //
 
             Self::finalize_proposal(proposal_id, proposal, ProposalDecision::Canceled);
+            Self::deposit_event(RawEvent::ProposalCancelled(proposer_id, proposal_id));
         }
 
         /// Veto a proposal. Must be root.

+ 133 - 49
runtime-modules/proposals/engine/src/tests/mod.rs

@@ -394,10 +394,10 @@ fn proposal_execution_succeeds() {
 
         EventFixture::assert_events(vec![
             RawEvent::ProposalCreated(1, proposal_id),
-            RawEvent::Voted(1, proposal_id, VoteKind::Approve),
-            RawEvent::Voted(2, proposal_id, VoteKind::Approve),
-            RawEvent::Voted(3, proposal_id, VoteKind::Approve),
-            RawEvent::Voted(4, proposal_id, VoteKind::Approve),
+            RawEvent::Voted(1, proposal_id, VoteKind::Approve, Vec::new()),
+            RawEvent::Voted(2, proposal_id, VoteKind::Approve, Vec::new()),
+            RawEvent::Voted(3, proposal_id, VoteKind::Approve, Vec::new()),
+            RawEvent::Voted(4, proposal_id, VoteKind::Approve, Vec::new()),
             RawEvent::ProposalDecisionMade(
                 proposal_id,
                 ProposalDecision::Approved(ApprovedProposalDecision::PendingExecution),
@@ -446,10 +446,10 @@ fn proposal_execution_failed() {
 
         EventFixture::assert_events(vec![
             RawEvent::ProposalCreated(1, proposal_id),
-            RawEvent::Voted(1, proposal_id, VoteKind::Approve),
-            RawEvent::Voted(2, proposal_id, VoteKind::Approve),
-            RawEvent::Voted(3, proposal_id, VoteKind::Approve),
-            RawEvent::Voted(4, proposal_id, VoteKind::Approve),
+            RawEvent::Voted(1, proposal_id, VoteKind::Approve, Vec::new()),
+            RawEvent::Voted(2, proposal_id, VoteKind::Approve, Vec::new()),
+            RawEvent::Voted(3, proposal_id, VoteKind::Approve, Vec::new()),
+            RawEvent::Voted(4, proposal_id, VoteKind::Approve, Vec::new()),
             RawEvent::ProposalDecisionMade(
                 proposal_id,
                 ProposalDecision::Approved(ApprovedProposalDecision::PendingExecution),
@@ -497,10 +497,10 @@ fn voting_results_calculation_succeeds() {
 
         EventFixture::assert_events(vec![
             RawEvent::ProposalCreated(1, proposal_id),
-            RawEvent::Voted(1, proposal_id, VoteKind::Approve),
-            RawEvent::Voted(2, proposal_id, VoteKind::Approve),
-            RawEvent::Voted(3, proposal_id, VoteKind::Reject),
-            RawEvent::Voted(4, proposal_id, VoteKind::Abstain),
+            RawEvent::Voted(1, proposal_id, VoteKind::Approve, Vec::new()),
+            RawEvent::Voted(2, proposal_id, VoteKind::Approve, Vec::new()),
+            RawEvent::Voted(3, proposal_id, VoteKind::Reject, Vec::new()),
+            RawEvent::Voted(4, proposal_id, VoteKind::Abstain, Vec::new()),
             RawEvent::ProposalDecisionMade(
                 proposal_id,
                 ProposalDecision::Approved(ApprovedProposalDecision::PendingExecution),
@@ -632,7 +632,10 @@ fn cancel_proposal_succeeds() {
         let parameters_fixture = ProposalParametersFixture::default();
         let dummy_proposal =
             DummyProposalFixture::default().with_parameters(parameters_fixture.params());
-        let proposal_id = dummy_proposal.create_proposal_and_assert(Ok(1)).unwrap();
+        let proposal_id = dummy_proposal
+            .clone()
+            .create_proposal_and_assert(Ok(1))
+            .unwrap();
 
         // internal active proposal counter check
         assert_eq!(<ActiveProposalCount>::get(), 1);
@@ -645,9 +648,9 @@ fn cancel_proposal_succeeds() {
 
         assert!(!<crate::Proposals<Test>>::contains_key(proposal_id));
 
-        EventFixture::assert_last_crate_event(RawEvent::ProposalDecisionMade(
+        EventFixture::assert_last_crate_event(RawEvent::ProposalCancelled(
+            dummy_proposal.account_id,
             proposal_id,
-            ProposalDecision::Canceled,
         ));
     });
 }
@@ -801,7 +804,10 @@ fn cancel_proposal_event_emitted() {
         run_to_block_and_finalize(1);
 
         let dummy_proposal = DummyProposalFixture::default();
-        let proposal_id = dummy_proposal.create_proposal_and_assert(Ok(1)).unwrap();
+        let proposal_id = dummy_proposal
+            .clone()
+            .create_proposal_and_assert(Ok(1))
+            .unwrap();
 
         let cancel_proposal = CancelProposalFixture::new(proposal_id);
         cancel_proposal.cancel_and_assert(Ok(()));
@@ -809,6 +815,7 @@ fn cancel_proposal_event_emitted() {
         EventFixture::assert_events(vec![
             RawEvent::ProposalCreated(1, proposal_id),
             RawEvent::ProposalDecisionMade(proposal_id, ProposalDecision::Canceled),
+            RawEvent::ProposalCancelled(dummy_proposal.account_id, proposal_id),
         ]);
     });
 }
@@ -827,7 +834,7 @@ fn vote_proposal_event_emitted() {
 
         EventFixture::assert_events(vec![
             RawEvent::ProposalCreated(1, 1),
-            RawEvent::Voted(1, 1, VoteKind::Approve),
+            RawEvent::Voted(1, 1, VoteKind::Approve, Vec::new()),
         ]);
     });
 }
@@ -981,10 +988,30 @@ fn cancel_active_and_pending_execution_proposal_by_runtime() {
         EventFixture::assert_events(vec![
             RawEvent::ProposalCreated(1, pending_execution_proposal_id),
             RawEvent::ProposalCreated(1, active_proposal_id),
-            RawEvent::Voted(1, pending_execution_proposal_id, VoteKind::Approve),
-            RawEvent::Voted(2, pending_execution_proposal_id, VoteKind::Approve),
-            RawEvent::Voted(3, pending_execution_proposal_id, VoteKind::Approve),
-            RawEvent::Voted(4, pending_execution_proposal_id, VoteKind::Approve),
+            RawEvent::Voted(
+                1,
+                pending_execution_proposal_id,
+                VoteKind::Approve,
+                Vec::new(),
+            ),
+            RawEvent::Voted(
+                2,
+                pending_execution_proposal_id,
+                VoteKind::Approve,
+                Vec::new(),
+            ),
+            RawEvent::Voted(
+                3,
+                pending_execution_proposal_id,
+                VoteKind::Approve,
+                Vec::new(),
+            ),
+            RawEvent::Voted(
+                4,
+                pending_execution_proposal_id,
+                VoteKind::Approve,
+                Vec::new(),
+            ),
             RawEvent::ProposalDecisionMade(
                 pending_execution_proposal_id,
                 ProposalDecision::Approved(ApprovedProposalDecision::PendingExecution),
@@ -1055,10 +1082,10 @@ fn cancel_pending_constitutionality_proposal_by_runtime() {
 
         EventFixture::assert_events(vec![
             RawEvent::ProposalCreated(1, proposal_id),
-            RawEvent::Voted(1, proposal_id, VoteKind::Approve),
-            RawEvent::Voted(2, proposal_id, VoteKind::Approve),
-            RawEvent::Voted(3, proposal_id, VoteKind::Approve),
-            RawEvent::Voted(4, proposal_id, VoteKind::Approve),
+            RawEvent::Voted(1, proposal_id, VoteKind::Approve, Vec::new()),
+            RawEvent::Voted(2, proposal_id, VoteKind::Approve, Vec::new()),
+            RawEvent::Voted(3, proposal_id, VoteKind::Approve, Vec::new()),
+            RawEvent::Voted(4, proposal_id, VoteKind::Approve, Vec::new()),
             RawEvent::ProposalDecisionMade(
                 proposal_id,
                 ProposalDecision::Approved(ApprovedProposalDecision::PendingConstitutionality),
@@ -1427,10 +1454,7 @@ fn proposal_cancellation_with_slashes_with_balance_checks_succeeds() {
 
         run_to_block_and_finalize(3);
 
-        EventFixture::assert_last_crate_event(RawEvent::ProposalDecisionMade(
-            proposal_id,
-            ProposalDecision::Canceled,
-        ));
+        EventFixture::assert_last_crate_event(RawEvent::ProposalCancelled(account_id, proposal_id));
 
         let cancellation_fee = CancellationFee::get();
         assert_eq!(
@@ -1775,10 +1799,10 @@ fn proposal_with_pending_constitutionality_succeeds() {
 
         EventFixture::assert_events(vec![
             RawEvent::ProposalCreated(1, proposal_id),
-            RawEvent::Voted(1, proposal_id, VoteKind::Approve),
-            RawEvent::Voted(2, proposal_id, VoteKind::Approve),
-            RawEvent::Voted(3, proposal_id, VoteKind::Approve),
-            RawEvent::Voted(4, proposal_id, VoteKind::Approve),
+            RawEvent::Voted(1, proposal_id, VoteKind::Approve, Vec::new()),
+            RawEvent::Voted(2, proposal_id, VoteKind::Approve, Vec::new()),
+            RawEvent::Voted(3, proposal_id, VoteKind::Approve, Vec::new()),
+            RawEvent::Voted(4, proposal_id, VoteKind::Approve, Vec::new()),
             RawEvent::ProposalDecisionMade(
                 proposal_id,
                 ProposalDecision::Approved(ApprovedProposalDecision::PendingConstitutionality),
@@ -1838,10 +1862,10 @@ fn proposal_with_pending_constitutionality_reactivation_succeeds() {
 
         EventFixture::assert_events(vec![
             RawEvent::ProposalCreated(1, proposal_id),
-            RawEvent::Voted(1, proposal_id, VoteKind::Approve),
-            RawEvent::Voted(2, proposal_id, VoteKind::Approve),
-            RawEvent::Voted(3, proposal_id, VoteKind::Approve),
-            RawEvent::Voted(4, proposal_id, VoteKind::Approve),
+            RawEvent::Voted(1, proposal_id, VoteKind::Approve, Vec::new()),
+            RawEvent::Voted(2, proposal_id, VoteKind::Approve, Vec::new()),
+            RawEvent::Voted(3, proposal_id, VoteKind::Approve, Vec::new()),
+            RawEvent::Voted(4, proposal_id, VoteKind::Approve, Vec::new()),
             RawEvent::ProposalDecisionMade(
                 proposal_id,
                 ProposalDecision::Approved(ApprovedProposalDecision::PendingConstitutionality),
@@ -1936,10 +1960,30 @@ fn proposal_with_pending_constitutionality_execution_succeeds() {
             TestEvent::frame_system(frame_system::RawEvent::NewAccount(1)), // because of token transfer
             TestEvent::balances(balances::RawEvent::Endowed(1, total_balance)), // because of token transfer
             TestEvent::engine(RawEvent::ProposalCreated(1, proposal_id)),
-            TestEvent::engine(RawEvent::Voted(1, proposal_id, VoteKind::Approve)),
-            TestEvent::engine(RawEvent::Voted(2, proposal_id, VoteKind::Approve)),
-            TestEvent::engine(RawEvent::Voted(3, proposal_id, VoteKind::Approve)),
-            TestEvent::engine(RawEvent::Voted(4, proposal_id, VoteKind::Approve)),
+            TestEvent::engine(RawEvent::Voted(
+                1,
+                proposal_id,
+                VoteKind::Approve,
+                Vec::new(),
+            )),
+            TestEvent::engine(RawEvent::Voted(
+                2,
+                proposal_id,
+                VoteKind::Approve,
+                Vec::new(),
+            )),
+            TestEvent::engine(RawEvent::Voted(
+                3,
+                proposal_id,
+                VoteKind::Approve,
+                Vec::new(),
+            )),
+            TestEvent::engine(RawEvent::Voted(
+                4,
+                proposal_id,
+                VoteKind::Approve,
+                Vec::new(),
+            )),
             TestEvent::engine(RawEvent::ProposalDecisionMade(
                 proposal_id,
                 ProposalDecision::Approved(ApprovedProposalDecision::PendingConstitutionality),
@@ -2015,10 +2059,30 @@ fn proposal_with_pending_constitutionality_execution_succeeds() {
             TestEvent::frame_system(frame_system::RawEvent::NewAccount(1)), // because of token transfer
             TestEvent::balances(balances::RawEvent::Endowed(1, total_balance)), // because of token transfer
             TestEvent::engine(RawEvent::ProposalCreated(1, proposal_id)),
-            TestEvent::engine(RawEvent::Voted(1, proposal_id, VoteKind::Approve)),
-            TestEvent::engine(RawEvent::Voted(2, proposal_id, VoteKind::Approve)),
-            TestEvent::engine(RawEvent::Voted(3, proposal_id, VoteKind::Approve)),
-            TestEvent::engine(RawEvent::Voted(4, proposal_id, VoteKind::Approve)),
+            TestEvent::engine(RawEvent::Voted(
+                1,
+                proposal_id,
+                VoteKind::Approve,
+                Vec::new(),
+            )),
+            TestEvent::engine(RawEvent::Voted(
+                2,
+                proposal_id,
+                VoteKind::Approve,
+                Vec::new(),
+            )),
+            TestEvent::engine(RawEvent::Voted(
+                3,
+                proposal_id,
+                VoteKind::Approve,
+                Vec::new(),
+            )),
+            TestEvent::engine(RawEvent::Voted(
+                4,
+                proposal_id,
+                VoteKind::Approve,
+                Vec::new(),
+            )),
             TestEvent::engine(RawEvent::ProposalDecisionMade(
                 proposal_id,
                 ProposalDecision::Approved(ApprovedProposalDecision::PendingConstitutionality),
@@ -2033,10 +2097,30 @@ fn proposal_with_pending_constitutionality_execution_succeeds() {
                 ProposalStatus::Active,
             )),
             // second proposal approval chain
-            TestEvent::engine(RawEvent::Voted(1, proposal_id, VoteKind::Approve)),
-            TestEvent::engine(RawEvent::Voted(2, proposal_id, VoteKind::Approve)),
-            TestEvent::engine(RawEvent::Voted(3, proposal_id, VoteKind::Approve)),
-            TestEvent::engine(RawEvent::Voted(4, proposal_id, VoteKind::Approve)),
+            TestEvent::engine(RawEvent::Voted(
+                1,
+                proposal_id,
+                VoteKind::Approve,
+                Vec::new(),
+            )),
+            TestEvent::engine(RawEvent::Voted(
+                2,
+                proposal_id,
+                VoteKind::Approve,
+                Vec::new(),
+            )),
+            TestEvent::engine(RawEvent::Voted(
+                3,
+                proposal_id,
+                VoteKind::Approve,
+                Vec::new(),
+            )),
+            TestEvent::engine(RawEvent::Voted(
+                4,
+                proposal_id,
+                VoteKind::Approve,
+                Vec::new(),
+            )),
             TestEvent::engine(RawEvent::ProposalDecisionMade(
                 proposal_id,
                 ProposalDecision::Approved(ApprovedProposalDecision::PendingExecution),

+ 8 - 8
runtime-modules/referendum/src/benchmarking.rs

@@ -458,7 +458,7 @@ benchmarks_instance! {
                 vote_option,
                 One::one()
             );
-    }: reveal_vote(RawOrigin::Signed(account_id.clone()), salt, option_id)
+    }: reveal_vote(RawOrigin::Signed(account_id.clone()), salt.clone(), option_id)
     verify {
         let stake = T::MinimumStake::get() + One::one() + One::one();
         let cycle_id = 0;
@@ -493,7 +493,7 @@ benchmarks_instance! {
             "Vote not revealed",
         );
 
-        assert_last_event::<T, I>(RawEvent::VoteRevealed(account_id, option_id).into());
+        assert_last_event::<T, I>(RawEvent::VoteRevealed(account_id, option_id, salt).into());
     }
 
     reveal_vote_space_not_in_winners {
@@ -510,7 +510,7 @@ benchmarks_instance! {
                 vote_option,
                 Zero::zero(),
             );
-    }: reveal_vote(RawOrigin::Signed(account_id.clone()), salt, option_id)
+    }: reveal_vote(RawOrigin::Signed(account_id.clone()), salt.clone(), option_id)
     verify {
         let stake = T::MinimumStake::get() + One::one();
         let cycle_id = 0;
@@ -537,7 +537,7 @@ benchmarks_instance! {
             "Vote not revealed",
         );
 
-        assert_last_event::<T, I>(RawEvent::VoteRevealed(account_id, option_id).into());
+        assert_last_event::<T, I>(RawEvent::VoteRevealed(account_id, option_id, salt).into());
     }
 
     reveal_vote_space_replace_last_winner {
@@ -554,7 +554,7 @@ benchmarks_instance! {
                 vote_option,
                 One::one(),
             );
-    }: reveal_vote(RawOrigin::Signed(account_id.clone()), salt, option_id)
+    }: reveal_vote(RawOrigin::Signed(account_id.clone()), salt.clone(), option_id)
     verify {
         let stake = T::MinimumStake::get() + One::one() + One::one();
         let cycle_id = 0;
@@ -588,7 +588,7 @@ benchmarks_instance! {
             "Vote not revealed",
         );
 
-        assert_last_event::<T, I>(RawEvent::VoteRevealed(account_id, option_id).into());
+        assert_last_event::<T, I>(RawEvent::VoteRevealed(account_id, option_id, salt).into());
     }
 
     reveal_vote_already_existing {
@@ -608,7 +608,7 @@ benchmarks_instance! {
 
         let old_vote_power = intermediate_winners[i as usize].vote_power;
         let new_vote_power = old_vote_power + T::get_option_power(&option_id);
-    }: reveal_vote(RawOrigin::Signed(account_id.clone()), salt, option_id)
+    }: reveal_vote(RawOrigin::Signed(account_id.clone()), salt.clone(), option_id)
     verify {
         let stake = T::MinimumStake::get() + One::one();
         let cycle_id = 0;
@@ -642,7 +642,7 @@ benchmarks_instance! {
             "Vote not revealed",
         );
 
-        assert_last_event::<T, I>(RawEvent::VoteRevealed(account_id, option_id).into());
+        assert_last_event::<T, I>(RawEvent::VoteRevealed(account_id, option_id, salt).into());
     }
 
     release_vote_stake {

+ 2 - 2
runtime-modules/referendum/src/lib.rs

@@ -313,7 +313,7 @@ decl_event! {
         VoteCast(AccountId, Hash, Balance),
 
         /// User revealed his vote
-        VoteRevealed(AccountId, MemberId),
+        VoteRevealed(AccountId, MemberId, Vec<u8>),
 
         /// User released his stake
         StakeReleased(AccountId),
@@ -468,7 +468,7 @@ decl_module! {
             Mutations::<T, I>::reveal_vote(stage_data, &account_id, &vote_option_id, cast_vote)?;
 
             // emit event
-            Self::deposit_event(RawEvent::VoteRevealed(account_id, vote_option_id));
+            Self::deposit_event(RawEvent::VoteRevealed(account_id, vote_option_id, salt));
 
             Ok(())
         }

+ 3 - 2
runtime-modules/referendum/src/mock.rs

@@ -760,7 +760,7 @@ impl InstanceMocks<Runtime, DefaultInstance> {
         assert_eq!(
             Module::<Runtime>::reveal_vote(
                 InstanceMockUtils::<Runtime, DefaultInstance>::mock_origin(origin),
-                salt,
+                salt.clone(),
                 vote_option_index,
             ),
             expected_result,
@@ -778,7 +778,8 @@ impl InstanceMocks<Runtime, DefaultInstance> {
                 .event,
             TestEvent::event_mod_DefaultInstance(RawEvent::VoteRevealed(
                 account_id,
-                vote_option_index
+                vote_option_index,
+                salt
             ))
         );
     }

+ 54 - 23
runtime-modules/working-group/src/benchmarking.rs

@@ -573,14 +573,16 @@ benchmarks_instance! {
             ),
         };
 
-    }: _ (RawOrigin::Signed(lead_account_id.clone()), apply_on_opening_params)
+    }: _ (RawOrigin::Signed(lead_account_id.clone()), apply_on_opening_params.clone())
     verify {
         assert!(
             ApplicationById::<T, I>::contains_key(0),
             "Application not found"
         );
 
-        assert_last_event::<T, I>(RawEvent::AppliedOnOpening(opening_id, Zero::zero()).into());
+        assert_last_event::<T, I>(
+            RawEvent::AppliedOnOpening(apply_on_opening_params, Zero::zero()).into()
+        );
     }
 
     fill_opening_lead {
@@ -596,7 +598,7 @@ benchmarks_instance! {
 
         let mut successful_application_ids: BTreeSet<ApplicationId> = BTreeSet::new();
         successful_application_ids.insert(application_id);
-    }: fill_opening(RawOrigin::Root, opening_id, successful_application_ids)
+    }: fill_opening(RawOrigin::Root, opening_id, successful_application_ids.clone())
     verify {
         assert!(!OpeningById::<T, I>::contains_key(opening_id), "Opening still not filled");
 
@@ -611,8 +613,11 @@ benchmarks_instance! {
         let mut application_id_to_worker_id = BTreeMap::new();
         application_id_to_worker_id.insert(application_id, worker_id);
 
-        assert_last_event::<T, I>(
-            RawEvent::OpeningFilled(opening_id, application_id_to_worker_id).into()
+        assert_last_event::<T, I>(RawEvent::OpeningFilled(
+                opening_id,
+                application_id_to_worker_id,
+                successful_application_ids
+            ).into()
         );
     }
 
@@ -650,8 +655,11 @@ benchmarks_instance! {
             );
         }
 
-        assert_last_event::<T, I>(
-            RawEvent::OpeningFilled(opening_id, application_id_to_worker_id).into()
+        assert_last_event::<T, I>(RawEvent::OpeningFilled(
+                opening_id,
+                application_id_to_worker_id,
+                successful_application_ids
+            ).into()
         );
     }
 
@@ -719,14 +727,21 @@ benchmarks_instance! {
             Some(lead_id.clone())
         );
         let slashing_amount = One::one();
+        let rationale = Some(vec![0u8; i.try_into().unwrap()]);
     }: _(
         RawOrigin::Signed(lead_id.clone()),
         worker_id,
         slashing_amount,
-        Some(vec![0u8; i.try_into().unwrap()])
+        rationale.clone()
     )
     verify {
-        assert_last_event::<T, I>(RawEvent::StakeSlashed(worker_id, slashing_amount).into());
+        assert_last_event::<T, I>(RawEvent::StakeSlashed(
+                worker_id,
+                slashing_amount,
+                slashing_amount,
+                rationale
+            ).into()
+        );
     }
 
     terminate_role_worker {
@@ -743,15 +758,17 @@ benchmarks_instance! {
         // To be able to pay unpaid reward
         let current_budget = BalanceOf::<T>::max_value();
         WorkingGroup::<T, _>::set_budget(RawOrigin::Root.into(), current_budget).unwrap();
+        let penalty = Some(One::one());
+        let rationale = Some(vec![0u8; i.try_into().unwrap()]);
     }: terminate_role(
             RawOrigin::Signed(lead_id.clone()),
             worker_id,
-            Some(One::one()),
-            Some(vec![0u8; i.try_into().unwrap()])
+            penalty,
+            rationale.clone()
         )
     verify {
         assert!(!WorkerById::<T, I>::contains_key(worker_id), "Worker not terminated");
-        assert_last_event::<T, I>(RawEvent::TerminatedWorker(worker_id).into());
+        assert_last_event::<T, I>(RawEvent::TerminatedWorker(worker_id, penalty, rationale).into());
     }
 
     terminate_role_lead {
@@ -762,15 +779,19 @@ benchmarks_instance! {
         let current_budget = BalanceOf::<T>::max_value();
         // To be able to pay unpaid reward
         WorkingGroup::<T, _>::set_budget(RawOrigin::Root.into(), current_budget).unwrap();
+        let penalty = Some(One::one());
+        let rationale = Some(vec![0u8; i.try_into().unwrap()]);
     }: terminate_role(
             RawOrigin::Root,
             lead_worker_id,
-            Some(One::one()),
-            Some(vec![0u8; i.try_into().unwrap()])
+            penalty,
+            rationale.clone()
         )
     verify {
         assert!(!WorkerById::<T, I>::contains_key(lead_worker_id), "Worker not terminated");
-        assert_last_event::<T, I>(RawEvent::TerminatedLeader(lead_worker_id).into());
+        assert_last_event::<T, I>(
+            RawEvent::TerminatedLeader(lead_worker_id, penalty, rationale).into()
+        );
     }
 
     // Regular worker is the worst case scenario since the checks
@@ -826,7 +847,7 @@ benchmarks_instance! {
     }: _ (RawOrigin::Signed(lead_id.clone()), lead_id.clone(), current_budget, None)
     verify {
         assert_eq!(WorkingGroup::<T, I>::budget(), Zero::zero(), "Budget not updated");
-        assert_last_event::<T, I>(RawEvent::BudgetSpending(lead_id, current_budget).into());
+        assert_last_event::<T, I>(RawEvent::BudgetSpending(lead_id, current_budget, None).into());
     }
 
     // Regular worker is the worst case scenario since the checks
@@ -864,7 +885,7 @@ benchmarks_instance! {
 
     }: _ (RawOrigin::Signed(lead_id), status_text.clone())
     verify {
-        let status_text_hash = T::Hashing::hash(&status_text.unwrap()).as_ref().to_vec();
+        let status_text_hash = T::Hashing::hash(&status_text.clone().unwrap()).as_ref().to_vec();
 
         assert_eq!(
             WorkingGroup::<T, I>::status_text_hash(),
@@ -872,7 +893,9 @@ benchmarks_instance! {
             "Status text not updated"
         );
 
-        assert_last_event::<T, I>(RawEvent::StatusTextChanged(status_text_hash).into());
+        assert_last_event::<T, I>(
+            RawEvent::StatusTextChanged(status_text_hash, status_text).into()
+        );
     }
 
     update_reward_account {
@@ -917,14 +940,21 @@ benchmarks_instance! {
 
     }: _(
             RawOrigin::Signed(lead_id),
-            description,
+            description.clone(),
             OpeningType::Regular,
-            Some(stake_policy),
+            Some(stake_policy.clone()),
             Some(BalanceOf::<T>::max_value())
         )
     verify {
         assert!(OpeningById::<T, I>::contains_key(1));
-        assert_last_event::<T, I>(RawEvent::OpeningAdded(1).into());
+        assert_last_event::<T, I>(RawEvent::OpeningAdded(
+                1,
+                description,
+                OpeningType::Regular,
+                Some(stake_policy),
+                Some(BalanceOf::<T>::max_value())
+            ).into()
+        );
     }
 
     // This is always worse than leave_role_immediatly
@@ -941,15 +971,16 @@ benchmarks_instance! {
             RawOrigin::Root.into(),
             BalanceOf::<T>::max_value()
         ).unwrap();
+        let rationale = Some(vec![0u8; i.try_into().unwrap()]);
 
     }: leave_role(
             RawOrigin::Signed(caller_id),
             lead_worker_id,
-            Some(vec![0u8; i.try_into().unwrap()])
+            rationale.clone()
         )
     verify {
         assert!(!WorkerById::<T, I>::contains_key(lead_worker_id), "Worker hasn't left");
-        assert_last_event::<T, I>(RawEvent::WorkerExited(lead_worker_id).into());
+        assert_last_event::<T, I>(RawEvent::WorkerLeft(lead_worker_id, rationale).into());
     }
 
     // Generally speaking this seems to be always the best case scenario

+ 81 - 32
runtime-modules/working-group/src/lib.rs

@@ -130,23 +130,31 @@ decl_event!(
        WorkerId = WorkerId<T>,
        <T as frame_system::Trait>::AccountId,
        Balance = BalanceOf<T>,
+       OpeningType = OpeningType,
+       StakePolicy = StakePolicy<<T as frame_system::Trait>::BlockNumber, BalanceOf<T>>,
+       ApplyOnOpeningParameters = ApplyOnOpeningParameters<T>,
     {
         /// Emits on adding new job opening.
         /// Params:
         /// - Opening id
-        OpeningAdded(OpeningId),
+        /// - Description
+        /// - Opening Type(Lead or Worker)
+        /// - Stake Policy for the opening
+        /// - Reward per block
+        OpeningAdded(OpeningId, Vec<u8>, OpeningType, Option<StakePolicy>, Option<Balance>),
 
         /// Emits on adding the application for the worker opening.
         /// Params:
-        /// - Opening id
+        /// - Opening parameteres
         /// - Application id
-        AppliedOnOpening(OpeningId, ApplicationId),
+        AppliedOnOpening(ApplyOnOpeningParameters, ApplicationId),
 
         /// Emits on filling the job opening.
         /// Params:
         /// - Worker opening id
         /// - Worker application id to the worker id dictionary
-        OpeningFilled(OpeningId, ApplicationIdToWorkerIdMap),
+        /// - Applicationd ids used to fill the opening
+        OpeningFilled(OpeningId, ApplicationIdToWorkerIdMap, BTreeSet<ApplicationId>),
 
         /// Emits on setting the group leader.
         /// Params:
@@ -165,23 +173,36 @@ decl_event!(
         /// Emits on exiting the worker.
         /// Params:
         /// - worker id.
+        /// - Rationale.
         WorkerExited(WorkerId),
 
+        /// Emits when worker is leaving immediatly after extrinsic is called
+        /// Params:
+        /// - Worker id.
+        /// - Rationale.
+        WorkerLeft(WorkerId, Option<Vec<u8>>),
+
         /// Emits on terminating the worker.
         /// Params:
         /// - worker id.
-        TerminatedWorker(WorkerId),
+        /// - Penalty.
+        /// - Rationale.
+        TerminatedWorker(WorkerId, Option<Balance>, Option<Vec<u8>>),
 
         /// Emits on terminating the leader.
         /// Params:
         /// - leader worker id.
-        TerminatedLeader(WorkerId),
+        /// - Penalty.
+        /// - Rationale.
+        TerminatedLeader(WorkerId, Option<Balance>, Option<Vec<u8>>),
 
         /// Emits on slashing the regular worker/lead stake.
         /// Params:
         /// - regular worker/lead id.
         /// - actual slashed balance.
-        StakeSlashed(WorkerId, Balance),
+        /// - Requested slashed balance.
+        /// - Rationale.
+        StakeSlashed(WorkerId, Balance, Balance, Option<Vec<u8>>),
 
         /// Emits on decreasing the regular worker/lead stake.
         /// Params:
@@ -225,12 +246,15 @@ decl_event!(
         /// Emits on updating the status text of the working group.
         /// Params:
         /// - status text hash
-        StatusTextChanged(Vec<u8>),
+        /// - status text
+        StatusTextChanged(Vec<u8>, Option<Vec<u8>>),
 
-        /// Emits on updating the status text of the working group.
+        /// Emits on budget from the working group being spent
         /// Params:
-        /// - status text hash
-        BudgetSpending(AccountId, Balance),
+        /// - Reciever Account Id.
+        /// - Balance spent.
+        /// - Rationale.
+        BudgetSpending(AccountId, Balance, Option<Vec<u8>>),
     }
 );
 
@@ -296,7 +320,11 @@ decl_module! {
             let mut biggest_number_of_processed_workers = leaving_workers.len();
 
             leaving_workers.iter().for_each(|wi| {
-                Self::remove_worker(&wi.worker_id, &wi.worker, RawEvent::WorkerExited(wi.worker_id));
+                Self::remove_worker(
+                    &wi.worker_id,
+                    &wi.worker,
+                    RawEvent::WorkerExited(wi.worker_id)
+                );
             });
 
             if Self::is_reward_block() {
@@ -350,7 +378,7 @@ decl_module! {
                 opening_type,
                 created: Self::current_block(),
                 description_hash: hashed_description.as_ref().to_vec(),
-                stake_policy,
+                stake_policy: stake_policy.clone(),
                 reward_per_block,
             };
 
@@ -361,7 +389,13 @@ decl_module! {
             // Update NextOpeningId
             NextOpeningId::<I>::mutate(|id| *id += <OpeningId as One>::one());
 
-            Self::deposit_event(RawEvent::OpeningAdded(new_opening_id));
+            Self::deposit_event(RawEvent::OpeningAdded(
+                    new_opening_id,
+                    description,
+                    opening_type,
+                    stake_policy,
+                    reward_per_block,
+                ));
         }
 
         /// Apply on a worker opening.
@@ -420,7 +454,7 @@ decl_module! {
             let application = Application::<T>::new(
                 &p.role_account_id,
                 &p.reward_account_id,
-                &p.stake_parameters.map(|sp| sp.staking_account_id),
+                &p.stake_parameters.as_ref().map(|sp| sp.staking_account_id.clone()),
                 &p.member_id,
                 hashed_description.as_ref().to_vec(),
             );
@@ -435,7 +469,7 @@ decl_module! {
             NextApplicationId::<I>::mutate(|id| *id += <ApplicationId as One>::one());
 
             // Trigger the event.
-            Self::deposit_event(RawEvent::AppliedOnOpening(p.opening_id, new_application_id));
+            Self::deposit_event(RawEvent::AppliedOnOpening(p, new_application_id));
         }
 
         /// Fill opening for the regular/lead position.
@@ -496,7 +530,11 @@ decl_module! {
             <OpeningById::<T, I>>::remove(opening_id);
 
             // Trigger event
-            Self::deposit_event(RawEvent::OpeningFilled(opening_id, application_id_to_worker_id));
+            Self::deposit_event(RawEvent::OpeningFilled(
+                    opening_id,
+                    application_id_to_worker_id,
+                    successful_application_ids
+                ));
         }
 
         /// Update the associated role account of the active regular worker/lead.
@@ -549,7 +587,7 @@ decl_module! {
         pub fn leave_role(
             origin,
             worker_id: WorkerId<T>,
-            _rationale: Option<Vec<u8>>
+            rationale: Option<Vec<u8>>
         ) {
             // Ensure there is a signer which matches role account of worker corresponding to provided id.
             let worker = checks::ensure_worker_signed::<T, I>(origin, &worker_id)?;
@@ -562,7 +600,11 @@ decl_module! {
             //
 
             if Self::can_leave_immediately(&worker){
-                Self::remove_worker(&worker_id, &worker, RawEvent::WorkerExited(worker_id));
+                Self::remove_worker(
+                    &worker_id,
+                    &worker,
+                    RawEvent::WorkerLeft(worker_id, rationale)
+                );
             } else{
                 WorkerById::<T, I>::mutate(worker_id, |worker| {
                     worker.started_leaving_at = Some(Self::current_block())
@@ -580,12 +622,12 @@ decl_module! {
         /// - DB:
         ///    - O(1) doesn't depend on the state or parameters
         /// # </weight>
-        #[weight = Module::<T, I>::terminate_role_weight(&_rationale)]
+        #[weight = Module::<T, I>::terminate_role_weight(&rationale)]
         pub fn terminate_role(
             origin,
             worker_id: WorkerId<T>,
             penalty: Option<BalanceOf<T>>,
-            _rationale: Option<Vec<u8>>,
+            rationale: Option<Vec<u8>>,
         ) {
             // Ensure lead is set or it is the council terminating the leader.
             let is_sudo = checks::ensure_origin_for_worker_operation::<T,I>(origin, worker_id)?;
@@ -607,15 +649,15 @@ decl_module! {
 
             if let Some(penalty) = penalty {
                 if let Some(staking_account_id) = worker.staking_account_id.clone() {
-                    Self::slash(worker_id, &staking_account_id, Some(penalty));
+                    Self::slash(worker_id, &staking_account_id, penalty, rationale.clone());
                 }
             }
 
             // Trigger the event
             let event = if is_sudo {
-                RawEvent::TerminatedLeader(worker_id)
+                RawEvent::TerminatedLeader(worker_id, penalty, rationale)
             } else {
-                RawEvent::TerminatedWorker(worker_id)
+                RawEvent::TerminatedWorker(worker_id, penalty, rationale)
             };
 
             Self::remove_worker(&worker_id, &worker, event);
@@ -632,12 +674,12 @@ decl_module! {
         /// - DB:
         ///    - O(1) doesn't depend on the state or parameters
         /// # </weight>
-        #[weight = Module::<T, I>::slash_stake_weight(&_rationale)]
+        #[weight = Module::<T, I>::slash_stake_weight(&rationale)]
         pub fn slash_stake(
             origin,
             worker_id: WorkerId<T>,
             penalty: BalanceOf<T>,
-            _rationale: Option<Vec<u8>>
+            rationale: Option<Vec<u8>>
         ) {
             // Ensure lead is set or it is the council slashing the leader.
             checks::ensure_origin_for_worker_operation::<T,I>(origin, worker_id)?;
@@ -661,7 +703,7 @@ decl_module! {
             //
 
             if let Some(staking_account_id) = worker.staking_account_id {
-                Self::slash(worker_id, &staking_account_id, Some(penalty))
+                Self::slash(worker_id, &staking_account_id, penalty, rationale)
             }
         }
 
@@ -973,6 +1015,7 @@ decl_module! {
             //
 
             let status_text_hash = status_text
+                .as_ref()
                 .map(|status_text| {
                         let hashed = T::Hashing::hash(&status_text);
 
@@ -984,7 +1027,7 @@ decl_module! {
             <StatusTextHash<I>>::put(status_text_hash.clone());
 
             // Trigger event
-            Self::deposit_event(RawEvent::StatusTextChanged(status_text_hash));
+            Self::deposit_event(RawEvent::StatusTextChanged(status_text_hash, status_text));
         }
 
         /// Transfers specified amount to any account.
@@ -1023,7 +1066,7 @@ decl_module! {
             Self::pay_from_budget(&account_id, amount);
 
             // Trigger event
-            Self::deposit_event(RawEvent::BudgetSpending(account_id, amount));
+            Self::deposit_event(RawEvent::BudgetSpending(account_id, amount, rationale));
         }
     }
 }
@@ -1199,10 +1242,16 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
     fn slash(
         worker_id: WorkerId<T>,
         staking_account_id: &T::AccountId,
-        balance: Option<BalanceOf<T>>,
+        balance: BalanceOf<T>,
+        rationale: Option<Vec<u8>>,
     ) {
-        let slashed_balance = T::StakingHandler::slash(staking_account_id, balance);
-        Self::deposit_event(RawEvent::StakeSlashed(worker_id, slashed_balance));
+        let slashed_balance = T::StakingHandler::slash(staking_account_id, Some(balance));
+        Self::deposit_event(RawEvent::StakeSlashed(
+            worker_id,
+            slashed_balance,
+            balance,
+            rationale,
+        ));
     }
 
     // Reward a worker using reward presets and working group budget.

+ 33 - 18
runtime-modules/working-group/src/tests/fixtures.rs

@@ -16,7 +16,18 @@ use crate::{
 pub struct EventFixture;
 impl EventFixture {
     pub fn assert_last_crate_event(
-        expected_raw_event: RawEvent<u64, u64, BTreeMap<u64, u64>, u64, u64, u64, DefaultInstance>,
+        expected_raw_event: RawEvent<
+            u64,
+            u64,
+            BTreeMap<u64, u64>,
+            u64,
+            u64,
+            u64,
+            OpeningType,
+            StakePolicy<u64, u64>,
+            ApplyOnOpeningParameters<Test>,
+            DefaultInstance,
+        >,
     ) {
         let converted_event = TestEvent::crate_DefaultInstance(expected_raw_event);
 
@@ -35,12 +46,12 @@ impl EventFixture {
 }
 
 pub struct AddOpeningFixture {
-    origin: RawOrigin<u64>,
-    description: Vec<u8>,
-    opening_type: OpeningType,
-    starting_block: u64,
-    stake_policy: Option<StakePolicy<u64, u64>>,
-    reward_per_block: Option<u64>,
+    pub origin: RawOrigin<u64>,
+    pub description: Vec<u8>,
+    pub opening_type: OpeningType,
+    pub starting_block: u64,
+    pub stake_policy: Option<StakePolicy<u64, u64>>,
+    pub reward_per_block: Option<u64>,
 }
 
 impl Default for AddOpeningFixture {
@@ -181,18 +192,22 @@ impl ApplyOnOpeningFixture {
         }
     }
 
+    pub fn get_apply_on_opening_parameters(&self) -> ApplyOnOpeningParameters<Test> {
+        ApplyOnOpeningParameters::<Test> {
+            member_id: self.member_id,
+            opening_id: self.opening_id,
+            role_account_id: self.role_account_id,
+            reward_account_id: self.reward_account_id,
+            description: self.description.clone(),
+            stake_parameters: self.stake_parameters.clone(),
+        }
+    }
+
     pub fn call(&self) -> Result<u64, DispatchError> {
         let saved_application_next_id = TestWorkingGroup::next_application_id();
         TestWorkingGroup::apply_on_opening(
             self.origin.clone().into(),
-            ApplyOnOpeningParameters::<Test> {
-                member_id: self.member_id,
-                opening_id: self.opening_id,
-                role_account_id: self.role_account_id,
-                reward_account_id: self.reward_account_id,
-                description: self.description.clone(),
-                stake_parameters: self.stake_parameters.clone(),
-            },
+            self.get_apply_on_opening_parameters(),
         )?;
 
         Ok(saved_application_next_id)
@@ -234,7 +249,7 @@ impl ApplyOnOpeningFixture {
 pub struct FillOpeningFixture {
     origin: RawOrigin<u64>,
     opening_id: u64,
-    successful_application_ids: BTreeSet<u64>,
+    pub successful_application_ids: BTreeSet<u64>,
     role_account_id: u64,
     reward_account_id: u64,
     staking_account_id: Option<u64>,
@@ -541,8 +556,8 @@ impl LeaveWorkerRoleFixture {
 pub struct TerminateWorkerRoleFixture {
     worker_id: u64,
     origin: RawOrigin<u64>,
-    penalty: Option<u64>,
-    rationale: Option<Vec<u8>>,
+    pub penalty: Option<u64>,
+    pub rationale: Option<Vec<u8>>,
 }
 
 impl TerminateWorkerRoleFixture {

+ 40 - 10
runtime-modules/working-group/src/tests/mod.rs

@@ -48,7 +48,13 @@ fn add_opening_succeeded() {
 
         let opening_id = add_opening_fixture.call_and_assert(Ok(()));
 
-        EventFixture::assert_last_crate_event(RawEvent::OpeningAdded(opening_id));
+        EventFixture::assert_last_crate_event(RawEvent::OpeningAdded(
+            opening_id,
+            add_opening_fixture.description,
+            add_opening_fixture.opening_type,
+            add_opening_fixture.stake_policy,
+            add_opening_fixture.reward_per_block,
+        ));
     });
 }
 
@@ -143,7 +149,7 @@ fn apply_on_opening_succeeded() {
         let application_id = apply_on_opening_fixture.call_and_assert(Ok(()));
 
         EventFixture::assert_last_crate_event(RawEvent::AppliedOnOpening(
-            opening_id,
+            apply_on_opening_fixture.get_apply_on_opening_parameters(),
             application_id,
         ));
     });
@@ -230,7 +236,11 @@ fn fill_opening_succeeded() {
         let mut result_map = BTreeMap::new();
         result_map.insert(application_id, worker_id);
 
-        EventFixture::assert_last_crate_event(RawEvent::OpeningFilled(opening_id, result_map));
+        EventFixture::assert_last_crate_event(RawEvent::OpeningFilled(
+            opening_id,
+            result_map,
+            fill_opening_fixture.successful_application_ids,
+        ));
     });
 }
 
@@ -279,7 +289,11 @@ fn fill_opening_succeeded_with_stake() {
         let mut result_map = BTreeMap::new();
         result_map.insert(application_id, worker_id);
 
-        EventFixture::assert_last_crate_event(RawEvent::OpeningFilled(opening_id, result_map));
+        EventFixture::assert_last_crate_event(RawEvent::OpeningFilled(
+            opening_id,
+            result_map,
+            fill_opening_fixture.successful_application_ids,
+        ));
     });
 }
 
@@ -519,7 +533,7 @@ fn leave_worker_role_succeeds() {
 
         leave_worker_role_fixture.call_and_assert(Ok(()));
 
-        EventFixture::assert_last_crate_event(RawEvent::WorkerExited(worker_id));
+        EventFixture::assert_last_crate_event(RawEvent::WorkerLeft(worker_id, None));
     });
 }
 
@@ -675,7 +689,11 @@ fn terminate_worker_role_succeeds() {
 
         terminate_worker_role_fixture.call_and_assert(Ok(()));
 
-        EventFixture::assert_last_crate_event(RawEvent::TerminatedWorker(worker_id));
+        EventFixture::assert_last_crate_event(RawEvent::TerminatedWorker(
+            worker_id,
+            terminate_worker_role_fixture.penalty,
+            terminate_worker_role_fixture.rationale,
+        ));
     });
 }
 
@@ -726,7 +744,11 @@ fn terminate_leader_succeeds() {
 
         terminate_worker_role_fixture.call_and_assert(Ok(()));
 
-        EventFixture::assert_last_crate_event(RawEvent::TerminatedLeader(worker_id));
+        EventFixture::assert_last_crate_event(RawEvent::TerminatedLeader(
+            worker_id,
+            terminate_worker_role_fixture.penalty,
+            terminate_worker_role_fixture.rationale,
+        ));
 
         assert_eq!(TestWorkingGroup::current_lead(), None);
     });
@@ -1207,7 +1229,9 @@ fn slash_worker_stake_succeeds() {
 
         slash_stake_fixture.call_and_assert(Ok(()));
 
-        EventFixture::assert_last_crate_event(RawEvent::StakeSlashed(worker_id, penalty));
+        EventFixture::assert_last_crate_event(RawEvent::StakeSlashed(
+            worker_id, penalty, penalty, None,
+        ));
     });
 }
 
@@ -1264,7 +1288,12 @@ fn slash_leader_stake_succeeds() {
 
         slash_stake_fixture.call_and_assert(Ok(()));
 
-        EventFixture::assert_last_crate_event(RawEvent::StakeSlashed(leader_worker_id, penalty));
+        EventFixture::assert_last_crate_event(RawEvent::StakeSlashed(
+            leader_worker_id,
+            penalty,
+            penalty,
+            None,
+        ));
     });
 }
 
@@ -2272,6 +2301,7 @@ fn set_status_text_succeeded() {
         let expected_hash = <Test as frame_system::Trait>::Hashing::hash(&status_text);
         EventFixture::assert_last_crate_event(RawEvent::StatusTextChanged(
             expected_hash.as_ref().to_vec(),
+            Some(status_text),
         ));
     });
 }
@@ -2305,7 +2335,7 @@ fn spend_from_budget_succeeded() {
             .with_amount(amount)
             .call_and_assert(Ok(()));
 
-        EventFixture::assert_last_crate_event(RawEvent::BudgetSpending(account_id, amount));
+        EventFixture::assert_last_crate_event(RawEvent::BudgetSpending(account_id, amount, None));
     });
 }