commit 5a6fb1f21aba56bc705340c266000f5a484a1b67
parent c7063fc3fc3440938bb80c58b34ce8eedaa7b7ee
Author: triesap <tyson@radroots.org>
Date: Tue, 26 May 2026 20:29:04 +0000
runtime: organize store account modules
Diffstat:
13 files changed, 156 insertions(+), 156 deletions(-)
diff --git a/src/operation_basket.rs b/src/operation_basket.rs
@@ -1331,7 +1331,7 @@ mod tests {
BasketListRequest, BasketQuoteCreateRequest, BasketValidateRequest, OperationAdapter,
OperationContext, OperationData, OperationRequest,
};
- use crate::runtime::accounts;
+ use crate::runtime::account;
use crate::runtime::config::{
AccountConfig, AccountSecretContractConfig, HyfConfig, IdentityConfig, InteractionConfig,
LocalConfig, LoggingConfig, MigrationConfig, MycConfig, OutputConfig, OutputFormat,
@@ -1508,7 +1508,7 @@ mod tests {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path());
seed_current_listing(&config);
- accounts::create_or_migrate_default_account(&config).expect("create buyer account");
+ account::create_or_migrate_default_account(&config).expect("create buyer account");
let service = OperationAdapter::new(BasketOperationService::new(&config));
create_basket(&service, "basket_quote");
add_listing_item(&service, "basket_quote");
@@ -1562,7 +1562,7 @@ mod tests {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path());
seed_current_listing(&config);
- accounts::create_or_migrate_default_account(&config).expect("create buyer account");
+ account::create_or_migrate_default_account(&config).expect("create buyer account");
let service = OperationAdapter::new(BasketOperationService::new(&config));
create_basket(&service, "basket_dry_run");
add_listing_item(&service, "basket_dry_run");
@@ -1677,7 +1677,7 @@ mod tests {
fn basket_readiness_fails_closed_for_unresolved_listing() {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path());
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let service = OperationAdapter::new(BasketOperationService::new(&config));
create_basket(&service, "basket_unresolved");
let add = add_listing_item(&service, "basket_unresolved");
@@ -1769,7 +1769,7 @@ mod tests {
}
fn seed_current_listing(config: &RuntimeConfig) {
- crate::runtime::local::init(config).expect("store init");
+ crate::runtime::store::init(config).expect("store init");
let parsed = RadrootsTradeListingAddress::parse(LISTING_ADDR).expect("listing addr");
let event = RadrootsNostrEvent {
id: "2".repeat(64),
diff --git a/src/operation_core.rs b/src/operation_core.rs
@@ -19,7 +19,7 @@ use crate::ops::{
WorkspaceInitRequest, WorkspaceInitResult,
};
use crate::runtime::RuntimeError;
-use crate::runtime::accounts::{
+use crate::runtime::account::{
AccountResolution, AccountRuntimeFailure, account_resolution_view, account_summary_view,
attach_identity_secret, clear_default_account, create_or_migrate_default_account,
import_public_identity, preview_account_removal, preview_identity_secret_attachment,
@@ -55,7 +55,7 @@ impl OperationService<WorkspaceInitRequest> for CoreOperationService<'_> {
request: OperationRequest<WorkspaceInitRequest>,
) -> Result<OperationResult<Self::Result>, OperationAdapterError> {
if request.context.dry_run {
- let local = map_runtime(crate::runtime::local::init_preflight(self.config))?;
+ let local = map_runtime(crate::runtime::store::init_preflight(self.config))?;
return json_operation_result::<WorkspaceInitResult>(json!({
"state": local.state,
"profile": self.config.paths.profile,
@@ -63,7 +63,7 @@ impl OperationService<WorkspaceInitRequest> for CoreOperationService<'_> {
}));
}
- let local = map_runtime(crate::runtime::local::init(self.config))?;
+ let local = map_runtime(crate::runtime::store::init(self.config))?;
json_operation_result::<WorkspaceInitResult>(json!({
"state": local.state,
"profile": self.config.paths.profile,
@@ -101,7 +101,7 @@ impl OperationService<HealthStatusGetRequest> for CoreOperationService<'_> {
&self,
_request: OperationRequest<HealthStatusGetRequest>,
) -> Result<OperationResult<Self::Result>, OperationAdapterError> {
- let store = map_runtime(crate::runtime::local::status(self.config))?;
+ let store = map_runtime(crate::runtime::store::status(self.config))?;
let account = map_runtime(resolve_account_resolution(self.config))?;
let publish = publish_runtime_view(self.config, true, &account);
let state = health_status_state(&store.state, &publish);
@@ -127,7 +127,7 @@ impl OperationService<HealthCheckRunRequest> for CoreOperationService<'_> {
&self,
_request: OperationRequest<HealthCheckRunRequest>,
) -> Result<OperationResult<Self::Result>, OperationAdapterError> {
- let store = map_runtime(crate::runtime::local::status(self.config))?;
+ let store = map_runtime(crate::runtime::store::status(self.config))?;
let account = map_runtime(resolve_account_resolution(self.config))?;
let account_reason = if account.resolved_account.is_some() {
None
@@ -281,8 +281,8 @@ impl OperationService<AccountCreateRequest> for CoreOperationService<'_> {
let result = map_runtime(create_or_migrate_default_account(self.config))?;
json_operation_result::<AccountCreateResult>(json!({
"state": match result.mode {
- crate::runtime::accounts::AccountCreateMode::Created => "created",
- crate::runtime::accounts::AccountCreateMode::Migrated => "migrated",
+ crate::runtime::account::AccountCreateMode::Created => "created",
+ crate::runtime::account::AccountCreateMode::Migrated => "migrated",
},
"account": account_summary_view(&result.account),
}))
@@ -428,7 +428,7 @@ impl OperationService<AccountListRequest> for CoreOperationService<'_> {
.map(account_summary_view)
.collect::<Vec<_>>();
json_operation_result::<AccountListResult>(json!({
- "source": crate::runtime::accounts::SHARED_ACCOUNT_STORE_SOURCE,
+ "source": crate::runtime::account::SHARED_ACCOUNT_STORE_SOURCE,
"count": accounts.len(),
"accounts": accounts,
}))
@@ -550,11 +550,11 @@ impl OperationService<StoreInitRequest> for CoreOperationService<'_> {
request: OperationRequest<StoreInitRequest>,
) -> Result<OperationResult<Self::Result>, OperationAdapterError> {
if request.context.dry_run {
- let view = map_runtime(crate::runtime::local::init_preflight(self.config))?;
+ let view = map_runtime(crate::runtime::store::init_preflight(self.config))?;
return serialized_operation_result::<StoreInitResult, _>(&view);
}
- let view = map_runtime(crate::runtime::local::init(self.config))?;
+ let view = map_runtime(crate::runtime::store::init(self.config))?;
serialized_operation_result::<StoreInitResult, _>(&view)
}
}
@@ -566,7 +566,7 @@ impl OperationService<StoreStatusGetRequest> for CoreOperationService<'_> {
&self,
_request: OperationRequest<StoreStatusGetRequest>,
) -> Result<OperationResult<Self::Result>, OperationAdapterError> {
- let view = map_runtime(crate::runtime::local::status(self.config))?;
+ let view = map_runtime(crate::runtime::store::status(self.config))?;
serialized_operation_result::<StoreStatusGetResult, _>(&view)
}
}
@@ -597,7 +597,7 @@ impl OperationService<StoreExportRequest> for CoreOperationService<'_> {
));
}
- let view = map_runtime(crate::runtime::local::export(
+ let view = map_runtime(crate::runtime::store::export(
self.config,
format,
output.as_path(),
@@ -618,14 +618,14 @@ impl OperationService<StoreBackupCreateRequest> for CoreOperationService<'_> {
if request.context.dry_run {
let view = map_expected_runtime(
request.operation_id(),
- crate::runtime::local::backup_preflight(self.config, output.as_path()),
+ crate::runtime::store::backup_preflight(self.config, output.as_path()),
)?;
return local_backup_result(request.operation_id(), &view);
}
let view = map_expected_runtime(
request.operation_id(),
- crate::runtime::local::backup(self.config, output.as_path()),
+ crate::runtime::store::backup(self.config, output.as_path()),
)?;
local_backup_result(request.operation_id(), &view)
}
@@ -653,7 +653,7 @@ fn map_runtime<T>(result: Result<T, RuntimeError>) -> Result<T, OperationAdapter
fn account_secret_backend_ready(
operation_id: &str,
config: &RuntimeConfig,
-) -> Result<crate::runtime::accounts::AccountSecretBackendStatus, OperationAdapterError> {
+) -> Result<crate::runtime::account::AccountSecretBackendStatus, OperationAdapterError> {
let secret_backend = secret_backend_status(config);
if secret_backend.state == "ready" {
return Ok(secret_backend);
diff --git a/src/operation_market.rs b/src/operation_market.rs
@@ -314,7 +314,7 @@ mod tests {
let mut config = sample_config(dir.path());
config.output.dry_run = true;
config.relay.urls = vec!["wss://relay.example.com".to_owned()];
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let service = OperationAdapter::new(MarketOperationService::new(&config));
let mut context = OperationContext::default();
@@ -349,7 +349,7 @@ mod tests {
fn market_refresh_no_relay_action_is_actionable() {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path());
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let service = OperationAdapter::new(MarketOperationService::new(&config));
let request =
OperationRequest::new(OperationContext::default(), MarketRefreshRequest::default())
diff --git a/src/ops/error.rs b/src/ops/error.rs
@@ -4,7 +4,7 @@ use serde_json::{Map, Value, json};
use crate::out::envelope::{CliExitCode, OutputError};
use crate::runtime::RuntimeError;
-use crate::runtime::accounts::AccountRuntimeFailure;
+use crate::runtime::account::AccountRuntimeFailure;
use crate::view::runtime::CommandDisposition;
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
diff --git a/src/ops/mod.rs b/src/ops/mod.rs
@@ -26,7 +26,7 @@ mod tests {
use crate::cli::TargetCliArgs;
use crate::registry::OPERATION_REGISTRY;
use crate::runtime::RuntimeError;
- use crate::runtime::accounts::AccountRuntimeFailure;
+ use crate::runtime::account::AccountRuntimeFailure;
#[test]
fn adapter_binds_every_registry_entry() {
diff --git a/src/runtime/accounts.rs b/src/runtime/account.rs
diff --git a/src/runtime/farm.rs b/src/runtime/farm.rs
@@ -20,7 +20,7 @@ use crate::cli::global::{
FarmUpdateArgs,
};
use crate::runtime::RuntimeError;
-use crate::runtime::accounts::{self, AccountRecordView};
+use crate::runtime::account::{self, AccountRecordView};
use crate::runtime::config::{
PublishMode, RADROOTSD_PUBLISH_DEFERRED_REASON, RuntimeConfig, SignerBackend,
};
@@ -151,7 +151,7 @@ fn rebind_inner(
let from_seller_pubkey = from_account
.as_ref()
.map(|account| account.record.public_identity.public_key_hex.clone());
- let target_account = accounts::resolve_account_selector(config, args.selector.as_str())
+ let target_account = account::resolve_account_selector(config, args.selector.as_str())
.map_err(|error| farm_rebind_selector_error(args.selector.as_str(), error))?;
let to_seller_pubkey = target_account.record.public_identity.public_key_hex.clone();
let seller_pubkey_changed = from_seller_pubkey
@@ -220,8 +220,8 @@ fn rebind_inner(
fn farm_rebind_selector_error(selector: &str, error: RuntimeError) -> RuntimeError {
match error {
- RuntimeError::Account(accounts::AccountRuntimeFailure::Unresolved(issue)) => {
- accounts::AccountRuntimeFailure::unresolved_with_detail(
+ RuntimeError::Account(account::AccountRuntimeFailure::Unresolved(issue)) => {
+ account::AccountRuntimeFailure::unresolved_with_detail(
issue.message().to_owned(),
json!({
"seller_actor_source": FARM_SELLER_ACTOR_SOURCE,
@@ -539,7 +539,7 @@ fn relay_farm_publish_readiness(
state: "unconfigured",
executable: false,
reason: Some(
- accounts::AccountRuntimeFailure::watch_only(&account.record.account_id).to_string(),
+ account::AccountRuntimeFailure::watch_only(&account.record.account_id).to_string(),
),
missing: vec!["Write-capable farm-bound seller account".to_owned()],
actions: vec![format!(
@@ -968,7 +968,7 @@ fn resolve_farm_signing_identity(
config: &RuntimeConfig,
account_id: &str,
account_pubkey: &str,
-) -> Result<accounts::AccountSigningIdentity, ActorWriteBindingError> {
+) -> Result<account::AccountSigningIdentity, ActorWriteBindingError> {
if !matches!(
config.signer.backend,
crate::runtime::config::SignerBackend::Local
@@ -979,7 +979,7 @@ fn resolve_farm_signing_identity(
))
});
}
- let signing = accounts::resolve_local_signing_identity_for_account(config, account_id)
+ let signing = account::resolve_local_signing_identity_for_account(config, account_id)
.map_err(ActorWriteBindingError::from_runtime)?;
let selected_pubkey = signing
.account
@@ -989,7 +989,7 @@ fn resolve_farm_signing_identity(
.as_str();
if !selected_pubkey.eq_ignore_ascii_case(account_pubkey) {
return Err(ActorWriteBindingError::Account(
- accounts::AccountRuntimeFailure::mismatch(format!(
+ account::AccountRuntimeFailure::mismatch(format!(
"account mismatch: resolved account pubkey `{selected_pubkey}` cannot sign farm-bound seller pubkey `{account_pubkey}`"
)),
));
@@ -1558,7 +1558,7 @@ fn relay_failures(failures: Vec<DirectRelayFailure>) -> Vec<RelayFailureView> {
fn selected_account_for_draft(
config: &RuntimeConfig,
) -> Result<Option<AccountRecordView>, RuntimeError> {
- accounts::resolve_account(config)
+ account::resolve_account(config)
}
fn missing_selected_account_setup_view() -> FarmSetupView {
@@ -1585,7 +1585,7 @@ fn init_document(
"account mismatch: farm config is bound to seller account `{}`; use `radroots farm rebind {}` to change the farm-bound seller account",
document.selection.account, account.record.account_id
);
- return Err(accounts::AccountRuntimeFailure::mismatch_with_detail(
+ return Err(account::AccountRuntimeFailure::mismatch_with_detail(
message,
json!({
"seller_actor_source": FARM_SELLER_ACTOR_SOURCE,
@@ -1954,7 +1954,7 @@ fn configured_account(
config: &RuntimeConfig,
account_id: &str,
) -> Result<Option<AccountRecordView>, RuntimeError> {
- let snapshot = accounts::snapshot(config)?;
+ let snapshot = account::snapshot(config)?;
Ok(snapshot
.accounts
.into_iter()
diff --git a/src/runtime/listing.rs b/src/runtime/listing.rs
@@ -36,7 +36,7 @@ use crate::cli::global::{
ListingRebindArgs, RecordLookupArgs,
};
use crate::runtime::RuntimeError;
-use crate::runtime::accounts;
+use crate::runtime::account;
use crate::runtime::config::{
PublishMode, RADROOTSD_PUBLISH_DEFERRED_REASON, RuntimeConfig, SignerBackend,
};
@@ -910,7 +910,7 @@ fn rebind_inner(
)));
}
- let target_account = accounts::resolve_account_selector(config, args.selector.as_str())
+ let target_account = account::resolve_account_selector(config, args.selector.as_str())
.map_err(|error| listing_rebind_selector_error(args.selector.as_str(), error))?;
let from_seller_account_id = non_empty(draft.seller_actor.account_id.clone());
let from_seller_pubkey = non_empty(draft.seller_actor.pubkey.clone());
@@ -1023,8 +1023,8 @@ fn resolve_rebind_farm_d_tag(
fn listing_rebind_selector_error(selector: &str, error: RuntimeError) -> RuntimeError {
match error {
- RuntimeError::Account(accounts::AccountRuntimeFailure::Unresolved(issue)) => {
- accounts::AccountRuntimeFailure::unresolved_with_detail(
+ RuntimeError::Account(account::AccountRuntimeFailure::Unresolved(issue)) => {
+ account::AccountRuntimeFailure::unresolved_with_detail(
issue.message().to_owned(),
json!({
"seller_actor_source": LISTING_SELLER_ACTOR_SOURCE_REBIND,
@@ -1757,7 +1757,7 @@ fn mutate(
let mut canonical = canonicalize_draft(&parsed, &contents, &context).map_err(|error| {
let issue = match error {
ListingDraftValidationError::MissingSellerAccount(issue) => {
- return accounts::AccountRuntimeFailure::unresolved_with_detail(
+ return account::AccountRuntimeFailure::unresolved_with_detail(
format!("{} ({})", issue.message, issue.field),
json!({
"seller_actor_source": "listing_draft",
@@ -2468,7 +2468,7 @@ fn ensure_listing_bound_account(
) -> Result<(), RuntimeError> {
validate_invocation_account_matches_bound(config, canonical, file)?;
let Some(account) = configured_account(config, &canonical.seller_account_id)? else {
- return Err(accounts::AccountRuntimeFailure::unresolved_with_detail(
+ return Err(account::AccountRuntimeFailure::unresolved_with_detail(
format!(
"listing-bound seller account `{}` is not present in the local account store",
canonical.seller_account_id
@@ -2484,7 +2484,7 @@ fn ensure_listing_bound_account(
};
let account_pubkey = account.record.public_identity.public_key_hex;
if !account_pubkey.eq_ignore_ascii_case(canonical.seller_pubkey.as_str()) {
- return Err(accounts::AccountRuntimeFailure::mismatch_with_detail(
+ return Err(account::AccountRuntimeFailure::mismatch_with_detail(
format!(
"account mismatch: listing-bound seller account `{}` pubkey `{account_pubkey}` cannot sign listing seller_pubkey `{}`",
canonical.seller_account_id, canonical.seller_pubkey
@@ -2517,11 +2517,11 @@ fn validate_invocation_account_matches_bound(
else {
return Ok(());
};
- let attempted = accounts::resolve_account_selector(config, selector)?;
+ let attempted = account::resolve_account_selector(config, selector)?;
if attempted.record.account_id.to_string() == canonical.seller_account_id {
return Ok(());
}
- Err(accounts::AccountRuntimeFailure::mismatch_with_detail(
+ Err(account::AccountRuntimeFailure::mismatch_with_detail(
format!(
"account mismatch: listing draft is bound to seller account `{}`; invocation selected `{}`",
canonical.seller_account_id, attempted.record.account_id
@@ -2779,8 +2779,8 @@ fn validate_local_listing_signer(
fn resolve_listing_signing_identity(
config: &RuntimeConfig,
canonical: &CanonicalListingDraft,
-) -> Result<accounts::AccountSigningIdentity, RuntimeError> {
- let signing = accounts::resolve_local_signing_identity_for_account(
+) -> Result<account::AccountSigningIdentity, RuntimeError> {
+ let signing = account::resolve_local_signing_identity_for_account(
config,
canonical.seller_account_id.as_str(),
)
@@ -2792,7 +2792,7 @@ fn resolve_listing_signing_identity(
.public_key_hex
.as_str();
if !account_pubkey.eq_ignore_ascii_case(canonical.seller_pubkey.as_str()) {
- return Err(accounts::AccountRuntimeFailure::mismatch_with_detail(
+ return Err(account::AccountRuntimeFailure::mismatch_with_detail(
format!(
"account mismatch: listing-bound seller account `{}` pubkey `{account_pubkey}` cannot sign listing seller_pubkey `{}`",
canonical.seller_account_id, canonical.seller_pubkey
@@ -2818,8 +2818,8 @@ fn listing_bound_signing_error(
canonical: &CanonicalListingDraft,
) -> RuntimeError {
match error {
- RuntimeError::Account(accounts::AccountRuntimeFailure::Unresolved(issue)) => {
- accounts::AccountRuntimeFailure::unresolved_with_detail(
+ RuntimeError::Account(account::AccountRuntimeFailure::Unresolved(issue)) => {
+ account::AccountRuntimeFailure::unresolved_with_detail(
issue.message().to_owned(),
json!({
"seller_actor_source": canonical.seller_actor_source,
@@ -2833,8 +2833,8 @@ fn listing_bound_signing_error(
)
.into()
}
- RuntimeError::Account(accounts::AccountRuntimeFailure::WatchOnly(issue)) => {
- accounts::AccountRuntimeFailure::watch_only_with_detail(
+ RuntimeError::Account(account::AccountRuntimeFailure::WatchOnly(issue)) => {
+ account::AccountRuntimeFailure::watch_only_with_detail(
&canonical.seller_account_id,
json!({
"seller_actor_source": canonical.seller_actor_source,
@@ -3114,9 +3114,9 @@ fn issue_from_trade_validation(
}
fn authoring_defaults(config: &RuntimeConfig) -> Result<ListingAuthoringDefaults, RuntimeError> {
- let account_resolution = accounts::resolve_account_resolution(config)?;
+ let account_resolution = account::resolve_account_resolution(config)?;
let Some(selected_account) = account_resolution.resolved_account.clone() else {
- return Err(accounts::AccountRuntimeFailure::unresolved_with_detail(
+ return Err(account::AccountRuntimeFailure::unresolved_with_detail(
"no resolved account is available for listing seller actor",
json!({
"seller_actor_source": LISTING_SELLER_ACTOR_SOURCE_RESOLVED_ACCOUNT,
@@ -3154,7 +3154,7 @@ fn authoring_defaults(config: &RuntimeConfig) -> Result<ListingAuthoringDefaults
};
let Some(account) = configured_account(config, &resolved.document.selection.account)? else {
let account_id = resolved.document.selection.account.clone();
- return Err(accounts::AccountRuntimeFailure::unresolved_with_detail(
+ return Err(account::AccountRuntimeFailure::unresolved_with_detail(
format!(
"farm-bound seller account `{account_id}` is not present in the local account store"
),
@@ -3242,8 +3242,8 @@ fn modified_unix(path: &Path) -> Option<u64> {
fn configured_account(
config: &RuntimeConfig,
account_id: &str,
-) -> Result<Option<accounts::AccountRecordView>, RuntimeError> {
- let snapshot = accounts::snapshot(config)?;
+) -> Result<Option<account::AccountRecordView>, RuntimeError> {
+ let snapshot = account::snapshot(config)?;
Ok(snapshot
.accounts
.into_iter()
diff --git a/src/runtime/mod.rs b/src/runtime/mod.rs
@@ -1,4 +1,4 @@
-pub mod accounts;
+pub mod account;
pub mod config;
pub mod direct_relay;
pub mod farm;
@@ -6,7 +6,6 @@ pub mod farm_config;
pub mod find;
pub mod hyf;
pub mod listing;
-pub mod local;
pub mod local_events;
pub mod logging;
pub mod network;
@@ -14,6 +13,7 @@ pub mod order;
pub mod paths;
pub mod provider;
pub mod signer;
+pub mod store;
pub mod sync;
pub mod validation_receipt;
@@ -24,7 +24,7 @@ pub enum RuntimeError {
#[error("{0}")]
Config(String),
#[error("{0}")]
- Account(#[from] accounts::AccountRuntimeFailure),
+ Account(#[from] account::AccountRuntimeFailure),
#[error("failed to initialize logging: {0}")]
Logging(#[from] radroots_log::Error),
#[error("accounts error: {0}")]
diff --git a/src/runtime/order.rs b/src/runtime/order.rs
@@ -94,7 +94,7 @@ use crate::cli::global::{
OrderSubmitArgs, RecordLookupArgs,
};
use crate::runtime::RuntimeError;
-use crate::runtime::accounts;
+use crate::runtime::account;
use crate::runtime::config::{RuntimeConfig, SignerBackend};
use crate::runtime::direct_relay::{
DirectRelayFailure, DirectRelayFetchError, DirectRelayFetchReceipt, DirectRelayPublishReceipt,
@@ -335,7 +335,7 @@ struct OrderEventListActorContext {
#[derive(Debug, Clone)]
struct OrderBoundBuyerWriteContext {
loaded: LoadedOrderDraft,
- account: accounts::AccountRecordView,
+ account: account::AccountRecordView,
}
#[derive(Debug, Clone)]
@@ -1054,7 +1054,7 @@ fn rebind_inner(
}
let loaded = load_draft(file.as_path()).map_err(RuntimeError::Config)?;
- let target_account = accounts::resolve_account_selector(config, args.selector.as_str())
+ let target_account = account::resolve_account_selector(config, args.selector.as_str())
.map_err(|error| order_rebind_selector_error(args.selector.as_str(), error))?;
let existing_request = order_rebind_existing_request_check(config, &loaded)?;
let from_order_id = loaded.document.order.order_id.clone();
@@ -1236,7 +1236,7 @@ pub fn decide(
return Ok(view);
}
- let seller = match accounts::resolve_account(config)? {
+ let seller = match account::resolve_account(config)? {
Some(account) => account,
None => {
let mut view =
@@ -1373,7 +1373,7 @@ pub fn revision_propose(
return Ok(view);
}
- let seller = match accounts::resolve_account(config)? {
+ let seller = match account::resolve_account(config)? {
Some(account) => account,
None => {
let mut view =
@@ -1684,7 +1684,7 @@ pub fn fulfillment_update(
}
};
- let selected_account = match accounts::resolve_account(config)? {
+ let selected_account = match account::resolve_account(config)? {
Some(account) => account,
None => {
let mut view =
@@ -1975,7 +1975,7 @@ pub fn payment_record(
return Ok(view);
}
- let selected_account = match accounts::resolve_account(config)? {
+ let selected_account = match account::resolve_account(config)? {
Some(account) => account,
None => {
let mut view =
@@ -2069,7 +2069,7 @@ pub fn settlement_decision(
return Ok(view);
}
- let selected_account = match accounts::resolve_account(config)? {
+ let selected_account = match account::resolve_account(config)? {
Some(account) => account,
None => {
let mut view =
@@ -7907,7 +7907,7 @@ fn publish_order_revision(
config: &RuntimeConfig,
args: &OrderRevisionProposeArgs,
status: OrderStatusView,
- signing: accounts::AccountSigningIdentity,
+ signing: account::AccountSigningIdentity,
payload: RadrootsTradeOrderRevisionProposed,
) -> Result<OrderRevisionProposalView, RuntimeError> {
let parts = order_revision_event_parts(&status, &payload)?;
@@ -7924,7 +7924,7 @@ fn publish_order_revision_decision(
args: &OrderRevisionDecisionArgs,
status: OrderStatusView,
proposal: &OrderRevisionProposalRecord,
- signing: accounts::AccountSigningIdentity,
+ signing: account::AccountSigningIdentity,
payload: RadrootsTradeOrderRevisionDecisionEvent,
) -> Result<OrderRevisionDecisionView, RuntimeError> {
let parts = order_revision_decision_event_parts(&payload)?;
@@ -8013,7 +8013,7 @@ fn publish_order_fulfillment(
config: &RuntimeConfig,
args: &OrderFulfillmentArgs,
status: OrderStatusView,
- signing: accounts::AccountSigningIdentity,
+ signing: account::AccountSigningIdentity,
payload: RadrootsTradeFulfillmentUpdated,
) -> Result<OrderFulfillmentView, RuntimeError> {
let parts = order_fulfillment_event_parts(&status, &payload)?;
@@ -8034,7 +8034,7 @@ fn publish_order_cancellation(
config: &RuntimeConfig,
args: &OrderCancelArgs,
status: OrderStatusView,
- signing: accounts::AccountSigningIdentity,
+ signing: account::AccountSigningIdentity,
payload: RadrootsTradeOrderCancelled,
) -> Result<OrderCancellationView, RuntimeError> {
let parts = order_cancellation_event_parts(&status, &payload)?;
@@ -8050,7 +8050,7 @@ fn publish_order_receipt(
config: &RuntimeConfig,
args: &OrderReceiptArgs,
status: OrderStatusView,
- signing: accounts::AccountSigningIdentity,
+ signing: account::AccountSigningIdentity,
payload: RadrootsTradeBuyerReceipt,
) -> Result<OrderReceiptView, RuntimeError> {
let parts = order_receipt_event_parts(&status, &payload)?;
@@ -8066,7 +8066,7 @@ fn publish_order_payment(
config: &RuntimeConfig,
args: &OrderPaymentArgs,
status: OrderStatusView,
- signing: accounts::AccountSigningIdentity,
+ signing: account::AccountSigningIdentity,
payload: RadrootsTradePaymentRecorded,
) -> Result<OrderPaymentView, RuntimeError> {
let parts = order_payment_event_parts(&status, &payload)?;
@@ -8082,7 +8082,7 @@ fn publish_order_settlement(
config: &RuntimeConfig,
args: &OrderSettlementArgs,
status: OrderStatusView,
- signing: accounts::AccountSigningIdentity,
+ signing: account::AccountSigningIdentity,
payload: RadrootsTradeSettlementDecisionEvent,
) -> Result<OrderSettlementView, RuntimeError> {
let parts = order_settlement_event_parts(&status, &payload)?;
@@ -8488,7 +8488,7 @@ fn publish_order_decision(
args: &OrderDecisionArgs,
request: ResolvedSellerOrderRequest,
resolution: SellerOrderRequestResolution,
- signing: accounts::AccountSigningIdentity,
+ signing: account::AccountSigningIdentity,
payload: RadrootsTradeOrderDecisionEvent,
inventory: Option<OrderInventoryView>,
) -> Result<OrderDecisionView, RuntimeError> {
@@ -10243,7 +10243,7 @@ fn inspect_document_with_source_issues(
#[derive(Debug, Clone)]
struct OrderBuyerActorReadiness {
- account: Option<accounts::AccountRecordView>,
+ account: Option<account::AccountRecordView>,
issues: Vec<OrderIssueView>,
}
@@ -10260,7 +10260,7 @@ fn inspect_buyer_actor_readiness(
});
}
- let snapshot = accounts::snapshot(config)?;
+ let snapshot = account::snapshot(config)?;
let Some(account) = snapshot
.accounts
.into_iter()
@@ -10576,7 +10576,7 @@ fn app_order_issue<'a>(issues: &'a [OrderIssueView], code: &str) -> Option<&'a O
fn order_rebind_selector_error(selector: &str, error: RuntimeError) -> RuntimeError {
match error {
RuntimeError::Accounts(_) | RuntimeError::Account(_) => {
- accounts::AccountRuntimeFailure::unresolved_with_detail(
+ account::AccountRuntimeFailure::unresolved_with_detail(
format!("order rebind target selector `{selector}` did not resolve"),
json!({
"selector": selector,
@@ -10635,10 +10635,10 @@ fn order_rebind_existing_request_check(
fn resolve_initial_buyer_actor(
config: &RuntimeConfig,
) -> Result<OrderDraftBuyerActor, RuntimeError> {
- let resolution = accounts::resolve_account_resolution(config)?;
+ let resolution = account::resolve_account_resolution(config)?;
let Some(account) = resolution.resolved_account else {
- return Err(accounts::AccountRuntimeFailure::unresolved_with_detail(
- accounts::unresolved_account_reason(config)?,
+ return Err(account::AccountRuntimeFailure::unresolved_with_detail(
+ account::unresolved_account_reason(config)?,
json!({
"buyer_actor_source": ORDER_BUYER_ACTOR_SOURCE_RESOLVED_ACCOUNT,
"actions": [
@@ -10691,7 +10691,7 @@ fn order_status_actor_context(
});
}
- let selected_account = accounts::resolve_account(config)?;
+ let selected_account = account::resolve_account(config)?;
let Some(account) = selected_account else {
return Ok(OrderDraftStatusActorContext {
source: ORDER_ACTOR_CONTEXT_NETWORK_ONLY,
@@ -10729,7 +10729,7 @@ fn order_event_list_actor_context(
}
Ok(
- accounts::resolve_account(config)?.map(|account| OrderEventListActorContext {
+ account::resolve_account(config)?.map(|account| OrderEventListActorContext {
source: ORDER_ACTOR_CONTEXT_RESOLVED_ACCOUNT,
seller_pubkey: account.record.public_identity.public_key_hex,
}),
@@ -10764,7 +10764,7 @@ fn order_buyer_write_actor_context(
}));
}
- Ok(accounts::resolve_account(config)?.map(|account| {
+ Ok(account::resolve_account(config)?.map(|account| {
let selected_pubkey = account.record.public_identity.public_key_hex;
OrderBuyerWriteActorContext {
bound: None,
@@ -11682,7 +11682,7 @@ fn publish_order_request(
config: &RuntimeConfig,
loaded: &LoadedOrderDraft,
args: &OrderSubmitArgs,
- signing: accounts::AccountSigningIdentity,
+ signing: account::AccountSigningIdentity,
payload: RadrootsTradeOrderRequested,
) -> Result<OrderSubmitView, RuntimeError> {
let listing_event = order_listing_event_ptr(config, loaded)?;
@@ -11850,18 +11850,18 @@ fn order_binding_error_view(
fn validate_bound_order_buyer_account(
config: &RuntimeConfig,
loaded: &LoadedOrderDraft,
-) -> Result<accounts::AccountRecordView, RuntimeError> {
+) -> Result<account::AccountRecordView, RuntimeError> {
let document = &loaded.document;
let account_id = document.buyer_actor.account_id.trim();
let buyer_pubkey = document.buyer_actor.pubkey.trim();
- let snapshot = accounts::snapshot(config)?;
+ let snapshot = account::snapshot(config)?;
let Some(account) = snapshot
.accounts
.iter()
.find(|account| account.record.account_id.as_str() == account_id)
.cloned()
else {
- return Err(accounts::AccountRuntimeFailure::unresolved_with_detail(
+ return Err(account::AccountRuntimeFailure::unresolved_with_detail(
format!(
"order-bound buyer account `{account_id}` is not present in the local account store"
),
@@ -11886,7 +11886,7 @@ fn validate_bound_order_buyer_account(
.buyer_pubkey
.eq_ignore_ascii_case(buyer_pubkey)
{
- return Err(accounts::AccountRuntimeFailure::mismatch_with_detail(
+ return Err(account::AccountRuntimeFailure::mismatch_with_detail(
format!(
"order-bound buyer account `{account_id}` does not match order buyer pubkey `{buyer_pubkey}`"
),
@@ -11906,7 +11906,7 @@ fn validate_bound_order_buyer_account(
}
if !account.write_capable {
- return Err(accounts::AccountRuntimeFailure::watch_only_with_detail(
+ return Err(account::AccountRuntimeFailure::watch_only_with_detail(
account_id,
order_buyer_failure_detail(
loaded,
@@ -11922,8 +11922,8 @@ fn validate_bound_order_buyer_account(
}
if let Some(selector) = config.account.selector.as_deref() {
- let attempted = accounts::resolve_account_selector(config, selector).map_err(|_| {
- accounts::AccountRuntimeFailure::unresolved_with_detail(
+ let attempted = account::resolve_account_selector(config, selector).map_err(|_| {
+ account::AccountRuntimeFailure::unresolved_with_detail(
format!("account override `{selector}` did not resolve to a local buyer account"),
order_buyer_failure_detail(
loaded,
@@ -11939,7 +11939,7 @@ fn validate_bound_order_buyer_account(
})?;
if attempted.record.account_id.as_str() != account_id {
let attempted_pubkey = attempted.record.public_identity.public_key_hex.as_str();
- return Err(accounts::AccountRuntimeFailure::mismatch_with_detail(
+ return Err(account::AccountRuntimeFailure::mismatch_with_detail(
format!(
"account override `{}` cannot retarget order `{}` bound to buyer account `{account_id}`",
attempted.record.account_id, document.order.order_id
@@ -11986,7 +11986,7 @@ fn order_buyer_failure_detail(
fn resolve_local_order_signing_identity(
config: &RuntimeConfig,
loaded: &LoadedOrderDraft,
-) -> Result<accounts::AccountSigningIdentity, ActorWriteBindingError> {
+) -> Result<account::AccountSigningIdentity, ActorWriteBindingError> {
resolve_local_order_bound_buyer_signing_identity(config, loaded, "order submit")
}
@@ -11994,7 +11994,7 @@ fn resolve_local_order_bound_buyer_signing_identity(
config: &RuntimeConfig,
loaded: &LoadedOrderDraft,
action: &str,
-) -> Result<accounts::AccountSigningIdentity, ActorWriteBindingError> {
+) -> Result<account::AccountSigningIdentity, ActorWriteBindingError> {
if !matches!(config.signer.backend, SignerBackend::Local) {
return Err(ActorWriteBindingError::Unconfigured(format!(
"{action} requires signer mode `local`"
@@ -12002,7 +12002,7 @@ fn resolve_local_order_bound_buyer_signing_identity(
}
let account_id = loaded.document.buyer_actor.account_id.trim();
let buyer_pubkey = loaded.document.buyer_actor.pubkey.trim();
- let signing = accounts::resolve_local_signing_identity_for_account(config, account_id)
+ let signing = account::resolve_local_signing_identity_for_account(config, account_id)
.map_err(ActorWriteBindingError::from_runtime)?;
let selected_pubkey = signing
.account
@@ -12012,7 +12012,7 @@ fn resolve_local_order_bound_buyer_signing_identity(
.as_str();
if !selected_pubkey.eq_ignore_ascii_case(buyer_pubkey) {
return Err(ActorWriteBindingError::Account(
- accounts::AccountRuntimeFailure::mismatch_with_detail(
+ account::AccountRuntimeFailure::mismatch_with_detail(
format!(
"account mismatch: order-bound buyer account `{account_id}` pubkey `{selected_pubkey}` cannot sign order buyer_pubkey `{buyer_pubkey}`"
),
@@ -12037,14 +12037,14 @@ fn resolve_local_order_decision_signing_identity(
config: &RuntimeConfig,
seller_pubkey: &str,
decision: OrderDecisionArg,
-) -> Result<accounts::AccountSigningIdentity, ActorWriteBindingError> {
+) -> Result<account::AccountSigningIdentity, ActorWriteBindingError> {
if !matches!(config.signer.backend, SignerBackend::Local) {
return Err(ActorWriteBindingError::Unconfigured(format!(
"order {} requires signer mode `local`",
decision.command()
)));
}
- let signing = accounts::resolve_local_signing_identity(config)
+ let signing = account::resolve_local_signing_identity(config)
.map_err(ActorWriteBindingError::from_runtime)?;
let selected_pubkey = signing
.account
@@ -12054,7 +12054,7 @@ fn resolve_local_order_decision_signing_identity(
.as_str();
if !selected_pubkey.eq_ignore_ascii_case(seller_pubkey) {
return Err(ActorWriteBindingError::Account(
- accounts::AccountRuntimeFailure::mismatch(format!(
+ account::AccountRuntimeFailure::mismatch(format!(
"account mismatch: resolved account pubkey `{selected_pubkey}` cannot sign order seller_pubkey `{seller_pubkey}`"
)),
));
@@ -12065,13 +12065,13 @@ fn resolve_local_order_decision_signing_identity(
fn resolve_local_order_fulfillment_signing_identity(
config: &RuntimeConfig,
seller_pubkey: &str,
-) -> Result<accounts::AccountSigningIdentity, ActorWriteBindingError> {
+) -> Result<account::AccountSigningIdentity, ActorWriteBindingError> {
if !matches!(config.signer.backend, SignerBackend::Local) {
return Err(ActorWriteBindingError::Unconfigured(
"order fulfillment update requires signer mode `local`".to_owned(),
));
}
- let signing = accounts::resolve_local_signing_identity(config)
+ let signing = account::resolve_local_signing_identity(config)
.map_err(ActorWriteBindingError::from_runtime)?;
let selected_pubkey = signing
.account
@@ -12081,7 +12081,7 @@ fn resolve_local_order_fulfillment_signing_identity(
.as_str();
if !selected_pubkey.eq_ignore_ascii_case(seller_pubkey) {
return Err(ActorWriteBindingError::Account(
- accounts::AccountRuntimeFailure::mismatch(format!(
+ account::AccountRuntimeFailure::mismatch(format!(
"account mismatch: resolved account pubkey `{selected_pubkey}` cannot sign order seller_pubkey `{seller_pubkey}`"
)),
));
@@ -12092,13 +12092,13 @@ fn resolve_local_order_fulfillment_signing_identity(
fn resolve_local_order_cancellation_signing_identity(
config: &RuntimeConfig,
buyer_pubkey: &str,
-) -> Result<accounts::AccountSigningIdentity, ActorWriteBindingError> {
+) -> Result<account::AccountSigningIdentity, ActorWriteBindingError> {
if !matches!(config.signer.backend, SignerBackend::Local) {
return Err(ActorWriteBindingError::Unconfigured(
"order cancel requires signer mode `local`".to_owned(),
));
}
- let signing = accounts::resolve_local_signing_identity(config)
+ let signing = account::resolve_local_signing_identity(config)
.map_err(ActorWriteBindingError::from_runtime)?;
let selected_pubkey = signing
.account
@@ -12108,7 +12108,7 @@ fn resolve_local_order_cancellation_signing_identity(
.as_str();
if !selected_pubkey.eq_ignore_ascii_case(buyer_pubkey) {
return Err(ActorWriteBindingError::Account(
- accounts::AccountRuntimeFailure::mismatch(format!(
+ account::AccountRuntimeFailure::mismatch(format!(
"account mismatch: resolved account pubkey `{selected_pubkey}` cannot sign order buyer_pubkey `{buyer_pubkey}`"
)),
));
@@ -12119,13 +12119,13 @@ fn resolve_local_order_cancellation_signing_identity(
fn resolve_local_order_receipt_signing_identity(
config: &RuntimeConfig,
buyer_pubkey: &str,
-) -> Result<accounts::AccountSigningIdentity, ActorWriteBindingError> {
+) -> Result<account::AccountSigningIdentity, ActorWriteBindingError> {
if !matches!(config.signer.backend, SignerBackend::Local) {
return Err(ActorWriteBindingError::Unconfigured(
"order receipt record requires signer mode `local`".to_owned(),
));
}
- let signing = accounts::resolve_local_signing_identity(config)
+ let signing = account::resolve_local_signing_identity(config)
.map_err(ActorWriteBindingError::from_runtime)?;
let selected_pubkey = signing
.account
@@ -12135,7 +12135,7 @@ fn resolve_local_order_receipt_signing_identity(
.as_str();
if !selected_pubkey.eq_ignore_ascii_case(buyer_pubkey) {
return Err(ActorWriteBindingError::Account(
- accounts::AccountRuntimeFailure::mismatch(format!(
+ account::AccountRuntimeFailure::mismatch(format!(
"account mismatch: resolved account pubkey `{selected_pubkey}` cannot sign order buyer_pubkey `{buyer_pubkey}`"
)),
));
@@ -12146,13 +12146,13 @@ fn resolve_local_order_receipt_signing_identity(
fn resolve_local_order_payment_signing_identity(
config: &RuntimeConfig,
buyer_pubkey: &str,
-) -> Result<accounts::AccountSigningIdentity, ActorWriteBindingError> {
+) -> Result<account::AccountSigningIdentity, ActorWriteBindingError> {
if !matches!(config.signer.backend, SignerBackend::Local) {
return Err(ActorWriteBindingError::Unconfigured(
"order payment record requires signer mode `local`".to_owned(),
));
}
- let signing = accounts::resolve_local_signing_identity(config)
+ let signing = account::resolve_local_signing_identity(config)
.map_err(ActorWriteBindingError::from_runtime)?;
let selected_pubkey = signing
.account
@@ -12162,7 +12162,7 @@ fn resolve_local_order_payment_signing_identity(
.as_str();
if !selected_pubkey.eq_ignore_ascii_case(buyer_pubkey) {
return Err(ActorWriteBindingError::Account(
- accounts::AccountRuntimeFailure::mismatch(format!(
+ account::AccountRuntimeFailure::mismatch(format!(
"account mismatch: resolved account pubkey `{selected_pubkey}` cannot sign order buyer_pubkey `{buyer_pubkey}`"
)),
));
@@ -12173,13 +12173,13 @@ fn resolve_local_order_payment_signing_identity(
fn resolve_local_order_settlement_signing_identity(
config: &RuntimeConfig,
seller_pubkey: &str,
-) -> Result<accounts::AccountSigningIdentity, ActorWriteBindingError> {
+) -> Result<account::AccountSigningIdentity, ActorWriteBindingError> {
if !matches!(config.signer.backend, SignerBackend::Local) {
return Err(ActorWriteBindingError::Unconfigured(
"order settlement decision requires signer mode `local`".to_owned(),
));
}
- let signing = accounts::resolve_local_signing_identity(config)
+ let signing = account::resolve_local_signing_identity(config)
.map_err(ActorWriteBindingError::from_runtime)?;
let selected_pubkey = signing
.account
@@ -12189,7 +12189,7 @@ fn resolve_local_order_settlement_signing_identity(
.as_str();
if !selected_pubkey.eq_ignore_ascii_case(seller_pubkey) {
return Err(ActorWriteBindingError::Account(
- accounts::AccountRuntimeFailure::mismatch(format!(
+ account::AccountRuntimeFailure::mismatch(format!(
"account mismatch: resolved account pubkey `{selected_pubkey}` cannot sign order seller_pubkey `{seller_pubkey}`"
)),
));
@@ -12201,14 +12201,14 @@ fn resolve_local_order_revision_decision_signing_identity(
config: &RuntimeConfig,
buyer_pubkey: &str,
args: &OrderRevisionDecisionArgs,
-) -> Result<accounts::AccountSigningIdentity, ActorWriteBindingError> {
+) -> Result<account::AccountSigningIdentity, ActorWriteBindingError> {
if !matches!(config.signer.backend, SignerBackend::Local) {
return Err(ActorWriteBindingError::Unconfigured(format!(
"order revision {} requires signer mode `local`",
args.decision.command()
)));
}
- let signing = accounts::resolve_local_signing_identity(config)
+ let signing = account::resolve_local_signing_identity(config)
.map_err(ActorWriteBindingError::from_runtime)?;
let selected_pubkey = signing
.account
@@ -12218,7 +12218,7 @@ fn resolve_local_order_revision_decision_signing_identity(
.as_str();
if !selected_pubkey.eq_ignore_ascii_case(buyer_pubkey) {
return Err(ActorWriteBindingError::Account(
- accounts::AccountRuntimeFailure::mismatch(format!(
+ account::AccountRuntimeFailure::mismatch(format!(
"account mismatch: resolved account pubkey `{selected_pubkey}` cannot sign order buyer_pubkey `{buyer_pubkey}`"
)),
));
@@ -12631,7 +12631,7 @@ mod tests {
OrderRevisionDecisionArgs, OrderRevisionProposeArgs, OrderSettlementArgs,
OrderSettlementDecisionArg, OrderSubmitArgs,
};
- use crate::runtime::accounts;
+ use crate::runtime::account;
use crate::runtime::config::{
AccountConfig, AccountSecretContractConfig, HyfConfig, IdentityConfig, InteractionConfig,
LocalConfig, LoggingConfig, MigrationConfig, MycConfig, OutputConfig, OutputFormat,
@@ -12867,7 +12867,7 @@ mod tests {
fn order_draft_requires_listing_event_id_for_submit_readiness() {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path());
- let buyer = accounts::create_or_migrate_default_account(&config)
+ let buyer = account::create_or_migrate_default_account(&config)
.expect("buyer account")
.account;
let buyer_account_id = buyer.record.account_id.to_string();
@@ -12914,7 +12914,7 @@ mod tests {
fn order_draft_requires_listing_relays_for_submit_readiness() {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path());
- let buyer = accounts::create_or_migrate_default_account(&config)
+ let buyer = account::create_or_migrate_default_account(&config)
.expect("buyer account")
.account;
let buyer_account_id = buyer.record.account_id.to_string();
@@ -17534,7 +17534,7 @@ mod tests {
fn order_fulfillment_signing_rejects_selected_non_seller_account() {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path());
- accounts::create_or_migrate_default_account(&config).expect("create selected account");
+ account::create_or_migrate_default_account(&config).expect("create selected account");
let fixture = order_status_fixture();
let error = resolve_local_order_fulfillment_signing_identity(
diff --git a/src/runtime/signer.rs b/src/runtime/signer.rs
@@ -1,6 +1,6 @@
use crate::runtime::RuntimeError;
-use crate::runtime::accounts::AccountRuntimeFailure;
-use crate::runtime::accounts::{SHARED_ACCOUNT_STORE_SOURCE, empty_account_resolution_view};
+use crate::runtime::account::AccountRuntimeFailure;
+use crate::runtime::account::{SHARED_ACCOUNT_STORE_SOURCE, empty_account_resolution_view};
use crate::runtime::config::{RuntimeConfig, SIGNER_REMOTE_NIP46_CAPABILITY, SignerBackend};
use crate::view::runtime::{
IdentityPublicView, LocalSignerStatusView, SignerBindingStatusView, SignerStatusView,
@@ -81,9 +81,9 @@ pub fn resolve_actor_write_authority(
fn resolve_local_signer_status(config: &RuntimeConfig) -> SignerStatusView {
let (account_resolution, resolved_account_id) =
- match crate::runtime::accounts::resolve_account_resolution(config) {
+ match crate::runtime::account::resolve_account_resolution(config) {
Ok(resolution) => (
- crate::runtime::accounts::account_resolution_view(&resolution),
+ crate::runtime::account::account_resolution_view(&resolution),
resolution
.resolved_account
.as_ref()
@@ -105,7 +105,7 @@ fn resolve_local_signer_status(config: &RuntimeConfig) -> SignerStatusView {
};
}
};
- let secret_backend = crate::runtime::accounts::secret_backend_status(config);
+ let secret_backend = crate::runtime::account::secret_backend_status(config);
if secret_backend.state == "unavailable" {
let reason = secret_backend.reason.clone();
return SignerStatusView {
@@ -143,7 +143,7 @@ fn resolve_local_signer_status(config: &RuntimeConfig) -> SignerStatusView {
.unwrap_or_else(|| "unknown".to_owned());
let used_fallback = secret_backend.used_fallback;
- match crate::runtime::accounts::resolved_account_signing_status(config) {
+ match crate::runtime::account::resolved_account_signing_status(config) {
Ok(RadrootsNostrAccountStatus::Ready { account }) => {
let capability = RadrootsNostrSignerCapability::LocalAccount(
RadrootsNostrLocalSignerCapability::new(
@@ -211,11 +211,11 @@ fn resolve_local_signer_status(config: &RuntimeConfig) -> SignerStatusView {
source: SHARED_ACCOUNT_STORE_SOURCE.to_owned(),
signer_account_id: None,
account_resolution: account_resolution.clone(),
- reason: crate::runtime::accounts::unresolved_account_reason(config).ok(),
+ reason: crate::runtime::account::unresolved_account_reason(config).ok(),
binding: disabled_binding_status(),
write_kinds: local_write_kind_readiness(
false,
- crate::runtime::accounts::unresolved_account_reason(config).ok(),
+ crate::runtime::account::unresolved_account_reason(config).ok(),
),
local: None,
myc: None,
@@ -239,8 +239,8 @@ fn resolve_local_signer_status(config: &RuntimeConfig) -> SignerStatusView {
}
fn resolve_myc_signer_status(config: &RuntimeConfig) -> SignerStatusView {
- let account_resolution = match crate::runtime::accounts::resolve_account_resolution(config) {
- Ok(resolution) => crate::runtime::accounts::account_resolution_view(&resolution),
+ let account_resolution = match crate::runtime::account::resolve_account_resolution(config) {
+ Ok(resolution) => crate::runtime::account::account_resolution_view(&resolution),
Err(_) => empty_account_resolution_view(),
};
SignerStatusView {
diff --git a/src/runtime/local.rs b/src/runtime/store.rs
diff --git a/src/runtime/sync.rs b/src/runtime/sync.rs
@@ -26,7 +26,7 @@ use serde_json::json;
use crate::cli::global::SyncWatchArgs;
use crate::runtime::RuntimeError;
-use crate::runtime::accounts;
+use crate::runtime::account;
use crate::runtime::config::{PublishMode, RuntimeConfig};
use crate::runtime::direct_relay::{
DirectRelayFailure, DirectRelayFetchError, DirectRelayFetchReceipt, DirectRelayPublishError,
@@ -376,7 +376,7 @@ where
return Ok(push_unconfigured_view(snapshot));
}
- let signing = match accounts::resolve_local_signing_identity(config) {
+ let signing = match account::resolve_local_signing_identity(config) {
Ok(signing) => signing,
Err(RuntimeError::Account(failure)) => {
let mut view = empty_action_from_snapshot(snapshot, "push");
@@ -1632,7 +1632,7 @@ mod tests {
let dir = tempdir().expect("tempdir");
let mut config = sample_config(dir.path(), vec!["wss://relay.example.com".to_owned()]);
config.output.dry_run = true;
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let view = pull_with_fetcher(&config, |_, _| panic!("dry run must not fetch"))
.expect("sync pull dry run");
@@ -1650,7 +1650,7 @@ mod tests {
fn sync_pull_no_relay_action_is_actionable() {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path(), Vec::new());
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let view = pull_with_fetcher(&config, |_, _| {
panic!("unconfigured sync pull must not fetch")
@@ -1669,9 +1669,9 @@ mod tests {
let dir = tempdir().expect("tempdir");
let mut config = sample_config(dir.path(), vec!["wss://relay.example.com".to_owned()]);
config.output.dry_run = true;
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let signing =
- crate::runtime::accounts::create_or_migrate_default_account(&config).expect("account");
+ crate::runtime::account::create_or_migrate_default_account(&config).expect("account");
seed_replica_farm(
&config,
signing
@@ -1718,9 +1718,9 @@ mod tests {
let dir = tempdir().expect("tempdir");
let mut config = sample_config(dir.path(), vec!["wss://relay.example.com".to_owned()]);
config.output.dry_run = true;
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let signing =
- crate::runtime::accounts::create_or_migrate_default_account(&config).expect("account");
+ crate::runtime::account::create_or_migrate_default_account(&config).expect("account");
let selected_pubkey = signing
.account
.record
@@ -1764,9 +1764,9 @@ mod tests {
fn sync_push_publishes_pending_local_author_events_and_updates_state() {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path(), vec!["wss://relay.example.com".to_owned()]);
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let signing =
- crate::runtime::accounts::create_or_migrate_default_account(&config).expect("account");
+ crate::runtime::account::create_or_migrate_default_account(&config).expect("account");
seed_replica_farm(
&config,
signing
@@ -1820,9 +1820,9 @@ mod tests {
fn sync_push_reports_partial_when_other_author_events_remain_pending() {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path(), vec!["wss://relay.example.com".to_owned()]);
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let signing =
- crate::runtime::accounts::create_or_migrate_default_account(&config).expect("account");
+ crate::runtime::account::create_or_migrate_default_account(&config).expect("account");
let selected_pubkey = signing
.account
.record
@@ -1891,8 +1891,8 @@ mod tests {
fn sync_push_reports_unconfigured_when_only_other_author_events_are_pending() {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path(), vec!["wss://relay.example.com".to_owned()]);
- crate::runtime::local::init(&config).expect("store init");
- crate::runtime::accounts::create_or_migrate_default_account(&config).expect("account");
+ crate::runtime::store::init(&config).expect("store init");
+ crate::runtime::account::create_or_migrate_default_account(&config).expect("account");
let other_pubkey = identity(44).public_key_hex();
seed_replica_farm(&config, other_pubkey.as_str());
@@ -1933,9 +1933,9 @@ mod tests {
fn sync_push_failed_publish_leaves_pending_state_retryable() {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path(), vec!["wss://relay.example.com".to_owned()]);
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let signing =
- crate::runtime::accounts::create_or_migrate_default_account(&config).expect("account");
+ crate::runtime::account::create_or_migrate_default_account(&config).expect("account");
seed_replica_farm(
&config,
signing
@@ -1999,7 +1999,7 @@ mod tests {
fn sync_pull_ingests_relay_events_and_market_reads_without_daemon() {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path(), vec!["wss://relay.example.com".to_owned()]);
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let seller = identity(7);
let seller_pubkey = seller.public_key_hex();
let listing_addr = format!("{KIND_LISTING}:{seller_pubkey}:{LISTING_D_TAG}");
@@ -2050,7 +2050,7 @@ mod tests {
fn market_refresh_uses_market_scope_for_ingest() {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path(), vec!["wss://relay.example.com".to_owned()]);
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let seller = identity(8);
let events = vec![listing_event(&seller), plot_event(&seller)];
@@ -2074,7 +2074,7 @@ mod tests {
"wss://relay-b.example.com".to_owned(),
],
);
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let seller = identity(9);
let _ = market_refresh_with_fetcher(&config, fake_fetcher(vec![listing_event(&seller)]))
@@ -2095,7 +2095,7 @@ mod tests {
fn relay_refresh_records_current_run_freshness() {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path(), vec!["wss://relay.example.com".to_owned()]);
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let seller = identity(10);
let view = market_refresh_with_fetcher(&config, fake_fetcher(vec![listing_event(&seller)]))
@@ -2120,7 +2120,7 @@ mod tests {
"wss://relay-b.example.com".to_owned(),
],
);
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let seller = identity(13);
let view = pull_with_fetcher(&config, |relays, _| {
@@ -2156,7 +2156,7 @@ mod tests {
fn sync_pull_reports_no_overwrite_skips_without_replacing_projection() {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path(), vec!["wss://relay.example.com".to_owned()]);
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let seller = identity(12);
let first = listing_event_with_title_at(&seller, "Pasture Eggs", 200);
@@ -2193,7 +2193,7 @@ mod tests {
fn sync_status_reports_relay_set_changed_freshness() {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path(), vec!["wss://relay-a.example.com".to_owned()]);
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let seller = identity(11);
pull_with_fetcher(&config, fake_fetcher(vec![listing_event(&seller)])).expect("sync pull");
let changed = sample_config(dir.path(), vec!["wss://relay-b.example.com".to_owned()]);
@@ -2210,7 +2210,7 @@ mod tests {
fn relay_ingest_splits_unsupported_and_failed_events() {
let dir = tempdir().expect("tempdir");
let config = sample_config(dir.path(), vec!["wss://relay.example.com".to_owned()]);
- crate::runtime::local::init(&config).expect("store init");
+ crate::runtime::store::init(&config).expect("store init");
let seller = identity(9);
let events = vec![
signed_event(