Skip to content

feat(wallet): build ephemeral hot wallet pool with automated multi-sig replenishment (closes #965) - #1081

Merged
ibochielizabeth-spec merged 1 commit into
EF-CHAIN:mainfrom
warlock-netizen:feat/ephemeral-hot-wallet-pool-965
Nov 26, 2026
Merged

ibochielizabeth-spec merged 1 commit into
EF-CHAIN:mainfrom
warlock-netizen:feat/ephemeral-hot-wallet-pool-965

Conversation

@warlock-netizen

Copy link
Copy Markdown
Contributor

Summary

  • Implements \HotWalletPool\ in \�pps/api/src/wallet/hotWalletPool.js\ providing a pool of low-balance, rotatable ephemeral hot wallets.
  • Enforces strict capped balances (< 500 XLM) across all hot wallets in the pool.
  • Automatically fires structured alerts (\low_liquidity, \pool_exhausted) when wallet balances or pool liquidity dip below configured safety thresholds.
  • Automatically triggers multi-sig replenishment transactions from cold storage (2-of-3 threshold) to top up hot wallets up to target capacity without exceeding balance caps.
  • Includes unit and integration test suite in \�pps/api/test/hotWalletPool.test.js\ verifying balance cap enforcement, automated alerts, multi-sig cold storage transfers, and wallet rotation.

Closes #965

@drips-wave

drips-wave Bot commented Nov 24, 2026

Copy link
Copy Markdown

@warlock-netizen Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@ibochielizabeth-spec
ibochielizabeth-spec merged commit d05511b into EF-CHAIN:main Nov 26, 2026
10 of 15 checks passed
ibochielizabeth-spec pushed a commit that referenced this pull request Nov 27, 2026
…ubmission (#1086)

* feat(wallet): gate high-value transfers behind the 2-of-3 quorum on submission

The 2-of-3 quorum policy existed but nothing called it: `submitPayment`
built, signed and submitted a high-value envelope with a single key. This
wires the policy into the one function every outbound value-moving path
goes through, between signing and `server.submitTransaction`, so a transfer
that cannot show two valid signatures throws before any transport exists.

Second signatures come from the deployment's configured quorum co-signers
(`MULTISIG_COSIGNERS`), consulted over the protocol the HSM signer already
speaks. A co-signer is only ever asked, never trusted: its reply must be a
64-byte Ed25519 signature that verifies against this exact envelope, its key
must already be an on-chain signer on the account, and the whole envelope is
then re-verified against the ledger's own signer set and thresholds. With
nothing configured, high-value transfers fail closed with
`cosigner_unavailable` rather than silently downgrading to single-key
submission.

Below the threshold nothing new runs - no extra Horizon read, no co-signer
resolution - so a broken co-signer configuration cannot break an ordinary
payment. `changeTrust` stays single-key, since it moves no value.

Also fixes a reservation leak the gate exposed: the refusal is raised after
`submissionStarted` is set, but `handleStellarPaymentFailure` only enqueues a
reversal for genuine Horizon rejections, so the velocity reservation was
left to expire. Refusals raised before any submission now carry
`preSubmission`, and the orchestrator releases the reservation itself.

* docs(wallet): correct the quorum gate's submission-coverage claim

The gate's own comments claimed `submitPayment` is the one function every
outbound value-moving path goes through. That was true at the base commit but
is not true on current upstream main, and a comment that overstates a security
boundary is worse than no comment: the next reader trusts it.

`wallet/hotWalletPool.js` (#1081, now merged) builds a native payment of
arbitrary size from cold storage, signs it with raw in-process keypairs up to
its own `coldStorageThreshold`, and submits directly to Horizon. It applies an
ad-hoc quorum unrelated to this policy and this gate cannot see or refuse it.

The comments now scope the claim to user-facing outbound transfers, enumerate
the modules that submit directly, and separate the genuinely exempt ones
(changeTrust, fee bumps, channel accounts) from that real gap. Whether the
treasury path comes under one policy is a maintainer decision and is flagged
as such rather than assumed.

Comments only; no behaviour change.

* test(wallet): make the ungated-submission tripwire survive #1066

The guard asserted that `feeBump.js` and `channelAccountPool.js` are dormant,
which was true at this branch's base but is not on current main: #1066 wires
`feeBump.buildFeeBumpEnvelope` into `trustlines.js`. Merging #959 onto main
therefore turned this test red for a reason that is not a bypass — the wrapped
operation is a zero-value ChangeTrust.

Reworked so it asserts the invariant instead of the snapshot:

- `feeBump.js` may have callers, but only allowlisted ones. Subset semantics,
  so it holds both on a base that predates `trustlines.js` and on main; an
  unsanctioned caller still fails, because feeBump is generic and could be
  handed a valued inner transaction.
- `channelAccountPool.js` and `hotWalletPool.js` must stay dormant. Both
  submit valued transactions straight to Horizon. `hotWalletPool` (#1081)
  signs native payments of arbitrary size with raw in-process keypairs under
  its own quorum notion; nothing requires it today, so it is a latent rather
  than live gap, and this is what keeps it that way.

Verified red-to-green against both trees: this branch's base and a trial merge
onto current upstream main. The module comment is corrected to match.

Tests only, plus comments; no behaviour change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build Ephemeral Hot Wallet Pool with Automated Replenishment from Cold Storage

2 participants