Browse Source

Merge pull request #2174 from conectado/add-params-events

Add extrinsic parameters to all events
shamil-gadelshin 4 năm trước cách đây
mục cha
commit
32b194abff
48 tập tin đã thay đổi với 1190 bổ sung398 xóa
  1. 1 1
      runtime-modules/common/src/lib.rs
  2. 1 1
      runtime-modules/constitution/src/benchmarking.rs
  3. 3 2
      runtime-modules/constitution/src/lib.rs
  4. 3 2
      runtime-modules/constitution/src/tests/mod.rs
  5. 138 35
      runtime-modules/content-directory/src/lib.rs
  6. 13 7
      runtime-modules/content-directory/src/mock.rs
  7. 3 0
      runtime-modules/content-directory/src/tests.rs
  8. 7 3
      runtime-modules/content-directory/src/tests/add_class_schema.rs
  9. 9 1
      runtime-modules/content-directory/src/tests/create_class.rs
  10. 5 2
      runtime-modules/content-directory/src/tests/create_entity.rs
  11. 3 1
      runtime-modules/content-directory/src/tests/insert_at_entity_property_vector.rs
  12. 1 0
      runtime-modules/content-directory/src/tests/remove_at_entity_property_vector.rs
  13. 3 2
      runtime-modules/content-directory/src/tests/transaction.rs
  14. 7 3
      runtime-modules/content-directory/src/tests/transfer_entity_ownership.rs
  15. 9 4
      runtime-modules/content-directory/src/tests/update_class_permissions.rs
  16. 12 6
      runtime-modules/content-directory/src/tests/update_entity_creation_voucher.rs
  17. 5 2
      runtime-modules/content-directory/src/tests/update_entity_permissions.rs
  18. 8 4
      runtime-modules/content-directory/src/tests/update_entity_property_values.rs
  19. 6 1
      runtime-modules/council/src/benchmarking.rs
  20. 12 3
      runtime-modules/council/src/lib.rs
  21. 8 3
      runtime-modules/council/src/mock.rs
  22. 177 24
      runtime-modules/forum/src/benchmarking.rs
  23. 86 32
      runtime-modules/forum/src/lib.rs
  24. 85 19
      runtime-modules/forum/src/mock.rs
  25. 39 12
      runtime-modules/membership/src/benchmarking.rs
  26. 48 21
      runtime-modules/membership/src/lib.rs
  27. 13 6
      runtime-modules/membership/src/tests/fixtures.rs
  28. 22 7
      runtime-modules/membership/src/tests/mod.rs
  29. 3 3
      runtime-modules/memo/src/lib.rs
  30. 16 5
      runtime-modules/proposals/discussion/src/benchmarking.rs
  31. 8 8
      runtime-modules/proposals/discussion/src/lib.rs
  32. 3 3
      runtime-modules/proposals/discussion/src/tests/mod.rs
  33. 4 3
      runtime-modules/proposals/engine/src/benchmarking.rs
  34. 12 4
      runtime-modules/proposals/engine/src/lib.rs
  35. 133 49
      runtime-modules/proposals/engine/src/tests/mod.rs
  36. 8 8
      runtime-modules/referendum/src/benchmarking.rs
  37. 2 2
      runtime-modules/referendum/src/lib.rs
  38. 3 2
      runtime-modules/referendum/src/mock.rs
  39. 14 4
      runtime-modules/storage/src/data_directory.rs
  40. 9 2
      runtime-modules/storage/src/data_object_storage_registry.rs
  41. 16 7
      runtime-modules/storage/src/data_object_type_registry.rs
  42. 14 4
      runtime-modules/storage/src/tests/data_directory.rs
  43. 3 1
      runtime-modules/storage/src/tests/data_object_storage_registry.rs
  44. 7 6
      runtime-modules/storage/src/tests/data_object_type_registry.rs
  45. 54 23
      runtime-modules/working-group/src/benchmarking.rs
  46. 81 32
      runtime-modules/working-group/src/lib.rs
  47. 33 18
      runtime-modules/working-group/src/tests/fixtures.rs
  48. 40 10
      runtime-modules/working-group/src/tests/mod.rs

+ 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));
     });
 }
 

+ 138 - 35
runtime-modules/content-directory/src/lib.rs

