From 197a1284c608f7c879d47becaaf1e84d7d9a23d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8r=E2=88=82=C2=A1?= Date: Mon, 27 May 2024 16:37:50 +0200 Subject: [PATCH] Make the condition only allow addMember --- .../src/conditions/MemberAccessExecuteCondition.sol | 11 ++++------- .../contracts/src/governance/MemberAccessPlugin.sol | 7 ++----- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/packages/contracts/src/conditions/MemberAccessExecuteCondition.sol b/packages/contracts/src/conditions/MemberAccessExecuteCondition.sol index 69d826d..25c8876 100644 --- a/packages/contracts/src/conditions/MemberAccessExecuteCondition.sol +++ b/packages/contracts/src/conditions/MemberAccessExecuteCondition.sol @@ -18,7 +18,7 @@ contract MemberAccessExecuteCondition is PermissionCondition { targetContract = _targetContract; } - /// @notice Checks whether the current action attempts to add or remove members + /// @notice Checks whether the current action attempts to add members function isGranted( address _where, address _who, @@ -42,12 +42,9 @@ contract MemberAccessExecuteCondition is PermissionCondition { else if (_actions[0].to != targetContract) return false; // Decode the call being requested (both have the same parameters) - (bytes4 _requestedSelector, ) = _decodeAddRemoveMemberCalldata(_actions[0].data); + (bytes4 _requestedSelector, ) = _decodeAddMemberCalldata(_actions[0].data); - if ( - _requestedSelector != MainVotingPlugin.addMember.selector && - _requestedSelector != MainVotingPlugin.removeMember.selector - ) return false; + if (_requestedSelector != MainVotingPlugin.addMember.selector) return false; return true; } @@ -60,7 +57,7 @@ contract MemberAccessExecuteCondition is PermissionCondition { } } - function _decodeAddRemoveMemberCalldata( + function _decodeAddMemberCalldata( bytes memory _data ) internal pure returns (bytes4 sig, address account) { // Slicing is only supported for bytes calldata, not bytes memory diff --git a/packages/contracts/src/governance/MemberAccessPlugin.sol b/packages/contracts/src/governance/MemberAccessPlugin.sol index 5db8c18..bfb3527 100644 --- a/packages/contracts/src/governance/MemberAccessPlugin.sol +++ b/packages/contracts/src/governance/MemberAccessPlugin.sol @@ -22,7 +22,7 @@ bytes4 constant MEMBER_ACCESS_INTERFACE_ID = MemberAccessPlugin.initialize.selec contract MemberAccessPlugin is IMultisig, PluginUUPSUpgradeable, ProposalUpgradeable { using SafeCastUpgradeable for uint256; - /// @notice The ID of the permission required to call the `addAddresses` and `removeAddresses` functions. + /// @notice The ID of the permission required to call the `addAddresses` functions. bytes32 public constant UPDATE_MULTISIG_SETTINGS_PERMISSION_ID = keccak256("UPDATE_MULTISIG_SETTINGS_PERMISSION"); @@ -97,7 +97,7 @@ contract MemberAccessPlugin is IMultisig, PluginUUPSUpgradeable, ProposalUpgrade /// @param proposalId The ID of the proposal. error ProposalExecutionForbidden(uint256 proposalId); - /// @notice Thrown when attempting to use addAddresses and removeAddresses. + /// @notice Thrown when attempting to use addAddresses. error AddresslistDisabled(); /// @notice Thrown when attempting to use an invalid contract. @@ -106,9 +106,6 @@ contract MemberAccessPlugin is IMultisig, PluginUUPSUpgradeable, ProposalUpgrade /// @notice Thrown when attempting request membership for a current member. error AlreadyMember(address _member); - /// @notice Thrown when attempting propose removing membership for a non-member. - error AlreadyNotMember(address _member); - /// @notice Emitted when a proposal is approved by an editor. /// @param proposalId The ID of the proposal. /// @param editor The editor casting the approve.