Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update to latest maci version #9

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ yarn start

7. **Compute Results**

- In a fourth terminal, clone the maci repo - `git clone [email protected]:privacy-scaling-explorations/maci.git` and then reset to `ee3e2a6` commit using `git reset --hard ee3e2a6`
- In a fourth terminal, clone the maci repo - `git clone [email protected]:privacy-scaling-explorations/maci.git`
- Copy the zkeys generated from the maci wrapper repo to the cli directory of the maci repo using `cp -r maci-wrapper/packages/hardhat/zkeys maci/cli`.
- Install the dependencies using `pnpm i` and build the maci project using `pnpm run build`
- Copy the new contract addresses from the maci wrapper repo to the maci repo using `cp -r maci-wrapper/packages/contractAddresses.json maci/cli/build/contractAddresses.json`.
Expand Down
1 change: 0 additions & 1 deletion packages/hardhat/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export const InitialVoiceCreditProxyContractName = "ConstantInitialVoiceCreditProxy";
export const GatekeeperContractName = "FreeForAllGatekeeper";
export const VerifierContractName = "Verifier";
export const TopupCreditContractName = "TopupCredit";

// zk registry config
export const stateTreeDepth = 10;
Expand Down
6 changes: 2 additions & 4 deletions packages/hardhat/contracts/maci-contracts/MACIWrapper.sol
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { MACI } from "maci-contracts/contracts/MACI.sol";
import { IPollFactory } from "maci-contracts/contracts/interfaces/IPollFactory.sol";
import { IMessageProcessorFactory } from "maci-contracts/contracts/interfaces/IMPFactory.sol";
import { ITallyFactory } from "maci-contracts/contracts/interfaces/ITallyFactory.sol";
import { SignUpGatekeeper } from "maci-contracts/contracts/gatekeepers/SignUpGatekeeper.sol";
import { InitialVoiceCreditProxy } from "maci-contracts/contracts/initialVoiceCreditProxy/InitialVoiceCreditProxy.sol";
import { TopupCredit } from "maci-contracts/contracts/TopupCredit.sol";