@@ -534,7 +534,7 @@ decl_module! {
                 <EntityCreationVouchers<T>>::insert(class_id, controller.clone(), entity_creation_voucher.clone());
 
                 // Trigger event
-                Self::deposit_event(RawEvent::EntityCreationVoucherUpdated(controller, entity_creation_voucher))
+                Self::deposit_event(RawEvent::EntityCreationVoucherUpdated(controller, entity_creation_voucher, class_id))
             } else {
                 // Create new EntityCreationVoucher instance with provided maximum_entities_count
                 let entity_creation_voucher = EntityCreationVoucher::new(maximum_entities_count);
@@ -544,7 +544,7 @@ decl_module! {
                 <EntityCreationVouchers<T>>::insert(class_id, controller.clone(), entity_creation_voucher.clone());
 
                 // Trigger event
-                Self::deposit_event(RawEvent::EntityCreationVoucherCreated(controller, entity_creation_voucher));
+                Self::deposit_event(RawEvent::EntityCreationVoucherCreated(controller, entity_creation_voucher, class_id));
             }
 
             Ok(())
@@ -586,7 +586,11 @@ decl_module! {
 
             // Create new Class instance from provided values
             let class = Class::new(
-                class_permissions, name, description, maximum_entities_count, default_entity_creation_voucher_upper_bound
+                class_permissions.clone(),
+                name.clone(),
+                description.clone(),
+                maximum_entities_count,
+                default_entity_creation_voucher_upper_bound
             );
 
             let class_id = Self::next_class_id();
@@ -598,7 +602,14 @@ decl_module! {
             <NextClassId<T>>::mutate(|n| *n += T::ClassId::one());
 
             // Trigger event
-            Self::deposit_event(RawEvent::ClassCreated(class_id));
+            Self::deposit_event(RawEvent::ClassCreated(
+                    class_id,
+                    name,
+                    description,
+                    class_permissions,
+                    maximum_entities_count,
+                    default_entity_creation_voucher_upper_bound
+                ));
             Ok(())
         }
 
@@ -711,7 +722,7 @@ decl_module! {
             // Make updated class_permissions from parameters provided
             let updated_class_permissions = Self::make_updated_class_permissions(
                 &class_permissions, updated_any_member, updated_entity_creation_blocked,
-                updated_all_entity_property_values_locked, updated_maintainers
+                updated_all_entity_property_values_locked, updated_maintainers.clone()
             );
 
             // If class_permissions update has been performed
@@ -735,7 +746,13 @@ decl_module! {
                 });
 
                 // Trigger event
-                Self::deposit_event(RawEvent::ClassPermissionsUpdated(class_id));
+                Self::deposit_event(RawEvent::ClassPermissionsUpdated(
+                        class_id,
+                        updated_any_member,
+                        updated_entity_creation_blocked,
+                        updated_all_entity_property_values_locked,
+                        updated_maintainers
+                    ));
             }
 
             Ok(())
@@ -784,10 +801,17 @@ decl_module! {
             //
 
             // Create `Schema` instance from existing and new property ids
-            let schema = Self::create_class_schema(existing_properties, &class_properties, &new_properties);
+            let schema = Self::create_class_schema(
+                existing_properties.clone(),
+                &class_properties,
+                &new_properties
+            );
 
             // Update class properties after new `Schema` added
-            let updated_class_properties = Self::make_updated_class_properties(class_properties, new_properties);
+            let updated_class_properties = Self::make_updated_class_properties(
+                class_properties,
+                new_properties.clone()
+            );
 
             // Update Class properties and schemas
             <ClassById<T>>::mutate(class_id, |class| {
@@ -796,7 +820,12 @@ decl_module! {
             });
 
             // Trigger event
-            Self::deposit_event(RawEvent::ClassSchemaAdded(class_id, schema_id));
+            Self::deposit_event(RawEvent::ClassSchemaAdded(
+                    class_id,
+                    schema_id,
+                    existing_properties,
+                    new_properties
+                ));
 
             Ok(())
         }
@@ -866,7 +895,11 @@ decl_module! {
                 });
 
                 // Trigger event
-                Self::deposit_event(RawEvent::EntityPermissionsUpdated(entity_id));
+                Self::deposit_event(RawEvent::EntityPermissionsUpdated(
+                        entity_id,
+                        updated_frozen,
+                        updated_referenceable
+                    ));
             }
             Ok(())
         }
@@ -939,7 +972,7 @@ decl_module! {
                 new_values_for_existing_properties, &new_controller
             )?;
 
-            let new_output_property_value_references_with_same_owner_flag_set = Self::make_output_property_values(new_property_value_references_with_same_owner_flag_set);
+            let new_output_property_value_references_with_same_owner_flag_set = Self::make_output_property_values(new_property_value_references_with_same_owner_flag_set.clone());
 
             // Compute StoredPropertyValues, which respective Properties have unique flag set
             // (skip PropertyIds, which respective property values under this Entity are default and non required)
@@ -1006,7 +1039,12 @@ decl_module! {
             };
 
             // Trigger event
-            Self::deposit_event(RawEvent::EntityOwnershipTransfered(entity_id, new_controller, entities_inbound_rcs_delta));
+            Self::deposit_event(RawEvent::EntityOwnershipTransfered(
+                    entity_id,
+                    new_controller,
+                    entities_inbound_rcs_delta,
+                    new_property_value_references_with_same_owner_flag_set
+                ));
 
             Ok(())
         }
@@ -1098,7 +1136,7 @@ decl_module! {
             });
 
             // Trigger event
-            Self::deposit_event(RawEvent::EntityCreated(actor, entity_id));
+            Self::deposit_event(RawEvent::EntityCreated(actor, entity_id, class_id));
             Ok(())
         }
 
@@ -1220,7 +1258,8 @@ decl_module! {
 
             let entity_property_values = entity.get_values();
 
-            let new_output_property_values = Self::make_output_property_values(new_property_values);
+            let new_output_property_values =
+                Self::make_output_property_values(new_property_values.clone());
 
             // Compute updated entity values, after new schema support added
             let entity_values_updated = Self::make_updated_entity_property_values(
@@ -1264,7 +1303,13 @@ decl_module! {
             });
 
             // Trigger event
-            Self::deposit_event(RawEvent::EntitySchemaSupportAdded(actor, entity_id, schema_id, entities_inbound_rcs_delta));
+            Self::deposit_event(RawEvent::EntitySchemaSupportAdded(
+                    actor,
+                    entity_id,
+                    schema_id,
+                    entities_inbound_rcs_delta,
+                    new_property_values
+                ));
             Ok(())
         }
 
@@ -1314,7 +1359,7 @@ decl_module! {
 
             let entity_property_values = entity.get_values();
 
-            let new_output_property_values = Self::make_output_property_values(new_property_values);
+            let new_output_property_values = Self::make_output_property_values(new_property_values.clone());
 
             // Compute StoredPropertyValues, which respective Properties have unique flag set
             // (skip PropertyIds, which respective property values under this Entity are default and non required)
@@ -1361,7 +1406,12 @@ decl_module! {
                 });
 
                 // Trigger event
-                Self::deposit_event(RawEvent::EntityPropertyValuesUpdated(actor, entity_id, entities_inbound_rcs_delta));
+                Self::deposit_event(RawEvent::EntityPropertyValuesUpdated(
+                        actor,
+                        entity_id,
+                        entities_inbound_rcs_delta,
+                        new_property_values
+                    ));
             }
 
             Ok(())
@@ -1540,10 +1590,12 @@ decl_module! {
             });
 
             // Trigger event
+            // Note: The first `nonce + T::Nonce::one()` is the new value for the nonce while
+            // the second `nonce` is the input paramer for the extrinsic
             Self::deposit_event(
                 RawEvent::RemovedAtVectorIndex(
                     actor, entity_id, in_class_schema_property_id, index_in_property_vector,
-                    nonce + T::Nonce::one(), involved_entity_and_side_effect
+                    nonce + T::Nonce::one(), involved_entity_and_side_effect, nonce,
                 )
             );
 
