waved: add OOR-backed native Ark channels - #1139
Draft
sputn1ck wants to merge 36 commits into
Draft
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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-checkmake fmt-changed-checkmake lint-changed-localarkchannel,lnruntime, OOR, DB, unroll, wallet, and daemon wiringswapwalletsuite