Remove execute_extrinsics_without_checks as it will not be required (#2145)

This functionality was added by me for Cumulus, but after better
understanding Cumulus, this will not be required.
This commit is contained in:
Bastian Köcher
2019-04-01 15:37:59 +02:00
committed by Gav Wood
parent eca163ba64
commit 137409f02a
5 changed files with 9 additions and 35 deletions
+7 -15
View File
@@ -21,7 +21,7 @@ use rstd::prelude::*;
use runtime_io::{storage_root, enumerated_trie_root, storage_changes_root, twox_128};
use runtime_support::storage::{self, StorageValue, StorageMap};
use runtime_support::storage_items;
use runtime_primitives::traits::{Hash as HashT, BlakeTwo256, Digest as DigestT, NumberFor, Block as BlockT};
use runtime_primitives::traits::{Hash as HashT, BlakeTwo256, Digest as DigestT};
use runtime_primitives::generic;
use runtime_primitives::{ApplyError, ApplyOutcome, ApplyResult, transaction_validity::TransactionValidity};
use parity_codec::{KeyedVec, Encode};
@@ -70,15 +70,6 @@ pub fn initialize_block(header: &Header) {
storage::unhashed::put(well_known_keys::EXTRINSIC_INDEX, &0u32);
}
fn execute_extrinsics_without_checks(extrinsics: Vec<<Block as BlockT>::Extrinsic>) {
// execute transactions
extrinsics.into_iter().enumerate().for_each(|(i, e)| {
storage::unhashed::put(well_known_keys::EXTRINSIC_INDEX, &(i as u32));
execute_transaction_backend(&e).unwrap_or_else(|_| panic!("Invalid transaction"));
storage::unhashed::kill(well_known_keys::EXTRINSIC_INDEX);
});
}
/// Actually execute all transitioning for `block`.
pub fn polish_block(block: &mut Block) {
let header = &mut block.header;
@@ -120,7 +111,12 @@ pub fn execute_block(block: Block) {
info_expect_equal_hash(&txs_root, &header.extrinsics_root);
assert!(txs_root == header.extrinsics_root, "Transaction trie root must be valid.");
execute_extrinsics_without_checks(block.extrinsics);
// execute transactions
block.extrinsics.into_iter().enumerate().for_each(|(i, e)| {
storage::unhashed::put(well_known_keys::EXTRINSIC_INDEX, &(i as u32));
execute_transaction_backend(&e).unwrap_or_else(|_| panic!("Invalid transaction"));
storage::unhashed::kill(well_known_keys::EXTRINSIC_INDEX);
});
// check storage root.
let storage_root = storage_root().into();
@@ -145,10 +141,6 @@ impl executive::ExecuteBlock<Block> for BlockExecutor {
fn execute_block(block: Block) {
execute_block(block);
}
fn execute_extrinsics_without_checks(_: NumberFor<Block>, extrinsics: Vec<<Block as BlockT>::Extrinsic>) {
execute_extrinsics_without_checks(extrinsics);
}
}
/// Execute a transaction outside of the block execution function.