From 3095991dae885dbf9a2bd7887a4416315be6e7bc Mon Sep 17 00:00:00 2001 From: Claudia Date: Thu, 28 Nov 2024 17:27:18 +0100 Subject: [PATCH 1/4] feat: update to use new upload to pinnata function --- .../contracts/deploy/20_new_version/23_publish.ts | 14 +++++++------- .../test/20_integration-testing/21_deployment.ts | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/contracts/deploy/20_new_version/23_publish.ts b/packages/contracts/deploy/20_new_version/23_publish.ts index a0807eac..c4043f6b 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'; @@ -32,12 +32,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { 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) - )}`; + const releaseMetadataURI = await uploadToPinata( + JSON.stringify(METADATA.release, null, 2), `${PLUGIN_REPO_ENS_SUBDOMAIN_NAME}-release-metadata` + ); + const 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 1449af41..7640092d 100644 --- a/packages/contracts/test/20_integration-testing/21_deployment.ts +++ b/packages/contracts/test/20_integration-testing/21_deployment.ts @@ -9,7 +9,7 @@ import { PERMISSION_MANAGER_FLAGS, PLUGIN_REPO_PERMISSIONS, UnsupportedNetworkError, - uploadToIPFS, + uploadToPinata, } from '@aragon/osx-commons-sdk'; import { DAO, @@ -72,9 +72,9 @@ describe(`Deployment on network '${productionNetworkName}'`, function () { build: VERSION.build, }); - const buildMetadataURI = `ipfs://${await uploadToIPFS( - JSON.stringify(METADATA.build, null, 2) - )}`; + const buildMetadataURI = await uploadToPinata( + JSON.stringify(METADATA.build, null, 2), "multisig-random" + ); expect(results.buildMetadata).to.equal( ethers.utils.hexlify(ethers.utils.toUtf8Bytes(buildMetadataURI)) From 4bf5fe46dcca59a1b5e6d1ff73fde02a725e21ff Mon Sep 17 00:00:00 2001 From: Claudia Date: Thu, 28 Nov 2024 18:27:01 +0100 Subject: [PATCH 2/4] feat: update scrips to no upload to pinnata if running locally (running tests ) --- .../deploy/20_new_version/23_publish.ts | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/contracts/deploy/20_new_version/23_publish.ts b/packages/contracts/deploy/20_new_version/23_publish.ts index c4043f6b..3302c3cd 100644 --- a/packages/contracts/deploy/20_new_version/23_publish.ts +++ b/packages/contracts/deploy/20_new_version/23_publish.ts @@ -31,13 +31,21 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const {deployments} = hre; const [deployer] = await hre.ethers.getSigners(); - // Upload the metadata to IPFS - const releaseMetadataURI = await uploadToPinata( - JSON.stringify(METADATA.release, null, 2), `${PLUGIN_REPO_ENS_SUBDOMAIN_NAME}-release-metadata` - ); - const buildMetadataURI = await uploadToPinata( - JSON.stringify(METADATA.build, null, 2), `${PLUGIN_REPO_ENS_SUBDOMAIN_NAME}-build-metadata` - ); + // 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 97705430406c3385b83c1ea91fdb73f40c418926 Mon Sep 17 00:00:00 2001 From: Claudia Date: Thu, 28 Nov 2024 18:28:07 +0100 Subject: [PATCH 3/4] feat: fix test to avoid upgrading to pinnata, check setup, build and release is valid --- .../20_integration-testing/21_deployment.ts | 28 +++++++++++-------- 1 file changed, 16 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 7640092d..e5625b20 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, - uploadToPinata, } from '@aragon/osx-commons-sdk'; import { DAO, @@ -65,22 +64,17 @@ describe(`Deployment on network '${productionNetworkName}'`, function () { context('PluginSetup Publication', async () => { it('registers the setup', async () => { - const {pluginRepo} = await loadFixture(fixture); + const {pluginRepo, pluginSetupAddr} = await loadFixture(fixture); const results = await pluginRepo['getVersion((uint8,uint16))']({ release: VERSION.release, build: VERSION.build, }); - const buildMetadataURI = await uploadToPinata( - JSON.stringify(METADATA.build, null, 2), "multisig-random" - ); - - 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); + }); }); }); @@ -90,6 +84,7 @@ type FixtureResult = { pluginRepo: PluginRepo; pluginRepoRegistry: PluginRepoRegistry; managementDaoProxy: DAO; + pluginSetupAddr: string; }; async function fixture(): Promise { @@ -126,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 fffc680f563698cfb7aec962fb89b4196025f629 Mon Sep 17 00:00:00 2001 From: Giorgi Lagidze Date: Mon, 2 Dec 2024 12:11:40 +0400 Subject: [PATCH 4/4] prettier --- packages/contracts/test/20_integration-testing/21_deployment.ts | 1 - 1 file changed, 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 e5625b20..72c89cc3 100644 --- a/packages/contracts/test/20_integration-testing/21_deployment.ts +++ b/packages/contracts/test/20_integration-testing/21_deployment.ts @@ -74,7 +74,6 @@ describe(`Deployment on network '${productionNetworkName}'`, function () { expect(results.pluginSetup).to.equal(pluginSetupAddr); expect(results.tag.build).to.equal(VERSION.build); expect(results.tag.release).to.equal(VERSION.release); - }); }); });