Skip to content

Private RFQ showcase: L2PS transport, agent registration, settlement - #1

Open
pallytin88 wants to merge 8 commits into
mainfrom
feat/private-rfq-showcase
Open

pallytin88 wants to merge 8 commits into
mainfrom
feat/private-rfq-showcase

Conversation

@pallytin88

@pallytin88 pallytin88 commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

What this is

The complete SuperColony package for a private DACS-3 RFQ negotiation on Demos: a buyer agent and a seller agent negotiate inside an encrypted L2PS subnet on a self-hosted node, and only the listing, the two vet records, a commitment hash and the payment land on the public testnet. Offers and counters never leave the subnet.

This PR opens the package for review by DACS contributors. It is the exact code two external testers ran on 2026-10-09 (bundle dacs-rfq-tester-2026-10-09b.tgz), each completing a settled 9.5 DEM deal against our node.

Components

  • Transport (src/transport/): L2PS carrier (l2ps.ts, l2psDemos.ts), signed channel envelopes inside encrypted subnet transactions, subnet-bound history reads, ack threshold confirmed; interim HTTP transport kept for comparison.
  • Agent registration (src/registration/): an agent signs a request with its wallet and sends an X25519 public key; the host provisions a dedicated subnet, seals the subnet key to that X25519 key (HKDF, AES-GCM), funds the agent on the host chain, and admits it live. Auto-approve policy for contributor testing. No clear-text secret ever leaves either side.
  • Settlement (src/settle.ts, src/walletLock.ts): pay-DEM rail authenticated against the chain, policy-hash keyed spend ledger, terminal-absent reconciliation, serial wallet lock (fixes the anchor/transfer nonce race).
  • Commitment (src/commit.ts, src/live/anchors.ts): storage-program anchor with write evidence; readers by native locator or logical name.
  • Buyer (src/buyer/): MCP server for an LLM buyer, showcase viewer with per-job events and a subnet exhibit (metadata only). Seller (src/seller/): daemon with rule policy and live member admission.
  • bin/: buyer, seller, register, approve, fund, fund-local, reconcile, drive, edge; setup.sh clones the DACS SDK branch (dacs-sdk PR #332) and pins demosdk 4.0.18 beside it.
  • Docs: README.md runbook (node, L2PS, registration, supervision, exposure), TESTERS.md for external testers.

Verification

  • vitest run: 112 tests, 15 files, including the DACS-3 v0.6 canonical vectors; same result in a clean-room install from the 09d bundle.
  • Live on the patched stack (2026-10-09 ~21:00Z): job 01M4H798SZYGXPNMP4F9H3FZ89, 9 → 10.5 → 9.5, payment e7bd692b… confirmed in block 491494, zero history-decrypt failures.
  • Clean-room install on Node 22: setup.sh exits 0 with demosdk 4.0.18 and getL2PSHistory present.
  • Live: jobs 01M4G1KAQVAMQ3JH8TBA1Q0M2C and 01M4GJE5V777F9AH9SF0QBCKGF by an external tester; commitments stor-b29327fb… / stor-3d9e11b0…, payments in blocks 487580 / 489329. The anchor read back from the public RPC carries job id, parties, listing ref, agreement hash and signature, and no price.

Second commit: private security read (783eb26)

A peer read of this package produced seven findings, all confirmed and fixed here:

  1. Registration keeps only the host sealed into the credential; REGISTER_URL must be https off loopback. History rows are decrypted locally from the stored ciphertext and hash-checked; a node's content field is never used.
  2. Terminal absence binds the failed transfer to the reservation (payer, payee, amount); reconcile refuses a differing operator hash, reports a confirmed transfer as settled, and records evidence only after the chain check.
  3. Settled authentication requires amount and, when present, the native-send args to match the reserved payee and amount (no OR).
  4. Approval persists the minted subnet and the signed funding hash before the broadcast; an interrupted approval resumes and never funds twice.
  5. One lock per L2PS account, shared by every subnet client and the tester funder.
  6. The viewer no longer sends access-control-allow-origin: *.
  7. REGISTRATION_AUTO_APPROVE=all is capped by REGISTRATION_AUTO_APPROVE_MAX (default 20).

Third commit: SDK head and second read

setup.sh pins the SDK commit (the branch moved under PR #332 and an unpinned install broke). The durable client gets a verifier-owned profile admission from the operator's peer table; the verifier resolves keys for the CH-7 member. From a second private read: a cross-process wallet lock shared by the daemon and the operator CLIs, the funding callback on bin/approve.mts, a mandatory expected transfer for terminal absence plus a cross-reservation refusal, an atomic auto-approve budget with a total-DEM cap, and a clock check on carriers. Live on this head: job 01M4KA5F7R721T335KMHXD6JTY, payment 330dcf1d….

Depends on

Filed by SuperColony; findings verified by parallel AUDITOR/DETECTIVE/ANALYST byte-verification.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KuxqrwyA8kuyT1ZJLUWZWo

pallytin88 and others added 2 commits October 9, 2026 14:34
…n, settlement)

The SuperColony buyer/seller agents that negotiate a DACS-3 RFQ privately
and land only the commitment hash and the payment on the public Demos
testnet. Snapshot of the package as run by two external testers on
2026-10-09.

- transport: L2PS subnet carrier on a self-hosted node (signed channel
  envelopes inside encrypted subnet transactions, subnet-bound history
  reads, ack threshold `confirmed`), plus the interim HTTP transport
- registration: agents join with a signed request; the host provisions
  a dedicated subnet, seals the subnet key to the agent's X25519 key,
  funds the agent on the host chain; auto-approval policy
- settlement: pay-DEM rail with on-chain authentication, policy-hash
  keyed spend ledger, terminal-absent reconciliation, serial wallet lock
- commitment: storage-program anchor with write evidence; anchor reads
  by native locator or logical name
- buyer: MCP server + showcase viewer (procurement events, subnet
  exhibit as metadata only); seller daemon with rule policy and live
  member admission
- bin: buyer, seller, register, approve, fund, fund-local, reconcile,
  drive, edge; setup.sh pins demosdk 4.0.18 beside the DACS SDK branch
- docs: README (runbook), TESTERS.md (external tester guide)
- tests: 102 (vitest), including DACS-3 v0.6 canonical vectors

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KuxqrwyA8kuyT1ZJLUWZWo
…yption, settlement binding, resumable approval, shared L2PS lock, auto-approve cap, CORS)

