Skip to content

Improved metric to avoid alerts#891

Merged
ZanCorDX merged 1 commit intodevelopfrom
dx/filter-fake-subsidies
Mar 11, 2026
Merged

Improved metric to avoid alerts#891
ZanCorDX merged 1 commit intodevelopfrom
dx/filter-fake-subsidies

Conversation

@ZanCorDX
Copy link
Collaborator

📝 Summary

Now big negative balance deltas will not be counted as subsidies.
This might miss some subsidies (we could have a withdrawal AND a subsidy) but it's not critical.

💡 Motivation and Context

While receiving the Nobel Prize, I got a BuilderNet alert "subsidies too high" and had to forfeit it.
I turns out the subsidies were doing cocaine.

✅ I have completed the following steps:

  • Run make lint
  • Run make test
  • Added tests (if applicable)

@ZanCorDX ZanCorDX requested a review from dvush as a code owner March 10, 2026 20:36
@claude
Copy link
Contributor

claude bot commented Mar 10, 2026

Claude finished @ZanCorDX's task in 1m 30s —— View job


Review of PR #891

  • Gather context and read changed files
  • Review code changes
  • Post review feedback

Overall: The approach is reasonable — moving the filter into add_subsidy_value and consolidating inc_subsidized_blocks as a private helper keeps the logic centralized. A couple of items worth noting:

1. Silent filtering without trace (minor observability concern)

In the wallet_balance_watcher path, a filtered subsidy will still be logged via info!("Subsidy detected") at line 166, but the metric won't be recorded — this mismatch could be confusing during debugging. In the relay_submit path, a filtered subsidy is completely silent (no log, no metric).

Consider adding a warn! or debug! log inside add_subsidy_value when the filter triggers, so operators can see when subsidies are being dropped:

if value > MAX_POSSIBLE_SUBSIDY {
    tracing::debug!(?value, landed, "Filtering subsidy exceeding MAX_POSSIBLE_SUBSIDY");
    return;
}

2. Hardcoded threshold

0.1 ETH is a sensible heuristic for now, but if operational conditions change (e.g., higher subsidies become normal), this will silently suppress real data. A configuration parameter or at minimum a more visible constant (e.g., in a config module) would make this easier to adjust without a code change. Not blocking, just something to keep in mind.

No blocking issues found. The logic is correct, the constant computation is valid (10^17 wei = 0.1 ETH), and making inc_subsidized_blocks private with the count now tied to the filtered add_subsidy_value is a good consolidation.

@ZanCorDX ZanCorDX merged commit f4e3a56 into develop Mar 11, 2026
9 of 10 checks passed
@ZanCorDX ZanCorDX deleted the dx/filter-fake-subsidies branch March 11, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants