From 9e563a3a9875e970d4fde8b713fafe952f784596 Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 23 Sep 2024 17:33:36 +0200 Subject: [PATCH 1/4] fix: remove duplicated test --- packages/contracts/test/10_unit-testing/11_plugin.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/contracts/test/10_unit-testing/11_plugin.ts b/packages/contracts/test/10_unit-testing/11_plugin.ts index 3181b0c7..a094cf9d 100644 --- a/packages/contracts/test/10_unit-testing/11_plugin.ts +++ b/packages/contracts/test/10_unit-testing/11_plugin.ts @@ -317,9 +317,6 @@ describe('Multisig', function () { ).to.be.revertedWith('Initializable: contract is already initialized'); }); - // todo add test for checking that plugins already initialized on a previous version can not be initialized again - it('reverts if trying to initialize lower version plugin'); - it('sets the `_targetConfig` when initializing an uninitialized plugin', async () => { const {uninitializedPlugin, deployer} = await loadFixture(fixture); From 927a4c2f406108ca65c6ae454c2bf5195f3f2a4d Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 23 Sep 2024 17:34:21 +0200 Subject: [PATCH 2/4] ci: define latest plugin build as constant --- packages/contracts/test/20_integration-testing/test-helpers.ts | 3 ++- packages/contracts/test/multisig-constants.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/contracts/test/20_integration-testing/test-helpers.ts b/packages/contracts/test/20_integration-testing/test-helpers.ts index fc2c5f41..fcc3b180 100644 --- a/packages/contracts/test/20_integration-testing/test-helpers.ts +++ b/packages/contracts/test/20_integration-testing/test-helpers.ts @@ -6,6 +6,7 @@ import { } from '../../typechain'; import {ProxyCreatedEvent} from '../../typechain/@aragon/osx-commons-contracts/src/utils/deployment/ProxyFactory'; import {PluginUUPSUpgradeable__factory} from '../../typechain/factories/@aragon/osx-v1.0.0/core/plugin'; +import {latestPluginBuild} from '../multisig-constants'; import { DAO_PERMISSIONS, PLUGIN_SETUP_PROCESSOR_PERMISSIONS, @@ -333,7 +334,7 @@ export async function updateFromBuildTest( pluginSetupRefLatestBuild, ethers.utils.defaultAbiCoder.encode( getNamedTypesFromMetadata( - METADATA.build.pluginSetup.prepareUpdate[3].inputs + METADATA.build.pluginSetup.prepareUpdate[latestPluginBuild].inputs ), updateInputs ) diff --git a/packages/contracts/test/multisig-constants.ts b/packages/contracts/test/multisig-constants.ts index 73ed4b35..ab180132 100644 --- a/packages/contracts/test/multisig-constants.ts +++ b/packages/contracts/test/multisig-constants.ts @@ -40,3 +40,4 @@ export type TargetConfig = { }; export const latestInitializerVersion = 2; +export const latestPluginBuild = 3; From a2a5dd5f9d51891b3ec2967032868da7286a0be5 Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 23 Sep 2024 17:34:59 +0200 Subject: [PATCH 3/4] feat: add test to check the prepare upgrade must do nothing if the from version is the latest one --- .../test/10_unit-testing/12_plugin-setup.ts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/packages/contracts/test/10_unit-testing/12_plugin-setup.ts b/packages/contracts/test/10_unit-testing/12_plugin-setup.ts index 3f3e79a6..bee3f2e5 100644 --- a/packages/contracts/test/10_unit-testing/12_plugin-setup.ts +++ b/packages/contracts/test/10_unit-testing/12_plugin-setup.ts @@ -495,6 +495,31 @@ describe('MultisigSetup', function () { ], ]); }); + + it('returns the permissions expected for the update from build 3', async () => { + const {pluginSetup, dao, prepareUpdateBuild3Inputs} = await loadFixture( + fixture + ); + const plugin = ethers.Wallet.createRandom().address; + + // Make a static call to check that the plugin update data being returned is correct. + const { + initData: initData, + preparedSetupData: {helpers, permissions}, + } = await pluginSetup.callStatic.prepareUpdate(dao.address, 3, { + currentHelpers: [ + ethers.Wallet.createRandom().address, + ethers.Wallet.createRandom().address, + ], + data: prepareUpdateBuild3Inputs, + plugin, + }); + + // Check the return data. There should be no permission needed for build 3. + expect(initData).to.be.eq('0x'); + expect(permissions.length).to.be.equal(0); + expect(helpers.length).to.be.equal(0); + }); }); describe('prepareUninstallation', async () => { From 3814009f27cd799920b545dd3a15cd45063a4d96 Mon Sep 17 00:00:00 2001 From: Claudia Date: Thu, 26 Sep 2024 14:42:16 +0200 Subject: [PATCH 4/4] fix: test comment --- packages/contracts/test/10_unit-testing/12_plugin-setup.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/contracts/test/10_unit-testing/12_plugin-setup.ts b/packages/contracts/test/10_unit-testing/12_plugin-setup.ts index bee3f2e5..552765d5 100644 --- a/packages/contracts/test/10_unit-testing/12_plugin-setup.ts +++ b/packages/contracts/test/10_unit-testing/12_plugin-setup.ts @@ -496,7 +496,7 @@ describe('MultisigSetup', function () { ]); }); - it('returns the permissions expected for the update from build 3', async () => { + it('returns the permissions expected for the update from build 3 (empty list)', async () => { const {pluginSetup, dao, prepareUpdateBuild3Inputs} = await loadFixture( fixture );