lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README

commit 2d157f928e7cccad7a60d060718db448ec5905e8
parent c0ba705ff19c5951ab5ed84dc0e2d4cf5af7c577
Author: triesap <tyson@radroots.org>
Date:   Thu,  9 Jul 2026 01:37:32 +0000

sdk: rename Nostr transport features

- replace relay-named SDK feature gates with transport-nostr names
- expose the Nostr adapter module without the relay module alias
- update README, examples, and tests for the breaking feature map
- verify SDK tests, generators, and xtask checks

Diffstat:
Mcrates/sdk/Cargo.toml | 8++++----
Mcrates/sdk/README | 10+++++-----
Mcrates/sdk/examples/runtime_local.rs | 4++--
Mcrates/sdk/src/adapters/mod.rs | 4++--
Acrates/sdk/src/adapters/nostr.rs | 74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dcrates/sdk/src/adapters/relay.rs | 74--------------------------------------------------------------------------
Mcrates/sdk/src/lib.rs | 2+-
Mcrates/sdk/src/orders_runtime.rs | 144++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mcrates/sdk/src/sync_runtime.rs | 10+++++-----
Mcrates/sdk/tests/orders_runtime.rs | 82++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mcrates/sdk/tests/runtime_foundation.rs | 2+-
Mcrates/sdk/tests/source_boundary.rs | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mcrates/sdk/tests/sync_runtime.rs | 4++--
Mcrates/sdk/tests/trade_public_api.rs | 8++++----
Rcrates/sdk/tests/unit/adapters_relay_tests.rs -> crates/sdk/tests/unit/adapters_nostr_tests.rs | 0
Mcrates/sdk/tests/unit/error_tests.rs | 2+-
16 files changed, 277 insertions(+), 214 deletions(-)

