Skip to content

Commit

Permalink
Merge branch 'develop' into feature/permission-condition-erc-165-support
Browse files Browse the repository at this point in the history
  • Loading branch information
heueristik authored Jun 15, 2023
2 parents 6205e3e + 5ae9b0d commit 33ccee8
Show file tree
Hide file tree
Showing 11 changed files with 121 additions and 25 deletions.
7 changes: 5 additions & 2 deletions UPDATE_CHECKLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@ 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

To update run `yarn deploy --network NETWORK` in `packages/contracts` and replace `NETWORK` with the correct network name (e.g. for mainnet it is `yarn deploy --network mainnet`).

## After-Update

- [ ] Follow the version specific tasks in the section `Version tasks`
- [ ] Follow the version specific tasks in the section `Version tasks`

### Configuration updates

Expand Down
6 changes: 4 additions & 2 deletions packages/contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Added `PermissionConditionBase` to have ERC-165 support for `IPermissionCondition` implementations.
- 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.

Expand All @@ -29,6 +29,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
Expand Down
5 changes: 4 additions & 1 deletion packages/contracts/src/framework/plugin/repo/PluginRepo.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -21,6 +23,7 @@ contract PluginRepo is
ERC165Upgradeable,
IPluginRepo,
UUPSUpgradeable,
ProtocolVersion,
PermissionManager
{
using AddressUpgradeable for address;
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@

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";

/// @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;

Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.",
Expand Down Expand Up @@ -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": {
Expand Down
7 changes: 7 additions & 0 deletions packages/contracts/test/framework/dao/dao-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
DAORegistry__factory,
PluginRepo__factory,
IProtocolVersion__factory,
IERC165__factory,
} from '../../../typechain';

import {deployENSSubdomainRegistrar} from '../../test-utils/ens';
Expand Down Expand Up @@ -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
Expand Down
31 changes: 31 additions & 0 deletions packages/contracts/test/framework/plugin/plugin-repo-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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(
Expand Down
40 changes: 40 additions & 0 deletions packages/contracts/test/framework/plugin/plugin-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,21 @@ import {
PluginUUPSUpgradeableSetupV1Mock,
PlaceholderSetup__factory,
TestPlugin__factory,
IERC165__factory,
IPluginRepo__factory,
IProtocolVersion__factory,
UUPSUpgradeable__factory,
} from '../../../typechain';

import {
deployMockPluginSetup,
deployNewPluginRepo,
} from '../../test-utils/repo';
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';
Expand Down Expand Up @@ -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(
Expand Down
26 changes: 13 additions & 13 deletions packages/subgraph/manifest/data/polygon.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
}
2 changes: 1 addition & 1 deletion packages/subgraph/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/subgraph/scripts/deploy-subgraph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 33ccee8

Please sign in to comment.