@@ -80,7 +80,7 @@ import {SafeCast} from "@oz/utils/math/SafeCast.sol";
8080 * - EXECUTION_DELAY_IN_ROUNDS: Rounds to wait before allowing execution
8181 * - LIFETIME_IN_ROUNDS: Maximum age of rounds that can still be executed
8282 * - SLASH_OFFSET_IN_ROUNDS: How far back to look for validators to slash
83- * - SLASHING_UNIT: Base amount of slashing per unit voted
83+ * - SLASH_AMOUNT_SMALL/MEDIUM/LARGE: Specific amounts for each slash unit level
8484 * - COMMITTEE_SIZE: Number of validators per committee
8585 */
8686contract TallySlashingProposer is EIP712 {
@@ -195,8 +195,19 @@ contract TallySlashingProposer is EIP712 {
195195 /**
196196 * @notice Base amount of stake to slash per slashing unit (in wei)
197197 * @dev Validators can be voted to be slashed by 1-3 units, multiplied by this base amount
198+ * @notice Small slash amount for 1 unit votes (in wei)
198199 */
199- uint256 public immutable SLASHING_UNIT;
200+ uint256 public immutable SLASH_AMOUNT_SMALL;
201+
202+ /**
203+ * @notice Medium slash amount for 2 unit votes (in wei)
204+ */
205+ uint256 public immutable SLASH_AMOUNT_MEDIUM;
206+
207+ /**
208+ * @notice Large slash amount for 3 unit votes (in wei)
209+ */
210+ uint256 public immutable SLASH_AMOUNT_LARGE;
200211
201212 /**
202213 * @notice Minimum number of votes required to slash a validator
@@ -275,7 +286,7 @@ contract TallySlashingProposer is EIP712 {
275286 * _executionDelayInRounds and < ROUNDABOUT_SIZE)
276287 * @param _executionDelayInRounds The number of rounds to wait after a round ends before it can be executed (provides
277288 * time for review)
278- * @param _slashingUnit The base amount of stake to slash per slashing unit ( must be > 0)
289+ * @param _slashAmounts Array of 3 slash amounts [small, medium, large] for 1, 2, 3 unit votes (all must be > 0)
279290 * @param _committeeSize The number of validators in each committee (must be > 0)
280291 * @param _epochDuration The number of slots in each epoch (used to calculate ROUND_SIZE_IN_EPOCHS)
281292 * @param _slashOffsetInRounds How many rounds in the past to look when determining which validators to slash (must be
@@ -288,14 +299,16 @@ contract TallySlashingProposer is EIP712 {
288299 uint256 _roundSize ,
289300 uint256 _lifetimeInRounds ,
290301 uint256 _executionDelayInRounds ,
291- uint256 _slashingUnit ,
302+ uint256 [ 3 ] memory _slashAmounts ,
292303 uint256 _committeeSize ,
293304 uint256 _epochDuration ,
294305 uint256 _slashOffsetInRounds
295306 ) EIP712 ("TallySlashingProposer " , "1 " ) {
296307 INSTANCE = _instance;
297308 SLASHER = _slasher;
298- SLASHING_UNIT = _slashingUnit;
309+ SLASH_AMOUNT_SMALL = _slashAmounts[0 ];
310+ SLASH_AMOUNT_MEDIUM = _slashAmounts[1 ];
311+ SLASH_AMOUNT_LARGE = _slashAmounts[2 ];
299312 QUORUM = _quorum;
300313 ROUND_SIZE = _roundSize;
301314 ROUND_SIZE_IN_EPOCHS = _roundSize / _epochDuration;
@@ -318,7 +331,8 @@ contract TallySlashingProposer is EIP712 {
318331 require (ROUND_SIZE > 1 , Errors.TallySlashingProposer__InvalidQuorumAndRoundSize (QUORUM, ROUND_SIZE));
319332 require (QUORUM > ROUND_SIZE / 2 , Errors.TallySlashingProposer__InvalidQuorumAndRoundSize (QUORUM, ROUND_SIZE));
320333 require (QUORUM <= ROUND_SIZE, Errors.TallySlashingProposer__InvalidQuorumAndRoundSize (QUORUM, ROUND_SIZE));
321- require (SLASHING_UNIT > 0 , Errors.TallySlashingProposer__SlashingUnitMustBeGreaterThanZero (SLASHING_UNIT));
334+ require (_slashAmounts[0 ] <= _slashAmounts[1 ], Errors.TallySlashingProposer__InvalidSlashAmounts (_slashAmounts));
335+ require (_slashAmounts[1 ] <= _slashAmounts[2 ], Errors.TallySlashingProposer__InvalidSlashAmounts (_slashAmounts));
322336 require (
323337 LIFETIME_IN_ROUNDS > EXECUTION_DELAY_IN_ROUNDS,
324338 Errors.TallySlashingProposer__LifetimeMustBeGreaterThanExecutionDelay (
@@ -863,11 +877,19 @@ contract TallySlashingProposer is EIP712 {
863877
864878 // Check if this slash amount has reached quorum
865879 if (voteCountForValidator >= QUORUM) {
880+ // Convert units to actual slash amount
881+ uint256 slashAmount;
882+ if (j == 1 ) {
883+ slashAmount = SLASH_AMOUNT_SMALL;
884+ } else if (j == 2 ) {
885+ slashAmount = SLASH_AMOUNT_MEDIUM;
886+ } else if (j == 3 ) {
887+ slashAmount = SLASH_AMOUNT_LARGE;
888+ }
889+
866890 // Record the slashing action
867- actions[actionCount] = SlashAction ({
868- validator: _committees[i / COMMITTEE_SIZE][i % COMMITTEE_SIZE],
869- slashAmount: SLASHING_UNIT * j
870- });
891+ actions[actionCount] =
892+ SlashAction ({validator: _committees[i / COMMITTEE_SIZE][i % COMMITTEE_SIZE], slashAmount: slashAmount});
871893 ++ actionCount;
872894
873895 // Mark this committee as having at least one slashed validator
0 commit comments