@@ -1599,7 +1651,7 @@ decl_module! {
             // Insert SingleInputPropertyValue at in_class_schema_property_id into property value vector
             // Get VecInputPropertyValue wrapped in InputPropertyValue
             let property_value_vector_updated = Self::insert_at_index_in_property_vector(
-                property_value_vector.clone(), index_in_property_vector, value
+                property_value_vector.clone(), index_in_property_vector, value.clone()
             );
 
             let class_id = entity.get_class_id();
@@ -1653,7 +1705,7 @@ decl_module! {
             Self::deposit_event(
                 RawEvent::InsertedAtVectorIndex(
                     actor, entity_id, in_class_schema_property_id, index_in_property_vector,
-                    nonce + T::Nonce::one(), involved_entity_and_side_effect
+                    nonce + T::Nonce::one(), involved_entity_and_side_effect, value, nonce
                 )
             );
 
@@ -1677,7 +1729,7 @@ decl_module! {
            // Create raw origin
            let raw_origin = origin.into().map_err(|_| Error::<T>::OriginCanNotBeMadeIntoRawOrigin)?;
 
-           for (index, operation_type) in operations.into_iter().enumerate() {
+           for (index, operation_type) in operations.clone().into_iter().enumerate() {
                let origin = T::Origin::from(raw_origin.clone());
                match operation_type {
                    OperationType::CreateEntity(create_entity_operation) => {
@@ -1746,7 +1798,7 @@ decl_module! {
            }
 
            // Trigger event
-           Self::deposit_event(RawEvent::TransactionCompleted(actor));
+           Self::deposit_event(RawEvent::TransactionCompleted(actor, operations));
 
            Ok(())
        }
@@ -2914,6 +2966,11 @@ decl_event!(
         SideEffects = Option<ReferenceCounterSideEffects<T>>,
         SideEffect = Option<(<T as Trait>::EntityId, EntityReferenceCounterSideEffect)>,
         FailedAt = u32,
+        ClassPermissions = ClassPermissions<<T as Trait>::CuratorGroupId>,
+        Property = Property<<T as Trait>::ClassId>,
+        InputPropertyValue = InputPropertyValue<T>,
+        InputValue = InputValue<T>,
+        OperationType = OperationType<T>,
     {
         CuratorGroupAdded(CuratorGroupId),
         CuratorGroupRemoved(CuratorGroupId),
@@ -2922,22 +2979,68 @@ decl_event!(
         CuratorRemoved(CuratorGroupId, CuratorId),
         MaintainerAdded(ClassId, CuratorGroupId),
         MaintainerRemoved(ClassId, CuratorGroupId),
-        EntityCreationVoucherUpdated(EntityController, EntityCreationVoucher),
-        EntityCreationVoucherCreated(EntityController, EntityCreationVoucher),
-        ClassCreated(ClassId),
-        ClassPermissionsUpdated(ClassId),
-        ClassSchemaAdded(ClassId, SchemaId),
+        EntityCreationVoucherUpdated(EntityController, EntityCreationVoucher, ClassId),
+        EntityCreationVoucherCreated(EntityController, EntityCreationVoucher, ClassId),
+        ClassCreated(
+            ClassId,
+            Vec<u8>,
+            Vec<u8>,
+            ClassPermissions,
+            EntityId,
+            EntityId,
+        ),
+        ClassPermissionsUpdated(
+            ClassId,
+            Option<bool>,
+            Option<bool>,
+            Option<bool>,
+            Option<BTreeSet<CuratorGroupId>>,
+        ),
+        ClassSchemaAdded(ClassId, SchemaId, BTreeSet<PropertyId>, Vec<Property>),
         ClassSchemaStatusUpdated(ClassId, SchemaId, Status),
-        EntityPermissionsUpdated(EntityId),
-        EntityCreated(Actor, EntityId),
+        EntityPermissionsUpdated(EntityId, Option<bool>, Option<bool>),
+        EntityCreated(Actor, EntityId, ClassId),
         EntityRemoved(Actor, EntityId),
-        EntitySchemaSupportAdded(Actor, EntityId, SchemaId, SideEffects),
-        EntityPropertyValuesUpdated(Actor, EntityId, SideEffects),
+        EntitySchemaSupportAdded(
+            Actor,
+            EntityId,
+            SchemaId,
+            SideEffects,
+            BTreeMap<PropertyId, InputPropertyValue>,
+        ),
+        EntityPropertyValuesUpdated(
+            Actor,
+            EntityId,
+            SideEffects,
+            BTreeMap<PropertyId, InputPropertyValue>,
+        ),
         VectorCleared(Actor, EntityId, PropertyId, SideEffects),
-        RemovedAtVectorIndex(Actor, EntityId, PropertyId, VecMaxLength, Nonce, SideEffect),
-        InsertedAtVectorIndex(Actor, EntityId, PropertyId, VecMaxLength, Nonce, SideEffect),
-        EntityOwnershipTransfered(EntityId, EntityController, SideEffects),
-        TransactionCompleted(Actor),
+        RemovedAtVectorIndex(
+            Actor,
+            EntityId,
+            PropertyId,
+            VecMaxLength,
+            Nonce,
+            SideEffect,
+            Nonce,
+        ),
+        InsertedAtVectorIndex(
+            Actor,
+            EntityId,
+            PropertyId,
+            VecMaxLength,
+            Nonce,
+            SideEffect,
+            InputValue,
+            Nonce,
+        ),
+        EntityOwnershipTransfered(
+            EntityId,
+            EntityController,
+            SideEffects,
+            BTreeMap<PropertyId, InputPropertyValue>,
+        ),
+        TransactionCompleted(Actor, Vec<OperationType>),
         TransactionFailed(Actor, FailedAt),
     }
 );

+ 13 - 7
runtime-modules/content-directory/src/mock.rs

@@ -465,6 +465,11 @@ type RawTestEvent = RawEvent<
     Option<ReferenceCounterSideEffects<Runtime>>,
     Option<(EntityId, EntityReferenceCounterSideEffect)>,
     u32,
+    ClassPermissions<CuratorGroupId>,
+    Property<ClassId>,
+    InputPropertyValue<Runtime>,
+    InputValue<Runtime>,
+    OperationType<Runtime>,
 >;
 
 pub fn get_test_event(raw_event: RawTestEvent) -> TestEvent {
@@ -476,12 +481,7 @@ pub fn assert_event(tested_event: TestEvent, number_of_events_after_call: usize)
     assert_eq!(System::events().len(), number_of_events_after_call);
 
     // Ensure  last emitted event is equal to expected one
-    assert!(matches!(
-            System::events()
-                .iter()
-                .last(),
-            Some(last_event) if last_event.event == tested_event
-    ));
+    assert_eq!(System::events().iter().last().unwrap().event, tested_event);
 }
 
 pub fn assert_failure(
@@ -557,7 +557,7 @@ pub enum ClassType {
     CuratorGroupDoesNotExist,
 }
 
-pub fn create_simple_class(lead_origin: u64, class_type: ClassType) -> DispatchResult {
+pub fn get_class_for(class_type: ClassType) -> Class<EntityId, ClassId, CuratorGroupId> {
     let mut class = create_class_with_default_permissions();
     match class_type {
         ClassType::Valid => (),
@@ -606,6 +606,12 @@ pub fn create_simple_class(lead_origin: u64, class_type: ClassType) -> DispatchR
             class.get_permissions_mut().set_maintainers(maintainers);
         }
     };
+
+    class
+}
+
+pub fn create_simple_class(lead_origin: u64, class_type: ClassType) -> DispatchResult {
+    let class = get_class_for(class_type);
     TestModule::create_class(
         Origin::signed(lead_origin),
         class.get_name().to_owned(),

+ 3 - 0
runtime-modules/content-directory/src/tests.rs

@@ -118,6 +118,8 @@ pub fn add_entity_schemas_support() -> (
         second_schema_property_values.clone()
     ));
 
+    let second_schema_property_value_original = second_schema_property_values.clone();
+
     // Update supported schemas set and properties of first entity
     *first_entity.get_supported_schemas_mut() =
         BTreeSet::from_iter(vec![FIRST_SCHEMA_ID, SECOND_SCHEMA_ID].into_iter());
@@ -142,6 +144,7 @@ pub fn add_entity_schemas_support() -> (
         FIRST_ENTITY_ID,
         SECOND_SCHEMA_ID,
         Some(side_effects),
+        second_schema_property_value_original,
     ));
 
     // Last event checked

+ 7 - 3
runtime-modules/content-directory/src/tests/add_class_schema.rs

@@ -38,7 +38,7 @@ fn add_class_schema_success() {
         // Ensure class schemas added succesfully
         let mut class = create_class_with_default_permissions();
 
-        class.set_properties(vec![first_property, second_property]);
+        class.set_properties(vec![first_property.clone(), second_property.clone()]);
         *class.get_schemas_mut() = vec![
             Schema::new(BTreeSet::from_iter(vec![FIRST_PROPERTY_ID].into_iter())),
             Schema::new(BTreeSet::from_iter(
@@ -48,8 +48,12 @@ fn add_class_schema_success() {
 
         assert_eq!(class_by_id(FIRST_CLASS_ID), class);
 
-        let class_schema_added_event =
-            get_test_event(RawEvent::ClassSchemaAdded(FIRST_CLASS_ID, SECOND_SCHEMA_ID));
+        let class_schema_added_event = get_test_event(RawEvent::ClassSchemaAdded(
+            FIRST_CLASS_ID,
+            SECOND_SCHEMA_ID,
+            BTreeSet::from_iter(vec![FIRST_PROPERTY_ID].into_iter()),
+            vec![second_property],
+        ));
 
         // Last event checked
         assert_event(class_schema_added_event, number_of_events_before_call + 2);

+ 9 - 1
runtime-modules/content-directory/src/tests/create_class.rs

@@ -20,7 +20,15 @@ fn create_class_success() {
         let default_class = create_class_with_default_permissions();
         assert_eq!(class_by_id(FIRST_CLASS_ID), default_class);
 
-        let class_created_event = get_test_event(RawEvent::ClassCreated(FIRST_CLASS_ID));
+        let class = get_class_for(ClassType::Valid);
+        let class_created_event = get_test_event(RawEvent::ClassCreated(
+            FIRST_CLASS_ID,
+            class.get_name().to_owned(),
+            class.get_description().to_owned(),
+            class.get_permissions_ref().to_owned(),
+            class.get_maximum_entities_count(),
+            class.get_default_entity_creation_voucher_upper_bound(),
+        ));
 
         // Event checked
         assert_event(class_created_event, number_of_events_before_call + 1);

+ 5 - 2
runtime-modules/content-directory/src/tests/create_entity.rs

@@ -67,8 +67,11 @@ fn create_entity_success() {
         // Ensure `NextEntityId` storage value updated
         assert_eq!(next_entity_id(), SECOND_ENTITY_ID);
 
-        let entity_created_event =
-            get_test_event(RawEvent::EntityCreated(actor, next_entity_id() - 1));
+        let entity_created_event = get_test_event(RawEvent::EntityCreated(
+            actor,
+            next_entity_id() - 1,
+            FIRST_CLASS_ID,
+        ));
 
         // Last event checked
         assert_event(entity_created_event, number_of_events_before_call + 1);

+ 3 - 1
runtime-modules/content-directory/src/tests/insert_at_entity_property_vector.rs

@@ -25,7 +25,7 @@ fn insert_at_entity_property_vector_success() {
             FIRST_ENTITY_ID,
             SECOND_PROPERTY_ID,
             index_in_property_vector,
-            input_value,
+            input_value.clone(),
             nonce
         ));
 
@@ -61,6 +61,8 @@ fn insert_at_entity_property_vector_success() {
             index_in_property_vector,
             nonce + 1,
             Some((SECOND_ENTITY_ID, side_effect)),
+            input_value,
+            nonce,
         ));
 
         // Last event checked

+ 1 - 0
runtime-modules/content-directory/src/tests/remove_at_entity_property_vector.rs

@@ -56,6 +56,7 @@ fn remove_at_entity_property_vector_success() {
             index_in_property_vector,
             nonce + 1,
             Some((SECOND_ENTITY_ID, side_effect)),
+            nonce,
         ));
 
         // Last event checked

+ 3 - 2
runtime-modules/content-directory/src/tests/transaction.rs

@@ -58,11 +58,12 @@ fn transaction_success() {
         let operations_count = operations.len();
 
         // Complete transaction
-        assert_ok!(transaction(LEAD_ORIGIN, actor.clone(), operations));
+        assert_ok!(transaction(LEAD_ORIGIN, actor.clone(), operations.clone()));
 
         // Runtime tested state after call
 
-        let transaction_completed_event = get_test_event(RawEvent::TransactionCompleted(actor));
+        let transaction_completed_event =
+            get_test_event(RawEvent::TransactionCompleted(actor, operations));
 
         // Last event checked
         assert_event(

+ 7 - 3
runtime-modules/content-directory/src/tests/transfer_entity_ownership.rs

@@ -46,9 +46,13 @@ fn transfer_entity_ownership_success() {
             .get_permissions_ref()
             .controller_is_equal_to(&new_controller));
 
-        let entity_ownership_transfered_event = get_test_event(
-            RawEvent::EntityOwnershipTransfered(FIRST_ENTITY_ID, new_controller, None),
-        );
+        let entity_ownership_transfered_event =
+            get_test_event(RawEvent::EntityOwnershipTransfered(
+                FIRST_ENTITY_ID,
+                new_controller,
+                None,
+                BTreeMap::new(),
+            ));
 
         // Last event checked
         assert_event(

+ 9 - 4
runtime-modules/content-directory/src/tests/update_class_permissions.rs

@@ -55,7 +55,7 @@ fn update_class_permissions_success() {
 
         // Ensure class permissions updated succesfully
 
-        *class_permissions.get_maintainers_mut() = maintainers;
+        *class_permissions.get_maintainers_mut() = maintainers.clone();
         class_permissions.set_entity_creation_blocked(true);
 
         assert_eq!(
@@ -63,9 +63,6 @@ fn update_class_permissions_success() {
             class_permissions
         );
 
-        let class_permissions_updated_event =
-            get_test_event(RawEvent::ClassPermissionsUpdated(FIRST_CLASS_ID));
-
         // Ensure number of classes maintained by curator groups updated succesfully.
 
         assert_eq!(
@@ -102,6 +99,14 @@ fn update_class_permissions_success() {
             1
         );
 
+        let class_permissions_updated_event = get_test_event(RawEvent::ClassPermissionsUpdated(
+            FIRST_CLASS_ID,
+            None,
+            Some(true),
+            None,
+            Some(maintainers),
+        ));
+
         // Event checked
         assert_event(
             class_permissions_updated_event,

+ 12 - 6
runtime-modules/content-directory/src/tests/update_entity_creation_voucher.rs

@@ -35,9 +35,12 @@ fn create_entity_creation_voucher_success() {
             entity_voucher,
         );
 
-        let entity_creation_voucher_created_event = get_test_event(
-            RawEvent::EntityCreationVoucherCreated(entity_controller, entity_voucher),
-        );
+        let entity_creation_voucher_created_event =
+            get_test_event(RawEvent::EntityCreationVoucherCreated(
+                entity_controller,
+                entity_voucher,
+                FIRST_CLASS_ID,
+            ));
 
         // Last event checked
         assert_event(
@@ -96,9 +99,12 @@ fn update_entity_creation_voucher_success() {
             entity_creation_voucher
         );
 
-        let entity_creation_voucher_created_event = get_test_event(
-            RawEvent::EntityCreationVoucherUpdated(entity_controller, entity_creation_voucher),
-        );
+        let entity_creation_voucher_created_event =
+            get_test_event(RawEvent::EntityCreationVoucherUpdated(
+                entity_controller,
+                entity_creation_voucher,
+                FIRST_CLASS_ID,
+            ));
 
         // Last event checked
         assert_event(

+ 5 - 2
runtime-modules/content-directory/src/tests/update_entity_permissions.rs

@@ -39,8 +39,11 @@ fn update_entity_permissions_success() {
             entity_permissions
         );
 
-        let entity_permissions_updated_event =
-            get_test_event(RawEvent::EntityPermissionsUpdated(FIRST_ENTITY_ID));
+        let entity_permissions_updated_event = get_test_event(RawEvent::EntityPermissionsUpdated(
+            FIRST_ENTITY_ID,
+            None,
+            Some(false),
+        ));
 
         // Last event checked
         assert_event(

+ 8 - 4
runtime-modules/content-directory/src/tests/update_entity_property_values.rs

@@ -25,7 +25,7 @@ fn update_entity_property_values_success() {
             LEAD_ORIGIN,
             actor.clone(),
             FIRST_ENTITY_ID,
-            second_schema_new_property_values
+            second_schema_new_property_values.clone()
         ));
 
         // Runtime tested state after call
@@ -50,9 +50,13 @@ fn update_entity_property_values_success() {
         let mut side_effects = ReferenceCounterSideEffects::default();
         side_effects.insert(SECOND_ENTITY_ID, side_effect);
 
-        let entity_property_values_updated_event = get_test_event(
-            RawEvent::EntityPropertyValuesUpdated(actor, FIRST_ENTITY_ID, Some(side_effects)),
-        );
+        let entity_property_values_updated_event =
+            get_test_event(RawEvent::EntityPropertyValuesUpdated(
+                actor,
+                FIRST_ENTITY_ID,
+                Some(side_effects),
+                second_schema_new_property_values,
+            ));
 
         // Last event checked
         assert_event(

+ 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()
+        );
     }
 }
 

+ 86 - 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, 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,13 @@ 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,
+                    new_text
+                ));
 
             Ok(())
         }
@@ -1174,7 +1224,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 +1267,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(())
         }

+ 85 - 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,13 @@ 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,
+                new_text
+            ))
         );
     }
     post_id
@@ -903,7 +946,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 +967,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 +976,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 +992,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 +1026,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 +1061,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 +1100,7 @@ pub fn set_stickied_threads_mock(
             TestEvent::forum_mod(RawEvent::CategoryStickyThreadUpdate(
                 category_id,
                 stickied_ids.clone(),
+                PrivilegedActor::Moderator(moderator_id)
             ))
         );
     };
@@ -1070,6 +1134,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(),
+        ));
     });
 }
 

+ 3 - 3
runtime-modules/memo/src/lib.rs

@@ -22,7 +22,7 @@ decl_storage! {
 
 decl_event! {
     pub enum Event<T> where <T as frame_system::Trait>::AccountId {
-        MemoUpdated(AccountId),
+        MemoUpdated(AccountId, MemoText),
     }
 }
 
@@ -37,8 +37,8 @@ decl_module! {
             ensure!(!<balances::Module<T>>::total_balance(&sender).is_zero(), "account must have a balance");
             ensure!(memo.len() as u32 <= Self::max_memo_length(), "memo too long");
 
-            <Memo<T>>::insert(&sender, memo);
-            Self::deposit_event(RawEvent::MemoUpdated(sender));
+            <Memo<T>>::insert(&sender, memo.clone());
+            Self::deposit_event(RawEvent::MemoUpdated(sender, memo));
         }
     }
 }

+ 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
             ))
         );
     }

+ 14 - 4
runtime-modules/storage/src/data_directory.rs

@@ -159,13 +159,17 @@ decl_event! {
     pub enum Event<T> where
         <T as Trait>::ContentId,
         MemberId = MemberId<T>,
-        StorageProviderId = StorageProviderId<T>
+        StorageProviderId = StorageProviderId<T>,
+        DataObjectTypeId = <T as data_object_type_registry::Trait>::DataObjectTypeId
     {
         /// Emits on adding of the content.
         /// Params:
         /// - Id of the relationship.
         /// - Id of the member.
-        ContentAdded(ContentId, MemberId),
+        /// - Id of the data object type
+        /// - Size of the content
+        /// - IPFS content ID
+        ContentAdded(ContentId, MemberId, DataObjectTypeId, u64, Vec<u8>),
 
         /// Emits when the storage provider accepts a content.
         /// Params:
@@ -225,7 +229,7 @@ decl_module! {
                 owner: member_id,
                 liaison,
                 liaison_judgement: LiaisonJudgement::Pending,
-                ipfs_content_id,
+                ipfs_content_id: ipfs_content_id.clone(),
             };
 
             //
@@ -233,7 +237,13 @@ decl_module! {
             //
 
             <DataObjectByContentId<T>>::insert(&content_id, data);
-            Self::deposit_event(RawEvent::ContentAdded(content_id, member_id));
+            Self::deposit_event(RawEvent::ContentAdded(
+                    content_id,
+                    member_id,
+                    type_id,
+                    size,
+                    ipfs_content_id
+                ));
         }
 
         /// Storage provider accepts a content. Requires signed storage provider account and its id.

+ 9 - 2
runtime-modules/storage/src/data_object_storage_registry.rs

@@ -123,7 +123,12 @@ decl_event! {
         /// Params:
         /// - Id of the relationship.
         /// - Current state of the relationship (True=Active).
-        DataObjectStorageRelationshipReadyUpdated(DataObjectStorageRelationshipId, bool),
+        /// - Id of the storage provider
+        DataObjectStorageRelationshipReadyUpdated(
+            DataObjectStorageRelationshipId,
+            bool,
+            StorageProviderId
+        ),
     }
 }
 
@@ -229,7 +234,9 @@ impl<T: Trait> Module<T> {
         // Update DOSR and fire event.
         <Relationships<T>>::insert(id, dosr);
         Self::deposit_event(RawEvent::DataObjectStorageRelationshipReadyUpdated(
-            id, ready,
+            id,
+            ready,
+            storage_provider_id,
         ));
 
         Ok(())

+ 16 - 7
runtime-modules/storage/src/data_object_type_registry.rs

@@ -63,7 +63,7 @@ decl_error! {
 }
 
 /// Contains description and constrains for the data object.
-#[derive(Clone, Encode, Decode, PartialEq, Debug)]
+#[derive(Clone, Encode, Decode, PartialEq, Debug, Eq)]
 pub struct DataObjectType {
     /// Data object description.
     pub description: Vec<u8>,
@@ -106,12 +106,19 @@ decl_event! {
         /// Emits on the data object type registration.
         /// Params:
         /// - Id of the new data object type.
-        DataObjectTypeRegistered(DataObjectTypeId),
+        /// - Object type parameter
+        DataObjectTypeRegistered(DataObjectTypeId, DataObjectType),
 
         /// Emits on the data object type update.
         /// Params:
         /// - Id of the updated data object type.
-        DataObjectTypeUpdated(DataObjectTypeId),
+        /// - Objet type parameter
+        DataObjectTypeUpdated(DataObjectTypeId, DataObjectType),
+
+        /// Emits on the datata type activation status changed.
+        /// Params:
+        /// - Id of the updated data object type.
+        DataObjectTypeActivationChanged(DataObjectTypeId),
     }
 }
 
@@ -155,7 +162,9 @@ decl_module! {
             <DataObjectTypes<T>>::insert(new_do_type_id, do_type);
             <NextDataObjectTypeId<T>>::mutate(|n| { *n += T::DataObjectTypeId::from(1); });
 
-            Self::deposit_event(RawEvent::DataObjectTypeRegistered(new_do_type_id));
+            Self::deposit_event(
+                RawEvent::DataObjectTypeRegistered(new_do_type_id, data_object_type)
+            );
         }
 
         /// Updates existing data object type. Requires leader privileges.
@@ -178,7 +187,7 @@ decl_module! {
 
             <DataObjectTypes<T>>::insert(id, do_type);
 
-            Self::deposit_event(RawEvent::DataObjectTypeUpdated(id));
+            Self::deposit_event(RawEvent::DataObjectTypeUpdated(id, data_object_type));
         }
 
         /// Activates existing data object type. Requires leader privileges.
@@ -196,7 +205,7 @@ decl_module! {
 
             <DataObjectTypes<T>>::insert(id, do_type);
 
-            Self::deposit_event(RawEvent::DataObjectTypeUpdated(id));
+            Self::deposit_event(RawEvent::DataObjectTypeActivationChanged(id));
         }
 
         /// Deactivates existing data object type. Requires leader privileges.
@@ -214,7 +223,7 @@ decl_module! {
 
             <DataObjectTypes<T>>::insert(id, do_type);
 
-            Self::deposit_event(RawEvent::DataObjectTypeUpdated(id));
+            Self::deposit_event(RawEvent::DataObjectTypeActivationChanged(id));
         }
     }
 }

+ 14 - 4
runtime-modules/storage/src/tests/data_directory.rs

@@ -62,13 +62,17 @@ fn accept_and_reject_content_fail_with_invalid_storage_provider() {
             0,
             vec![1, 2, 3, 4],
         );
+
         assert!(res.is_ok());
 
-        let (content_id, _) = match System::events().last().unwrap().event {
+        let (content_id, _) = match &System::events().last().unwrap().event {
             MetaEvent::data_directory(data_directory::RawEvent::ContentAdded(
                 content_id,
                 creator,
-            )) => (content_id, creator),
+                _,
+                _,
+                _,
+            )) => (content_id.clone(), creator.clone()),
             _ => (0u64, 0xdeadbeefu64), // invalid value, unlikely to match
         };
 
