Remove native call (#12201)

* Remove native call

With the recent introduction of staging runtime apis the native call wasn't supported anymore. This
removes the entire support for this as it is not used anymore.

* FMT

* Fix benchmarks

* FIX ui tests
This commit is contained in:
Bastian Köcher
2022-09-12 11:25:56 +01:00
committed by GitHub
parent 5647e71947
commit b356a5589a
17 changed files with 211 additions and 705 deletions
+5 -10
View File
@@ -18,13 +18,11 @@
//! A method call executor interface.
use codec::{Decode, Encode};
use sc_executor::{RuntimeVersion, RuntimeVersionOf};
use sp_core::NativeOrEncoded;
use sp_externalities::Extensions;
use sp_runtime::{generic::BlockId, traits::Block as BlockT};
use sp_state_machine::{ExecutionManager, ExecutionStrategy, OverlayedChanges, StorageProof};
use std::{cell::RefCell, panic::UnwindSafe, result};
use std::cell::RefCell;
use crate::execution_extensions::ExecutionExtensions;
use sp_api::{ProofRecorder, StorageTransactionCache};
@@ -68,11 +66,9 @@ pub trait CallExecutor<B: BlockT>: RuntimeVersionOf {
/// of the execution context.
fn contextual_call<
EM: Fn(
Result<NativeOrEncoded<R>, Self::Error>,
Result<NativeOrEncoded<R>, Self::Error>,
) -> Result<NativeOrEncoded<R>, Self::Error>,
R: Encode + Decode + PartialEq,
NC: FnOnce() -> result::Result<R, sp_api::ApiError> + UnwindSafe,
Result<Vec<u8>, Self::Error>,
Result<Vec<u8>, Self::Error>,
) -> Result<Vec<u8>, Self::Error>,
>(
&self,
at: &BlockId<B>,
@@ -85,10 +81,9 @@ pub trait CallExecutor<B: BlockT>: RuntimeVersionOf {
>,
>,
execution_manager: ExecutionManager<EM>,
native_call: Option<NC>,
proof_recorder: &Option<ProofRecorder<B>>,
extensions: Option<Extensions>,
) -> sp_blockchain::Result<NativeOrEncoded<R>>
) -> sp_blockchain::Result<Vec<u8>>
where
ExecutionManager<EM>: Clone;
@@ -201,11 +201,11 @@ impl<Block: traits::Block> ExecutionExtensions<Block> {
///
/// Based on the execution context and capabilities it produces
/// the right manager and extensions object to support desired set of APIs.
pub fn manager_and_extensions<E: std::fmt::Debug, R: codec::Codec>(
pub fn manager_and_extensions<E: std::fmt::Debug>(
&self,
at: &BlockId<Block>,
context: ExecutionContext,
) -> (ExecutionManager<DefaultHandler<R, E>>, Extensions) {
) -> (ExecutionManager<DefaultHandler<E>>, Extensions) {
let manager = match context {
ExecutionContext::BlockConstruction => self.strategies.block_construction.get_manager(),
ExecutionContext::Syncing => self.strategies.syncing.get_manager(),