threshold-network / merkle-distribution

Threshold Network rewards generation and distribution
https://threshold.network
1 stars 6 forks source link

Adding an uptime check for the entire interval #88

Closed dimpar closed 11 months ago

dimpar commented 11 months ago

There was a check that validated an uptime for a given instance but only when an instance was running. This bug gave the nodes hidden slack. A node could spin up and start running only e.g. for 10 days and report 100% uptime, but it was just around 33% of the entire interval. In order to be eligible for rewards, a node should run at least a requiredUptime of interval. In this PR we check not only an uptime of a node while it was running, but also a percentage of an interval it was up. Both values need to be >= requiredUptime to get the rewards.

dimpar commented 11 months ago

Nope... what if a new staker comes and starts running a node at the end of the interval? We should reward only a portion of the rewards by multiplying with uptimeCoefficient as it is now. It's a feature, not a bug. But if a staker runs a node at the beginning of the interval, stops it, and then starts again at the end of the interval. No rewards. The uptime tracking starts when the first uptime tick is registered by Prometheus.