@arkade-os/swap can neither request nor fill an offer where both legs name an
asset. The solver decides such offers as of
lightning-swap-service#110
(merged), so the two sides now disagree about what the corridor serves.
Nothing is broken in production: no orchestrator serves an asset leg yet
(lss#125 tracks
what each leg still needs), and every failure below is loud. Filing it now because
closing it is design work, not a patch, and the solver side has already landed.
What the solver admits
src/core/assetOffer.ts models both sides as string | null — wantAssetId and
offerAssetId — with null meaning BTC, and its markets are unordered pairs of
asset ids with null. Both non-null is a served market; only the same asset on
both sides is refused, as degenerate_pair. On the wire, lss#113 makes the pair
arkade:<68-hex>->arkade:<68-hex> (152 chars, inside the 158 cap it sized for
exactly this case).
Where this SDK stops it
Four places, at origin/master:
| site |
what it enforces |
packages/swap/src/offer.ts:40-41,54-55,91 |
two covenant programs only — swap-want-asset.program.json / swap-want-btc.program.json, selected by offer.wantAsset ? … : … |
offer.ts:138,189 |
the offer TLV carries ONE asset field (wantAsset, tag 0x03), not two |
offer.ts:165 and offer.ts:238 |
"offer must carry exactly one of wantAsset or offerAsset", on build and on TLV decode |
rfq.ts:259-265 (arkadeSwapRequest), rfq.ts:971 (offerTermsFromQuote) |
the same invariant at the request and quote-mapping layers |
The failure is loud and early — arkadeSwapRequest throws before anything reaches
a solver, so a client cannot even ask. That is the right behaviour for today; it
is not a bug to fix in isolation.
What closing it needs
- A third covenant program: deliver asset X against a deposit of asset Y. The
existing two are "the fill must deliver an asset" and "the fill must deliver
sats"; neither constrains both legs.
- A widened offer TLV that can name two assets and say which is which, plus
the decode-side rule that replaces "exactly one".
- Relaxing the four guards above, in that order — they are correct until 1 and 2
exist, and relaxing them first would let a caller build a request the fill path
cannot settle.
Worth designing against lss#107's covenant and this repo's #763 together, rather
than after either merges.
Related
@arkade-os/swapcan neither request nor fill an offer where both legs name anasset. The solver decides such offers as of
lightning-swap-service#110
(merged), so the two sides now disagree about what the corridor serves.
Nothing is broken in production: no orchestrator serves an asset leg yet
(lss#125 tracks
what each leg still needs), and every failure below is loud. Filing it now because
closing it is design work, not a patch, and the solver side has already landed.
What the solver admits
src/core/assetOffer.tsmodels both sides asstring | null—wantAssetIdandofferAssetId— withnullmeaning BTC, and its markets are unordered pairs ofasset ids with
null. Both non-null is a served market; only the same asset onboth sides is refused, as
degenerate_pair. On the wire, lss#113 makes the pairarkade:<68-hex>->arkade:<68-hex>(152 chars, inside the 158 cap it sized forexactly this case).
Where this SDK stops it
Four places, at
origin/master:packages/swap/src/offer.ts:40-41,54-55,91swap-want-asset.program.json/swap-want-btc.program.json, selected byoffer.wantAsset ? … : …offer.ts:138,189wantAsset, tag0x03), not twooffer.ts:165andoffer.ts:238"offer must carry exactly one of wantAsset or offerAsset", on build and on TLV decoderfq.ts:259-265(arkadeSwapRequest),rfq.ts:971(offerTermsFromQuote)The failure is loud and early —
arkadeSwapRequestthrows before anything reachesa solver, so a client cannot even ask. That is the right behaviour for today; it
is not a bug to fix in isolation.
What closing it needs
existing two are "the fill must deliver an asset" and "the fill must deliver
sats"; neither constrains both legs.
the decode-side rule that replaces "exactly one".
exist, and relaxing them first would let a caller build a request the fill path
cannot settle.
Worth designing against lss#107's covenant and this repo's #763 together, rather
than after either merges.
Related
it did not cover.
VHTLC.ScriptV2denominated in an asset: the same asset-covenantwork, one leg at a time.
orchestrator exists.