Skip to content

Commit

Permalink
fix(maci): upgraded minor version and fixed bug in testnet deployment
Browse files Browse the repository at this point in the history
Added maxFeePerGas parameter to the deployment of MACI's contracts; Bumped minor version to 1.1.1

fix #551 and fix #552
  • Loading branch information
ctrlc03 committed Nov 30, 2022
1 parent 0ce643a commit 5ef5ed8
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 49 deletions.
10 changes: 5 additions & 5 deletions circuits/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "maci-circuits",
"version": "1.1.0",
"description": "",
"version": "1.1.1",
"description": "zk-SNARK circuits for MACI",
"main": "build/index.js",
"scripts": {
"circom-helper": "circom-helper -c ./circomHelperConfig.json -b ./build/test/ -p 9001 -nc",
Expand Down Expand Up @@ -57,9 +57,9 @@
"axios": "^1.1.3",
"circom-helper": "^0.3.0",
"jest": "^26.6.3",
"maci-core": "^1.1.0",
"maci-crypto": "^1.1.0",
"maci-domainobjs": "^1.1.0",
"maci-core": "^1.1.1",
"maci-crypto": "^1.1.1",
"maci-domainobjs": "^1.1.1",
"ts-jest": "^26.5.4",
"typescript": "^4.2.3"
},
Expand Down
16 changes: 8 additions & 8 deletions cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "maci-cli",
"version": "1.1.0",
"description": "",
"version": "1.1.1",
"description": "CLI utilities for MACI",
"main": "build/index.js",
"bin": {
"maci-cli": "./build/index.js"
Expand All @@ -21,12 +21,12 @@
"ffiasm": "0.1.3",
"hardhat": "^2.0.11",
"js-yaml": "4.0.0",
"maci-circuits": "^1.1.0",
"maci-common": "^1.1.0",
"maci-contracts": "^1.1.0",
"maci-core": "^1.1.0",
"maci-crypto": "^1.1.0",
"maci-domainobjs": "^1.1.0",
"maci-circuits": "^1.1.1",
"maci-common": "^1.1.1",
"maci-contracts": "^1.1.1",
"maci-core": "^1.1.1",
"maci-crypto": "^1.1.1",
"maci-domainobjs": "^1.1.1",
"prompt-async": "^0.9.9",
"shelljs": "^0.8.4",
"snarkjs": "^0.5.0",
Expand Down
2 changes: 1 addition & 1 deletion common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maci-common",
"version": "1.1.0",
"version": "1.1.1",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
10 changes: 5 additions & 5 deletions contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maci-contracts",
"version": "1.1.0",
"version": "1.1.1",
"description": "Solidity Smart Contracts for MACI (Minimal Anti-Collusion Infrastructure)",
"main": "build/index.js",
"scripts": {
Expand Down Expand Up @@ -43,10 +43,10 @@
"@types/node": "^14.14.35",
"ethers": "^5.0.32",
"jest": "^26.6.3",
"maci-circuits": "^1.1.0",
"maci-core": "^1.1.0",
"maci-crypto": "^1.1.0",
"maci-domainobjs": "^1.1.0",
"maci-circuits": "^1.1.1",
"maci-core": "^1.1.1",
"maci-crypto": "^1.1.1",
"maci-domainobjs": "^1.1.1",
"shelljs": "^0.8.4",
"ts-jest": "^26.5.4"
},
Expand Down
79 changes: 65 additions & 14 deletions contracts/ts/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as fs from 'fs'
import * as path from 'path'
const { ethers } = require('hardhat')
import { BigNumber } from 'ethers'

const abiDir = path.join(__dirname, '..', 'artifacts')
const solDir = path.join(__dirname, '..', 'contracts')
Expand All @@ -24,7 +25,6 @@ const parseArtifact = (filename: string) => {
filePath += `${filename}.sol`
}


if (filename.includes('Verifier')) {
filePath += 'crypto/Verifier.sol/'
}
Expand Down Expand Up @@ -121,13 +121,19 @@ const genJsonRpcDeployer = (
const deployTopupCredit = async () => {
const signer = await getDefaultSigner()
const topupCreditFactory = await ethers.getContractFactory('TopupCredit', signer)
return await topupCreditFactory.deploy()
const gasFees = await signer.provider.getFeeData()
return await topupCreditFactory.deploy({
maxFeePerGas: BigNumber.from(gasFees['maxFeePerGas']).mul(2),
})
}

const deployVkRegistry = async () => {
const signer = await getDefaultSigner()
const vkRegistryFactory = await ethers.getContractFactory('VkRegistry', signer)
return await vkRegistryFactory.deploy()
const gasFees = await signer.provider.getFeeData()
return await vkRegistryFactory.deploy({
maxFeePerGas: BigNumber.from(gasFees['maxFeePerGas']).mul(2),
})
}

const deployMockVerifier = async (quiet = false) => {
Expand Down Expand Up @@ -169,6 +175,7 @@ const deploySignupTokenGatekeeper = async (

const signer = await getDefaultSigner()
const factory = await ethers.getContractFactory('SignUpTokenGatekeeper', signer)

return await factory.deploy(signUpTokenAddress)
}

Expand All @@ -195,10 +202,20 @@ const deployPoseidonContracts = async (quiet = false) => {
const PoseidonT5ContractFactory = await ethers.getContractFactory('PoseidonT5', signer)
const PoseidonT6ContractFactory = await ethers.getContractFactory('PoseidonT6', signer)

const PoseidonT3Contract = await PoseidonT3ContractFactory.deploy()
const PoseidonT4Contract = await PoseidonT4ContractFactory.deploy()
const PoseidonT5Contract = await PoseidonT5ContractFactory.deploy()
const PoseidonT6Contract = await PoseidonT6ContractFactory.deploy()
const gasFees = await signer.provider.getFeeData()

const PoseidonT3Contract = await PoseidonT3ContractFactory.deploy({
maxFeePerGas: gasFees['maxFeePerGas'],
})
const PoseidonT4Contract = await PoseidonT4ContractFactory.deploy({
maxFeePerGas: gasFees['maxFeePerGas'],
})
const PoseidonT5Contract = await PoseidonT5ContractFactory.deploy({
maxFeePerGas: gasFees['maxFeePerGas'],
})
const PoseidonT6Contract = await PoseidonT6ContractFactory.deploy({
maxFeePerGas: gasFees['maxFeePerGas'],
})

await PoseidonT3Contract.deployTransaction.wait()
await PoseidonT4Contract.deployTransaction.wait()
Expand All @@ -217,24 +234,35 @@ const deployPollFactory = async (quiet = false) => {
const signer = await getDefaultSigner()
log('Deploying PollFactory', quiet)
const pollFactory = await ethers.getContractFactory('PollFactory', signer)
const gasFees = await signer.provider.getFeeData()

return await pollFactory.deploy()
return await pollFactory.deploy({
maxFeePerGas: gasFees['maxFeePerGas'],
})
}

const deployPpt = async (verifierContractAddress: string, quiet = false) => {
const signer = await getDefaultSigner()
log('Deploying PollProcessorAndTallyer', quiet)
const pptFactory = await ethers.getContractFactory('PollProcessorAndTallyer', signer)

return await pptFactory.deploy(verifierContractAddress)
const gasFees = await signer.provider.getFeeData()

return await pptFactory.deploy(verifierContractAddress, {
maxFeePerGas: gasFees['maxFeePerGas'],
})
}

const deployMessageAqFactory = async (quiet = false) => {
const signer = await getDefaultSigner()
log('Deploying MessageAqFactory', quiet)
const messageAqFactory = await ethers.getContractFactory('MessageAqFactory', signer)
// MessageAqFactory
return await messageAqFactory.deploy()
const gasFees = await signer.provider.getFeeData()

return await messageAqFactory.deploy({
maxFeePerGas: gasFees['maxFeePerGas'],
})
}

const deployMaci = async (
Expand Down Expand Up @@ -279,28 +307,51 @@ const deployMaci = async (
await pollFactoryContract.deployTransaction.wait()

log('Deploying MACI', quiet)

let gasFees = await signer.provider.getFeeData()

const maciContract = await maciContractFactory.deploy(
pollFactoryContract.address,
signUpTokenGatekeeperContractAddress,
initialVoiceCreditBalanceAddress,
{
maxFeePerGas: gasFees['maxFeePerGas'],
}
)

await maciContract.deployTransaction.wait()

gasFees = await signer.provider.getFeeData()

log('Transferring PollFactory ownership to MACI', quiet)
await (await (pollFactoryContract.transferOwnership(maciContract.address))).wait()
await (await (pollFactoryContract.transferOwnership(maciContract.address, {
maxFeePerGas: gasFees['maxFeePerGas'],
}))).wait()

gasFees = await signer.provider.getFeeData()

const messageAqContract = await messageAqFactory.deploy()
const messageAqContract = await messageAqFactory.deploy({
maxFeePerGas: gasFees['maxFeePerGas'],
})
await messageAqContract.deployTransaction.wait()

gasFees = await signer.provider.getFeeData()

log('Transferring MessageAqFactory ownership to PollFactory', quiet)
await (await (messageAqContract.transferOwnership(pollFactoryContract.address))).wait()
await (await (messageAqContract.transferOwnership(pollFactoryContract.address, {
maxFeePerGas: gasFees['maxFeePerGas'],
}))).wait()

log('Initialising MACI', quiet)
gasFees = await signer.provider.getFeeData()

await (await (maciContract.init(
vkRegistryContractAddress,
messageAqContract.address,
topupCreditContractAddress
topupCreditContractAddress,
{
maxFeePerGas: gasFees['maxFeePerGas'],
}
))).wait()

const [ AccQueueQuinaryMaciAbi, ] = parseArtifact('AccQueue')
Expand Down
6 changes: 3 additions & 3 deletions core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maci-core",
"version": "1.1.0",
"version": "1.1.1",
"description": "",
"main": "build/index.js",
"scripts": {
Expand All @@ -17,8 +17,8 @@
"@maci-contracts": "../contracts"
},
"dependencies": {
"maci-crypto": "^1.1.0",
"maci-domainobjs": "^1.1.0",
"maci-crypto": "^1.1.1",
"maci-domainobjs": "^1.1.1",
"module-alias": "^2.2.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion crypto/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maci-crypto",
"version": "1.1.0",
"version": "1.1.1",
"description": "",
"main": "build/index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions domainobjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maci-domainobjs",
"version": "1.1.0",
"version": "1.1.1",
"description": "",
"main": "build/index.js",
"scripts": {
Expand All @@ -13,7 +13,7 @@
"@types/jest": "^26.0.21",
"@types/node": "^14.14.35",
"jest": "^26.6.3",
"maci-crypto": "^1.1.0",
"maci-crypto": "^1.1.1",
"ts-jest": "^26.5.4"
},
"dependencies": {
Expand Down
14 changes: 7 additions & 7 deletions integrationTests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maci-integrationtests",
"version": "1.1.0",
"version": "1.1.1",
"description": "",
"main": "build/index.js",
"scripts": {
Expand Down Expand Up @@ -29,12 +29,12 @@
"hardhat-contract-sizer": "^2.0.3",
"jest": "^26.6.3",
"js-yaml": "^4.0.0",
"maci-circuits": "^1.1.0",
"maci-cli": "^1.1.0",
"maci-contracts": "^1.1.0",
"maci-core": "^1.1.0",
"maci-crypto": "^1.1.0",
"maci-domainobjs": "^1.1.0",
"maci-circuits": "^1.1.1",
"maci-cli": "^1.1.1",
"maci-contracts": "^1.1.1",
"maci-core": "^1.1.1",
"maci-crypto": "^1.1.1",
"maci-domainobjs": "^1.1.1",
"module-alias": "^2.2.2",
"shelljs": "^0.8.5",
"ts-jest": "^26.5.4"
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"server",
"common"
],
"version": "1.1.0",
"version": "1.1.1",
"npmClient": "npm"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maci",
"version": "1.1.0",
"version": "1.1.1",
"description": "Minimal Anti-Collustion Infrastructure",
"repository": "https://github.com/privacy-scaling-explorations/maci",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maci-server",
"version": "1.1.0",
"version": "1.1.1",
"description": "",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 5ef5ed8

Please sign in to comment.