Skip to content
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

feature: new multisig version #19

Merged
merged 67 commits into from
Nov 5, 2024
Merged

Conversation

clauBv23
Copy link

@clauBv23 clauBv23 commented Aug 21, 2024

Description

  • Add condition for create proposal permission.
  • Define a target that will work as executor instead of DAO
  • Update the proposal id to be a hash of the proposal's properties.

A couple of things remaining: ???

Task ID: OS-1482, OS-1450

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I created tasks to update dependent repositories (OSx, Plugins)
  • I ran all tests with success and extended them if necessary.
  • I have updated the CHANGELOG.md file in the root folder.

Copy link

@nivida nivida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also could generally add FuncDocs to the Solidity contracts.. but this maybe should be done within another PR to keep a narrow scope of changes here :-)

packages/contracts/src/Multisig.sol Show resolved Hide resolved
packages/contracts/src/Multisig.sol Show resolved Hide resolved
packages/contracts/src/Multisig.sol Outdated Show resolved Hide resolved
packages/contracts/src/Multisig.sol Outdated Show resolved Hide resolved
packages/contracts/src/Multisig.sol Show resolved Hide resolved
Comment on lines 184 to 190
permissions[1] = PermissionLib.MultiTargetPermission(
PermissionLib.Operation.Revoke,
_payload.plugin,
_dao,
PermissionLib.NO_CONDITION,
UPGRADE_PLUGIN_PERMISSION_ID
);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from v1.3 the UPGRADE_PLUGIN_PERMISSION_ID is not being granted to the DAO, so it doesn’t need to be revoked when uninstalling.
It is already being revoked when upgrading from a previous version

@@ -69,15 +74,21 @@ contract Multisig is

/// @notice The [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID of the contract.
bytes4 internal constant MULTISIG_INTERFACE_ID =
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this the old interface, I would make it clear by the name.
The new interface is checked via the interface ID

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not the old one, but in the new code, the IProposal createProposal function was added.

Note that this createProposal function is not needed on the current interface id because it belong to IProposal

Comment on lines 484 to 485
Action[] calldata _actions,
bytes memory _metadata
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As stated above, createProposal generating the same proposal ID twice for the same data can be a problem for certain cases.

Adding startDate might solve this issue, although my recommendation would be for having a nonce salted with the chain ID and the plugin's address

_actions: _actions,
_allowFailureMap: _allowFailureMap
});
proposalId = createProposalId(_actions, _metadata);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if I need to submit a recurring proposal each week with identical actions and description?

  • If I wanted to automate the resubmission from a contract of my own, I wouldn't be able to
  • I would be forced to append garbage bytes to the metadata URI and corrupt the UI trying to fetch it

Recommendation:

  • Add the startDate as a salt parameter
  • Consider having random and unique proposal ID's unless there's a major reason for strong determinism

Copy link
Author

@clauBv23 clauBv23 Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

/// @inheritdoc IProposal
function createProposalParamsABI() external pure override returns (string memory) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not sold on the interface name...
Thinking of createProposalDataABI(), customProposalParamsABI() or similar.
Otherwise it sounds as if createProposal() had to have these exact params, instead of talking about data

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we ended up agreeing on customProposalParamsABI
aragon/osx-commons#106

Comment on lines 31 to 44
/// @notice The ID of the permission required to call the `upgradeToAndCall` function.
bytes32 internal constant UPGRADE_PLUGIN_PERMISSION_ID = keccak256("UPGRADE_PLUGIN_PERMISSION");

/// @notice The ID of the permission required to call the `setTargetConfig` function.
bytes32 public constant SET_TARGET_CONFIG_PERMISSION_ID =
keccak256("SET_TARGET_CONFIG_PERMISSION");

/// @notice The ID of the permission required to call the `updateMetadata` function.
bytes32 public constant UPDATE_METADATA_PERMISSION_ID = keccak256("UPDATE_METADATA_PERMISSION");

/// @notice The ID of the permission required to call the `updateMultisigSettings` function.
bytes32 public constant UPDATE_MULTISIG_SETTINGS_PERMISSION_ID =
keccak256("UPDATE_MULTISIG_SETTINGS_PERMISSION");

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as with other plugins, these constants might be better moved as file level constants, living on the lib (osx-common) package

permissions[1] = PermissionLib.MultiTargetPermission(
PermissionLib.Operation.GrantWithCondition,
_payload.plugin,
address(type(uint160).max), // ANY_ADDR
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ANY_ADDR should be imported from PermissionLib, rather than hardcoded

@@ -55,10 +82,9 @@ contract MultisigSetup is PluginUpgradeableSetup {
where: plugin,
who: _dao,
condition: PermissionLib.NO_CONDITION,
permissionId: Multisig(IMPLEMENTATION).UPDATE_MULTISIG_SETTINGS_PERMISSION_ID()
permissionId: UPDATE_MULTISIG_SETTINGS_PERMISSION_ID
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not importing this from a plugin level library?

@@ -67,7 +93,34 @@ contract MultisigSetup is PluginUpgradeableSetup {
permissionId: EXECUTE_PERMISSION_ID
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not importing these from OSx common > Executor?

plugin,
address(type(uint160).max), // ANY_ADDR
listedCheckCondition,
Multisig(IMPLEMENTATION).CREATE_PROPOSAL_PERMISSION_ID()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not a file level import from an internal library, rather than calling external instances?

Copy link
Author

@clauBv23 clauBv23 Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, even when this has not been the pattern so far, I would support your proposal, unless we find a problem with doing it this way

Comment on lines 109 to 117
permissionId: SET_TARGET_CONFIG_PERMISSION_ID
});

permissions[4] = PermissionLib.MultiTargetPermission({
operation: PermissionLib.Operation.Grant,
where: plugin,
who: _dao,
condition: PermissionLib.NO_CONDITION,
permissionId: UPDATE_METADATA_PERMISSION_ID
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above:

  • file level import from OSx common > IPlugin
  • file level import from OSx common > IMetadataExtension

@novaknole novaknole merged commit af77951 into develop Nov 5, 2024
2 of 7 checks passed
@novaknole novaknole deleted the feature/multisig-improvements branch November 5, 2024 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants