Skip to content

Commit

Permalink
Merge pull request #7041 from Agoric/markm-more-invitation-proposal-p…
Browse files Browse the repository at this point in the history
…atterns

fix(governance): some governance invitations use proposal patterns
  • Loading branch information
mergify[bot] authored Aug 29, 2023
2 parents 89a3a85 + 1a0db7d commit 1eed398
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
14 changes: 10 additions & 4 deletions packages/governance/src/committee.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { E } from '@endo/eventual-send';

import { StorageNodeShape } from '@agoric/internal';
import { prepareExo, provideDurableMapStore } from '@agoric/vat-data';
import { EmptyProposalShape } from '@agoric/zoe/src/typeGuards.js';
import {
getOpenQuestions,
getPoserInvitation,
Expand Down Expand Up @@ -79,10 +80,15 @@ export const start = (zcf, privateArgs, baggage) => {
// This will produce unique descriptions because
// makeCommitteeVoterInvitation() is only called within the following loop,
// which is only called once per Electorate.
return zcf.makeInvitation(seat => {
seat.exit();
return makeVoterKit(index);
}, `Voter${index}`);
return zcf.makeInvitation(
seat => {
seat.exit();
return makeVoterKit(index);
},
`Voter${index}`,
undefined,
EmptyProposalShape,
);
};

const { committeeName, committeeSize } = zcf.getTerms();
Expand Down
8 changes: 7 additions & 1 deletion packages/governance/src/electorateTools.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { EmptyProposalShape } from '@agoric/zoe/src/typeGuards.js';
import { E } from '@endo/eventual-send';
import { deeplyFulfilled, Far } from '@endo/marshal';

Expand Down Expand Up @@ -95,7 +96,12 @@ const getPoserInvitation = (zcf, addQuestion) => {
seat.exit();
return Far(`questionPoser`, { addQuestion });
};
return zcf.makeInvitation(questionPoserHandler, `questionPoser`);
return zcf.makeInvitation(
questionPoserHandler,
`questionPoser`,
undefined,
EmptyProposalShape,
);
};

harden(startCounter);
Expand Down
3 changes: 3 additions & 0 deletions packages/governance/src/noActionElectorate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { makePublishKit } from '@agoric/notifier';
import { makePromiseKit } from '@endo/promise-kit';
import { makeExo } from '@agoric/store';
import { EmptyProposalShape } from '@agoric/zoe/src/typeGuards.js';

import { ElectoratePublicI, ElectorateCreatorI } from './typeGuards.js';

Expand Down Expand Up @@ -40,6 +41,8 @@ const start = zcf => {
return zcf.makeInvitation(
() => {},
`noActionElectorate doesn't allow posing questions`,
undefined,
EmptyProposalShape,
);
},
addQuestion(_instance, _question) {
Expand Down
6 changes: 6 additions & 0 deletions packages/zoe/src/typeGuards.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ export const FullProposalShape = harden({
/** @see {Proposal} type */
export const ProposalShape = M.splitRecord({}, FullProposalShape, {});

export const EmptyProposalShape = M.splitRecord({
give: {},
want: {},
exit: { onDemand: null },
});

export const isOnDemandExitRule = exit => {
const [exitKey] = Object.keys(exit);
return exitKey === 'onDemand';
Expand Down

0 comments on commit 1eed398

Please sign in to comment.