Skip to content
Business logic Audit finding Intermediate

Validator can fail to receive commission reward in redeemAllRewards

A validator can fail to receive commission rewards when calling redeemAllRewards because a check requires rewards to be greater than zero, which may revert even if the validator has commission to receive. This can cause issues when the validator is handled by a contract.

jonah1005 Follow

Originally disclosed on Code4rena

Submitted by jonah1005

Impact

Validator can fail to receive commission reward by calling redeemAllRewards. There’s a check in redeemAllRewards

uint128 rewards = sharesToTokens(s.shares, v.exchangeRate) - s.staked;
require(rewards > 0, "Nothing to redeem");

The validator’s tx might be reverted here even if he got some commission reward to receive.

Proof of Concept

We can trigger the bug by setting commisionRate to 1e18 - 1 (DelegatedStaking.sol L275-L276)

Recommended Mitigation Steps

Though this may rarely happen and the validator can redeem the reward through redeemRewards, this may cause some issues when the validator is handled by a contract.

I consider calling redeemRewards in redeemAllReawards as a more succinct way to do this.

kitti-katy (Covalent) acknowledged:

I don’t think there will ever be a commission rate set to almost 100%. Since it is changed by the owner we will make sure the input is correct.

GalloDaSballo (judge) commented:

Agree with the finding and understand the sponsors take.

As per the docs for contests: 2 — Med: Assets not at direct risk, but the function of the protocol or its availability could be impacted, or leak value with a hypothetical attack path with stated assumptions, but external requirements.

This fall as a medium severity

A simple mitigation would be to limit the commisionRate to less than the value that causes issues

The original report as published on Code4rena, by jonah1005. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the check `require(rewards > 0, "Nothing to redeem")` in `redeemAllRewards` does not account for commission rewards that may be positive even when the calculated `rewards` is zero.

Impact

The validator's transaction might revert, preventing them from receiving commission rewards, which could cause issues if the validator is a contract.

What the attacker needed

CommissionRate set to 1e18 - 1; validator calls redeemAllRewards

The fix

The function should call redeemRewards internally or limit the commissionRate to a value that does not cause the issue.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A validator is a participant who helps run a blockchain network and earns rewards. In this code, a function that should let them collect all rewards can fail if the reward amount is zero, even when they are owed a commission. This means they might not get their money in some cases.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by jonah1005

View all

39 more disclosed reports, best first.

More from Covalent contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.