mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 12:17:58 +00:00
This reverts commit 6ee39261c8.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use codec::{Encode, Decode};
|
||||
use frame_support::Hashable;
|
||||
use sp_state_machine::TestExternalities as CoreTestExternalities;
|
||||
use sp_core::{NeverNativeValue, NativeOrEncoded, traits::{CodeExecutor, RuntimeCode}};
|
||||
use sp_core::{NeverNativeValue, NativeOrEncoded, traits::CodeExecutor};
|
||||
use sp_runtime::{ApplyExtrinsicResult, traits::{Header as HeaderT, BlakeTwo256}};
|
||||
use sc_executor::{NativeExecutor, WasmExecutionMethod};
|
||||
use sc_executor::error::Result;
|
||||
@@ -71,11 +71,8 @@ pub fn executor_call<
|
||||
native_call: Option<NC>,
|
||||
) -> (Result<NativeOrEncoded<R>>, bool) {
|
||||
let mut t = t.ext();
|
||||
let runtime_code = RuntimeCode::from_externalities(&t)
|
||||
.expect("Code should be part of the externalities");
|
||||
executor().call::<_, R, NC>(
|
||||
&mut t,
|
||||
&runtime_code,
|
||||
method,
|
||||
data,
|
||||
use_native,
|
||||
|
||||
Reference in New Issue
Block a user