Findings from a private peer read of this package and kynesyslabs/node#1033,
each verified against the code and fixed here:

1. register.mts keeps only the host sealed into the credential; a host named
   by the clear-text status response is ignored (logged), and REGISTER_URL
   must be https:// off loopback. The L2PS client decrypts history locally
   from the row's stored ciphertext with the subnet key and checks the
   decrypted hash against the row; a `content` field from the node is never
   used (node#1033 now returns `encrypted_payload` instead of plaintext).
2. Terminal absence binds the failed transfer to the reservation: this payer,
   this payee, this amount. reconcile refuses an operator hash that differs
   from the remembered one, reports a chain-confirmed transfer as settled and
   never releases it, and writes evidence only after the chain check.
3. Settled authentication requires `amount` to equal the reserved amount and,
   when native-send args are present, those to name the same payee and
   amount (an OR between the two used to pass).
4. Approval records the minted subnet before funding and the signed funding
   hash before the broadcast (store.beginProvision / beginFunding; funder
   signs first and calls back). An approval interrupted after the broadcast
   resumes with the same subnet and never funds twice.
5. One lock per L2PS demos instance, shared by every subnet client and the
   tester funder, so no two broadcasts on that account take the same nonce.
6. The showcase viewer no longer sends access-control-allow-origin: *.
7. REGISTRATION_AUTO_APPROVE=all is bounded by REGISTRATION_AUTO_APPROVE_MAX
   (default 20); later requests wait for the operator.

Tests: 108 (6 new) covering the strict amount match, the bound terminal
absence and reconcile refusals, resumable approval, the cap, and local
decryption against the SDK's own ciphertext (outer-tx and bare shapes,
other key, other subnet, hash mismatch, node plaintext ignored).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KuxqrwyA8kuyT1ZJLUWZWo
@cX3po

cX3po commented Oct 10, 2026

Copy link
Copy Markdown

Peer reading of pallytin88/dacs-rfq pull request 1 at 783eb2695c98a5e9db17a4a06fba1530d2314daa. The private findings from the read of 0064da1cf543ccd1ed6d221234b4fd291a4c9b56 were addressed in that commit. This note keeps the items that are still open.

setup.sh pins a version string and an unpinned branch

setup.sh is unchanged in this commit. The script clones the SDK branch only when the directory is absent:

if [ ! -d "$SDK/.git" ]; then
  git clone --depth 1 --branch feat/canonical-channel-message-v06 https://github.com/pallytin88/dacs-sdk.git "$SDK"
fi

An existing checkout is neither fetched nor compared to a commit. The extra tools are collected with no version, then installed in the same call as demosdk:

for m in tsx better-sqlite3 vitest @types/better-sqlite3; do [ -e "$SDK/node_modules/$m/package.json" ] || missing="$missing $m"; done
( cd "$SDK" && npm install --no-save @kynesyslabs/demosdk@4.0.18 $missing )
node -e 'const v=require(process.argv[1]).version; if (v!=="4.0.18") { console.error("demosdk", v, "installed; 4.0.18 required"); process.exit(1) }' "$SDK/node_modules/@kynesyslabs/demosdk/package.json"

The check compares the installed version string. npm ci and npm install run package lifecycle scripts.

A full commit SHA, with the script failing when HEAD differs, plus an integrity pin for demosdk and versions for those four tools, would close the gap this reading is about. The tip of feat/canonical-channel-message-v06 observed while linking the offline tests was ccbe19a40d3ef0392f723d419209d3c1d73a896e. The script records no SHA, so this review does not treat that tip as the commit the package was built from.

Offline vitest run at this head, Node 22.22.2, vitest 4.1.8: 14 files, 108 tests passed, in 13.21s. That run did not re-execute setup.sh and did not touch a live chain.

The agreed price is the public native transfer

src/settle.ts says the buyer pays the exact terms.price of the agreement it holds locally, and that "the payment amount itself is public on the rail." settleWithPayDem pays that amount on the native DEM rail. TESTERS.md says the public set includes "the payment, whose amount is the agreed price," and that the offers and counters stay in the subnet. README.md says the showcase's anchored bytes "contain no offer, counter or price value." That sentence describes the anchor.

On both 2026-10-09 settled runs, measured against the previous head, the local receipt's settlement.amountOs was 9500000000 (9.5 DEM). A read-only getTxByHash of each settlement returned content.type native and content.amount 9500000000. Those chain reads were not repeated for this commit. The pay path here still pays terms.price.

Reading: the offers and counters stay off the commitment. The agreed price is public because the native transfer moves that amount.

Wording that matches the code and those two reads:

The commitment anchor carries the agreement hash, the parties, the pattern, the times, and a signature. It does not carry the offers or the counters. The native DEM payment is a separate public transaction, and its amount is the agreed price. On the two 2026-10-09 testnet runs that amount was 9.5 DEM (9500000000 OS), visible on the confirmed native transfer.

Keeping that price private would mean the public rail transfers something other than the price. This reading does not propose that design.

History admission checks the envelope as of its own issue time

src/transport/l2ps.ts says the envelope "is verified as of its own issue time because the chain, not the wire, is the durable medium here; replay and duplicates remain the inbox's job (packetId is the primary key)." The feeder passes nowMs: envelope.issuedAt when that field is a number. That passage is unchanged in this commit. With nowMs set to issuedAt, the expiry check reads as vacuous for a carrier still inside its own signed lifetime.

PATH-OS (cX3po)

… SDK commit, close the private follow-up

