mirror of
https://git.ghostchain.io/proxmio/ghost-node.git
synced 2025-12-27 03:09:56 +00:00
rustfmt the ghost-slow-clap pallet
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
@@ -2,13 +2,15 @@
|
||||
|
||||
use frame_support::{
|
||||
derive_impl, parameter_types,
|
||||
traits::{ConstU32, ConstU64}, weights::Weight,
|
||||
traits::{ConstU32, ConstU64},
|
||||
weights::Weight,
|
||||
};
|
||||
use frame_system::EnsureRoot;
|
||||
use pallet_session::historical as pallet_session_historical;
|
||||
use sp_runtime::{
|
||||
curve::PiecewiseLinear,
|
||||
testing::{TestXt, UintAuthorityId},
|
||||
traits::ConvertInto, curve::PiecewiseLinear,
|
||||
traits::ConvertInto,
|
||||
Permill,
|
||||
};
|
||||
use sp_staking::{
|
||||
@@ -36,8 +38,8 @@ frame_support::construct_runtime!(
|
||||
|
||||
parameter_types! {
|
||||
pub static Validators: Option<Vec<u64>> = Some(vec![
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
]);
|
||||
}
|
||||
@@ -53,13 +55,10 @@ impl pallet_session::SessionManager<u64> for TestSessionManager {
|
||||
|
||||
impl pallet_session::historical::SessionManager<u64, u64> for TestSessionManager {
|
||||
fn new_session(_new_index: SessionIndex) -> Option<Vec<(u64, u64)>> {
|
||||
Validators::mutate(|l| l
|
||||
.take()
|
||||
.map(|validators| validators
|
||||
.iter()
|
||||
.map(|v| (*v, *v))
|
||||
.collect())
|
||||
)
|
||||
Validators::mutate(|l| {
|
||||
l.take()
|
||||
.map(|validators| validators.iter().map(|v| (*v, *v)).collect())
|
||||
})
|
||||
}
|
||||
fn end_session(_: SessionIndex) {}
|
||||
fn start_session(_: SessionIndex) {}
|
||||
@@ -94,11 +93,10 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
result.execute_with(|| {
|
||||
for i in 1..=3 {
|
||||
System::inc_providers(&i);
|
||||
assert_eq!(Session::set_keys(
|
||||
RuntimeOrigin::signed(i),
|
||||
i.into(),
|
||||
vec![],
|
||||
), Ok(()));
|
||||
assert_eq!(
|
||||
Session::set_keys(RuntimeOrigin::signed(i), i.into(), vec![],),
|
||||
Ok(())
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -150,7 +148,7 @@ impl frame_support::traits::EstimateNextSessionRotation<u64> for TestNextSession
|
||||
}
|
||||
|
||||
fn estimate_current_session_progress(now: u64) -> (Option<Permill>, Weight) {
|
||||
let (estimate, weight) =
|
||||
let (estimate, weight) =
|
||||
pallet_session::PeriodicSessions::<Period, Offset>::estimate_current_session_progress(
|
||||
now,
|
||||
);
|
||||
@@ -257,8 +255,7 @@ pub fn advance_session_with_authority(authority: u64) {
|
||||
UintAuthorityId::from(69),
|
||||
UintAuthorityId::from(420),
|
||||
UintAuthorityId::from(1337),
|
||||
]
|
||||
],
|
||||
);
|
||||
assert_eq!(session_index, (now / Period::get()) as u32);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user