fix(cli)(sphere-sdk#455): mint test tokens locally (drop HTTP faucet)#45
Merged
Conversation
…P faucet The faucet/topup/top-up handlers now call sphere.payments.mintFungibleToken() to mint test tokens directly via the L3 aggregator. This removes the dependency on the external https://faucet.unicity.network HTTP service — which was the dominant cause of the soak flakiness reported in #455 (single-coin path lost Nostr events; bulk path stayed lucky because 7 parallel events raised retention odds). Behavioral changes: - Nametag precondition dropped — local mint goes to the wallet's own signing key; nothing on-chain depends on a registered nametag. - Default coin set unchanged (UCT 100, BTC 1, ETH 42, SOL 1000, USDT 1000, USDC 1000, USDU 1000) — soaks/playbooks see the same balances after `sphere faucet`. - Symbol resolution covers both the legacy faucet names ("unicity", "bitcoin", ...) and the canonical symbols ("UCT", "BTC", ...). - Bulk mint runs sequentially to keep output ordered and sidestep potential storage-write races between concurrent addToken() calls. - Help text + command listing refreshed to reflect "mint locally". Integration test: dropped the no-nametag dispatch pin (premise gone) and refreshed the live-mint test to match the new "Minting … locally" / "Received …" wording. Help-shape pins still cover all three aliases. Verified: typecheck clean; 127 unit tests pass; integration faucet suite 4/4 pass including live mint of 1 UCT against the testnet aggregator.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes upstream: unicity-sphere/sphere-sdk#455
Summary
sphere faucet/topup/top-upnow mint test tokens directly via the L3 aggregator (sphere.payments.mintFungibleToken()).https://faucet.unicity.networkHTTP service is no longer touched. This removes the dominant cause of sphere-sdk#455 single-coin soak flakiness (the HTTP→Nostr→relay→subscriber race).Why
sphere-sdk#455 documents
manual-test-swap-roundtrip.shfailing consistently at §2 becausesphere faucet 100 UCT(single-coin path) returned HTTP 200 but the receiver's wallet never materialized the token. Bulksphere faucet(7 events) usually survived; single-event runs lost their event in a relay TTL / subscription-window race. Cutting the HTTP faucet and minting locally bypasses the whole race.Test plan
npm run build— cleannpx tsc --noEmit— exit 0npx vitest run— 127/127 unit tests passnpx vitest run --config vitest.integration.config.ts test/integration/cli-faucet.integration.test.ts— 3 pass + 1 skipped (live mint gated by E2E_RUN_FAUCET)E2E_RUN_FAUCET=1 ...— 4/4 including live mint of 1 UCT against testnet aggregator (no nametag, ~4s)sphere faucetminted all 7 coins, exit 0manual-test-swap-roundtrip.sh— Scenarios A (happy-path) + B (reject) both ALL GREEN. §2 baselines materialize on first try (alice 100 UCT, bob 100 ETH); swap deposits/payouts complete; balance deltas match exactly. See sphere-sdk#456 for the one unrelated infra blocker uncovered along the way (the@escrow-testnetnametag resolution failure — worked around withESCROW=DIRECT://...).Notes
PaymentsModule.mintFungibleToken()is already onmain(added in feat/migrate-state-transition-sdk → 5c8e5b6).unicity,bitcoin) and canonical symbols (UCT,BTC).addToken()calls. ~7 inclusion-proof waits ≈ 10s in practice.Related
@escrow-testnetnametag does not resolve on testnet relay) — unrelated infra issue, does not affect this PR.