From 1a4c609f9df8aabd25a896e8f09802daaab38d0b Mon Sep 17 00:00:00 2001 From: Vic Genin Date: Fri, 5 Jul 2024 15:21:43 +0300 Subject: [PATCH] fmt --- pallets/ddc-verification/src/lib.rs | 44 ++++++++++++++--------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/pallets/ddc-verification/src/lib.rs b/pallets/ddc-verification/src/lib.rs index 2e34ea8a1..35937fcad 100644 --- a/pallets/ddc-verification/src/lib.rs +++ b/pallets/ddc-verification/src/lib.rs @@ -29,7 +29,6 @@ use polkadot_ckb_merkle_mountain_range::{ util::{MemMMR, MemStore}, MerkleProof, MMR, }; -use scale_info::prelude::{format, string::String}; use serde::{Deserialize, Serialize}; use sp_application_crypto::RuntimeAppPublic; use sp_runtime::{ @@ -1151,8 +1150,8 @@ pub mod pallet { if let Some((era_id, start, end)) = Self::get_era_for_payout(cluster_id, EraValidationStatus::PayoutInProgress) { - if T::PayoutVisitor::get_billing_report_status(cluster_id, era_id) == - PayoutState::Initialized + if T::PayoutVisitor::get_billing_report_status(cluster_id, era_id) + == PayoutState::Initialized { if let Some((_, _, customers_activity_batch_roots, _, _, _)) = Self::fetch_validation_activities::( @@ -1216,8 +1215,8 @@ pub mod pallet { if let Some((era_id, _start, _end)) = Self::get_era_for_payout(cluster_id, EraValidationStatus::PayoutInProgress) { - if T::PayoutVisitor::get_billing_report_status(cluster_id, era_id) == - PayoutState::ChargingCustomers + if T::PayoutVisitor::get_billing_report_status(cluster_id, era_id) + == PayoutState::ChargingCustomers { if let Some(( customers_activity_in_consensus, @@ -1321,9 +1320,9 @@ pub mod pallet { if let Some((era_id, _start, _end)) = Self::get_era_for_payout(cluster_id, EraValidationStatus::PayoutInProgress) { - if T::PayoutVisitor::get_billing_report_status(cluster_id, era_id) == - PayoutState::ChargingCustomers && - T::PayoutVisitor::all_customer_batches_processed(cluster_id, era_id) + if T::PayoutVisitor::get_billing_report_status(cluster_id, era_id) + == PayoutState::ChargingCustomers + && T::PayoutVisitor::all_customer_batches_processed(cluster_id, era_id) { return Ok(Some(era_id)); } @@ -1337,8 +1336,8 @@ pub mod pallet { if let Some((era_id, _start, _end)) = Self::get_era_for_payout(cluster_id, EraValidationStatus::PayoutInProgress) { - if T::PayoutVisitor::get_billing_report_status(cluster_id, era_id) == - PayoutState::CustomersChargedWithFees + if T::PayoutVisitor::get_billing_report_status(cluster_id, era_id) + == PayoutState::CustomersChargedWithFees { if let Some(( _, @@ -1399,9 +1398,9 @@ pub mod pallet { if let Some((era_id, _start, _end)) = Self::get_era_for_payout(cluster_id, EraValidationStatus::PayoutInProgress) { - if T::PayoutVisitor::get_billing_report_status(cluster_id, era_id) == - PayoutState::RewardingProviders && - T::PayoutVisitor::all_provider_batches_processed(cluster_id, era_id) + if T::PayoutVisitor::get_billing_report_status(cluster_id, era_id) + == PayoutState::RewardingProviders + && T::PayoutVisitor::all_provider_batches_processed(cluster_id, era_id) { return Ok(Some(era_id)); } @@ -1415,8 +1414,8 @@ pub mod pallet { if let Some((era_id, _start, _end)) = Self::get_era_for_payout(cluster_id, EraValidationStatus::PayoutInProgress) { - if T::PayoutVisitor::get_billing_report_status(cluster_id, era_id) == - PayoutState::ProvidersRewarded + if T::PayoutVisitor::get_billing_report_status(cluster_id, era_id) + == PayoutState::ProvidersRewarded { return Ok(Some(era_id)); } @@ -1610,11 +1609,12 @@ pub mod pallet { for &leaf in leaves { match mmr.push(leaf) { Ok(pos) => leaves_with_position.push((pos, leaf)), - Err(_) => + Err(_) => { return Err(OCWError::FailedToCreateMerkleRoot { cluster_id: *cluster_id, era_id, - }), + }) + }, } } @@ -1648,9 +1648,9 @@ pub mod pallet { let mut end_era: i64 = Default::default(); for (stored_cluster_id, era_id, validation) in EraValidations::::iter() { - if stored_cluster_id == *cluster_id && - validation.status == status && - (smallest_era_id.is_none() || era_id < smallest_era_id.unwrap()) + if stored_cluster_id == *cluster_id + && validation.status == status + && (smallest_era_id.is_none() || era_id < smallest_era_id.unwrap()) { smallest_era_id = Some(era_id); start_era = validation.start_era; @@ -2142,8 +2142,8 @@ pub mod pallet { era_validation.start_era = era_activity.start; era_validation.end_era = era_activity.end; - if payers_merkle_root_hash == ActivityHash::default() && - payees_merkle_root_hash == payers_merkle_root_hash + if payers_merkle_root_hash == ActivityHash::default() + && payees_merkle_root_hash == payers_merkle_root_hash { era_validation.status = EraValidationStatus::PayoutSuccess; } else {