Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
runcomet committed Nov 23, 2024
1 parent a4b0c01 commit 7c38b15
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 31 deletions.
27 changes: 6 additions & 21 deletions substrate/frame/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,17 @@ use codec::{Decode, Encode, MaxEncodedLen};
use frame::{
deps::{
frame_support::{BoundedSlice, BoundedVec, ConsensusEngineId, Parameter},
sp_runtime::{generic::DigestItem, RuntimeAppPublic, BoundToRuntimeAppPublic},
sp_runtime::{generic::DigestItem, BoundToRuntimeAppPublic, RuntimeAppPublic},
},
derive::DefaultNoBound,
prelude::*,
traits::{
DisabledValidators, FindAuthor, Get, IsMember, OnTimestampSet, OneSessionHandler,
SaturatedConversion, Saturating, Zero,
},
derive::DefaultNoBound
};
/*
use frame_support::{
traits::{DisabledValidators, FindAuthor, Get, OnTimestampSet, OneSessionHandler},
BoundedSlice, BoundedVec, ConsensusEngineId, Parameter,
};
*/
use log;
use sp_consensus_aura::{AuthorityIndex, ConsensusLog, Slot, AURA_ENGINE_ID};
/*
use sp_runtime::{
generic::DigestItem,
traits::{IsMember, Member, SaturatedConversion, Saturating, Zero},
RuntimeAppPublic,
};
*/

pub mod migrations;
mod mock;
Expand All @@ -92,14 +79,9 @@ impl<T: pallet_timestamp::Config> Get<T::Moment> for MinimumPeriodTimesTwo<T> {
}
}

// #[frame_support::pallet]
#[frame::pallet]
pub mod pallet {
use super::*;
/*
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
*/

#[pallet::config]
pub trait Config: pallet_timestamp::Config + frame_system::Config {
Expand Down Expand Up @@ -303,7 +285,10 @@ impl<T: Config> Pallet<T> {
<Authorities<T>>::decode_len().ok_or("Failed to decode authorities length")?;

// Check that the authorities are non-empty.
frame::deps::frame_support::ensure!(!authorities_len.is_zero(), "Authorities must be non-empty.");
frame::deps::frame_support::ensure!(
!authorities_len.is_zero(),
"Authorities must be non-empty."
);

// Check that the current authority is not disabled.
let authority_index = *current_slot % authorities_len as u64;
Expand Down
6 changes: 5 additions & 1 deletion substrate/frame/aura/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@

//! Migrations for the AURA pallet.

use frame::{deps::frame_support::{pallet_prelude::*, traits::{Get, StorageInstance}, weights::Weight}};
use frame::deps::frame_support::{
pallet_prelude::*,
traits::{Get, StorageInstance},
weights::Weight,
};

struct __LastTimestamp<T>(core::marker::PhantomData<T>);
impl<T: RemoveLastTimestamp> StorageInstance for __LastTimestamp<T> {
Expand Down
10 changes: 4 additions & 6 deletions substrate/frame/aura/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@
#![cfg(test)]

use crate as pallet_aura;
use frame::{prelude::*, deps::{sp_runtime::{testing::UintAuthorityId, BuildStorage}}, runtime::prelude::{derive_impl, parameter_types,construct_runtime}, traits::{ConstU32, ConstU64, DisabledValidators}};
/*
use frame_support::{
derive_impl, parameter_types,
use frame::{
deps::sp_runtime::{testing::UintAuthorityId, BuildStorage},
prelude::*,
runtime::prelude::{construct_runtime, derive_impl, parameter_types},
traits::{ConstU32, ConstU64, DisabledValidators},
};
*/
use sp_consensus_aura::{ed25519::AuthorityId, AuthorityIndex};
// use sp_runtime::{testing::UintAuthorityId, BuildStorage};

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

Expand Down
7 changes: 4 additions & 3 deletions substrate/frame/aura/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
use super::pallet;
use crate::mock::{build_ext_and_execute_test, Aura, MockDisabledValidators, System, Test};
use codec::Encode;
// use frame_support::traits::OnInitialize;
use frame::deps::{
frame_support::traits::OnInitialize,
sp_runtime::{Digest, DigestItem},
};
use sp_consensus_aura::{Slot, AURA_ENGINE_ID};
// use sp_runtime::{Digest, DigestItem};
use frame::{deps::{frame_support::traits::OnInitialize, sp_runtime::{Digest, DigestItem}}};

#[test]
fn initial_values() {
Expand Down

0 comments on commit 7c38b15

Please sign in to comment.