Skip to content

Use NetworkState in node rewards. - #1182

Open
thomaspanf wants to merge 5 commits into
masterfrom
node-rewards-use-networkstate
Open

Use NetworkState in node rewards. #1182
thomaspanf wants to merge 5 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

@github-actions

Copy link
Copy Markdown

Merging this branch will decrease overall coverage

Impacted Packages Coverage Δ 🤖
github.com/rocket-pool/smartnode/bindings/utils/state 0.57% (-0.04%) 👎
github.com/rocket-pool/smartnode/rocketpool-cli/node 0.00% (ø)
github.com/rocket-pool/smartnode/rocketpool/api/megapool 0.00% (ø)
github.com/rocket-pool/smartnode/rocketpool/api/node 0.00% (ø)
github.com/rocket-pool/smartnode/shared/services/state 3.86% (-0.09%) 👎

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.06% (-0.02%) 3221 (+855) 2 3219 (+855) 👎
github.com/rocket-pool/smartnode/rocketpool-cli/node/rewards.go 0.00% (ø) 1718 (-140) 0 1718 (-140)
github.com/rocket-pool/smartnode/rocketpool/api/megapool/status.go 0.00% (ø) 3061 0 3061
github.com/rocket-pool/smartnode/rocketpool/api/node/rewards.go 0.00% (ø) 5362 (-364) 0 5362 (-364)
github.com/rocket-pool/smartnode/shared/services/state/network-state.go 5.55% (-0.21%) 6094 (+200) 338 (-1) 5756 (+201) 👎

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 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.

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