Open code423n4 opened 1 year ago
Coded POC -> Primary
GalloDaSballo marked the issue as primary issue
I think this should be primary
Might be the more clear description compared to #136 of the specific duration bug. I'm not sure if this should be the primary or a duplicate.
The Warden has shown an incorrect formula that uses the duration
of the pool for slashing.
The resulting loss can be up to 26 times the yield that should be made up for.
Because the:
I believe the most appropriate severity to be High
GalloDaSballo changed the severity to 3 (High Risk)
GalloDaSballo marked the issue as selected for report
Lines of code
https://github.com/code-423n4/2022-12-gogopool/blob/main/contracts/contract/MinipoolManager.sol#L673-L675
Vulnerability details
Description
A node operator sends in the amount of duration they want to stake for. Behind the scenes Rialto will stake in 14 day cycles and then distribute rewards.
If a node operator doesn't have high enough availability and doesn't get any rewards, the protocol will slash their staked
GGP
. For calculating the expected rewards that are missed however, the full duration is used:This is unfair to the node operator because the expected rewards is from a 14 day cycle.
Also, If they were to be unavailable again, in a later cycle, they would get slashed for the full duration once again.
Impact
A node operator staking for a long time is getting slashed for an unfairly large amount if they aren't available during a 14 day period.
The protocol also wants node operators to stake in longer periods: https://multisiglabs.notion.site/Known-Issues-42e2f733daf24893a93ad31100f4cd98
This slashing amount calculation incentives the node operator to sign up for the shortest period possible and restake themselves to minimize possible losses.
Proof of Concept
Test in
MinipoolManager.t.sol
:Slashed amount for a
365 days
duration is100 eth
(10%). However, where they to stake for the minimum time,14 days
the slashed amount would be only ~3.8 eth
.Tools Used
vs code, forge
Recommended Mitigation Steps
Either hard code the duration to 14 days for calculating expected rewards or calculate the actual duration using
startTime
andendTime
.