@maci-protocol/core 0.0.0-ci.ec84efe → 0.0.0-ci.eea13a2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,7 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Barry WhiteHat, Kendrick Tan, Kobi Gurkan, Kirill Goncharov
4
- Cory Dickson, Han Jian, Chih-Cheng Liang, and Koh Wei Jie
3
+ Copyright (c) 2025 Ethereum Foundation
5
4
 
6
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -15,7 +15,7 @@ contracts in discrete components which are easy to test.
15
15
 
16
16
  To this end, this submodule exposes a `MaciState` class and a `Poll` class.
17
17
  Developers should instantiate objects from these classes to test MACI. For
18
- instance, [`MACI.test.ts`](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/tests/MACI.test.ts) creates a
18
+ instance, [`MACI.test.ts`](https://github.com/privacy-scaling-explorations/maci/blob/main/packages/contracts/tests/MACI.test.ts) creates a
19
19
  `MaciState` object and every time it interacts with the MACI smart contract, it
20
20
  mirrors said interaction on the `MaciState` and `Poll`. As such, the developer
21
21
  can then use their helper functions like `maciState.signUp()`,
@@ -34,8 +34,8 @@ In testing, whenever a test suite submits a `signUp()` transaction, it should
34
34
  call `maciState.signUp()` as well, so that the off-chain representation of MACI
35
35
  is kept up to date.
36
36
 
37
- In production, `genMaciStateFromContract()` in
38
- [`genMaciState.ts`](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/ts/genMaciState.ts) uses this function when it
37
+ In production, `generateMaciStateFromContract()` in
38
+ [`generateMaciState.ts`](https://github.com/privacy-scaling-explorations/maci/blob/main/packages/contracts/ts/generateMaciState.ts) uses this function when it
39
39
  scans a MACI contract's event log for signups, so as to bring its `MaciState`
40
40
  instance up to date.
41
41
 
@@ -1,16 +1,17 @@
1
1
  import { IncrementalQuinTree } from "@maci-protocol/crypto";
2
- import { PubKey, type Keypair } from "@maci-protocol/domainobjs";
3
- import type { IJsonMaciState, IMaciState, TreeDepths } from "./utils/types";
2
+ import { PublicKey, type Keypair } from "@maci-protocol/domainobjs";
3
+ import type { IJsonMaciState, IMaciState, ITreeDepths } from "./utils/types";
4
4
  import { Poll } from "./Poll";
5
+ import { EMode } from "./utils/constants";
5
6
  /**
6
7
  * A representation of the MACI contract.
7
8
  */
8
9
  export declare class MaciState implements IMaciState {
9
10
  polls: Map<bigint, Poll>;
10
- pubKeys: PubKey[];
11
+ publicKeys: PublicKey[];
11
12
  stateTreeDepth: number;
12
13
  stateTree?: IncrementalQuinTree;
13
- numSignUps: number;
14
+ totalSignups: number;
14
15
  pollBeingProcessed?: boolean;
15
16
  currentPollBeingProcessed?: bigint;
16
17
  /**
@@ -20,10 +21,10 @@ export declare class MaciState implements IMaciState {
20
21
  constructor(stateTreeDepth: number);
21
22
  /**
22
23
  * Sign up a user with the given public key.
23
- * @param pubKey - The public key of the user.
24
+ * @param publicKey - The public key of the user.
24
25
  * @returns The index of the newly signed-up user in the state tree.
25
26
  */
26
- signUp(pubKey: PubKey): number;
27
+ signUp(publicKey: PublicKey): number;
27
28
  /**
28
29
  * Deploy a new poll with the given parameters.
29
30
  * @param pollEndTimestamp - The Unix timestamp at which the poll ends.
@@ -31,9 +32,10 @@ export declare class MaciState implements IMaciState {
31
32
  * @param messageBatchSize - The batch size for processing messages.
32
33
  * @param coordinatorKeypair - The keypair of the MACI round coordinator.
33
34
  * @param voteOptions - The number of vote options for this poll.
35
+ * @param mode - The voting mode
34
36
  * @returns The index of the newly deployed poll.
35
37
  */
36
- deployPoll(pollEndTimestamp: bigint, treeDepths: TreeDepths, messageBatchSize: number, coordinatorKeypair: Keypair, voteOptions: bigint): bigint;
38
+ deployPoll(pollEndTimestamp: bigint, treeDepths: ITreeDepths, messageBatchSize: number, coordinatorKeypair: Keypair, voteOptions: bigint, mode: EMode): bigint;
37
39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AAE,cAAc,GAAG,SAAS;CAgBjD"}
@@ -16,15 +16,15 @@ class MaciState {
16
16
  // a MaciState can hold multiple polls
17
17
  this.polls = new Map();
18
18
  // the public keys of the users
19
- this.pubKeys = [];
20
- this.numSignUps = 0;
19
+ this.publicKeys = [];
20
+ this.totalSignups = 0;
21
21
  /**
22
22
  * Create a deep copy of the MaciState object.
23
23
  * @returns A new instance of the MaciState object with the same properties.
24
24
  */
25
25
  this.copy = () => {
26
26
  const copied = new MaciState(this.stateTreeDepth);
27
- copied.pubKeys = this.pubKeys.map((x) => x.copy());
27
+ copied.publicKeys = this.publicKeys.map((x) => x.copy());
28
28
  copied.polls = new Map(Array.from(this.polls, ([key, value]) => [key, value.copy()]));
29
29
  return copied;
30
30
  };
@@ -36,7 +36,7 @@ class MaciState {
36
36
  this.equals = (m) => {
37
37
  const result = this.stateTreeDepth === m.stateTreeDepth &&
38
38
  this.polls.size === m.polls.size &&
39
- this.pubKeys.length === m.pubKeys.length;
39
+ this.publicKeys.length === m.publicKeys.length;
40
40
  if (!result) {
41
41
  return false;
42
42
  }
@@ -45,8 +45,8 @@ class MaciState {
45
45
  return false;
46
46
  }
47
47
  }
48
- for (let i = 0; i < this.pubKeys.length; i += 1) {
49
- if (!this.pubKeys[i].equals(m.pubKeys[i])) {
48
+ for (let i = 0; i < this.publicKeys.length; i += 1) {
49
+ if (!this.publicKeys[i].equals(m.publicKeys[i])) {
50
50
  return false;
51
51
  }
52
52
  }
@@ -54,20 +54,20 @@ class MaciState {
54
54
  };
55
55
  this.stateTreeDepth = stateTreeDepth;
56
56
  // we put a blank state leaf to prevent a DoS attack
57
- this.pubKeys.push(domainobjs_1.padKey);
57
+ this.publicKeys.push(domainobjs_1.padKey);
58
58
  // we need to increase the number of signups by one given
59
59
  // that we already added the blank leaf
60
- this.numSignUps += 1;
60
+ this.totalSignups += 1;
61
61
  }
62
62
  /**
63
63
  * Sign up a user with the given public key.
64
- * @param pubKey - The public key of the user.
64
+ * @param publicKey - The public key of the user.
65
65
  * @returns The index of the newly signed-up user in the state tree.
66
66
  */
67
- signUp(pubKey) {
68
- this.numSignUps += 1;
69
- this.stateTree?.insert(pubKey.hash());
70
- return this.pubKeys.push(pubKey.copy()) - 1;
67
+ signUp(publicKey) {
68
+ this.totalSignups += 1;
69
+ this.stateTree?.insert(publicKey.hash());
70
+ return this.publicKeys.push(publicKey.copy()) - 1;
71
71
  }
72
72
  /**
73
73
  * Deploy a new poll with the given parameters.
@@ -76,13 +76,14 @@ class MaciState {
76
76
  * @param messageBatchSize - The batch size for processing messages.
77
77
  * @param coordinatorKeypair - The keypair of the MACI round coordinator.
78
78
  * @param voteOptions - The number of vote options for this poll.
79
+ * @param mode - The voting mode
79
80
  * @returns The index of the newly deployed poll.
80
81
  */
81
- deployPoll(pollEndTimestamp, treeDepths, messageBatchSize, coordinatorKeypair, voteOptions) {
82
+ deployPoll(pollEndTimestamp, treeDepths, messageBatchSize, coordinatorKeypair, voteOptions, mode) {
82
83
  const poll = new Poll_1.Poll(pollEndTimestamp, coordinatorKeypair, treeDepths, {
83
84
  messageBatchSize,
84
- tallyBatchSize: constants_1.STATE_TREE_ARITY ** treeDepths.intStateTreeDepth,
85
- }, this, voteOptions);
85
+ tallyBatchSize: constants_1.STATE_TREE_ARITY ** treeDepths.tallyProcessingStateTreeDepth,
86
+ }, this, voteOptions, mode);
86
87
  this.polls.set(BigInt(this.polls.size), poll);
87
88
  return BigInt(this.polls.size - 1);
88
89
  }
@@ -100,10 +101,10 @@ class MaciState {
100
101
  return {
101
102
  stateTreeDepth: this.stateTreeDepth,
102
103
  polls: Array.from(this.polls.values()).map((poll) => poll.toJSON()),
103
- pubKeys: this.pubKeys.map((pubKey) => pubKey.toJSON()),
104
+ publicKeys: this.publicKeys.map((publicKey) => publicKey.toJSON()),
104
105
  pollBeingProcessed: Boolean(this.pollBeingProcessed),
105
106
  currentPollBeingProcessed: this.currentPollBeingProcessed ? this.currentPollBeingProcessed.toString() : "",
106
- numSignUps: this.numSignUps,
107
+ totalSignups: this.totalSignups,
107
108
  };
108
109
  }
109
110
  /**
@@ -114,10 +115,10 @@ class MaciState {
114
115
  static fromJSON(json) {
115
116
  const maciState = new MaciState(json.stateTreeDepth);
116
117
  // assign the json values to the new instance
117
- maciState.pubKeys = json.pubKeys.map((pubKey) => domainobjs_1.PubKey.fromJSON(pubKey));
118
+ maciState.publicKeys = json.publicKeys.map((publicKey) => domainobjs_1.PublicKey.fromJSON(publicKey));
118
119
  maciState.pollBeingProcessed = json.pollBeingProcessed;
119
120
  maciState.currentPollBeingProcessed = BigInt(json.currentPollBeingProcessed);
120
- maciState.numSignUps = json.numSignUps;
121
+ maciState.totalSignups = json.totalSignups;
121
122
  // re-generate the polls and set the maci state reference
122
123
  maciState.polls = new Map(json.polls.map((jsonPoll, index) => [BigInt(index), Poll_1.Poll.fromJSON(jsonPoll, maciState)]));
123
124
  return maciState;
@@ -1 +1 @@
1
- {"version":3,"file":"MaciState.js","sourceRoot":"","sources":["../../ts/MaciState.ts"],"names":[],"mappings":";;;AACA,0DAAyE;AAIzE,iCAA8B;AAC9B,iDAAqD;AAErD;;GAEG;AACH,MAAa,SAAS;IAoBpB;;;OAGG;IACH,YAAY,cAAsB;QAvBlC,sCAAsC;QACtC,UAAK,GAAsB,IAAI,GAAG,EAAgB,CAAC;QAEnD,+BAA+B;QAC/B,YAAO,GAAa,EAAE,CAAC;QAQvB,eAAU,GAAG,CAAC,CAAC;QAwEf;;;WAGG;QACH,SAAI,GAAG,GAAc,EAAE;YACrB,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAElD,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YAE3D,MAAM,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,E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,IAAI,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAErD,6CAA6C;QAC7C,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,sBAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;QACzF,SAAS,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC;QACvD,SAAS,CAAC,yBAAyB,GAAG,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QAC7E,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QAE3C,yDAAyD;QACzD,SAAS,CAAC,KAAK,GAAG,IAAI,GAAG,CACvB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAmB,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,WAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CACpG,CAAC;QAEF,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAvKD,8BAuKC"}
@@ -1,49 +1,53 @@
1
1
  import { IncrementalQuinTree } from "@maci-protocol/crypto";
2
- import { PCommand, Keypair, Ballot, PubKey, Message, StateLeaf } from "@maci-protocol/domainobjs";
2
+ import { VoteCommand, Keypair, Ballot, PublicKey, Message, StateLeaf, VoteCounts } from "@maci-protocol/domainobjs";
3
3
  import { LeanIMT } from "@zk-kit/lean-imt";
4
- import type { TreeDepths, BatchSizes, IPoll, IJsonPoll, IProcessMessagesOutput, ITallyCircuitInputs, IProcessMessagesCircuitInputs, IPollJoiningCircuitInputs, IJoiningCircuitArgs } from "./index";
5
4
  import type { MaciState } from "./MaciState";
6
- import type { IJoinedCircuitArgs, IPollJoinedCircuitInputs } from "./utils/types";
5
+ import type { ITreeDepths, IBatchSizes, IPoll, IJsonPoll, IProcessMessagesOutput, IVoteTallyCircuitInputs, IProcessMessagesCircuitInputs, IPollJoiningCircuitInputs, IJoiningCircuitArgs, IGetVoiceCreditsLeft, IJoinedCircuitArgs, IPollJoinedCircuitInputs } from "./utils/types";
6
+ import { EMode } from "./utils/constants";
7
7
  /**
8
8
  * A representation of the Poll contract.
9
9
  */
10
10
  export declare class Poll implements IPoll {
11
11
  coordinatorKeypair: Keypair;
12
- treeDepths: TreeDepths;
13
- batchSizes: BatchSizes;
12
+ treeDepths: ITreeDepths;
13
+ batchSizes: IBatchSizes;
14
14
  voteOptions: bigint;
15
15
  maxVoteOptions: number;
16
- stateTreeDepth: number;
17
16
  actualStateTreeDepth: number;
18
17
  pollEndTimestamp: bigint;
19
18
  ballots: Ballot[];
20
19
  ballotTree?: IncrementalQuinTree;
20
+ voteCounts: VoteCounts[];
21
+ voteCountsTree?: IncrementalQuinTree;
21
22
  messages: Message[];
22
- commands: PCommand[];
23
- encPubKeys: PubKey[];
23
+ commands: VoteCommand[];
24
+ encryptionPublicKeys: PublicKey[];
24
25
  stateCopied: boolean;
25
- pubKeys: PubKey[];
26
+ publicKeys: PublicKey[];
26
27
  stateTree?: LeanIMT;
27
- numBatchesProcessed: number;
28
+ totalBatchesProcessed: number;
28
29
  currentMessageBatchIndex: number;
29
30
  maciStateRef: MaciState;
30
31
  pollId: bigint;
31
32
  sbSalts: Record<number | string, bigint>;
32
33
  resultRootSalts: Record<number | string, bigint>;
33
- preVOSpentVoiceCreditsRootSalts: Record<number | string, bigint>;
34
+ perVoteOptionSpentVoiceCreditsRootSalts: Record<number | string, bigint>;
34
35
  spentVoiceCreditSubtotalSalts: Record<number | string, bigint>;
35
36
  tallyResult: bigint[];
36
- perVOSpentVoiceCredits: bigint[];
37
+ perVoteOptionSpentVoiceCredits: bigint[];
37
38
  numBatchesTallied: number;
38
39
  totalSpentVoiceCredits: bigint;
39
40
  emptyBallot: Ballot;
40
- emptyBallotHash?: bigint;
41
+ emptyBallotHash: bigint;
42
+ emptyVoteCounts: VoteCounts;
43
+ emptyVoteCountsHash: bigint;
41
44
  chainHash: bigint;
42
45
  batchHashes: bigint[];
43
46
  pollStateLeaves: StateLeaf[];
44
47
  pollStateTree?: IncrementalQuinTree;
45
48
  pollNullifiers: Map<bigint, boolean>;
46
- private numSignups;
49
+ private mode;
50
+ private totalSignups;
47
51
  /**
48
52
  * Constructs a new Poll object.
49
53
  * @param pollEndTimestamp - The Unix timestamp at which the poll ends.
@@ -53,7 +57,7 @@ export declare class Poll implements IPoll {
53
57
  * @param maciStateRef - The reference to the MACI state.
54
58
  * @param pollId - The poll id
55
59
  */
56
- constructor(pollEndTimestamp: bigint, coordinatorKeypair: Keypair, treeDepths: TreeDepths, batchSizes: BatchSizes, maciStateRef: MaciState, voteOptions: bigint);
60
+ constructor(pollEndTimestamp: bigint, coordinatorKeypair: Keypair, treeDepths: ITreeDepths, batchSizes: IBatchSizes, maciStateRef: MaciState, voteOptions: bigint, mode: EMode);
57
61
  /**
58
62
  * Check if user has already joined the poll by checking if the nullifier is registered
59
63
  */
@@ -61,38 +65,44 @@ export declare class Poll implements IPoll {
61
65
  /**
62
66
  * Join the anonymous user to the Poll (to the tree)
63
67
  * @param nullifier - Hashed private key used as nullifier
64
- * @param pubKey - The poll public key.
68
+ * @param publicKey - The poll public key.
65
69
  * @param newVoiceCreditBalance - New voice credit balance of the user.
66
- * @param timestamp - The timestamp of the sign-up.
67
70
  * @returns The index of added state leaf
68
71
  */
69
- joinPoll: (nullifier: bigint, pubKey: PubKey, newVoiceCreditBalance: bigint, timestamp: bigint) => number;
72
+ joinPoll: (nullifier: bigint, publicKey: PublicKey, newVoiceCreditBalance: bigint) => number;
70
73
  /**
71
74
  * Update a Poll with data from MaciState.
72
75
  * This is the step where we copy the state from the MaciState instance,
73
76
  * and set the number of signups we have so far.
74
- * @note It should be called to generate the state for poll joining with numSignups set as
75
- * the number of signups in the MaciState. For message processing, you should set numSignups as
77
+ * @note It should be called to generate the state for poll joining with totalSignups set as
78
+ * the number of signups in the MaciState. For message processing, you should set totalSignups as
76
79
  * the number of users who joined the poll.
77
80
  */
78
- updatePoll: (numSignups: bigint) => void;
81
+ updatePoll: (totalSignups: bigint) => void;
79
82
  /**
80
83
  * Process one message.
81
84
  * @param message - The message to process.
82
- * @param encPubKey - The public key associated with the encryption private key.
85
+ * @param encryptionPublicKey - The public key associated with the encryption private key.
83
86
  * @returns A number of variables which will be used in the zk-SNARK circuit.
84
87
  */
85
- processMessage: (message: Message, encPubKey: PubKey, qv?: boolean) => IProcessMessagesOutput;
88
+ processMessage: (message: Message, encryptionPublicKey: PublicKey) => IProcessMessagesOutput;
89
+ /**
90
+ * Get voice credits left for the voting command.
91
+ *
92
+ * @param args - arguments for getting voice credits
93
+ * @returns voice credits left
94
+ */
95
+ getVoiceCreditsLeft({ stateLeaf, originalVoteWeight, newVoteWeight, mode }: IGetVoiceCreditsLeft): bigint;
86
96
  /**
87
97
  * Inserts a Message and the corresponding public key used to generate the
88
98
  * ECDH shared key which was used to encrypt said message.
89
99
  * @param message - The message to insert
90
- * @param encPubKey - The public key used to encrypt the message
100
+ * @param encryptionPublicKey - The public key used to encrypt the message
91
101
  */
92
- publishMessage: (message: Message, encPubKey: PubKey) => void;
102
+ publishMessage: (message: Message, encryptionPublicKey: PublicKey) => void;
93
103
  /**
94
104
  * Updates message chain hash
95
- * @param messageHash hash of message with encPubKey
105
+ * @param messageHash hash of message with encryptionPublicKey
96
106
  */
97
107
  updateChainHash: (messageHash: bigint) => void;
98
108
  /**
@@ -100,13 +110,13 @@ export declare class Poll implements IPoll {
100
110
  * @param args Poll joining circuit inputs
101
111
  * @returns stringified circuit inputs
102
112
  */
103
- joiningCircuitInputs: ({ maciPrivKey, stateLeafIndex, pollPubKey, }: IJoiningCircuitArgs) => IPollJoiningCircuitInputs;
113
+ joiningCircuitInputs: ({ maciPrivateKey, stateLeafIndex, pollPublicKey, }: IJoiningCircuitArgs) => IPollJoiningCircuitInputs;
104
114
  /**
105
115
  * Create circuit input for pollJoined
106
116
  * @param args Poll joined circuit inputs
107
117
  * @returns stringified circuit inputs
108
118
  */
109
- joinedCircuitInputs: ({ maciPrivKey, stateLeafIndex, voiceCreditsBalance, joinTimestamp, }: IJoinedCircuitArgs) => IPollJoinedCircuitInputs;
119
+ joinedCircuitInputs: ({ maciPrivateKey, stateLeafIndex, voiceCreditsBalance, }: IJoinedCircuitArgs) => IPollJoinedCircuitInputs;
110
120
  /**
111
121
  * Pad last unclosed batch
112
122
  */
@@ -131,13 +141,13 @@ export declare class Poll implements IPoll {
131
141
  * @param quiet - Whether to log errors or not
132
142
  * @returns stringified circuit inputs
133
143
  */
134
- processMessages: (pollId: bigint, qv?: boolean, quiet?: boolean) => IProcessMessagesCircuitInputs;
144
+ processMessages: (pollId: bigint, quiet?: boolean) => IProcessMessagesCircuitInputs;
135
145
  /**
136
146
  * Generates partial circuit inputs for processing a batch of messages
137
147
  * @param index - The index of the partial batch.
138
148
  * @returns stringified partial circuit inputs
139
149
  */
140
- private genProcessMessagesCircuitInputsPartial;
150
+ private generateProcessMessagesCircuitInputsPartial;
141
151
  /**
142
152
  * Process all messages. This function does not update the ballots or state
143
153
  * leaves; rather, it copies and then updates them. This makes it possible
@@ -155,30 +165,30 @@ export declare class Poll implements IPoll {
155
165
  hasUntalliedBallots: () => boolean;
156
166
  /**
157
167
  * This method tallies a ballots and updates the tally results.
158
- * @returns the circuit inputs for the TallyVotes circuit.
168
+ *
169
+ * @returns the circuit inputs for the VoteTally circuit.
159
170
  */
160
- tallyVotes: () => ITallyCircuitInputs;
161
- tallyVotesNonQv: () => ITallyCircuitInputs;
171
+ tallyVotes: () => IVoteTallyCircuitInputs;
162
172
  /**
163
173
  * This method generates a commitment to the total spent voice credits.
164
174
  *
165
175
  * This is the hash of the total spent voice credits and a salt, computed as Poseidon([totalCredits, _salt]).
166
176
  * @param salt - The salt used in the hash function.
167
- * @param numBallotsToCount - The number of ballots to count for the calculation.
168
- * @param useQuadraticVoting - Whether to use quadratic voting or not. Default is true.
177
+ * @param ballotsToCount - The number of ballots to count for the calculation.
178
+ * @param mode - Voting mode, default is QV.
169
179
  * @returns Returns the hash of the total spent voice credits and a salt, computed as Poseidon([totalCredits, _salt]).
170
180
  */
171
- private genSpentVoiceCreditSubtotalCommitment;
181
+ private generateSpentVoiceCreditSubtotalCommitment;
172
182
  /**
173
183
  * This method generates a commitment to the spent voice credits per vote option.
174
184
  *
175
185
  * This is the hash of the Merkle root of the spent voice credits per vote option and a salt, computed as Poseidon([root, _salt]).
176
186
  * @param salt - The salt used in the hash function.
177
- * @param numBallotsToCount - The number of ballots to count for the calculation.
178
- * @param useQuadraticVoting - Whether to use quadratic voting or not. Default is true.
187
+ * @param ballotsToCount - The number of ballots to count for the calculation.
188
+ * @param mode - Voting mode, default is QV.
179
189
  * @returns Returns the hash of the Merkle root of the spent voice credits per vote option and a salt, computed as Poseidon([root, _salt]).
180
190
  */
181
- private genPerVOSpentVoiceCreditsCommitment;
191
+ private generatePerVoteOptionSpentVoiceCreditsCommitment;
182
192
  /**
183
193
  * Create a deep copy of the Poll object.
184
194
  * @returns A new instance of the Poll object with the same properties.
@@ -186,10 +196,10 @@ export declare class Poll implements IPoll {
186
196
  copy: () => Poll;
187
197
  /**
188
198
  * Check if the Poll object is equal to another Poll object.
189
- * @param p - The Poll object to compare.
199
+ * @param poll - The Poll object to compare.
190
200
  * @returns True if the two Poll objects are equal, false otherwise.
191
201
  */
192
- equals: (p: Poll) => boolean;
202
+ equals: (poll: Poll) => boolean;
193
203
  /**
194
204
  * Serialize the Poll object to a JSON object
195
205
  * @returns a JSON object
@@ -209,13 +219,13 @@ export declare class Poll implements IPoll {
209
219
  setCoordinatorKeypair: (serializedPrivateKey: string) => void;
210
220
  /**
211
221
  * Set the number of signups to match the ones from the contract
212
- * @param numSignups - the number of signups
222
+ * @param totalSignups - the number of signups
213
223
  */
214
- setNumSignups: (numSignups: bigint) => void;
224
+ setTotalSignups: (totalSignups: bigint) => void;
215
225
  /**
216
226
  * Get the number of signups
217
227
  * @returns The number of signups
218
228
  */
219
- getNumSignups: () => bigint;
229
+ getTotalSignups: () => bigint;
220
230
  }
221
231
  //# sourceMappingURL=Poll.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Poll.d.ts","sourceRoot":"","sources":["../../ts/Poll.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAYpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,QAAQ,EACR,OAAO,EACP,MAAM,EACN,MAAM,EAEN,OAAO,EACP,SAAS,EAMV,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAAuB,MAAM,kBAAkB,CAAC;AAIhE,OAAO,KAAK,EAEV,UAAU,EACV,UAAU,EACV,KAAK,EACL,SAAS,EACT,sBAAsB,EACtB,mBAAmB,EACnB,6BAA6B,EAC7B,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAMlF;;GAEG;AACH,qBAAa,IAAK,YAAW,KAAK;IAGhC,kBAAkB,EAAE,OAAO,CAAC;IAE5B,UAAU,EAAE,UAAU,CAAC;IAEvB,UAAU,EAAE,UAAU,CAAC;IAEvB,WAAW,EAAE,MAAM,CAAC;IAEpB,cAAc,EAAE,MAAM,CAAC;IAGvB,cAAc,EAAE,MAAM,CAAC;IAGvB,oBAAoB,EAAE,MAAM,CAAC;IAE7B,gBAAgB,EAAE,MAAM,CAAC;IAEzB,OAAO,EAAE,MAAM,EAAE,CAAM;IAEvB,UAAU,CAAC,EAAE,mBAAmB,CAAC;IAEjC,QAAQ,EAAE,OAAO,EAAE,CAAM;IAEzB,QAAQ,EAAE,QAAQ,EAAE,CAAM;IAE1B,UAAU,EAAE,MAAM,EAAE,CAAM;IAE1B,WAAW,UAAS;IAEpB,OAAO,EAAE,MAAM,EAAE,CAAY;IAE7B,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