@@ -127,11 +131,14 @@ fn accept_content_as_liaison() {
         assert!(res.is_ok());
 
         // An appropriate event should have been fired.
-        let (content_id, creator) = match System::events().last().unwrap().event {
+        let (content_id, creator) = match &System::events().last().unwrap().event {
             MetaEvent::data_directory(data_directory::RawEvent::ContentAdded(
                 content_id,
                 creator,
-            )) => (content_id, creator),
+                _,
+                _,
+                _,
+            )) => (content_id.clone(), creator.clone()),
             _ => (0u64, 0xdeadbeefu64), // invalid value, unlikely to match
         };
         assert_ne!(creator, 0xdeadbeefu64);
@@ -182,6 +189,9 @@ fn reject_content_as_liaison() {
             MetaEvent::data_directory(data_directory::RawEvent::ContentAdded(
                 content_id,
                 creator,
+                _,
+                _,
+                _,
             )) => (content_id, creator),
             _ => (0u64, 0xdeadbeefu64), // invalid value, unlikely to match
         };

+ 3 - 1
runtime-modules/storage/src/tests/data_object_storage_registry.rs

@@ -174,7 +174,9 @@ fn test_toggle_ready() {
             System::events().last().unwrap().event,
             MetaEvent::data_object_storage_registry(
                 data_object_storage_registry::RawEvent::DataObjectStorageRelationshipReadyUpdated(
-                    dosr_id, true,
+                    dosr_id,
+                    true,
+                    storage_provider_id
                 )
             )
         );

