Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Auto channel open: end-to-end test and docs - #662

Open
markettes wants to merge 4 commits into
feat/simple-auto-channel-open-uifrom
feat/simple-auto-channel-open-e2e
Open

markettes wants to merge 4 commits into
feat/simple-auto-channel-open-uifrom
feat/simple-auto-channel-open-e2e

Conversation

@markettes

Copy link
Copy Markdown
Contributor

Draft until the e2e test has a clean run: earlier runs were broken by another process driving the same compose stack, so it has not passed yet.

AutoChannelOpenE2ETests drives the whole feature on the regtest stack. Alice pays over alice→bob→carol so bob earns fees on its channel to carol; that channel is drained, and payments bob can't forward are refused for INSUFFICIENT_BALANCE. With the feature on in Recommendation mode, the job writes an open recommendation with that evidence, the fixed size and the inherited fee policy. In Auto mode it promotes it, the request funds from the hot wallet, and a new channel to carol opens at the configured capacity with the same policy. LndTestClient and E2ETestBase gain the helpers it needs; the e2e compose turns the feature on with low thresholds.

The VS Code debug config gets the same switch and thresholds, so a local regtest shows recommendations quickly.

docs/auto-channel-open.md describes the rule, modes, lifecycle, budget, settings and known limitations.

@markettes
markettes added this pull request to stack #663 October 30, 2026 18:07
@markettes
markettes force-pushed the feat/simple-auto-channel-open-e2e branch from caaab90 to 6abe607 Compare October 30, 2026 18:26
@markettes
markettes requested a review from Jossec101 October 30, 2026 18:30
@markettes
markettes marked this pull request as ready for review October 30, 2026 18:30
Jossec101
Jossec101 previously approved these changes Nov 12, 2026
Jossec101
Jossec101 previously approved these changes Nov 24, 2026

@lunar-patrol lunar-patrol Bot 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.

🔒 Automated security review — no issues found

This PR adds an E2E test class for auto channel open, two LndTestClient helpers, a refactored E2ETestBase method, and regtest-only env flags in the e2e compose and VS Code debug config. All changes live in test infrastructure and developer tooling against a local regtest stack; no production endpoint, handler, or secret is touched. The API_TOKEN_SALT in launch.json is pre-existing (unchanged by this diff) and a local dev value, so it is out of scope. No exploitable path found.

Reviewed 5 files at 5377593. Nothing to report.

Not a guarantee — one diff, no knowledge of your threat model.

🤖 Automated security review. It never pushes, approves or blocks; a suggestion applies only when you click Commit suggestion.

@markettes
markettes force-pushed the feat/simple-auto-channel-open-e2e branch from 5377593 to e844ada Compare November 26, 2026 11:34
Copilot AI balanced review requested due to automatic review settings November 26, 2026 11:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The documentation incorrectly rules out event replay after restart, whereas the LND contract permits replay but does not guarantee delivery, so it should clarify that evidence across downtime may be incomplete.

1 open issue
What changed in this PR

Adds end-to-end coverage and operator documentation for automatic channel opening, exercising the path from forwarding evidence to recommendations and funded channels. The PR remains draft pending a clean regtest run.

Changes:

  • Adds a scenario covering earned fees, liquidity refusals, recommendation promotion, channel capacity, and inherited fees.
  • Extends test helpers and enables low auto-open thresholds in E2E and local debug configurations.
  • Documents qualification rules, modes, lifecycle, budgets, settings, and limitations.
File Description
test/​NodeGuard.Tests/​E2E/​LndTestClient.cs Adds explicit-route payments and local fee-policy queries.
test/​NodeGuard.Tests/​E2E/​E2ETestBase.cs Extracts reusable channel-confirmation mining logic.
test/​NodeGuard.Tests/​E2E/​AutoChannelOpenE2ETests.cs Adds the recommendation-to-channel-opening scenario.
docs/​auto-channel-open.md Documents feature behavior and operational limits.
docker/​e2e/​docker-compose.yml Enables auto-open with low test thresholds.
.vscode/​launch.json Enables matching settings for local debugging.

Review effort: Balanced

Comment thread docs/auto-channel-open.md Resolved
@markettes
markettes force-pushed the feat/simple-auto-channel-open-e2e branch 2 times, most recently from cf11160 to 298d0ac Compare November 27, 2026 13:45
Comment thread docs/auto-channel-open.md Resolved
Jossec101
Jossec101 previously approved these changes Nov 30, 2026
@markettes
markettes force-pushed the feat/simple-auto-channel-open-e2e branch 2 times, most recently from 07d9c6d to 62f5d26 Compare November 30, 2026 15:10

@lunar-patrol lunar-patrol Bot 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.

🔒 Automated security review

This PR adds the auto-channel-open feature end to end: a Quartz job that derives open recommendations from forwarding-HTLC evidence, a promotion service that turns them into channel operation requests (auto-dispatched for hot wallets), UI on the Nodes and Routing Management pages, a migration, and e2e tests. The security-relevant paths hold up: all new SQL is parameterized EF/LINQ, the UI promote/dismiss actions are role-gated (FinanceManager) behind a page-level [Authorize], the Promote→request transition is made race-safe with an atomic UpdateIfStatus, and failure paths cancel the orphaned request. The one observation worth recording: an operator's Dismiss only suppresses a peer for the 6-hour cooldown — after that the job recycles the Dismissed row to Open and, in Auto mode, promotes it without further review.

Reviewed Lunar-Rails/NodeGuard #662 at 07d9c6d — 0 inline finding(s), 0 not anchorable, 1 below the posting threshold.

1 lower-severity observation(s)
  • LOW · authz — Operator dismissal of a peer is silently reversed after the 6h cooldown (src/Data/Repositories/ChannelOpenRecommendationRepository.cs line 80)
    An operator dismisses a recommendation for a peer on the Routing Management page (status Dismissed). The dismissal only feeds the peer cooldown in AutoChannelOpenJob.BuildPeerSnapshots (AUTO_CHANNEL_OPEN_PEER_COOLDOWN_HOURS, default 6h). On the first run after that window, if the peer still qualifies, Upsert recycles the Dismissed row: CopyEvidence overwrites it, Status is set back to Open, and DismissReason is cleared. In Auto mode RecordAndMaybePromote then promotes it with no further human review, so a channel opens to a peer the operator explicitly turned down, funded from the configured wallet. A peer that keeps draining the node's outbound re-triggers this indefinitely. The Constants comment ('per-peer suppression after an open attempt or a dismissal') shows this is a deliberate tradeoff, so grading LOW; if dismissal is meant to be sticky, Upsert should not recycle Dismissed rows, or a separate permanent-dismiss status is needed.

🤖 Automated security review. It never pushes, approves or blocks; a suggestion applies only when you click Commit suggestion.

@markettes
markettes force-pushed the feat/simple-auto-channel-open-e2e branch from 62f5d26 to 28112f9 Compare November 30, 2026 15:17
@markettes
markettes force-pushed the feat/simple-auto-channel-open-e2e branch from 28112f9 to debd723 Compare November 30, 2026 18:26

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants