Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore: update doc references from `tinywallet` to `tinywallet-bus` and clarify key derivation bounda\n\nUpdated documentation across the wallet and x402 modules to reflect the split between the root `tinywallet` crate and the `tinywallet-bus` contract crate, correcting stale references and explaining which derivation paths live where. The key change is that private key derivation now happens only in the root crate or via confidential module calls, not in the bus crate, and the doc comments across all chain modules and the x402 signer now accurately describe this architecture.\n\nAuto-committed-on: dragonfly\n

Steven Enamakel7d0e0e533913
diff --git a/src/openhuman/web3/wallet/abi.rs b/src/openhuman/web3/wallet/abi.rs
index 91cfb2c11d..8750482eb3 100644
--- a/src/openhuman/web3/wallet/abi.rs
+++ b/src/openhuman/web3/wallet/abi.rs
@@ -1,4 +1,4 @@
-//! ERC-20 calldata, delegated to `tinywallet`.
+//! ERC-20 calldata, delegated to `tinywallet-bus`.
//!
//! This used to hand-build an `ethers_core::abi::Function` to encode one call.
//! That worked, and it cost the whole `ethers-core` ABI machinery — a type
diff --git a/src/openhuman/web3/wallet/chains/btc.rs b/src/openhuman/web3/wallet/chains/btc.rs
index d96466b224..40f831e10a 100644
--- a/src/openhuman/web3/wallet/chains/btc.rs
+++ b/src/openhuman/web3/wallet/chains/btc.rs
@@ -76,7 +76,7 @@ pub fn validate_btc_address(addr: &str) -> Result<String, String> {
/// Sender-side validation — must be P2WPKH because we only know how to
/// derive + sign for native segwit (`bc1q…`). Recipients can be any type.
///
-/// See [`validate_btc_address`] for why this delegates. `tinywallet` keeps the
+/// See [`validate_btc_address`] for why this delegates. `tinywallet-bus` keeps the
/// two rules as separate functions for the same reason this module does: using
/// the recipient rule for a sender accepts an address that only fails later,
/// at signing time.
@@ -123,10 +123,15 @@ pub async fn broadcast_raw_hex(tx_hex: &str) -> Result<String, String> {
/// Derive the P2WPKH signing key for `derivation_path` from a BIP-39 mnemonic.
///
-/// Delegates to the vendored [`tinywallet_bus`] crate, which owns BIP-32
-/// secp256k1 derivation. Custody stays here: the mnemonic is decrypted from
-/// the keyring by this crate and handed over as a `&str` that is not retained.
-/// Test-only: production derives inside the wallet module.
+/// Test-only, and deliberately on the **root** `tinywallet` crate rather than
+/// `tinywallet-bus`: `key` is one of the gates that did not move into the
+/// contract crate, because deriving is the module's job. The root crate is a
+/// dev-dependency here, so this derivation stack is not linked into the shipped
+/// binary. Production derives inside the wallet module, via
+/// `modules::wallet::derive_account`.
+///
+/// Custody stays here: the mnemonic is decrypted from the keyring by this crate
+/// and handed over as a `&str` that is not retained.
#[cfg(test)]
fn derive_btc_private_key(
mnemonic: &str,
@@ -422,7 +427,7 @@ mod tests {
#[test]
fn validate_btc_address_rejects_testnet() {
let err = validate_btc_address("tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx").unwrap_err();
- // `tinywallet` reports a wrong-network address as a distinct condition
+ // `tinywallet-bus` reports a wrong-network address as a distinct condition
// from a malformed one, so the message names the required network.
assert!(err.contains("not on mainnet"), "got: {err}");
}
diff --git a/src/openhuman/web3/wallet/chains/solana.rs b/src/openhuman/web3/wallet/chains/solana.rs
index 751be6b5f2..c0aa569983 100644
--- a/src/openhuman/web3/wallet/chains/solana.rs
+++ b/src/openhuman/web3/wallet/chains/solana.rs
@@ -92,12 +92,17 @@ pub async fn native_balance(address: &str) -> Result<u128, String> {
/// Derive the Solana signing key for `derivation_path` from a BIP-39 mnemonic.
///
-/// Delegates to the vendored [`tinywallet_bus`] crate, which owns SLIP-0010
-/// ed25519 derivation. The hand-rolled HMAC walk and path parser that used to
-/// live here moved there wholesale — nothing about "derive an ed25519 key at a
-/// hardened path" is OpenHuman-specific. Custody stays here: the mnemonic
-/// arrives already decrypted from the keyring and `tinywallet` never sees a
-/// stored secret.
+/// Test-only, and deliberately on the **root** `tinywallet` crate rather than
+/// `tinywallet-bus`: `key` is one of the gates that did not move into the
+/// contract crate. The root crate is a dev-dependency here, so this derivation
+/// stack is not linked into the shipped binary. Production derives inside the
+/// wallet module, via `modules::wallet::derive_account`.
+///
+/// The root crate owns SLIP-0010 ed25519 derivation; the hand-rolled HMAC walk
+/// and path parser that used to live here moved there wholesale — nothing about
+/// "derive an ed25519 key at a hardened path" is OpenHuman-specific. Custody
+/// stays here: the mnemonic arrives already decrypted from the keyring and
+/// `tinywallet` never sees a stored secret.
///
/// One behavioural note: `tinywallet` reports a non-hardened Solana path as
/// its own error variant rather than folding it into a generic parse failure,
diff --git a/src/openhuman/web3/wallet/chains/tron.rs b/src/openhuman/web3/wallet/chains/tron.rs
index 3eaba69004..6318c160a1 100644
--- a/src/openhuman/web3/wallet/chains/tron.rs
+++ b/src/openhuman/web3/wallet/chains/tron.rs
@@ -143,11 +143,16 @@ fn tron_transaction_spec(
/// Derive the Tron signing key and its base58check address.
///
-/// Delegates to the vendored [`tinywallet_bus`] crate, which owns BIP-32
-/// secp256k1 derivation and the Keccak-then-base58check address construction.
-/// The hand-rolled BIP-32 walk and path parser that used to live here moved
-/// there wholesale. Custody stays here.
-/// Test-only: production derives inside the wallet module.
+/// Test-only, and deliberately on the **root** `tinywallet` crate rather than
+/// `tinywallet-bus`: `key` is one of the gates that did not move into the
+/// contract crate. The root crate is a dev-dependency here, so this derivation
+/// stack is not linked into the shipped binary. Production derives inside the
+/// wallet module, via `modules::wallet::derive_account`.
+///
+/// The root crate owns BIP-32 secp256k1 derivation and the
+/// Keccak-then-base58check address construction; the hand-rolled BIP-32 walk
+/// and path parser that used to live here moved there wholesale. Custody stays
+/// here.
#[cfg(test)]
fn derive_tron_keypair(mnemonic: &str, derivation_path: &str) -> Result<(Vec<u8>, String), String> {
let derived = tinywallet::key::derive(tinywallet::Chain::Tron, mnemonic, derivation_path)
diff --git a/src/openhuman/web3/wallet/execution.rs b/src/openhuman/web3/wallet/execution.rs
index a7e48870b0..e0c102543b 100644
--- a/src/openhuman/web3/wallet/execution.rs
+++ b/src/openhuman/web3/wallet/execution.rs
@@ -363,7 +363,7 @@ fn validate_address(chain: WalletChain, addr: &str) -> Result<String, String> {
WalletChain::Solana => tinywallet_bus::Chain::Solana,
WalletChain::Tron => tinywallet_bus::Chain::Tron,
};
- debug!("{LOG_PREFIX} validate_address chain={chain:?} role=recipient dispatch=tinywallet");
+ debug!("{LOG_PREFIX} validate_address chain={chain:?} role=recipient dispatch=tinywallet_bus");
let result = tinywallet_bus::address::validate(tw_chain, addr).map_err(|e| e.to_string());
debug!(
"{LOG_PREFIX} validate_address chain={chain:?} role=recipient result={}",
diff --git a/src/openhuman/web3/wallet/transport.rs b/src/openhuman/web3/wallet/transport.rs
index 85138cbcb9..96953d88df 100644
--- a/src/openhuman/web3/wallet/transport.rs
+++ b/src/openhuman/web3/wallet/transport.rs
@@ -1,6 +1,6 @@
//! OpenHuman's implementation of the [`tinywallet_bus::rpc::Transport`] seam.
//!
-//! `tinywallet` performs no I/O and takes no URLs: it names a
+//! `tinywallet-bus` performs no I/O and takes no URLs: it names a
//! [`NetworkId`](tinywallet_bus::rpc::NetworkId) and asks a host to reach it. This
//! module is that host side — the adapter that lets `tinywallet_bus::rpc` and
//! the chain modules run against OpenHuman's existing RPC layer.
@@ -16,7 +16,7 @@
//!
//! ## Error mapping is the part worth reviewing
//!
-//! `tinywallet` splits transport failures into retryable
+//! `tinywallet-bus` splits transport failures into retryable
//! ([`TransportError::Unreachable`]) and authoritative
//! ([`TransportError::Rpc`]), and a host's failover depends on that
//! distinction: retrying an authoritative "insufficient funds" gets the same
@@ -53,13 +53,13 @@ impl OpenHumanTransport {
}
}
-/// Map a `tinywallet` network onto OpenHuman's chain enum plus a base URL.
+/// Map a `tinywallet-bus` network onto OpenHuman's chain enum plus a base URL.
#[allow(unreachable_patterns)]
fn resolve(network: NetworkId) -> Result<String, TransportError> {
match network.chain {
tinywallet_bus::Chain::Evm => {
// An EVM request names its EIP-155 chain id; resolving it here is
- // what keeps `tinywallet` free of OpenHuman's network enum.
+ // what keeps `tinywallet-bus` free of OpenHuman's network enum.
let chain_id = network.evm_chain_id.ok_or_else(|| TransportError::Rpc {
network,
message: "EVM requests require an EIP-155 chain id".to_string(),
diff --git a/src/openhuman/web3/x402/ops.rs b/src/openhuman/web3/x402/ops.rs
index 85544e1aa5..2180e496af 100644
--- a/src/openhuman/web3/x402/ops.rs
+++ b/src/openhuman/web3/x402/ops.rs
@@ -742,12 +742,28 @@ pub(crate) fn evm_payment_payload(
})
}
-/// Derive the wallet's EVM signing key from the encrypted mnemonic.
+/// Resolve the EVM account an x402 payment will be signed as.
///
-/// Returns the raw secret and the checksummed address it controls. Derivation
-/// goes through `tinywallet_bus::key` — the same BIP-32 walk the wallet domain uses,
-/// so an x402 payment is signed by exactly the account the wallet reports — and
-/// the key stays in this process.
+/// Returns the config, the [`SecretMaterial`](tinywallet_bus::wire::SecretMaterial)
+/// the signing calls take, and the checksummed address that material controls.
+///
+/// # Where the key is, and where it is not
+///
+/// **No private key is derived in this process.** The address comes back from
+/// `modules::wallet::derive_account` — a confidential call into the loaded
+/// `tinywallet` module, which derives, answers with public data only, and wipes
+/// its copy of the phrase before returning. The signature is produced the same
+/// way, by `modules::wallet::sign_message`. This binary links no derivation
+/// stack at all: it takes `tinywallet-bus`, the wire contract, and `key` is one
+/// of the gates that deliberately stayed in the root crate.
+///
+/// What *does* live in this process is the decrypted **mnemonic**, held in the
+/// returned `SecretMaterial` for as long as a caller holds it and sent across
+/// the bus on each confidential call. That is the exposure to reason about
+/// here; a derived private key is not one of them.
+///
+/// Deriving the address rather than assuming one is what makes an x402 payment
+/// signed by exactly the account the wallet reports.
async fn evm_signer() -> Result<
(
crate::openhuman::config::Config,
diff --git a/src/openhuman/web3/x402/x402_tests.rs b/src/openhuman/web3/x402/x402_tests.rs
index 446a187801..7c1c59e564 100644
--- a/src/openhuman/web3/x402/x402_tests.rs
+++ b/src/openhuman/web3/x402/x402_tests.rs
@@ -411,8 +411,11 @@ fn eip712_domain_separator_is_deterministic() {
/// The BIP-39 vector mnemonic's EVM account: raw secret and its address.
///
-/// Derived through `tinywallet_bus::key`, which is what the production path uses,
-/// so the test signs as exactly the account the wallet would.
+/// Derived through the **root** `tinywallet` crate's `key` gate, taken here as a
+/// dev-dependency. Production does not derive in this process at all — it calls
+/// `modules::wallet::derive_account` — so this reproduces the same BIP-32 walk
+/// locally, which is what lets the test sign as exactly the account the wallet
+/// would without standing up a broker.
fn test_signer() -> (Vec<u8>, String) {
let test_mnemonic = "abandon abandon abandon abandon abandon abandon \
abandon abandon abandon abandon abandon about";