+ 7 - 6
runtime-modules/storage/src/tests/data_object_type_registry.rs

@@ -40,7 +40,7 @@ impl SetLeadFixture {
 fn get_last_data_object_type_id() -> u64 {
     let dot_id = match System::events().last().unwrap().event {
         MetaEvent::data_object_type_registry(
-            data_object_type_registry::RawEvent::DataObjectTypeRegistered(dot_id),
+            data_object_type_registry::RawEvent::DataObjectTypeRegistered(dot_id, _),
         ) => dot_id,
         _ => 0xdeadbeefu64, // unlikely value
     };
@@ -238,7 +238,7 @@ fn update_existing() {
         let res = TestDataObjectTypeRegistry::update_data_object_type(
             RawOrigin::Signed(DEFAULT_LEADER_ACCOUNT_ID).into(),
             dot_id,
-            updated3,
+            updated3.clone(),
         );
         assert!(res.is_ok());
         assert_eq!(
@@ -246,7 +246,7 @@ fn update_existing() {
             EventRecord {
                 phase: Phase::Initialization,
                 event: MetaEvent::data_object_type_registry(
-                    data_object_type_registry::RawEvent::DataObjectTypeUpdated(dot_id)
+                    data_object_type_registry::RawEvent::DataObjectTypeUpdated(dot_id, updated3)
                 ),
                 topics: vec![],
             }
@@ -291,7 +291,7 @@ fn activate_existing() {
         };
         let id_res = TestDataObjectTypeRegistry::register_data_object_type(
             RawOrigin::Signed(DEFAULT_LEADER_ACCOUNT_ID).into(),
-            data,
+            data.clone(),
         );
         assert!(id_res.is_ok());
         assert_eq!(
@@ -300,7 +300,8 @@ fn activate_existing() {
                 phase: Phase::Initialization,
                 event: MetaEvent::data_object_type_registry(
                     data_object_type_registry::RawEvent::DataObjectTypeRegistered(
-                        expected_data_object_type_id
+                        expected_data_object_type_id,
+                        data
                     )
                 ),
                 topics: vec![],
@@ -323,7 +324,7 @@ fn activate_existing() {
             EventRecord {
                 phase: Phase::Initialization,
                 event: MetaEvent::data_object_type_registry(
-                    data_object_type_registry::RawEvent::DataObjectTypeUpdated(
+                    data_object_type_registry::RawEvent::DataObjectTypeActivationChanged(
                         expected_data_object_type_id
                     )
                 ),

+ 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));
     });
 }