Skip to content

Commit

Permalink
removed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
soloseng committed Sep 24, 2024
1 parent 7a623ce commit 0cc126a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
22 changes: 11 additions & 11 deletions packages/protocol/contracts-0.8/governance/Validators.sol
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ contract Validators is
* @param uptime The Fixidity representation of the validator's uptime, between 0 and 1.
*/
function updateValidatorScoreFromSigner(address signer, uint256 uptime) external virtual onlyVm {
allowOnlyL1(); // no longer using signer
allowOnlyL1();
_updateValidatorScoreFromSigner(signer, uptime);
}

Expand All @@ -234,7 +234,7 @@ contract Validators is
address signer,
uint256 maxPayment
) external virtual onlyVm returns (uint256) {
allowOnlyL1(); // no longer using signer
allowOnlyL1();
return _distributeEpochPaymentsFromSigner(signer, maxPayment);
}

Expand All @@ -255,7 +255,7 @@ contract Validators is
bytes calldata blsPublicKey,
bytes calldata blsPop
) external nonReentrant returns (bool) {
allowOnlyL1(); // no longer allow to register with a bls key
allowOnlyL1();
address account = getAccounts().validatorSignerToAccount(msg.sender);
_isRegistrationAllowed(account);
require(!isValidator(account) && !isValidatorGroup(account), "Already registered");
Expand Down Expand Up @@ -385,7 +385,7 @@ contract Validators is
bytes calldata blsPublicKey,
bytes calldata blsPop
) external returns (bool) {
allowOnlyL1(); // no longer allow to register with a bls key
allowOnlyL1();
address account = getAccounts().validatorSignerToAccount(msg.sender);
require(isValidator(account), "Not a validator");
Validator storage validator = validators[account];
Expand Down Expand Up @@ -461,7 +461,7 @@ contract Validators is
bytes calldata blsPublicKey,
bytes calldata blsPop
) external onlyRegisteredContract(ACCOUNTS_REGISTRY_ID) returns (bool) {
allowOnlyL1(); // no longer allow to register with a bls key
allowOnlyL1();
require(isValidator(account), "Not a validator");
Validator storage validator = validators[account];
require(
Expand Down Expand Up @@ -611,7 +611,7 @@ contract Validators is
* @param validatorAccount The validator to deaffiliate from their affiliated validator group.
*/
function forceDeaffiliateIfValidator(address validatorAccount) external nonReentrant onlySlasher {
allowOnlyL1(); //Not used by governance slasher.
allowOnlyL1();
if (isValidator(validatorAccount)) {
Validator storage validator = validators[validatorAccount];
if (validator.affiliation != address(0)) {
Expand Down Expand Up @@ -640,7 +640,7 @@ contract Validators is
* @param account The group being slashed.
*/
function halveSlashingMultiplier(address account) external nonReentrant onlySlasher {
allowOnlyL1(); //Not used by governance slasher.
allowOnlyL1();
require(isValidatorGroup(account), "Not a validator group");
ValidatorGroup storage group = groups[account];
group.slashInfo.multiplier = FixidityLib.wrap(group.slashInfo.multiplier.unwrap().div(2));
Expand Down Expand Up @@ -989,7 +989,7 @@ contract Validators is
uint256 exponent,
uint256 adjustmentSpeed
) public onlyOwner returns (bool) {
allowOnlyL1(); // score handled by score manager now
allowOnlyL1();
require(
adjustmentSpeed <= FixidityLib.fixed1().unwrap(),
"Adjustment speed cannot be larger than 1"
Expand Down Expand Up @@ -1052,7 +1052,7 @@ contract Validators is
* @param value New reset period for slashing multiplier.
*/
function setSlashingMultiplierResetPeriod(uint256 value) public nonReentrant onlyOwner {
allowOnlyL1(); // no used by governance slasher.
allowOnlyL1();
slashingMultiplierResetPeriod = value;
}

Expand All @@ -1061,7 +1061,7 @@ contract Validators is
* @param value New downtime grace period for calculating epoch scores.
*/
function setDowntimeGracePeriod(uint256 value) public nonReentrant onlyOwner {
allowOnlyL1(); // downtime no longer supported
allowOnlyL1();
downtimeGracePeriod = value;
}

Expand Down Expand Up @@ -1116,7 +1116,7 @@ contract Validators is
* @return Fixidity representation of the epoch score between 0 and 1.
*/
function calculateEpochScore(uint256 uptime) public view returns (uint256) {
allowOnlyL1(); //score set by score manager.
allowOnlyL1();
require(uptime <= FixidityLib.fixed1().unwrap(), "Uptime cannot be larger than one");
uint256 numerator;
uint256 denominator;
Expand Down
10 changes: 5 additions & 5 deletions packages/protocol/contracts/governance/test/MockValidators.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ contract MockValidators is IValidators, IsL2Check {
bytes calldata,
bytes calldata
) external returns (bool) {
allowOnlyL1(); // BLS key no longer supported
allowOnlyL1();
return true;
}

Expand Down Expand Up @@ -78,11 +78,11 @@ contract MockValidators is IValidators, IsL2Check {
}

function halveSlashingMultiplier(address) external {
allowOnlyL1(); // not used by governance slasher
allowOnlyL1();
}

function forceDeaffiliateIfValidator(address validator) external {
allowOnlyL1(); // not used by governance slasher
allowOnlyL1();
}

function getValidatorsGroup(address validator) external view returns (address) {
Expand All @@ -108,7 +108,7 @@ contract MockValidators is IValidators, IsL2Check {
}

function getValidatorGroupSlashingMultiplier(address) external view returns (uint256) {
allowOnlyL1(); // not used by governance slasher
allowOnlyL1();
return FIXED1_UINT;
}

Expand Down Expand Up @@ -283,7 +283,7 @@ contract MockValidators is IValidators, IsL2Check {
revert("Method not implemented in mock");
}

function distributeEpochPaymentsFromSigner(address, uint256) external returns (uint256) {
function distributeEpochPaymentsFromSigner(address, uint256) external onlyL1 returns (uint256) {
revert("Method not implemented in mock");
}

Expand Down

0 comments on commit 0cc126a

Please sign in to comment.