Skip to content

Unexplained volume of stamp purchases on the staging node #271

Description

@crtahlin

Open question

A staging Bee node accumulated 82 postage stamps against a configured reserve of 5, spending roughly 8.9 BZZ (balance 10 -> 0.80). #265 fixed one mechanism that caused this — the pool bought a full reserve whenever it could not read the node — but that mechanism accounts for five stamps per affected restart, not seventy.

What the evidence shows

Reconstructing purchase times from the remaining stamps' TTLs:

 1h ago: 51 stamps
 2h ago: 25
14h ago: 5
15h ago: 1

76 of 82 originate in a roughly two-hour window, most of it before that day's first deploy. That does not match one-reserve-per-restart, which would spread purchases across deploys.

Candidate explanations, none confirmed

  1. External callers. The gateway had become publicly reachable, and the free tier permits 3 requests/minute with no payment. POST /api/v1/stamps/ and /pool/acquire are both reachable that way, and an acquire removes a stamp from the pool, prompting a replacement purchase. Sustained traffic would produce exactly this shape.
  2. A second defect in the replenish path beyond the one Do not replenish the stamp pool when the Bee node cannot be read #265 addressed.
  3. Repeated restarts from some source not visible in the surviving logs.

Why it could not be resolved

  • The reverse proxy was not recording access logs at the time, so there is no record of inbound requests. (Now fixed — access logging is enabled.)
  • The gateway container holding its own request log was replaced, taking the log with it.
  • gateway_stamp_purchases_total is a counter that resets on every restart, and no series is currently exported, so the history is not in Prometheus either.

That last point is worth addressing on its own: the metric that exists specifically to answer "how many stamps did we buy and when" could not answer it. A counter that resets on restart, with no recording rule or long-term aggregation, gives no usable history.

Current state

After #265 the node has been stable: 82 stamps and an unchanged balance across six samples over eight minutes. The bleeding has stopped, but the cause of the bulk of those purchases is unidentified, and the same conditions could recur.

Suggested follow-up

  • Watch stamp count and wallet balance now that access logs exist; if it recurs, the logs will show whether inbound traffic drives it.
  • Consider a hard ceiling on pool purchases per interval, so no defect in the replenish path can spend without bound.
  • Make purchase history durable — a recording rule, or a gauge of node-owned stamps (gateway_node_stamps_total, added in Add node-owned stamp metrics; correct misleading gauge descriptions #262) which survives restarts because it is derived from the node rather than counted in-process.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcostAffects BZZ or running costp1High priority — do next

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions