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

Feat: add script to merge all proposal actions #641

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7052baf
feat: add proposals data folder to gitIgnore
clauBv23 Feb 6, 2025
01a99d4
feat: create script to merge the json actions
clauBv23 Feb 6, 2025
0903be1
feat: add update path in the hh config file
clauBv23 Feb 6, 2025
2583128
feat: create the proposal creation call information to the script
clauBv23 Feb 7, 2025
81ac811
feat: use the actions descriptions as proposal metadatat
clauBv23 Feb 7, 2025
09f3e4f
feat: add logic to stor the metadata on ipfs and set the cid on the p…
clauBv23 Feb 7, 2025
51da846
feat: add proposal information to the json generated
clauBv23 Feb 7, 2025
fa672a4
feat: update the script to get the proposal information properly from…
clauBv23 Feb 7, 2025
b198e13
feat: add direction regarding how to use the script
clauBv23 Feb 10, 2025
8b0b675
feat: add format when storing info in json
clauBv23 Feb 10, 2025
219b4af
feat: set the proposal end date in the future
clauBv23 Feb 10, 2025
6c13c30
feat: add test to check new deployment proposal is correct
clauBv23 Feb 10, 2025
d19a55e
fix typo
clauBv23 Feb 10, 2025
b361110
fix: un mark generate proposal json as async
clauBv23 Feb 10, 2025
34eba92
fix: revert if something went wrong when generating the jsons
clauBv23 Feb 10, 2025
38051ab
feat: validate json has all the needed info
clauBv23 Feb 10, 2025
398cc4e
fix: revert if something when wrong generating the calldata
clauBv23 Feb 10, 2025
542e416
fix: revert
clauBv23 Feb 10, 2025
037a082
fix: typo
clauBv23 Feb 10, 2025
88829cb
fix: throw if something went wrong
clauBv23 Feb 11, 2025
e02f64d
feat(wip): add function to check all stages after proposal execution
clauBv23 Feb 11, 2025
40076d2
Merge branch 'main' into feat/add-script-to-merge-all-proposal-actions
clauBv23 Feb 11, 2025
34ef747
feat: add check for the permission and plugin and framework state aft…
clauBv23 Feb 11, 2025
ca271e8
feat: store the json to avoid losing the deployed addresses
clauBv23 Feb 11, 2025
8aed2c6
fix: update ignored folder to the new one
clauBv23 Feb 12, 2025
8dd03b7
feat: add folder for the script and related files
clauBv23 Feb 12, 2025
fb39d88
fix: update script path and test paths, add filter for identifying ea…
clauBv23 Feb 12, 2025
5c8cc35
fix: uncomment function call
clauBv23 Feb 12, 2025
927eec3
fix: revert messages and add check for creating the file
clauBv23 Feb 12, 2025
cccd6af
feat: add readme describing how using the script
clauBv23 Feb 12, 2025
cc0d964
fix: modify upload to pinata function call to new one
clauBv23 Feb 12, 2025
f02921d
feat: bump sdk version
clauBv23 Feb 12, 2025
3c2fc95
update copy
Rekard0 Feb 28, 2025
0d4af0e
update the enddate
Rekard0 Feb 28, 2025
35015b4
Fixing the local test
brickpop Feb 28, 2025
51cffed
add conditional skip test
Rekard0 Feb 28, 2025
e339c95
don't require pinata in testing
Rekard0 Feb 28, 2025
83dd772
add comment
Rekard0 Feb 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ yarn-error.log*
deployments
deployed_contracts.json
managementDAOTX.json
packages/contracts/scripts/management-dao-proposal/files-to-merge/

# generated
generated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,16 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

let metadataCIDPath = '0x';

if (!process.env.PUB_PINATA_JWT) {
throw new Error('PUB_PINATA_JWT is not set');
}

if (!isLocal(hre.network)) {
// Upload the metadata to IPFS
metadataCIDPath = await uploadToPinata(
JSON.stringify(MANAGEMENT_DAO_METADATA, null, 2),
`management-dao-metadata`
MANAGEMENT_DAO_METADATA,
`management-dao-metadata`,
process.env.PUB_PINATA_JWT
);
}