/// @title MACI - Minimum Anti-Collusion Infrastructure Version 1
/// @notice A contract which allows users to sign up, and deploy new polls
contract MACIWrapper is MACI {
contract MACIWrapper is MACI, Ownable(msg.sender) {
struct PollData {
uint256 id;
string name;
Expand Down Expand Up @@ -59,7 +59,6 @@ contract MACIWrapper is MACI {
ITallyFactory _tallyFactory,
SignUpGatekeeper _signUpGatekeeper,
InitialVoiceCreditProxy _initialVoiceCreditProxy,
TopupCredit _topupCredit,
uint8 _stateTreeDepth
)
MACI(
Expand All @@ -68,7 +67,6 @@ contract MACIWrapper is MACI {
_tallyFactory,
_signUpGatekeeper,
_initialVoiceCreditProxy,
_topupCredit,
_stateTreeDepth
)
{}
Expand Down
21 changes: 0 additions & 21 deletions packages/hardhat/deploy/03_topup_credit.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import {
GatekeeperContractName,
InitialVoiceCreditProxyContractName,
TopupCreditContractName,
stateTreeDepth,
} from "../constants";
import { GatekeeperContractName, InitialVoiceCreditProxyContractName, stateTreeDepth } from "../constants";
import { MACIWrapper, SignUpGatekeeper } from "../typechain-types";

// const STATE_TREE_SUBDEPTH = 2;

const deployContracts: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployer } = await hre.getNamedAccounts();

Expand All @@ -19,7 +12,6 @@ const deployContracts: DeployFunction = async function (hre: HardhatRuntimeEnvir
const poseidonT6 = await hre.ethers.getContract("PoseidonT6", deployer);
const initialVoiceCreditProxy = await hre.ethers.getContract(InitialVoiceCreditProxyContractName, deployer);
const gatekeeper = await hre.ethers.getContract<SignUpGatekeeper>(GatekeeperContractName, deployer);
const topupCredit = await hre.ethers.getContract(TopupCreditContractName, deployer);
const pollFactory = await hre.ethers.getContract("PollFactory", deployer);
const messageProcessorFactory = await hre.ethers.getContract("MessageProcessorFactory", deployer);
const tallyFactory = await hre.ethers.getContract("TallyFactory", deployer);
Expand All @@ -32,7 +24,6 @@ const deployContracts: DeployFunction = async function (hre: HardhatRuntimeEnvir
await tallyFactory.getAddress(),
await gatekeeper.getAddress(),
await initialVoiceCreditProxy.getAddress(),
await topupCredit.getAddress(),
stateTreeDepth,
],
log: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const deployContracts: DeployFunction = async function (hre: HardhatRuntimeEnvir
await hre.deployments.deploy("VkRegistry", {
from: deployer,
args: [],
log: true,
log: false,
autoMine: true,
});

Expand Down Expand Up @@ -59,7 +59,7 @@ const deployContracts: DeployFunction = async function (hre: HardhatRuntimeEnvir
[processVkParam, processVkNonQvParam],
[tallyVkParam, tallyVkNonQvParam],
);
await tx.wait(1);
await tx.wait();
};

export default deployContracts;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,30 @@ const deployContracts: DeployFunction = async function (hre: HardhatRuntimeEnvir
const gatekeeper = await hre.ethers.getContract(GatekeeperContractName, deployer);
const verifier = await hre.ethers.getContract("Verifier", deployer);
const pollFactory = await hre.ethers.getContract("PollFactory", deployer);
const topupCredit = await hre.ethers.getContract("TopupCredit", deployer);
const poseidonT3 = await hre.ethers.getContract("PoseidonT3", deployer);
const poseidonT4 = await hre.ethers.getContract("PoseidonT4", deployer);
const poseidonT5 = await hre.ethers.getContract("PoseidonT5", deployer);
const poseidonT6 = await hre.ethers.getContract("PoseidonT6", deployer);

fs.writeFileSync(
"./contractAddresses.json",
JSON.stringify({
[hre.network.name]: {
MACI: await maci.getAddress(),
InitialVoiceCreditProxy: await initialVoiceCreditProxy.getAddress(),
SignUpGatekeeper: await gatekeeper.getAddress(),
Verifier: await verifier.getAddress(),
PollFactory: await pollFactory.getAddress(),
TopupCredit: await topupCredit.getAddress(),
PoseidonT3: await poseidonT3.getAddress(),
PoseidonT4: await poseidonT4.getAddress(),
PoseidonT5: await poseidonT5.getAddress(),
PoseidonT6: await poseidonT6.getAddress(),
JSON.stringify(
{
[hre.network.name]: {
MACI: await maci.getAddress(),
InitialVoiceCreditProxy: await initialVoiceCreditProxy.getAddress(),
SignUpGatekeeper: await gatekeeper.getAddress(),
Verifier: await verifier.getAddress(),
PollFactory: await pollFactory.getAddress(),
PoseidonT3: await poseidonT3.getAddress(),
PoseidonT4: await poseidonT4.getAddress(),
PoseidonT5: await poseidonT5.getAddress(),
PoseidonT6: await poseidonT6.getAddress(),
},
},
}),
undefined,
4,
),
);
};

Expand Down
1 change: 1 addition & 0 deletions packages/hardhat/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const config: HardhatUserConfig = {
// url: `https://eth-mainnet.alchemyapi.io/v2/${providerApiKey}`,
// enabled: process.env.MAINNET_FORKING_ENABLED === "true",
// },
loggingEnabled: false,
},
mainnet: {
url: `https://eth-mainnet.alchemyapi.io/v2/${providerApiKey}`,
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat/maci-scripts/download_zkeys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

mkdir -p ./zkeys

URL=https://maci-develop-fra.s3.eu-central-1.amazonaws.com/v1.3.0/maci_artifacts_10-2-1-2_test_f6073a6.tar.gz
URL=https://maci-develop-fra.s3.eu-central-1.amazonaws.com/v1.3.0/maci_artifacts_10-2-1-2_test.tar.gz
DIR_NAME="maci_keys.tar.gz"
OUT_DIR=./

Expand Down
10 changes: 5 additions & 5 deletions packages/hardhat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
"dotenv": "~16.0.3",
"envfile": "~6.18.0",
"hardhat-artifactor": "^0.2.0",
"maci-circuits": "0.0.0-ci.f6073a6",
"maci-cli": "0.0.0-ci.f6073a6",
"maci-contracts": "0.0.0-ci.f6073a6",
"maci-crypto": "0.0.0-ci.f6073a6",
"maci-domainobjs": "0.0.0-ci.f6073a6",
"maci-circuits": "0.0.0-ci.4d2d340",
"maci-cli": "0.0.0-ci.4d2d340",
"maci-contracts": "0.0.0-ci.4d2d340",
"maci-crypto": "0.0.0-ci.4d2d340",
"maci-domainobjs": "0.0.0-ci.4d2d340",
"prompt": "^1.3.0",
"qrcode": "~1.5.1",
"snarkjs": "^0.7.3"
Expand Down
Loading
Loading