Skip to content

Commit

Permalink
feat(kreivo-runtime): make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
pandres95 committed Jan 5, 2025
1 parent 25ae3e1 commit 900fdff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions runtime/kreivo/src/communities/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ use {
sp_runtime::Perbill,
};

type MembershipsManagementCollection =
frame_support::traits::nonfungible_v2::ItemOf<CommunityMemberships, MembershipsCollectionId, AccountId>;

type CreationPayment = Option<(Balance, AccountId, AccountId)>;

parameter_types! {
Expand Down Expand Up @@ -114,6 +111,10 @@ impl pallet_communities_manager::Config for Runtime {
#[cfg(feature = "runtime-benchmarks")]
pub struct CommunityBenchmarkHelper;

#[cfg(feature = "runtime-benchmarks")]
type MembershipsManagementCollection =
frame_support::traits::nonfungible_v2::ItemOf<CommunityMemberships, MembershipsCollectionId, AccountId>;

#[cfg(feature = "runtime-benchmarks")]
impl BenchmarkHelper<Runtime> for CommunityBenchmarkHelper {
fn community_id() -> CommunityIdOf<Runtime> {
Expand Down
8 changes: 4 additions & 4 deletions runtime/kreivo/src/configuration/system_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,18 @@ parameter_types! {
}

/// A [`Challenger`][`fc_traits_authn::Challenger`] which verifies the
/// block hash of a block of a given block that's within the last `PastBlocks`.
pub struct BlockHashChallenger<const PastBlocks: BlockNumber>;
/// block hash of a block of a given block that's within the last `PAST_BLOCKS`.
pub struct BlockHashChallenger<const PAST_BLOCKS: BlockNumber>;

impl<const PastBlocks: BlockNumber> Challenger for BlockHashChallenger<PastBlocks> {
impl<const PAST_BLOCKS: BlockNumber> Challenger for BlockHashChallenger<PAST_BLOCKS> {
type Context = BlockNumber;

fn generate(cx: &Self::Context) -> Challenge {
System::block_hash(cx).0
}

fn check_challenge(cx: &Self::Context, challenge: &[u8]) -> Option<()> {
(*cx >= System::block_number().saturating_sub(PastBlocks)).then_some(())?;
(*cx >= System::block_number().saturating_sub(PAST_BLOCKS)).then_some(())?;
Self::generate(cx).eq(challenge).then_some(())
}
}
Expand Down

0 comments on commit 900fdff

Please sign in to comment.