Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/vb-governance-n06' into ra/gover…
Browse files Browse the repository at this point in the history
…nance-fix-review-merged-fixes
  • Loading branch information
Raid Ateir committed Oct 29, 2024
2 parents befa74a + af8a60e commit 2430404
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions l1-contracts/contracts/governance/PermanentRestriction.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ contract PermanentRestriction is IRestriction, IPermanentRestriction, Ownable2St
mapping(bytes allowedCalldata => bool isAllowed) public allowedCalls;

/// @notice The mapping of the validated selectors.
mapping(bytes4 selector => bool isValidated) public validatedSelectors;
mapping(bytes4 selector => bool isValidated) public selectorsToValidate;

/// @notice The mapping of whitelisted L2 admins.
mapping(address adminAddress => bool isWhitelisted) public allowedL2Admins;
Expand All @@ -73,7 +73,7 @@ contract PermanentRestriction is IRestriction, IPermanentRestriction, Ownable2St
/// @notice Allows a certain `ChainAdmin` implementation to be used as an admin.
/// @param _implementationHash The hash of the implementation code.
/// @param _isAllowed The flag that indicates if the implementation is allowed.
function allowAdminImplementation(bytes32 _implementationHash, bool _isAllowed) external onlyOwner {
function setAllowedAdminImplementation(bytes32 _implementationHash, bool _isAllowed) external onlyOwner {
allowedAdminImplementations[_implementationHash] = _isAllowed;

emit AdminImplementationAllowed(_implementationHash, _isAllowed);
Expand All @@ -91,8 +91,8 @@ contract PermanentRestriction is IRestriction, IPermanentRestriction, Ownable2St
/// @notice Allows a certain selector to be validated.
/// @param _selector The selector of the function.
/// @param _isValidated The flag that indicates if the selector is validated.
function setSelectorIsValidated(bytes4 _selector, bool _isValidated) external onlyOwner {
validatedSelectors[_selector] = _isValidated;
function setSelectorShouldBeValidated(bytes4 _selector, bool _isValidated) external onlyOwner {
selectorsToValidate[_selector] = _isValidated;

emit SelectorValidationChanged(_selector, _isValidated);
}
Expand Down Expand Up @@ -170,7 +170,7 @@ contract PermanentRestriction is IRestriction, IPermanentRestriction, Ownable2St
return;
}

if (!validatedSelectors[selector]) {
if (!selectorsToValidate[selector]) {
// The selector is not validated, any data is allowed.
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ contract PermanentRestrictionTest is ChainTypeManagerTest {
);
}

function test_allowAdminImplementation(bytes32 implementationHash) public {
function test_setAllowedAdminImplementation(bytes32 implementationHash) public {
vm.expectEmit(true, false, false, true);
emit IPermanentRestriction.AdminImplementationAllowed(implementationHash, true);

vm.prank(owner);
permRestriction.allowAdminImplementation(implementationHash, true);
permRestriction.setAllowedAdminImplementation(implementationHash, true);
}

function test_setAllowedData(bytes memory data) public {
Expand All @@ -105,12 +105,12 @@ contract PermanentRestrictionTest is ChainTypeManagerTest {
permRestriction.setAllowedData(data, true);
}

function test_setSelectorIsValidated(bytes4 selector) public {
function test_setSelectorShouldBeValidated(bytes4 selector) public {
vm.expectEmit(true, false, false, true);
emit IPermanentRestriction.SelectorValidationChanged(selector, true);

vm.prank(owner);
permRestriction.setSelectorIsValidated(selector, true);
permRestriction.setSelectorShouldBeValidated(selector, true);
}

function isAddressAdmin(address chainAddr, address _potentialAdmin) internal returns (bool) {
Expand Down Expand Up @@ -160,7 +160,7 @@ contract PermanentRestrictionTest is ChainTypeManagerTest {

function test_validateCallSetPendingAdminRemovingPermanentRestriction() public {
vm.prank(owner);
permRestriction.allowAdminImplementation(address(chainAdmin).codehash, true);
permRestriction.setAllowedAdminImplementation(address(chainAdmin).codehash, true);

Call memory call = Call({
target: hyperchain,
Expand All @@ -177,7 +177,7 @@ contract PermanentRestrictionTest is ChainTypeManagerTest {

function test_validateCallSetPendingAdmin() public {
vm.prank(owner);
permRestriction.allowAdminImplementation(address(chainAdmin).codehash, true);
permRestriction.setAllowedAdminImplementation(address(chainAdmin).codehash, true);

vm.prank(address(chainAdmin));
chainAdmin.addRestriction(address(permRestriction));
Expand Down Expand Up @@ -207,7 +207,7 @@ contract PermanentRestrictionTest is ChainTypeManagerTest {

function test_validateCallCallNotAllowed() public {
vm.prank(owner);
permRestriction.setSelectorIsValidated(IAdmin.acceptAdmin.selector, true);
permRestriction.setSelectorShouldBeValidated(IAdmin.acceptAdmin.selector, true);
Call memory call = Call({
target: hyperchain,
value: 0,
Expand All @@ -223,7 +223,7 @@ contract PermanentRestrictionTest is ChainTypeManagerTest {

function test_validateCall() public {
vm.prank(owner);
permRestriction.setSelectorIsValidated(IAdmin.acceptAdmin.selector, true);
permRestriction.setSelectorShouldBeValidated(IAdmin.acceptAdmin.selector, true);
Call memory call = Call({
target: hyperchain,
value: 0,
Expand Down

0 comments on commit 2430404

Please sign in to comment.