@maci-protocol/core 0.0.0-ci.fd5247e → 0.0.0-ci.fdc9104
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/README.md +3 -3
- package/build/ts/MaciState.d.ts +4 -2
- package/build/ts/MaciState.d.ts.map +1 -1
- package/build/ts/MaciState.js +4 -3
- package/build/ts/MaciState.js.map +1 -1
- package/build/ts/Poll.d.ts +31 -19
- package/build/ts/Poll.d.ts.map +1 -1
- package/build/ts/Poll.js +188 -190
- package/build/ts/Poll.js.map +1 -1
- package/build/ts/index.d.ts +2 -1
- package/build/ts/index.d.ts.map +1 -1
- package/build/ts/index.js +7 -5
- package/build/ts/index.js.map +1 -1
- package/build/ts/utils/constants.d.ts +8 -0
- package/build/ts/utils/constants.d.ts.map +1 -1
- package/build/ts/utils/constants.js +10 -1
- package/build/ts/utils/constants.js.map +1 -1
- package/build/ts/utils/errors.d.ts +2 -1
- package/build/ts/utils/errors.d.ts.map +1 -1
- package/build/ts/utils/errors.js +1 -0
- package/build/ts/utils/errors.js.map +1 -1
- package/build/ts/utils/types.d.ts +37 -9
- package/build/ts/utils/types.d.ts.map +1 -1
- package/build/ts/utils/utils.d.ts +1 -1
- package/build/ts/utils/utils.js +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +10 -8
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/
|
|
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, `
|
|
38
|
-
[`
|
|
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
|
|
package/build/ts/MaciState.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { IncrementalQuinTree } from "@maci-protocol/crypto";
|
|
1
|
+
import { type IncrementalQuinTree } from "@maci-protocol/crypto";
|
|
2
2
|
import { PublicKey, type Keypair } from "@maci-protocol/domainobjs";
|
|
3
3
|
import type { IJsonMaciState, IMaciState, ITreeDepths } from "./utils/types";
|
|
4
4
|
import { Poll } from "./Poll";
|
|
5
|
+
import { type EMode } from "./utils/constants";
|
|
5
6
|
/**
|
|
6
7
|
* A representation of the MACI contract.
|
|
7
8
|
*/
|
|
@@ -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: ITreeDepths, messageBatchSize: number, coordinatorKeypair: Keypair, voteOptions: bigint): bigint;
|
|
38
|
+
deployPoll(pollEndTimestamp: bigint, treeDepths: ITreeDepths, messageBatchSize: number, coordinatorKeypair: Keypair, voteOptions: bigint, mode: EMode): bigint;
|
|
37
39
|
/**
|
|
38
40
|
* Deploy a null poll.
|
|
39
41
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaciState.d.ts","sourceRoot":"","sources":["../../ts/MaciState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"MaciState.d.ts","sourceRoot":"","sources":["../../ts/MaciState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,KAAK,OAAO,EAAU,MAAM,2BAA2B,CAAC;AAE5E,OAAO,KAAK,EAAE,cAAc,EAAa,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAExF,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,KAAK,EAAoB,MAAM,mBAAmB,CAAC;AAEjE;;GAEG;AACH,qBAAa,SAAU,YAAW,UAAU;IAE1C,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAA2B;IAGnD,UAAU,EAAE,SAAS,EAAE,CAAM;IAG7B,cAAc,EAAE,MAAM,CAAC;IAGvB,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAEhC,YAAY,SAAK;IAGjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IAEnC;;;OAGG;gBACS,cAAc,EAAE,MAAM;IAUlC;;;;OAIG;IACH,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM;IAOpC;;;;;;;;;OASG;IACH,UAAU,CACR,gBAAgB,EAAE,MAAM,EACxB,UAAU,EAAE,WAAW,EACvB,gBAAgB,EAAE,MAAM,EACxB,kBAAkB,EAAE,OAAO,EAC3B,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,KAAK,GACV,MAAM;IAkBT;;OAEG;IACH,cAAc,IAAI,IAAI;IAItB;;;OAGG;IACH,IAAI,QAAO,SAAS,CAQlB;IAEF;;;;OAIG;IACH,MAAM,GAAI,GAAG,SAAS,KAAG,OAAO,CAsB9B;IAEF;;;OAGG;IACH,MAAM,IAAI,cAAc;IAWxB;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS;CAgBjD"}
|
package/build/ts/MaciState.js
CHANGED
|
@@ -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.
|
|
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
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaciState.js","sourceRoot":"","sources":["../../ts/MaciState.ts"],"names":[],"mappings":";;;AACA,0DAA4E;AAI5E,iCAA8B;AAC9B,
|
|
1
|
+
{"version":3,"file":"MaciState.js","sourceRoot":"","sources":["../../ts/MaciState.ts"],"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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"}
|
package/build/ts/Poll.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IncrementalQuinTree } from "@maci-protocol/crypto";
|
|
2
|
-
import { VoteCommand, Keypair, Ballot, PublicKey, 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 { ITreeDepths, IBatchSizes, 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
|
*/
|
|
@@ -17,31 +17,36 @@ export declare class Poll implements IPoll {
|
|
|
17
17
|
pollEndTimestamp: bigint;
|
|
18
18
|
ballots: Ballot[];
|
|
19
19
|
ballotTree?: IncrementalQuinTree;
|
|
20
|
+
voteCounts: VoteCounts[];
|
|
21
|
+
voteCountsTree?: IncrementalQuinTree;
|
|
20
22
|
messages: Message[];
|
|
21
23
|
commands: VoteCommand[];
|
|
22
24
|
encryptionPublicKeys: PublicKey[];
|
|
23
25
|
stateCopied: boolean;
|
|
24
26
|
publicKeys: PublicKey[];
|
|
25
27
|
stateTree?: LeanIMT;
|
|
26
|
-
|
|
28
|
+
totalBatchesProcessed: number;
|
|
27
29
|
currentMessageBatchIndex: number;
|
|
28
30
|
maciStateRef: MaciState;
|
|
29
31
|
pollId: bigint;
|
|
30
32
|
sbSalts: Record<number | string, bigint>;
|
|
31
33
|
resultRootSalts: Record<number | string, bigint>;
|
|
32
|
-
|
|
34
|
+
perVoteOptionSpentVoiceCreditsRootSalts: Record<number | string, bigint>;
|
|
33
35
|
spentVoiceCreditSubtotalSalts: Record<number | string, bigint>;
|
|
34
36
|
tallyResult: bigint[];
|
|
35
37
|
perVoteOptionSpentVoiceCredits: bigint[];
|
|
36
38
|
numBatchesTallied: number;
|
|
37
39
|
totalSpentVoiceCredits: bigint;
|
|
38
40
|
emptyBallot: Ballot;
|
|
39
|
-
emptyBallotHash
|
|
41
|
+
emptyBallotHash: bigint;
|
|
42
|
+
emptyVoteCounts: VoteCounts;
|
|
43
|
+
emptyVoteCountsHash: bigint;
|
|
40
44
|
chainHash: bigint;
|
|
41
45
|
batchHashes: bigint[];
|
|
42
46
|
pollStateLeaves: StateLeaf[];
|
|
43
47
|
pollStateTree?: IncrementalQuinTree;
|
|
44
48
|
pollNullifiers: Map<bigint, boolean>;
|
|
49
|
+
private mode;
|
|
45
50
|
private totalSignups;
|
|
46
51
|
/**
|
|
47
52
|
* Constructs a new Poll object.
|
|
@@ -52,7 +57,7 @@ export declare class Poll implements IPoll {
|
|
|
52
57
|
* @param maciStateRef - The reference to the MACI state.
|
|
53
58
|
* @param pollId - The poll id
|
|
54
59
|
*/
|
|
55
|
-
constructor(pollEndTimestamp: bigint, coordinatorKeypair: Keypair, treeDepths: ITreeDepths, batchSizes: IBatchSizes, maciStateRef: MaciState, voteOptions: bigint);
|
|
60
|
+
constructor(pollEndTimestamp: bigint, coordinatorKeypair: Keypair, treeDepths: ITreeDepths, batchSizes: IBatchSizes, maciStateRef: MaciState, voteOptions: bigint, mode: EMode);
|
|
56
61
|
/**
|
|
57
62
|
* Check if user has already joined the poll by checking if the nullifier is registered
|
|
58
63
|
*/
|
|
@@ -80,7 +85,14 @@ export declare class Poll implements IPoll {
|
|
|
80
85
|
* @param encryptionPublicKey - The public key associated with the encryption private key.
|
|
81
86
|
* @returns A number of variables which will be used in the zk-SNARK circuit.
|
|
82
87
|
*/
|
|
83
|
-
processMessage: (message: Message, encryptionPublicKey: PublicKey
|
|
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;
|
|
84
96
|
/**
|
|
85
97
|
* Inserts a Message and the corresponding public key used to generate the
|
|
86
98
|
* ECDH shared key which was used to encrypt said message.
|
|
@@ -129,7 +141,7 @@ export declare class Poll implements IPoll {
|
|
|
129
141
|
* @param quiet - Whether to log errors or not
|
|
130
142
|
* @returns stringified circuit inputs
|
|
131
143
|
*/
|
|
132
|
-
processMessages: (pollId: bigint,
|
|
144
|
+
processMessages: (pollId: bigint, quiet?: boolean) => IProcessMessagesCircuitInputs;
|
|
133
145
|
/**
|
|
134
146
|
* Generates partial circuit inputs for processing a batch of messages
|
|
135
147
|
* @param index - The index of the partial batch.
|
|
@@ -153,30 +165,30 @@ export declare class Poll implements IPoll {
|
|
|
153
165
|
hasUntalliedBallots: () => boolean;
|
|
154
166
|
/**
|
|
155
167
|
* This method tallies a ballots and updates the tally results.
|
|
156
|
-
*
|
|
168
|
+
*
|
|
169
|
+
* @returns the circuit inputs for the VoteTally circuit.
|
|
157
170
|
*/
|
|
158
|
-
tallyVotes: () =>
|
|
159
|
-
tallyVotesNonQv: () => ITallyCircuitInputs;
|
|
171
|
+
tallyVotes: () => IVoteTallyCircuitInputs;
|
|
160
172
|
/**
|
|
161
173
|
* This method generates a commitment to the total spent voice credits.
|
|
162
174
|
*
|
|
163
175
|
* This is the hash of the total spent voice credits and a salt, computed as Poseidon([totalCredits, _salt]).
|
|
164
176
|
* @param salt - The salt used in the hash function.
|
|
165
|
-
* @param
|
|
166
|
-
* @param
|
|
177
|
+
* @param ballotsToCount - The number of ballots to count for the calculation.
|
|
178
|
+
* @param mode - Voting mode, default is QV.
|
|
167
179
|
* @returns Returns the hash of the total spent voice credits and a salt, computed as Poseidon([totalCredits, _salt]).
|
|
168
180
|
*/
|
|
169
|
-
private
|
|
181
|
+
private generateSpentVoiceCreditSubtotalCommitment;
|
|
170
182
|
/**
|
|
171
183
|
* This method generates a commitment to the spent voice credits per vote option.
|
|
172
184
|
*
|
|
173
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]).
|
|
174
186
|
* @param salt - The salt used in the hash function.
|
|
175
|
-
* @param
|
|
176
|
-
* @param
|
|
187
|
+
* @param ballotsToCount - The number of ballots to count for the calculation.
|
|
188
|
+
* @param mode - Voting mode, default is QV.
|
|
177
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]).
|
|
178
190
|
*/
|
|
179
|
-
private
|
|
191
|
+
private generatePerVoteOptionSpentVoiceCreditsCommitment;
|
|
180
192
|
/**
|
|
181
193
|
* Create a deep copy of the Poll object.
|
|
182
194
|
* @returns A new instance of the Poll object with the same properties.
|
|
@@ -214,6 +226,6 @@ export declare class Poll implements IPoll {
|
|
|
214
226
|
* Get the number of signups
|
|
215
227
|
* @returns The number of signups
|
|
216
228
|
*/
|
|
217
|
-
|
|
229
|
+
getTotalSignups: () => bigint;
|
|
218
230
|
}
|
|
219
231
|
//# sourceMappingURL=Poll.d.ts.map
|
package/build/ts/Poll.d.ts.map
CHANGED
|
@@ -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,WAAW,EACX,OAAO,EACP,MAAM,EACN,SAAS,EAET,OAAO,EACP,SAAS,
|
|
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,WAAW,EACX,OAAO,EACP,MAAM,EACN,SAAS,EAET,OAAO,EACP,SAAS,EACT,UAAU,EAKX,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAA4B,MAAM,kBAAkB,CAAC;AAKrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAEV,WAAW,EACX,WAAW,EACX,KAAK,EACL,SAAS,EACT,sBAAsB,EACtB,uBAAuB,EACvB,6BAA6B,EAC7B,yBAAyB,EACzB,mBAAmB,EACnB,oB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