Skip to content

Commit

Permalink
chore(config): added optimism to config and fixed broken link (#1578)
Browse files Browse the repository at this point in the history
* chore(config): added optimism to config and fixed broken link

* docs(zk-snark-circuits): fixed broken links

---------

Co-authored-by: Crisgarner <@crisgarner>
  • Loading branch information
crisgarner authored Jun 19, 2024
1 parent 71014a9 commit 3a278fb
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 5 deletions.
57 changes: 57 additions & 0 deletions contracts/deploy-config-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,62 @@
"coordinatorPubkey": "macipk.0a1ce79a43fa676ee3d2882c79d9164a24d4a22bb6190e3d8fa25d97bffc069a",
"useQuadraticVoting": false
}
},
"optimism": {
"ConstantInitialVoiceCreditProxy": {
"deploy": true,
"amount": 99
},
"FreeForAllGatekeeper": {
"deploy": false
},
"EASGatekeeper": {
"deploy": true,
"easAddress": "0x4200000000000000000000000000000000000021",
"schema": "0xe2636f31239f7948afdd9a9c477048b7fc2a089c347af60e3aa1251e5bf63e5c",
"attester": "the-attester-address"
},
"GitcoinPassportGatekeeper": {
"deploy": false,
"decoderAddress": "0xe53C60F8069C2f0c3a84F9B3DB5cf56f3100ba56",
"passingScore": 5
},
"ZupassGatekeeper": {
"deploy": false,
"signer1": "13908133709081944902758389525983124100292637002438232157513257158004852609027",
"signer2": "7654374482676219729919246464135900991450848628968334062174564799457623790084",
"eventId": "69c0caaa-c65d-5345-a20c-867774f18c67",
"zupassVerifier": "0x2272cdb3596617886d0F48524DA486044E0376d6"
},
"MACI": {
"stateTreeDepth": 6,
"gatekeeper": "EASGatekeeper"
},
"VkRegistry": {
"stateTreeDepth": 6,
"intStateTreeDepth": 2,
"messageTreeDepth": 9,
"voteOptionTreeDepth": 3,
"messageBatchDepth": 2,
"zkeys": {
"qv": {
"processMessagesZkey": "../cli/zkeys/ProcessMessages_6-9-2-3/processMessages_6-9-2-3.zkey",
"tallyVotesZkey": "../cli/zkeys/TallyVotes_6-2-3/tallyVotes_6-2-3.zkey",
"processWasm": "../cli/zkeys/ProcessMessages_6-9-2-3/ProcessMessages_6-9-2-3_js/ProcessMessages_6-9-2-3.wasm",
"tallyWasm": "../cli/zkeys/TallyVotes_6-2-3/TallyVotes_6-2-3_js/TallyVotes_6-2-3.wasm"
},
"nonQv": {
"processMessagesZkey": "../cli/zkeys/ProcessMessagesNonQv_6-9-2-3/processMessagesNonQv_6-9-2-3.zkey",
"tallyVotesZkey": "../cli/zkeys/TallyVotesNonQv_6-2-3/tallyVotesNonQv_6-2-3.zkey",
"processWasm": "../cli/zkeys/ProcessMessagesNonQv_6-9-2-3/ProcessMessagesNonQv_6-9-2-3_js/ProcessMessagesNonQv_6-9-2-3.wasm",
"tallyWasm": "../cli/zkeys/TallyVotesNonQv_6-2-3/TallyVotesNonQv_6-2-3_js/TallyVotesNonQv_6-2-3.wasm"
}
}
},
"Poll": {
"pollDuration": 3600,
"coordinatorPubkey": "macipk.9a59264310d95cfd8eb7083aebeba221b5c26e77427f12b7c0f50bc1cc35e621",
"useQuadraticVoting": false
}
}
}
14 changes: 12 additions & 2 deletions contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const config: HardhatUserConfig = {
defaultNetwork: "localhost",
networks: {
sepolia: getCommonNetworkConfig(ESupportedChains.Sepolia, EChainId.Sepolia),
optimism: getCommonNetworkConfig(ESupportedChains.Optimism, EChainId.Optimism),
optimism_sepolia: getCommonNetworkConfig(ESupportedChains.OptimismSepolia, EChainId.OptimismSepolia),
scroll: getCommonNetworkConfig(ESupportedChains.Scroll, EChainId.Scroll),
scroll_sepolia: getCommonNetworkConfig(ESupportedChains.ScrollSepolia, EChainId.ScrollSepolia),
Expand Down Expand Up @@ -102,17 +103,26 @@ const config: HardhatUserConfig = {
etherscan: {
apiKey: {
[ESupportedChains.Sepolia]: ETHERSCAN_API_KEYS[ESupportedChains.Sepolia]!,
[ESupportedChains.Optimism]: ETHERSCAN_API_KEYS[ESupportedChains.Optimism]!,
[ESupportedChains.OptimismSepolia]: ETHERSCAN_API_KEYS[ESupportedChains.OptimismSepolia]!,
[ESupportedChains.Scroll]: ETHERSCAN_API_KEYS[ESupportedChains.Scroll]!,
[ESupportedChains.ScrollSepolia]: ETHERSCAN_API_KEYS[ESupportedChains.ScrollSepolia]!,
},
customChains: [
{
network: ESupportedChains.Optimism,
chainId: EChainId.Optimism,
urls: {
apiURL: "https://api-optimistic.etherscan.io/api",
browserURL: "https://optimistic.etherscan.io",
},
},
{
network: ESupportedChains.OptimismSepolia,
chainId: EChainId.OptimismSepolia,
urls: {
apiURL: "https://api-sepolia-optimism.etherscan.io/api",
browserURL: "https://sepolia-optimism.etherscan.io",
apiURL: "https://api-sepolia-optimistic.etherscan.io/api",
browserURL: "https://sepolia-optimistic.etherscan.io",
},
},
{
Expand Down
5 changes: 5 additions & 0 deletions contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,30 @@
"deploy:localhost": "pnpm run deploy",
"deploy:sepolia": "pnpm run deploy --network sepolia",
"deploy:optimism-sepolia": "pnpm run deploy --network optimism_sepolia",
"deploy:optimism": "pnpm run deploy --network optimism",
"deploy:scroll": "pnpm run deploy --network scroll",
"deploy:scroll-sepolia": "pnpm run deploy --network scroll_sepolia",
"deploy-poll:localhost": "pnpm run deploy-poll",
"deploy-poll:sepolia": "pnpm run deploy-poll --network sepolia",
"deploy-poll:optimism-sepolia": "pnpm run deploy-poll --network optimism_sepolia",
"deploy-poll:optimism": "pnpm run deploy-poll --network optimism",
"deploy-poll:scroll": "pnpm run deploy-poll --network scroll",
"deploy-poll:scroll-sepolia": "pnpm run deploy-poll --network scroll_sepolia",
"merge:localhost": "pnpm run merge",
"merge:sepolia": "pnpm run merge --network sepolia",
"merge:optimism-sepolia": "pnpm run merge --network optimism_sepolia",
"merge:optimism": "pnpm run merge --network optimism",
"merge:scroll": "pnpm run merge --network scroll",
"merge:scroll-sepolia": "pnpm run merge --network scroll_sepolia",
"prove:localhost": "pnpm run prove",
"prove:sepolia": "pnpm run prove --network sepolia",
"prove:optimism-sepolia": "pnpm run prove --network optimism_sepolia",
"prove:optimism": "pnpm run prove --network optimism",
"prove:scroll": "pnpm run prove --network scroll",
"prove:scroll-sepolia": "pnpm run prove --network scroll_sepolia",
"verify:sepolia": "pnpm run verify --network sepolia",
"verify:optimism-sepolia": "pnpm run verify --network optimism_sepolia",
"verify:optimism": "pnpm run verify --network optimism",
"verify:scroll": "pnpm run verify --network scroll",
"verify:scroll-sepolia": "pnpm run verify --network scroll_sepolia"
},
Expand Down
6 changes: 6 additions & 0 deletions contracts/tasks/helpers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
export enum ESupportedChains {
Sepolia = "sepolia",
Optimism = "optimism",
OptimismSepolia = "optimism_sepolia",
Scroll = "scroll",
ScrollSepolia = "scroll_sepolia",
Expand All @@ -15,6 +16,7 @@ export enum ESupportedChains {
*/
export enum EChainId {
Hardhat = 31337,
Optimism = 10,
OptimismSepolia = 11155420,
Sepolia = 11155111,
Scroll = 534352,
Expand All @@ -39,6 +41,7 @@ const gasPrice = (value: number) => value * GWEI;
*/
export const NETWORKS_DEFAULT_GAS: Record<ESupportedChains, number | "auto"> = {
[ESupportedChains.Sepolia]: gasPrice(1),
[ESupportedChains.Optimism]: gasPrice(1),
[ESupportedChains.OptimismSepolia]: gasPrice(1),
[ESupportedChains.Scroll]: gasPrice(1),
[ESupportedChains.ScrollSepolia]: gasPrice(1),
Expand All @@ -53,12 +56,14 @@ export const NETWORKS_DEFAULT_GAS: Record<ESupportedChains, number | "auto"> = {
*/
export const getNetworkRpcUrls = (): Record<ESupportedChains, string> => {
const SEPOLIA_RPC_URL = process.env.SEPOLIA_RPC_URL ?? "";
const OP_RPC_URL = process.env.OP_RPC_URL ?? "";
const OP_SEPOLIA_RPC_URL = process.env.OP_SEPOLIA_RPC_URL ?? "";
const SCROLL_RPC_URL = process.env.SCROLL_RPC_URL ?? "";
const SCROLL_SEPOLIA_RPC_URL = process.env.SCROLL_SEPOLIA_RPC_URL ?? "";

return {
[ESupportedChains.Sepolia]: SEPOLIA_RPC_URL,
[ESupportedChains.Optimism]: OP_RPC_URL,
[ESupportedChains.OptimismSepolia]: OP_SEPOLIA_RPC_URL,
[ESupportedChains.Scroll]: SCROLL_RPC_URL,
[ESupportedChains.ScrollSepolia]: SCROLL_SEPOLIA_RPC_URL,
Expand All @@ -69,6 +74,7 @@ export const getNetworkRpcUrls = (): Record<ESupportedChains, string> => {

export const getEtherscanApiKeys = (): Record<ESupportedChains, string | undefined> => ({
[ESupportedChains.Sepolia]: process.env.ETH_ETHERSCAN_API_KEY,
[ESupportedChains.Optimism]: process.env.OPTIMISM_ETHERSCAN_API_KEY,
[ESupportedChains.OptimismSepolia]: process.env.OPTIMISM_ETHERSCAN_API_KEY,
[ESupportedChains.Scroll]: process.env.SCROLL_ETHERSCAN_API_KEY,
[ESupportedChains.ScrollSepolia]: process.env.SCROLL_ETHERSCAN_API_KEY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pnpm circom:build $CIRCUIT_NAME

> Please note that the name should match one of the circuit names inside the `circom.json` file.
### Parameters
### Parameters

MACI's circuits are parameterized, and thus can be configured to support different number of users, messages (votes), and vote options. Please ensure you understand what each of these parameter means and correctly configure them when building circuits from scratch, and when deploying the smart contracts.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ We recommend to use the hardhat tasks inside the `maci-contracts` folder, due to
## Deployment Steps

:::info
Before deploying the contracts, please ensure that you have compiled the project using the correct state tree depth argument. This defines the maximum number of users that the system supports, and by default the parameter is set to 10 (to support 2 \*\* 10 users) for testing purposes. For production use, you might need to change this parameter to a different value. For more information about the parameters please refer to the [circuits page](/docs/developers-references/zk-snark-circuits/setup#Parameters).
Before deploying the contracts, please ensure that you have compiled the project using the correct state tree depth argument. This defines the maximum number of users that the system supports, and by default the parameter is set to 10 (to support 2 \*\* 10 users) for testing purposes. For production use, you might need to change this parameter to a different value. For more information about the parameters please refer to the [circuits page](/docs/developers-references/zk-snark-circuits/setup#parameters).

To re-compile with a different state tree depth parameter please run:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pnpm run build
```

:::info
Depending on the number of signups you would like to support, you will be required to re-compile the contracts with a different STATE_TREE_DEPTH parameter. This is by default 10 and can be used for testing purposes. For more information about the parameters please refer to the [circuits page](/docs/developers-references/zk-snark-circuits/setup#Parameters).
Depending on the number of signups you would like to support, you will be required to re-compile the contracts with a different STATE_TREE_DEPTH parameter. This is by default 10 and can be used for testing purposes. For more information about the parameters please refer to the [circuits page](/docs/developers-references/zk-snark-circuits/setup#parameters).

To re-compile with a different state tree depth parameter please run:

Expand Down

0 comments on commit 3a278fb

Please sign in to comment.