Revert "Don't include :code by default in storage proofs (#5060)" (#5136)

This reverts commit 6ee39261c8.
This commit is contained in:
Arkadiy Paronyan
2020-03-05 10:55:05 +01:00
committed by GitHub
parent ff2a36d7cb
commit 9a1b3b53f2
31 changed files with 182 additions and 478 deletions
+3 -13
View File
@@ -25,8 +25,8 @@ use node_runtime::constants::currency::*;
use node_testing::keyring::*;
use sp_core::{NativeOrEncoded, NeverNativeValue};
use sp_core::storage::well_known_keys;
use sp_core::traits::{CodeExecutor, RuntimeCode};
use frame_support::Hashable;
use sp_core::traits::CodeExecutor;
use frame_support::Hashable;
use sp_state_machine::TestExternalities as CoreTestExternalities;
use sc_executor::{NativeExecutor, RuntimeInfo, WasmExecutionMethod, Externalities};
use sp_runtime::traits::BlakeTwo256;
@@ -90,12 +90,9 @@ fn construct_block<E: Externalities>(
digest: Default::default(),
};
let runtime_code = RuntimeCode::from_externalities(ext).expect("`ext` provides `:code`");
// execute the block to get the real header.
executor.call::<_, NeverNativeValue, fn() -> _>(
ext,
&runtime_code,
"Core_initialize_block",
&header.encode(),
true,
@@ -105,7 +102,6 @@ fn construct_block<E: Externalities>(
for i in extrinsics.iter() {
executor.call::<_, NeverNativeValue, fn() -> _>(
ext,
&runtime_code,
"BlockBuilder_apply_extrinsic",
&i.encode(),
true,
@@ -115,7 +111,6 @@ fn construct_block<E: Externalities>(
let header = match executor.call::<_, NeverNativeValue, fn() -> _>(
ext,
&runtime_code,
"BlockBuilder_finalize_block",
&[0u8;0],
true,
@@ -171,9 +166,7 @@ fn bench_execute_block(c: &mut Criterion) {
// Get the runtime version to initialize the runtimes cache.
{
let mut test_ext = new_test_ext(&genesis_config);
let runtime_code = RuntimeCode::from_externalities(&test_ext.ext())
.expect("`test_ext` provides `:code`");
executor.runtime_version(&mut test_ext.ext(), &runtime_code).unwrap();
executor.runtime_version(&mut test_ext.ext());
}
let blocks = test_blocks(&genesis_config, &executor);
@@ -181,12 +174,9 @@ fn bench_execute_block(c: &mut Criterion) {
b.iter_batched_ref(
|| new_test_ext(&genesis_config),
|test_ext| {
let runtime_code = RuntimeCode::from_externalities(&test_ext.ext())
.expect("`test_ext` provides `:code`");
for block in blocks.iter() {
executor.call::<_, NeverNativeValue, fn() -> _>(
&mut test_ext.ext(),
&runtime_code,
"Core_execute_block",
&block.0,
use_native,