diff --git a/crates/aldabra-mcp/src/tools.rs b/crates/aldabra-mcp/src/tools.rs index 256bb6b..7928d07 100644 --- a/crates/aldabra-mcp/src/tools.rs +++ b/crates/aldabra-mcp/src/tools.rs @@ -417,6 +417,20 @@ impl WalletService { if lovelace == 0 { return Err("lovelace must be > 0".into()); } + // AUDIT4-G2 fix: catch sub-min-utxo ada-only sends client-side + // before the chain rejects them (saves a koios round-trip + the + // user's mental model of "tx submitted" → "tx failed minutes later"). + // Asset-bearing sends have a dynamic min driven by asset count + + // name lengths — let those reach chain so the real number is in + // the error. + let default_min = ProtocolParams::default().min_utxo_lovelace; + if assets.is_empty() && lovelace < default_min { + return Err(format!( + "lovelace {lovelace} below min-utxo {default_min}; \ + the chain would reject this output. Send ≥ {default_min} \ + (1 ADA), or pass assets to use the dynamic asset-aware min." + )); + } self.enforce_value_cap(lovelace, force)?; let utxos = self