Skip to content

ADR 008: Division by zero in reporter weight at network bootstrap #63

Closed

Description

@thiras

Category: Bug

Severity: HIGH

File: adr/008-reputation.md (~line 51)

reporter_weight = settled_channels(reporter) / max_settled_channels_observed

At network bootstrap, max_settled_channels_observed is 0 (no channels have been settled yet). This causes a division by zero.

Impact:
First reputation report submitted to the network crashes the scoring logic or produces undefined behavior depending on implementation.

Recommendation:
Add a guard clause:

let reporter_weight = if max_settled_channels_observed == 0 {
    1.0  // equal weighting during bootstrap
} else {
    settled_channels(reporter) as f64 / max_settled_channels_observed as f64
};

ADRs affected

  • ADR 008 (Reputation System)

Activity

  1. added
    kind:bug
    on Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:bug

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions