Skip to content

Commit

Permalink
feat: EL rewards stealing additional fee (#53)
Browse files Browse the repository at this point in the history
* feat: additional fee

* chore: `...PENALTY` -> `...FINE`
  • Loading branch information
vgorkavenko authored Jan 10, 2024
1 parent 4f29e1b commit ab851f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
17 changes: 11 additions & 6 deletions src/CSModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ contract CSModuleBase {
event UnvettingFeeSet(uint256 unvettingFee);

event UnvettingFeeApplied(uint256 indexed nodeOperatorId);
event ELRewardsStealingPenaltyInitiated(
event ELRewardsStealingPenaltyReported(
uint256 indexed nodeOperatorId,
uint256 proposedBlockNumber,
uint256 stolenAmount
Expand Down Expand Up @@ -133,6 +133,8 @@ contract CSModule is ICSModule, CSModuleBase {
bytes32 public constant SIGNING_KEYS_POSITION =
keccak256("lido.CommunityStakingModule.signingKeysPosition");

uint256 public constant EL_REWARDS_STEALING_FINE = 0.1 ether;

uint256 public unvettingFee;
QueueLib.Queue public queue;

Expand Down Expand Up @@ -1034,15 +1036,18 @@ contract CSModule is ICSModule, CSModuleBase {
uint256 amount
) external onlyExistingNodeOperator(nodeOperatorId) {
// TODO: check role
accounting.lockBondETH(nodeOperatorId, amount);

_checkForUnbondedKeys(nodeOperatorId);

emit ELRewardsStealingPenaltyInitiated(
emit ELRewardsStealingPenaltyReported(
nodeOperatorId,
blockNumber,
amount
);

accounting.lockBondETH(
nodeOperatorId,
amount + EL_REWARDS_STEALING_FINE
);

_checkForUnbondedKeys(nodeOperatorId);
}

/// @dev Should be called by the committee.
Expand Down
4 changes: 2 additions & 2 deletions test/CSModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1674,11 +1674,11 @@ contract CsmReportELRewardsStealingPenalty is CSMCommon {
csm.vetKeys(noId, 1);

vm.expectEmit(true, true, true, true, address(csm));
emit ELRewardsStealingPenaltyInitiated(noId, 100, BOND_SIZE / 2);
emit ELRewardsStealingPenaltyReported(noId, 100, BOND_SIZE / 2);
csm.reportELRewardsStealingPenalty(noId, 100, BOND_SIZE / 2);

uint256 lockedBond = accounting.getActualLockedBond(noId);
assertEq(lockedBond, BOND_SIZE / 2);
assertEq(lockedBond, BOND_SIZE / 2 + csm.EL_REWARDS_STEALING_FINE());

CSModule.NodeOperatorInfo memory no = csm.getNodeOperator(noId);
assertEq(no.totalVettedValidators, 1);
Expand Down

0 comments on commit ab851f1

Please sign in to comment.