From 5e77c1eb2a7919c98e27a6c59734554c6a38b7d1 Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 2 Dec 2024 10:19:07 +0100 Subject: [PATCH 1/5] feat: use new upload to pinata function from sdk --- .../deploy/20_new_version/23_publish.ts | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/contracts/deploy/20_new_version/23_publish.ts b/packages/contracts/deploy/20_new_version/23_publish.ts index 28020a74..890060d2 100644 --- a/packages/contracts/deploy/20_new_version/23_publish.ts +++ b/packages/contracts/deploy/20_new_version/23_publish.ts @@ -12,7 +12,7 @@ import { isLocal, pluginEnsDomain, } from '../../utils/helpers'; -import {PLUGIN_REPO_PERMISSIONS, uploadToIPFS} from '@aragon/osx-commons-sdk'; +import {PLUGIN_REPO_PERMISSIONS, uploadToPinata} from '@aragon/osx-commons-sdk'; import {writeFile} from 'fs/promises'; import {ethers} from 'hardhat'; import {DeployFunction} from 'hardhat-deploy/types'; @@ -31,14 +31,19 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const {deployments} = hre; const [deployer] = await hre.ethers.getSigners(); - // Upload the metadata to IPFS - const releaseMetadataURI = `ipfs://${await uploadToIPFS( - JSON.stringify(METADATA.release, null, 2) - )}`; - const buildMetadataURI = `ipfs://${await uploadToIPFS( - JSON.stringify(METADATA.build, null, 2) - )}`; + // / metadata will be empty if running locally + let releaseMetadataURI = ''; + let buildMetadataURI = ''; + if (!isLocal(hre)) { + // Upload the metadata to IPFS + releaseMetadataURI = await uploadToPinata( + JSON.stringify(METADATA.release, null, 2), `${PLUGIN_REPO_ENS_SUBDOMAIN_NAME}-release-metadata` + ); + buildMetadataURI = await uploadToPinata( + JSON.stringify(METADATA.build, null, 2), `${PLUGIN_REPO_ENS_SUBDOMAIN_NAME}-build-metadata` + ); + } console.log(`Uploaded release metadata: ${releaseMetadataURI}`); console.log(`Uploaded build metadata: ${buildMetadataURI}`); From 0bf7f4adce2965422cb60ae49b26ac64858b0bb1 Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 2 Dec 2024 10:19:27 +0100 Subject: [PATCH 2/5] feat: update test to no need upload to pinnata function in the tests --- .../20_integration-testing/21_deployment.ts | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/packages/contracts/test/20_integration-testing/21_deployment.ts b/packages/contracts/test/20_integration-testing/21_deployment.ts index cfa1da4d..096afd17 100644 --- a/packages/contracts/test/20_integration-testing/21_deployment.ts +++ b/packages/contracts/test/20_integration-testing/21_deployment.ts @@ -1,4 +1,4 @@ -import {METADATA, VERSION} from '../../plugin-settings'; +import {VERSION, PLUGIN_SETUP_CONTRACT_NAME} from '../../plugin-settings'; import {getProductionNetworkName, findPluginRepo} from '../../utils/helpers'; import { getLatestNetworkDeployment, @@ -9,7 +9,6 @@ import { PERMISSION_MANAGER_FLAGS, PLUGIN_REPO_PERMISSIONS, UnsupportedNetworkError, - uploadToIPFS, } from '@aragon/osx-commons-sdk'; import { DAO, @@ -64,21 +63,18 @@ describe(`Deployment on network '${productionNetworkName}'`, function () { }); context('PluginSetup Publication', async () => { - it('registers the setup', async () => { - const {pluginRepo} = await loadFixture(fixture); + it.only('registers the setup', async () => { + const {pluginRepo, pluginSetupAddr} = await loadFixture(fixture); const results = await pluginRepo['getVersion((uint8,uint16))']({ release: VERSION.release, build: VERSION.build, }); - const buildMetadataURI = `ipfs://${await uploadToIPFS( - JSON.stringify(METADATA.build, null, 2) - )}`; - - expect(results.buildMetadata).to.equal( - ethers.utils.hexlify(ethers.utils.toUtf8Bytes(buildMetadataURI)) - ); + + expect(results.pluginSetup).to.equal(pluginSetupAddr); + expect(results.tag.build).to.equal(VERSION.build); + expect(results.tag.release).to.equal(VERSION.release); }); }); }); @@ -88,6 +84,7 @@ type FixtureResult = { pluginRepo: PluginRepo; pluginRepoRegistry: PluginRepoRegistry; managementDaoProxy: DAO; + pluginSetupAddr: string; }; async function fixture(): Promise { @@ -124,5 +121,14 @@ async function fixture(): Promise { deployer ); - return {deployer, pluginRepo, pluginRepoRegistry, managementDaoProxy}; + const pluginSetupAddr = (await deployments.get(PLUGIN_SETUP_CONTRACT_NAME)) + .address; + +return { + deployer, + pluginRepo, + pluginRepoRegistry, + managementDaoProxy, + pluginSetupAddr, +}; } From ec3ca0b6401ff3758a177b661a59ab157663b3fe Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 2 Dec 2024 10:20:30 +0100 Subject: [PATCH 3/5] ci: format --- .../deploy/20_new_version/23_publish.ts | 10 ++++++---- .../20_integration-testing/21_deployment.ts | 19 +++++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/contracts/deploy/20_new_version/23_publish.ts b/packages/contracts/deploy/20_new_version/23_publish.ts index 890060d2..47ef911d 100644 --- a/packages/contracts/deploy/20_new_version/23_publish.ts +++ b/packages/contracts/deploy/20_new_version/23_publish.ts @@ -38,11 +38,13 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { if (!isLocal(hre)) { // Upload the metadata to IPFS releaseMetadataURI = await uploadToPinata( - JSON.stringify(METADATA.release, null, 2), `${PLUGIN_REPO_ENS_SUBDOMAIN_NAME}-release-metadata` + JSON.stringify(METADATA.release, null, 2), + `${PLUGIN_REPO_ENS_SUBDOMAIN_NAME}-release-metadata` + ); + buildMetadataURI = await uploadToPinata( + JSON.stringify(METADATA.build, null, 2), + `${PLUGIN_REPO_ENS_SUBDOMAIN_NAME}-build-metadata` ); - buildMetadataURI = await uploadToPinata( - JSON.stringify(METADATA.build, null, 2), `${PLUGIN_REPO_ENS_SUBDOMAIN_NAME}-build-metadata` - ); } console.log(`Uploaded release metadata: ${releaseMetadataURI}`); console.log(`Uploaded build metadata: ${buildMetadataURI}`); diff --git a/packages/contracts/test/20_integration-testing/21_deployment.ts b/packages/contracts/test/20_integration-testing/21_deployment.ts index 096afd17..8a0a1c8a 100644 --- a/packages/contracts/test/20_integration-testing/21_deployment.ts +++ b/packages/contracts/test/20_integration-testing/21_deployment.ts @@ -71,7 +71,6 @@ describe(`Deployment on network '${productionNetworkName}'`, function () { build: VERSION.build, }); - expect(results.pluginSetup).to.equal(pluginSetupAddr); expect(results.tag.build).to.equal(VERSION.build); expect(results.tag.release).to.equal(VERSION.release); @@ -122,13 +121,13 @@ async function fixture(): Promise { ); const pluginSetupAddr = (await deployments.get(PLUGIN_SETUP_CONTRACT_NAME)) - .address; - -return { - deployer, - pluginRepo, - pluginRepoRegistry, - managementDaoProxy, - pluginSetupAddr, -}; + .address; + + return { + deployer, + pluginRepo, + pluginRepoRegistry, + managementDaoProxy, + pluginSetupAddr, + }; } From 3b90eb82af992bf638c7b907b15da16a89a8ec43 Mon Sep 17 00:00:00 2001 From: Claudia Barcelo Date: Mon, 2 Dec 2024 10:26:34 +0100 Subject: [PATCH 4/5] Update packages/contracts/deploy/20_new_version/23_publish.ts --- packages/contracts/deploy/20_new_version/23_publish.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/contracts/deploy/20_new_version/23_publish.ts b/packages/contracts/deploy/20_new_version/23_publish.ts index 47ef911d..cfc8625e 100644 --- a/packages/contracts/deploy/20_new_version/23_publish.ts +++ b/packages/contracts/deploy/20_new_version/23_publish.ts @@ -31,7 +31,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const {deployments} = hre; const [deployer] = await hre.ethers.getSigners(); - // / metadata will be empty if running locally + // metadata will be empty if running locally let releaseMetadataURI = ''; let buildMetadataURI = ''; From 0bd973e6aca11b2208d34cd94d85b685df916de2 Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 2 Dec 2024 10:30:24 +0100 Subject: [PATCH 5/5] fix: remove .only --- packages/contracts/test/20_integration-testing/21_deployment.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/contracts/test/20_integration-testing/21_deployment.ts b/packages/contracts/test/20_integration-testing/21_deployment.ts index 8a0a1c8a..69cebfd5 100644 --- a/packages/contracts/test/20_integration-testing/21_deployment.ts +++ b/packages/contracts/test/20_integration-testing/21_deployment.ts @@ -63,7 +63,7 @@ describe(`Deployment on network '${productionNetworkName}'`, function () { }); context('PluginSetup Publication', async () => { - it.only('registers the setup', async () => { + it('registers the setup', async () => { const {pluginRepo, pluginSetupAddr} = await loadFixture(fixture); const results = await pluginRepo['getVersion((uint8,uint16))']({