-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2091 from privacy-scaling-explorations/refactor/s…
…dk-structure refactor(sdk): change sdk package structure
- Loading branch information
Showing
27 changed files
with
860 additions
and
865 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { getAllOnChainVks, compareVks, extractAllVks } from "./verifyingKeys"; | ||
export type { IGetAllVksArgs, IMaciVerifyingKeys, IExtractAllVksArgs, IMaciVks } from "./types"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import type { Signer } from "ethers"; | ||
import type { EMode } from "maci-contracts"; | ||
import type { IVkContractParams, VerifyingKey } from "maci-domainobjs"; | ||
|
||
/** | ||
* Arguments for the getAllVks function | ||
*/ | ||
export interface IGetAllVksArgs { | ||
/** | ||
* The address of the VkRegistry contract | ||
*/ | ||
vkRegistryAddress: string; | ||
/** | ||
* The signer to use for the contract calls | ||
*/ | ||
signer: Signer; | ||
/** | ||
* The depth of the state tree | ||
*/ | ||
stateTreeDepth: number; | ||
/** | ||
* The depth of the vote option tree | ||
*/ | ||
voteOptionTreeDepth: number; | ||
/** | ||
* The batch size for the process messages | ||
*/ | ||
messageBatchSize: number; | ||
/** | ||
* The depth of the ballot tree | ||
*/ | ||
intStateTreeDepth: number; | ||
/** | ||
* The mode to use for the contract calls | ||
*/ | ||
mode: EMode; | ||
} | ||
|
||
/** | ||
* MACI's verifying keys | ||
*/ | ||
export interface IMaciVerifyingKeys { | ||
/** | ||
* The verifying key for the poll joining circuit | ||
*/ | ||
pollJoiningVkOnChain: IVkContractParams; | ||
/** | ||
* The verifying key for the poll joined circuit | ||
*/ | ||
pollJoinedVkOnChain: IVkContractParams; | ||
/** | ||
* The verifying key for the process messages circuit | ||
*/ | ||
processVkOnChain: IVkContractParams; | ||
/** | ||
* The verifying key for the tally votes circuit | ||
*/ | ||
tallyVkOnChain: IVkContractParams; | ||
} | ||
|
||
/** | ||
* Arguments for the extractAllVks function | ||
*/ | ||
export interface IExtractAllVksArgs { | ||
/** | ||
* The path to the poll joining zkey | ||
*/ | ||
pollJoiningZkeyPath?: string; | ||
/** | ||
* The path to the poll joined zkey | ||
*/ | ||
pollJoinedZkeyPath?: string; | ||
/** | ||
* The path to the process messages zkey | ||
*/ | ||
processMessagesZkeyPath?: string; | ||
/** | ||
* The path to the tally votes zkey | ||
*/ | ||
tallyVotesZkeyPath?: string; | ||
} | ||
|
||
/** | ||
* Maci verifying keys | ||
*/ | ||
export interface IMaciVks { | ||
/** | ||
* The poll joining verifying key | ||
*/ | ||
pollJoiningVk?: VerifyingKey; | ||
/** | ||
* The poll joined verifying key | ||
*/ | ||
pollJoinedVk?: VerifyingKey; | ||
/** | ||
* The message processing verifying key | ||
*/ | ||
processVk?: VerifyingKey; | ||
/** | ||
* The tally verifying key | ||
*/ | ||
tallyVk?: VerifyingKey; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export { getPoll, getPollParams } from "./poll"; | ||
export type { | ||
IGetPollArgs, | ||
IGetPollData, | ||
IGetPollParamsArgs, | ||
IPollParams, | ||
IPollJoiningInputs, | ||
IPollJoinedInputs, | ||
} from "./types"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
import type { BigNumberish, Provider, Signer } from "ethers"; | ||
|
||
/** | ||
* Interface for the arguments to the get poll command | ||
*/ | ||
export interface IGetPollArgs { | ||
/** | ||
* A signer object | ||
*/ | ||
signer?: Signer; | ||
|
||
/** | ||
* A provider fallback object | ||
*/ | ||
provider?: Provider; | ||
|
||
/** | ||
* The address of the MACI contract | ||
*/ | ||
maciAddress: string; | ||
|
||
/** | ||
* The poll id. If not specified, latest poll id will be used | ||
*/ | ||
pollId?: BigNumberish; | ||
} | ||
|
||
/** | ||
* Interface for the return data to the get poll command | ||
*/ | ||
export interface IGetPollData { | ||
/** | ||
* The poll id | ||
*/ | ||
id: BigNumberish; | ||
|
||
/** | ||
* The poll address | ||
*/ | ||
address: string; | ||
|
||
/** | ||
* The poll deployment time | ||
*/ | ||
deployTime: BigNumberish; | ||
|
||
/** | ||
* The poll duration | ||
*/ | ||
duration: BigNumberish; | ||
|
||
/** | ||
* The poll number of signups | ||
*/ | ||
numSignups: BigNumberish; | ||
|
||
/** | ||
* Whether the MACI contract's state root has been merged | ||
*/ | ||
isMerged: boolean; | ||
|
||
/** | ||
* Mode of the poll | ||
*/ | ||
mode: BigNumberish; | ||
} | ||
|
||
/** | ||
* Arguments for the get poll params command | ||
*/ | ||
export interface IGetPollParamsArgs { | ||
/** | ||
* The poll id | ||
*/ | ||
pollId: bigint; | ||
/** | ||
* The signer | ||
*/ | ||
signer: Signer; | ||
/** | ||
* The MACI contract address | ||
*/ | ||
maciContractAddress: string; | ||
} | ||
|
||
/** | ||
* Poll parameters | ||
*/ | ||
export interface IPollParams { | ||
/** | ||
* The message batch size | ||
*/ | ||
messageBatchSize: number; | ||
/** | ||
* The number of vote options | ||
*/ | ||
numVoteOptions: number; | ||
|
||
/** | ||
* Tally Batch Size | ||
*/ | ||
tallyBatchSize: number; | ||
|
||
/** | ||
* The vote option tree depth | ||
*/ | ||
voteOptionTreeDepth: number; | ||
|
||
/** | ||
* The depth of the tree holding the user ballots | ||
*/ | ||
intStateTreeDepth: number; | ||
} | ||
|
||
/** | ||
* Inputs for circuit PollJoining | ||
*/ | ||
export interface IPollJoiningInputs { | ||
privKey: bigint; | ||
pollPubKey: bigint[][]; | ||
stateLeaf: bigint[]; | ||
siblings: bigint[][]; | ||
indices: bigint[]; | ||
nullifier: bigint; | ||
credits: bigint; | ||
stateRoot: bigint; | ||
actualStateTreeDepth: bigint; | ||
pollId: bigint; | ||
} | ||
|
||
/** | ||
* Inputs for circuit PollJoined | ||
*/ | ||
export interface IPollJoinedInputs { | ||
privKey: bigint; | ||
voiceCreditsBalance: bigint; | ||
joinTimestamp: bigint; | ||
stateLeaf: bigint[]; | ||
pathElements: bigint[][]; | ||
pathIndices: bigint[]; | ||
credits: bigint; | ||
stateRoot: bigint; | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/sdk/ts/tallyCommitments.ts → packages/sdk/ts/tally/commitments.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export { generateTallyCommitments } from "./commitments"; | ||
export { verify } from "./verification"; | ||
export type { | ||
ITallyData, | ||
IVerifyArgs, | ||
IGenerateTallyCommitmentsArgs, | ||
ITallyCommitments, | ||
ITallyVotesInputs, | ||
} from "./types"; |
Oops, something went wrong.