Remove inherent in pallet-babe (#8124)

This commit is contained in:
Guillaume Thiolliere
2021-02-16 19:03:59 +01:00
committed by GitHub
parent f49aae65a8
commit f35a27cca0
10 changed files with 66 additions and 57 deletions
+15 -1
View File
@@ -19,6 +19,7 @@ use codec::{Encode, Decode};
use frame_system::offchain::AppCrypto;
use frame_support::Hashable;
use sp_state_machine::TestExternalities as CoreTestExternalities;
use sp_consensus_babe::{BABE_ENGINE_ID, Slot, digests::{PreDigest, SecondaryPlainPreDigest}};
use sp_core::{
NeverNativeValue, NativeOrEncoded,
crypto::KeyTypeId,
@@ -29,6 +30,8 @@ use sp_runtime::{
ApplyExtrinsicResult,
MultiSigner,
MultiSignature,
Digest,
DigestItem,
traits::{Header as HeaderT, BlakeTwo256},
};
use sc_executor::{NativeExecutor, WasmExecutionMethod};
@@ -145,6 +148,7 @@ pub fn construct_block(
number: BlockNumber,
parent_hash: Hash,
extrinsics: Vec<CheckedExtrinsic>,
babe_slot: Slot,
) -> (Vec<u8>, Hash) {
use sp_trie::{TrieConfiguration, trie_types::Layout};
@@ -162,7 +166,17 @@ pub fn construct_block(
number,
extrinsics_root,
state_root: Default::default(),
digest: Default::default(),
digest: Digest {
logs: vec![
DigestItem::PreRuntime(
BABE_ENGINE_ID,
PreDigest::SecondaryPlain(SecondaryPlainPreDigest {
slot: babe_slot,
authority_index: 42,
}).encode()
),
],
},
};
// execute the block to get the real header.