Skip to content

Commit

Permalink
fix: Check for zero amount in reportELRewardsStealingPenalty
Browse files Browse the repository at this point in the history
  • Loading branch information
dgusakov committed Aug 20, 2024
1 parent 143c4fb commit 7c3df56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/CSModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,7 @@ contract CSModule is
uint256 amount
) external onlyRole(REPORT_EL_REWARDS_STEALING_PENALTY_ROLE) {
_onlyExistingNodeOperator(nodeOperatorId);
if (amount == 0) revert InvalidAmount();
accounting.lockBondETH(
nodeOperatorId,
amount + EL_REWARDS_STEALING_FINE
Expand Down
12 changes: 12 additions & 0 deletions test/CSModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5309,6 +5309,18 @@ contract CsmReportELRewardsStealingPenalty is CSMCommon {
csm.reportELRewardsStealingPenalty(0, blockhash(block.number), 1 ether);
}

function test_reportELRewardsStealingPenalty_RevertWhen_ZeroAmount()
public
{
uint256 noId = createNodeOperator();
vm.expectRevert(CSModule.InvalidAmount.selector);
csm.reportELRewardsStealingPenalty(
noId,
blockhash(block.number),
0 ether
);
}

function test_reportELRewardsStealingPenalty_NoNonceChange()
public
assertInvariants
Expand Down

0 comments on commit 7c3df56

Please sign in to comment.