From 0308393290b3012b555554508de1f946b07994ea Mon Sep 17 00:00:00 2001 From: Michael Heuer <20623991+Michael-A-Heuer@users.noreply.github.com> Date: Wed, 14 Jun 2023 10:25:37 +0200 Subject: [PATCH 1/4] fix: corrected build metadata (#411) * fix: corrected build metadata * fix: added missing item to the change list * feat: updated deployment checklist * feat: improved checklist item --- UPDATE_CHECKLIST.md | 7 +++++-- .../src/plugins/governance/multisig/build-metadata.json | 6 +----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/UPDATE_CHECKLIST.md b/UPDATE_CHECKLIST.md index 387700fb5..1e59a02c2 100644 --- a/UPDATE_CHECKLIST.md +++ b/UPDATE_CHECKLIST.md @@ -19,7 +19,10 @@ This checklist is seen as a guide to update the existing deployment. - [ ] Set `ETH_KEY` in `.env` to the deployers private key. It doesn't have to be the previous deployer - [ ] Set the right API key for the chains blockchain explorer in `.env` (e.g. for mainnet it is `ETHERSCAN_KEY`) - [ ] Copy the managing DAO multisig env variables from `packages/subgraph/.env-example` into `packages/subgraph/.env` -- [ ] Follow the version specific tasks in the section `Version tasks` +- [ ] Follow the version specific tasks in the section `Version tasks` +- [ ] If new plugin builds are released + - [ ] Double-check that the build-metadata was updated correctly for the UI to work correctly + - [ ] If the plugin is used by the managing DAO and the new build includes security relevant changes it must be applied immediately ## Update @@ -27,7 +30,7 @@ To update run `yarn deploy --network NETWORK` in `packages/contracts` and replac ## After-Update -- [ ] Follow the version specific tasks in the section `Version tasks` +- [ ] Follow the version specific tasks in the section `Version tasks` ### Configuration updates diff --git a/packages/contracts/src/plugins/governance/multisig/build-metadata.json b/packages/contracts/src/plugins/governance/multisig/build-metadata.json index 9ba9c517a..57d40531e 100644 --- a/packages/contracts/src/plugins/governance/multisig/build-metadata.json +++ b/packages/contracts/src/plugins/governance/multisig/build-metadata.json @@ -1,6 +1,6 @@ { "ui": {}, - "change": "- The ability to create a proposal now depends on the membership status of the current instead of the snapshot block.", + "change": "- The ability to create a proposal now depends on the membership status of the current instead of the snapshot block.\n- Added a check ensuring that the initial member list cannot overflow.", "pluginSetup": { "prepareInstallation": { "description": "The information required for the installation.", @@ -36,10 +36,6 @@ "1": { "description": "No input is required for the update.", "inputs": [] - }, - "2": { - "description": "No input is required for the update.", - "inputs": [] } }, "prepareUninstallation": { From f58f93bcffda4b39ed6667b215b9b26c3de3f6b4 Mon Sep 17 00:00:00 2001 From: Rekard0 <5880388+Rekard0@users.noreply.github.com> Date: Wed, 14 Jun 2023 12:23:38 +0300 Subject: [PATCH 2/4] bump package version (#413) * bump package version * add satsuma ipfs gateway --- packages/subgraph/package.json | 2 +- packages/subgraph/scripts/deploy-subgraph.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/subgraph/package.json b/packages/subgraph/package.json index 7a9962794..4422b814d 100644 --- a/packages/subgraph/package.json +++ b/packages/subgraph/package.json @@ -1,6 +1,6 @@ { "name": "@aragon/osx-subgraph", - "version": "1.1.0", + "version": "1.2.0", "description": "The Aragon OSx Subgraph", "homepage": "https://github.com/aragon/osx", "license": "AGPL-3.0-or-later", diff --git a/packages/subgraph/scripts/deploy-subgraph.sh b/packages/subgraph/scripts/deploy-subgraph.sh index 0c99609ce..e39dbba99 100755 --- a/packages/subgraph/scripts/deploy-subgraph.sh +++ b/packages/subgraph/scripts/deploy-subgraph.sh @@ -47,6 +47,7 @@ then else graph deploy $FULLNAME \ --version-label $SUBGRAPH_VERSION \ + --ipfs https://ipfs.satsuma.xyz \ --node https://app.satsuma.xyz/api/subgraphs/deploy \ --deploy-key $GRAPH_KEY > deploy-output.txt From 54590f347e22be44be5c6c0c87cbaf9956ec31ae Mon Sep 17 00:00:00 2001 From: Rekard0 <5880388+Rekard0@users.noreply.github.com> Date: Wed, 14 Jun 2023 17:18:21 +0300 Subject: [PATCH 3/4] fix polygon manifest (#414) --- packages/subgraph/manifest/data/polygon.json | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/subgraph/manifest/data/polygon.json b/packages/subgraph/manifest/data/polygon.json index 162073c83..def964e99 100644 --- a/packages/subgraph/manifest/data/polygon.json +++ b/packages/subgraph/manifest/data/polygon.json @@ -6,18 +6,18 @@ "name": "DAORegistry", "address": "0x96E54098317631641703404C06A5afAD89da7373", "startBlock": 40817440 - } - }, - "PluginRepoRegistry": { - "name": "PluginRepoRegistry", - "address": "0xA03C2182af8eC460D498108C92E8638a580b94d4", - "startBlock": 40817440 - }, - "PluginSetupProcessors": [ - { - "name": "PluginSetupProcessor", - "address": "0x879D9dfe3F36d7684BeC1a2bB4Aa8E8871A7245B", + }, + "PluginRepoRegistry": { + "name": "PluginRepoRegistry", + "address": "0xA03C2182af8eC460D498108C92E8638a580b94d4", "startBlock": 40817440 - } - ] + }, + "PluginSetupProcessors": [ + { + "name": "PluginSetupProcessor", + "address": "0x879D9dfe3F36d7684BeC1a2bB4Aa8E8871A7245B", + "startBlock": 40817440 + } + ] + } } From 5ae9b0d8a3be73b471df0d14ecacb6676b203e5f Mon Sep 17 00:00:00 2001 From: Michael Heuer <20623991+Michael-A-Heuer@users.noreply.github.com> Date: Thu, 15 Jun 2023 10:18:58 +0200 Subject: [PATCH 4/4] Added ProtocolVersion to PluginRepoFactory and PluginRepo (#412) * feat: added ProtocolVersion to PluginRepoFactory and PluginRepo * fix: remove wrong ERC-165 usage * chore: maintained changelog --- packages/contracts/CHANGELOG.md | 6 ++- .../src/framework/plugin/repo/PluginRepo.sol | 5 ++- .../plugin/repo/PluginRepoFactory.sol | 15 ++++++- .../test/framework/dao/dao-factory.ts | 7 ++++ .../framework/plugin/plugin-repo-factory.ts | 31 ++++++++++++++ .../test/framework/plugin/plugin-repo.ts | 40 +++++++++++++++++++ 6 files changed, 100 insertions(+), 4 deletions(-) diff --git a/packages/contracts/CHANGELOG.md b/packages/contracts/CHANGELOG.md index 1cebd85ac..9c769bb67 100644 --- a/packages/contracts/CHANGELOG.md +++ b/packages/contracts/CHANGELOG.md @@ -9,8 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Inherit `ProtocolVersion` and `ERC165` in `DAOFactory`. -- Inherit `ProtocolVersion` in `DAO`. +- Inherit `ProtocolVersion` and `ERC165` in `DAOFactory` and `PluginRepoFactory`. +- Inherit `ProtocolVersion` in `DAO` and `PluginRepo`. - Added a `nonReentrant` modifier to the `execute` function in the `DAO` contract. - Added `allowFailureMap` to `IDAO.Executed` event. @@ -28,6 +28,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed +- Removed unnecessary ERC-165 check for `type(UUPSUpgradeable).interfaceId` from `supportsInterface` in `PluginRepo`. + ## v1.2.0 ### Added diff --git a/packages/contracts/src/framework/plugin/repo/PluginRepo.sol b/packages/contracts/src/framework/plugin/repo/PluginRepo.sol index 655b8ebf5..0fd62fcb5 100644 --- a/packages/contracts/src/framework/plugin/repo/PluginRepo.sol +++ b/packages/contracts/src/framework/plugin/repo/PluginRepo.sol @@ -8,6 +8,8 @@ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/U import {AddressUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; import {ERC165CheckerUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165CheckerUpgradeable.sol"; +import {IProtocolVersion} from "../../../utils/protocol/IProtocolVersion.sol"; +import {ProtocolVersion} from "../../../utils/protocol/ProtocolVersion.sol"; import {PermissionManager} from "../../../core/permission/PermissionManager.sol"; import {PluginSetup} from "../setup/PluginSetup.sol"; import {IPluginSetup} from "../setup/PluginSetup.sol"; @@ -21,6 +23,7 @@ contract PluginRepo is ERC165Upgradeable, IPluginRepo, UUPSUpgradeable, + ProtocolVersion, PermissionManager { using AddressUpgradeable for address; @@ -264,7 +267,7 @@ contract PluginRepo is function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) { return _interfaceId == type(IPluginRepo).interfaceId || - _interfaceId == type(UUPSUpgradeable).interfaceId || + _interfaceId == type(IProtocolVersion).interfaceId || super.supportsInterface(_interfaceId); } } diff --git a/packages/contracts/src/framework/plugin/repo/PluginRepoFactory.sol b/packages/contracts/src/framework/plugin/repo/PluginRepoFactory.sol index 4a666b0ac..06e362b85 100644 --- a/packages/contracts/src/framework/plugin/repo/PluginRepoFactory.sol +++ b/packages/contracts/src/framework/plugin/repo/PluginRepoFactory.sol @@ -2,7 +2,11 @@ pragma solidity 0.8.17; +import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol"; + import {PermissionLib} from "../../../core/permission/PermissionLib.sol"; +import {IProtocolVersion} from "../../../utils/protocol/IProtocolVersion.sol"; +import {ProtocolVersion} from "../../../utils/protocol/ProtocolVersion.sol"; import {createERC1967Proxy} from "../../../utils/Proxy.sol"; import {PluginRepoRegistry} from "./PluginRepoRegistry.sol"; import {PluginRepo} from "./PluginRepo.sol"; @@ -10,7 +14,7 @@ import {PluginRepo} from "./PluginRepo.sol"; /// @title PluginRepoFactory /// @author Aragon Association - 2022-2023 /// @notice This contract creates `PluginRepo` proxies and registers them on a `PluginRepoRegistry` contract. -contract PluginRepoFactory { +contract PluginRepoFactory is ERC165, ProtocolVersion { /// @notice The Aragon plugin registry contract. PluginRepoRegistry public pluginRepoRegistry; @@ -25,6 +29,15 @@ contract PluginRepoFactory { pluginRepoBase = address(new PluginRepo()); } + /// @notice Checks if this or the parent contract supports an interface by its ID. + /// @param _interfaceId The ID of the interface. + /// @return Returns `true` if the interface is supported. + function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) { + return + _interfaceId == type(IProtocolVersion).interfaceId || + super.supportsInterface(_interfaceId); + } + /// @notice Creates a plugin repository proxy pointing to the `pluginRepoBase` implementation and registers it in the Aragon plugin registry. /// @param _subdomain The plugin repository subdomain. /// @param _initialOwner The plugin maintainer address. diff --git a/packages/contracts/test/framework/dao/dao-factory.ts b/packages/contracts/test/framework/dao/dao-factory.ts index d903ddc63..a0663e0e9 100644 --- a/packages/contracts/test/framework/dao/dao-factory.ts +++ b/packages/contracts/test/framework/dao/dao-factory.ts @@ -25,6 +25,7 @@ import { DAORegistry__factory, PluginRepo__factory, IProtocolVersion__factory, + IERC165__factory, } from '../../../typechain'; import {deployENSSubdomainRegistrar} from '../../test-utils/ens'; @@ -299,6 +300,12 @@ describe('DAOFactory: ', function () { expect(await daoFactory.supportsInterface('0xffffffff')).to.be.false; }); + it('supports the `IERC165` interface', async () => { + const iface = IERC165__factory.createInterface(); + expect(await daoFactory.supportsInterface(getInterfaceID(iface))).to.be + .true; + }); + it('supports the `IProtocolVersion` interface', async () => { const iface = IProtocolVersion__factory.createInterface(); expect(await daoFactory.supportsInterface(getInterfaceID(iface))).to.be diff --git a/packages/contracts/test/framework/plugin/plugin-repo-factory.ts b/packages/contracts/test/framework/plugin/plugin-repo-factory.ts index 6f91bd30c..7ee96d196 100644 --- a/packages/contracts/test/framework/plugin/plugin-repo-factory.ts +++ b/packages/contracts/test/framework/plugin/plugin-repo-factory.ts @@ -15,8 +15,12 @@ import { PluginRepoFactory, PluginRepoFactory__factory, PluginRepo__factory, + IProtocolVersion__factory, + IERC165__factory, } from '../../../typechain'; import {getMergedABI} from '../../../utils/abi'; +import {getInterfaceID} from '../../test-utils/interfaces'; +import {CURRENT_PROTOCOL_VERSION} from '../../test-utils/protocol-version'; const EVENTS = { PluginRepoRegistered: 'PluginRepoRegistered', @@ -111,6 +115,33 @@ describe('PluginRepoFactory: ', function () { ); }); + describe('ERC-165', async () => { + it('does not support the empty interface', async () => { + expect(await pluginRepoFactory.supportsInterface('0xffffffff')).to.be + .false; + }); + + it('supports the `IERC165` interface', async () => { + const iface = IERC165__factory.createInterface(); + expect(await pluginRepoFactory.supportsInterface(getInterfaceID(iface))) + .to.be.true; + }); + + it('supports the `IProtocolVersion` interface', async () => { + const iface = IProtocolVersion__factory.createInterface(); + expect(await pluginRepoFactory.supportsInterface(getInterfaceID(iface))) + .to.be.true; + }); + }); + + describe('Protocol version', async () => { + it('returns the current protocol version', async () => { + expect(await pluginRepoFactory.protocolVersion()).to.deep.equal( + CURRENT_PROTOCOL_VERSION + ); + }); + }); + describe('CreatePluginRepo', async () => { it('fail to create new pluginRepo with no PLUGIN_REGISTER_PERMISSION', async () => { await managingDao.revoke( diff --git a/packages/contracts/test/framework/plugin/plugin-repo.ts b/packages/contracts/test/framework/plugin/plugin-repo.ts index f12c06951..ba629afbf 100644 --- a/packages/contracts/test/framework/plugin/plugin-repo.ts +++ b/packages/contracts/test/framework/plugin/plugin-repo.ts @@ -11,7 +11,12 @@ import { PluginUUPSUpgradeableSetupV1Mock, PlaceholderSetup__factory, TestPlugin__factory, + IERC165__factory, + IPluginRepo__factory, + IProtocolVersion__factory, + UUPSUpgradeable__factory, } from '../../../typechain'; + import { deployMockPluginSetup, deployNewPluginRepo, @@ -19,6 +24,8 @@ import { import {shouldUpgradeCorrectly} from '../../test-utils/uups-upgradeable'; import {UPGRADE_PERMISSIONS} from '../../test-utils/permissions'; import {ZERO_BYTES32} from '../../test-utils/dao'; +import {getInterfaceID} from '../../test-utils/interfaces'; +import {CURRENT_PROTOCOL_VERSION} from '../../test-utils/protocol-version'; const emptyBytes = '0x00'; const BUILD_METADATA = '0x11'; @@ -74,6 +81,39 @@ describe('PluginRepo', function () { } }); + describe('ERC-165', async () => { + it('does not support the empty interface', async () => { + expect(await pluginRepo.supportsInterface('0xffffffff')).to.be.false; + }); + + it('supports the `IERC165` interface', async () => { + const iface = IERC165__factory.createInterface(); + expect(await pluginRepo.supportsInterface(getInterfaceID(iface))).to.be + .true; + }); + + it('supports the `IPluginRepo` interface', async () => { + const iface = IPluginRepo__factory.createInterface(); + expect(getInterfaceID(iface)).to.equal('0xd4321b40'); // the interfaceID from IPluginRepo v1.0.0 + expect(await pluginRepo.supportsInterface(getInterfaceID(iface))).to.be + .true; + }); + + it('supports the `IProtocolVersion` interface', async () => { + const iface = IProtocolVersion__factory.createInterface(); + expect(await pluginRepo.supportsInterface(getInterfaceID(iface))).to.be + .true; + }); + }); + + describe('Protocol version', async () => { + it('returns the current protocol version', async () => { + expect(await pluginRepo.protocolVersion()).to.deep.equal( + CURRENT_PROTOCOL_VERSION + ); + }); + }); + describe('CreateVersion: ', async () => { it('reverts if the caller does not have permission', async () => { await expect(