PR: #31 (feat/06-chainprovider-ws)
File: crates/charon-scanner/src/provider.rs
Lines: 31, 43
Problem: connect returns owned ChainProvider. RootProvider<PubSubFrontend> does not implement Clone. Scanner needs to share provider across at least two concurrent tokio tasks (block subscriber + liquidation executor). Without Arc, callers must unsafely alias reference or restructure entire task topology.
No compile-time assertion that ChainProvider: Send + Sync, so future field addition could silently break task-spawn without clear error.
Impact: Any scanner PR spawning two tasks over same provider fails to compile or requires undocumented Arc wrap not enforced by API.
Fix:
pub async fn connect(...) -> Result<Arc<Self>> {
// ... existing logic ...
Ok(Arc::new(Self { name, ws: provider }))
}
const _: () = {
fn assert_send_sync<T: Send + Sync>() {}
fn check() { assert_send_sync::<ChainProvider>(); }
};
Document in rustdoc that callers Arc::clone per spawned task.
PR: #31 (feat/06-chainprovider-ws)
File: crates/charon-scanner/src/provider.rs
Lines: 31, 43
Problem:
connectreturns ownedChainProvider.RootProvider<PubSubFrontend>does not implementClone. Scanner needs to share provider across at least two concurrent tokio tasks (block subscriber + liquidation executor). WithoutArc, callers must unsafely alias reference or restructure entire task topology.No compile-time assertion that
ChainProvider: Send + Sync, so future field addition could silently break task-spawn without clear error.Impact: Any scanner PR spawning two tasks over same provider fails to compile or requires undocumented Arc wrap not enforced by API.
Fix:
Document in rustdoc that callers
Arc::cloneper spawned task.