Skip to content

Commit

Permalink
comp imports
Browse files Browse the repository at this point in the history
  • Loading branch information
runcomet committed Nov 19, 2024
1 parent 1e0c500 commit 8c9c6cf
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 10 deletions.
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions substrate/frame/alliance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ array-bytes = { workspace = true, default-features = true }
sp-crypto-hashing = { workspace = true }
pallet-balances = { workspace = true, default-features = true }
pallet-collective = { workspace = true, default-features = true }
pretty_assertions = { workspace = true }

[features]
default = ["std"]
Expand Down
8 changes: 5 additions & 3 deletions substrate/frame/alliance/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
#![cfg(feature = "runtime-benchmarks")]

use core::{cmp, mem::size_of};
/*
use sp_runtime::traits::{Bounded, Hash, StaticLookup};
use frame_benchmarking::{account, v2::*, BenchmarkError};
use frame_support::traits::{EnsureOrigin, Get, UnfilteredDispatchable};
use frame_system::{pallet_prelude::BlockNumberFor, Pallet as System, RawOrigin as SystemOrigin};

*/
use super::{Call as AllianceCall, Pallet as Alliance, *};
use frame::{benchmarking::prelude::*, deps::{frame_system::{Pallet as System, RawOrigin as SystemOrigin}, frame_support::traits::{EnsureOrigin, Get, UnfilteredDispatchable}}};

const SEED: u32 = 0;

Expand Down Expand Up @@ -193,7 +195,7 @@ mod benchmarks {

// Whitelist voter account from further DB operations.
let voter_key = frame_system::Account::<T>::hashed_key_for(&voter);
frame_benchmarking::benchmarking::add_to_whitelist(voter_key.into());
add_to_whitelist(voter_key.into());

#[extrinsic_call]
_(SystemOrigin::Signed(voter), last_hash, index, approve);
Expand Down Expand Up @@ -264,7 +266,7 @@ mod benchmarks {

// Whitelist voter account from further DB operations.
let voter_key = frame_system::Account::<T>::hashed_key_for(&voter);
frame_benchmarking::benchmarking::add_to_whitelist(voter_key.into());
add_to_whitelist(voter_key.into());

#[extrinsic_call]
close(SystemOrigin::Signed(voter), last_hash, index, Weight::MAX, bytes_in_storage);
Expand Down
9 changes: 8 additions & 1 deletion substrate/frame/alliance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ extern crate alloc;

use alloc::{boxed::Box, vec, vec::Vec};
use codec::{Decode, Encode, MaxEncodedLen};
use frame::{prelude::*, traits::{Dispatchable, Saturating, StaticLookup, Zero}, deps::sp_runtime::DispatchError, derive::DefaultNoBound};
use frame::{
deps::sp_runtime::DispatchError,
prelude::*,
traits::{
ChangeMembers, Currency, Dispatchable, InitializeMembers, OnUnbalanced, ReservableCurrency,
Saturating, StaticLookup, Zero,
},
};
/*
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
Expand Down
4 changes: 3 additions & 1 deletion substrate/frame/alliance/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

use crate::{Config, Pallet, Weight, LOG_TARGET};
//use frame_support::{pallet_prelude::*, storage::migration, traits::OnRuntimeUpgrade};
use frame::{prelude::*, traits::OnRuntimeUpgrade, deps::frame_support::storage::migration};
use frame::{deps::frame_support::storage::migration, prelude::*, traits::OnRuntimeUpgrade};
use log;

/// The in-code storage version.
Expand Down Expand Up @@ -163,6 +163,8 @@ pub(crate) mod v1_to_v2 {
#[cfg(test)]
mod test {
use super::*;
use frame::testing_prelude::assert_ok;
use pretty_assertions::assert_eq;
use crate::{mock::*, MemberRole, Members};

#[test]
Expand Down
19 changes: 17 additions & 2 deletions substrate/frame/alliance/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// limitations under the License.

//! Test utilities

/*
pub use sp_core::H256;
use sp_runtime::traits::Hash;
pub use sp_runtime::{
Expand All @@ -29,6 +29,21 @@ pub use frame_support::{
traits::EitherOfDiverse, BoundedVec,
};
use frame_system::{EnsureRoot, EnsureSignedBy};
*/
use frame::{
deps::{
frame_support::{traits::EitherOfDiverse, BoundedVec},
sp_runtime::traits::{IdentifyAccount, Lazy, Verify},
},
runtime::{
prelude::{
construct_runtime, derive_impl, ord_parameter_types, parameter_types, EnsureRoot,
EnsureSignedBy,
},
testing_prelude::BuildStorage,
},
testing_prelude::{assert_noop, assert_ok},
};
use pallet_identity::{
legacy::{IdentityField, IdentityInfo},
Data, IdentityOf, Judgement, SuperOf,
Expand Down Expand Up @@ -237,7 +252,7 @@ impl Config for Test {

type Block = frame_system::mocking::MockBlock<Test>;

frame_support::construct_runtime!(
construct_runtime!(
pub enum Test
{
System: frame_system,
Expand Down
4 changes: 3 additions & 1 deletion substrate/frame/alliance/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@

//! Tests for the alliance pallet.

/*
use frame_support::{assert_noop, assert_ok};
use frame_system::{EventRecord, Phase};
use sp_runtime::traits::BadOrigin;

*/
use super::*;
use crate::{self as alliance, mock::*};
use frame::{testing_prelude::{assert_noop, assert_ok}, deps::{sp_runtime::DispatchError::BadOrigin, frame_system::{EventRecord, Phase}}};

type AllianceMotionEvent = pallet_collective::Event<Test, pallet_collective::Instance1>;

Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/alliance/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use codec::{Decode, Encode, MaxEncodedLen};
// use frame_support::{traits::ConstU32, BoundedVec};
use scale_info::TypeInfo;
// use sp_runtime::RuntimeDebug;
use frame::{runtime::prelude::ConstU32, derive::RuntimeDebug, deps::frame_support::BoundedVec};
use frame::{deps::frame_support::BoundedVec, derive::RuntimeDebug, runtime::prelude::ConstU32};

/// A Multihash instance that only supports the basic functionality and no hashing.
#[derive(
Expand Down

0 comments on commit 8c9c6cf

Please sign in to comment.