Skip to content

trader-roundtrip soak: reshape to per-user local-HM pattern #477

Description

@vrogojin

Why

The current manual-test-trader-roundtrip.sh (PR #475 / issue #474) is written against a shared host manager: it assumes HOST_MANAGER (or SPHERE_HOST_MANAGER) points to one HM that both alice and bob can spawn trader tenants on. Two problems with that:

  1. Auth model mismatch. A host manager whitelists AUTHORIZED_CONTROLLERS at boot; the public HM allows exactly one controller pubkey at a time. The soak creates two fresh wallets each run, neither of which is on the whitelist. To run the soak end-to-end against a shared HM, the operator has to edit manager.env and restart the HM container per run — impractical.

  2. Architectural intent. Per project owner guidance, the design is for each developer to run their own local HM scoped to their controller pubkey. The public HM is reserved for shared services (escrow, faucet, etc.). The soak should mirror that — alice brings up her own local HM, bob brings up his.

What changes

Once sphere trader spawn / stop lands in sphere-cli (unicity-sphere/sphere-cli#47-or-similar), reshape §3 / §11 of manual-test-trader-roundtrip.sh:

Today (§3):

sphere host spawn alice-trader-$SUFFIX \
  --template trader-agent --nametag alice-trader-$SUFFIX \
  --env UNICITY_CONTROLLER_PUBKEY=<alice-pubkey> ...

After the wrapper lands:

cd "$PEER_ALICE"
sphere wallet use alice
ALICE_TRADER_ADDR=$(sphere trader spawn --name alice-trader-$SUFFIX --json | jq -r .agent_address)

cd "$PEER_BOB"
sphere wallet use bob
BOB_TRADER_ADDR=$(sphere trader spawn --name bob-trader-$SUFFIX --json | jq -r .agent_address)

Each sphere trader spawn brings up its own HM + tenant scoped to the current wallet's controller pubkey. No shared HM. No HOST_MANAGER env var. No AUTHORIZED_CONTROLLERS editing.

§11 cleanup becomes:

cd "$PEER_ALICE" && sphere wallet use alice && sphere trader stop --name alice-trader-$SUFFIX
cd "$PEER_BOB"   && sphere wallet use bob   && sphere trader stop --name bob-trader-$SUFFIX

Everything in between (§4 ready-check, §5 fund, §6/§7 post intents, §8 wait for completion, §9 assert deltas) stays the same — the wrapper makes the tenant's address available, but post-spawn the existing sphere trader create-intent --tenant <addr> flow is unchanged.

Acceptance

  • Soak script's # KNOWN LIMITATIONS block updated to remove the controller-auth caveat.
  • Soak script drops HOST_MANAGER and SPHERE_HOST_MANAGER env contracts; replaces with --name slugs.
  • §11 cleanup uses sphere trader stop; the KEEP_TENANTS=1 flag forwards to --keep-hm --keep-data.
  • Soak's wall-time budget revised — local-HM-per-user adds startup time vs shared HM. Bumping TRADER_DEAL_DEADLINE_S default from 600 to 900 s likely necessary.
  • End-to-end testnet validation: 3-of-3 consecutive runs of the reshaped soak pass.
  • Demo playbook (docs/DEMO-PLAYBOOK-TRADER-ROUNDTRIP.md) §3 narrative updated — "alice spins up her own trader" is a stronger demo beat than "alice issues a spawn against the shared HM."

Out of scope

  • The wrapper itself (sphere trader spawn / stop) — tracked in sphere-cli.
  • The trader image rebuild — tracked in agentic_hosting.
  • Integration of the trader engine into sphere-sdk as a MarketModule extension — separate conversation.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions