From fff596d5ac361a944f563991e6d5f3732915a057 Mon Sep 17 00:00:00 2001 From: rabi-siddique Date: Thu, 26 Sep 2024 14:26:00 +0500 Subject: [PATCH 1/4] feat: builder script for replacing committee and charter --- .../scripts/inter-protocol/ec-changes-core.js | 35 +++++++++++++ .../proposals/replaceCommitteeAndCharter.js | 52 ++++++++++++++++++- 2 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 packages/builders/scripts/inter-protocol/ec-changes-core.js diff --git a/packages/builders/scripts/inter-protocol/ec-changes-core.js b/packages/builders/scripts/inter-protocol/ec-changes-core.js new file mode 100644 index 00000000000..9caa366c170 --- /dev/null +++ b/packages/builders/scripts/inter-protocol/ec-changes-core.js @@ -0,0 +1,35 @@ +/* global process */ + +import { makeHelpers } from '@agoric/deploy-script-support'; +import { getManifestForReplaceCommitteeAndCharter } from '@agoric/inter-protocol/src/proposals/replaceCommitteeAndCharter'; + +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ +export const defaultProposalBuilder = async ({ publishRef, install }, opts) => { + return harden({ + sourceSpec: + '@agoric/inter-protocol/src/proposals/replaceCommitteeAndCharter.js', + getManifestCall: [ + getManifestForReplaceCommitteeAndCharter.name, + { + ...opts, + economicCommitteeRef: publishRef( + install( + '@agoric/governance/src/committee.js', + '@agoric/governance/bundles/bundle-committee.js', + ), + ), + economicCharterRef: publishRef( + install( + '@agoric/inter-protocol/src/econCommitteeCharter.js', + '@agoric/inter-protocol/bundles/bundle-econCommitteeCharter.js', + ), + ), + }, + ], + }); +}; + +export default async (homeP, endowments) => { + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('replace-committee-and-charter', defaultProposalBuilder); +}; diff --git a/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js b/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js index e9f2be296eb..e5fe720879e 100644 --- a/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js +++ b/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js @@ -337,7 +337,7 @@ const shutdown = async ({ trace('EC Charter shutdown successful'); }; -const main = async permittedPowers => { +const replaceCommitteeAndCharter = async permittedPowers => { await shutdown(permittedPowers); await startNewEconomicCommittee(permittedPowers); await startNewEconCharter(permittedPowers); @@ -377,4 +377,52 @@ const main = async permittedPowers => { trace('Installed New Economic Committee'); }; -main; +export const getManifestForReplaceCommitteeAndCharter = async ({ + economicCommitteeRef: _economicCommitteeRef, + economicCharterRef: _economicCharterRef, +}) => ({ + manifest: { + [replaceCommitteeAndCharter.name]: { + consume: { + board: true, + chainStorage: true, + econCharterKit: true, + economicCommitteeCreatorFacet: true, + highPrioritySendersManager: true, + instancePrivateArgs: true, + namesByAddressAdmin: true, + priceAuthority: true, + priceAuthorityAdmin: true, + reserveKit: true, + vaultFactoryKit: true, + auctioneerKit: true, + psmKit: true, + zoe: true, + }, + produce: { + economicCommittee: true, + economicCommitteeCreatorFacet: true, + econCharterKit: true, + econCommitteeCharter: true, + }, + installation: { + consume: { + committee: true, + econCommitteeCharter: true, + binaryVoteCounter: true, + }, + }, + instance: { + consume: { + reserve: true, + VaultFactory: true, + auctioneer: true, + }, + produce: { + economicCommittee: true, + econCommitteeCharter: true, + }, + }, + }, + }, +}); From ee927b80c1eacfc1b8e8d02b18800e474012a309 Mon Sep 17 00:00:00 2001 From: rabi-siddique Date: Thu, 26 Sep 2024 14:38:48 +0500 Subject: [PATCH 2/4] lint: replace let with const to fix lint failure --- .../builders/scripts/inter-protocol/ec-changes-core.js | 8 +++----- .../src/proposals/replaceCommitteeAndCharter.js | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/builders/scripts/inter-protocol/ec-changes-core.js b/packages/builders/scripts/inter-protocol/ec-changes-core.js index 9caa366c170..4aa95ffed06 100644 --- a/packages/builders/scripts/inter-protocol/ec-changes-core.js +++ b/packages/builders/scripts/inter-protocol/ec-changes-core.js @@ -1,7 +1,5 @@ -/* global process */ - import { makeHelpers } from '@agoric/deploy-script-support'; -import { getManifestForReplaceCommitteeAndCharter } from '@agoric/inter-protocol/src/proposals/replaceCommitteeAndCharter'; +import { getManifestForReplaceCommitteeAndCharter } from '@agoric/inter-protocol/src/proposals/replaceCommitteeAndCharter.js'; /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }, opts) => { @@ -15,13 +13,13 @@ export const defaultProposalBuilder = async ({ publishRef, install }, opts) => { economicCommitteeRef: publishRef( install( '@agoric/governance/src/committee.js', - '@agoric/governance/bundles/bundle-committee.js', + '../bundles/bundle-committee.js', ), ), economicCharterRef: publishRef( install( '@agoric/inter-protocol/src/econCommitteeCharter.js', - '@agoric/inter-protocol/bundles/bundle-econCommitteeCharter.js', + '../bundles/bundle-econCommitteeCharter.js', ), ), }, diff --git a/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js b/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js index e5fe720879e..9b2b0cdc75b 100644 --- a/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js +++ b/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js @@ -111,14 +111,14 @@ const handlehighPrioritySendersList = async ({ if (highPrioritySendersManager) { // Add the addresses - for (let address of uniqueAddAddresses) { + for (const address of uniqueAddAddresses) { await E(highPrioritySendersManager).add( EC_HIGH_PRIORITY_SENDERS_NAMESPACE, address, ); } // Remove the addresses - for (let address of uniqueRemoveAddresses) { + for (const address of uniqueRemoveAddresses) { await E(highPrioritySendersManager).remove( EC_HIGH_PRIORITY_SENDERS_NAMESPACE, address, From 05d2cf72f67c324fc804bfbe2df758bff57df6e6 Mon Sep 17 00:00:00 2001 From: rabi-siddique Date: Thu, 26 Sep 2024 17:49:48 +0500 Subject: [PATCH 3/4] chore: export and harden replaceCommitteeAndCharter --- .../inter-protocol/src/proposals/replaceCommitteeAndCharter.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js b/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js index 9b2b0cdc75b..683fc2aae61 100644 --- a/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js +++ b/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js @@ -337,7 +337,7 @@ const shutdown = async ({ trace('EC Charter shutdown successful'); }; -const replaceCommitteeAndCharter = async permittedPowers => { +export const replaceCommitteeAndCharter = async permittedPowers => { await shutdown(permittedPowers); await startNewEconomicCommittee(permittedPowers); await startNewEconCharter(permittedPowers); @@ -377,6 +377,7 @@ const replaceCommitteeAndCharter = async permittedPowers => { trace('Installed New Economic Committee'); }; +harden(replaceCommitteeAndCharter); export const getManifestForReplaceCommitteeAndCharter = async ({ economicCommitteeRef: _economicCommitteeRef, economicCharterRef: _economicCharterRef, From a038d6eeb117e696aadbf2467fb787aae517ca1a Mon Sep 17 00:00:00 2001 From: rabi-siddique Date: Thu, 26 Sep 2024 17:56:20 +0500 Subject: [PATCH 4/4] chore: add missing import for E() --- .../src/proposals/replaceCommitteeAndCharter.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js b/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js index 683fc2aae61..bc7d23be218 100644 --- a/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js +++ b/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js @@ -1,13 +1,11 @@ -/* global E */ // @ts-check -/// -/// +import { E } from '@endo/eventual-send'; const { Fail } = assert; const runConfig = { committeeName: 'Economic Committee', economicCommitteeAddresses: { - gov1: 'agoric1ldmtatp24qlllgxmrsjzcpe20fvlkp448zcuce', + gov1: 'agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q', // gov2: 'agoric140dmkrz2e42ergjj7gyvejhzmjzurvqeq82ang', // gov3: 'agoric1w8wktaur4zf8qmmtn3n7x3r0jhsjkjntcm3u6h', // gov4: 'agoric1p2aqakv3ulz4qfy2nut86j9gx0dx0yw09h96md', @@ -338,11 +336,11 @@ const shutdown = async ({ }; export const replaceCommitteeAndCharter = async permittedPowers => { - await shutdown(permittedPowers); + // await shutdown(permittedPowers); await startNewEconomicCommittee(permittedPowers); await startNewEconCharter(permittedPowers); await addGovernorsToEconCharter(permittedPowers); - await handlehighPrioritySendersList(permittedPowers); + // await handlehighPrioritySendersList(permittedPowers); const psmKitMap = await permittedPowers.consume.psmKit;