Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 159 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ resolver = "2"
members = [
"crates/crypto",
"crates/wallet-core",
"crates/evm-core",
"crates/chain",
"crates/store",
"crates/webhooks",
"crates/email",
Expand Down Expand Up @@ -32,6 +34,9 @@ slip10_ed25519 = "0.1.3"
tiny-bip39 = "2.0.0"
ed25519-dalek = "2.2.0"
aes-gcm = "0.10.3"
# --- EVM / secp256k1 (see docs/architecture.md ADR: narrow primitives over alloy, MSRV 1.84.1) ---
k256 = "0.13"
sha3 = "0.10"
zeroize = { version = "1.8.2", features = ["derive"] }
hmac = "0.12.1"
hkdf = "0.12.4"
Expand Down Expand Up @@ -67,6 +72,8 @@ proptest = "1"
# --- internal crates ---
octo-crypto = { path = "crates/crypto" }
octo-wallet-core = { path = "crates/wallet-core" }
octo-evm-core = { path = "crates/evm-core" }
octo-chain = { path = "crates/chain" }
octo-store = { path = "crates/store" }
octo-webhooks = { path = "crates/webhooks" }
octo-email = { path = "crates/email" }
Expand Down
37 changes: 37 additions & 0 deletions bin/server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use anyhow::{Context, Result};
use octo_api::{build_router, AppState};
use octo_email::EmailSender;
use octo_ingest::confirmation::EvmSupervisor;
use octo_ingest::Supervisor;
use octo_resilience::ResilienceConfig;
use octo_store::Store;
Expand Down Expand Up @@ -89,6 +90,30 @@ async fn main() -> Result<()> {
"deposit ingest supervisor started"
);

// EVM confirmation tracker (background task) — only runs when an RPC endpoint is
// configured. Not every deployment has EVM wallets yet, and there is no sane default RPC
// URL to fall back to (unlike Horizon, which has a public testnet endpoint).
if let Some(evm_rpc_url) = cfg.evm_rpc_url.clone() {
let evm_supervisor = EvmSupervisor::new_with_resilience(
store.clone(),
evm_rpc_url,
WebhookSender::new(store.clone()),
cfg.network.as_str(),
cfg.resilience.retry_policy(),
cfg.resilience.circuit_breaker(),
);
let interval = Duration::from_secs(cfg.evm_confirmation_interval_secs);
tokio::spawn(async move {
evm_supervisor.run(interval).await;
});
tracing::info!(
interval_secs = cfg.evm_confirmation_interval_secs,
"evm confirmation tracker started"
);
} else {
tracing::info!("EVM_RPC_URL not set; evm confirmation tracker not started");
}

// REST API.
let app = build_router(state);
let listener = tokio::net::TcpListener::bind(&cfg.bind_addr)
Expand Down Expand Up @@ -134,6 +159,10 @@ struct Config {
bind_addr: String,
ingest_interval_secs: u64,
ingest_page_limit: u32,
/// JSON-RPC endpoint for the EVM confirmation tracker. Optional: unset means no EVM wallets
/// are in use yet, and the tracker simply doesn't start (see `docs/deposit-model.md`).
evm_rpc_url: Option<String>,
evm_confirmation_interval_secs: u64,
/// Resilience settings for all Horizon clients (API + ingest).
///
/// | Variable | Default | Description |
Expand Down Expand Up @@ -203,6 +232,12 @@ impl Config {

let resilience = ResilienceConfig::from_env();

let evm_rpc_url = std::env::var("EVM_RPC_URL").ok();
let evm_confirmation_interval_secs = std::env::var("EVM_CONFIRMATION_INTERVAL_SECS")
.ok()
.and_then(|s| s.parse().ok())
.unwrap_or(15);

Ok(Config {
database_url,
network,
Expand All @@ -217,6 +252,8 @@ impl Config {
bind_addr,
ingest_interval_secs,
ingest_page_limit,
evm_rpc_url,
evm_confirmation_interval_secs,
resilience,
})
}
Expand Down
2 changes: 2 additions & 0 deletions crates/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ authors.workspace = true
[dependencies]
octo-crypto.workspace = true
octo-wallet-core.workspace = true
octo-evm-core.workspace = true
octo-chain.workspace = true
octo-store.workspace = true
octo-webhooks.workspace = true
octo-email.workspace = true
Expand Down
Loading
Loading