@@ -23,13 +23,13 @@ use crate::{
2323 StorageOverrideHandler ,
2424 } ,
2525} ;
26- use futures:: { future, prelude :: * , FutureExt } ;
26+ use futures:: { future, FutureExt } ;
2727use sc_client_api:: { Backend , BlockBackend } ;
2828use sc_consensus:: BasicQueue ;
2929use sc_consensus_babe:: BabeWorkerHandle ;
3030use sc_consensus_grandpa:: SharedVoterState ;
3131#[ allow( deprecated) ]
32- pub use sc_executor:: NativeElseWasmExecutor ;
32+ pub use sc_executor:: WasmExecutor ;
3333use sc_service:: { error:: Error as ServiceError , Configuration , TaskManager } ;
3434use sc_telemetry:: { Telemetry , TelemetryHandle , TelemetryWorker } ;
3535use sc_transaction_pool_api:: OffchainTransactionPoolFactory ;
@@ -48,63 +48,13 @@ use tangle_testnet_runtime::{self, RuntimeApi, TransactionConverter};
4848/// imported and generated.
4949const GRANDPA_JUSTIFICATION_PERIOD : u32 = 512 ;
5050
51- #[ cfg( not( feature = "testnet" ) ) ]
52- pub mod tangle {
53- // Our native executor instance.
54- pub struct ExecutorDispatch ;
55-
56- impl sc_executor:: NativeExecutionDispatch for ExecutorDispatch {
57- /// Only enable the benchmarking host functions when we actually want to benchmark.
58- #[ cfg( feature = "runtime-benchmarks" ) ]
59- type ExtendHostFunctions =
60- ( frame_benchmarking:: benchmarking:: HostFunctions , primitives_ext:: ext:: HostFunctions ) ;
61- /// Otherwise we only use the default Substrate host functions.
62- #[ cfg( not( feature = "runtime-benchmarks" ) ) ]
63- type ExtendHostFunctions = primitives_ext:: ext:: HostFunctions ;
64-
65- fn dispatch ( method : & str , data : & [ u8 ] ) -> Option < Vec < u8 > > {
66- tangle_runtime:: api:: dispatch ( method, data)
67- }
68-
69- fn native_version ( ) -> sc_executor:: NativeVersion {
70- tangle_runtime:: native_version ( )
71- }
72- }
73- }
74-
75- #[ cfg( feature = "testnet" ) ]
76- pub mod testnet {
77- // Our native executor instance.
78- pub struct ExecutorDispatch ;
79-
80- impl sc_executor:: NativeExecutionDispatch for ExecutorDispatch {
81- /// Only enable the benchmarking host functions when we actually want to benchmark.
82- #[ cfg( feature = "runtime-benchmarks" ) ]
83- type ExtendHostFunctions =
84- ( frame_benchmarking:: benchmarking:: HostFunctions , primitives_ext:: ext:: HostFunctions ) ;
85- /// Otherwise we only use the default Substrate host functions.
86- #[ cfg( not( feature = "runtime-benchmarks" ) ) ]
87- type ExtendHostFunctions = primitives_ext:: ext:: HostFunctions ;
88-
89- fn dispatch ( method : & str , data : & [ u8 ] ) -> Option < Vec < u8 > > {
90- tangle_testnet_runtime:: api:: dispatch ( method, data)
91- }
92-
93- fn native_version ( ) -> sc_executor:: NativeVersion {
94- tangle_testnet_runtime:: native_version ( )
95- }
96- }
97- }
98-
9951#[ cfg( not( feature = "testnet" ) ) ]
10052#[ allow( deprecated) ]
101- pub ( crate ) type FullClient =
102- sc_service:: TFullClient < Block , RuntimeApi , NativeElseWasmExecutor < tangle:: ExecutorDispatch > > ;
53+ pub ( crate ) type FullClient = sc_service:: TFullClient < Block , RuntimeApi , WasmExecutor > ;
10354
10455#[ cfg( feature = "testnet" ) ]
10556#[ allow( deprecated) ]
106- pub ( crate ) type FullClient =
107- sc_service:: TFullClient < Block , RuntimeApi , NativeElseWasmExecutor < testnet:: ExecutorDispatch > > ;
57+ pub ( crate ) type FullClient = sc_service:: TFullClient < Block , RuntimeApi , WasmExecutor > ;
10858
10959pub ( crate ) type FullBackend = sc_service:: TFullBackend < Block > ;
11060type FullSelectChain = sc_consensus:: LongestChain < FullBackend , Block > ;
@@ -174,8 +124,12 @@ where
174124 } )
175125 . transpose ( ) ?;
176126
177- #[ allow( deprecated) ]
178- let executor = sc_service:: new_native_or_wasm_executor ( config) ;
127+ // Create the WasmExecutor with allow_missing_host_functions flag set to true
128+ let executor = WasmExecutor :: builder ( )
129+ . with_max_runtime_instances ( config. max_runtime_instances )
130+ . with_runtime_cache_size ( config. runtime_cache_size )
131+ . with_allow_missing_host_functions ( true )
132+ . build ( ) ;
179133
180134 let ( client, backend, keystore_container, task_manager) =
181135 sc_service:: new_full_parts :: < Block , RuntimeApi , _ > (
0 commit comments