Expand Down
24 changes: 24 additions & 0 deletions packages/contracts/deploy/update/to_v1.4.0/01_Info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log('\nInfo: Updating to version 1.4.0');

hre.proposalInfo = {
proposalTitle: 'Upgrade OSx Protocol to version 1.4.0',
proposalSummary:
'Upgrade OSx Protocol to version 1.4.0, and release Admin Plugin v1.2, Multisig v1.3 and TokenVoting v1.3',
proposalResources: [
{
name: 'audit report',
url: 'https://github.com/aragon/osx/tree/main/audits',
},
],
// Adjust this values
proposalStartDate: 0,
proposalEndDate: 1741370400, // Date and time (GMT): Friday, 7 March 2025 18:00:00
};
};
export default func;
func.tags = ['Info', 'v1.4.0'];
func.dependencies = ['Env'];
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
to: managementDAOAddress,
value: 0,
data: calldata,
description: `Grant the <strong>REGISTER_DAO_PERMISSION_ID</strong> permission on the <strong>DAORegistry</strong> (<code>${daoRegistryAddress}</code>) to the new <strong>DAOFactory</strong> (<code>${deployResult.address}</code>).`,
description: `\n- Grant the **REGISTER_DAO_PERMISSION_ID** permission on the **DAORegistry** (\`${daoRegistryAddress}\`) to the new **DAOFactory** (\`${deployResult.address}\`).`,
});
};
export default func;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
to: managementDAOAddress,
value: 0,
data: calldata,
description: `Moves the <strong>REGISTER_PLUGIN_REPO_PERMISSION</strong> permission on the <strong>PluginRepoRegistry</strong> (<code>${pluginRepoRegistryAddress}</code>) from the old <strong>PluginRepoFactory</strong> (<code>${previousPluginRepoFactoryAddress}</code>) to the new <strong>PluginRepoFactory</strong> (<code>${deployResult.address}</code>).`,
description: `\n- Moves the **REGISTER_PLUGIN_REPO_PERMISSION_ID** permission on the **PluginRepoRegistry** (\`${pluginRepoRegistryAddress}\`) from the old **PluginRepoFactory** (\`${previousPluginRepoFactoryAddress}\`) to the new **PluginRepoFactory** (\`${deployResult.address}\`).`,
});
};
export default func;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
to: upgradeTX.to,
data: upgradeTX.data,
value: 0,
description: `Upgrade the <strong>DaoRegistry </strong> (<code>${daoRegistryAddress}</code>) to the new <strong>implementation</strong> (<code>${result.address}</code>).`,
description: `\n- Upgrade the **DaoRegistry** (\`${daoRegistryAddress}\`) to the new **implementation** (\`${result.address}\`).`,
});
};
export default func;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
to: upgradeTX.to,
data: upgradeTX.data,
value: 0,
description: `Upgrade the <strong>PluginRepoRegistry </strong> (<code>${pluginRepoRegistryAddress}</code>) to the new <strong>implementation</strong> (<code>${result.address}</code>).`,
description: `\n- Upgrade the **PluginRepoRegistry** (\`${pluginRepoRegistryAddress}\`) to the new **implementation** (\`${result.address}\`).`,
});
};
export default func;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
to: upgradeTX.to,
data: upgradeTX.data,
value: 0,
description: `Upgrade the <strong>management DAO</strong> (<code>${managementDAOAddress}</code>) to the new <strong>implementation</strong> (<code>${newDaoImplementation}</code>).`,
description: `\n- Upgrade the **management DAO** (\`${managementDAOAddress}\`) to the new **implementation** (\`${newDaoImplementation}\`).`,
});
};
export default func;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,16 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
}

const storeInfo = {
proposalInfo: hre.proposalInfo,
deployedContractAddresses,
managementDAOActions: hre.managementDAOActions,
};

