Skip to content

Commit

Permalink
Merge branch 'dev' into chore/ethglobal-singapore-projects
Browse files Browse the repository at this point in the history
  • Loading branch information
jennyg0 authored Oct 29, 2024
2 parents 2c15056 + 8e76436 commit 0370ea4
Show file tree
Hide file tree
Showing 12 changed files with 386 additions and 220 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/typos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Use typos with config file
uses: crate-ci/[email protected].0
uses: crate-ci/[email protected].8
with:
config: .github/workflows/config/typos.toml
4 changes: 2 additions & 2 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@docusaurus/core": "^3.5.1",
"@docusaurus/preset-classic": "^3.5.1",
"@docusaurus/theme-classic": "^3.5.1",
"@docusaurus/theme-common": "^3.5.1",
"@docusaurus/theme-common": "^3.5.2",
"@docusaurus/types": "^3.5.1",
"@easyops-cn/docusaurus-search-local": "^0.44.5",
"@mdx-js/react": "^3.0.1",
Expand All @@ -38,7 +38,7 @@
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.5.2",
"@docusaurus/tsconfig": "^3.5.2",
"@types/node": "^22.4.1",
"@types/node": "^22.8.1",
"@types/react": "^18.3.11",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/circuits/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@types/chai": "^4.3.11",
"@types/chai-as-promised": "^7.1.8",
"@types/mocha": "^10.0.8",
"@types/node": "^22.4.1",
"@types/node": "^22.8.1",
"@types/snarkjs": "^0.7.8",
"@zk-kit/baby-jubjub": "^1.0.3",
"chai": "^4.3.10",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"commander": "^12.1.0",
"dotenv": "^16.4.5",
"ethers": "^6.13.2",
"hardhat": "^2.22.13",
"hardhat": "^2.22.8",
"maci-circuits": "^2.4.0",
"maci-contracts": "^2.4.0",
"maci-core": "^2.4.0",
Expand All @@ -59,7 +59,7 @@
"@types/chai": "^4.3.9",
"@types/chai-as-promised": "^7.1.8",
"@types/mocha": "^10.0.8",
"@types/node": "^22.4.1",
"@types/node": "^22.8.1",
"@types/prompt": "^1.1.9",
"@types/snarkjs": "^0.7.8",
"chai": "^4.3.10",
Expand Down
24 changes: 1 addition & 23 deletions packages/contracts/contracts/Tally.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,6 @@ contract Tally is Ownable, SnarkCommon, CommonUtilities, Hasher, DomainObjs, ITa
bool flag;
}

/// @notice tally result args
struct AddTallyResultsArgs {
/// @param voteOptionIndices Vote option index.
uint256[] voteOptionIndices;
/// @param tallyResults The results of vote tally for the recipients.
uint256[] tallyResults;
/// @param tallyResultProofs Proofs of correctness of the vote tally results.
uint256[][][] tallyResultProofs;
/// @param totalSpent spent field retrieved in the totalSpentVoiceCredits object
uint256 totalSpent;
/// @param totalSpentSalt spent salt
uint256 totalSpentSalt;
/// @param tallyResultSalt the respective salt in the results object in the tally.json
uint256 tallyResultSalt;
/// @param newResultsCommitment The salted commitment of the vote tally for this batch of leaves plus the vote tally from currentResults
uint256 newResultsCommitment;
/// @param spentVoiceCreditsHash hashLeftRight(number of spent voice credits, spent salt)
uint256 spentVoiceCreditsHash;
/// @param perVOSpentVoiceCreditsHash hashLeftRight(merkle root of the no spent voice credits per vote option, perVOSpentVoiceCredits salt)
uint256 perVOSpentVoiceCreditsHash;
}

