From 3037b97faa0c79cd70d27eb9c2d7dac14276e737 Mon Sep 17 00:00:00 2001 From: Celestial Date: Thu, 9 Apr 2026 15:26:28 +0200 Subject: [PATCH 1/2] chore(ci): make arch check portable --- scripts/arch-check.sh | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/scripts/arch-check.sh b/scripts/arch-check.sh index 1d101b53..85f8752e 100755 --- a/scripts/arch-check.sh +++ b/scripts/arch-check.sh @@ -13,7 +13,7 @@ search_rust_files() { shift 2 if has_rg; then - rg -n "$@" "${pattern}" >"${output_file}" + rg -n "${pattern}" "$@" >"${output_file}" return fi @@ -40,15 +40,6 @@ check_forbidden_import() { local forbidden_target="$2" local match_file="/tmp/sof-arch-check-${src_slice}-${forbidden_target}.log" - if has_rg; then - if rg -n --glob '!**/tests.rs' "crate::${forbidden_target}\b" "crates/sof-observer/src/${src_slice}" >"${match_file}"; then - echo "ARD boundary violation: '${src_slice}' must not import '${forbidden_target}'" - cat "${match_file}" - violations=1 - fi - return - fi - if search_rust_files \ "${match_file}" \ "crate::${forbidden_target}" \ From 212096993a70cbdcd700e49ae374addba504c9d5 Mon Sep 17 00:00:00 2001 From: Celestial Date: Thu, 9 Apr 2026 15:26:28 +0200 Subject: [PATCH 2/2] refactor(runtime): trim import path noise --- crates/sof-observer/src/framework/host.rs | 13 +++++++------ crates/sof-observer/src/runtime.rs | 11 +++++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/crates/sof-observer/src/framework/host.rs b/crates/sof-observer/src/framework/host.rs index 20b0d16d..33dcc647 100644 --- a/crates/sof-observer/src/framework/host.rs +++ b/crates/sof-observer/src/framework/host.rs @@ -8,13 +8,14 @@ use std::{ thread, }; +use crate::event::TxCommitmentStatus; use crate::framework::{ events::{ ClusterTopologyEvent, DatasetEvent, LeaderScheduleEntry, LeaderScheduleEvent, ObservedRecentBlockhashEvent, RawPacketEvent, ReorgEvent, ShredEvent, SlotStatusEvent, TransactionBatchEvent, TransactionEvent, }, - plugin::{ObserverPlugin, PluginConfig}, + plugin::{ObserverPlugin, PluginConfig, TransactionDispatchMode}, }; use arcshift::ArcShift; use solana_pubkey::Pubkey; @@ -65,7 +66,7 @@ pub struct PluginHostStartupError { /// Chooses a bounded default worker count for accepted-transaction dispatch. fn default_transaction_dispatch_workers() -> usize { - std::thread::available_parallelism() + thread::available_parallelism() .map(usize::from) .unwrap_or(1) .clamp(1, DEFAULT_TRANSACTION_DISPATCH_WORKERS_CAP) @@ -138,7 +139,7 @@ struct PluginHookSubscriptions { /// At least one plugin wants transaction callbacks. transaction: bool, /// Lowest commitment required by any transaction subscriber. - transaction_min_commitment: crate::event::TxCommitmentStatus, + transaction_min_commitment: TxCommitmentStatus, /// At least one transaction plugin exposes a compiled prefilter. transaction_prefilter: bool, /// At least one plugin wants transaction-log callbacks. @@ -187,19 +188,19 @@ impl From<&PluginConfig> for PluginHookSubscriptions { inline_transaction: config.transaction && matches!( config.transaction_dispatch_mode, - crate::framework::plugin::TransactionDispatchMode::Inline + TransactionDispatchMode::Inline ), transaction_batch: config.transaction_batch, inline_transaction_batch: config.transaction_batch && matches!( config.transaction_batch_dispatch_mode, - crate::framework::plugin::TransactionDispatchMode::Inline + TransactionDispatchMode::Inline ), transaction_view_batch: config.transaction_view_batch, inline_transaction_view_batch: config.transaction_view_batch && matches!( config.transaction_view_batch_dispatch_mode, - crate::framework::plugin::TransactionDispatchMode::Inline + TransactionDispatchMode::Inline ), account_touch: config.account_touch, account_update: config.account_update, diff --git a/crates/sof-observer/src/runtime.rs b/crates/sof-observer/src/runtime.rs index e8c1070b..c1773106 100644 --- a/crates/sof-observer/src/runtime.rs +++ b/crates/sof-observer/src/runtime.rs @@ -10,6 +10,7 @@ use std::{ path::PathBuf, pin::Pin, sync::Arc, + thread, time::Instant, }; @@ -21,6 +22,8 @@ use crate::framework::{ DerivedStateHost, DerivedStateReplayBackend, DerivedStateReplayDurability, PluginHost, RuntimeExtensionHost, TransactionEvent, }; +#[cfg(feature = "kernel-bypass")] +use crate::ingest::{RawPacketBatchReceiver, RawPacketBatchSender, create_raw_packet_batch_queue}; use crate::{ app::runtime as app_runtime, event::TxCommitmentStatus, framework, provider_stream, runtime_env, }; @@ -2911,7 +2914,7 @@ async fn wait_for_termination_signal() { #[cfg(unix)] { let (shutdown_tx, shutdown_rx) = tokio::sync::oneshot::channel(); - std::thread::spawn(move || { + thread::spawn(move || { let mut signals = match signal_hook::iterator::Signals::new([ signal_hook::consts::signal::SIGTERM, signal_hook::consts::signal::SIGINT, @@ -3051,11 +3054,11 @@ pub async fn run_async_with_hosts_and_derived_state_host_and_setup( /// External ingress sender type used by `kernel-bypass` integrations. /// /// Producers publish [`crate::ingest::RawPacketBatch`] values through this queue. -pub type KernelBypassIngressSender = crate::ingest::RawPacketBatchSender; +pub type KernelBypassIngressSender = RawPacketBatchSender; #[cfg(feature = "kernel-bypass")] /// External ingress receiver type used by `kernel-bypass` integrations. -pub type KernelBypassIngressReceiver = crate::ingest::RawPacketBatchReceiver; +pub type KernelBypassIngressReceiver = RawPacketBatchReceiver; #[cfg(feature = "kernel-bypass")] /// Creates a kernel-bypass ingress queue pair. @@ -3065,7 +3068,7 @@ pub type KernelBypassIngressReceiver = crate::ingest::RawPacketBatchReceiver; #[must_use] pub fn create_kernel_bypass_ingress_queue() -> (KernelBypassIngressSender, KernelBypassIngressReceiver) { - crate::ingest::create_raw_packet_batch_queue() + create_raw_packet_batch_queue() } #[cfg(feature = "kernel-bypass")]