await fs.writeFile('deployed_contracts.json', JSON.stringify(storeInfo));
await fs.writeFile(
'deployed_contracts.json',
JSON.stringify(storeInfo, null, 2),
'utf-8'
);
};
export default func;
func.tags = ['New', 'Conclude', 'ConcludeEnd'];
Expand Down
7 changes: 6 additions & 1 deletion packages/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ const config: HardhatUserConfig = {
gasPrice: 80000000000,
deploy: ENABLE_DEPLOY_TEST
? ['./deploy']
: ['./deploy/env', './deploy/new', './deploy/verification'],
: [
'./deploy/env',
'./deploy/new',
'./deploy/verification',
'./deploy/update',
],
},
localhost: {
deploy: ENABLE_DEPLOY_TEST
Expand Down
5 changes: 3 additions & 2 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"prepublishOnly": "yarn build && yarn build:npm",
"docgen": "hardhat docgen",
"docs": "DOCS=true scripts/prepare-docs.sh",
"clean": "rm -rf artifacts cache deployments typechain"
"clean": "rm -rf artifacts cache deployments typechain",
"generate-proposal": "ts-node scripts/management-dao-proposal/generate-managing-dao-proposal-info.ts"
},
"repository": {
"type": "git",
Expand All @@ -52,7 +53,7 @@
},
"devDependencies": {
"@aragon/osx-commons-configs": "^0.8.0",
"@aragon/osx-commons-sdk": "^0.1.0",
"@aragon/osx-commons-sdk": "^0.2.0",
"@aragon/osx-ethers-v1.2.0": "npm:@aragon/[email protected]",
"@aragon/osx-v1.0.1": "npm:@aragon/[email protected]",
"@aragon/osx-v1.3.0": "npm:@aragon/[email protected]",
Expand Down
58 changes: 58 additions & 0 deletions packages/contracts/scripts/management-dao-proposal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
## Description

This script merges the plugin proposal actions defined in the files inside the `files-to-merge` folder and the `deployed_contracts.json` file into the `merged-proposals.json` file.

## How it works

Before running this script, you need to deploy the plugins and the framework.

To deploy the framework, run the deploy script in the `packages/contracts` folder:

```
yarn deploy --network <network> --tags <the tags>
```

For deploying version `1.4.0` on Sepolia, you can run:

```
yarn deploy --network sepolia --tags v1.4.0,VerifyEnd,ConcludeEnd
```

This will generate a `deployed_contracts.json` file in the `packages/contracts` folder that will be used by this script to merge proposal actions. The proposal information will be included (for more details, check the first deployment step in the `01_Info.ts` file). You can modify this information as needed (elements like the proposal end date might need modification).

After deploying the framework, go to each plugin repository and run the deploy script:

```
yarn deploy --network <network> --tags <the tags>
```

For deploying and publishing a new version on Sepolia, you can run:

```
yarn deploy --network sepolia --tags NewVersion,Verification
```

This deployment will generate a `createVersionProposalData-network.json` file that you need to copy to the `./files-to-merge` folder.

Once you have both the `deployed_contracts.json` file and the plugin deployment json files, you can run this script to merge the proposal actions:

```
yarn generate-proposal
```

This will generate two files in the `./generated` folder:

- A `merged-proposals.json` file with all the proposal and deployment details
- A `calldata.json` file with the proposal information and the raw calldata

## Steps

1. Deploy the framework
2. Deploy the plugins
3. Copy the deployment json files to the `./files-to-merge` folder
4. Run the script to merge the proposal actions
5. The `./generated` folder will be created with the `merged-proposals.json` file and the `calldata.json` file

## Note

To test the deployment and the generated calldata, you can check the tests in the `test/deploy/deployment-1.4.0.ts` file. It will attempt to create, approve, and execute the proposal with the calldata generated by this script. This file is specific for checking the deployment of version `1.4.0`; you might need to modify it for other versions. Also, note that the test is forking the network, so you might need to adjust the network name and the fork block number.
Loading
Loading