The SDK branch this package builds on moved on 2026-10-10 (five maintainer
commits on top of ccbe19a4). A fresh install against the unpinned branch
then failed at buyer start ("profileAdmission must be a non-Proxy
function"), as a third tester reported.

SDK head:
- src/profileAdmission.ts: the CORE §11.1.2(3) capability the durable
  client now consults on every operation. The deployment's exact profile is
  DACS_V06_PROFILE; the authority is granted from the operator's peer table
  (configured counterpart + admitted registrations), bound to the exact
  channel and the two participants, and withheld otherwise.
- channelSignature: on current-read the key is resolved for the `member`
  the SDK resolved under CH-7, never for the self-declared sender.
- Both tick loops archive a job whose record the store refuses (pre-bump
  records are read as corrupt or read-only) after logging once, instead of
  retrying it every tick; settled jobs are skipped before any store call.
- setup.sh pins DACS_SDK_COMMIT (fetch + verify HEAD), pins tsx,
  better-sqlite3, vitest and the two @types packages, adds @types/node.

Private follow-up (second read of 783eb26):
- walletFileLock.ts: per-wallet cross-process lock; the seller daemon,
  bin/approve.mts and bin/fund-local.mts share it.
- bin/approve.mts passes the funding callback through, so the signed hash
  is recorded before the broadcast on that path too.
- isTerminallyFailedTransfer requires the expected transfer; reconcile
  refuses a hash remembered under another reservation.
- Auto-approve: budget check and approval under one lock; a total DEM
  budget (autoApproveMaxFundDem) alongside the claim cap.
- L2PS feeder refuses a carrier dated more than 60 s ahead of the reader.

Tests: 112 (profile admission, cross-reservation refusal, budget).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KuxqrwyA8kuyT1ZJLUWZWo
@pallytin88

Copy link
Copy Markdown
Owner Author

Thanks for the second read. Head is now f43d44abe8bcab19e21ab61c13ef99b03ba99605; it was pushed after this comment, so here is where each item stands against it.

setup.sh. The script now pins DACS_SDK_COMMIT=3523cf872ff52438015531ba40b065f268e31ca4: it fetches that commit, checks it out detached, and exits non-zero when git rev-parse HEAD differs. The extra tools are versioned (tsx@4.21.0 better-sqlite3@12.6.2 vitest@4.1.8 @types/better-sqlite3@9.6.0 @types/node@20.19.42) and the demosdk version gate stays. The pinned SDK commit is the current head of dacs-sdk#332 (five maintainer commits on top of ccbe19a4), which is why a fresh install against the unpinned branch broke for the third tester; the package follows that head now (profile admission on every durable operation). Still open from your note: an integrity pin for demosdk. The version string is checked, the tarball is not. I will add the integrity value from the registry manifest on the next push.

The agreed price is public. Agreed on every point. TESTERS.md already states the public set as the listing, both vet records, the commitment anchor and the payment "whose amount is the agreed price"; the README sentence at the showcase test describes the anchor only. Your paragraph matches the code and the two chain reads, and I would like to put it in the README as written, attributed to this review, unless you would rather it stay here.

History admission at issue time. The reading is right: with nowMs = issuedAt the expiry check cannot fail for a carrier inside its own signed lifetime. That is deliberate for the history path, because a carrier read back from the chain days later is still the same signed turn, and replay is the inbox's job (nonce and packet recorded in one transaction, packetId primary key). What f43d44a adds is the other direction: a carrier whose issuedAt is more than 60 s ahead of local time is refused (FUTURE_SKEW_MS), so a forged future issue time cannot buy a longer lifetime. If you see a case where a stale-but-valid carrier does harm that the inbox does not catch, I would rather hear it than keep the comment as is.

Offline at f43d44a: 15 files, 112 tests. Two settled deals on the public testnet after the SDK move (01M4H798…, 01M4KA5F…).

Filed by SuperColony; findings verified by parallel AUDITOR/DETECTIVE/ANALYST byte-verification.

The version gate compares a string in package.json; a substituted
4.0.18 tarball passes it. npm records the integrity of what it actually
unpacked in node_modules/.package-lock.json, so compare that against the
registry's sha512 for demosdk-4.0.18.tgz and fail on a mismatch.
Raised in the second read of PR #1.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KuxqrwyA8kuyT1ZJLUWZWo
@pallytin88

Copy link
Copy Markdown
Owner Author

The demosdk integrity pin landed in ddbb3cc rather than waiting for a later push: setup.sh now compares the integrity npm recorded for node_modules/@kynesyslabs/demosdk in the hidden lockfile against the registry sha512 for demosdk-4.0.18.tgz and exits on a mismatch. That closes the three setup.sh points from your note. Head is ddbb3cc.

…standalone checkout

The UI label and the package description still said the L2PS transport
was coming; it is the live path since 2026-10-09. The Tests section gave
monorepo-relative paths that do not exist in the tester bundle or the
public repo; give the standalone commands first (vitest and tsc from the
sibling dacs-sdk tree that setup.sh links) and keep the monorepo form as
a note. The dependency note now describes what setup.sh does instead of
the manual --no-save dance. Raised by the third tester's 09d/10e retest.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KuxqrwyA8kuyT1ZJLUWZWo
@cX3po

cX3po commented Oct 10, 2026

Copy link
Copy Markdown

Yes. Use the price paragraph in the README as written, attributed to PATH-OS (cX3po).

We found no case where a stale-but-valid carrier is applied twice, or applied after the session clock. A stored carrier is replay at src/transport/inboxStore.ts:134 while its nonce remains, and duplicate at :138-139 when the packetId and hash match; pruneNonces (:131) deletes expired nonces only, and a different hash is conflict (:140). The feeder still passes nowMs: envelope.issuedAt (src/transport/l2ps.ts:256-258), so a later read does not fail src/transport/envelope.ts:226. First delivery uses the SDK receipt clock: at dacs-sdk 3523cf87, receive() sets receivedAt from nowMs (src/negotiate/durableRfqLifecycle.ts:2405-2407), and when that is past awaitingSince + timeoutMs the turn is not applied and the session is recorded timed-out (src/negotiate/rfq.ts:1045-1052).

At head ddbb3cc, setup.sh:27-31 exits when the hidden lockfile integrity for node_modules/@kynesyslabs/demosdk differs from sha512-6yomgfl6MLKDWRCI00WGBylsmChWjyIWlum98tB/TDCbhl/03szJESVbq/+vsqVQsmvT0uk+WXcslhG84kD2XQ==. That string matches npm view @kynesyslabs/demosdk@4.0.18 dist.integrity.

PATH-OS (cX3po)

@cX3po cX3po left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. We ran this as two settled testnet deals from a fresh buyer wallet:

  • Bundle 09d: deal settled, job 01M4KDHXVK1D0095MTFDR0YDGN.
  • Bundle 10e (commit ddbb3cc): deal settled, job 01M4KEYNC8ZAGXBAP3A3ZBS113. The commitment is at block 498941 and the 9.5 DEM native transfer at 498942 on the public testnet RPC.

2f9de32 against ddbb3cc changes only README.md and the package.json description. The "L2PS transport coming" label and the "L2PS transport pending" description are removed, and the Tests section lists the standalone vitest and tsc paths. No code changed, so we did not re-run.

Thanks for the fast turnarounds on every round.

PATH-OS (cX3po)

pallytin88 and others added 3 commits October 12, 2026 09:33
… scope

The standalone canonical reader copied the unsigned envelope with plain
assignment. For an own `__proto__` member, which JSON.parse creates, that
assignment hits the inherited setter and drops the member, so a message
with unsigned content under that name still hashed to the signed bytes
and passed. Copy members as own data properties, and return an `error`
decision instead of throwing when the envelope has no canonical form.
Same class as dacs-sdk GHSA-pjhm-8m5v-v63m; regression tests cover
primitive, null, object and array values and an honest producer that
signs such a member.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KuxqrwyA8kuyT1ZJLUWZWo
…t and test name

The own-__proto__ test and the withoutSignature comment cited an upstream
advisory that is still a private draft. Keep the behaviour and the tests;
remove the identifier until the advisory is published.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KuxqrwyA8kuyT1ZJLUWZWo
…terminal events with the message time

Regression test for the reader's "message has no canonical form" error
decision: a non-finite number, a lone UTF-16 surrogate and an integer
above 2^53 as a top-level member each produce an error decision, not a
throw. The procurement viewer stamped "agreed", the derived agreement
and message-caused terminal events with the session clock, which a
terminal turn does not advance; they now carry that turn's sentAt, and a
timeout carries the recorded failure time. TESTERS.md and README now say
the final price is public as the payment amount and only the offers and
counters stay in the subnet.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KuxqrwyA8kuyT1ZJLUWZWo
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.

2 participants