Skip to content

Commit

Permalink
fix: call internal function and allow manager to grant and revoke per…
Browse files Browse the repository at this point in the history
…â�missions
  • Loading branch information
blockgroot committed Oct 3, 2024
1 parent ac8e162 commit 76100fa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions contracts/StaderConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -302,19 +302,19 @@ contract StaderConfig is IStaderConfig, AccessControlUpgradeable {
address contractAddress,
string calldata functionSig,
address accountToPermit
) external override onlyRole(DEFAULT_ADMIN_ROLE) {
) external override onlyRole(MANAGER) {
bytes32 role = keccak256(abi.encodePacked(contractAddress, functionSig));
grantRole(role, accountToPermit);
_grantRole(role, accountToPermit);
emit PermissionGranted(accountToPermit, contractAddress, functionSig);
}

function revokeCallPermission(
address contractAddress,
string calldata functionSig,
address accountToRevoke
) external override onlyRole(DEFAULT_ADMIN_ROLE) {
) external override onlyRole(MANAGER) {
bytes32 role = keccak256(abi.encodePacked(contractAddress, functionSig));
revokeRole(role, accountToRevoke);
_revokeRole(role, accountToRevoke);
emit PermissionRevoked(accountToRevoke, contractAddress, functionSig);

Check warning on line 318 in contracts/StaderConfig.sol

View check run for this annotation

Codecov / codecov/patch

contracts/StaderConfig.sol#L316-L318

Added lines #L316 - L318 were not covered by tests
}

Expand Down
4 changes: 3 additions & 1 deletion test/foundry_tests/PoolSelector.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ contract PoolSelectorTest is Test {
staderConfig.updateStakePoolManager(staderStakePoolManager);
staderConfig.grantRole(staderConfig.MANAGER(), staderManager);
staderConfig.grantRole(staderConfig.OPERATOR(), operator);
staderConfig.giveCallPermission(address(poolSelector), "updatePoolWeights(uint256[])", configurator);
vm.stopPrank();

vm.prank(staderManager);
staderConfig.giveCallPermission(address(poolSelector), "updatePoolWeights(uint256[])", configurator);
}

function test_JustToIncreaseCoverage() public {
Expand Down
4 changes: 3 additions & 1 deletion test/foundry_tests/PoolUtils.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ contract PoolUtilsTest is Test {
vm.startPrank(staderAdmin);
staderConfig.grantRole(staderConfig.MANAGER(), staderManager);
staderConfig.grantRole(staderConfig.OPERATOR(), operator);
staderConfig.giveCallPermission(address(poolUtils), "processValidatorExitList(bytes[])", configurator);
vm.stopPrank();

vm.prank(staderManager);
staderConfig.giveCallPermission(address(poolUtils), "processValidatorExitList(bytes[])", configurator);
}

function test_JustToIncreaseCoverage() public {
Expand Down

0 comments on commit 76100fa

Please sign in to comment.