From 6b5a88b07c13f534689dc29aeca8a4976f962be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Sat, 19 Nov 2022 12:05:23 +0100 Subject: [PATCH 1/2] Enable try-runtime for contracts-rococo --- 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..1b2f6d2b564 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 From 9cbdf9bd6bc0b4fc18a52bcfd4527c5c236dda97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Thu, 24 Nov 2022 12:44:16 +0100 Subject: [PATCH 2/2] Fix typo from merge --- polkadot-parachain/src/command.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polkadot-parachain/src/command.rs b/polkadot-parachain/src/command.rs index 1b2f6d2b564..0bbe33fcbc0 100644 --- a/polkadot-parachain/src/command.rs +++ b/polkadot-parachain/src/command.rs @@ -628,7 +628,7 @@ pub fn run() -> Result<()> { }), Runtime::ContractsRococo => runner.async_run(|config| { Ok(( - cmd.run::(config), + cmd.run::(config), task_manager, )) }),