/// @notice The commitment to the tally results. Its initial value is 0, but after
/// the tally of each batch is proven on-chain via a zk-SNARK, it should be
/// updated to:
Expand Down Expand Up @@ -390,7 +368,7 @@ contract Tally is Ownable, SnarkCommon, CommonUtilities, Hasher, DomainObjs, ITa
* @notice Add and verify tally results by batch.
* @param args add tally result args
*/
function addTallyResults(AddTallyResultsArgs calldata args) public virtual onlyOwner {
function addTallyResults(ITally.AddTallyResultsArgs calldata args) public virtual onlyOwner {
if (!isTallied()) {
revert VotesNotTallied();
}
Expand Down
22 changes: 22 additions & 0 deletions packages/contracts/contracts/interfaces/ITally.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ pragma solidity ^0.8.10;
/// @title ITally
/// @notice Tally interface
interface ITally {
/// @notice tally result args
struct AddTallyResultsArgs {
/// @param voteOptionIndices Vote option index.
uint256[] voteOptionIndices;
/// @param tallyResults The results of vote tally for the recipients.
uint256[] tallyResults;
/// @param tallyResultProofs Proofs of correctness of the vote tally results.
uint256[][][] tallyResultProofs;
/// @param totalSpent spent field retrieved in the totalSpentVoiceCredits object
uint256 totalSpent;
/// @param totalSpentSalt spent salt
uint256 totalSpentSalt;
/// @param tallyResultSalt the respective salt in the results object in the tally.json
uint256 tallyResultSalt;
/// @param newResultsCommitment The salted commitment of the vote tally for this batch of leaves plus the vote tally from currentResults
uint256 newResultsCommitment;
/// @param spentVoiceCreditsHash hashLeftRight(number of spent voice credits, spent salt)
uint256 spentVoiceCreditsHash;
/// @param perVOSpentVoiceCreditsHash hashLeftRight(merkle root of the no spent voice credits per vote option, perVOSpentVoiceCredits salt)
uint256 perVOSpentVoiceCreditsHash;
}

/// @notice Verify the number of spent voice credits per vote option from the tally.json
/// @param _voteOptionIndex the index of the vote option where credits were spent
/// @param _spent the spent voice credits for a given vote option index
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"@openzeppelin/merkle-tree": "^1.0.7",
"circomlibjs": "^0.1.7",
"ethers": "^6.13.2",
"hardhat": "^2.22.13",
"hardhat": "^2.22.8",
"lowdb": "^1.0.0",
"maci-circuits": "^2.4.0",
"maci-core": "^2.4.0",
Expand All @@ -172,7 +172,7 @@
"@types/circomlibjs": "^0.1.6",
"@types/lowdb": "^1.0.15",
"@types/mocha": "^10.0.8",
"@types/node": "^22.4.1",
"@types/node": "^22.8.1",
"@types/snarkjs": "^0.7.8",
"@types/uuid": "^10.0.0",
"chai": "^4.3.10",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"devDependencies": {
"@types/chai": "^4.3.11",
"@types/mocha": "^10.0.8",
"@types/node": "^22.4.1",
"@types/node": "^22.8.1",
"benny": "^3.7.1",
"chai": "^4.3.10",
"mocha": "^10.7.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"devDependencies": {
"@types/chai": "^4.3.11",
"@types/mocha": "^10.0.8",
"@types/node": "^22.4.1",
"@types/node": "^22.8.1",
"benny": "^3.7.1",
"chai": "^4.3.10",
"mocha": "^10.7.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/domainobjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"devDependencies": {
"@types/chai": "^4.3.11",
"@types/mocha": "^10.0.8",
"@types/node": "^22.4.1",
"@types/node": "^22.8.1",
"chai": "^4.3.10",
"mocha": "^10.7.3",
"nyc": "^17.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/integrationTests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
"@types/chai": "^4.3.11",
"@types/chai-as-promised": "^7.1.8",
"@types/mocha": "^10.0.8",
"@types/node": "^22.4.1",
"@types/node": "^22.8.1",
"chai": "^4.3.10",
"chai-as-promised": "^7.1.2",
"hardhat": "^2.22.13",
"hardhat": "^2.22.8",
"hardhat-artifactor": "^0.2.0",
"hardhat-contract-sizer": "^2.0.3",
"mocha": "^10.7.3",
Expand Down
Loading

0 comments on commit 0370ea4

Please sign in to comment.