Skip to content

Use NetworkState in node rewards. - #1182

Merged
0xfornax merged 9 commits into
masterfrom
node-rewards-use-networkstate
Aug 27, 2026
Merged

Use NetworkState in node rewards. #1182
0xfornax merged 9 commits into
masterfrom
node-rewards-use-networkstate

Conversation

@thomaspanf

Copy link
Copy Markdown
Member

A handful of improvements to the node rewards path: #1140

  • Use NetworkState instead of multicall.
  • Scope the NetworkState to a node's megapool instead of walking the entire network for megapool data.
  • Use NetworkState to compute the megapool CL rewards. Previously, we made an extra API call from the CLI to get megapool CL rewards.
  • Fixed an accounting bug with exited-unfinialized minipools: Your share of unskimmed Beacon Chain (CL) rewards is currently -8.005268 ETH.

Highly scientific benchmark on two different hoodi nodes:

user@node:~/dev/smartnode$ time rocketpool node rewards
Minipools Megapool validators Before After
2 26 4.262s 0.723s
1400 1705 13.961s 4.572s

@github-actions

Copy link
Copy Markdown

Coverage Report

@0xfornax

0xfornax commented Aug 20, 2026

Copy link
Copy Markdown
Member

There seems to be a regression related to GetHeadStateForNode. It no longer loads the network-wide megapool set and the node daemon's supply collector still treats that slice as global, so megapool network supply metrics would be node only.

@jshufro

jshufro commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

There seems to be a regression related to GetHeadStateForNode. It no longer loads the network-wide megapool set and the node daemon's supply collector still treats that slice as global, so megapool network supply metrics would be node only.

Metrics collection should either not use the GetHeadStateForNode if it cares about network-wide aggregates, or should not care about network-wide aggregates.

Personally, I think having network stats in grafana is a bit pointless, as better third-party trackers exist (Dune, steely's site). All it does is increase load on the node every time the state locker cache thingy refreshes.

@0xfornax

0xfornax commented Aug 20, 2026

Copy link
Copy Markdown
Member

Personally, I think having network stats in grafana is a bit pointless, as better third-party trackers exist (Dune, steely's site). All it does is increase load on the node every time the state locker cache thingy refreshes.

I'm in favor of removing global stats that are impacting the SN performance. Just make sure to adapt the Grafana dashboard so users understand these changes.

@github-actions

Copy link
Copy Markdown

Coverage Report

@github-actions

Copy link
Copy Markdown

Coverage Report

@github-actions

Copy link
Copy Markdown

Merging this branch changes the coverage (2 decrease, 1 increase)

Impacted Packages Coverage Δ 🤖
github.com/rocket-pool/smartnode/bindings/utils/state 0.27% (-0.01%) 👎
github.com/rocket-pool/smartnode/rocketpool-cli/node 0.00% (ø)
github.com/rocket-pool/smartnode/rocketpool/api/megapool 0.08% (ø)
github.com/rocket-pool/smartnode/rocketpool/api/node 2.27% (+0.01%) 👍
github.com/rocket-pool/smartnode/rocketpool/node/collectors 0.23% (-0.00%) 👎
github.com/rocket-pool/smartnode/shared/services/state 3.79% (-0.05%) 👎

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/rocket-pool/smartnode/bindings/utils/state/megapool.go 0.03% (-0.01%) 5770 (+1721) 2 5768 (+1721) 👎
github.com/rocket-pool/smartnode/rocketpool-cli/node/rewards.go 0.00% (ø) 3036 (-158) 0 3036 (-158)
github.com/rocket-pool/smartnode/rocketpool/api/megapool/status.go 0.00% (ø) 5404 0 5404
github.com/rocket-pool/smartnode/rocketpool/api/node/rewards.go 0.00% (ø) 7454 (-720) 0 7454 (-720)
github.com/rocket-pool/smartnode/rocketpool/node/collectors/node-collector.go 0.00% (ø) 15002 (+2164) 0 15002 (+2164)
github.com/rocket-pool/smartnode/rocketpool/node/collectors/supply-collector.go 0.00% (ø) 2030 (-2049) 0 2030 (-2049)
github.com/rocket-pool/smartnode/shared/services/state/network-state.go 4.69% (-0.11%) 9850 (+220) 462 9388 (+220) 👎

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

@0xfornax
0xfornax merged commit 634de69 into master Aug 27, 2026
6 checks passed
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.

3 participants