Skip to content

Commit

Permalink
removes unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
gpestana committed Oct 9, 2024
1 parent 9131032 commit 500ad9c
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 51 deletions.
10 changes: 3 additions & 7 deletions substrate/frame/election-provider-multi-block/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,13 @@
//! Some helper functions/macros for this crate.

use crate::{
types::{
AllTargetPagesMinerOf, AllTargetPagesOf, AllVoterPagesMinerOf, AllVoterPagesOf,
MaxWinnersPerPageMinerOf, MinerVoterOf, VoterOf,
},
AccountIdOf, Config, MaxWinnersPerPageOf, SolutionTargetIndexMinerOf, SolutionTargetIndexOf,
SolutionVoterIndexMinerOf, SolutionVoterIndexOf,
types::{AllTargetPagesMinerOf, AllVoterPagesMinerOf, MaxWinnersPerPageMinerOf, MinerVoterOf},
SolutionTargetIndexMinerOf, SolutionVoterIndexMinerOf,
};
use frame_election_provider_support::{PageIndex, VoteWeight};
use frame_support::{traits::Get, BoundedVec};
use sp_runtime::SaturatedConversion;
use sp_std::{cmp::Reverse, collections::btree_map::BTreeMap, vec, vec::Vec};
use sp_std::{cmp::Reverse, collections::btree_map::BTreeMap, vec};

#[macro_export]
macro_rules! log {
Expand Down
9 changes: 2 additions & 7 deletions substrate/frame/election-provider-multi-block/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,7 @@ pub use crate::{verifier::Verifier, weights::WeightInfo};

/// Internal crate re-exports to use across benchmarking and tests.
#[cfg(any(test, feature = "runtime-benchmarks"))]
use crate::{
signed::{Config as ConfigSigned, Pallet as PalletSigned},
unsigned::Config as ConfigUnsigned,
verifier::{Config as ConfigVerifier, Pallet as PalletVerifier},
Config as ConfigCore, Pallet as PalletCore,
};
use crate::verifier::Pallet as PalletVerifier;

const LOG_TARGET: &'static str = "runtime::multiblock-election";

Expand Down Expand Up @@ -773,7 +768,7 @@ impl<T: Config> ElectionProvider for Pallet<T> {
#[cfg(test)]
mod phase_transition {
use super::*;
use crate::{mock::*, verifier::AsyncVerifier};
use crate::mock::*;

use frame_support::assert_ok;

Expand Down
1 change: 0 additions & 1 deletion substrate/frame/election-provider-multi-block/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use frame_support::{BoundedVec, DebugNoBound};
use scale_info::TypeInfo;
use sp_npos_elections::ElectionScore;
use sp_runtime::SaturatedConversion;
use sp_std::{boxed::Box, vec::Vec};

use crate::{unsigned::miner, Verifier};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,21 @@

use crate::{
helpers,
types::{PageSize, Pagify, SupportsOf, VoterOf},
types::{PageSize, Pagify},
unsigned::{pallet::Config as UnsignedConfig, Call},
verifier::FeasibilityError,
MinerAssignmentOf, MinerSolutionAccuracyOf, MinerSupportsOf, MinerVoterOf, Pallet as EPM,
Snapshot, SolutionAccuracyOf, SolutionOf,
MinerAssignmentOf, MinerSupportsOf, MinerVoterOf, Pallet as EPM, Snapshot,
};

use codec::Encode;
use frame_election_provider_support::{
DataProviderBounds, ElectionDataProvider, IndexAssignmentOf, NposSolution, NposSolver,
PageIndex, TryIntoBoundedSupports, Weight,
ElectionDataProvider, IndexAssignmentOf, NposSolution, NposSolver, PageIndex,
TryIntoBoundedSupports, Weight,
};
use frame_support::{ensure, traits::Get, BoundedVec};
use scale_info::TypeInfo;
use sp_npos_elections::{
assignment_ratio_to_staked_normalized, assignment_staked_to_ratio_normalized, ElectionResult,
ElectionScore, ExtendedBalance, PerThing128, Support,
};
use sp_runtime::{offchain::storage::StorageValueRef, traits::Zero, SaturatedConversion};
use sp_std::{vec, vec::Vec};
use sp_npos_elections::{ElectionResult, ElectionScore, ExtendedBalance, Support};
use sp_runtime::{offchain::storage::StorageValueRef, SaturatedConversion};
use sp_std::vec;

pub type TargetSnaphsotOf<T> =
BoundedVec<<T as Config>::AccountId, <T as Config>::TargetSnapshotPerBlock>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ mod tests;

use crate::{
unsigned::{
miner::{Config as MinerConfig, OffchainMinerError, OffchainWorkerMiner},
miner::{OffchainMinerError, OffchainWorkerMiner},
weights::WeightInfo,
},
verifier, AccountIdOf, Pallet as EPM, Phase, SolutionAccuracyOf, SolutionOf, Verifier,
verifier, Phase, SolutionOf, Verifier,
};
use frame_election_provider_support::PageIndex;
use frame_support::{
Expand All @@ -81,7 +81,6 @@ use frame_support::{
use frame_system::{offchain::SendTransactionTypes, pallet_prelude::BlockNumberFor};
use sp_npos_elections::ElectionScore;
use sp_runtime::SaturatedConversion;
use sp_std::vec::Vec;

// public re-exports.
pub use pallet::{
Expand All @@ -92,8 +91,6 @@ pub use pallet::{
#[frame_support::pallet(dev_mode)]
pub(crate) mod pallet {

use crate::MinerSolutionAccuracyOf;

use super::*;
use frame_support::pallet_prelude::*;
use frame_system::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@

use super::*;
use crate::{
mock::*,
unsigned::{miner::*, pallet::Config as UnsignedConfig},
PagedTargetSnapshot, PagedVoterSnapshot, Phase, Snapshot, Verifier,
mock::*, unsigned::miner::Config, PagedTargetSnapshot, PagedVoterSnapshot, Phase, Snapshot,
Verifier,
};

use frame_election_provider_support::ElectionProvider;
use frame_support::{assert_noop, assert_ok};
use frame_support::assert_ok;

mod calls {
use super::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,17 @@ use frame_support::{
traits::{Defensive, TryCollect},
BoundedVec,
};
use sp_runtime::{
traits::{BlockNumber, One, Zero},
Perbill, Saturating,
};
use sp_runtime::{traits::Zero, Perbill};
use sp_std::{collections::btree_map::BTreeMap, vec::Vec};

use super::*;
use pallet::*;

use crate::{
helpers, unsigned::miner, verifier::weights::WeightInfo, AccountIdOf, SolutionAccuracyOf,
SolutionOf,
};
use crate::{helpers, unsigned::miner, verifier::weights::WeightInfo, SolutionOf};

#[frame_support::pallet(dev_mode)]
pub(crate) mod pallet {
use crate::{SolutionVoterIndexOf, SupportsOf};
use crate::SupportsOf;

use super::*;
use frame_support::pallet_prelude::{ValueQuery, *};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ mod feasibility_check {

mod sync_verifier {
use super::*;
use crate::{
verifier::{impls::pallet::QueuedSolution, SolutionPointer},
SupportsOf, Verifier,
};

#[test]
fn sync_verifier_simple_works() {
Expand Down
1 change: 0 additions & 1 deletion substrate/primitives/core/src/offchain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
//! Offchain workers types

use crate::{OpaquePeerId, RuntimeDebug};
use alloc::{boxed::Box, vec::Vec};
use codec::{Decode, Encode};
use scale_info::TypeInfo;
use sp_runtime_interface::pass_by::{PassByCodec, PassByEnum, PassByInner};
Expand Down
1 change: 0 additions & 1 deletion substrate/primitives/npos-elections/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
//! Helper methods for npos-elections.

use crate::{Assignment, Error, IdentifierT, PerThing128, StakedAssignment, VoteWeight};
use alloc::vec::Vec;
use sp_arithmetic::PerThing;

/// Converts a vector of ratio assignments into ones with absolute budget value.
Expand Down

0 comments on commit 500ad9c

Please sign in to comment.