Procházet zdrojové kódy

referendum - code reformatting

ondratra před 4 roky
rodič
revize
361160ddcb

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 81 - 0
rome-testnet.json


+ 3 - 5
runtime-modules/referendum/src/lib.rs

@@ -413,10 +413,7 @@ impl<T: Trait<I>, I: Instance> ReferendumManager<T, I> for Module<T, I> {
         Mutations::<T, I>::start_voting_period(&extra_options_count, &extra_winning_target_count);
 
         // emit event
-        Self::deposit_event(RawEvent::ReferendumStarted(
-            total_options,
-            total_winners,
-        ));
+        Self::deposit_event(RawEvent::ReferendumStarted(total_options, total_winners));
 
         Ok(())
     }
@@ -460,7 +457,8 @@ impl<T: Trait<I>, I: Instance> Mutations<T, I> {
     }
 
     fn start_revealing_period(old_stage: ReferendumStageVoting<T::BlockNumber>) {
-        let total_options = old_stage.extra_options_count + old_stage.extra_winning_target_count + 1;
+        let total_options =
+            old_stage.extra_options_count + old_stage.extra_winning_target_count + 1;
 
         // change referendum state
         Stage::<T, I>::put(ReferendumStage::Revealing(ReferendumStageRevealing::<

+ 17 - 8
runtime-modules/referendum/src/mock.rs

@@ -295,7 +295,12 @@ where
         custom_salt: &[u8],
     ) -> (T::Hash, Vec<u8>) {
         let cycle_id = CurrentCycleId::<I>::get();
-        Self::calculate_commitment_for_cycle(account_id, &cycle_id, vote_option_index, Some(custom_salt))
+        Self::calculate_commitment_for_cycle(
+            account_id,
+            &cycle_id,
+            vote_option_index,
+            Some(custom_salt),
+        )
     }
 
     pub fn generate_salt() -> Vec<u8> {
@@ -310,7 +315,6 @@ where
         vote_option_index: &u64,
         custom_salt: Option<&[u8]>,
     ) -> (T::Hash, Vec<u8>) {
-
         let salt = match custom_salt {
             Some(tmp_salt) => tmp_salt.to_vec(),
             None => Self::generate_salt(),
@@ -354,7 +358,11 @@ impl InstanceMocks<Runtime, Instance0> {
             expected_result,
         );
 
-        Self::start_referendum_inner(extra_options_count, extra_winning_target_count, expected_result)
+        Self::start_referendum_inner(
+            extra_options_count,
+            extra_winning_target_count,
+            expected_result,
+        )
     }
 
     pub fn start_referendum_manager(
@@ -375,7 +383,11 @@ impl InstanceMocks<Runtime, Instance0> {
             expected_result,
         );
 
-        Self::start_referendum_inner(extra_options_count, extra_winning_target_count, expected_result)
+        Self::start_referendum_inner(
+            extra_options_count,
+            extra_winning_target_count,
+            expected_result,
+        )
     }
 
     fn start_referendum_inner(
@@ -402,10 +414,7 @@ impl InstanceMocks<Runtime, Instance0> {
 
         assert_eq!(
             system::Module::<Runtime>::events().last().unwrap().event,
-            TestEvent::from(RawEvent::ReferendumStarted(
-                total_options,
-                total_winners,
-            ))
+            TestEvent::from(RawEvent::ReferendumStarted(total_options, total_winners,))
         );
     }
 

+ 2 - 1
runtime-modules/referendum/src/tests.rs

@@ -365,7 +365,8 @@ fn reveal_salt_too_long() {
 
         let option_to_vote_for = 1;
         let stake = <Runtime as Trait<Instance0>>::MinimumStake::get();
-        let (commitment, _) = MockUtils::calculate_commitment_custom_salt(&account_id, &option_to_vote_for, &salt);
+        let (commitment, _) =
+            MockUtils::calculate_commitment_custom_salt(&account_id, &option_to_vote_for, &salt);
 
         Mocks::start_referendum_extrinsic(
             origin.clone(),

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů