-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
L1-L2-checks #11225
L1-L2-checks #11225
Conversation
@@ -38,7 +37,7 @@ contract MockValidators is IValidators, IsL2Check { | |||
bytes calldata, | |||
bytes calldata | |||
) external returns (bool) { | |||
allowOnlyL1(); | |||
allowOnlyL1(); // BLS key no longer supported |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BLS key no longer supported
@@ -84,20 +78,15 @@ contract MockValidators is IValidators, IsL2Check { | |||
} | |||
|
|||
function halveSlashingMultiplier(address) external { | |||
allowOnlyL1(); // TODO remove | |||
allowOnlyL1(); // not used by governance slasher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not used by governance slasher.
} | ||
|
||
function forceDeaffiliateIfValidator(address validator) external { | ||
allowOnlyL1(); // TODO remove | ||
allowOnlyL1(); // not used by governance slasher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not used by governance slasher. L1 check stays.
@@ -119,7 +108,7 @@ contract MockValidators is IValidators, IsL2Check { | |||
} | |||
|
|||
function getValidatorGroupSlashingMultiplier(address) external view returns (uint256) { | |||
allowOnlyL1(); | |||
allowOnlyL1(); // not used by governance slasher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not used by governance slasher. L1 check stays
@@ -116,7 +116,7 @@ contract DoubleSigningSlasher is ICeloVersionedContract, SlasherUtil { | |||
uint256 index, | |||
bytes memory headerA, | |||
bytes memory headerB | |||
) public view returns (uint256) { | |||
) public view onlyL1 returns (uint256) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uses precompile. Added modifier for a clean revert message.
@@ -170,7 +170,7 @@ contract DowntimeSlasher is ICeloVersionedContract, SlasherUtil { | |||
function getBitmapForInterval( | |||
uint256 startBlock, | |||
uint256 endBlock | |||
) public view returns (bytes32) { | |||
) public view onlyL1 returns (bytes32) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uses precompile. Added modifier for a clean revert msg.
@@ -215,7 +215,7 @@ contract DowntimeSlasher is ICeloVersionedContract, SlasherUtil { | |||
uint256 startBlock, | |||
uint256 endBlock, | |||
uint256 signerIndex | |||
) public view returns (bool) { | |||
) public view onlyL1 returns (bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
@@ -250,7 +250,7 @@ contract DowntimeSlasher is ICeloVersionedContract, SlasherUtil { | |||
uint256[] memory startBlocks, | |||
uint256[] memory endBlocks, | |||
uint256[] memory signerIndices | |||
) public view returns (bool) { | |||
) public view onlyL1 returns (bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto.
- downtime slashing not supported
@@ -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(); | |||
allowOnlyL1(); // no longer using signer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer using signers or uptime score
@@ -234,7 +234,7 @@ contract Validators is | |||
address signer, | |||
uint256 maxPayment | |||
) external virtual onlyVm returns (uint256) { | |||
allowOnlyL1(); | |||
allowOnlyL1(); // no longer using signer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer using signers
@@ -255,7 +255,7 @@ contract Validators is | |||
bytes calldata blsPublicKey, | |||
bytes calldata blsPop | |||
) external nonReentrant returns (bool) { | |||
allowOnlyL1(); | |||
allowOnlyL1(); // no longer allow to register with a bls key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer supporting BLS key.
@@ -385,7 +385,7 @@ contract Validators is | |||
bytes calldata blsPublicKey, | |||
bytes calldata blsPop | |||
) external returns (bool) { | |||
allowOnlyL1(); | |||
allowOnlyL1(); // no longer allow to register with a bls key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer supporting BLS key.
@@ -461,7 +461,7 @@ contract Validators is | |||
bytes calldata blsPublicKey, | |||
bytes calldata blsPop | |||
) external onlyRegisteredContract(ACCOUNTS_REGISTRY_ID) returns (bool) { | |||
allowOnlyL1(); | |||
allowOnlyL1(); // no longer allow to register with a bls key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer supporting BLS key.
@@ -611,6 +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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added since governance slasher does not use this function.
@@ -639,7 +640,7 @@ contract Validators is | |||
* @param account The group being slashed. | |||
*/ | |||
function halveSlashingMultiplier(address account) external nonReentrant onlySlasher { | |||
allowOnlyL1(); | |||
allowOnlyL1(); //Not used by governance slasher. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not used by governance slasher.
require(isValidator(account), "Not a validator"); | ||
require(epochNumber <= getEpochNumber(), "Epoch cannot be larger than current"); | ||
require(epochNumber <= _getEpochNumber(), "Epoch cannot be larger than current"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to support L2 epoch number
@@ -992,7 +989,7 @@ contract Validators is | |||
uint256 exponent, | |||
uint256 adjustmentSpeed | |||
) public onlyOwner returns (bool) { | |||
allowOnlyL1(); | |||
allowOnlyL1(); // score handled by score manager now | |||
require( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
score now handled by score manager. Leaving as is.
@@ -1055,7 +1052,7 @@ contract Validators is | |||
* @param value New reset period for slashing multiplier. | |||
*/ | |||
function setSlashingMultiplierResetPeriod(uint256 value) public nonReentrant onlyOwner { | |||
allowOnlyL1(); | |||
allowOnlyL1(); // no used by governance slasher. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not used by governance slasher.
@@ -1119,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(); | |||
allowOnlyL1(); //score set by score manager. | |||
require(uptime <= FixidityLib.fixed1().unwrap(), "Uptime cannot be larger than one"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not supported in L2. Score is now set by scoreManager.
Description
Check if
onlyL1
&&onlyL2
are appropriatly calledOther changes
updated test
Related issues