From 96144936c78fdb169161a853f4fbf2342aa3456b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Sun, 27 Nov 2022 15:28:24 +0100 Subject: [PATCH] Allow try-runtime for contracts-rococo (#1906) * Enable try-runtime for contracts-rococo * Fix typo from merge --- polkadot-parachain/src/command.rs | 6 ++++++ polkadot-parachain/src/service.rs | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/polkadot-parachain/src/command.rs b/polkadot-parachain/src/command.rs index c436a98dc69..0bbe33fcbc0 100644 --- a/polkadot-parachain/src/command.rs +++ b/polkadot-parachain/src/command.rs @@ -626,6 +626,12 @@ pub fn run() -> Result<()> { task_manager, )) }), + Runtime::ContractsRococo => runner.async_run(|config| { + Ok(( + cmd.run::(config), + task_manager, + )) + }), _ => Err("Chain doesn't support try-runtime".into()), } }, diff --git a/polkadot-parachain/src/service.rs b/polkadot-parachain/src/service.rs index cba3fbdfb35..a239f195a47 100644 --- a/polkadot-parachain/src/service.rs +++ b/polkadot-parachain/src/service.rs @@ -150,6 +150,21 @@ impl sc_executor::NativeExecutionDispatch for CollectivesPolkadotRuntimeExecutor } } +// Native contracts executor instance. +pub struct ContractsRococoRuntimeExecutor; + +impl sc_executor::NativeExecutionDispatch for ContractsRococoRuntimeExecutor { + type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; + + fn dispatch(method: &str, data: &[u8]) -> Option> { + contracts_rococo_runtime::api::dispatch(method, data) + } + + fn native_version() -> sc_executor::NativeVersion { + contracts_rococo_runtime::native_version() + } +} + /// Starts a `ServiceBuilder` for a full service. /// /// Use this macro if you don't actually need the full service, but just the builder in order to