Skip to content

cli: node earnings labels a period from the earliest row, not from when the ledger started covering #2624

Closed

Description

@thiras

What

decdn node earnings labels a period "(ledger from )" when the period starts before ledger_since_unix. That value is the landed_at_unix of the earliest row the response counts (build_earnings_response), not the time the data source started covering. The figures are right; the label can disagree with them.

Two cases, both from PR #2623's review:

  • Daemon mode. A node runs with the ledger for 30 days and lands its first settlement on day 30. ledger_since reads day 30, so last 7d gets "(ledger from day 30)", which says the figure is truncated when the ledger covered all seven days and the answer is complete. The suffix means "no data before X" and the truth is "no settlement before X".
  • Chain mode (--address). ledger_since_unix is the block time of the first Settled found from from_block. A --since earlier than from_block's time is clamped by block_at_or_after(.., lo = from, ..) and then labelled "(ledger from )"; the real coverage boundary, from_block's timestamp, never appears in the response.

Proposed shape

Carry what the producer knows: a coverage_from_unix on EarningsResponse (or a covered_from_unix per EarningsPeriod, so each row is self-describing and the CLI needs no cross-field reasoning).

  • Daemon: a ledger-start stamp written to settle.redb when settlement_ledger_v1 is first created (one small row), dropped with the table on a PaymentPool repoint.
  • Chain mode: the timestamp of from_block, one header read block_at_or_after already pays for.

period_label compares against that instead of the earliest row. Keep ledger_since_unix as "earliest settlement" if the header line still wants it.

Admin wire change; pre-mainnet, no shim.

Activity

  1. added
    prio:medium
    area:cli
    area:node
    on Oct 25, 2026
  2. added this to the v0.3 milestone on Oct 28, 2026
  3. self-assigned this
    on Oct 28, 2026
  4. moved this from Backlog to In progress in deCDNon Oct 28, 2026
  5. moved this from In progress to Done in deCDNon Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:cliarea:nodeprio:medium

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions