You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
incentive: no metric or structured log event distinguishing payment-channel open failures caused by insufficient buyer deposit from those caused by RPC/contract errors #966
design:economicsToken economics, pricing, fee split, bond sizingkind:featureNew capability or a change to current behaviorprio:mediumScheduledrustDependabot: a Cargo update; use area: labels for Rust code otherwise
The buyer-side openChannel path (#753) can fail due to insufficient deposited USDC, on-chain revert, or transient RPC errors, but all failure modes appear as a single error log line. Splitting these into distinct counter labels (e.g. decdn_channel_open_failures_total{reason="insufficient_deposit|contract_revert|rpc_error"}) would let operators distinguish misconfiguration from infrastructure problems.
The buyer-side openChannel path fails silently with an undifferentiated error log line regardless of whether the root cause is an insufficient USDC deposit (misconfiguration), an on-chain contract revert, or a transient RPC error. The request is to split these into distinct labeled Prometheus counters (decdn_channel_open_failures_total{reason="..."}) so operators can immediately tell whether an alert reflects an operator misconfiguration vs. an infrastructure blip. This is a well-scoped, high-signal observability gap in the incentive crate.
📊 Assessment
Dimension
Value
Reasoning
Type
Feature
Adding structured metrics/observability where none exists today
Labels
rust added; enhancement, economics, technical, medium retained
The existing labels are already accurate; rust added since this is a pure Rust crate implementation task
Coding agent
Suitable
Clear success criteria, well-defined scope (incentive crate openChannel error paths), and an established codebase pattern to follow
crates/incentive/src/buyer_channel.rs — buyer-side channel state machine; the openChannel trigger logic consults get_by_provider before deciding reuse vs. open.
crates/incentive/src/client_bridge.rs — wires buyer channel state to the stream layer; RetryLater vs ChannelError paths are likely candidates for tagging.
crates/incentive/src/channel.rs — already has the decdn_voucher_nonce_gaps_total precedent: the leaf crate exposes a saturating counter accessor and the node crate's metrics layer calls it to publish via iroh-metrics. The same pattern should be used here (no iroh-metrics dep in decdn-incentive).
Suggested implementation steps:
Define an error-reason enum (or extend the existing error type) that distinguishes at least:
InsufficientDeposit — USDC balance below channelDeposit at open time.
ContractRevert — on-chain call reverted (decode the revert reason if possible).
Add a saturating counter accessor on the buyer channel manager (follow the evictions_total / decdn_client_reputation_evictions_total pattern in client_reputation.rs) so the metric value is exposed without pulling iroh-metrics into the leaf crate.
Wire it in the node crate metrics layer: read the counter and publish decdn_channel_open_failures_total{reason="..."}.
Add a unit test asserting that a synthetic InsufficientDeposit error increments the right bucket without touching the others.
CI reminder: new Rust code must satisfy the workspace-wide clippy::unwrap_used, clippy::expect_used, and clippy::indexing_slicing denies. Run cargo clippy and cargo nextest run -p decdn-incentive before opening the PR.
design:economicsToken economics, pricing, fee split, bond sizingkind:featureNew capability or a change to current behaviorprio:mediumScheduledrustDependabot: a Cargo update; use area: labels for Rust code otherwise
Activity
github-actions commentedon Jun 22, 2026
🎯 Triage report
The buyer-side
openChannelpath fails silently with an undifferentiated error log line regardless of whether the root cause is an insufficient USDC deposit (misconfiguration), an on-chain contract revert, or a transient RPC error. The request is to split these into distinct labeled Prometheus counters (decdn_channel_open_failures_total{reason="..."}) so operators can immediately tell whether an alert reflects an operator misconfiguration vs. an infrastructure blip. This is a well-scoped, high-signal observability gap in theincentivecrate.📊 Assessment
rustadded;enhancement,economics,technical,mediumretainedrustadded since this is a pure Rust crate implementation taskopenChannelerror paths), and an established codebase pattern to follow🔗 Similar issues
💡 Notes and suggestions
Where to look:
crates/incentive/src/buyer_channel.rs— buyer-side channel state machine; theopenChanneltrigger logic consultsget_by_providerbefore deciding reuse vs. open.crates/incentive/src/client_bridge.rs— wires buyer channel state to the stream layer;RetryLatervsChannelErrorpaths are likely candidates for tagging.crates/incentive/src/channel.rs— already has thedecdn_voucher_nonce_gaps_totalprecedent: the leaf crate exposes a saturating counter accessor and thenodecrate's metrics layer calls it to publish via iroh-metrics. The same pattern should be used here (noiroh-metricsdep indecdn-incentive).Suggested implementation steps:
InsufficientDeposit— USDC balance belowchannelDepositat open time.ContractRevert— on-chain call reverted (decode the revert reason if possible).RpcError— transport/RPC layer error (timeouts, provider unavailable, etc.).evictions_total/decdn_client_reputation_evictions_totalpattern inclient_reputation.rs) so the metric value is exposed without pullingiroh-metricsinto the leaf crate.nodecrate metrics layer: read the counter and publishdecdn_channel_open_failures_total{reason="..."}.InsufficientDepositerror increments the right bucket without touching the others.CI reminder: new Rust code must satisfy the workspace-wide
clippy::unwrap_used,clippy::expect_used, andclippy::indexing_slicingdenies. Runcargo clippyandcargo nextest run -p decdn-incentivebefore opening the PR.Add this agentic workflows to your repo
To install this agentic workflow, run
docs(incentive): correct channel-open metric docs to sibling-counter …
feat(incentive): label channel-open failures by reason (insufficient_…