Skip to content

waved: add OOR-backed native Ark channels - #1139

Draft
sputn1ck wants to merge 36 commits into
mainfrom
kon/modular-ark-channels
Draft

waved: add OOR-backed native Ark channels#1139
sputn1ck wants to merge 36 commits into
mainfrom
kon/modular-ark-channels

Conversation

@sputn1ck

@sputn1ck sputn1ck commented Aug 12, 2026

Copy link
Copy Markdown
Member

Summary

  • define a three-path channel VTXO policy and a durable channel FSM
  • prepare OOR funding before publication, then activate ordinary lnd channel state
  • compose lnd wallet, funding, switch, invoice, link, and contract-court subsystems without running a full lnd daemon
  • bridge channel sends and fallback vHTLC receives through existing wallet flows
  • support client-owned cooperative close and exact unroll plus force-close recovery
  • watch all source parents so either endpoint can continue materialization after a conflict

The channel point and commitment state are fully negotiated before the OOR transfer commits. Happy-path operation leaves the backing transaction unpublished; on-chain publication is a recovery or close action owned by the durable channel FSM.

LND dependency

This branch fetches the exact head of sputn1ck/lnd:kon/modular-channel-runtime as a Go pseudo-version. There is no nested LND submodule. The fork contains only reusable lifecycle and composition interfaces; no upstream LND PR is opened for this draft.

Testing

  • make tidy-module-check
  • make fmt-changed-check
  • make lint-changed-local
  • affected-package unit suite across arkchannel, lnruntime, OOR, DB, unroll, wallet, and daemon wiring
  • tagged swapwallet suite
  • commit-message lint
  • full daemon E2E is covered by the dependent swapdk-server PR

Keep the channel implementation in the reviewed lnd fork while
Wavelength composes only the subsystems needed by Ark channels.
Encode cooperative settlement, delayed channel materialization, and the
later funder refund as one validated Ark output policy.
Let a caller negotiate and sign an OOR transfer before publication, then
durably commit or abort it after the dependent channel state is ready.
Centralize promotion, activation, payments, cooperative close, and
conflict recovery in one replayable channel FSM with explicit
side-effect barriers.
Persist channel terms, lifecycle snapshots, receive claims, recovery
artifacts, and application-owned recovery VTXOs across daemon restarts.
Materialize the typed query surface and consolidated schema for the new
durable channel records.
Store the FSM snapshot and immutable channel terms atomically so either
endpoint can resume negotiation and recovery after restart.
Keep channel-policy outputs available to the common unroller without
exposing them as wallet liquidity, and resolve sender-side OOR ancestry
before local ownership exists.
Expose local channel operations and authenticated peer negotiation while
carrying receive-channel settlement metadata through existing wallet
RPCs.
Generate the gRPC and mailbox bindings consumed by the client and
channel operator runtimes.
Allow swap and channel protocols to share one authenticated operator
connection without colliding actor identities or delivery cursors.
Run lnd's wallet, funding, switch, invoice, link, notifier, and
fixed-route payment components without starting a full lnd server or
graph runtime.
Quiesce native links before cooperative signing, persist each endpoint
barrier, and hand force-close publication to the Ark materialization
owner.
Compose one persistent native endpoint per party and drive funding,
recovery-package exchange, activation, payments, and close RPCs around
the durable Ark FSM.
Negotiate the channel and recovery package before committing the OOR
send, so failed counterparties never receive an unencumbered VTXO.
Install exact channel and cooperative-close spend policies on the shared
unroller, and detect parent conflicts before lnd publishes a commitment.
Record the reserved alias, backing fee, and manifested channel ID needed
to resume a vHTLC-backed receive after restart.
Expose typed storage fields for the receive-channel promotion metadata.
Reserve the backing fee in the vHTLC, wait for the channel bridge to
claim it atomically, and persist the resulting channel settlement
metadata.
Let the wallet-facing receive FSM hand an acknowledged vHTLC to the
channel coordinator while keeping existing swap settlement behavior
unchanged.
Expose manifested channel identifiers and backing reserves through the
existing wallet activity model.
Install sender and receiver ancestry symmetrically, watch every parent
output, and resume exact materialization when either side publishes a
conflicting Ark path.
Wire the durable channel service, prepared OOR funding, modular lnd
node, payment bridge, close controller, and recovery runtime behind one
daemon-owned process.
Provide development commands for promotion, payments, inspection,
cooperative close, and force close, with one amount-driven creation
surface.
Make the third-party Lightning edge public so integration payments
exercise ordinary graph routing around the private Ark channel.
Pin the reviewed fork commit through Go's module resolver so
ordinary and CI checkouts do not need a nested lnd submodule. Keep
the remote replacement narrowly allowed by the module directive linter.
Recovery-only descriptors belong to an application FSM and must not
appear as wallet liquidity. Handle the status explicitly and cover it in
the pending-balance regression test.
Ark-channel settlement identifies a completed receive and is not a valid
pay-side swap quote. Reject it explicitly in preview and execution
validation so every settlement enum has deliberate semantics.
A channel parent can be revealed by either peer while the local close
is in flight. Serialize force-close attempts and wait for the durable
close result. Accept the exact pre-signed final spend when the peer
wins the race.
Expose the cooperative OOR settlement messages and recovery claim RPC
needed to preserve the signed channel outcome across restarts. Keep
generated protobuf and REST surfaces beside their source definitions.
Move cooperative settlement onto the signed 3-of-3 OOR path so channel
balances remain inside Ark without publishing the channel point. Persist
lineage so either peer can recover the agreed result after an ancestor
appears on chain. Keep force close as the unilateral fallback.
Expose prepared OOR coordination, durable peer readiness, and generic
recovery export for hub-funded channels. Reserve the old vHTLC backing
fee fields because direct channel receives no longer use them.
Gate hub-funded channel negotiation on an explicit peer-ready event and
remove the receive-claim channel kind. Collapse its short-lived schema
migration so fresh databases persist only promotions and receive
intents.
Carry funding control over the authenticated peer transport and stage
inbound messages durably before invoking lnd. The hub cannot commit its
OOR transfer until the client validates the source and persists
readiness.
Prepare hub-owned channel-policy VTXOs for direct receives, activate the
channel before forwarding the held HTLC, and remove the fused vHTLC
claim path. Ordinary wallet VTXOs remain independently promotable.
Document direct hub-funded receive channels separately from ordinary
vHTLC settlement. Keep wallet-VTXO promotion explicit as an independent
channel creation flow.
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.

1 participant