Hey everyone,
I’d like to make a quick post about the state of Rewards Tree Spec v4 to keep everyone in the loop.
TLDR
The spec has now been written and is ready for review.
It makes one change to the existing rules:
In Collateral Rewards, the way
nodeEffectiveStake
is determined has changed. Previously, it relied on this contract call:
nodeEffectiveStake := RocketNodeStaking.getNodeEffectiveRPLStake(nodeAddress)
Now, it is calculated explicitly for each node using the number of active minipools according to the Beacon Chain, not according to the contracts. Please see that section for more details on the new calculation method.
I also have a reference implementation built, which I use to build my nightly preview trees alongside the canonical ones using ruleset v3.
I’ll include the details on v4 below.
Rationale
Currently, during RPL rewards calculation, the Smartnode asks the contracts what the effective stake for each node is and determines the RPL distribution for everyone based on those numbers.
The contracts internally check how many minipools the node had in the staking
state at the end of the interval and uses that to calculate the minimum and maximum RPL collateral.
For those that appreciate the technical details, here’s some simplified pseudocode that shows how the effective stake is calculated:
min := 16 / rplPriceRatio * numberOfStakingMinipools * 0.1
max := 16 / rplPriceRatio * numberOfStakingMinipools * 1.5
effectiveStake = stakedRpl
if stakedRpl < min {
effectiveStake = 0
} else if stakedRpl > max {
effectiveStake = max
}
A minipool that has entered staking
status is one that has deposited all 32 ETH and is ready for activation on Beacon. It enters staking
the moment the second deposit (the stake
transaction) is validated and added to the chain.
The problem here is that the contracts don’t know when a validator has actually been activated on Beacon or exited Beacon; this requires the Oracle DAO to shuttle state updates over to the contracts. For a few reasons that became apparent during Atlas development, the team has decided not to put this particular behavior into the watchtower.
(Note: those are out-of-scope for this particular thread and can be explored further in a separate one, so I’ll stick to the rewards spec here.)
Without knowing that a minipool has exited, the contracts will happily keep a staking
minipool in the staking
status and thus, it will continue to be eligible for RPL rewards even though it is now dormant and can be withdrawn-from at any time (predicated on the Beacon chain’s withdrawal queue).
Ruleset v4 changes this by changing the way effective stake is calculated for each node. Instead of asking the contracts to calculate it, the Smartnode will now calculate it manually using the activation and exit times of each minipool on the Beacon Chain.
This is the only change that ruleset v4 includes.
Implementation
At its core, this ruleset changes the way effectiveStake
for each node is calculated by changing the number of eligibleMinipools
.
Previously, eligibleMinipools
was simply equal to the number of minipools in the staking
state.
With this ruleset, eligibleMinipools
is now determined by querying the Beacon Chain.
The following process is run for each node:
-
Get the list of minipools for the node. Ignore all minipools that are not in the
staking
state. -
For each
staking
minipool, get the validator pubkey. Ask the Beacon Chain for the status of this validator (using/eth/v1/beacon/states/<targetBcSlot>/validators?id=0x<pubkey>
, wheretargetBcSlot
is the checkpoint slot for this interval).- This will have two important fields:
activation_epoch
andexit_epoch
- the epoch the minipool was activated on, and exited, the Beacon Chain.
- This will have two important fields:
-
If
activation_epoch
is before the checkpoint interval’s ending epoch, and ifexit_epoch
is after the checkpoint interval’s ending epoch, then this is an eligible minipool. -
Run the calculation above in the Rationale section, but replace
numberOfStakingMinipools
witheligibleMinipools
.
The rest of the rewards generation is calculated normally.
Release
I would like to include this release for Interval 6 which occurs on February 16th. At the time of this writing, this is in 5 weeks.
This would give @Peteris and I 2-3 weeks to compare our implementations, iron out any bugs, and incorporate it into a future Smartnode release. The Oracle DAO would then have 2-3 weeks to update to it at their discretion.
The spec itself has been reviewed by some of the community members for about a week already, and they didn’t see any issues in moving forward with it so here we are.
Discussion
This particular change doesn’t exactly fall under the “bugfix” category (though I suppose you could make an argument for it), but it doesn’t fall under the “massive changes” category either like the notion of prorating RPL rewards by attestation performance. I think it’s closer to the former than the latter, so I’m inclined to push it through.
That being said, I think it’s important to gauge everyone else’s thoughts on the matter before unilaterally doing it, so please discuss this change here (even if it’s just a simple thumbs up).
Thanks everyone!