Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

primitives: remove random_seed from BlockBuilder API #8718

Merged
4 commits merged into from
May 4, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,6 @@ impl_runtime_apis! {
) -> sp_inherents::CheckInherentsResult {
data.check_extrinsics(&block)
}

fn random_seed() -> <Block as BlockT>::Hash {
RandomnessCollectiveFlip::random_seed().0
}
}

impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
Expand Down
6 changes: 1 addition & 5 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use frame_support::{
DispatchClass,
},
traits::{
Currency, Imbalance, KeyOwnerProofSystem, OnUnbalanced, Randomness, LockIdentifier,
Currency, Imbalance, KeyOwnerProofSystem, OnUnbalanced, LockIdentifier,
U128CurrencyToVote,
},
};
Expand Down Expand Up @@ -1228,10 +1228,6 @@ impl_runtime_apis! {
fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult {
data.check_extrinsics(&block)
}

fn random_seed() -> <Block as BlockT>::Hash {
pallet_babe::RandomnessFromOneEpochAgo::<Runtime>::random_seed().0
}
}

impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
Expand Down
10 changes: 5 additions & 5 deletions primitives/block-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,29 @@

#![cfg_attr(not(feature = "std"), no_std)]

use sp_inherents::{CheckInherentsResult, InherentData};
use sp_runtime::{traits::Block as BlockT, ApplyExtrinsicResult};

use sp_inherents::{InherentData, CheckInherentsResult};

sp_api::decl_runtime_apis! {
/// The `BlockBuilder` api trait that provides the required functionality for building a block.
#[api_version(4)]
#[api_version(5)]
pub trait BlockBuilder {
/// Apply the given extrinsic.
///
/// Returns an inclusion outcome which specifies if this extrinsic is included in
/// this block or not.
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult;

/// Finish the current block.
#[renamed("finalise_block", 3)]
fn finalize_block() -> <Block as BlockT>::Header;

/// Generate inherent extrinsics. The inherent data will vary from chain to chain.
fn inherent_extrinsics(
inherent: InherentData,
) -> sp_std::vec::Vec<<Block as BlockT>::Extrinsic>;

/// Check that the inherents are valid. The inherent data will vary from chain to chain.
fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult;
/// Generate a random seed.
fn random_seed() -> <Block as BlockT>::Hash;
}
}
8 changes: 0 additions & 8 deletions test-utils/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,10 +665,6 @@ cfg_if! {
fn check_inherents(_block: Block, _data: InherentData) -> CheckInherentsResult {
CheckInherentsResult::new()
}

fn random_seed() -> <Block as BlockT>::Hash {
unimplemented!()
}
}

impl self::TestAPI<Block> for Runtime {
Expand Down Expand Up @@ -922,10 +918,6 @@ cfg_if! {
fn check_inherents(_block: Block, _data: InherentData) -> CheckInherentsResult {
CheckInherentsResult::new()
}

fn random_seed() -> <Block as BlockT>::Hash {
unimplemented!()
}
}

impl self::TestAPI<Block> for Runtime {
Expand Down