Repository navigation
Conversation
caaab90 to
6abe607
Compare
6abe607 to
5377593
Compare
There was a problem hiding this comment.
🔒 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.
5377593 to
e844ada
Compare
There was a problem hiding this comment.
🟡 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
cf11160 to
298d0ac
Compare
07d9c6d to
62f5d26
Compare
There was a problem hiding this comment.
🔒 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.csline 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.
62f5d26 to
28112f9
Compare
28112f9 to
debd723
Compare

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.