Improve CodeExecutor (#2358)

Since `sp-state-machine` and `GenesisConfigBuilderRuntimeCaller` always
set `use_native` to be false.
We should remove this param and make `NativeElseWasmExecutor` behave
like its name.
It could make the above components use the correct execution strategy.

Maybe polkadot do not need about `NativeElseWasmExecutor` anymore. But
it is still needed by other chains and it's useful for debugging.

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: command-bot <>
Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
This commit is contained in:
yjh
2023-11-29 21:48:32 +08:00
committed by GitHub
parent 63ac2471aa
commit f2fe6a4c56
9 changed files with 56 additions and 81 deletions
+1 -11
View File
@@ -103,14 +103,7 @@ fn construct_block<E: Externalities>(
// execute the block to get the real header.
executor
.call(
ext,
&runtime_code,
"Core_initialize_block",
&header.encode(),
true,
CallContext::Offchain,
)
.call(ext, &runtime_code, "Core_initialize_block", &header.encode(), CallContext::Offchain)
.0
.unwrap();
@@ -121,7 +114,6 @@ fn construct_block<E: Externalities>(
&runtime_code,
"BlockBuilder_apply_extrinsic",
&i.encode(),
true,
CallContext::Offchain,
)
.0
@@ -135,7 +127,6 @@ fn construct_block<E: Externalities>(
&runtime_code,
"BlockBuilder_finalize_block",
&[0u8; 0],
true,
CallContext::Offchain,
)
.0
@@ -200,7 +191,6 @@ fn bench_execute_block(c: &mut Criterion) {
&runtime_code,
"Core_execute_block",
&block.0,
false,
CallContext::Offchain,
)
.0