Repository navigation
Closed
Copy link
Labels
kind:bugSomething does not behave as documentedprio:mediumScheduledrustDependabot: a Cargo update; use area: labels for Rust code otherwise
Description
Deferred items from the comprehensive review of #327 / PR #743 (none block the PR; all are robustness/observability or contained refactors).
Correctness gap
- Opened-during-downtime backfill.
payment_settlement::run_watcher_onceuses.watch()filters, which only deliver logs from the current block forward. A channel a client opens against this node while the node is down is never registered (it isn't in the store either), so its vouchers are rejected withWrongChannelindefinitely. Add a startup log-backfill: persist a last-seen block and queryChannelOpened(provider == self) over the gap on bootstrap, registering each. Documented as a known gap in the module doc in 34a91ae.
Robustness
- Independent redeemer tick.
redeemer_loopacts only on hints from the bounded (256) advisory channel. Under high channel fan-out, hints can be dropped and threshold redemption stalls until shutdown/expiry-sweep. Add a low-frequency self-tick that scansload_allfor above-threshold channels. (Also covers awithdrawwhose receipt errored but later mined, and a channel that goes quiet just below threshold.) - Quiesce the redeemer before the shutdown close.
close_open_channels_on_shutdownruns whileredeemer_loopis still live (it's only aborted when the service drops, afterrun()returns), so a shutdowncloseChannelcan race an in-flightwithdraw→ a benign revert + a misleadingwarn!. Abort/await the redeemer first, or downgrade the expected race log.
Observability
- Metrics for the silent/near-silent paths: dropped redeem hints (
try_sendFull), redemption-attempt failures (redeemer_loop), and swallowed handler-persist failures in the watcher (register_open_channel/update_channel_deposit/forget_channel). Today a real problem in any of these is only a singlewarn!line. - A
VoucherRejectReason::Expired(orStreamError::ChannelExpired) wire code so the expiry serve-gate surfaces an actionable reason instead of an opaqueanyhow::bail!stream drop.
Type hygiene (contained refactors)
- Demote
ChannelState's replay-criticallast_*fields behind a hydration constructor + getters so the incentive: no replay-protection window enforced on incoming voucher nonces, allowing a client to resubmit a previously accepted voucher after a node restart and receive a second byte-delivery for the same payment #527 "advance only viaapply_voucher" invariant is compiler-enforced rather than doc-enforced (the fields arepubfor cross-crate hydration today). Considerlast_signature: Option<[u8; 65]>to make "empty or exactly 65 bytes" unrepresentable-when-wrong. - (cosmetic) bundle the schema-v2 trailing segments into a single
TrailerV2 { signature, expires_at }encoded/decoded as a unit, so the order contract lives in a type rather than mirror-imagerecord/decode_recordcall sites. NB: keep them as trailing segments, not prefix struct fields — a v2 reader decoding an existing on-disk v1 record would read past end-of-input otherwise.
Context: PR #743, review threads on commits 5d658d8 / 076b919 / 34a91ae.
Reacted by github-actions
Metadata
Metadata
Assignees
Labels
kind:bugSomething does not behave as documentedprio:mediumScheduledrustDependabot: a Cargo update; use area: labels for Rust code otherwise
Type
Fields
Priority
None yet
Activity
github-actions commentedon May 31, 2026
🎯 Triage report
Post-PR #743 follow-up tracker covering seven deferred items across correctness, robustness, observability, and type hygiene in the seller-side payment settlement crate (
incentive). The correctness gap (downtime backfill) is the most impactful: channels opened while the node is offline are permanently unregisterable until the next restart with the fix, silently causingWrongChannelrejections for those clients. The remaining items are robustness/observability improvements or contained refactors, all well-scoped.📊 Assessment
bug,technical,rust,mediumincentive; medium priority — no data loss, just dropped vouchers and silent errorsincentivecrate's channel store, watcher, and redeemer internals. The downtime-backfill and independent-redeemer-tick items are closest to "suitable" once someone confirms the current block-persistence mechanism. The type-hygiene items are the most self-contained and likely the easiest entry point.💡 Notes and suggestions
Recommended work order:
VoucherRejectReason::Expiredwire code — purely additive, no cross-crate state touch, good warm-up.TrailerV2bundle (cosmetic) — isolated codec change, easy to test with round-trip property tests.ChannelStatehydration constructor — compiler-enforce theapply_voucher-only invariant; unblocks safer work on the redeemer.tokio::time::intervalalongside the hint channel receiver inredeemer_loop; scanload_all, filterabove_threshold, submit withdraw.JoinHandleforredeemer_loop,abort()+awaitit before enteringclose_open_channels_on_shutdown; downgrade the existingwarn!on the now-expected race todebug!in the interim if full quiesce is non-trivial.try_sendfull path, redemption failures, and watcher persist failures; agree on the metrics subsystem (prometheus counters via the existing metrics crate).last_seen_block(likely in the same store as channel state), aget_logscall on bootstrap filtered toChannelOpened(provider == self)over the gap, and careful handling of reorgs / very large gaps.Correctness gap details:
run_watcher_oncesubscribes via.watch()which only delivers future logs. On bootstrap, the node should: (a) read persistedlast_seen_block, (b) calleth_getLogsforChannelOpenedevents withprovider == self.addressbetweenlast_seen_block+1andcurrent_block, (c) callregister_open_channelfor each, (d) updatelast_seen_block. This must be idempotent (upsert semantics on the store) to handle repeated restarts or RPC failures mid-backfill.Redeemer race on shutdown:
The simplest fix is to store
redeemer_task: JoinHandle<()>on the service struct and callredeemer_task.abort(); let _ = redeemer_task.await;at the top ofclose_open_channels_on_shutdown. If that's a large refactor, an acceptable interim is downgrading thewarn!on the revert todebug!("expected revert: redeemer raced shutdown closeChannel").Add this agentic workflows to your repo
To install this agentic workflow, run
fix(node): address review — propagate backfill failures, test retry c…
fix(node): backfill ChannelOpened to close watcher bring-up race (#762)…
refactor(node): address PR #781 review — sync redeemer mutex + backfi…
fix(node): harden #751 checkpoint against cross-arm/cross-cycle strand
test(node): make the #751 downtime-backfill e2e a true discriminator
fix(node): address PR #781 review (Alper) — watcher recovery + doc ac…
feat(node): seller-settlement robustness follow-ups (#751) (#781)
refactor(node): apply multi-agent PR review findings (#1012)
fix(node): harden resumable-watcher failure paths from multi-agent re…
feat(node): eth_getLogs resumable watcher, off eth_newFilter (#1106, #…
feat(node): share one eth_blockNumber read across all chain watchers (#…
feat(node): share one eth_blockNumber read across all chain watchers (#…
feat(node): share one eth_blockNumber read across all chain watchers (#…