diff --git a/crates/sdk/Cargo.toml b/crates/sdk/Cargo.toml @@ -37,7 +37,7 @@ identity-models = [ ] identity-storage = ["identity-models", "std", "radroots_identity/std"] signing = ["dep:nostr", "dep:radroots_nostr", "nostr"] -relay-client = ["signing", "std", "serde_json", "radroots_nostr/client"] +transport-nostr-client = ["signing", "std", "serde_json", "radroots_nostr/client"] radrootsd-proxy = [ "std", "serde_json", @@ -89,7 +89,7 @@ runtime = [ "radroots_trade/event_store", ] local-signer = ["runtime", "radroots_authority/local_signer"] -relay-runtime = [ +transport-nostr-runtime = [ "runtime", "dep:radroots_nostr", "radroots_nostr/client", @@ -101,8 +101,8 @@ local-runtime = [ "serde_json", "runtime", "signer-adapters", - "relay-runtime", - "relay-client", + "transport-nostr-runtime", + "transport-nostr-client", ] local-runtime-radrootsd-proxy = [ "std", diff --git a/crates/sdk/README b/crates/sdk/README @@ -35,7 +35,7 @@ clock at enqueue time. Listing enqueue receipts report mutation state with the p `StoredAndQueued` and `AlreadyQueued`. `sdk.sync().push_outbox(...)` is the product sync entrypoint. It publishes queued signed outbox work -when `relay-runtime` is enabled. Push time uses the delivery targets already stored on each queued +when `transport-nostr-runtime` is enabled. Push time uses the delivery targets already stored on each queued outbox event, so already queued work does not require a configured builder profile. Nostr transport publishing and the `radrootsd-proxy` Publish Proxy transport consume signed outbox events; neither transport owns signing. `push_outbox_with_adapter(...)` remains available for tests and controlled @@ -58,9 +58,9 @@ actions. Runtime-only builds intentionally expose no buyer write handle and no t DTOs. DVM proof requests and validation receipt ingestion use `sdk.dvm()`. The `local-runtime` feature is the curated feature bundle for local product runtime consumers. It -enables `std`, `serde`, `serde_json`, `runtime`, `signer-adapters`, `relay-runtime`, and -`relay-client`. `signer-adapters` contains the SDK `local_key` and `myc_nip46` signing surface. -`relay-client` supplies the Nostr relay WebSocket publish adapter used when signed outbox work +enables `std`, `serde`, `serde_json`, `runtime`, `signer-adapters`, `transport-nostr-runtime`, and +`transport-nostr-client`. `signer-adapters` contains the SDK `local_key` and `myc_nip46` signing surface. +`transport-nostr-client` supplies the Nostr relay WebSocket publish adapter used when signed outbox work targets Nostr relay URLs. `local-runtime-radrootsd-proxy` uses daemon-resolved publishing through `publish.event` and the same configured signer provider API. @@ -107,7 +107,7 @@ Optional advanced substrate is explicitly feature-scoped: - `identity-models`: identity data types without local storage coupling - `identity-storage`: encrypted identity-file helpers - `signing`: Nostr builder and local signing adapters -- `relay-client`: relay client and publish adapters +- `transport-nostr-client`: Nostr relay WebSocket client and publish adapters - `signer-adapters`: SDK local-key and Myc NIP-46 signer providers plus configured-signer product write APIs diff --git a/crates/sdk/examples/runtime_local.rs b/crates/sdk/examples/runtime_local.rs @@ -55,12 +55,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { prepared.public_listing_addr.as_str(), enqueue.public_listing_addr.as_str() ); - #[cfg(feature = "relay-runtime")] + #[cfg(feature = "transport-nostr-runtime")] assert!(matches!( push, Err(RadrootsSdkError::ProductSyncTransportSetupFailure { .. }) )); - #[cfg(not(feature = "relay-runtime"))] + #[cfg(not(feature = "transport-nostr-runtime"))] assert!(matches!( push, Err(RadrootsSdkError::ProductSyncUnsupported { .. }) diff --git a/crates/sdk/src/adapters/mod.rs b/crates/sdk/src/adapters/mod.rs @@ -1,7 +1,7 @@ +#[cfg(feature = "transport-nostr-client")] +pub mod nostr; #[cfg(feature = "radrootsd-proxy")] pub mod radrootsd; -#[cfg(feature = "relay-client")] -pub mod relay; #[cfg(feature = "signer-adapters")] pub mod signer; #[cfg(feature = "signing")] diff --git a/crates/sdk/src/adapters/nostr.rs b/crates/sdk/src/adapters/nostr.rs @@ -0,0 +1,74 @@ +use core::time::Duration; + +use crate::adapters::signing::SignedNostrEvent; +use crate::identity::RadrootsIdentity; +use radroots_nostr::prelude::{ + RadrootsNostrClient, RadrootsNostrClientOptions, RadrootsNostrError, RadrootsNostrEventId, + RadrootsNostrOutput, +}; + +pub type RelayClient = RadrootsNostrClient; +pub type RelayClientOptions = RadrootsNostrClientOptions; +pub type RelayError = RadrootsNostrError; +pub type RelayEventId = RadrootsNostrEventId; +pub type RelayOutput<T> = RadrootsNostrOutput<T>; + +pub fn signerless_client() -> RelayClient { + RelayClient::new_signerless() +} + +pub fn signerless_client_with_options( + options: RelayClientOptions, +) -> Result<RelayClient, RelayError> { + RelayClient::new_signerless_with_options(options) +} + +pub fn client_from_identity(identity: &RadrootsIdentity) -> RelayClient { + RelayClient::from_identity(identity) +} + +pub async fn configure_write_relays( + client: &RelayClient, + relay_urls: &[String], + connect_timeout: Duration, +) -> Result<(), RelayError> { + for relay_url in relay_urls { + client.add_write_relay(relay_url).await?; + } + client.connect().await; + client.wait_for_connection(connect_timeout).await; + Ok(()) +} + +pub async fn connected_client_from_identity( + identity: &RadrootsIdentity, + relay_urls: &[String], + connect_timeout: Duration, +) -> Result<RelayClient, RelayError> { + let client = client_from_identity(identity); + configure_write_relays(&client, relay_urls, connect_timeout).await?; + Ok(client) +} + +pub async fn connected_relay_urls(client: &RelayClient) -> Vec<String> { + let mut relay_urls = client + .relays() + .await + .into_values() + .filter(|relay| relay.is_connected()) + .map(|relay| relay.url().to_string()) + .collect::<Vec<_>>(); + relay_urls.sort(); + relay_urls +} + +pub async fn publish_signed_event( + client: &RelayClient, + event: &SignedNostrEvent, +) -> Result<RelayOutput<RelayEventId>, RelayError> { + client.send_event(event).await +} + +#[cfg(test)] +#[path = "../../tests/unit/adapters_nostr_tests.rs"] +mod tests; diff --git a/crates/sdk/src/adapters/relay.rs b/crates/sdk/src/adapters/relay.rs @@ -1,74 +0,0 @@ -use core::time::Duration; - -use crate::adapters::signing::SignedNostrEvent; -use crate::identity::RadrootsIdentity; -use radroots_nostr::prelude::{ - RadrootsNostrClient, RadrootsNostrClientOptions, RadrootsNostrError, RadrootsNostrEventId, - RadrootsNostrOutput, -}; - -pub type RelayClient = RadrootsNostrClient; -pub type RelayClientOptions = RadrootsNostrClientOptions; -pub type RelayError = RadrootsNostrError; -pub type RelayEventId = RadrootsNostrEventId; -pub type RelayOutput<T> = RadrootsNostrOutput<T>; - -pub fn signerless_client() -> RelayClient { - RelayClient::new_signerless() -} - -pub fn signerless_client_with_options( - options: RelayClientOptions, -) -> Result<RelayClient, RelayError> { - RelayClient::new_signerless_with_options(options) -} - -pub fn client_from_identity(identity: &RadrootsIdentity) -> RelayClient { - RelayClient::from_identity(identity) -} - -pub async fn configure_write_relays( - client: &RelayClient, - relay_urls: &[String], - connect_timeout: Duration, -) -> Result<(), RelayError> { - for relay_url in relay_urls { - client.add_write_relay(relay_url).await?; - } - client.connect().await; - client.wait_for_connection(connect_timeout).await; - Ok(()) -} - -pub async fn connected_client_from_identity( - identity: &RadrootsIdentity, - relay_urls: &[String], - connect_timeout: Duration, -) -> Result<RelayClient, RelayError> { - let client = client_from_identity(identity); - configure_write_relays(&client, relay_urls, connect_timeout).await?; - Ok(client) -} - -pub async fn connected_relay_urls(client: &RelayClient) -> Vec<String> { - let mut relay_urls = client - .relays() - .await - .into_values() - .filter(|relay| relay.is_connected()) - .map(|relay| relay.url().to_string()) - .collect::<Vec<_>>(); - relay_urls.sort(); - relay_urls -} - -pub async fn publish_signed_event( - client: &RelayClient, - event: &SignedNostrEvent, -) -> Result<RelayOutput<RelayEventId>, RelayError> { - client.send_event(event).await -} - -#[cfg(test)] -#[path = "../../tests/unit/adapters_relay_tests.rs"] -mod tests; diff --git a/crates/sdk/src/lib.rs b/crates/sdk/src/lib.rs @@ -9,7 +9,7 @@ mod actor_json; #[cfg(any( feature = "radrootsd-proxy", feature = "signing", - feature = "relay-client", + feature = "transport-nostr-client", feature = "signer-adapters" ))] pub mod adapters; diff --git a/crates/sdk/src/orders_runtime.rs b/crates/sdk/src/orders_runtime.rs @@ -1,10 +1,10 @@ #[cfg(feature = "signer-adapters")] use crate::TradeBuyerClient; -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] use crate::runtime::sdk_now_ms; #[cfg(feature = "runtime")] use crate::sync_runtime::SyncProjectionRefreshReceipt; -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] use crate::sync_runtime::{SyncProjectionRefreshRequest, refresh_product_projections_for_sdk}; #[cfg(feature = "signer-adapters")] use crate::workflow_runtime::enqueue_configured_signed_workflow; @@ -25,7 +25,7 @@ use crate::{ use radroots_authority::RadrootsActorContext; #[cfg(all(feature = "runtime", test))] use radroots_authority::RadrootsEventSigner; -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] use radroots_event_store::RadrootsStoredEventTag; #[cfg(feature = "runtime")] use radroots_event_store::{RadrootsEventIngest, RadrootsStoredEvent}; @@ -57,7 +57,7 @@ use radroots_events::{ ids::{RadrootsListingAddress, RadrootsOrderId, RadrootsPublicKey}, order::RadrootsOrderEconomics, }; -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] use radroots_events::{ kinds::KIND_LISTING, tags::{TAG_D, TAG_E}, @@ -69,7 +69,7 @@ use radroots_events_codec::order::{ }; #[cfg(any(feature = "signer-adapters", test))] use radroots_events_codec::wire::{WireEventParts, to_frozen_draft}; -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] use radroots_nostr::prelude::{ RadrootsNostrEventId, RadrootsNostrFilter, RadrootsNostrKind, RadrootsNostrPublicKey, radroots_nostr_filter_tag, @@ -78,7 +78,7 @@ use radroots_nostr::prelude::{ use radroots_trade::dvm::RADROOTS_DVM_TAG_VALIDATION_RECEIPT; #[cfg(feature = "runtime")] use radroots_trade::identity::{RadrootsTradeLocator, RadrootsTradeLocatorCandidate}; -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] use radroots_trade::listing::parse_listing_address; #[cfg(any(feature = "signer-adapters", test))] use radroots_trade::order::{ @@ -93,7 +93,7 @@ use radroots_trade::order::{ RadrootsTradeLocatorProjectionResolution, order_event_record_from_event, order_projection_query_for_trade_locator, }; -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] use radroots_trade::validation_receipt::RadrootsValidationReceiptError; #[cfg(feature = "runtime")] use radroots_trade::validation_receipt::{ @@ -105,7 +105,7 @@ use radroots_trade::validation_receipt::{ }; #[cfg(feature = "runtime")] use radroots_trade::workflow::RadrootsTradeWorkflowState; -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] use radroots_transport_nostr::{ RadrootsNostrClientFetchAdapter, RadrootsRelayFetchAdapter, RadrootsRelayFetchEventReceipt, RadrootsRelayFetchOutcomeKind, RadrootsRelayFetchReceipt, RadrootsRelayFetchRelayOutcome, @@ -1547,7 +1547,7 @@ impl TradeResyncRequest { Ok(self) } - #[cfg(feature = "relay-runtime")] + #[cfg(feature = "transport-nostr-runtime")] fn validate(&self) -> Result<(), RadrootsSdkError> { if self.limit == 0 || self.limit > TRADE_STATUS_MAX_LIMIT { return Err(RadrootsSdkError::trade_status_limit_invalid( @@ -1750,7 +1750,7 @@ impl TradeValidationReceiptListRequest { Ok(self) } - #[cfg(feature = "relay-runtime")] + #[cfg(feature = "transport-nostr-runtime")] fn validate(&self) -> Result<(), RadrootsSdkError> { validate_validation_receipt_limit(self.limit) } @@ -3313,17 +3313,17 @@ impl<'sdk> TradesClient<'sdk> { match request.source { SdkTradeStatusSource::LocalOnly => self.local_status(request).await, SdkTradeStatusSource::ResyncThenLocal => { - #[cfg(feature = "relay-runtime")] + #[cfg(feature = "transport-nostr-runtime")] { let adapter = RadrootsNostrClientFetchAdapter; return self.status_with_fetch_adapter(request, &adapter).await; } - #[cfg(not(feature = "relay-runtime"))] + #[cfg(not(feature = "transport-nostr-runtime"))] { let _ = request; Err(RadrootsSdkError::ProductSyncUnsupported { operation: "trade.status.resync_then_local", - required_feature: "relay-runtime", + required_feature: "transport-nostr-runtime", }) } } @@ -3358,7 +3358,7 @@ impl<'sdk> TradesClient<'sdk> { }) } - #[cfg(all(feature = "signer-adapters", feature = "relay-runtime"))] + #[cfg(all(feature = "signer-adapters", feature = "transport-nostr-runtime"))] pub async fn status_with_fetch_adapter<A>( &self, request: TradeStatusRequest, @@ -3537,23 +3537,23 @@ impl<'sdk> TradeResyncClient<'sdk> { &self, request: TradeResyncRequest, ) -> Result<TradeResyncReceipt, RadrootsSdkError> { - #[cfg(feature = "relay-runtime")] + #[cfg(feature = "transport-nostr-runtime")] { let adapter = RadrootsNostrClientFetchAdapter; return self.resync_with_fetch_adapter(request, &adapter).await; } - #[cfg(not(feature = "relay-runtime"))] + #[cfg(not(feature = "transport-nostr-runtime"))] { let _ = self.sdk; let _ = request; Err(RadrootsSdkError::ProductSyncUnsupported { operation: "trade.resync", - required_feature: "relay-runtime", + required_feature: "transport-nostr-runtime", }) } } - #[cfg(feature = "relay-runtime")] + #[cfg(feature = "transport-nostr-runtime")] pub async fn resync_with_fetch_adapter<A>( &self, request: TradeResyncRequest, @@ -3598,14 +3598,14 @@ impl<'sdk> TradeResyncClient<'sdk> { } } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] struct TradeResyncExecution { relay_targets: Vec<String>, evidence: TradeResyncEvidenceReceipt, refresh: SyncProjectionRefreshReceipt, } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] async fn execute_trade_resync_with_fetch_adapter<A>( sdk: &crate::RadrootsClient, locator: RadrootsTradeLocator, @@ -3642,7 +3642,7 @@ where }) } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn trade_evidence_fetch_request( sdk: &crate::RadrootsClient, query_plan: &TradeEvidenceQueryPlan, @@ -3667,7 +3667,7 @@ fn trade_evidence_fetch_request( ) } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn trade_evidence_query_plan( locator: RadrootsTradeLocator, limit: u32, @@ -3740,7 +3740,7 @@ fn trade_evidence_query_plan( }) } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn trade_evidence_branch( kind: TradeEvidenceQueryBranchKind, event_kinds: Vec<u32>, @@ -3764,7 +3764,7 @@ fn trade_evidence_branch( } } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn trade_evidence_branch_filters( branch: &TradeEvidenceQueryBranch, ) -> Result<Vec<RadrootsNostrFilter>, RadrootsSdkError> { @@ -3781,7 +3781,7 @@ fn trade_evidence_branch_filters( .collect() } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn trade_evidence_branch_filter( branch: &TradeEvidenceQueryBranch, kind: u32, @@ -3808,13 +3808,13 @@ fn trade_evidence_branch_filter( } } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] struct ListingSnapshotFilterParts { seller_pubkey: String, listing_id: String, } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn listing_snapshot_filter_parts( listing_addr: &str, ) -> Result<ListingSnapshotFilterParts, RadrootsSdkError> { @@ -3828,7 +3828,7 @@ fn listing_snapshot_filter_parts( }) } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn trade_resync_total_relay_failure( receipt: &RadrootsRelayFetchReceipt, relay_count: usize, @@ -3836,7 +3836,7 @@ fn trade_resync_total_relay_failure( relay_count > 0 && receipt.eose_count == 0 && receipt.closed_count >= relay_count } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn trade_resync_total_failure_message( operation: &str, receipt: &RadrootsRelayFetchReceipt, @@ -3847,7 +3847,7 @@ fn trade_resync_total_failure_message( ) } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] impl TradeResyncEvidenceReceipt { async fn from_fetch( sdk: &crate::RadrootsClient, @@ -3885,7 +3885,7 @@ impl TradeResyncEvidenceReceipt { } } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] async fn trade_evidence_branch_receipts( sdk: &crate::RadrootsClient, query_plan: &TradeEvidenceQueryPlan, @@ -3922,7 +3922,7 @@ async fn trade_evidence_branch_receipts( .collect()) } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] async fn trade_evidence_event_branch( sdk: &crate::RadrootsClient, query_plan: &TradeEvidenceQueryPlan, @@ -3960,7 +3960,7 @@ async fn trade_evidence_event_branch( .unwrap_or(TradeEvidenceQueryBranchKind::RejectedEvidence)) } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn trade_evidence_branch_matches_event( branch: &TradeEvidenceQueryBranch, stored_event: &RadrootsStoredEvent, @@ -3986,7 +3986,7 @@ fn trade_evidence_branch_matches_event( } } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] impl TradeEvidenceBranchReceipt { fn from_parts( branch: TradeEvidenceQueryBranchKind, @@ -4036,7 +4036,7 @@ impl TradeEvidenceBranchReceipt { } } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] impl From<RadrootsRelayFetchEventReceipt> for TradeResyncEventImportReceipt { fn from(receipt: RadrootsRelayFetchEventReceipt) -> Self { Self { @@ -4055,7 +4055,7 @@ impl From<RadrootsRelayFetchEventReceipt> for TradeResyncEventImportReceipt { } } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] impl From<RadrootsRelayFetchRelayOutcome> for TradeResyncRelayOutcomeReceipt { fn from(receipt: RadrootsRelayFetchRelayOutcome) -> Self { Self { @@ -4067,7 +4067,7 @@ impl From<RadrootsRelayFetchRelayOutcome> for TradeResyncRelayOutcomeReceipt { } } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] impl From<RadrootsRelayFetchOutcomeKind> for TradeResyncRelayOutcomeKind { fn from(kind: RadrootsRelayFetchOutcomeKind) -> Self { match kind { @@ -4078,7 +4078,7 @@ impl From<RadrootsRelayFetchOutcomeKind> for TradeResyncRelayOutcomeKind { } } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] impl From<RadrootsRelayOutcomeKind> for TradeResyncRelayTransportOutcomeKind { fn from(kind: RadrootsRelayOutcomeKind) -> Self { match kind { @@ -4109,23 +4109,23 @@ impl<'sdk> TradeValidationReceiptsClient<'sdk> { &self, request: TradeValidationReceiptListRequest, ) -> Result<TradeValidationReceiptListReceipt, RadrootsSdkError> { - #[cfg(feature = "relay-runtime")] + #[cfg(feature = "transport-nostr-runtime")] { let adapter = RadrootsNostrClientFetchAdapter; return self.list_with_fetch_adapter(request, &adapter).await; } - #[cfg(not(feature = "relay-runtime"))] + #[cfg(not(feature = "transport-nostr-runtime"))] { let _ = self.sdk; let _ = request; Err(RadrootsSdkError::ProductSyncUnsupported { operation: "trade.validation_receipts.list", - required_feature: "relay-runtime", + required_feature: "transport-nostr-runtime", }) } } - #[cfg(feature = "relay-runtime")] + #[cfg(feature = "transport-nostr-runtime")] pub async fn list_with_fetch_adapter<A>( &self, request: TradeValidationReceiptListRequest, @@ -4173,23 +4173,23 @@ impl<'sdk> TradeValidationReceiptsClient<'sdk> { &self, request: TradeValidationReceiptInspectRequest, ) -> Result<TradeValidationReceiptInspectReceipt, RadrootsSdkError> { - #[cfg(feature = "relay-runtime")] + #[cfg(feature = "transport-nostr-runtime")] { let adapter = RadrootsNostrClientFetchAdapter; return self.inspect_with_fetch_adapter(request, &adapter).await; } - #[cfg(not(feature = "relay-runtime"))] + #[cfg(not(feature = "transport-nostr-runtime"))] { let _ = self.sdk; let _ = request; Err(RadrootsSdkError::ProductSyncUnsupported { operation: "trade.validation_receipts.inspect", - required_feature: "relay-runtime", + required_feature: "transport-nostr-runtime", }) } } - #[cfg(feature = "relay-runtime")] + #[cfg(feature = "transport-nostr-runtime")] pub async fn inspect_with_fetch_adapter<A>( &self, request: TradeValidationReceiptInspectRequest, @@ -4212,23 +4212,23 @@ impl<'sdk> TradeValidationReceiptsClient<'sdk> { &self, request: TradeValidationReceiptVerifyRequest, ) -> Result<TradeValidationReceiptInspectReceipt, RadrootsSdkError> { - #[cfg(feature = "relay-runtime")] + #[cfg(feature = "transport-nostr-runtime")] { let adapter = RadrootsNostrClientFetchAdapter; return self.verify_with_fetch_adapter(request, &adapter).await; } - #[cfg(not(feature = "relay-runtime"))] + #[cfg(not(feature = "transport-nostr-runtime"))] { let _ = self.sdk; let _ = request; Err(RadrootsSdkError::ProductSyncUnsupported { operation: "trade.validation_receipts.verify", - required_feature: "relay-runtime", + required_feature: "transport-nostr-runtime", }) } } - #[cfg(feature = "relay-runtime")] + #[cfg(feature = "transport-nostr-runtime")] pub async fn verify_with_fetch_adapter<A>( &self, request: TradeValidationReceiptVerifyRequest, @@ -4248,7 +4248,7 @@ impl<'sdk> TradeValidationReceiptsClient<'sdk> { } } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] async fn validation_receipt_inspect<A>( sdk: &crate::RadrootsClient, receipt_event_id: RadrootsEventId, @@ -4293,7 +4293,7 @@ where }) } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn validation_receipt_relay_targets( sdk: &crate::RadrootsClient, operation: impl Into<String>, @@ -4305,7 +4305,7 @@ fn validation_receipt_relay_targets( Ok(relay_targets) } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn validation_receipt_list_fetch_request( sdk: &crate::RadrootsClient, request: &TradeValidationReceiptListRequest, @@ -4327,7 +4327,7 @@ fn validation_receipt_list_fetch_request( ) } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn validation_receipt_inspect_fetch_request( sdk: &crate::RadrootsClient, receipt_event_id: &RadrootsEventId, @@ -4349,7 +4349,7 @@ fn validation_receipt_inspect_fetch_request( ) } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn validation_receipt_worker_fetch_request( sdk: &crate::RadrootsClient, receipts: &[TradeValidationReceiptEvent], @@ -4384,7 +4384,7 @@ fn validation_receipt_worker_fetch_request( )) } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] async fn validation_receipt_events_from_fetch( sdk: &crate::RadrootsClient, events: &[TradeResyncEventImportReceipt], @@ -4418,7 +4418,7 @@ async fn validation_receipt_events_from_fetch( Ok(fetched) } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn classify_validation_receipts( events: Vec<RadrootsNostrEvent>, expected_order_id: Option<&str>, @@ -4453,7 +4453,7 @@ fn classify_validation_receipts( Ok((receipts, invalid_receipts)) } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] async fn attach_worker_evidence<A>( sdk: &crate::RadrootsClient, adapter: &A, @@ -5098,7 +5098,7 @@ struct RawTradeValidationReceiptWorkerResult { worker_role: Option<String>, } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] impl TradeValidationReceiptRelayEvidenceReceipt { fn from_fetch(receipt: RadrootsRelayFetchReceipt) -> Self { Self { @@ -5117,7 +5117,7 @@ impl TradeValidationReceiptRelayEvidenceReceipt { } } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] impl From<RadrootsRelayFetchRelayOutcome> for TradeValidationReceiptRelayOutcomeReceipt { fn from(receipt: RadrootsRelayFetchRelayOutcome) -> Self { Self { @@ -5129,7 +5129,7 @@ impl From<RadrootsRelayFetchRelayOutcome> for TradeValidationReceiptRelayOutcome } } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] impl From<RadrootsRelayFetchOutcomeKind> for TradeValidationReceiptRelayOutcomeKind { fn from(kind: RadrootsRelayFetchOutcomeKind) -> Self { match kind { @@ -5140,7 +5140,7 @@ impl From<RadrootsRelayFetchOutcomeKind> for TradeValidationReceiptRelayOutcomeK } } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] impl From<RadrootsRelayOutcomeKind> for TradeValidationReceiptRelayTransportOutcomeKind { fn from(kind: RadrootsRelayOutcomeKind) -> Self { match kind { @@ -5205,7 +5205,7 @@ fn stored_event_to_nostr_event( }) } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn validation_receipt_event_order( left: &TradeValidationReceiptEvent, right: &TradeValidationReceiptEvent, @@ -5216,7 +5216,7 @@ fn validation_receipt_event_order( .then_with(|| left.event.id.cmp(&right.event.id)) } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn validation_receipt_invalid_order( left: &TradeValidationReceiptInvalidCandidate, right: &TradeValidationReceiptInvalidCandidate, @@ -5227,7 +5227,7 @@ fn validation_receipt_invalid_order( .then_with(|| left.event.id.cmp(&right.event.id)) } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn validate_validation_receipt_limit(limit: u32) -> Result<(), RadrootsSdkError> { if limit == 0 || limit > TRADE_STATUS_MAX_LIMIT { return Err(RadrootsSdkError::trade_status_limit_invalid( @@ -5256,7 +5256,7 @@ where .collect() } -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] fn validation_receipt_invalid_reason_code(error: &RadrootsValidationReceiptError) -> &'static str { match error { RadrootsValidationReceiptError::InvalidProofMetadata("proof.material") @@ -5653,7 +5653,7 @@ impl<'sdk> TradeSellerClient<'sdk> { .await } - #[cfg(feature = "relay-runtime")] + #[cfg(feature = "transport-nostr-runtime")] pub async fn accept_trade_with_fetch_adapter<A>( &self, request: TradeAcceptRequest, @@ -5917,7 +5917,7 @@ async fn trade_mutation_status( .await } TradeEvidenceMode::ResyncBeforeMutation => { - #[cfg(feature = "relay-runtime")] + #[cfg(feature = "transport-nostr-runtime")] { let adapter = RadrootsNostrClientFetchAdapter; let status = trades_client(sdk) @@ -5930,19 +5930,19 @@ async fn trade_mutation_status( require_trade_mutation_online_evidence_clean(operation, &status)?; Ok(status) } - #[cfg(not(feature = "relay-runtime"))] + #[cfg(not(feature = "transport-nostr-runtime"))] { let _ = locator; Err(RadrootsSdkError::ProductSyncUnsupported { operation, - required_feature: "relay-runtime", + required_feature: "transport-nostr-runtime", }) } } } } -#[cfg(all(feature = "signer-adapters", feature = "relay-runtime"))] +#[cfg(all(feature = "signer-adapters", feature = "transport-nostr-runtime"))] async fn trade_mutation_context_with_fetch_adapter<A>( sdk: &crate::RadrootsClient, locator: RadrootsTradeLocator, @@ -6078,7 +6078,7 @@ async fn ingest_explicit_trade_mutation_evidence( Ok(()) } -#[cfg(all(feature = "signer-adapters", feature = "relay-runtime"))] +#[cfg(all(feature = "signer-adapters", feature = "transport-nostr-runtime"))] fn require_trade_mutation_online_evidence_clean( operation: &'static str, status: &TradeStatusReceipt, diff --git a/crates/sdk/src/sync_runtime.rs b/crates/sdk/src/sync_runtime.rs @@ -13,7 +13,7 @@ use crate::{ use radroots_event_store::{RADROOTS_EVENT_STORE_QUERY_LIMIT_MAX, RadrootsEventStoreStatusSummary}; #[cfg(feature = "runtime")] use radroots_events::ids::RadrootsEventId; -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] use radroots_nostr::prelude::RadrootsNostrClient; #[cfg(all(feature = "runtime", feature = "radrootsd-proxy"))] use radroots_outbox::{ @@ -35,7 +35,7 @@ use radroots_transport::{ RadrootsTransportImplementationState, RadrootsTransportKind, RadrootsTransportReadinessState, RadrootsTransportStatus, RadrootsTransportTarget, }; -#[cfg(all(feature = "runtime", feature = "relay-runtime"))] +#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))] use radroots_transport_nostr::RadrootsNostrClientPublishAdapter; #[cfg(feature = "runtime")] use radroots_transport_nostr::{ @@ -600,7 +600,7 @@ impl<'sdk> SyncClient<'sdk> { ) -> Result<PushOutboxReceipt, RadrootsSdkError> { match self.sdk.transport_profile() { TransportProfile::Nostr { .. } | TransportProfile::Hybrid { .. } => { - #[cfg(feature = "relay-runtime")] + #[cfg(feature = "transport-nostr-runtime")] { let adapter = RadrootsNostrClientPublishAdapter::new( RadrootsNostrClient::new_signerless(), @@ -608,12 +608,12 @@ impl<'sdk> SyncClient<'sdk> { self.push_outbox_with_adapter(&adapter, request).await } - #[cfg(not(feature = "relay-runtime"))] + #[cfg(not(feature = "transport-nostr-runtime"))] { let _ = request; Err(RadrootsSdkError::ProductSyncUnsupported { operation: "sync.push_outbox", - required_feature: "relay-runtime", + required_feature: "transport-nostr-runtime", }) } } diff --git a/crates/sdk/tests/orders_runtime.rs b/crates/sdk/tests/orders_runtime.rs @@ -2,20 +2,20 @@ #[cfg(all(feature = "signer-adapters", feature = "local-signer"))] use std::path::Path; -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] use std::sync::{Arc, Mutex}; use std::time::{Duration, Instant}; -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] use futures::future::BoxFuture; -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] use nostr::JsonUtil; use radroots_authority::RadrootsActorContext; use radroots_core::{ RadrootsCoreCurrency, RadrootsCoreDecimal, RadrootsCoreMoney, RadrootsCoreUnit, }; use radroots_event_store::{RadrootsEventIngest, RadrootsEventStore}; -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] use radroots_events::ids::RadrootsPublicKey; use radroots_events::{ RadrootsNostrEvent, RadrootsNostrEventPtr, @@ -38,7 +38,7 @@ use radroots_nostr::prelude::{ radroots_nostr_build_event, }; use radroots_outbox::RadrootsOutbox; -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] use radroots_sdk::{ DvmValidationReceiptIngestRequest, TradeEvidenceQueryBranchKind, TradeResyncRelayOutcomeKind, TradeResyncRelayTransportOutcomeKind, TradeResyncRequest, TradeSellerInboxRequest, @@ -60,7 +60,7 @@ use radroots_sdk::{ use radroots_sdk::{PrivacyPreflightConfirmation, PrivacyPreflightStatus, ProductSensitivityField}; #[cfg(all(feature = "signer-adapters", feature = "local-signer"))] use radroots_sdk::{RadrootsSdkLocalKeySigner, RadrootsSdkSignerProvider}; -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] use radroots_trade::identity::RadrootsTradeLocator; use radroots_trade::order::RadrootsOrderIssue; use radroots_trade::validation_receipt::{ @@ -69,7 +69,7 @@ use radroots_trade::validation_receipt::{ RadrootsValidationReceiptStatement, RadrootsValidationReceiptType, validation_receipt_event_build, validation_receipt_public_values_hash_hex, }; -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] use radroots_transport_nostr::{ RadrootsMockRelayFetchAdapter, RadrootsRelayFetchAdapter, RadrootsRelayFetchItem, RadrootsRelayFetchRequest, RadrootsRelayTransportError, @@ -91,7 +91,7 @@ const RELAY: &str = "wss://relay.radroots.test"; #[cfg(any())] const OTHER_PUBLIC_KEY_HEX: &str = "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"; -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] const RELAY_B: &str = "wss://relay-b.radroots.test"; const PERF_TOTAL_LOCAL_EVENTS: i64 = 100_000; const PERF_TRADE_RELEVANT_EVENTS: i64 = 25_000; @@ -111,13 +111,13 @@ struct FailingStructSerializer { failure: FailingSerializeFailure, } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] #[derive(Clone, Default)] struct CapturingRelayFetchAdapter { filters_json: Arc<Mutex<Vec<String>>>, } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] impl CapturingRelayFetchAdapter { fn filters_json(&self) -> Vec<String> { self.filters_json @@ -127,7 +127,7 @@ impl CapturingRelayFetchAdapter { } } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] impl RadrootsRelayFetchAdapter for CapturingRelayFetchAdapter { fn fetch<'a>( &'a self, @@ -462,7 +462,7 @@ async fn directory_sdk_and_store() -> (tempfile::TempDir, RadrootsClient, Radroo (tempdir, sdk, store) } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] async fn directory_sdk_and_store_with_relays( relays: &[&str], ) -> (tempfile::TempDir, RadrootsClient, RadrootsEventStore) { @@ -964,7 +964,7 @@ async fn order_submit_enqueue_stores_event_queues_outbox_and_status_sees_request #[cfg(all( feature = "signer-adapters", feature = "local-signer", - feature = "relay-runtime" + feature = "transport-nostr-runtime" ))] #[tokio::test] async fn trade_product_clients_propose_inbox_accept_status_and_resync() { @@ -1107,7 +1107,7 @@ async fn trade_product_clients_propose_inbox_accept_status_and_resync() { #[cfg(all( feature = "signer-adapters", feature = "local-signer", - feature = "relay-runtime" + feature = "transport-nostr-runtime" ))] #[tokio::test] async fn trade_product_clients_resync_committed_after_rhi_validation_receipt() { @@ -1415,7 +1415,7 @@ async fn trade_status_trust_policy_requires_trusted_cryptographic_receipt_for_co #[cfg(all( feature = "signer-adapters", feature = "local-signer", - feature = "relay-runtime" + feature = "transport-nostr-runtime" ))] #[tokio::test] async fn trade_product_accept_resync_before_mutation_imports_relay_visible_request() { @@ -1522,7 +1522,7 @@ async fn trade_product_accept_resync_before_mutation_imports_relay_visible_reque #[cfg(all( feature = "signer-adapters", feature = "local-signer", - feature = "relay-runtime" + feature = "transport-nostr-runtime" ))] #[tokio::test] async fn trade_product_revision_status_resync_imports_pending_revision_proposal() { @@ -1669,7 +1669,7 @@ async fn trade_product_revision_status_resync_imports_pending_revision_proposal( #[cfg(all( feature = "signer-adapters", feature = "local-signer", - feature = "relay-runtime" + feature = "transport-nostr-runtime" ))] #[tokio::test] async fn trade_product_accept_local_only_does_not_fetch_relay_evidence() { @@ -1884,7 +1884,7 @@ async fn trade_product_accept_require_explicit_evidence_rejects_empty_evidence() ); } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] #[tokio::test] async fn trade_validation_receipts_fetch_from_relays_and_select_worker_evidence() { let (_tempdir, sdk, store) = directory_sdk_and_store_with_relays(&[RELAY]).await; @@ -1999,7 +1999,7 @@ async fn trade_validation_receipts_fetch_from_relays_and_select_worker_evidence( ); } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] #[tokio::test] async fn trade_validation_receipts_classify_worker_evidence_untrusted_without_trust_config() { let (_tempdir, sdk, _store) = directory_sdk_and_store_with_relays(&[RELAY]).await; @@ -2100,7 +2100,7 @@ async fn trade_validation_receipts_classify_worker_evidence_untrusted_without_tr ); } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] #[tokio::test] async fn trade_validation_receipt_list_rejects_out_of_filter_order_receipts() { let (_tempdir, sdk, store) = directory_sdk_and_store_with_relays(&[RELAY]).await; @@ -2144,7 +2144,7 @@ async fn trade_validation_receipt_list_rejects_out_of_filter_order_receipts() { ); } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] #[tokio::test] async fn trade_validation_receipt_inspect_rejects_unrequested_relay_receipts() { let (_tempdir, sdk, store) = directory_sdk_and_store_with_relays(&[RELAY]).await; @@ -2196,7 +2196,7 @@ async fn trade_validation_receipt_inspect_rejects_unrequested_relay_receipts() { ); } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] #[tokio::test] async fn trade_validation_receipt_inspect_skips_noise_before_exact_receipt_match() { let (_tempdir, sdk, store) = directory_sdk_and_store_with_relays(&[RELAY]).await; @@ -2263,7 +2263,7 @@ async fn trade_validation_receipt_inspect_skips_noise_before_exact_receipt_match ); } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] #[tokio::test] async fn trade_resync_imports_relay_evidence_into_empty_local_store() { let (_tempdir, sdk, store) = directory_sdk_and_store_with_relays(&[RELAY]).await; @@ -2328,7 +2328,7 @@ async fn trade_resync_imports_relay_evidence_into_empty_local_store() { ); } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] #[tokio::test] async fn trade_status_local_only_ignores_failing_fetch_adapter() { let (_tempdir, sdk, _store) = directory_sdk_and_store_with_relays(&[RELAY]).await; @@ -2349,7 +2349,7 @@ async fn trade_status_local_only_ignores_failing_fetch_adapter() { assert!(status.online_evidence.is_none()); } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] #[tokio::test] async fn trade_status_resync_then_local_fetches_evidence_before_status() { let (_tempdir, sdk, store) = directory_sdk_and_store_with_relays(&[RELAY]).await; @@ -2395,7 +2395,7 @@ async fn trade_status_resync_then_local_fetches_evidence_before_status() { ); } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] #[tokio::test] async fn trade_resync_skips_noise_before_matching_trade_event() { let (_tempdir, sdk, store) = directory_sdk_and_store_with_relays(&[RELAY]).await; @@ -2435,7 +2435,7 @@ async fn trade_resync_skips_noise_before_matching_trade_event() { ); } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] #[tokio::test] async fn trade_resync_duplicate_replay_is_idempotent() { let (_tempdir, sdk, _store) = directory_sdk_and_store_with_relays(&[RELAY]).await; @@ -2465,7 +2465,7 @@ async fn trade_resync_duplicate_replay_is_idempotent() { assert_eq!(second.status.status, TradeStatusKind::Requested); } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] #[tokio::test] async fn trade_resync_splits_lifecycle_branch_into_single_kind_filters() { let (_tempdir, sdk, _store) = directory_sdk_and_store_with_relays(&[RELAY]).await; @@ -2498,7 +2498,7 @@ async fn trade_resync_splits_lifecycle_branch_into_single_kind_filters() { ); } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] #[tokio::test] async fn trade_resync_reports_malformed_evidence_without_poisoning_store() { let (_tempdir, sdk, store) = directory_sdk_and_store_with_relays(&[RELAY]).await; @@ -2530,7 +2530,7 @@ async fn trade_resync_reports_malformed_evidence_without_poisoning_store() { ); } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] #[tokio::test] async fn trade_resync_rejects_out_of_filter_evidence_without_poisoning_store() { let (_tempdir, sdk, store) = directory_sdk_and_store_with_relays(&[RELAY]).await; @@ -2567,7 +2567,7 @@ async fn trade_resync_rejects_out_of_filter_evidence_without_poisoning_store() { ); } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] #[tokio::test] async fn trade_resync_errors_on_total_relay_failure() { let (_tempdir, sdk, _store) = directory_sdk_and_store_with_relays(&[RELAY, RELAY_B]).await; @@ -2591,7 +2591,7 @@ async fn trade_resync_errors_on_total_relay_failure() { assert_eq!(error.code(), "product_sync_transport_setup_failure"); } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] #[tokio::test] async fn trade_resync_reports_partial_relay_failure() { let (_tempdir, sdk, _store) = directory_sdk_and_store_with_relays(&[RELAY, RELAY_B]).await; @@ -2627,7 +2627,7 @@ async fn trade_resync_reports_partial_relay_failure() { ); } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] async fn relay_event_item_from_store( source: &RadrootsEventStore, event_id: &RadrootsEventId, @@ -2660,7 +2660,7 @@ async fn event_from_store( radroots_event_from_nostr(&event) } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] fn relay_raw_event_item( event: &nostr::Event, relay_url: &str, @@ -2673,14 +2673,14 @@ fn relay_raw_event_item( } } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] fn relay_eose(relay_url: &str) -> RadrootsRelayFetchItem { RadrootsRelayFetchItem::Eose { relay_url: relay_url.to_owned(), } } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] fn relay_closed(relay_url: &str, message: &str) -> RadrootsRelayFetchItem { RadrootsRelayFetchItem::Closed { relay_url: relay_url.to_owned(), @@ -2688,7 +2688,7 @@ fn relay_closed(relay_url: &str, message: &str) -> RadrootsRelayFetchItem { } } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] fn relay_malformed(relay_url: &str) -> RadrootsRelayFetchItem { RadrootsRelayFetchItem::Event { relay_url: relay_url.to_owned(), @@ -3853,7 +3853,7 @@ fn revision_economics() -> RadrootsOrderEconomics { } } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] fn signed_raw_validation_receipt_event( raw_order_id: &str, listing_event_id: &RadrootsEventId, @@ -3893,7 +3893,7 @@ fn signed_raw_sp1_validation_receipt_event( ) } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] fn validation_receipt_wire_parts( raw_order_id: &str, listing_event_id: &RadrootsEventId, @@ -4031,7 +4031,7 @@ fn signed_raw_sp1_worker_result_event( ) } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] fn signed_raw_worker_result_event( raw_order_id: &str, receipt_event_id: &RadrootsEventId, @@ -4205,7 +4205,7 @@ fn signed_order_request_event(raw_order_id: &str, created_at: u32) -> RadrootsNo signed_event(BUYER_SECRET_KEY_HEX, created_at, draft) } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] fn signed_raw_order_request_event(raw_order_id: &str, created_at: u32) -> nostr::Event { let draft = radroots_events_codec::order::order_request_event_build( &listing_event_ptr(), diff --git a/crates/sdk/tests/runtime_foundation.rs b/crates/sdk/tests/runtime_foundation.rs @@ -466,7 +466,7 @@ fn sdk_error_contract_methods_cover_all_variants() { ( RadrootsSdkError::ProductSyncUnsupported { operation: "sync.push_outbox", - required_feature: "relay-runtime", + required_feature: "transport-nostr-runtime", }, "product_sync_unsupported", RadrootsSdkErrorClass::Unsupported, diff --git a/crates/sdk/tests/source_boundary.rs b/crates/sdk/tests/source_boundary.rs @@ -513,6 +513,69 @@ fn sdk_manifest_does_not_depend_on_app_or_cli_crates() { } #[test] +fn sdk_transport_nostr_features_do_not_retain_relay_named_aliases() { + let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR")); + let manifest = read_source(manifest_dir.join("Cargo.toml").as_path()); + + for required in [ + "transport-nostr-client = [", + "transport-nostr-runtime = [", + "\"transport-nostr-runtime\",", + "\"transport-nostr-client\",", + ] { + assert!( + manifest.contains(required), + "Cargo.toml must retain canonical SDK transport feature witness `{required}`" + ); + } + for forbidden in ["relay-client", "relay-runtime"] { + assert!( + !manifest.contains(forbidden), + "Cargo.toml must not retain removed SDK transport feature `{forbidden}`" + ); + } + + let lib_source = read_source(manifest_dir.join("src/lib.rs").as_path()); + assert!( + lib_source.contains("feature = \"transport-nostr-client\""), + "src/lib.rs must gate adapters on transport-nostr-client" + ); + assert!( + !lib_source.contains("relay-client") && !lib_source.contains("relay-runtime"), + "src/lib.rs must not retain removed transport feature names" + ); + + let adapters_mod_source = read_source(manifest_dir.join("src/adapters/mod.rs").as_path()); + assert!( + adapters_mod_source.contains("pub mod nostr;"), + "src/adapters/mod.rs must expose the Nostr adapter module by transport kind" + ); + assert!( + !adapters_mod_source.contains("pub mod relay;"), + "src/adapters/mod.rs must not retain a relay-named public adapter module" + ); + assert!( + !manifest_dir.join("src/adapters/relay.rs").exists(), + "src/adapters/relay.rs must not remain as a relay-named public adapter module" + ); + + for relative_path in [ + "src/sync_runtime.rs", + "src/orders_runtime.rs", + "examples/runtime_local.rs", + "README", + ] { + let source = read_source(manifest_dir.join(relative_path).as_path()); + for forbidden in ["relay-client", "relay-runtime"] { + assert!( + !source.contains(forbidden), + "{relative_path} must not retain removed SDK transport feature `{forbidden}`" + ); + } + } +} + +#[test] fn sdk_readme_documents_current_public_product_surface() { let readme_path = Path::new(env!("CARGO_MANIFEST_DIR")).join("README"); let readme = read_source(readme_path.as_path()); diff --git a/crates/sdk/tests/sync_runtime.rs b/crates/sdk/tests/sync_runtime.rs @@ -2110,7 +2110,7 @@ fn push_outbox_contract_dtos_serialize_deterministically() { ); } -#[cfg(not(feature = "relay-runtime"))] +#[cfg(not(feature = "transport-nostr-runtime"))] #[tokio::test] async fn product_push_outbox_without_relay_runtime_returns_structured_error() { let (_tempdir, sdk) = directory_sdk(&[RELAY_A]).await; @@ -2127,7 +2127,7 @@ async fn product_push_outbox_without_relay_runtime_returns_structured_error() { )); } -#[cfg(feature = "relay-runtime")] +#[cfg(feature = "transport-nostr-runtime")] #[tokio::test] async fn product_push_outbox_empty_queue_does_not_require_builder_relays() { let (_tempdir, sdk) = directory_sdk(&[]).await; diff --git a/crates/sdk/tests/trade_public_api.rs b/crates/sdk/tests/trade_public_api.rs @@ -32,9 +32,9 @@ async fn grouped_trade_surface_is_the_public_product_entrypoint() { .await .expect_err("resync requires configured relays"); - #[cfg(feature = "relay-runtime")] + #[cfg(feature = "transport-nostr-runtime")] assert_eq!(resync_error.code(), "empty_transport_targets"); - #[cfg(not(feature = "relay-runtime"))] + #[cfg(not(feature = "transport-nostr-runtime"))] assert_eq!(resync_error.code(), "product_sync_unsupported"); let validation_receipt_error = validation_receipts @@ -45,9 +45,9 @@ async fn grouped_trade_surface_is_the_public_product_entrypoint() { .await .expect_err("validation receipt list requires configured relays"); - #[cfg(feature = "relay-runtime")] + #[cfg(feature = "transport-nostr-runtime")] assert_eq!(validation_receipt_error.code(), "empty_transport_targets"); - #[cfg(not(feature = "relay-runtime"))] + #[cfg(not(feature = "transport-nostr-runtime"))] assert_eq!(validation_receipt_error.code(), "product_sync_unsupported"); let seller_actor = diff --git a/crates/sdk/tests/unit/adapters_relay_tests.rs b/crates/sdk/tests/unit/adapters_nostr_tests.rs diff --git a/crates/sdk/tests/unit/error_tests.rs b/crates/sdk/tests/unit/error_tests.rs @@ -365,7 +365,7 @@ fn sdk_error_contract_methods_cover_representative_classes_and_details() { }, RadrootsSdkError::ProductSyncUnsupported { operation: "sync.push_outbox", - required_feature: "relay-runtime", + required_feature: "transport-nostr-runtime", }, RadrootsSdkError::reticulum_preview_transport_unavailable( "sync.push_outbox",