From 85548973938ceeea99d7647962191417a3f9440c Mon Sep 17 00:00:00 2001 From: Chris Hibbert Date: Thu, 30 Sep 2021 15:04:10 -0700 Subject: [PATCH] refactor: rename Registrar to Electorate committeeRegistrar became committee --- packages/governance/README.md | 105 +++++++++--------- packages/governance/docs/AttackGuide.md | 26 ++--- .../governance/docs/contractGovernance.puml | 12 +- .../governance/docs/coreArchitecture.puml | 28 ++--- packages/governance/docs/example.puml | 8 +- packages/governance/src/binaryVoteCounter.js | 4 +- .../{committeeRegistrar.js => committee.js} | 20 ++-- packages/governance/src/contractGovernor.js | 32 +++--- packages/governance/src/index.js | 2 +- packages/governance/src/question.js | 8 +- packages/governance/src/registrarTools.js | 2 +- packages/governance/src/types.js | 42 +++---- packages/governance/src/validators.js | 18 +-- .../committeeBinary/bootstrap.js | 46 ++++---- .../committeeBinary/test-committee.js | 8 +- .../committeeBinary/vat-voter.js | 30 ++--- .../contractGovernor/bootstrap.js | 45 ++++---- .../contractGovernor/test-governor.js | 4 +- .../contractGovernor/vat-voter.js | 20 ++-- .../test/unitTests/test-committee.js | 22 ++-- packages/xsnap/moddable | 2 +- 21 files changed, 244 insertions(+), 240 deletions(-) rename packages/governance/src/{committeeRegistrar.js => committee.js} (88%) diff --git a/packages/governance/README.md b/packages/governance/README.md index 151617a38d81..2ca99a7f87d3 100644 --- a/packages/governance/README.md +++ b/packages/governance/README.md @@ -1,64 +1,64 @@ # Governance -This package provides Registrars and VoteCounters to create a general +This package provides Electorates and VoteCounters to create a general framework for governance. It has implementations for particular kinds of electorates and different ways of tallying votes. -The registrars and VoteCounters are self-describing and reveal what they are +The electorates and VoteCounters are self-describing and reveal what they are connected to so that voters can verify that their votes mean what they say and will be tabulated as expected. -Any occasion of governance starts with the creation of a Registrar. Two kinds +Any occasion of governance starts with the creation of an Electorate. Two kinds exist currently that represent committees and stakeholders (Stakeholder support is in review). The electorate may deal with many questions governing many things, so the electorate has to exist before any questions can be posed. The next piece to be created is an ElectionManager. (A Contract Governor, is a particular example, discussed below). An ElectionManager is tied to a particular -Registrar. It supports creation of questions, can manage what happens with the +Electorate. It supports creation of questions, can manage what happens with the results, and may limit the kinds of questions it can handle. The ElectionManager is also responsible for specifying which VoteCounter will be used with any particular question. Different VoteCounters will handle elections with two positions or more, with plurality voting, single-transferable-vote, or instant-runoff-voting. -When a question is posed, it is only with respect to a particular Registrar, +When a question is posed, it is only with respect to a particular Electorate, (which identifies a collection of eligible voters) and a particular vote -counting contract. The QuestionSpec consists of `{ choiceMethod, issue, -positions, electionType, maxChoices }`. The issue and positions can be -strings or structured objects. ChoiceMethod is one of UNRANKED and ORDER, which -is sufficient to describe all the most common kinds of votes. A vote between two -candidates or positions uses UNRANKED with a limit of one vote. ORDER will be -useful for Single Transferable Vote or Instant Runoff Voting. ElectionType -distinguishes PARAM_CHANGE, which has structured questions, from others where -the issue is a string. +counting contract. The QuestionSpec consists of `{ method, issue, positions, +electionType, maxChoices }`. The issue and positions can be strings or +structured objects. Method is one of UNRANKED and ORDER, which is sufficient to +describe all the most common kinds of votes. A vote between two candidates or +positions uses UNRANKED with a limit of one vote. ORDER will be useful for +Single Transferable Vote or Instant Runoff Voting. ElectionType distinguishes +PARAM_CHANGE, which has structured questions, from others where the issue is a +string. When posing a particular question to be voted on, the closingRule also has to be -specified. When voters are presented with a question to vote on, they have access -to QuestionDetails, which includes information from the QuestionSpec, the -closingRule, and the VoteCounter instance. The VoteCounter has the Registrar +specified. When voters are presented with a question to vote on, they have +access to QuestionDetails, which includes information from the QuestionSpec, the +closingRule, and the VoteCounter instance. The VoteCounter has the Electorate in its terms, so voters can verify it. Voters get a voting facet via an invitation, so they're sure they're connected -to the Registrar that's responsible for this vote. They can subscribe with the -registrar to get a list of new questions. They can use the questionHandle from the -notifier to get the questionDetails. Voters cast their vote by sending their -selected list of positions to their registrar, which they know and trust. +to the Electorate that's responsible for this vote. They can subscribe with the +electorate to get a list of new questions. They can use the questionHandle from +the notifier to get the questionDetails. Voters cast their vote by sending their +selected list of positions to their electorate, which they know and trust. -This structure of Registrars and VoteCounters allows voters and observers to +This structure of Electorates and VoteCounters allows voters and observers to verify how votes will be counted, and who can vote on them, but doesn't constrain the process of creating questions. ElectionManagers make that process visible. ContractGovernor is a particular example of that that makes it possible for a contract to publish details of how its parameters will be subject to governance. -## Registrar +## Electorate -A Registrar represents a set of voters. Each voter receives an invitation +An Electorate represents a set of voters. Each voter receives an invitation for a voterFacet, which allows voting in all elections supported by -that registrar. The Registrar starts a new VoteCounter instance for each +that electorate. The Electorate starts a new VoteCounter instance for each separate question, and gets the `creatorFacet`, which carries the `submitVote()` -method that registers votes with the voteCounter. The Registrar is responsible +method that registers votes with the voteCounter. The Electorate is responsible for ensuring that `submitVote()` can only be called with the voter's unique voterHandle. @@ -72,7 +72,7 @@ accessing the param values and for setting them. The governed contract would use the access facet internally, and make that visible to anyone who should be able to see the values, while ensuring that the private facet, which can control the values, is only accessible to a visible ContractGovernor. The ContractGovernor -makes the Registrar visible, while tightly controlling the process of +makes the Electorate visible, while tightly controlling the process of creating new questions and presenting them to the electorate. The governor starts up the Contract and can see what params are subject to @@ -83,16 +83,16 @@ to governance, but that's too many meta-levels at this point. The party that has the question-creating facet of the ContractGovernor can create a question that asks about changing a particular parameter on the -contract instance. The registrar creates new questions, and makes a new instance -of a VoteCounter so everyone can see how questions will be counted. +contract instance. The electorate creates new questions, and makes a new +instance of a VoteCounter so everyone can see how questions will be counted. -Registrars have a public method to get from the questionHandle to a question. +Electorates have a public method to get from the questionHandle to a question. Ballots include the questionSpec, the VoteCounter instance and closingRule. For contract governance, the question specifies the governed contract instance, the parameter to be changed, and the proposed new value. This is sufficient for voters and others to verify that the contract is managed -by the governor, the registrar is the one the governor uses, and a particular +by the governor, the electorate is the one the governor uses, and a particular voteCounter is in use. The governed contract can be inspected to verify that some parameter values are @@ -121,11 +121,12 @@ values are `{ AMOUNT, BRAND, INSTANCE, INSTALLATION, NAT, RATIO, STRING, UNKNOWN }`. The list can be extended as we find more types that contracts want to manage. -In order to make the management of parameters visible to clients of the -contract, it should +There's a contractHelper for the vast majority of expected clients that will +have a single set of parameters to manage. A contract only has to define the +parameters in a call to `handleParamGovernance()`, and add any needed methods +to the public and creator facets. This will * validate that the declaration of the parameters is included in its terms, - * publish the accessor facet of the paramManager in its publicFacet, and - * include a paramManagerRetriever in its creatorFacet for the contractGovernor. + * add the parameter retriever appropriately to the publicFacet and creatorFacet ## Scenarios @@ -133,7 +134,7 @@ contract, it should Governed contracts will make their governor and parameters visible, either through the terms or the public facet. The governor, in turn, publicly shares -the registrar, which makes the list of questions visible. The questions show +the electorate, which makes the list of questions visible. The questions show their voteCounters, which makes it possible to tell how the counting will be done. @@ -148,47 +149,49 @@ governor's public facet will also refer to the contract it governs. Once you have the instance you can retrieve the installation from Zoe which allows you to examine the source. -The governedContract will provide the registrar, which allows you to check the +The governedContract will provide the electorate, which allows you to check the electorate, and retrieve a list of open questions. (We should add closed questions and their resolution as well.) Each question refers to the voteCounter it uses. ### Participating in Governance -Voters are managed by a Registrar. Prospective voters should only accept a +Voters are managed by an Electorate. Prospective voters should only accept a voting API as the outcome of an invitation. The invitation allows you to verify -the particular registrar instance in use. The registrar's public facet has -`getQuestionSubscription()`, which allows you to find out about new questions for -the electorate and `getOpenQuestions()` which lists questions that haven't been -resolved. +the particular electorate instance in use. The electorate's public facet has +`getQuestionSubscription()`, which allows you to find out about new questions +for the electorate and `getOpenQuestions()` which lists questions that haven't +been resolved. Each question describes its subject. One field of the questionDetails is `ElectionType`, which can be `PARAM_CHANGE`, `ELECTION`, or `SURVEY`. (I'm sure we'll come up with more types.) When it is `PARAM_CHANGE`, the questionDetails -will also identify the contract instance, the particular parameter to be changed, -and the proposed new value. At present, all parameter change elections are by -majority vote, and if a majority doesn't vote in favor, then no change is made. +will also identify the contract instance, the particular parameter to be +changed, and the proposed new value. At present, all parameter change elections +are by majority vote, and if a majority doesn't vote in favor, then no change is +made. ## Future Extensions The architecture is intended to support several scenarios that haven't been filled in yet. -### Registrars +### Electorates -We currently have a committeeRegistrar, which has an opaque group of voters. The +The initial Electorate represents a Committee, with has an opaque group of +voters. The contract makes no attempt to make the voters legible to others. This might be useful for a private group making a decision, or a case where a dictator has the ability to appoint a committee that will make decisions. -The ClaimsRegistrar (coming soon!) is a Registrar that gives the ability to vote -to anyone who has an Attestation payment from the Attestation contract. +The AttestedElectorate (coming soon!) is an Electorate that gives the ability to +vote to anyone who has an Attestation payment from the Attestation contract. Observers can't tell who the voters are, but they can validate the qualifications to vote. -Another plausible registrar would use the result of a public vote to give voting -facets to the election winners. There would have to be some kind of public -registration of the identities of the candidates to make them visible. +Another plausible electorate would use the result of a public vote to give +voting facets to the election winners. There would have to be some kind of +public registration of the identities of the candidates to make them visible. ### VoteCounters diff --git a/packages/governance/docs/AttackGuide.md b/packages/governance/docs/AttackGuide.md index fb5ea40dab68..754a7dbe848e 100644 --- a/packages/governance/docs/AttackGuide.md +++ b/packages/governance/docs/AttackGuide.md @@ -31,7 +31,7 @@ stuff the ballot box. I can't think of a way to evade the way BinaryVoteCounter ensures that each vote is only counted once, but it's something to be aware of with new -VoteCounters, and particularly in combination with new Registrars. +VoteCounters, and particularly in combination with new Electorates. ## Break notification so voters don't hear about elections @@ -41,7 +41,7 @@ provided for announcing new issues. ## Leak the ability to create new questions Currently creating new questions is seen as tightly held. If that is loosened -in a new Registrar or ElectionManager, that provides a path for spamming +in a new Electorate or ElectionManager, that provides a path for spamming voters. ## What shenanigans can be caused by creating multiple questions with the same or very similar text? @@ -51,24 +51,24 @@ questionHandle for disambiguation. Voters ought to validate the particulars of any question they intend to vote on. Can they be confused by corrections or replacement? Is there a vulnerability here, or just a UI support need? -## Create a Question that refers to a different VoteCounter than the one the registrar will use +## Create a Question that refers to a different VoteCounter than the one the electorate will use -## Distribute questions that don't match the official one from the Registrar +## Distribute questions that don't match the official one from the Electorate Questions themselves are not secure. The voter has to get a copy of the question -from the Registrar to have any assurance that it's valid. If someone else +from the Electorate to have any assurance that it's valid. If someone else provides a question, they can replace various pieces to fool the voter as to what is being voted on or how the votes will be tallied. ## Ordinary bugs in counting votes, reporting, etc. -If the code in VoteCounter, Registrar, ContractGovernor has subtle mistakes, +If the code in VoteCounter, Electorate, ContractGovernor has subtle mistakes, wrong results will obtain. -## Produce a discrepancy between Terms and actions in VoteCounter or Registrar +## Produce a discrepancy between Terms and actions in VoteCounter or Electorate The voter's assurance that a particular vote has the effect they expect -arises in part because the `terms` in the VoteCounter, Registrar, +arises in part because the `terms` in the VoteCounter, Electorate, etc. dictate how those classes will act. If the code is changed to get info from hidden parameters or to ignore some of the terms, voters will be misled. @@ -79,17 +79,17 @@ timers, but timers aren't self-revealing. Participants should compare the timers to known platform-provided timers before relying on them. [A related bug has been filed](https://github.com/Agoric/agoric-sdk/issues/3748) -## Registrar allow unauthorized parties to cast votes +## Electorate allow unauthorized parties to cast votes -Every registrar will have some notion of who the authorized voters are. They +Every electorate will have some notion of who the authorized voters are. They need to properly enforce that each voter can vote their weight once. The -initial implementation (committeeRegistrar) supports equal weight votes and -known voters. Future Registrars and VoteCounters will support other models. +initial implementation (Committee) supports equal weight votes and +known voters. Future Electorates and VoteCounters will support other models. The combination of open-entry stake-holder votes with variable weight voteCounters will require even more diligence to ensure there are no avenues for multiply counting votes. -## Registrar accidentally re-use a voteCounter +## Electorate accidentally re-use a voteCounter Each voteCounter is intended to be used once. If there's a path that allows re-use, this would be a hazard. diff --git a/packages/governance/docs/contractGovernance.puml b/packages/governance/docs/contractGovernance.puml index be5420ce6b78..e8f30ab2c7a7 100644 --- a/packages/governance/docs/contractGovernance.puml +++ b/packages/governance/docs/contractGovernance.puml @@ -21,18 +21,18 @@ package "GovernedContract Vat" <> { } class "ContractGovernor\n(an ElectionManager)" as ContractGovernor { - verifiable: governedInstance, registrarInstance + verifiable: governedInstance, electorateInstance -- - +getRegistrar() + +getElectorate() +getGovernedContract() +validateVoteCounter() - +validateRegistrar() + +validateElectorate() +validateTimer() - -startGovernedInstance(registrar, governed, ...) + -startGovernedInstance(electorate, governed, ...) } note left : ContractGovernor starts GovernedContract\nstartGovernedInstance() returns a tightly held facet\n with voteOnParamChange() for the creator. -class Registrar { +class Electorate { Questions === -addQuestion() @@ -41,7 +41,7 @@ class Registrar { GovernedContract ..> ParamManager : creates > GovernedContract --> ParamManager : access\nto params ContractGovernor ..> GovernedContract : creates > -ContractGovernor --> Registrar +ContractGovernor --> Electorate ContractGovernor ==> ParamManager : manages\nparams @enduml diff --git a/packages/governance/docs/coreArchitecture.puml b/packages/governance/docs/coreArchitecture.puml index 7db5e7a4d6cf..2346b92e673d 100644 --- a/packages/governance/docs/coreArchitecture.puml +++ b/packages/governance/docs/coreArchitecture.puml @@ -20,8 +20,8 @@ package Legend <> #EEEEEE { note "Contracts have a 'C' marker.\nInvitations have an 'I'.\nblue arrows show verifiable connections.\ncreator-created links are labelled" as NC } -package "Registrar Vat" <> { - class Registrar { +package "Electorate Vat" <> { + class Electorate { terms: committeeSize, committeeName -- Questions[] @@ -34,16 +34,16 @@ package "Registrar Vat" <> { } note "produces VoterInvitations.\nPolymorphic over VoteCounters.\nquestions are enumerable." as N1 - Registrar .. N1 + Electorate .. N1 interface QuestionPoserInvitation { - Registrar + Electorate -- addQuestion() } interface VoterInvitation { - Registrar + Electorate -- getVoterFacet() } @@ -55,7 +55,7 @@ package "Registrar Vat" <> { note "instances held by\nindividual voters" as NVF VoterFacet . NVF - Registrar --> VoterFacet : creates > + Electorate --> VoterFacet : creates > } object QuestionDetails { @@ -69,7 +69,7 @@ object QuestionDetails { counterInstance } -note "QuestionDetails is a widely accessible record.\nverifiable copies are obtained from a Registrar" as N3 +note "QuestionDetails is a widely accessible record.\nverifiable copies are obtained from an Electorate" as N3 QuestionDetails .. N3 package "VoteCounter Vat" <> { @@ -89,26 +89,26 @@ package "VoteCounter Vat" <> { --- submitVote(VoterHandle, ...positions) } - note top: VoteCap is passed to and\ntightly held by Registrar. + note top: VoteCap is passed to and\ntightly held by Electorate. - note "unaware of voter registration.\n Only Registrar hands out voterFacets" as N2 + note "unaware of voter registration.\n Only Electorate hands out voterFacets" as N2 VoteCounter .. N2 VoteCounter --> VoteCap : creates > } class ElectionManager { - Registrar + Electorate addQuestion() } note top : ElectionManager is responsible\n for letting an appropriate\n party call addQuestion() -ElectionManager -.[#blue]-|> Registrar : verifiable +ElectionManager -.[#blue]-|> Electorate : verifiable -Registrar *. VoterInvitation -Registrar *. QuestionPoserInvitation +Electorate *. VoterInvitation +Electorate *. QuestionPoserInvitation VoterInvitation -> VoterFacet -Registrar -> QuestionDetails : creates > +Electorate -> QuestionDetails : creates > VoteCounter <|-.[#blue]-|> QuestionDetails : verifiable VoterFacet --|> VoteCap : encapsulates diff --git a/packages/governance/docs/example.puml b/packages/governance/docs/example.puml index f7e10d307451..a91fc36a2bf9 100644 --- a/packages/governance/docs/example.puml +++ b/packages/governance/docs/example.puml @@ -24,7 +24,7 @@ package "Example with Vote Invitation" <> { ContractGovernor } - class TreasuryGovernanceRegistrar1 { + class TreasuryGovernanceElectorate1 { Questions: FeesTo2Percent, ... -- distributed voterInvitations to creator. @@ -32,18 +32,18 @@ package "Example with Vote Invitation" <> { } interface memberAVoterInvitation { - TreasuryGovernanceRegistrar1 + TreasuryGovernanceElectorate1 } object memberAVoterFacet { - TreasuryGovernanceRegistrar1 + TreasuryGovernanceElectorate1 -- castBallotFor(questionHandle, [positions]) } } ContractGovernor --> BinaryVoteCounter : responds to\noutcome > -ContractGovernor -.[#blue]-|> TreasuryGovernanceRegistrar1 : verifiable +ContractGovernor -.[#blue]-|> TreasuryGovernanceElectorate1 : verifiable memberAVoterInvitation --> memberAVoterFacet memberAVoterFacet --> FeesTo2Percent diff --git a/packages/governance/src/binaryVoteCounter.js b/packages/governance/src/binaryVoteCounter.js index a72031dd92d2..a24ab07f603e 100644 --- a/packages/governance/src/binaryVoteCounter.js +++ b/packages/governance/src/binaryVoteCounter.js @@ -45,7 +45,7 @@ const validateBinaryQuestionSpec = questionSpec => { X`${questionSpec.method} must be UNRANKED`, ); // We don't check the quorumRule or quorumThreshold here. The quorumThreshold - // is provided by the Registrar that creates this voteCounter, since only it + // is provided by the Electorate that creates this voteCounter, since only it // can translate the quorumRule to a required number of votes. }; @@ -64,7 +64,7 @@ const makeBinaryVoteCounter = (questionSpec, threshold, instance) => { const positions = questionSpec.positions; const outcomePromise = makePromiseKit(); const tallyPromise = makePromiseKit(); - // The Registrar is responsible for creating a unique seat for each voter. + // The Electorate is responsible for creating a unique seat for each voter. // This voteCounter allows voters to re-vote, and replaces their previous // choice with the new selection. diff --git a/packages/governance/src/committeeRegistrar.js b/packages/governance/src/committee.js similarity index 88% rename from packages/governance/src/committeeRegistrar.js rename to packages/governance/src/committee.js index 298e0d04cc5d..295260f5c81a 100644 --- a/packages/governance/src/committeeRegistrar.js +++ b/packages/governance/src/committee.js @@ -13,13 +13,13 @@ import { QuorumRule } from './question.js'; const { ceilDivide } = natSafeMath; /** - * Each CommitteeRegistrar represents a particular set of voters. The number of - * voters is visible in the terms. + * Each Committee (an Electorate) represents a particular set of voters. The + * number of voters is visible in the terms. * - * This contract creates an electorate that is not visible to observers. There - * may be uses for such a structure, but it is not appropriate for elections - * where the set of voters needs to be known, unless the contract is used in a - * way that makes the distribution of voter facets visible. + * This contract creates an electorate whose membership is not visible to + * observers. There may be uses for such a structure, but it is not appropriate + * for elections where the set of voters needs to be known, unless the contract + * is used in a way that makes the distribution of voter facets visible. * * @type {ContractStartFn} */ @@ -67,7 +67,7 @@ const start = zcf => { // https://github.com/Agoric/agoric-sdk/pull/3448/files#r704003612 // This will produce unique descriptions because // makeCommitteeVoterInvitation() is only called within the following loop, - // which is only called once per Registrar. + // which is only called once per Electorate. return zcf.makeInvitation(offerHandler, `Voter${index}`); }; @@ -95,7 +95,7 @@ const start = zcf => { /** @type {QuestionTerms} */ const voteCounterTerms = { questionSpec, - registrar: zcf.getInstance(), + electorate: zcf.getInstance(), quorumThreshold: quorumThreshold(questionSpec.quorumRule), }; @@ -111,7 +111,7 @@ const start = zcf => { return { creatorFacet, publicFacet, instance }; }; - /** @type {RegistrarPublic} */ + /** @type {ElectoratePublic} */ const publicFacet = Far('publicFacet', { getQuestionSubscription: () => subscription, getOpenQuestions, @@ -128,7 +128,7 @@ const start = zcf => { return zcf.makeInvitation(questionPoserHandler, `questionPoser`); }; - /** @type {RegistrarCreatorFacet} */ + /** @type {ElectorateCreatorFacet} */ const creatorFacet = Far('adminFacet', { getPoserInvitation, addQuestion, diff --git a/packages/governance/src/contractGovernor.js b/packages/governance/src/contractGovernor.js index 0a65bed494af..c6d7cd8dce47 100644 --- a/packages/governance/src/contractGovernor.js +++ b/packages/governance/src/contractGovernor.js @@ -8,7 +8,7 @@ import { setupGovernance, validateParamChangeQuestion } from './governParam.js'; const { details: X } = assert; /** @type {ValidateQuestionDetails} */ -const validateQuestionDetails = async (zoe, registrar, details) => { +const validateQuestionDetails = async (zoe, electorate, details) => { const { counterInstance, issue: { contract: governedInstance }, @@ -21,17 +21,17 @@ const validateQuestionDetails = async (zoe, registrar, details) => { return Promise.all([ E(governorPublic).validateVoteCounter(counterInstance), - E(governorPublic).validateRegistrar(registrar), + E(governorPublic).validateElectorate(electorate), E(governorPublic).validateTimer(details), ]); }; /** @type {ValidateQuestionFromCounter} */ -const validateQuestionFromCounter = async (zoe, registrar, voteCounter) => { +const validateQuestionFromCounter = async (zoe, electorate, voteCounter) => { const counterPublicP = E(zoe).getPublicFacet(voteCounter); const questionDetails = await E(counterPublicP).getDetails(); - return validateQuestionDetails(zoe, registrar, questionDetails); + return validateQuestionDetails(zoe, electorate, questionDetails); }; /* @@ -39,14 +39,14 @@ const validateQuestionFromCounter = async (zoe, registrar, voteCounter) => { * own creator a facet that allows them to call for votes on parameters that * were declared by the contract. * - * The terms for this contract include the Timer, Registrar and + * The terms for this contract include the Timer, Electorate and * the Installation to be started, as well as an issuerKeywordRecord or terms * needed by the governed contract. Those details for the governed contract are * included in this contract's terms as a "governed" record. * * terms = { * timer, - * registrarInstance, + * electorateInstance, * governedContractInstallation, * governed: { * issuerKeywordRecord: governedIssuerKeywordRecord, @@ -77,7 +77,7 @@ const start = async (zcf, privateArgs) => { const zoe = zcf.getZoeService(); const { timer, - registrarInstance, + electorateInstance, governedContractInstallation, governed: { issuerKeywordRecord: governedIssuerKeywordRecord, @@ -86,13 +86,13 @@ const start = async (zcf, privateArgs) => { }, } = /** @type {ContractGovernorTerms} */ zcf.getTerms(); - const { registrarCreatorFacet } = privateArgs; + const { electorateCreatorFacet } = privateArgs; const augmentedTerms = harden({ ...governedTerms, electionManager: zcf.getInstance(), }); - const poserInvitation = E(registrarCreatorFacet).getPoserInvitation(); + const poserInvitation = E(electorateCreatorFacet).getPoserInvitation(); const [ { @@ -112,8 +112,8 @@ const start = async (zcf, privateArgs) => { ]); assert( - invitationDetails.instance === registrarInstance, - X`questionPoserInvitation didn't match supplied Registrar`, + invitationDetails.instance === electorateInstance, + X`questionPoserInvitation didn't match supplied Electorate`, ); // CRUCIAL: only governedContract should get the ability to update params @@ -141,11 +141,11 @@ const start = async (zcf, privateArgs) => { return true; }; - const validateRegistrar = async regP => { + const validateElectorate = async regP => { return E.when(regP, reg => { assert( - reg === registrarInstance, - X`Registrar doesn't match my Registrar`, + reg === electorateInstance, + X`Electorate doesn't match my Electorate`, ); return true; }); @@ -161,10 +161,10 @@ const start = async (zcf, privateArgs) => { /** @type {GovernorPublic} */ const publicFacet = Far('contract governor public', { - getRegistrar: () => registrarInstance, + getElectorate: () => electorateInstance, getGovernedContract: () => governedInstance, validateVoteCounter, - validateRegistrar, + validateElectorate, validateTimer, }); diff --git a/packages/governance/src/index.js b/packages/governance/src/index.js index ab357ba31390..b418b12b438a 100644 --- a/packages/governance/src/index.js +++ b/packages/governance/src/index.js @@ -27,5 +27,5 @@ export { ParamType, assertType } from './paramManager.js'; export { assertContractGovernance, - assertContractRegistrar, + assertContractElectorate, } from './validators.js'; diff --git a/packages/governance/src/question.js b/packages/governance/src/question.js index b5d21d23e185..119a54998daf 100644 --- a/packages/governance/src/question.js +++ b/packages/governance/src/question.js @@ -10,10 +10,10 @@ import { assertType, ParamType } from './paramManager.js'; const { details: X, quote: q } = assert; // Topics being voted on are 'Questions'. Before a Question is known to a -// registrar, the parameters can be described with a QuestionSpec. Once the -// question has been presented to a Registrar, there is a QuestionDetails record -// that also includes the VoteCounter which will determine the outcome and the -// questionHandle that uniquely identifies it. +// electorate, the parameters can be described with a QuestionSpec. Once the +// question has been presented to an Electorate, there is a QuestionDetails +// record that also includes the VoteCounter which will determine the outcome +// and the questionHandle that uniquely identifies it. /** * "unranked" is more formally known as "approval" voting, but this is hard for diff --git a/packages/governance/src/registrarTools.js b/packages/governance/src/registrarTools.js index c5cc40b0e206..41847bc266d3 100644 --- a/packages/governance/src/registrarTools.js +++ b/packages/governance/src/registrarTools.js @@ -14,7 +14,7 @@ const startCounter = async ( ) => { const ballotCounterTerms = { questionSpec, - registrar: zcf.getInstance(), + electorate: zcf.getInstance(), quorumThreshold, }; diff --git a/packages/governance/src/types.js b/packages/governance/src/types.js index 60d6965a384e..bfbd84ab5954 100644 --- a/packages/governance/src/types.js +++ b/packages/governance/src/types.js @@ -60,12 +60,12 @@ */ /** - * @typedef {Object} QuestionTerms - QuestionSpec plus the Registrar Instance and + * @typedef {Object} QuestionTerms - QuestionSpec plus the Electorate Instance and * a numerical threshold for the quorum. (The voteCounter doesn't know the - * size of the electorate, so the Registrar has to say what limit to enforce.) + * size of the electorate, so the Electorate has to say what limit to enforce.) * @property {QuestionSpec} questionSpec * @property {number} quorumThreshold - * @property {Instance} registrar + * @property {Instance} electorate */ /** @@ -162,12 +162,12 @@ */ /** - * @typedef {Object} VoteCounterCreatorFacet - a facet that the Registrar should + * @typedef {Object} VoteCounterCreatorFacet - a facet that the Electorate should * hold tightly. submitVote() is the core capability that allows the holder to * specify the identity and choice of a voter. The voteCounter is making that - * available to the Registrar, which should wrap and attenuate it so each + * available to the Electorate, which should wrap and attenuate it so each * voter gets only the ability to cast their own vote at a weight specified by - * the registrar. + * the electorate. * @property {SubmitVote} submitVote */ @@ -196,7 +196,7 @@ /** * @callback BuildVoteCounter * @param {QuestionSpec} questionSpec - * @param {bigint} threshold - questionSpec includes quorumRule; the registrar + * @param {bigint} threshold - questionSpec includes quorumRule; the electorate * converts that to a number that the counter can enforce. * @param {Instance} instance * @returns {VoteCounterFacets} @@ -241,7 +241,7 @@ */ /** - * @typedef {Object} RegistrarPublic + * @typedef {Object} ElectoratePublic * @property {() => Subscription} getQuestionSubscription * @property {() => Promise[]>} getOpenQuestions, * @property {() => string} getName @@ -255,15 +255,15 @@ */ /** - * @typedef {Object} RegistrarCreatorFacet + * @typedef {Object} ElectorateCreatorFacet * addQuestion() can be used directly when the creator doesn't need any - * reassurance. When someone needs to connect addQuestion to the Registrar + * reassurance. When someone needs to connect addQuestion to the Electorate * instance, getPoserInvitation() lets them get addQuestion with assurance. * @property {() => Promise} getPoserInvitation * @property {AddQuestion} addQuestion * @property {() => Promise[]} getVoterInvitations * @property {() => Subscription} getQuestionSubscription - * @property {() => RegistrarPublic} getPublicFacet + * @property {() => ElectoratePublic} getPublicFacet */ /** @@ -409,10 +409,10 @@ /** * @typedef {Object} GovernorPublic - * @property {() => Instance} getRegistrar + * @property {() => Instance} getElectorate * @property {() => Instance} getGovernedContract * @property {(voteCounter: Instance) => Promise} validateVoteCounter - * @property {(regP: ERef) => Promise} validateRegistrar + * @property {(regP: ERef) => Promise} validateElectorate * @property {(details: QuestionDetails) => boolean} validateTimer */ @@ -525,7 +525,7 @@ /** * @typedef {Object} ContractGovernorTerms * @property {VoteOnParamChange} timer - * @property {Instance} registrarInstance + * @property {Instance} electorateInstance * @property {Installation} governedContractInstallation * @property {GovernedContractTerms} governed */ @@ -541,23 +541,23 @@ */ /** - * @callback AssertContractRegistrar - assert that the contract uses the - * registrar + * @callback AssertContractElectorate - assert that the contract uses the + * electorate * * @param {ERef} zoe * @param {Instance} allegedGovernor - * @param {Instance} allegedRegistrar + * @param {Instance} allegedElectorate */ /** * @callback ValidateQuestionDetails * * Validate that the question details correspond to a parameter change question - * that the registrar hosts, and that the voteCounter and other details are + * that the electorate hosts, and that the voteCounter and other details are * consistent with it. * * @param {ERef} zoe - * @param {Instance} registrar + * @param {Instance} electorate * @param {ParamChangeIssueDetails} details * @returns {Promise<*>} */ @@ -566,11 +566,11 @@ * @callback ValidateQuestionFromCounter * * Validate that the questions counted by the voteCounter correspond to a - * parameter change question that the registrar hosts, and that the + * parameter change question that the electorate hosts, and that the * voteCounter and other details are consistent. * * @param {ERef} zoe - * @param {Instance} registrar + * @param {Instance} electorate * @param {Instance} voteCounter * @returns {Promise<*>} */ diff --git a/packages/governance/src/validators.js b/packages/governance/src/validators.js index 54a4a981e2a2..17a6f8fee775 100644 --- a/packages/governance/src/validators.js +++ b/packages/governance/src/validators.js @@ -50,26 +50,26 @@ const assertContractGovernance = async ( }; /** - * Assert that the governor refers to the indicated registrar. + * Assert that the governor refers to the indicated electorate. * - * @type {AssertContractRegistrar} + * @type {AssertContractElectorate} */ -const assertContractRegistrar = async ( +const assertContractElectorate = async ( zoe, allegedGovernor, - allegedRegistrar, + allegedElectorate, ) => { const allegedGovernorPF = E(zoe).getPublicFacet(allegedGovernor); - const registrar = await E(allegedGovernorPF).getRegistrar(); + const electorate = await E(allegedGovernorPF).getElectorate(); assert( - registrar === allegedRegistrar, - X`The allegedRegistrar didn't match the actual ${q(registrar)}`, + electorate === allegedElectorate, + X`The allegedElectorate didn't match the actual ${q(electorate)}`, ); return true; }; harden(assertContractGovernance); -harden(assertContractRegistrar); -export { assertContractGovernance, assertContractRegistrar }; +harden(assertContractElectorate); +export { assertContractGovernance, assertContractElectorate }; diff --git a/packages/governance/test/swingsetTests/committeeBinary/bootstrap.js b/packages/governance/test/swingsetTests/committeeBinary/bootstrap.js index 2932f19de052..306b189c5ebc 100644 --- a/packages/governance/test/swingsetTests/committeeBinary/bootstrap.js +++ b/packages/governance/test/swingsetTests/committeeBinary/bootstrap.js @@ -20,7 +20,7 @@ const makeVoterVat = async (log, vats, zoe) => { }; const createQuestion = async (qDetails, closingTime, tools, quorumRule) => { - const { registrarFacet, installations } = tools; + const { electorateFacet, installations } = tools; const { issue, positions, electionType } = qDetails; const closingRule = { timer: tools.timer, @@ -40,7 +40,7 @@ const createQuestion = async (qDetails, closingTime, tools, quorumRule) => { }), ); - const { instance: counterInstance } = await E(registrarFacet).addQuestion( + const { instance: counterInstance } = await E(electorateFacet).addQuestion( installations.binaryVoteCounter, questionSpec, ); @@ -54,10 +54,11 @@ const committeeBinaryStart = async ( log, installations, ) => { - const registrarTerms = { committeeName: 'TheCommittee', committeeSize: 5 }; - const { creatorFacet: registrarFacet, instance: registrarInstance } = await E( - zoe, - ).startInstance(installations.committeeRegistrar, {}, registrarTerms); + const electorateTerms = { committeeName: 'TheCommittee', committeeSize: 5 }; + const { + creatorFacet: electorateFacet, + instance: electorateInstance, + } = await E(zoe).startInstance(installations.committee, {}, electorateTerms); const choose = { text: 'Choose' }; const electionType = ElectionType.SURVEY; @@ -67,7 +68,7 @@ const committeeBinaryStart = async ( electionType, }; const [eeny, meeny] = details.positions; - const tools = { registrarFacet, installations, timer }; + const tools = { electorateFacet, installations, timer }; const { counterInstance } = await createQuestion( details, 3n, @@ -75,11 +76,11 @@ const committeeBinaryStart = async ( QuorumRule.MAJORITY, ); - const invitations = await E(registrarFacet).getVoterInvitations(); + const invitations = await E(electorateFacet).getVoterInvitations(); const details2 = await E(zoe).getInvitationDetails(invitations[2]); log( - `invitation details check: ${details2.instance === registrarInstance} ${ + `invitation details check: ${details2.instance === electorateInstance} ${ details2.description }`, ); @@ -92,7 +93,7 @@ const committeeBinaryStart = async ( const [alice] = await Promise.all([aliceP, bobP, carolP, daveP, emmaP]); // At least one voter should verify that everything is on the up-and-up - const instances = { registrarInstance, counterInstance }; + const instances = { electorateInstance, counterInstance }; await E(alice).verifyBallot(choose, instances); await E(timer).tick(); @@ -115,21 +116,22 @@ const committeeBinaryTwoQuestions = async ( ) => { log('starting TWO questions test'); - const registrarTerms = { committeeName: 'TheCommittee', committeeSize: 5 }; - const { creatorFacet: registrarFacet, instance: registrarInstance } = await E( - zoe, - ).startInstance(installations.committeeRegistrar, {}, registrarTerms); + const electorateTerms = { committeeName: 'TheCommittee', committeeSize: 5 }; + const { + creatorFacet: electorateFacet, + instance: electorateInstance, + } = await E(zoe).startInstance(installations.committee, {}, electorateTerms); - const invitations = await E(registrarFacet).getVoterInvitations(); + const invitations = await E(electorateFacet).getVoterInvitations(); const details2 = await E(zoe).getInvitationDetails(invitations[2]); log( - `invitation details check: ${details2.instance === registrarInstance} ${ + `invitation details check: ${details2.instance === electorateInstance} ${ details2.description }`, ); - const tools = { registrarFacet, installations, timer }; + const tools = { electorateFacet, installations, timer }; const twoPotato = harden({ text: 'Two Potato' }); const onePotato = harden({ text: 'One Potato' }); const choose = { text: 'Choose' }; @@ -185,11 +187,11 @@ const committeeBinaryTwoQuestions = async ( const [alice, bob] = await Promise.all([aliceP, bobP, carolP, daveP, emmaP]); // At least one voter should verify that everything is on the up-and-up await E(alice).verifyBallot(choose, { - registrarInstance, + electorateInstance, counterInstance: potatoCounterInstance, }); await E(bob).verifyBallot(howHigh, { - registrarInstance, + electorateInstance, counterInstance: heightCounterInstance, }); @@ -217,13 +219,13 @@ const makeBootstrap = (argv, cb, vatPowers) => async (vats, devices) => { /** @type { ERef } */ const zoe = E(vats.zoe).buildZoe(vatAdminSvc); - const [committeeRegistrar, binaryVoteCounter] = await Promise.all([ - E(zoe).install(cb.committeeRegistrar), + const [committee, binaryVoteCounter] = await Promise.all([ + E(zoe).install(cb.committee), E(zoe).install(cb.binaryVoteCounter), ]); const timer = buildManualTimer(log); - const installations = { committeeRegistrar, binaryVoteCounter }; + const installations = { committee, binaryVoteCounter }; const voterCreator = await makeVoterVat(log, vats, zoe); diff --git a/packages/governance/test/swingsetTests/committeeBinary/test-committee.js b/packages/governance/test/swingsetTests/committeeBinary/test-committee.js index 9d835fd78313..01f5efb4e865 100644 --- a/packages/governance/test/swingsetTests/committeeBinary/test-committee.js +++ b/packages/governance/test/swingsetTests/committeeBinary/test-committee.js @@ -12,7 +12,7 @@ import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat'; import bundleSource from '@agoric/bundle-source'; import path from 'path'; -const CONTRACT_FILES = ['committeeRegistrar', 'binaryVoteCounter']; +const CONTRACT_FILES = ['committee', 'binaryVoteCounter']; const filename = new URL(import.meta.url).pathname; const dirname = path.dirname(filename); @@ -78,7 +78,7 @@ const expectedCommitteeBinaryStartLog = [ 'Emma voted for {"text":"Meeny"}', 'verify question from instance: {"text":"Choose"}, [{"text":"Eeny"},{"text":"Meeny"}], unranked', 'Verify: q: {"text":"Choose"}, max: 1, committee: TheCommittee', - 'Verify instances: registrar: true, counter: true', + 'Verify instances: electorate: true, counter: true', '@@ tick:1 @@', '@@ tick:2 @@', '@@ tick:3 @@', @@ -109,10 +109,10 @@ const expectedCommitteeBinaryTwoQuestionsLog = [ 'Emma voted on {"text":"How high?"} for {"text":"2 feet"}', 'verify question from instance: {"text":"Choose"}, [{"text":"One Potato"},{"text":"Two Potato"}], unranked', 'Verify: q: {"text":"Choose"}, max: 1, committee: TheCommittee', - 'Verify instances: registrar: true, counter: true', + 'Verify instances: electorate: true, counter: true', 'verify question from instance: {"text":"How high?"}, [{"text":"1 foot"},{"text":"2 feet"}], unranked', 'Verify: q: {"text":"How high?"}, max: 1, committee: TheCommittee', - 'Verify instances: registrar: true, counter: true', + 'Verify instances: electorate: true, counter: true', '@@ tick:1 @@', '@@ tick:2 @@', '@@ tick:3 @@', diff --git a/packages/governance/test/swingsetTests/committeeBinary/vat-voter.js b/packages/governance/test/swingsetTests/committeeBinary/vat-voter.js index dbde243344bf..4f488b81cec1 100644 --- a/packages/governance/test/swingsetTests/committeeBinary/vat-voter.js +++ b/packages/governance/test/swingsetTests/committeeBinary/vat-voter.js @@ -7,10 +7,10 @@ import { sameStructure } from '@agoric/same-structure'; const { quote: q } = assert; -const verify = async (log, issue, registrarPublicFacet, instances) => { - const questionHandles = await E(registrarPublicFacet).getOpenQuestions(); +const verify = async (log, issue, electoratePublicFacet, instances) => { + const questionHandles = await E(electoratePublicFacet).getOpenQuestions(); const detailsP = questionHandles.map(h => { - const question = E(registrarPublicFacet).getQuestion(h); + const question = E(electoratePublicFacet).getQuestion(h); return E(question).getDetails(); }); const detailsPlural = await Promise.all(detailsP); @@ -18,12 +18,12 @@ const verify = async (log, issue, registrarPublicFacet, instances) => { const { positions, method, issue: iss, maxChoices } = details; log(`verify question from instance: ${q(issue)}, ${q(positions)}, ${method}`); - const c = await E(registrarPublicFacet).getName(); + const c = await E(electoratePublicFacet).getName(); log(`Verify: q: ${q(iss)}, max: ${maxChoices}, committee: ${c}`); - const registrarInstance = await E(registrarPublicFacet).getInstance(); + const electorateInstance = await E(electoratePublicFacet).getInstance(); log( - `Verify instances: registrar: ${registrarInstance === - instances.registrarInstance}, counter: ${details.counterInstance === + `Verify instances: electorate: ${electorateInstance === + instances.electorateInstance}, counter: ${details.counterInstance === instances.counterInstance}`, ); }; @@ -31,8 +31,8 @@ const verify = async (log, issue, registrarPublicFacet, instances) => { const build = async (log, zoe) => { return Far('voter', { createVoter: async (name, invitation, choice) => { - const registrarInstance = await E(zoe).getInstance(invitation); - const registrarPublicFacet = E(zoe).getPublicFacet(registrarInstance); + const electorateInstance = await E(zoe).getInstance(invitation); + const electoratePublicFacet = E(zoe).getPublicFacet(electorateInstance); const seat = E(zoe).offer(invitation); const voteFacet = E(seat).getOfferResult(); @@ -42,17 +42,17 @@ const build = async (log, zoe) => { return E(voteFacet).castBallotFor(details.questionHandle, [choice]); }, }); - const subscription = E(registrarPublicFacet).getQuestionSubscription(); + const subscription = E(electoratePublicFacet).getQuestionSubscription(); observeIteration(subscription, votingObserver); return Far(`Voter ${name}`, { verifyBallot: (question, instances) => - verify(log, question, registrarPublicFacet, instances), + verify(log, question, electoratePublicFacet, instances), }); }, createMultiVoter: async (name, invitation, choices) => { - const registrarInstance = await E(zoe).getInstance(invitation); - const registrarPublicFacet = E(zoe).getPublicFacet(registrarInstance); + const electorateInstance = await E(zoe).getInstance(invitation); + const electoratePublicFacet = E(zoe).getPublicFacet(electorateInstance); const seat = E(zoe).offer(invitation); const voteFacet = E(seat).getOfferResult(); @@ -68,12 +68,12 @@ const build = async (log, zoe) => { return E(voteFacet).castBallotFor(details.questionHandle, [choice]); }, }); - const subscription = E(registrarPublicFacet).getQuestionSubscription(); + const subscription = E(electoratePublicFacet).getQuestionSubscription(); observeIteration(subscription, votingObserver); return Far(`Voter ${name}`, { verifyBallot: (question, instances) => - verify(log, question, registrarPublicFacet, instances), + verify(log, question, electoratePublicFacet, instances), }); }, }); diff --git a/packages/governance/test/swingsetTests/contractGovernor/bootstrap.js b/packages/governance/test/swingsetTests/contractGovernor/bootstrap.js index ad49fdad33d0..d348db8c7e42 100644 --- a/packages/governance/test/swingsetTests/contractGovernor/bootstrap.js +++ b/packages/governance/test/swingsetTests/contractGovernor/bootstrap.js @@ -43,18 +43,18 @@ const contractGovernorStart = async ( const installContracts = async (zoe, cb) => { const [ - committeeRegistrar, + committee, binaryVoteCounter, contractGovernor, governedContract, ] = await Promise.all([ - E(zoe).install(cb.committeeRegistrar), + E(zoe).install(cb.committee), E(zoe).install(cb.binaryVoteCounter), E(zoe).install(cb.contractGovernor), E(zoe).install(cb.governedContract), ]); const installations = { - committeeRegistrar, + committee, binaryVoteCounter, contractGovernor, governedContract, @@ -62,21 +62,20 @@ const installContracts = async (zoe, cb) => { return installations; }; -const startRegistrar = async (zoe, installations) => { - const registrarTerms = { committeeName: 'TwentyCommittee', committeeSize: 5 }; +const startElectorate = async (zoe, installations) => { + const electorateTerms = { + committeeName: 'TwentyCommittee', + committeeSize: 5, + }; const { - creatorFacet: registrarCreatorFacet, - instance: registrarInstance, - } = await E(zoe).startInstance( - installations.committeeRegistrar, - {}, - registrarTerms, - ); - return { registrarCreatorFacet, registrarInstance }; + creatorFacet: electorateCreatorFacet, + instance: electorateInstance, + } = await E(zoe).startInstance(installations.committee, {}, electorateTerms); + return { electorateCreatorFacet, electorateInstance }; }; -const createVoters = async (registrarCreatorFacet, voterCreator) => { - const invitations = await E(registrarCreatorFacet).getVoterInvitations(); +const createVoters = async (electorateCreatorFacet, voterCreator) => { + const invitations = await E(electorateCreatorFacet).getVoterInvitations(); const aliceP = E(voterCreator).createVoter('Alice', invitations[0]); const bobP = E(voterCreator).createVoter('Bob', invitations[1]); @@ -101,7 +100,7 @@ const oneVoterValidate = async ( votersP, detailsP, governedInstanceP, - registrarInstance, + electorateInstance, governorInstanceP, installations, timer, @@ -122,7 +121,7 @@ const oneVoterValidate = async ( E(voters[0]).validate( counterInstance, governedInstance, - registrarInstance, + electorateInstance, governorInstance, installations, timer, @@ -158,23 +157,23 @@ const makeBootstrap = (argv, cb, vatPowers) => async (vats, devices) => { const installations = await installContracts(zoe, cb); const timer = buildManualTimer(log); const voterCreator = E(vats.voter).build(zoe); - const { registrarCreatorFacet, registrarInstance } = await startRegistrar( + const { electorateCreatorFacet, electorateInstance } = await startElectorate( zoe, installations, ); - log(`=> voter and registrar vats are set up`); + log(`=> voter and electorate vats are set up`); const terms = { timer, - registrarInstance, + electorateInstance, governedContractInstallation: installations.governedContract, governed: { issuerKeywordRecord: {}, terms: { main: governedParameterInitialValues }, }, }; - const privateArgs = { registrarCreatorFacet }; + const privateArgs = { electorateCreatorFacet }; const { creatorFacet: governor, instance: governorInstance } = await E( zoe, ).startInstance(installations.contractGovernor, {}, terms, privateArgs); @@ -183,7 +182,7 @@ const makeBootstrap = (argv, cb, vatPowers) => async (vats, devices) => { const [testName] = argv; switch (testName) { case 'contractGovernorStart': { - const votersP = createVoters(registrarCreatorFacet, voterCreator); + const votersP = createVoters(electorateCreatorFacet, voterCreator); const detailsP = contractGovernorStart(zoe, log, installations, governor); await votersVote(detailsP, votersP, [0, 1, 1, 0, 0]); @@ -191,7 +190,7 @@ const makeBootstrap = (argv, cb, vatPowers) => async (vats, devices) => { votersP, detailsP, governedInstance, - registrarInstance, + electorateInstance, governorInstance, installations, timer, diff --git a/packages/governance/test/swingsetTests/contractGovernor/test-governor.js b/packages/governance/test/swingsetTests/contractGovernor/test-governor.js index 1e48a78bb55e..6acc28ab5695 100644 --- a/packages/governance/test/swingsetTests/contractGovernor/test-governor.js +++ b/packages/governance/test/swingsetTests/contractGovernor/test-governor.js @@ -14,7 +14,7 @@ import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat'; import bundleSource from '@agoric/bundle-source'; const CONTRACT_FILES = [ - 'committeeRegistrar', + 'committee', 'contractGovernor', 'binaryVoteCounter', { @@ -83,7 +83,7 @@ const main = async (t, argv) => { }; const expectedcontractGovernorStartLog = [ - '=> voter and registrar vats are set up', + '=> voter and electorate vats are set up', '@@ schedule task for:3, currently: 0 @@', 'Voter Alice voted for {"changeParam":{"key":"main","parameterName":"MalleableNumber"},"proposedValue":"[299792458n]"}', 'Voter Bob voted for {"noChange":{"key":"main","parameterName":"MalleableNumber"}}', diff --git a/packages/governance/test/swingsetTests/contractGovernor/vat-voter.js b/packages/governance/test/swingsetTests/contractGovernor/vat-voter.js index 636cec23f648..04e774f00378 100644 --- a/packages/governance/test/swingsetTests/contractGovernor/vat-voter.js +++ b/packages/governance/test/swingsetTests/contractGovernor/vat-voter.js @@ -4,7 +4,7 @@ import { E } from '@agoric/eventual-send'; import { Far } from '@agoric/marshal'; import { - assertContractRegistrar, + assertContractElectorate, assertContractGovernance, } from '../../../src/validators.js'; import { @@ -29,13 +29,13 @@ const build = async (log, zoe) => { validate: async ( counterInstance, governedInstance, - registrarInstance, + electorateInstance, governorInstance, installations, ) => { const validateQuestionFromCounterP = validateQuestionFromCounter( zoe, - registrarInstance, + electorateInstance, counterInstance, ); @@ -49,7 +49,7 @@ const build = async (log, zoe) => { const [ governedParam, questionDetails, - registrarInstallation, + electorateInstallation, voteCounterInstallation, governedInstallation, governorInstallation, @@ -58,7 +58,7 @@ const build = async (log, zoe) => { ] = await Promise.all([ E.get(E(zoe).getTerms(governedInstance)).main, E(E(zoe).getPublicFacet(counterInstance)).getDetails(), - E(zoe).getInstallationForInstance(registrarInstance), + E(zoe).getInstallationForInstance(electorateInstance), E(zoe).getInstallationForInstance(counterInstance), E(zoe).getInstallationForInstance(governedInstance), E(zoe).getInstallationForInstance(governorInstance), @@ -70,19 +70,19 @@ const build = async (log, zoe) => { assert(installations.binaryVoteCounter === voteCounterInstallation); assert(installations.governedContract === governedInstallation); assert(installations.contractGovernor === governorInstallation); - assert(installations.committeeRegistrar === registrarInstallation); - await assertContractRegistrar( + assert(installations.committee === electorateInstallation); + await assertContractElectorate( zoe, governorInstance, - registrarInstance, + electorateInstance, ); await validateQuestionDetails( zoe, - registrarInstance, + electorateInstance, questionDetails, ); - assert(validatedQuestion, X`governor failed to validate registrar`); + assert(validatedQuestion, X`governor failed to validate electorate`); assert( contractGovernance, X`governor and governed aren't tightly linked`, diff --git a/packages/governance/test/unitTests/test-committee.js b/packages/governance/test/unitTests/test-committee.js index 55ada94eae50..38b3879d4a8c 100644 --- a/packages/governance/test/unitTests/test-committee.js +++ b/packages/governance/test/unitTests/test-committee.js @@ -21,7 +21,7 @@ import { const filename = new URL(import.meta.url).pathname; const dirname = path.dirname(filename); -const registrarRoot = `${dirname}/../../src/committeeRegistrar.js`; +const electorateRoot = `${dirname}/../../src/committee.js`; const counterRoot = `${dirname}/../../src/binaryVoteCounter.js`; const setupContract = async () => { @@ -30,36 +30,36 @@ const setupContract = async () => { const zoe = E(zoeService).bindDefaultFeePurse(feePurse); // pack the contract - const [registrarBundle, counterBundle] = await Promise.all([ - bundleSource(registrarRoot), + const [electorateBundle, counterBundle] = await Promise.all([ + bundleSource(electorateRoot), bundleSource(counterRoot), ]); // install the contract - const [registrarInstallation, counterInstallation] = await Promise.all([ - E(zoe).install(registrarBundle), + const [electorateInstallation, counterInstallation] = await Promise.all([ + E(zoe).install(electorateBundle), E(zoe).install(counterBundle), ]); const terms = { committeeName: 'illuminati', committeeSize: 13 }; - const registrarStartResult = await E(zoe).startInstance( - registrarInstallation, + const electorateStartResult = await E(zoe).startInstance( + electorateInstallation, {}, terms, ); /** @type {ContractFacet} */ - return { registrarStartResult, counterInstallation }; + return { electorateStartResult, counterInstallation }; }; test('committee-open no questions', async t => { const { - registrarStartResult: { publicFacet }, + electorateStartResult: { publicFacet }, } = await setupContract(); t.deepEqual(await publicFacet.getOpenQuestions(), []); }); test('committee-open question:one', async t => { const { - registrarStartResult: { creatorFacet, publicFacet }, + electorateStartResult: { creatorFacet, publicFacet }, counterInstallation, } = await setupContract(); @@ -86,7 +86,7 @@ test('committee-open question:one', async t => { test('committee-open question:mixed', async t => { const { - registrarStartResult: { creatorFacet, publicFacet }, + electorateStartResult: { creatorFacet, publicFacet }, counterInstallation, } = await setupContract(); diff --git a/packages/xsnap/moddable b/packages/xsnap/moddable index 10cc52e130a6..960c30d9e130 160000 --- a/packages/xsnap/moddable +++ b/packages/xsnap/moddable @@ -1 +1 @@ -Subproject commit 10cc52e130a62d59f9c13f5037c07bb32aeb64f2 +Subproject commit 960c30d9e13027d50728cf65991bc996878db73a