From 1cabfab9eaa52adfabe495a55fc6342ec4b01191 Mon Sep 17 00:00:00 2001 From: eNDdy Date: Thu, 28 Aug 2025 14:42:58 -0600 Subject: [PATCH] initial feature flag worker so that we can run xcm integration test --- Makefile | 2 +- common/primitives/src/offchain.rs | 31 +++++++++++++++-------------- node/service/src/common.rs | 6 ++++-- node/service/src/service.rs | 6 +++--- pallets/msa/src/offchain_storage.rs | 7 ++++--- 5 files changed, 28 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 9323c1c206..c3786b8e29 100644 --- a/Makefile +++ b/Makefile @@ -356,7 +356,7 @@ build-bridging-mainnet: cargo build --features frequency,frequency-bridging build-bridging-westend: - cargo build --features frequency-westend,frequency-bridging --release + cargo build --features frequency-westend,frequency-bridging build-bridging-local: cargo build --features frequency-local,frequency-bridging --release diff --git a/common/primitives/src/offchain.rs b/common/primitives/src/offchain.rs index 6832be216e..6fea7db22d 100644 --- a/common/primitives/src/offchain.rs +++ b/common/primitives/src/offchain.rs @@ -9,23 +9,24 @@ extern crate alloc; use alloc::vec::Vec; use core::fmt::Debug; -#[cfg(feature = "std")] -sp_externalities::decl_extension! { - /// Offchain worker custom extension - pub struct OcwCustomExt ( - // rpc address provided to offchain worker - Vec - ); -} +// #[cfg(feature = "std")] +// sp_externalities::decl_extension! { +// /// Offchain worker custom extension +// pub struct OcwCustomExt ( +// // rpc address provided to offchain worker +// Vec +// ); +// } /// runtime new customized -#[runtime_interface] -pub trait Custom: ExternalitiesExt { - /// another function - fn get_val(&mut self) -> Option> { - self.extension::().map(|ext| ext.0.clone()) - } -} +// #[runtime_interface] +// pub trait Custom: ExternalitiesExt { +// /// another function +// fn get_val(&mut self) -> Option> { +// self.extension::().map(|ext| ext.0.clone()) +// } +// } + /// Lock expiration timeout in milli-seconds for msa pallet per msa account pub const MSA_ACCOUNT_LOCK_TIMEOUT_EXPIRATION_MS: u64 = 50; /// Lock name prefix for msa account diff --git a/node/service/src/common.rs b/node/service/src/common.rs index f1ba2ee445..4252009112 100644 --- a/node/service/src/common.rs +++ b/node/service/src/common.rs @@ -1,6 +1,7 @@ #![allow(missing_docs)] use crate::service::ParachainClient; -use common_primitives::{node::Block, offchain::OcwCustomExt}; +use common_primitives::node::Block; +// use common_primitives::offchain::OcwCustomExt; use sc_client_api::Backend; use sc_offchain::NetworkProvider; use sc_service::{config::RpcEndpoint, TFullBackend, TaskManager}; @@ -58,7 +59,8 @@ pub fn start_offchain_workers( transaction_pool, network_provider, enable_http_requests: true, - custom_extensions: move |_hash| vec![Box::new(OcwCustomExt(rpc_address.clone())) as Box<_>], + custom_extensions: move |_hash| vec![], + // custom_extensions: move |_hash| vec![Box::new(OcwCustomExt(rpc_address.clone())) as Box<_>], }) .expect("Could not create Offchain Worker"); diff --git a/node/service/src/service.rs b/node/service/src/service.rs index 6aa4dd7ea6..3bef080ed6 100644 --- a/node/service/src/service.rs +++ b/node/service/src/service.rs @@ -57,14 +57,14 @@ type MaybeFullSelectChain = Option>; #[cfg(not(feature = "runtime-benchmarks"))] type HostFunctions = ( cumulus_client_service::ParachainHostFunctions, - common_primitives::offchain::custom::HostFunctions, + // common_primitives::offchain::custom::HostFunctions, ); #[cfg(feature = "runtime-benchmarks")] type HostFunctions = ( cumulus_client_service::ParachainHostFunctions, frame_benchmarking::benchmarking::HostFunctions, - common_primitives::offchain::custom::HostFunctions, + // common_primitives::offchain::custom::HostFunctions, ); use crate::common::start_offchain_workers; @@ -203,7 +203,7 @@ pub async fn start_parachain_node( override_pool_config: Option, ) -> sc_service::error::Result<(TaskManager, Arc)> { use crate::common::listen_addrs_to_normalized_strings; - use common_primitives::offchain::OcwCustomExt; + // use common_primitives::offchain::OcwCustomExt; use sc_client_db::Backend; let parachain_config = prepare_node_config(parachain_config); diff --git a/pallets/msa/src/offchain_storage.rs b/pallets/msa/src/offchain_storage.rs index 5958eda968..4ee78be0cd 100644 --- a/pallets/msa/src/offchain_storage.rs +++ b/pallets/msa/src/offchain_storage.rs @@ -455,12 +455,13 @@ pub struct FinalizedBlockResponse { /// fetches finalized block hash from rpc fn fetch_finalized_block_hash() -> Result { // we are not able to use the custom extension in benchmarks due to feature conflict - let rpc_address = if cfg!(feature = "runtime-benchmarks") { + let rpc_address: Vec = if cfg!(feature = "runtime-benchmarks") { RPC_FINALIZED_BLOCK_REQUEST_URL.into() } else { + RPC_FINALIZED_BLOCK_REQUEST_URL.into() // rpc address provided to offchain worker via custom extension - common_primitives::offchain::custom::get_val() - .unwrap_or(RPC_FINALIZED_BLOCK_REQUEST_URL.into()) + // common_primitives::offchain::custom::get_val() + // .unwrap_or(RPC_FINALIZED_BLOCK_REQUEST_URL.into()) }; let url = core::str::from_utf8(&rpc_address) .map_err(|_| sp_runtime::offchain::http::Error::Unknown)?;