From 42b16de4272a9bff579c2681b5cb9965638d5a26 Mon Sep 17 00:00:00 2001 From: 1xstj <106580853+1xstj@users.noreply.github.com> Date: Fri, 24 Nov 2023 10:49:06 +0000 Subject: [PATCH] cargo fmt --- pallets/dkg/src/tests.rs | 8 ++++++-- primitives/src/traits/jobs.rs | 8 +++----- primitives/src/traits/roles.rs | 10 ++++++---- primitives/src/types/jobs.rs | 14 ++++++-------- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/pallets/dkg/src/tests.rs b/pallets/dkg/src/tests.rs index d0e32400c..91da47318 100644 --- a/pallets/dkg/src/tests.rs +++ b/pallets/dkg/src/tests.rs @@ -57,8 +57,12 @@ fn set_fees_works() { #[test] fn dkg_key_verifcation_works() { new_test_ext().execute_with(|| { - let job_to_verify = - DKGResult { key: vec![], participants: vec![], keys_and_signatures: vec![], threshold: 2 }; + let job_to_verify = DKGResult { + key: vec![], + participants: vec![], + keys_and_signatures: vec![], + threshold: 2, + }; // should fail for empty participants assert_noop!( diff --git a/primitives/src/traits/jobs.rs b/primitives/src/traits/jobs.rs index 2540594b6..07fb5b9a0 100644 --- a/primitives/src/traits/jobs.rs +++ b/primitives/src/traits/jobs.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Tangle. If not, see . -use crate::jobs::{JobId, JobKey, JobSubmission, ValidatorOffence, JobResult}; +use crate::jobs::{JobId, JobKey, JobResult, JobSubmission, ValidatorOffence}; use frame_support::dispatch::Vec; use sp_arithmetic::traits::{BaseArithmetic, Unsigned}; use sp_runtime::DispatchResult; @@ -48,9 +48,7 @@ pub trait MPCHandler { /// # Errors /// /// Returns a `DispatchResult` indicating success or an error if verification fails. - fn verify( - data : JobResult - ) -> DispatchResult; + fn verify(data: JobResult) -> DispatchResult; // Verify a validator report /// @@ -65,7 +63,7 @@ pub trait MPCHandler { fn verify_validator_report( validator: AccountId, offence: ValidatorOffence, - signatures: Vec> + signatures: Vec>, ) -> DispatchResult; /// Validate the authority key associated with a specific validator. diff --git a/primitives/src/traits/roles.rs b/primitives/src/traits/roles.rs index 0f6672db4..7ce55f2ef 100644 --- a/primitives/src/traits/roles.rs +++ b/primitives/src/traits/roles.rs @@ -14,9 +14,11 @@ // You should have received a copy of the GNU General Public License // along with Tangle. If not, see . -use crate::jobs::{JobKey, ValidatorOffence}; +use crate::{ + jobs::{JobKey, ValidatorOffence}, + roles::RoleTypeMetadata, +}; use sp_runtime::DispatchResult; -use crate::roles::RoleTypeMetadata; /// A trait that handles roles associated with job types. pub trait RolesHandler { @@ -54,7 +56,7 @@ pub trait RolesHandler { /// /// # Returns /// - /// Returns an `Option` containing metadata information for the specified validator, - /// or `None` if no metadata is found. + /// Returns an `Option` containing metadata information for the specified + /// validator, or `None` if no metadata is found. fn get_validator_metadata(address: AccountId, job_key: JobKey) -> Option; } diff --git a/primitives/src/types/jobs.rs b/primitives/src/types/jobs.rs index 577f7a107..dd4766402 100644 --- a/primitives/src/types/jobs.rs +++ b/primitives/src/types/jobs.rs @@ -13,11 +13,11 @@ // // You should have received a copy of the GNU General Public License // along with Tangle. If not, see . +use crate::roles::RoleType; use frame_support::{dispatch::Vec, pallet_prelude::*, RuntimeDebug}; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; use sp_core::ecdsa; -use crate::roles::RoleType; pub type JobId = u32; @@ -275,13 +275,12 @@ pub enum JobResult { pub type KeysAndSignatures = Vec<(Vec, Vec)>; - #[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub struct DKGResult { /// Submitted key pub key: Vec, - + /// List of participants' public keys pub participants: Vec, @@ -302,7 +301,7 @@ pub struct DKGSignatureResult { pub signature: Vec, /// The expected key for the signature - pub signing_key : Vec + pub signing_key: Vec, } #[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] @@ -315,10 +314,9 @@ pub struct ZkSaasPhaseOneResult { pub participants: Vec>, /// The data to verify - pub data: Vec + pub data: Vec, } - #[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub struct ZkSaasPhaseTwoResult { @@ -326,5 +324,5 @@ pub struct ZkSaasPhaseTwoResult { pub data: Vec, /// The expected key for the signature - pub signing_key : Vec -} \ No newline at end of file + pub signing_key: Vec, +}