@@ -15,9 +15,12 @@ import {IOutbox} from "@aztec/core/interfaces/messagebridge/IOutbox.sol";
1515import {Constants} from "@aztec/core/libraries/ConstantsGen.sol " ;
1616import {CommitteeAttestations} from "@aztec/core/libraries/rollup/AttestationLib.sol " ;
1717import {Errors} from "@aztec/core/libraries/Errors.sol " ;
18- import {ExtRollupLib} from "@aztec/core/libraries/rollup/ExtRollupLib.sol " ;
19- import {ExtRollupLib2} from "@aztec/core/libraries/rollup/ExtRollupLib2.sol " ;
20- import {ExtRollupLib3} from "@aztec/core/libraries/rollup/ExtRollupLib3.sol " ;
18+ import {RollupOperationsExtLib} from "@aztec/core/libraries/rollup/RollupOperationsExtLib.sol " ;
19+ import {ValidatorOperationsExtLib} from "@aztec/core/libraries/rollup/ValidatorOperationsExtLib.sol " ;
20+ import {RewardDeploymentExtLib} from "@aztec/core/libraries/rollup/RewardDeploymentExtLib.sol " ;
21+ import {TallySlasherDeploymentExtLib} from "@aztec/core/libraries/rollup/TallySlasherDeploymentExtLib.sol " ;
22+ import {EmpireSlasherDeploymentExtLib} from "@aztec/core/libraries/rollup/EmpireSlasherDeploymentExtLib.sol " ;
23+ import {SlasherFlavor} from "@aztec/core/interfaces/ISlasher.sol " ;
2124import {EthValue, FeeLib} from "@aztec/core/libraries/rollup/FeeLib.sol " ;
2225import {ProposeArgs} from "@aztec/core/libraries/rollup/ProposeLib.sol " ;
2326import {STFLib, GenesisState} from "@aztec/core/libraries/rollup/STFLib.sol " ;
@@ -228,21 +231,44 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
228231 );
229232
230233 Timestamp exitDelay = Timestamp.wrap (_config.exitDelaySeconds);
231- ISlasher slasher = ExtRollupLib3.deploySlasher (
232- address (this ),
233- _config.slashingQuorum,
234- _config.slashingRoundSize,
235- _config.slashingLifetimeInRounds,
236- _config.slashingExecutionDelayInRounds,
237- _config.slashingVetoer
238- );
234+
235+ // Deploy slasher based on flavor
236+ ISlasher slasher;
237+
238+ // We call one external library or another based on the slasher flavor
239+ // This allows us to keep the slash flavors in separate external libraries so we do not exceed max contract size
240+ if (_config.slasherFlavor == SlasherFlavor.TALLY) {
241+ slasher = TallySlasherDeploymentExtLib.deployTallySlasher (
242+ address (this ),
243+ _config.slashingVetoer,
244+ _governance,
245+ _config.slashingQuorum,
246+ _config.slashingRoundSize,
247+ _config.slashingLifetimeInRounds,
248+ _config.slashingExecutionDelayInRounds,
249+ _config.slashingUnit,
250+ _config.targetCommitteeSize,
251+ _config.aztecEpochDuration,
252+ _config.slashingOffsetInRounds
253+ );
254+ } else {
255+ slasher = EmpireSlasherDeploymentExtLib.deployEmpireSlasher (
256+ address (this ),
257+ _config.slashingVetoer,
258+ _governance,
259+ _config.slashingQuorum,
260+ _config.slashingRoundSize,
261+ _config.slashingLifetimeInRounds,
262+ _config.slashingExecutionDelayInRounds
263+ );
264+ }
239265
240266 StakingLib.initialize (_stakingAsset, _gse, exitDelay, address (slasher), _config.stakingQueueConfig);
241- ExtRollupLib2 .initializeValidatorSelection (_config.targetCommitteeSize);
267+ ValidatorOperationsExtLib .initializeValidatorSelection (_config.targetCommitteeSize);
242268
243269 // If no booster is specifically provided, deploy one.
244270 if (address (_config.rewardConfig.booster) == address (0 )) {
245- _config.rewardConfig.booster = ExtRollupLib3 .deployRewardBooster (_config.rewardBoostConfig);
271+ _config.rewardConfig.booster = RewardDeploymentExtLib .deployRewardBooster (_config.rewardBoostConfig);
246272 }
247273
248274 RewardLib.setConfig (_config.rewardConfig);
@@ -309,7 +335,7 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
309335 * @param _slasher The address of the new slasher contract
310336 */
311337 function setSlasher (address _slasher ) external override (IStakingCore) onlyOwner {
312- ExtRollupLib2 .setSlasher (_slasher);
338+ ValidatorOperationsExtLib .setSlasher (_slasher);
313339 }
314340
315341 /**
@@ -327,7 +353,7 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
327353 * @param _config New configuration including queue size limits and timing parameters
328354 */
329355 function updateStakingQueueConfig (StakingQueueConfig memory _config ) external override (IStakingCore) onlyOwner {
330- ExtRollupLib2 .updateStakingQueueConfig (_config);
356+ ValidatorOperationsExtLib .updateStakingQueueConfig (_config);
331357 }
332358
333359 /**
@@ -365,7 +391,7 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
365391 * @param _proposalId The ID of the proposal to vote on
366392 */
367393 function vote (uint256 _proposalId ) external override (IStakingCore) {
368- ExtRollupLib2 .vote (_proposalId);
394+ ValidatorOperationsExtLib .vote (_proposalId);
369395 }
370396
371397 /**
@@ -386,7 +412,7 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
386412 G1Point memory _proofOfPossession ,
387413 bool _moveWithLatestRollup
388414 ) external override (IStakingCore) {
389- ExtRollupLib2 .deposit (
415+ ValidatorOperationsExtLib .deposit (
390416 _attester, _withdrawer, _publicKeyInG1, _publicKeyInG2, _proofOfPossession, _moveWithLatestRollup
391417 );
392418 }
@@ -397,7 +423,7 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
397423 * This helps maintain a controlled growth rate of the validator set.
398424 */
399425 function flushEntryQueue () external override (IStakingCore) {
400- ExtRollupLib2 .flushEntryQueue ();
426+ ValidatorOperationsExtLib .flushEntryQueue ();
401427 }
402428
403429 /**
@@ -409,7 +435,7 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
409435 * @return True if withdrawal was initiated, false if already initiated
410436 */
411437 function initiateWithdraw (address _attester , address _recipient ) external override (IStakingCore) returns (bool ) {
412- return ExtRollupLib2 .initiateWithdraw (_attester, _recipient);
438+ return ValidatorOperationsExtLib .initiateWithdraw (_attester, _recipient);
413439 }
414440
415441 /**
@@ -418,7 +444,7 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
418444 * @param _attester The validator address whose withdrawal to finalize
419445 */
420446 function finaliseWithdraw (address _attester ) external override (IStakingCore) {
421- ExtRollupLib2 .finaliseWithdraw (_attester);
447+ ValidatorOperationsExtLib .finaliseWithdraw (_attester);
422448 }
423449
424450 /**
@@ -429,7 +455,7 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
429455 * @return True if slashing was successful
430456 */
431457 function slash (address _attester , uint256 _amount ) external override (IStakingCore) returns (bool ) {
432- return ExtRollupLib2 .slash (_attester, _amount);
458+ return ValidatorOperationsExtLib .slash (_attester, _amount);
433459 }
434460
435461 /**
@@ -439,7 +465,7 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
439465 * Pruning occurs at epoch boundaries and removes all blocks in unproven epochs.
440466 */
441467 function prune () external override (IRollupCore) {
442- ExtRollupLib .prune ();
468+ RollupOperationsExtLib .prune ();
443469 }
444470
445471 /**
@@ -450,7 +476,7 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
450476 * @param _args Contains the epoch range, public inputs, fees, attestations, and the ZK proof
451477 */
452478 function submitEpochRootProof (SubmitEpochRootProofArgs calldata _args ) external override (IRollupCore) {
453- ExtRollupLib .submitEpochRootProof (_args);
479+ RollupOperationsExtLib .submitEpochRootProof (_args);
454480 }
455481
456482 /**
@@ -471,7 +497,7 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
471497 address [] calldata _signers ,
472498 bytes calldata _blobInput
473499 ) external override (IRollupCore) {
474- ExtRollupLib .propose (_args, _attestations, _signers, _blobInput, checkBlob);
500+ RollupOperationsExtLib .propose (_args, _attestations, _signers, _blobInput, checkBlob);
475501 }
476502
477503 /**
@@ -489,7 +515,7 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
489515 address [] memory _committee ,
490516 uint256 _invalidIndex
491517 ) external override (IRollupCore) {
492- ExtRollupLib2 .invalidateBadAttestation (_blockNumber, _attestations, _committee, _invalidIndex);
518+ ValidatorOperationsExtLib .invalidateBadAttestation (_blockNumber, _attestations, _committee, _invalidIndex);
493519 }
494520
495521 /**
@@ -505,15 +531,16 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
505531 CommitteeAttestations memory _attestations ,
506532 address [] memory _committee
507533 ) external override (IRollupCore) {
508- ExtRollupLib2 .invalidateInsufficientAttestations (_blockNumber, _attestations, _committee);
534+ ValidatorOperationsExtLib .invalidateInsufficientAttestations (_blockNumber, _attestations, _committee);
509535 }
510536
511537 /**
512538 * @notice Sets up validator selection for the current epoch
513539 * @dev Can be called by anyone at the start of an epoch. Samples the committee and determines proposers for all
514540 * slots in the epoch. Also stores a seed that is used for future sampling. The corresponding library
515541 * functionality is automatically called when `RollupCore.propose(...)` is called (via the
516- * `ExtRollupLib.propose(...)` -> `ProposeLib.propose(...)` -> `ValidatorSelectionLib.setupEpoch(...)`).
542+ * `RollupOperationsExtLib.propose(...)` -> `ProposeLib.propose(...)` ->
543+ * `ValidatorSelectionLib.setupEpoch(...)`).
517544 *
518545 * If there are missed proposals then setupEpoch does not get called automatically. Since the next committee
519546 * selection is computed based on the stored randao and the epoch number, failing to update the randao stored
@@ -526,7 +553,7 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
526553 * generation impractical.
527554 */
528555 function setupEpoch () external override (IValidatorSelectionCore) {
529- ExtRollupLib2 .setupEpoch ();
556+ ValidatorOperationsExtLib .setupEpoch ();
530557 }
531558
532559 /**
@@ -536,7 +563,7 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
536563 * `setupEpoch` to update the randao checkpoints.
537564 */
538565 function checkpointRandao () public override (IValidatorSelectionCore) {
539- ExtRollupLib2 .checkpointRandao ();
566+ ValidatorOperationsExtLib .checkpointRandao ();
540567 }
541568
542569 /**
@@ -555,7 +582,7 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
555582 * @return The number of validators that can be added in the next flush
556583 */
557584 function getEntryQueueFlushSize () public view override (IStakingCore) returns (uint256 ) {
558- return ExtRollupLib2 .getEntryQueueFlushSize ();
585+ return ValidatorOperationsExtLib .getEntryQueueFlushSize ();
559586 }
560587
561588 /**
0 commit comments