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

Builder Script for Replacing Committee and Charter #10161

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
33 changes: 33 additions & 0 deletions packages/builders/scripts/inter-protocol/ec-changes-core.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { makeHelpers } from '@agoric/deploy-script-support';
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) => {
return harden({
sourceSpec:
'@agoric/inter-protocol/src/proposals/replaceCommitteeAndCharter.js',
getManifestCall: [
getManifestForReplaceCommitteeAndCharter.name,
{
...opts,
economicCommitteeRef: publishRef(
install(
'@agoric/governance/src/committee.js',
'../bundles/bundle-committee.js',
),
),
economicCharterRef: publishRef(
install(
'@agoric/inter-protocol/src/econCommitteeCharter.js',
'../bundles/bundle-econCommitteeCharter.js',
),
),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having developed the builder script by referencing other examples in our repo, I have some questions around:

        ...opts,
        economicCommitteeRef: publishRef(
          install(
            '@agoric/governance/src/committee.js',
            '../bundles/bundle-committee.js',
          ),
        ),
        economicCharterRef: publishRef(
          install(
            '@agoric/inter-protocol/src/econCommitteeCharter.js',
            '../bundles/bundle-econCommitteeCharter.js',
          ),
        ),
  • What are the roles of economicCommitteeRef and economicCharterRef? Specifically, what are these references used for in the script?
  • Regarding the install function, what does the second parameter represent? Is it indicating the directory where the bundles are located, or does it serve another purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this section of code responsible for generating new bundles? If yes, I reckon we don't need to include:

    economicCommitteeRef: publishRef(
          install(
            '@agoric/governance/src/committee.js',
            '../bundles/bundle-committee.js',
          ),
        ),
        economicCharterRef: publishRef(
          install(
            '@agoric/inter-protocol/src/econCommitteeCharter.js',
            '../bundles/bundle-econCommitteeCharter.js',
          ),

That's something we plan to do in 2 different core evals(Maybe I'll add that in #10151 and #10150) which updates the creatorFacet of committee and charter contracts with the relevant methods after our design for it is finalized.

},
],
});
};

export default async (homeP, endowments) => {
const { writeCoreEval } = await makeHelpers(homeP, endowments);
await writeCoreEval('replace-committee-and-charter', defaultProposalBuilder);
};
67 changes: 57 additions & 10 deletions packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/* global E */
// @ts-check
/// <reference types="@agoric/vats/src/core/core-eval-env"/>
/// <reference types="@agoric/vats/src/core/types-ambient"/>
import { E } from '@endo/eventual-send';

Check failure on line 2 in packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js

View workflow job for this annotation

GitHub Actions / lint-primary

Expected 1 empty line after import statement not followed by another import
const { Fail } = assert;

const runConfig = {
committeeName: 'Economic Committee',
economicCommitteeAddresses: {
gov1: 'agoric1ldmtatp24qlllgxmrsjzcpe20fvlkp448zcuce',
gov1: 'agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q',
// gov2: 'agoric140dmkrz2e42ergjj7gyvejhzmjzurvqeq82ang',
// gov3: 'agoric1w8wktaur4zf8qmmtn3n7x3r0jhsjkjntcm3u6h',
// gov4: 'agoric1p2aqakv3ulz4qfy2nut86j9gx0dx0yw09h96md',
Expand Down Expand Up @@ -83,7 +81,7 @@
console.info('confirmed deposit for', debugName);
};

const handlehighPrioritySendersList = async ({

Check failure on line 84 in packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js

View workflow job for this annotation

GitHub Actions / lint-primary

'handlehighPrioritySendersList' is assigned a value but never used. Allowed unused vars must match /^_/u
consume: { highPrioritySendersManager: highPrioritySendersManagerP },
}) => {
const EC_HIGH_PRIORITY_SENDERS_NAMESPACE = 'economicCommittee';
Expand Down Expand Up @@ -111,14 +109,14 @@

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,
Expand Down Expand Up @@ -324,7 +322,7 @@
);
};

const shutdown = async ({

Check failure on line 325 in packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js

View workflow job for this annotation

GitHub Actions / lint-primary

'shutdown' is assigned a value but never used. Allowed unused vars must match /^_/u
consume: { economicCommitteeCreatorFacet, econCharterKit },
}) => {
trace('Shutting down old EC Committee');
Expand All @@ -337,12 +335,12 @@
trace('EC Charter shutdown successful');
};

const main = async permittedPowers => {
await shutdown(permittedPowers);
export const replaceCommitteeAndCharter = async permittedPowers => {
// await shutdown(permittedPowers);
await startNewEconomicCommittee(permittedPowers);
await startNewEconCharter(permittedPowers);
await addGovernorsToEconCharter(permittedPowers);
await handlehighPrioritySendersList(permittedPowers);
// await handlehighPrioritySendersList(permittedPowers);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented line 338. Because the shutdown definition assumes that committee and charter contracts have shutdown method in their creatorFacet.

Commented 343 too. Although it's not required if I've updated the wallet addresses on line 5 in runConfig object. Wallet addresses should be based on a3p.

const psmKitMap = await permittedPowers.consume.psmKit;

Expand Down Expand Up @@ -377,4 +375,53 @@
trace('Installed New Economic Committee');
};

main;
harden(replaceCommitteeAndCharter);
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,
},
},
},
},
});
Loading