Repository navigation
docs(examples): regenerate the walkthrough frames so they decode - #50
tora-ai-bot wants to merge 4 commits into
Conversation
The five FRAME lines in examples/htlc-walkthrough.md did not pass
decodeFrame: the DIDs were 46 characters (the spec's DID shape is 56),
the statement and contract ids had 63 hex digits, the reveal secret 62.
The prose said the statement was sha256("correct horse battery staple");
the value shown was sha256("password") missing its last digit, and the
secret bytes hashed to neither. Step 5 of the MCP flow (fold the four
frames to `claimed`) therefore could not reproduce, "illustrative"
disclaimer or not.
Regenerate every line with the library (makeOffer / makeAccept /
encodeFrame, fixed nonces, placeholder DIDs of valid shape, and a fixed
stand-in preimage: the 28 ASCII bytes of the phrase zero-padded to 32),
reword the intro and the hash note to match, and add
tests/walkthrough.test.ts, which reads the markdown, decodes each frame,
folds the transcript to `claimed` and to `refunded`, and checks the
preimage the prose describes. Docs and a test only; no library change.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…through conflict) examples/htlc-walkthrough.md: keep the library-generated frame lines and regenerate reveal/refund with the rail ref that upstream (flop-labs#51) now expects; tests/walkthrough.test.ts additionally checks reveal.ref/refund.ref == lock.ref. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Independent execution of exact head The walkthrough drift is causal. Copying only this PR's Pinned No blocker found. Marker: Technocore identity: did:key:z6MktR9NeQLNAxaAjYExcGVQBysaBD9ZeYMHPhDPCRdys9Fk |
…emas The MCP section called tclk_post_frame with nick/frame (the tool takes room and line, with did/sig/nonce optional), left out the required `from` on every builder call and `expiresMs` on the offer, and described an unsigned post that tclk_post_frame does not have: with no TECHNOCORE_SIGNING_KEY and no did/sig/nonce it answers posted:false with the signing challenge. Reported on flop-labs#49. With only those fixed, step 5 still could not fold to `claimed`. The fold wants offer and accept records in tclk-offers and later records in the derived deal room (SPEC.md section 2), and it replays each frame at its venue timestamp, so the fixed 2025 deadlines get the accept refused as expired. The section now posts where a fold looks, counts deadlines from now, uses each side's signing did:key as `from`, and spells out the two real signing paths: a server signing key, or the returned challenge answered with did/sig/nonce. tests/walkthrough.test.ts also checks every MCP call in the section against the generated tool catalogue (unknown and missing arguments) and the room each frame is posted in. Docs and a test only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Branch:
docs/walkthrough-frames-decode(change commitcc4de55, written against main81a8346;origin/mainat162b331merged in afterwards with no conflicts).Closes #49.
What
The five
FRAME='tclk1 …'lines inexamples/htlc-walkthrough.mdare regenerated with the library (makeOffer/makeAccept/encodeFrame, fixed nonces, placeholder DIDs of valid shape, a fixed stand-in preimage), so every line passesdecodeFrameand the transcript folds toclaimed(orrefunded) exactly as the MCP section promises. The intro paragraph no longer calls the frames illustrative, and the hash note now describes the bytes actually on the page.tests/walkthrough.test.tsreads the markdown, decodes each frame, folds both paths and checks the preimage, so the example cannot drift again. No library change.Why
None of the previous lines decoded (
from is malformed: 46-character DIDs against the spec's 56; 63-digit statement and contract ids; a 62-digit secret), the statement shown wassha256("password")minus its last digit rather than the hash the prose claimed, and step 5 of the MCP flow could not be reproduced. SPEC.md and the code agree here; only the example was wrong.The stand-in preimage is the 28 ASCII bytes of
correct horse battery staplezero-padded to 32, which keeps the original note true and keeps the example obviously non-secret. Amounts, deadlines, nonces, rail andrefare the ones the walkthrough already used.Note on #42: that PR also touches the
revealandrefundlines here (it adds"ref":"escrow-9182"to both) but keeps the 46-character DIDs and 63-digit ids. If #42 lands first I will regenerate the two lines withrefon top of it and re-runtests/walkthrough.test.ts; the test is the part worth keeping either way.Update (f5f80be): the MCP section
Follow-up to this comment on #49: the "The same flow via the MCP tools" section had the same problem, and the first commits did not touch it.
What was wrong:
tclk_post_framewas called withnick/frameinstead ofline.from, and the offer also lackedexpiresMs.tclk_post_framedoes not have.Fixing the arguments alone still leaves step 5 short of
claimed, for two reasons:tclk-offersand later frames to the derived deal room (SPEC §2).What changed in the section:
fromis each side's signingdid:key.TECHNOCORE_SIGNING_KEY, or answering the returned challenge withdid/sig/nonce.tests/walkthrough.test.tsgains two tests, and both fail on the previous text:mcp/worker/src/tool-manifest.generated.ts: no unknown arguments, no missing required ones.The revised flow was also run end to end through the stdio server against a fake venue (payer server-signed, payee answering the challenge) and folds to
claimed. SPEC and code agree here; only the example was wrong.Checks
pnpm install --frozen-lockfile && pnpm -r --include-workspace-root build— cleanpnpm -r --include-workspace-root teston the merged branch — root 81/81 (+3 in the new file), mcp 34/34, worker 31/31CHANGELOG.mdhas an[Unreleased]/ Fixed entrypnpm install --frozen-lockfile,pnpm -r --include-workspace-root buildandtest— root 109/109 (+2 intests/walkthrough.test.ts), mcp 40/40, worker 33/33Test evidence:
tests/walkthrough.test.tsfails on81a8346(3/3, first at the DID check) and passes on this branch;decodeFrameon each new line and the fold toclaimed/refundedwere also run outside vitest againstdist/.🤖 Generated with Claude Code
https://claude.ai/code/session_01WRUCBRVaYQK7bwa6BoPZta