From dab5e2b0c05f00d4ede53b67ea118d05a952c5c3 Mon Sep 17 00:00:00 2001 From: 0xmad <0xmad@users.noreply.github.com> Date: Wed, 24 Apr 2024 14:08:43 -0500 Subject: [PATCH] feat: support deployment without hardhat - [x] Use signer for deployment - [x] Use hardhat as a fallback - [x] Compatibility fixes --- cli/package.json | 2 +- cli/ts/commands/deploy.ts | 1 + contracts/package.json | 2 +- .../01-constantInitialVoiceCreditProxy.ts | 73 ++-- contracts/tasks/deploy/maci/02-gatekeepers.ts | 21 +- contracts/tasks/deploy/maci/03-verifier.ts | 10 +- contracts/tasks/deploy/maci/04-topupCredit.ts | 10 +- contracts/tasks/deploy/maci/05-poseidon.ts | 16 +- contracts/tasks/deploy/maci/06-pollFactory.ts | 25 +- .../deploy/maci/07-messageProcessorFactory.ts | 24 +- .../tasks/deploy/maci/08-tallyFactory.ts | 25 +- contracts/tasks/deploy/maci/09-maci.ts | 25 +- contracts/tasks/deploy/maci/10-vkRegistry.ts | 13 +- contracts/tasks/deploy/poll/01-poll.ts | 278 ++++++++------- contracts/tasks/helpers/ContractStorage.ts | 4 +- contracts/tasks/helpers/Deployment.ts | 66 ++-- contracts/tasks/helpers/abi.ts | 25 ++ contracts/tasks/helpers/types.ts | 30 +- contracts/tests/AccQueue.test.ts | 48 +-- contracts/tests/AccQueueBenchmark.test.ts | 50 ++- contracts/tests/Hasher.test.ts | 22 +- contracts/tests/HasherBenchmarks.test.ts | 23 +- contracts/tests/Utilities.test.ts | 22 +- contracts/tests/utils.ts | 37 +- contracts/ts/deploy.ts | 72 ++-- contracts/ts/index.ts | 6 +- coordinator/.env.example | 2 + coordinator/package.json | 15 +- coordinator/ts/app.module.ts | 10 +- coordinator/ts/main.ts | 7 +- integrationTests/package.json | 2 +- pnpm-lock.yaml | 336 +++--------------- 32 files changed, 598 insertions(+), 704 deletions(-) create mode 100644 contracts/tasks/helpers/abi.ts create mode 100644 coordinator/.env.example diff --git a/cli/package.json b/cli/package.json index 6d27a126d0..d4cc40aaea 100644 --- a/cli/package.json +++ b/cli/package.json @@ -46,7 +46,7 @@ "commander": "^12.0.0", "dotenv": "^16.4.5", "ethers": "^6.12.0", - "hardhat": "^2.22.2", + "hardhat": "^2.22.3", "maci-circuits": "^1.2.0", "maci-contracts": "^1.2.0", "maci-core": "^1.2.0", diff --git a/cli/ts/commands/deploy.ts b/cli/ts/commands/deploy.ts index b4f7bdffea..7d454abe50 100644 --- a/cli/ts/commands/deploy.ts +++ b/cli/ts/commands/deploy.ts @@ -65,6 +65,7 @@ export const deploy = async ({ // check if we have a signupGatekeeper already deployed or passed as arg let signupGatekeeperContractAddress = signupGatekeeperAddress || readContractAddress("SignUpGatekeeper", network?.name); + if (!signupGatekeeperContractAddress) { const contract = await deployFreeForAllSignUpGatekeeper(signer, true); signupGatekeeperContractAddress = await contract.getAddress(); diff --git a/contracts/package.json b/contracts/package.json index 3314875f91..dbb68351b6 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -75,7 +75,7 @@ "@openzeppelin/contracts": "^5.0.2", "circomlibjs": "^0.1.7", "ethers": "^6.12.0", - "hardhat": "^2.22.2", + "hardhat": "^2.22.3", "maci-circuits": "^1.2.0", "maci-core": "^1.2.0", "maci-crypto": "^1.2.0", diff --git a/contracts/tasks/deploy/maci/01-constantInitialVoiceCreditProxy.ts b/contracts/tasks/deploy/maci/01-constantInitialVoiceCreditProxy.ts index 9566f1b3ea..d6c778b8a3 100644 --- a/contracts/tasks/deploy/maci/01-constantInitialVoiceCreditProxy.ts +++ b/contracts/tasks/deploy/maci/01-constantInitialVoiceCreditProxy.ts @@ -12,39 +12,40 @@ const storage = ContractStorage.getInstance(); */ deployment .deployTask("full:deploy-constant-initial-voice-credit-proxy", "Deploy constant initial voice credit proxy") - .setAction(async ({ incremental }: IDeployParams, hre) => { - deployment.setHre(hre); - const deployer = await deployment.getDeployer(); - - const needDeploy = deployment.getDeployConfigField(EContracts.ConstantInitialVoiceCreditProxy, "deploy"); - - if (needDeploy === false) { - return; - } - - const constantInitialVoiceCreditProxyContractAddress = storage.getAddress( - EContracts.ConstantInitialVoiceCreditProxy, - hre.network.name, - ); - - if (incremental && constantInitialVoiceCreditProxyContractAddress) { - return; - } - - const amount = - deployment.getDeployConfigField(EContracts.ConstantInitialVoiceCreditProxy, "amount") ?? - DEFAULT_INITIAL_VOICE_CREDITS; - - const constantInitialVoiceCreditProxyContract = await deployment.deployContract( - EContracts.ConstantInitialVoiceCreditProxy, - deployer, - amount.toString(), - ); - - await storage.register({ - id: EContracts.ConstantInitialVoiceCreditProxy, - contract: constantInitialVoiceCreditProxyContract, - args: [amount.toString()], - network: hre.network.name, - }); - }); + .then((task) => + task.setAction(async ({ incremental }: IDeployParams, hre) => { + deployment.setHre(hre); + const deployer = await deployment.getDeployer(); + + const needDeploy = deployment.getDeployConfigField(EContracts.ConstantInitialVoiceCreditProxy, "deploy"); + + if (needDeploy === false) { + return; + } + + const constantInitialVoiceCreditProxyContractAddress = storage.getAddress( + EContracts.ConstantInitialVoiceCreditProxy, + hre.network.name, + ); + + if (incremental && constantInitialVoiceCreditProxyContractAddress) { + return; + } + + const amount = + deployment.getDeployConfigField(EContracts.ConstantInitialVoiceCreditProxy, "amount") ?? + DEFAULT_INITIAL_VOICE_CREDITS; + + const constantInitialVoiceCreditProxyContract = await deployment.deployContract( + { name: EContracts.ConstantInitialVoiceCreditProxy, signer: deployer }, + amount.toString(), + ); + + await storage.register({ + id: EContracts.ConstantInitialVoiceCreditProxy, + contract: constantInitialVoiceCreditProxyContract, + args: [amount.toString()], + network: hre.network.name, + }); + }), + ); diff --git a/contracts/tasks/deploy/maci/02-gatekeepers.ts b/contracts/tasks/deploy/maci/02-gatekeepers.ts index 79ff952731..4f8594d6e1 100644 --- a/contracts/tasks/deploy/maci/02-gatekeepers.ts +++ b/contracts/tasks/deploy/maci/02-gatekeepers.ts @@ -9,9 +9,8 @@ const storage = ContractStorage.getInstance(); /** * Deploy step registration and task itself */ -deployment - .deployTask("full:deploy-gatekeepers", "Deploy gatekeepers") - .setAction(async ({ incremental }: IDeployParams, hre) => { +deployment.deployTask("full:deploy-gatekeepers", "Deploy gatekeepers").then((task) => + task.setAction(async ({ incremental }: IDeployParams, hre) => { deployment.setHre(hre); const deployer = await deployment.getDeployer(); @@ -34,11 +33,14 @@ deployment } if (!skipDeployFreeForAllGatekeeper) { - const freeFroAllGatekeeperContract = await deployment.deployContract(EContracts.FreeForAllGatekeeper, deployer); + const freeForAllGatekeeperContract = await deployment.deployContract({ + name: EContracts.FreeForAllGatekeeper, + signer: deployer, + }); await storage.register({ id: EContracts.FreeForAllGatekeeper, - contract: freeFroAllGatekeeperContract, + contract: freeForAllGatekeeperContract, args: [], network: hre.network.name, }); @@ -54,8 +56,10 @@ deployment const attester = deployment.getDeployConfigField(EContracts.EASGatekeeper, "attester", true); const easGatekeeperContract = await deployment.deployContract( - EContracts.EASGatekeeper, - deployer, + { + name: EContracts.EASGatekeeper, + signer: deployer, + }, easAddress, attester, encodedSchema, @@ -68,4 +72,5 @@ deployment network: hre.network.name, }); } - }); + }), +); diff --git a/contracts/tasks/deploy/maci/03-verifier.ts b/contracts/tasks/deploy/maci/03-verifier.ts index 59eb50e8ef..139e2c1659 100644 --- a/contracts/tasks/deploy/maci/03-verifier.ts +++ b/contracts/tasks/deploy/maci/03-verifier.ts @@ -8,9 +8,8 @@ const storage = ContractStorage.getInstance(); /** * Deploy step registration and task itself */ -deployment - .deployTask("full:deploy-verifier", "Deploy verifier") - .setAction(async ({ incremental }: IDeployParams, hre) => { +deployment.deployTask("full:deploy-verifier", "Deploy verifier").then((task) => + task.setAction(async ({ incremental }: IDeployParams, hre) => { deployment.setHre(hre); const deployer = await deployment.getDeployer(); @@ -20,7 +19,7 @@ deployment return; } - const verifierContract = await deployment.deployContract(EContracts.Verifier, deployer); + const verifierContract = await deployment.deployContract({ name: EContracts.Verifier, signer: deployer }); await storage.register({ id: EContracts.Verifier, @@ -28,4 +27,5 @@ deployment args: [], network: hre.network.name, }); - }); + }), +); diff --git a/contracts/tasks/deploy/maci/04-topupCredit.ts b/contracts/tasks/deploy/maci/04-topupCredit.ts index 31709672c3..6a5fdd44c6 100644 --- a/contracts/tasks/deploy/maci/04-topupCredit.ts +++ b/contracts/tasks/deploy/maci/04-topupCredit.ts @@ -8,9 +8,8 @@ const storage = ContractStorage.getInstance(); /** * Deploy step registration and task itself */ -deployment - .deployTask("full:deploy-topup-credit", "Deploy topup credit") - .setAction(async ({ incremental }: IDeployParams, hre) => { +deployment.deployTask("full:deploy-topup-credit", "Deploy topup credit").then((task) => + task.setAction(async ({ incremental }: IDeployParams, hre) => { deployment.setHre(hre); const deployer = await deployment.getDeployer(); @@ -20,7 +19,7 @@ deployment return; } - const topupCreditContract = await deployment.deployContract(EContracts.TopupCredit, deployer); + const topupCreditContract = await deployment.deployContract({ name: EContracts.TopupCredit, signer: deployer }); await storage.register({ id: EContracts.TopupCredit, @@ -28,4 +27,5 @@ deployment args: [], network: hre.network.name, }); - }); + }), +); diff --git a/contracts/tasks/deploy/maci/05-poseidon.ts b/contracts/tasks/deploy/maci/05-poseidon.ts index 16e374c27c..7b3871d384 100644 --- a/contracts/tasks/deploy/maci/05-poseidon.ts +++ b/contracts/tasks/deploy/maci/05-poseidon.ts @@ -8,9 +8,8 @@ const storage = ContractStorage.getInstance(); /** * Deploy step registration and task itself */ -deployment - .deployTask("full:deploy-poseidon", "Deploy poseidon contracts") - .setAction(async ({ incremental }: IDeployParams, hre) => { +deployment.deployTask("full:deploy-poseidon", "Deploy poseidon contracts").then((task) => + task.setAction(async ({ incremental }: IDeployParams, hre) => { deployment.setHre(hre); const deployer = await deployment.getDeployer(); @@ -29,10 +28,10 @@ deployment return; } - const PoseidonT3Contract = await deployment.deployContract(EContracts.PoseidonT3, deployer); - const PoseidonT4Contract = await deployment.deployContract(EContracts.PoseidonT4, deployer); - const PoseidonT5Contract = await deployment.deployContract(EContracts.PoseidonT5, deployer); - const PoseidonT6Contract = await deployment.deployContract(EContracts.PoseidonT6, deployer); + const PoseidonT3Contract = await deployment.deployContract({ name: EContracts.PoseidonT3, signer: deployer }); + const PoseidonT4Contract = await deployment.deployContract({ name: EContracts.PoseidonT4, signer: deployer }); + const PoseidonT5Contract = await deployment.deployContract({ name: EContracts.PoseidonT5, signer: deployer }); + const PoseidonT6Contract = await deployment.deployContract({ name: EContracts.PoseidonT6, signer: deployer }); await Promise.all([ storage.register({ @@ -60,4 +59,5 @@ deployment network: hre.network.name, }), ]); - }); + }), +); diff --git a/contracts/tasks/deploy/maci/06-pollFactory.ts b/contracts/tasks/deploy/maci/06-pollFactory.ts index e48828db68..a9cff0efb9 100644 --- a/contracts/tasks/deploy/maci/06-pollFactory.ts +++ b/contracts/tasks/deploy/maci/06-pollFactory.ts @@ -8,9 +8,8 @@ const storage = ContractStorage.getInstance(); /** * Deploy step registration and task itself */ -deployment - .deployTask("full:deploy-poll-factory", "Deploy poll factory") - .setAction(async ({ incremental }: IDeployParams, hre) => { +deployment.deployTask("full:deploy-poll-factory", "Deploy poll factory").then((task) => + task.setAction(async ({ incremental }: IDeployParams, hre) => { deployment.setHre(hre); const deployer = await deployment.getDeployer(); @@ -25,14 +24,15 @@ deployment const poseidonT5ContractAddress = storage.mustGetAddress(EContracts.PoseidonT5, hre.network.name); const poseidonT6ContractAddress = storage.mustGetAddress(EContracts.PoseidonT6, hre.network.name); - const linkedPollFactoryContract = await deployment.linkPoseidonLibraries( - EContracts.PollFactory, - poseidonT3ContractAddress, - poseidonT4ContractAddress, - poseidonT5ContractAddress, - poseidonT6ContractAddress, - deployer, - ); + const linkedPollFactoryContract = await hre.ethers.getContractFactory(EContracts.PollFactory, { + signer: deployer, + libraries: { + PoseidonT3: poseidonT3ContractAddress, + PoseidonT4: poseidonT4ContractAddress, + PoseidonT5: poseidonT5ContractAddress, + PoseidonT6: poseidonT6ContractAddress, + }, + }); const pollFactoryContract = await deployment.deployContractWithLinkedLibraries(linkedPollFactoryContract); @@ -42,4 +42,5 @@ deployment args: [], network: hre.network.name, }); - }); + }), +); diff --git a/contracts/tasks/deploy/maci/07-messageProcessorFactory.ts b/contracts/tasks/deploy/maci/07-messageProcessorFactory.ts index 640e22c079..08f38dcf91 100644 --- a/contracts/tasks/deploy/maci/07-messageProcessorFactory.ts +++ b/contracts/tasks/deploy/maci/07-messageProcessorFactory.ts @@ -8,9 +8,8 @@ const storage = ContractStorage.getInstance(); /** * Deploy step registration and task itself */ -deployment - .deployTask("full:deploy-message-processor-factory", "Deploy message processor factory") - .setAction(async ({ incremental }: IDeployParams, hre) => { +deployment.deployTask("full:deploy-message-processor-factory", "Deploy message processor factory").then((task) => + task.setAction(async ({ incremental }: IDeployParams, hre) => { deployment.setHre(hre); const deployer = await deployment.getDeployer(); @@ -28,13 +27,17 @@ deployment const poseidonT5ContractAddress = storage.mustGetAddress(EContracts.PoseidonT5, hre.network.name); const poseidonT6ContractAddress = storage.mustGetAddress(EContracts.PoseidonT6, hre.network.name); - const linkedMessageProcessorFactoryContract = await deployment.linkPoseidonLibraries( + const linkedMessageProcessorFactoryContract = await hre.ethers.getContractFactory( EContracts.MessageProcessorFactory, - poseidonT3ContractAddress, - poseidonT4ContractAddress, - poseidonT5ContractAddress, - poseidonT6ContractAddress, - deployer, + { + signer: deployer, + libraries: { + PoseidonT3: poseidonT3ContractAddress, + PoseidonT4: poseidonT4ContractAddress, + PoseidonT5: poseidonT5ContractAddress, + PoseidonT6: poseidonT6ContractAddress, + }, + }, ); const messageProcessorFactoryContract = await deployment.deployContractWithLinkedLibraries( @@ -47,4 +50,5 @@ deployment args: [], network: hre.network.name, }); - }); + }), +); diff --git a/contracts/tasks/deploy/maci/08-tallyFactory.ts b/contracts/tasks/deploy/maci/08-tallyFactory.ts index 090b78c590..515fc10c6d 100644 --- a/contracts/tasks/deploy/maci/08-tallyFactory.ts +++ b/contracts/tasks/deploy/maci/08-tallyFactory.ts @@ -8,9 +8,8 @@ const storage = ContractStorage.getInstance(); /** * Deploy step registration and task itself */ -deployment - .deployTask("full:deploy-tally-factory", "Deploy tally factory") - .setAction(async ({ incremental }: IDeployParams, hre) => { +deployment.deployTask("full:deploy-tally-factory", "Deploy tally factory").then((task) => + task.setAction(async ({ incremental }: IDeployParams, hre) => { deployment.setHre(hre); const deployer = await deployment.getDeployer(); @@ -25,14 +24,15 @@ deployment const poseidonT5ContractAddress = storage.mustGetAddress(EContracts.PoseidonT5, hre.network.name); const poseidonT6ContractAddress = storage.mustGetAddress(EContracts.PoseidonT6, hre.network.name); - const linkedTallyFactoryContract = await deployment.linkPoseidonLibraries( - EContracts.TallyFactory, - poseidonT3ContractAddress, - poseidonT4ContractAddress, - poseidonT5ContractAddress, - poseidonT6ContractAddress, - deployer, - ); + const linkedTallyFactoryContract = await hre.ethers.getContractFactory(EContracts.TallyFactory, { + signer: deployer, + libraries: { + PoseidonT3: poseidonT3ContractAddress, + PoseidonT4: poseidonT4ContractAddress, + PoseidonT5: poseidonT5ContractAddress, + PoseidonT6: poseidonT6ContractAddress, + }, + }); const tallyFactoryContract = await deployment.deployContractWithLinkedLibraries(linkedTallyFactoryContract); @@ -42,4 +42,5 @@ deployment args: [], network: hre.network.name, }); - }); + }), +); diff --git a/contracts/tasks/deploy/maci/09-maci.ts b/contracts/tasks/deploy/maci/09-maci.ts index 03da07c72f..746f7cd64f 100644 --- a/contracts/tasks/deploy/maci/09-maci.ts +++ b/contracts/tasks/deploy/maci/09-maci.ts @@ -13,9 +13,8 @@ const STATE_TREE_SUBDEPTH = 2; /** * Deploy step registration and task itself */ -deployment - .deployTask("full:deploy-maci", "Deploy MACI contract") - .setAction(async ({ incremental }: IDeployParams, hre) => { +deployment.deployTask("full:deploy-maci", "Deploy MACI contract").then((task) => + task.setAction(async ({ incremental }: IDeployParams, hre) => { deployment.setHre(hre); const deployer = await deployment.getDeployer(); @@ -30,14 +29,15 @@ deployment const poseidonT5ContractAddress = storage.mustGetAddress(EContracts.PoseidonT5, hre.network.name); const poseidonT6ContractAddress = storage.mustGetAddress(EContracts.PoseidonT6, hre.network.name); - const maciContractFactory = await deployment.linkPoseidonLibraries( - EContracts.MACI, - poseidonT3ContractAddress, - poseidonT4ContractAddress, - poseidonT5ContractAddress, - poseidonT6ContractAddress, - deployer, - ); + const maciContractFactory = await hre.ethers.getContractFactory(EContracts.MACI, { + signer: deployer, + libraries: { + PoseidonT3: poseidonT3ContractAddress, + PoseidonT4: poseidonT4ContractAddress, + PoseidonT5: poseidonT5ContractAddress, + PoseidonT6: poseidonT6ContractAddress, + }, + }); const constantInitialVoiceCreditProxyContractAddress = storage.mustGetAddress( EContracts.ConstantInitialVoiceCreditProxy, @@ -107,4 +107,5 @@ deployment args: [STATE_TREE_SUBDEPTH], network: hre.network.name, }); - }); + }), +); diff --git a/contracts/tasks/deploy/maci/10-vkRegistry.ts b/contracts/tasks/deploy/maci/10-vkRegistry.ts index 97d6408f03..fa933bf298 100644 --- a/contracts/tasks/deploy/maci/10-vkRegistry.ts +++ b/contracts/tasks/deploy/maci/10-vkRegistry.ts @@ -15,9 +15,8 @@ const storage = ContractStorage.getInstance(); /** * Deploy step registration and task itself */ -deployment - .deployTask("full:deploy-vk-registry", "Deploy Vk Registry and set keys") - .setAction(async ({ incremental }: IDeployParams, hre) => { +deployment.deployTask("full:deploy-vk-registry", "Deploy Vk Registry and set keys").then((task) => + task.setAction(async ({ incremental }: IDeployParams, hre) => { deployment.setHre(hre); const deployer = await deployment.getDeployer(); @@ -66,7 +65,10 @@ deployment tallyVotesZkeyPathNonQv && extractVk(tallyVotesZkeyPathNonQv), ]).then((vks) => vks.map((vk) => vk && (VerifyingKey.fromObj(vk).asContractParam() as IVerifyingKeyStruct))); - const vkRegistryContract = await deployment.deployContract(EContracts.VkRegistry, deployer); + const vkRegistryContract = await deployment.deployContract({ + name: EContracts.VkRegistry, + signer: deployer, + }); const processZkeys = [qvProcessVk, nonQvProcessVk].filter(Boolean) as IVerifyingKeyStruct[]; const tallyZkeys = [qvTallyVk, nonQvTallyQv].filter(Boolean) as IVerifyingKeyStruct[]; @@ -99,4 +101,5 @@ deployment args: [], network: hre.network.name, }); - }); + }), +); diff --git a/contracts/tasks/deploy/poll/01-poll.ts b/contracts/tasks/deploy/poll/01-poll.ts index 4660e864de..b492010199 100644 --- a/contracts/tasks/deploy/poll/01-poll.ts +++ b/contracts/tasks/deploy/poll/01-poll.ts @@ -14,54 +14,69 @@ const storage = ContractStorage.getInstance(); /** * Deploy step registration and task itself */ -deployment.deployTask("poll:deploy-poll", "Deploy poll").setAction(async (_, hre) => { - deployment.setHre(hre); - - const maciContractAddress = storage.getAddress(EContracts.MACI, hre.network.name); - const verifierContractAddress = storage.getAddress(EContracts.Verifier, hre.network.name); - const vkRegistryContractAddress = storage.getAddress(EContracts.VkRegistry, hre.network.name); - - if (!maciContractAddress) { - throw new Error("Need to deploy MACI contract first"); - } - - if (!verifierContractAddress) { - throw new Error("Need to deploy Verifier contract first"); - } - - if (!vkRegistryContractAddress) { - throw new Error("Need to deploy VkRegistry contract first"); - } - - const maciContract = await deployment.getContract({ name: EContracts.MACI }); - const pollId = await maciContract.nextPollId(); - const stateAqContractAddress = await maciContract.stateAq(); - - const stateAq = await deployment.getContract({ - name: EContracts.AccQueue, - address: stateAqContractAddress, - }); - const isTreeMerged = await stateAq.treeMerged(); - - if (pollId > 0n && !isTreeMerged) { - console.log("Previous poll is not completed"); - return; - } - - const coordinatorPubkey = deployment.getDeployConfigField(EContracts.Poll, "coordinatorPubkey"); - const pollDuration = deployment.getDeployConfigField(EContracts.Poll, "pollDuration"); - const intStateTreeDepth = deployment.getDeployConfigField(EContracts.VkRegistry, "intStateTreeDepth"); - const messageTreeSubDepth = deployment.getDeployConfigField(EContracts.VkRegistry, "messageBatchDepth"); - const messageTreeDepth = deployment.getDeployConfigField(EContracts.VkRegistry, "messageTreeDepth"); - const voteOptionTreeDepth = deployment.getDeployConfigField(EContracts.VkRegistry, "voteOptionTreeDepth"); - - const useQuadraticVoting = - deployment.getDeployConfigField(EContracts.Poll, "useQuadraticVoting") ?? false; - const unserializedKey = PubKey.deserialize(coordinatorPubkey); - const mode = useQuadraticVoting ? EMode.QV : EMode.NON_QV; - - const [pollContractAddress, messageProcessorContractAddress, tallyContractAddress] = - await maciContract.deployPoll.staticCall( +deployment.deployTask("poll:deploy-poll", "Deploy poll").then((task) => + task.setAction(async (_, hre) => { + deployment.setHre(hre); + + const maciContractAddress = storage.getAddress(EContracts.MACI, hre.network.name); + const verifierContractAddress = storage.getAddress(EContracts.Verifier, hre.network.name); + const vkRegistryContractAddress = storage.getAddress(EContracts.VkRegistry, hre.network.name); + + if (!maciContractAddress) { + throw new Error("Need to deploy MACI contract first"); + } + + if (!verifierContractAddress) { + throw new Error("Need to deploy Verifier contract first"); + } + + if (!vkRegistryContractAddress) { + throw new Error("Need to deploy VkRegistry contract first"); + } + + const maciContract = await deployment.getContract({ name: EContracts.MACI }); + const pollId = await maciContract.nextPollId(); + const stateAqContractAddress = await maciContract.stateAq(); + + const stateAq = await deployment.getContract({ + name: EContracts.AccQueue, + address: stateAqContractAddress, + }); + const isTreeMerged = await stateAq.treeMerged(); + + if (pollId > 0n && !isTreeMerged) { + console.log("Previous poll is not completed"); + return; + } + + const coordinatorPubkey = deployment.getDeployConfigField(EContracts.Poll, "coordinatorPubkey"); + const pollDuration = deployment.getDeployConfigField(EContracts.Poll, "pollDuration"); + const intStateTreeDepth = deployment.getDeployConfigField(EContracts.VkRegistry, "intStateTreeDepth"); + const messageTreeSubDepth = deployment.getDeployConfigField(EContracts.VkRegistry, "messageBatchDepth"); + const messageTreeDepth = deployment.getDeployConfigField(EContracts.VkRegistry, "messageTreeDepth"); + const voteOptionTreeDepth = deployment.getDeployConfigField(EContracts.VkRegistry, "voteOptionTreeDepth"); + + const useQuadraticVoting = + deployment.getDeployConfigField(EContracts.Poll, "useQuadraticVoting") ?? false; + const unserializedKey = PubKey.deserialize(coordinatorPubkey); + const mode = useQuadraticVoting ? EMode.QV : EMode.NON_QV; + + const [pollContractAddress, messageProcessorContractAddress, tallyContractAddress] = + await maciContract.deployPoll.staticCall( + pollDuration, + { + intStateTreeDepth, + messageTreeSubDepth, + messageTreeDepth, + voteOptionTreeDepth, + }, + unserializedKey.asContractParam(), + verifierContractAddress, + vkRegistryContractAddress, + mode, + ); + + const tx = await maciContract.deployPoll( pollDuration, { intStateTreeDepth, @@ -75,93 +90,80 @@ deployment.deployTask("poll:deploy-poll", "Deploy poll").setAction(async (_, hre mode, ); - const tx = await maciContract.deployPoll( - pollDuration, - { - intStateTreeDepth, - messageTreeSubDepth, - messageTreeDepth, - voteOptionTreeDepth, - }, - unserializedKey.asContractParam(), - verifierContractAddress, - vkRegistryContractAddress, - mode, - ); - - const receipt = await tx.wait(); - - if (receipt?.status !== 1) { - throw new Error("Deploy poll transaction is failed"); - } - - const pollContract = await deployment.getContract({ name: EContracts.Poll, address: pollContractAddress }); - const [maxValues, extContracts] = await Promise.all([pollContract.maxValues(), pollContract.extContracts()]); - - const messageProcessorContract = await deployment.getContract({ - name: EContracts.MessageProcessor, - address: messageProcessorContractAddress, - }); - - const tallyContract = await deployment.getContract({ - name: EContracts.Tally, - address: tallyContractAddress, - }); - - const messageAccQueueContract = await deployment.getContract({ - name: EContracts.AccQueueQuinaryMaci, - address: extContracts[1], - }); - - await Promise.all([ - storage.register({ - id: EContracts.Poll, - key: `poll-${pollId}`, - contract: pollContract, - args: [ - pollDuration, - maxValues.map((value) => value.toString()), - { - intStateTreeDepth, - messageTreeSubDepth, - messageTreeDepth, - voteOptionTreeDepth, - }, - unserializedKey.asContractParam(), - extContracts, - ], - network: hre.network.name, - }), - - storage.register({ - id: EContracts.MessageProcessor, - key: `poll-${pollId}`, - contract: messageProcessorContract, - args: [verifierContractAddress, vkRegistryContractAddress, pollContractAddress, mode], - network: hre.network.name, - }), - - storage.register({ - id: EContracts.Tally, - key: `poll-${pollId}`, - contract: tallyContract, - args: [ - verifierContractAddress, - vkRegistryContractAddress, - pollContractAddress, - messageProcessorContractAddress, - mode, - ], - network: hre.network.name, - }), - - storage.register({ - id: EContracts.AccQueueQuinaryMaci, - key: `poll-${pollId}`, - name: "contracts/trees/AccQueueQuinaryMaci.sol:AccQueueQuinaryMaci", - contract: messageAccQueueContract, - args: [messageTreeSubDepth], - network: hre.network.name, - }), - ]); -}); + const receipt = await tx.wait(); + + if (receipt?.status !== 1) { + throw new Error("Deploy poll transaction is failed"); + } + + const pollContract = await deployment.getContract({ name: EContracts.Poll, address: pollContractAddress }); + const [maxValues, extContracts] = await Promise.all([pollContract.maxValues(), pollContract.extContracts()]); + + const messageProcessorContract = await deployment.getContract({ + name: EContracts.MessageProcessor, + address: messageProcessorContractAddress, + }); + + const tallyContract = await deployment.getContract({ + name: EContracts.Tally, + address: tallyContractAddress, + }); + + const messageAccQueueContract = await deployment.getContract({ + name: EContracts.AccQueueQuinaryMaci, + address: extContracts[1], + }); + + await Promise.all([ + storage.register({ + id: EContracts.Poll, + key: `poll-${pollId}`, + contract: pollContract, + args: [ + pollDuration, + maxValues.map((value) => value.toString()), + { + intStateTreeDepth, + messageTreeSubDepth, + messageTreeDepth, + voteOptionTreeDepth, + }, + unserializedKey.asContractParam(), + extContracts, + ], + network: hre.network.name, + }), + + storage.register({ + id: EContracts.MessageProcessor, + key: `poll-${pollId}`, + contract: messageProcessorContract, + args: [verifierContractAddress, vkRegistryContractAddress, pollContractAddress, mode], + network: hre.network.name, + }), + + storage.register({ + id: EContracts.Tally, + key: `poll-${pollId}`, + contract: tallyContract, + args: [ + verifierContractAddress, + vkRegistryContractAddress, + pollContractAddress, + messageProcessorContractAddress, + mode, + ], + network: hre.network.name, + }), + + storage.register({ + id: EContracts.AccQueueQuinaryMaci, + key: `poll-${pollId}`, + name: "contracts/trees/AccQueueQuinaryMaci.sol:AccQueueQuinaryMaci", + contract: messageAccQueueContract, + args: [messageTreeSubDepth], + network: hre.network.name, + }), + ]); + }), +); diff --git a/contracts/tasks/helpers/ContractStorage.ts b/contracts/tasks/helpers/ContractStorage.ts index 1502a97b2d..4112b0c922 100644 --- a/contracts/tasks/helpers/ContractStorage.ts +++ b/contracts/tasks/helpers/ContractStorage.ts @@ -2,6 +2,8 @@ import low from "lowdb"; import FileSync from "lowdb/adapters/FileSync"; +import path from "path"; + import type { EContracts, IRegisterContract, IStorageInstanceEntry, IStorageNamedEntry } from "./types"; /** @@ -38,7 +40,7 @@ export class ContractStorage { * Initialize class properties only once */ private constructor() { - this.db = low(new FileSync("./deployed-contracts.json")); + this.db = low(new FileSync(path.resolve(__dirname, "..", "..", "./deployed-contracts.json"))); } /** diff --git a/contracts/tasks/helpers/Deployment.ts b/contracts/tasks/helpers/Deployment.ts index fb9858220a..5055a90d20 100644 --- a/contracts/tasks/helpers/Deployment.ts +++ b/contracts/tasks/helpers/Deployment.ts @@ -1,17 +1,24 @@ /* eslint-disable no-console */ /* eslint-disable import/no-extraneous-dependencies */ import { BaseContract, ContractFactory, Signer } from "ethers"; -import { task } from "hardhat/config"; import low from "lowdb"; import FileSync from "lowdb/adapters/FileSync"; -import { exit } from "process"; +import path from "path"; +import type { TAbi } from "./types"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; import type { ConfigurableTaskDefinition, HardhatRuntimeEnvironment, TaskArguments } from "hardhat/types"; import { ContractStorage } from "./ContractStorage"; -import { EContracts, IDeployParams, IDeployStep, IDeployStepCatalog, IGetContractParams } from "./types"; +import { + EContracts, + IDeployContractArgs, + IDeployParams, + IDeployStep, + IDeployStepCatalog, + IGetContractParams, +} from "./types"; /** * Internal deploy config structure type. @@ -56,7 +63,7 @@ export class Deployment { ["poll", []], ]); this.hre = hre; - this.config = low(new FileSync("./deploy-config.json")); + this.config = low(new FileSync(path.resolve(__dirname, "..", "..", "./deploy-config.json"))); this.storage = ContractStorage.getInstance(); } @@ -186,7 +193,7 @@ export class Deployment { if (!success) { console.log("\nDeployment has failed"); - exit(1); + await import("process").then(({ exit }) => exit(1)); } console.log("\nDeployment has finished"); @@ -231,17 +238,17 @@ export class Deployment { * @param taskName - unique task name * @param stepName - task description * @param paramsFn - optional function to override default task arguments - * @returns {ConfigurableTaskDefinition} hardhat task definition + * @returns {Promise} hardhat task definition */ - deployTask( + async deployTask( taskName: string, stepName: string, paramsFn?: (params: IDeployParams) => Promise, - ): ConfigurableTaskDefinition { + ): Promise { const deployType = taskName.substring(0, taskName.indexOf(":")); this.addStep(deployType, { name: stepName, taskName, paramsFn: paramsFn || this.getDefaultParams }); - return task(taskName, stepName); + return import("hardhat/config").then(({ task }) => task(taskName, stepName)); } /** @@ -302,14 +309,14 @@ export class Deployment { * @returns deployed contract */ async deployContract( - contractName: EContracts, - signer?: Signer, + { name, abi, bytecode, signer }: IDeployContractArgs, ...args: unknown[] ): Promise { - const { ethers } = await import("hardhat"); - const deployer = signer || (await this.getDeployer()); - const contractFactory = await ethers.getContractFactory(contractName, deployer); + const contractFactory = + abi && bytecode + ? new ContractFactory(abi, bytecode, deployer) + : await import("hardhat").then(({ ethers }) => ethers.getContractFactory(name, deployer)); const feeData = await deployer.provider?.getFeeData(); const contract = await contractFactory.deploy(...args, { @@ -345,37 +352,18 @@ export class Deployment { } /** - * Link poseidon libraries with contract factory and return it + * Creates contract factory from abi and bytecode * * @param name - contract name - * @param poseidonT3Address - PoseidonT3 contract address - * @param poseidonT4Address - PoseidonT4 contract address - * @param poseidonT5Address - PoseidonT5 contract address - * @param poseidonT6Address - PoseidonT6 contract address + * @param abi - Contract abi + * @param bytecode - Contract linked bytecode * @param signer - signer * @returns contract factory with linked libraries */ - async linkPoseidonLibraries( - name: EContracts, - poseidonT3Address: string, - poseidonT4Address: string, - poseidonT5Address: string, - poseidonT6Address: string, - signer?: Signer, - ): Promise { - const { ethers } = await import("hardhat"); - - const contractFactory = await ethers.getContractFactory(name, { - signer: signer || (await this.getDeployer()), - libraries: { - PoseidonT3: poseidonT3Address, - PoseidonT4: poseidonT4Address, - PoseidonT5: poseidonT5Address, - PoseidonT6: poseidonT6Address, - }, - }); + async createContractFactory(abi: TAbi, bytecode: string, signer?: Signer): Promise { + const deployer = signer || (await this.getDeployer()); - return contractFactory; + return new ContractFactory(abi, bytecode, deployer); } /** diff --git a/contracts/tasks/helpers/abi.ts b/contracts/tasks/helpers/abi.ts new file mode 100644 index 0000000000..114b58a3b5 --- /dev/null +++ b/contracts/tasks/helpers/abi.ts @@ -0,0 +1,25 @@ +import type { MACILibraryAddresses } from "../../typechain-types/factories/contracts/MACI__factory"; +import type { MessageProcessorLibraryAddresses } from "../../typechain-types/factories/contracts/MessageProcessor__factory"; +import type { PollFactoryLibraryAddresses } from "../../typechain-types/factories/contracts/PollFactory__factory"; +import type { TallyLibraryAddresses } from "../../typechain-types/factories/contracts/Tally__factory"; + +/** + * Create linked contract addresses object + * + * @param poseidonT3ContractAddress - PoseidonT3 contract address + * @param poseidonT4ContractAddress - PoseidonT4 contract address + * @param poseidonT5ContractAddress - PoseidonT5 contract address + * @param poseidonT6ContractAddress - PoseidonT6 contract address + * @returns + */ +export const linkPoseidonLibraries = ( + poseidonT3ContractAddress: string, + poseidonT4ContractAddress: string, + poseidonT5ContractAddress: string, + poseidonT6ContractAddress: string, +): TallyLibraryAddresses | MessageProcessorLibraryAddresses | MACILibraryAddresses | PollFactoryLibraryAddresses => ({ + "contracts/crypto/PoseidonT3.sol:PoseidonT3": poseidonT3ContractAddress, + "contracts/crypto/PoseidonT4.sol:PoseidonT4": poseidonT4ContractAddress, + "contracts/crypto/PoseidonT5.sol:PoseidonT5": poseidonT5ContractAddress, + "contracts/crypto/PoseidonT6.sol:PoseidonT6": poseidonT6ContractAddress, +}); diff --git a/contracts/tasks/helpers/types.ts b/contracts/tasks/helpers/types.ts index 5ca5ed179d..452201e3ce 100644 --- a/contracts/tasks/helpers/types.ts +++ b/contracts/tasks/helpers/types.ts @@ -1,6 +1,6 @@ import type { AccQueue, MACI, MessageProcessor, Poll, Tally, Verifier, VkRegistry } from "../../typechain-types"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import type { BaseContract, BigNumberish, Signer } from "ethers"; +import type { BaseContract, BigNumberish, Fragment, JsonFragment, Signer } from "ethers"; import type { Libraries, TaskArguments } from "hardhat/types"; import type { Poll as PollWrapper } from "maci-core"; import type { Keypair, PrivKey } from "maci-domainobjs"; @@ -653,3 +653,31 @@ export interface TallyData { commitment: string; }; } + +// a type representing the ABI of a contract +export type TAbi = string | readonly (string | Fragment | JsonFragment)[]; + +/** + * Interface that represents deploy params + */ +export interface IDeployContractArgs { + /** + * Contract name + */ + name: EContracts; + + /** + * Contract abi + */ + abi?: TAbi; + + /** + * Contract bytecode + */ + bytecode?: string; + + /** + * Eth signer + */ + signer?: Signer; +} diff --git a/contracts/tests/AccQueue.test.ts b/contracts/tests/AccQueue.test.ts index 69d2ae673a..1929218b9e 100644 --- a/contracts/tests/AccQueue.test.ts +++ b/contracts/tests/AccQueue.test.ts @@ -1,7 +1,13 @@ import { expect } from "chai"; import { AccQueue, hashLeftRight, NOTHING_UP_MY_SLEEVE } from "maci-crypto"; -import { AccQueue as AccQueueContract } from "../typechain-types"; +import { + AccQueueBinary0__factory as AccQueueBinary0Factory, + AccQueueBinaryMaci__factory as AccQueueBinaryMaciFactory, + AccQueue as AccQueueContract, + AccQueueQuinary0__factory as AccQueueQuinary0Factory, + AccQueueQuinaryMaci__factory as AccQueueQuinaryMaciFactory, +} from "../typechain-types"; import { deployTestAccQueues, @@ -26,7 +32,7 @@ describe("AccQueues", () => { let aqContract: AccQueueContract; before(async () => { - const r = await deployTestAccQueues("AccQueueBinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueBinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); aqContract = r.aqContract as AccQueueContract; }); @@ -50,7 +56,7 @@ describe("AccQueues", () => { let aqContract: AccQueueContract; before(async () => { - const r = await deployTestAccQueues("AccQueueQuinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueQuinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); aqContract = r.aqContract as AccQueueContract; }); @@ -75,7 +81,7 @@ describe("AccQueues", () => { let aqContract: AccQueueContract; before(async () => { - const r = await deployTestAccQueues("AccQueueBinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueBinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); aq = r.aq; aqContract = r.aqContract as AccQueueContract; }); @@ -105,7 +111,7 @@ describe("AccQueues", () => { let aqContract: AccQueueContract; before(async () => { - const r = await deployTestAccQueues("AccQueueQuinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueQuinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); aq = r.aq; aqContract = r.aqContract as AccQueueContract; }); @@ -135,7 +141,7 @@ describe("AccQueues", () => { let aqContract: AccQueueContract; before(async () => { - const r = await deployTestAccQueues("AccQueueBinaryMaci", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueBinaryMaciFactory, SUB_DEPTH, HASH_LENGTH, ZERO); aq = r.aq; aqContract = r.aqContract as AccQueueContract; }); @@ -165,7 +171,7 @@ describe("AccQueues", () => { let aqContract: AccQueueContract; before(async () => { - const r = await deployTestAccQueues("AccQueueQuinaryMaci", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueQuinaryMaciFactory, SUB_DEPTH, HASH_LENGTH, ZERO); aq = r.aq; aqContract = r.aqContract as AccQueueContract; }); @@ -194,7 +200,7 @@ describe("AccQueues", () => { const MAIN_DEPTH = 3; it("should produce the correct main roots", async () => { - const r = await deployTestAccQueues("AccQueueBinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueBinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); await testMergeAgain(r.aq, r.aqContract as AccQueueContract, MAIN_DEPTH); }); }); @@ -205,7 +211,7 @@ describe("AccQueues", () => { const ZERO = BigInt(0); it("should not be possible to merge into a tree of depth 0", async () => { - const r = await deployTestAccQueues("AccQueueBinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueBinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); const aqContract = r.aqContract as AccQueueContract; await aqContract.enqueue(1).then((tx) => tx.wait()); @@ -217,7 +223,7 @@ describe("AccQueues", () => { }); it("A small SRT of depth 1 should just have 2 leaves", async () => { - const r = await deployTestAccQueues("AccQueueBinary0", 1, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueBinary0Factory, 1, HASH_LENGTH, ZERO); const aqContract = r.aqContract as AccQueueContract; await aqContract.enqueue(0, enqueueGasLimit).then((tx) => tx.wait()); @@ -228,7 +234,7 @@ describe("AccQueues", () => { }); it("should not be possible to merge subroots into a tree shorter than the SRT depth", async () => { - const r = await deployTestAccQueues("AccQueueBinary0", 1, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueBinary0Factory, 1, HASH_LENGTH, ZERO); const aqContract = r.aqContract as AccQueueContract; for (let i = 0; i < 4; i += 1) { // eslint-disable-next-line no-await-in-loop @@ -246,7 +252,7 @@ describe("AccQueues", () => { it("Merging without enqueuing new data should not change the root", async () => { const MAIN_DEPTH = 5; - const r = await deployTestAccQueues("AccQueueBinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueBinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); const { aq } = r; const aqContract = r.aqContract as AccQueueContract; @@ -272,7 +278,7 @@ describe("AccQueues", () => { const testParams = [1, 2, 3, 4]; testParams.forEach((testParam) => { it(`should merge ${testParam} subtrees`, async () => { - const r = await deployTestAccQueues("AccQueueBinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueBinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); const { aq } = r; const aqContract = r.aqContract as AccQueueContract; await testMerge(aq, aqContract, testParam, MAIN_DEPTH); @@ -289,7 +295,7 @@ describe("AccQueues", () => { const testParams = [1, 5, 26]; testParams.forEach((testParam) => { it(`should merge ${testParam} subtrees`, async () => { - const r = await deployTestAccQueues("AccQueueQuinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueQuinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); const { aq } = r; const aqContract = r.aqContract as AccQueueContract; await testMerge(aq, aqContract, testParam, MAIN_DEPTH); @@ -304,7 +310,7 @@ describe("AccQueues", () => { const ZERO = BigInt(0); it("Enqueued leaves and inserted subtrees should be in the right order", async () => { - const r = await deployTestAccQueues("AccQueueBinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueBinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); const { aq } = r; const aqContract = r.aqContract as AccQueueContract; await testEnqueueAndInsertSubTree(aq, aqContract); @@ -313,7 +319,7 @@ describe("AccQueues", () => { const testParams = [1, 2, 3, 9]; testParams.forEach((testParam) => { it(`should insert ${testParam} subtrees`, async () => { - const r = await deployTestAccQueues("AccQueueBinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueBinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); const { aq } = r; const aqContract = r.aqContract as AccQueueContract; await testInsertSubTrees(aq, aqContract, testParam, MAIN_DEPTH); @@ -328,7 +334,7 @@ describe("AccQueues", () => { const ZERO = BigInt(0); it("Enqueued leaves and inserted subtrees should be in the right order", async () => { - const r = await deployTestAccQueues("AccQueueQuinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueQuinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); const { aq } = r; const aqContract = r.aqContract as AccQueueContract; await testEnqueueAndInsertSubTree(aq, aqContract); @@ -337,7 +343,7 @@ describe("AccQueues", () => { const testParams = [1, 4, 9, 26]; testParams.forEach((testParam) => { it(`should insert ${testParam} subtrees`, async () => { - const r = await deployTestAccQueues("AccQueueQuinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueQuinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); const { aq } = r; const aqContract = r.aqContract as AccQueueContract; await testInsertSubTrees(aq, aqContract, testParam, MAIN_DEPTH); @@ -355,7 +361,7 @@ describe("AccQueues", () => { let aqContract: AccQueueContract; before(async () => { - const r = await deployTestAccQueues("AccQueueBinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueBinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); aq = r.aq; aqContract = r.aqContract as AccQueueContract; }); @@ -404,7 +410,7 @@ describe("AccQueues", () => { let aqContract: AccQueueContract; before(async () => { - const r = await deployTestAccQueues("AccQueueQuinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueQuinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); aq = r.aq; aqContract = r.aqContract as AccQueueContract; }); @@ -451,7 +457,7 @@ describe("AccQueues", () => { let aqContract: AccQueueContract; before(async () => { - const r = await deployTestAccQueues("AccQueueBinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deployTestAccQueues(AccQueueBinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); aqContract = r.aqContract as AccQueueContract; }); diff --git a/contracts/tests/AccQueueBenchmark.test.ts b/contracts/tests/AccQueueBenchmark.test.ts index 14beee079a..981ea51769 100644 --- a/contracts/tests/AccQueueBenchmark.test.ts +++ b/contracts/tests/AccQueueBenchmark.test.ts @@ -1,13 +1,24 @@ import { expect } from "chai"; import { AccQueue, NOTHING_UP_MY_SLEEVE } from "maci-crypto"; -import { deployPoseidonContracts, linkPoseidonLibraries } from "../ts/deploy"; +import { linkPoseidonLibraries } from "../tasks/helpers/abi"; +import { deployPoseidonContracts, createContractFactory } from "../ts/deploy"; import { getDefaultSigner } from "../ts/utils"; -import { AccQueue as AccQueueContract } from "../typechain-types"; +import { + AccQueueBinary0__factory as AccQueueBinary0Factory, + AccQueue as AccQueueContract, + AccQueueQuinary0__factory as AccQueueQuinary0Factory, + AccQueueQuinaryMaci__factory as AccQueueQuinaryMaciFactory, +} from "../typechain-types"; let aqContract: AccQueueContract; -const deploy = async (contractName: string, SUB_DEPTH: number, HASH_LENGTH: number, ZERO: bigint) => { +const deploy = async ( + factory: typeof AccQueueBinary0Factory | typeof AccQueueQuinary0Factory | typeof AccQueueQuinaryMaciFactory, + SUB_DEPTH: number, + HASH_LENGTH: number, + ZERO: bigint, +) => { const { PoseidonT3Contract, PoseidonT4Contract, PoseidonT5Contract, PoseidonT6Contract } = await deployPoseidonContracts(await getDefaultSigner(), {}, true); const [poseidonT3ContractAddress, poseidonT4ContractAddress, poseidonT5ContractAddress, poseidonT6ContractAddress] = @@ -19,14 +30,17 @@ const deploy = async (contractName: string, SUB_DEPTH: number, HASH_LENGTH: numb ]); // Link Poseidon contracts - const AccQueueFactory = await linkPoseidonLibraries( - contractName, - poseidonT3ContractAddress, - poseidonT4ContractAddress, - poseidonT5ContractAddress, - poseidonT6ContractAddress, + const AccQueueFactory = await createContractFactory( + factory.abi, + factory.linkBytecode( + linkPoseidonLibraries( + poseidonT3ContractAddress, + poseidonT4ContractAddress, + poseidonT5ContractAddress, + poseidonT6ContractAddress, + ), + ), await getDefaultSigner(), - true, ); aqContract = (await AccQueueFactory.deploy(SUB_DEPTH)) as typeof aqContract; @@ -116,7 +130,7 @@ describe("AccQueue gas benchmarks", () => { const HASH_LENGTH = 2; const ZERO = BigInt(0); before(async () => { - const r = await deploy("AccQueueBinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deploy(AccQueueBinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); aqContract = r.aqContract; }); @@ -137,7 +151,7 @@ describe("AccQueue gas benchmarks", () => { const HASH_LENGTH = 2; const ZERO = BigInt(0); before(async () => { - const r = await deploy("AccQueueBinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deploy(AccQueueBinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); aqContract = r.aqContract; }); @@ -160,7 +174,7 @@ describe("AccQueue gas benchmarks", () => { const HASH_LENGTH = 5; const ZERO = BigInt(0); before(async () => { - const r = await deploy("AccQueueQuinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deploy(AccQueueQuinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); aqContract = r.aqContract; }); @@ -181,7 +195,7 @@ describe("AccQueue gas benchmarks", () => { const HASH_LENGTH = 5; const ZERO = NOTHING_UP_MY_SLEEVE; before(async () => { - const r = await deploy("AccQueueQuinaryMaci", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deploy(AccQueueQuinaryMaciFactory, SUB_DEPTH, HASH_LENGTH, ZERO); aqContract = r.aqContract; }); @@ -207,7 +221,7 @@ describe("AccQueue gas benchmarks", () => { const NUM_SUBTREES = 32; let aq: AccQueue; before(async () => { - const r = await deploy("AccQueueBinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deploy(AccQueueBinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); aq = r.aq; aqContract = r.aqContract; }); @@ -226,7 +240,7 @@ describe("AccQueue gas benchmarks", () => { const NUM_MERGES = 4; let aq: AccQueue; before(async () => { - const r = await deploy("AccQueueBinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deploy(AccQueueBinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); aq = r.aq; aqContract = r.aqContract; }); @@ -244,7 +258,7 @@ describe("AccQueue gas benchmarks", () => { const NUM_SUBTREES = 25; let aq: AccQueue; before(async () => { - const r = await deploy("AccQueueQuinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deploy(AccQueueQuinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); aq = r.aq; aqContract = r.aqContract; }); @@ -264,7 +278,7 @@ describe("AccQueue gas benchmarks", () => { let aq: AccQueue; before(async () => { - const r = await deploy("AccQueueQuinary0", SUB_DEPTH, HASH_LENGTH, ZERO); + const r = await deploy(AccQueueQuinary0Factory, SUB_DEPTH, HASH_LENGTH, ZERO); aq = r.aq; aqContract = r.aqContract; }); diff --git a/contracts/tests/Hasher.test.ts b/contracts/tests/Hasher.test.ts index 134ef19811..c946c0df69 100644 --- a/contracts/tests/Hasher.test.ts +++ b/contracts/tests/Hasher.test.ts @@ -2,9 +2,10 @@ import { expect } from "chai"; import { BigNumberish } from "ethers"; import { sha256Hash, hashLeftRight, hash3, hash4, hash5, genRandomSalt } from "maci-crypto"; -import { deployPoseidonContracts, linkPoseidonLibraries } from "../ts/deploy"; +import { linkPoseidonLibraries } from "../tasks/helpers/abi"; +import { deployPoseidonContracts, createContractFactory } from "../ts/deploy"; import { getDefaultSigner } from "../ts/utils"; -import { Hasher } from "../typechain-types"; +import { Hasher, Hasher__factory as HasherFactory } from "../typechain-types"; describe("Hasher", () => { let hasherContract: Hasher; @@ -20,14 +21,17 @@ describe("Hasher", () => { PoseidonT6Contract.getAddress(), ]); // Link Poseidon contracts - const hasherContractFactory = await linkPoseidonLibraries( - "Hasher", - poseidonT3ContractAddress, - poseidonT4ContractAddress, - poseidonT5ContractAddress, - poseidonT6ContractAddress, + const hasherContractFactory = await createContractFactory( + HasherFactory.abi, + HasherFactory.linkBytecode( + linkPoseidonLibraries( + poseidonT3ContractAddress, + poseidonT4ContractAddress, + poseidonT5ContractAddress, + poseidonT6ContractAddress, + ), + ), await getDefaultSigner(), - true, ); hasherContract = (await hasherContractFactory.deploy()) as Hasher; diff --git a/contracts/tests/HasherBenchmarks.test.ts b/contracts/tests/HasherBenchmarks.test.ts index 588a8b56bb..7ab2bd88bc 100644 --- a/contracts/tests/HasherBenchmarks.test.ts +++ b/contracts/tests/HasherBenchmarks.test.ts @@ -2,12 +2,14 @@ import { expect } from "chai"; import { BigNumberish } from "ethers"; import { genRandomSalt } from "maci-crypto"; -import { deployPoseidonContracts, linkPoseidonLibraries } from "../ts/deploy"; +import { linkPoseidonLibraries } from "../tasks/helpers/abi"; +import { deployPoseidonContracts, createContractFactory } from "../ts/deploy"; import { getDefaultSigner } from "../ts/utils"; -import { HasherBenchmarks } from "../typechain-types"; +import { HasherBenchmarks, HasherBenchmarks__factory as HasherBenchmarksFactory } from "../typechain-types"; describe("Hasher", () => { let hasherContract: HasherBenchmarks; + before(async () => { const { PoseidonT3Contract, PoseidonT4Contract, PoseidonT5Contract, PoseidonT6Contract } = await deployPoseidonContracts(await getDefaultSigner(), {}, true); @@ -19,14 +21,17 @@ describe("Hasher", () => { PoseidonT6Contract.getAddress(), ]); // Link Poseidon contracts - const hasherContractFactory = await linkPoseidonLibraries( - "HasherBenchmarks", - poseidonT3ContractAddress, - poseidonT4ContractAddress, - poseidonT5ContractAddress, - poseidonT6ContractAddress, + const hasherContractFactory = await createContractFactory( + HasherBenchmarksFactory.abi, + HasherBenchmarksFactory.linkBytecode( + linkPoseidonLibraries( + poseidonT3ContractAddress, + poseidonT4ContractAddress, + poseidonT5ContractAddress, + poseidonT6ContractAddress, + ), + ), await getDefaultSigner(), - true, ); hasherContract = (await hasherContractFactory.deploy()) as HasherBenchmarks; diff --git a/contracts/tests/Utilities.test.ts b/contracts/tests/Utilities.test.ts index 46ed5f7849..2b57d56854 100644 --- a/contracts/tests/Utilities.test.ts +++ b/contracts/tests/Utilities.test.ts @@ -2,9 +2,10 @@ import { expect } from "chai"; import { BigNumberish, ZeroAddress } from "ethers"; import { StateLeaf, Keypair } from "maci-domainobjs"; -import { deployPoseidonContracts, linkPoseidonLibraries } from "../ts/deploy"; +import { linkPoseidonLibraries } from "../tasks/helpers/abi"; +import { deployPoseidonContracts, createContractFactory } from "../ts/deploy"; import { getDefaultSigner } from "../ts/utils"; -import { Utilities } from "../typechain-types"; +import { Utilities, Utilities__factory as UtilitiesFactory } from "../typechain-types"; describe("Utilities", () => { let utilitiesContract: Utilities; @@ -27,14 +28,17 @@ describe("Utilities", () => { ]); // Link Poseidon contracts - const utilitiesContractFactory = await linkPoseidonLibraries( - "Utilities", - poseidonT3ContractAddress, - poseidonT4ContractAddress, - poseidonT5ContractAddress, - poseidonT6ContractAddress, + const utilitiesContractFactory = await createContractFactory( + UtilitiesFactory.abi, + UtilitiesFactory.linkBytecode( + linkPoseidonLibraries( + poseidonT3ContractAddress, + poseidonT4ContractAddress, + poseidonT5ContractAddress, + poseidonT6ContractAddress, + ), + ), await getDefaultSigner(), - true, ); utilitiesContract = (await utilitiesContractFactory.deploy()) as Utilities; diff --git a/contracts/tests/utils.ts b/contracts/tests/utils.ts index ab3fdb5925..12b0baf132 100644 --- a/contracts/tests/utils.ts +++ b/contracts/tests/utils.ts @@ -6,6 +6,7 @@ import { IVkContractParams, VerifyingKey } from "maci-domainobjs"; import type { EthereumProvider } from "hardhat/types"; +import { linkPoseidonLibraries } from "../tasks/helpers/abi"; import { getDefaultSigner } from "../ts"; import { deployConstantInitialVoiceCreditProxy, @@ -15,10 +16,17 @@ import { deployPoseidonContracts, deployTopupCredit, deployVkRegistry, - linkPoseidonLibraries, + createContractFactory, } from "../ts/deploy"; import { IDeployedTestContracts } from "../ts/types"; -import { AccQueue as AccQueueContract, FreeForAllGatekeeper } from "../typechain-types"; +import { + AccQueueBinary0__factory as AccQueueBinary0Factory, + AccQueueBinaryMaci__factory as AccQueueBinaryMaciFactory, + AccQueue as AccQueueContract, + AccQueueQuinary0__factory as AccQueueQuinary0Factory, + AccQueueQuinaryMaci__factory as AccQueueQuinaryMaciFactory, + FreeForAllGatekeeper, +} from "../typechain-types"; export const insertSubTreeGasLimit = { gasLimit: 300000 }; export const enqueueGasLimit = { gasLimit: 500000 }; @@ -70,7 +78,11 @@ export const compareVks = (vk: VerifyingKey, vkOnChain: IVkContractParams): void * @returns the AccQueue class instance and the AccQueue contract */ export const deployTestAccQueues = async ( - contractName: string, + factory: + | typeof AccQueueBinary0Factory + | typeof AccQueueQuinary0Factory + | typeof AccQueueQuinaryMaciFactory + | typeof AccQueueBinaryMaciFactory, SUB_DEPTH: number, HASH_LENGTH: number, ZERO: bigint, @@ -86,17 +98,20 @@ export const deployTestAccQueues = async ( PoseidonT6Contract.getAddress(), ]); // Link Poseidon contracts - const AccQueueFactory = await linkPoseidonLibraries( - contractName, - poseidonT3ContractAddress, - poseidonT4ContractAddress, - poseidonT5ContractAddress, - poseidonT6ContractAddress, + const accQueueFactory = await createContractFactory( + factory.abi, + factory.linkBytecode( + linkPoseidonLibraries( + poseidonT3ContractAddress, + poseidonT4ContractAddress, + poseidonT5ContractAddress, + poseidonT6ContractAddress, + ), + ), await getDefaultSigner(), - true, ); - const aqContract = await AccQueueFactory.deploy(SUB_DEPTH); + const aqContract = await accQueueFactory.deploy(SUB_DEPTH); await aqContract.deploymentTransaction()?.wait(); diff --git a/contracts/ts/deploy.ts b/contracts/ts/deploy.ts index 5bac2ddcb5..2478b3edcc 100644 --- a/contracts/ts/deploy.ts +++ b/contracts/ts/deploy.ts @@ -1,6 +1,7 @@ import { type ContractFactory, type Signer, BaseContract } from "ethers"; import type { IDeployMaciArgs, IDeployedMaci, IDeployedPoseidonContracts } from "./types"; +import type { TAbi } from "../tasks/helpers/types"; import { Deployment } from "../tasks/helpers/Deployment"; import { EContracts } from "../tasks/helpers/types"; @@ -26,44 +27,29 @@ import { Verifier, VkRegistry, AccQueueQuinaryMaci__factory as AccQueueQuinaryMaciFactory, + PollFactory__factory as PollFactoryFactory, + MACI__factory as MACIFactory, + MessageProcessorFactory__factory as MessageProcessorFactoryFactory, + TallyFactory__factory as TallyFactoryFactory, } from "../typechain-types"; import { getDefaultSigner, log } from "./utils"; /** - * Link Poseidon libraries to a Smart Contract - * @param solFileToLink - the name of the contract to link the libraries to - * @param poseidonT3Address - the address of the PoseidonT3 contract - * @param poseidonT4Address - the address of the PoseidonT4 contract - * @param poseidonT5Address - the address of the PoseidonT5 contract - * @param poseidonT6Address - the address of the PoseidonT6 contract + * Creates contract factory from abi and bytecode + * + * @param abi - Contract abi + * @param bytecode - Contract bytecode * @param signer - the signer to use to deploy the contract - * @param quiet - whether to suppress console output * @returns a contract factory with the libraries linked */ -export const linkPoseidonLibraries = async ( - solFileToLink: string, - poseidonT3Address: string, - poseidonT4Address: string, - poseidonT5Address: string, - poseidonT6Address: string, - signer?: Signer, - quiet = false, -): Promise => { - log(`Linking Poseidon libraries to ${solFileToLink}`, quiet); +export const createContractFactory = async (abi: TAbi, bytecode: string, signer?: Signer): Promise => { const hre = await import("hardhat"); const deployment = Deployment.getInstance(hre); deployment.setHre(hre); const deployer = signer || (await deployment.getDeployer()); - return deployment.linkPoseidonLibraries( - solFileToLink as EContracts, - poseidonT3Address, - poseidonT4Address, - poseidonT5Address, - poseidonT6Address, - deployer, - ); + return deployment.createContractFactory(abi, bytecode, deployer); }; /** @@ -84,7 +70,7 @@ export const deployContract = async ( const deployment = Deployment.getInstance(hre); deployment.setHre(hre); - return deployment.deployContract(contractName as EContracts, signer, ...args); + return deployment.deployContract({ name: contractName as EContracts, signer }, ...args); }; /** @@ -229,14 +215,15 @@ export const deployPollFactory = async (signer: Signer, quiet = false): Promise< poseidonContracts.PoseidonT6Contract.getAddress(), ]); - const contractFactory = await linkPoseidonLibraries( - "PollFactory", - poseidonT3Contract, - poseidonT4Contract, - poseidonT5Contract, - poseidonT6Contract, + const contractFactory = await createContractFactory( + PollFactoryFactory.abi, + PollFactoryFactory.linkBytecode({ + "contracts/crypto/PoseidonT3.sol:PoseidonT3": poseidonT3Contract, + "contracts/crypto/PoseidonT4.sol:PoseidonT4": poseidonT4Contract, + "contracts/crypto/PoseidonT5.sol:PoseidonT5": poseidonT5Contract, + "contracts/crypto/PoseidonT6.sol:PoseidonT6": poseidonT6Contract, + }), signer, - quiet, ); return deployContractWithLinkedLibraries(contractFactory); @@ -271,19 +258,20 @@ export const deployMaci = async ({ poseidonT6, })); - const contractsToLink = ["MACI", "PollFactory", "MessageProcessorFactory", "TallyFactory"]; + const contractsToLink = [MACIFactory, PollFactoryFactory, MessageProcessorFactoryFactory, TallyFactoryFactory]; // Link Poseidon contracts to MACI const linkedContractFactories = await Promise.all( - contractsToLink.map(async (contractName: string) => - linkPoseidonLibraries( - contractName, - poseidonAddrs.poseidonT3, - poseidonAddrs.poseidonT4, - poseidonAddrs.poseidonT5, - poseidonAddrs.poseidonT6, + contractsToLink.map(async (factory) => + createContractFactory( + factory.abi, + factory.linkBytecode({ + "contracts/crypto/PoseidonT3.sol:PoseidonT3": poseidonAddrs.poseidonT3, + "contracts/crypto/PoseidonT4.sol:PoseidonT4": poseidonAddrs.poseidonT4, + "contracts/crypto/PoseidonT5.sol:PoseidonT5": poseidonAddrs.poseidonT5, + "contracts/crypto/PoseidonT6.sol:PoseidonT6": poseidonAddrs.poseidonT6, + }), signer, - quiet, ), ), ); diff --git a/contracts/ts/index.ts b/contracts/ts/index.ts index 38c6d4e401..b91dbd3564 100644 --- a/contracts/ts/index.ts +++ b/contracts/ts/index.ts @@ -10,13 +10,17 @@ export { deployConstantInitialVoiceCreditProxy, deployFreeForAllSignUpGatekeeper, deployPollFactory, - linkPoseidonLibraries, + createContractFactory, deployPoseidonContracts, deployVerifier, } from "./deploy"; export { genMaciStateFromContract } from "./genMaciState"; export { formatProofForVerifierContract, getDefaultSigner, getDefaultNetwork, getSigners } from "./utils"; export { EMode } from "./constants"; +export { Deployment } from "../tasks/helpers/Deployment"; +export { ContractStorage } from "../tasks/helpers/ContractStorage"; +export { EContracts } from "../tasks/helpers/types"; +export { linkPoseidonLibraries } from "../tasks/helpers/abi"; export type { IVerifyingKeyStruct, SnarkProof, Groth16Proof } from "./types"; export * from "../typechain-types"; diff --git a/coordinator/.env.example b/coordinator/.env.example new file mode 100644 index 0000000000..089fa78309 --- /dev/null +++ b/coordinator/.env.example @@ -0,0 +1,2 @@ +TTL=60000 +LIMIT=10 diff --git a/coordinator/package.json b/coordinator/package.json index d1de8e02b8..e9b4787d41 100644 --- a/coordinator/package.json +++ b/coordinator/package.json @@ -21,13 +21,18 @@ "@nestjs/common": "^10.3.7", "@nestjs/core": "^10.3.7", "@nestjs/platform-express": "^10.3.8", - "reflect-metadata": "^0.2.0", - "rxjs": "^7.8.1", + "@nestjs/throttler": "^5.1.2", "@nomicfoundation/hardhat-toolbox": "^5.0.0", "dotenv": "^16.4.5", "ethers": "^6.12.0", "hardhat": "^2.22.3", - "maci-cli": "^1.2.0" + "helmet": "^7.1.0", + "maci-circuits": "^1.2.0", + "maci-cli": "^1.2.0", + "maci-contracts": "^1.2.0", + "maci-domainobjs": "^1.2.0", + "reflect-metadata": "^0.2.0", + "rxjs": "^7.8.1" }, "devDependencies": { "@nestjs/cli": "^10.3.2", @@ -38,9 +43,9 @@ "@types/node": "^20.3.1", "@types/supertest": "^6.0.0", "jest": "^29.5.0", - "typescript": "^5.4.5", "supertest": "^6.3.4", - "ts-jest": "^29.1.2" + "ts-jest": "^29.1.2", + "typescript": "^5.4.5" }, "jest": { "moduleFileExtensions": [ diff --git a/coordinator/ts/app.module.ts b/coordinator/ts/app.module.ts index 972b4b2c93..1b41584249 100644 --- a/coordinator/ts/app.module.ts +++ b/coordinator/ts/app.module.ts @@ -1,10 +1,18 @@ import { Module } from "@nestjs/common"; +import { ThrottlerModule } from "@nestjs/throttler"; import { AppController } from "./app.controller"; import { AppService } from "./app.service"; @Module({ - imports: [], + imports: [ + ThrottlerModule.forRoot([ + { + ttl: Number(process.env.TTL), + limit: Number(process.env.LIMIT), + }, + ]), + ], controllers: [AppController], providers: [AppService], }) diff --git a/coordinator/ts/main.ts b/coordinator/ts/main.ts index ab7bffae54..3d366ecdd9 100644 --- a/coordinator/ts/main.ts +++ b/coordinator/ts/main.ts @@ -1,9 +1,14 @@ import { NestFactory } from "@nestjs/core"; +import dotenv from "dotenv"; +import helmet from "helmet"; -import { AppModule } from "./app.module"; +dotenv.config(); async function bootstrap() { + const { AppModule } = await import("./app.module"); const app = await NestFactory.create(AppModule); + app.use(helmet()); + app.enableCors(); await app.listen(3000); } diff --git a/integrationTests/package.json b/integrationTests/package.json index 0a124a0efe..d88add03e0 100644 --- a/integrationTests/package.json +++ b/integrationTests/package.json @@ -24,7 +24,7 @@ "@types/node": "^20.12.7", "chai": "^4.3.10", "chai-as-promised": "^7.1.1", - "hardhat": "^2.22.2", + "hardhat": "^2.22.3", "hardhat-artifactor": "^0.2.0", "hardhat-contract-sizer": "^2.0.3", "mocha": "^10.4.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5970ac09e8..bf03bbf8ac 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -152,7 +152,7 @@ importers: version: 12.0.1(commander@12.0.0) '@nomicfoundation/hardhat-toolbox': specifier: ^5.0.0 - version: 5.0.0(@nomicfoundation/hardhat-chai-matchers@2.0.6)(@nomicfoundation/hardhat-ethers@3.0.5)(@nomicfoundation/hardhat-ignition-ethers@0.15.1)(@nomicfoundation/hardhat-network-helpers@1.0.10)(@nomicfoundation/hardhat-verify@2.0.5)(@typechain/ethers-v6@0.5.1)(@typechain/hardhat@9.1.0)(@types/chai@4.3.14)(@types/mocha@10.0.6)(@types/node@20.12.7)(chai@4.4.1)(ethers@6.12.0)(hardhat-gas-reporter@1.0.10)(hardhat@2.22.2)(solidity-coverage@0.8.12)(ts-node@10.9.2)(typechain@8.3.2)(typescript@5.4.5) + version: 5.0.0(@nomicfoundation/hardhat-chai-matchers@2.0.6)(@nomicfoundation/hardhat-ethers@3.0.5)(@nomicfoundation/hardhat-ignition-ethers@0.15.1)(@nomicfoundation/hardhat-network-helpers@1.0.10)(@nomicfoundation/hardhat-verify@2.0.5)(@typechain/ethers-v6@0.5.1)(@typechain/hardhat@9.1.0)(@types/chai@4.3.14)(@types/mocha@10.0.6)(@types/node@20.12.7)(chai@4.4.1)(ethers@6.12.0)(hardhat-gas-reporter@1.0.10)(hardhat@2.22.3)(solidity-coverage@0.8.12)(ts-node@10.9.2)(typechain@8.3.2)(typescript@5.4.5) commander: specifier: ^12.0.0 version: 12.0.0 @@ -163,8 +163,8 @@ importers: specifier: ^6.12.0 version: 6.12.0 hardhat: - specifier: ^2.22.2 - version: 2.22.2(ts-node@10.9.2)(typescript@5.4.5) + specifier: ^2.22.3 + version: 2.22.3(ts-node@10.9.2)(typescript@5.4.5) maci-circuits: specifier: ^1.2.0 version: link:../circuits @@ -225,10 +225,10 @@ importers: dependencies: '@nomicfoundation/hardhat-ethers': specifier: ^3.0.5 - version: 3.0.5(ethers@6.12.0)(hardhat@2.22.2) + version: 3.0.5(ethers@6.12.0)(hardhat@2.22.3) '@nomicfoundation/hardhat-toolbox': specifier: ^5.0.0 - version: 5.0.0(@nomicfoundation/hardhat-chai-matchers@2.0.6)(@nomicfoundation/hardhat-ethers@3.0.5)(@nomicfoundation/hardhat-ignition-ethers@0.15.1)(@nomicfoundation/hardhat-network-helpers@1.0.10)(@nomicfoundation/hardhat-verify@2.0.5)(@typechain/ethers-v6@0.5.1)(@typechain/hardhat@9.1.0)(@types/chai@4.3.14)(@types/mocha@10.0.6)(@types/node@20.12.7)(chai@4.4.1)(ethers@6.12.0)(hardhat-gas-reporter@1.0.10)(hardhat@2.22.2)(solidity-coverage@0.8.12)(ts-node@10.9.2)(typechain@8.3.2)(typescript@5.4.5) + version: 5.0.0(@nomicfoundation/hardhat-chai-matchers@2.0.6)(@nomicfoundation/hardhat-ethers@3.0.5)(@nomicfoundation/hardhat-ignition-ethers@0.15.1)(@nomicfoundation/hardhat-network-helpers@1.0.10)(@nomicfoundation/hardhat-verify@2.0.5)(@typechain/ethers-v6@0.5.1)(@typechain/hardhat@9.1.0)(@types/chai@4.3.14)(@types/mocha@10.0.6)(@types/node@20.12.7)(chai@4.4.1)(ethers@6.12.0)(hardhat-gas-reporter@1.0.10)(hardhat@2.22.3)(solidity-coverage@0.8.12)(ts-node@10.9.2)(typechain@8.3.2)(typescript@5.4.5) '@openzeppelin/contracts': specifier: ^5.0.2 version: 5.0.2 @@ -239,8 +239,8 @@ importers: specifier: ^6.12.0 version: 6.12.0 hardhat: - specifier: ^2.22.2 - version: 2.22.2(ts-node@10.9.2)(typescript@5.4.5) + specifier: ^2.22.3 + version: 2.22.3(ts-node@10.9.2)(typescript@5.4.5) maci-circuits: specifier: ^1.2.0 version: link:../circuits @@ -255,7 +255,7 @@ importers: version: link:../domainobjs solidity-docgen: specifier: ^0.6.0-beta.36 - version: 0.6.0-beta.36(hardhat@2.22.2) + version: 0.6.0-beta.36(hardhat@2.22.3) devDependencies: '@types/chai': specifier: ^4.3.11 @@ -283,10 +283,10 @@ importers: version: 16.4.5 hardhat-artifactor: specifier: ^0.2.0 - version: 0.2.0(hardhat@2.22.2) + version: 0.2.0(hardhat@2.22.3) hardhat-contract-sizer: specifier: ^2.10.0 - version: 2.10.0(hardhat@2.22.2) + version: 2.10.0(hardhat@2.22.3) lowdb: specifier: ^1.0.0 version: 1.0.0 @@ -308,6 +308,9 @@ importers: '@nestjs/platform-express': specifier: ^10.3.8 version: 10.3.8(@nestjs/common@10.3.7)(@nestjs/core@10.3.7) + '@nestjs/throttler': + specifier: ^5.1.2 + version: 5.1.2(@nestjs/common@10.3.7)(@nestjs/core@10.3.7)(reflect-metadata@0.2.2) '@nomicfoundation/hardhat-toolbox': specifier: ^5.0.0 version: 5.0.0(@nomicfoundation/hardhat-chai-matchers@2.0.6)(@nomicfoundation/hardhat-ethers@3.0.5)(@nomicfoundation/hardhat-ignition-ethers@0.15.1)(@nomicfoundation/hardhat-network-helpers@1.0.10)(@nomicfoundation/hardhat-verify@2.0.5)(@typechain/ethers-v6@0.5.1)(@typechain/hardhat@9.1.0)(@types/chai@4.3.14)(@types/mocha@10.0.6)(@types/node@20.12.7)(chai@4.4.1)(ethers@6.12.0)(hardhat-gas-reporter@1.0.10)(hardhat@2.22.3)(solidity-coverage@0.8.12)(ts-node@10.9.2)(typechain@8.3.2)(typescript@5.4.5) @@ -320,9 +323,21 @@ importers: hardhat: specifier: ^2.22.3 version: 2.22.3(ts-node@10.9.2)(typescript@5.4.5) + helmet: + specifier: ^7.1.0 + version: 7.1.0 + maci-circuits: + specifier: ^1.2.0 + version: link:../circuits maci-cli: specifier: ^1.2.0 version: link:../cli + maci-contracts: + specifier: ^1.2.0 + version: link:../contracts + maci-domainobjs: + specifier: ^1.2.0 + version: link:../domainobjs reflect-metadata: specifier: ^0.2.0 version: 0.2.2 @@ -482,7 +497,7 @@ importers: dependencies: '@nomicfoundation/hardhat-toolbox': specifier: ^5.0.0 - version: 5.0.0(@nomicfoundation/hardhat-chai-matchers@2.0.6)(@nomicfoundation/hardhat-ethers@3.0.5)(@nomicfoundation/hardhat-ignition-ethers@0.15.1)(@nomicfoundation/hardhat-network-helpers@1.0.10)(@nomicfoundation/hardhat-verify@2.0.5)(@typechain/ethers-v6@0.5.1)(@typechain/hardhat@9.1.0)(@types/chai@4.3.14)(@types/mocha@10.0.6)(@types/node@20.12.7)(chai@4.4.1)(ethers@6.12.0)(hardhat-gas-reporter@1.0.10)(hardhat@2.22.2)(solidity-coverage@0.8.12)(ts-node@10.9.2)(typechain@8.3.2)(typescript@5.4.5) + version: 5.0.0(@nomicfoundation/hardhat-chai-matchers@2.0.6)(@nomicfoundation/hardhat-ethers@3.0.5)(@nomicfoundation/hardhat-ignition-ethers@0.15.1)(@nomicfoundation/hardhat-network-helpers@1.0.10)(@nomicfoundation/hardhat-verify@2.0.5)(@typechain/ethers-v6@0.5.1)(@typechain/hardhat@9.1.0)(@types/chai@4.3.14)(@types/mocha@10.0.6)(@types/node@20.12.7)(chai@4.4.1)(ethers@6.12.0)(hardhat-gas-reporter@1.0.10)(hardhat@2.22.3)(solidity-coverage@0.8.12)(ts-node@10.9.2)(typechain@8.3.2)(typescript@5.4.5) ethers: specifier: ^6.12.0 version: 6.12.0 @@ -524,14 +539,14 @@ importers: specifier: ^7.1.1 version: 7.1.1(chai@4.4.1) hardhat: - specifier: ^2.22.2 - version: 2.22.2(ts-node@10.9.2)(typescript@5.4.5) + specifier: ^2.22.3 + version: 2.22.3(ts-node@10.9.2)(typescript@5.4.5) hardhat-artifactor: specifier: ^0.2.0 - version: 0.2.0(hardhat@2.22.2) + version: 0.2.0(hardhat@2.22.3) hardhat-contract-sizer: specifier: ^2.0.3 - version: 2.10.0(hardhat@2.22.2) + version: 2.10.0(hardhat@2.22.3) mocha: specifier: ^10.4.0 version: 10.4.0 @@ -2148,6 +2163,7 @@ packages: /@colors/colors@1.5.0: resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==} engines: {node: '>=0.1.90'} + requiresBuild: true /@commander-js/extra-typings@12.0.1(commander@12.0.0): resolution: {integrity: sha512-OvkMobb1eMqOCuJdbuSin/KJkkZr7n24/UNV+Lcz/0Dhepf3r2p9PaGwpRpAWej7A+gQnny4h8mGhpFl4giKkg==} @@ -4200,6 +4216,18 @@ packages: tslib: 2.6.2 dev: true + /@nestjs/throttler@5.1.2(@nestjs/common@10.3.7)(@nestjs/core@10.3.7)(reflect-metadata@0.2.2): + resolution: {integrity: sha512-60MqhSLYUqWOgc38P6C6f76JIpf6mVjly7gpuPBCKtVd0p5e8Fq855j7bJuO4/v25vgaOo1OdVs0U1qtgYioGw==} + peerDependencies: + '@nestjs/common': ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 + '@nestjs/core': ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 + reflect-metadata: ^0.1.13 || ^0.2.0 + dependencies: + '@nestjs/common': 10.3.7(reflect-metadata@0.2.2)(rxjs@7.8.1) + '@nestjs/core': 10.3.7(@nestjs/common@10.3.7)(@nestjs/platform-express@10.3.8)(reflect-metadata@0.2.2)(rxjs@7.8.1) + reflect-metadata: 0.2.2 + dev: false + /@noble/curves@1.2.0: resolution: {integrity: sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==} dependencies: @@ -4504,24 +4532,6 @@ packages: '@nomicfoundation/ethereumjs-rlp': 5.0.4 ethereum-cryptography: 0.1.3 - /@nomicfoundation/hardhat-chai-matchers@2.0.6(@nomicfoundation/hardhat-ethers@3.0.5)(chai@4.4.1)(ethers@6.12.0)(hardhat@2.22.2): - resolution: {integrity: sha512-Te1Uyo9oJcTCF0Jy9dztaLpshmlpjLf2yPtWXlXuLjMt3RRSmJLm/+rKVTW6gfadAEs12U/it6D0ZRnnRGiICQ==} - peerDependencies: - '@nomicfoundation/hardhat-ethers': ^3.0.0 - chai: ^4.2.0 - ethers: ^6.1.0 - hardhat: ^2.9.4 - dependencies: - '@nomicfoundation/hardhat-ethers': 3.0.5(ethers@6.12.0)(hardhat@2.22.2) - '@types/chai-as-promised': 7.1.8 - chai: 4.4.1 - chai-as-promised: 7.1.1(chai@4.4.1) - deep-eql: 4.1.3 - ethers: 6.12.0 - hardhat: 2.22.2(ts-node@10.9.2)(typescript@5.4.5) - ordinal: 1.0.3 - dev: false - /@nomicfoundation/hardhat-chai-matchers@2.0.6(@nomicfoundation/hardhat-ethers@3.0.5)(chai@4.4.1)(ethers@6.12.0)(hardhat@2.22.3): resolution: {integrity: sha512-Te1Uyo9oJcTCF0Jy9dztaLpshmlpjLf2yPtWXlXuLjMt3RRSmJLm/+rKVTW6gfadAEs12U/it6D0ZRnnRGiICQ==} peerDependencies: @@ -4540,20 +4550,6 @@ packages: ordinal: 1.0.3 dev: false - /@nomicfoundation/hardhat-ethers@3.0.5(ethers@6.12.0)(hardhat@2.22.2): - resolution: {integrity: sha512-RNFe8OtbZK6Ila9kIlHp0+S80/0Bu/3p41HUpaRIoHLm6X3WekTd83vob3rE54Duufu1edCiBDxspBzi2rxHHw==} - peerDependencies: - ethers: ^6.1.0 - hardhat: ^2.0.0 - dependencies: - debug: 4.3.4(supports-color@8.1.1) - ethers: 6.12.0 - hardhat: 2.22.2(ts-node@10.9.2)(typescript@5.4.5) - lodash.isequal: 4.5.0 - transitivePeerDependencies: - - supports-color - dev: false - /@nomicfoundation/hardhat-ethers@3.0.5(ethers@6.12.0)(hardhat@2.22.3): resolution: {integrity: sha512-RNFe8OtbZK6Ila9kIlHp0+S80/0Bu/3p41HUpaRIoHLm6X3WekTd83vob3rE54Duufu1edCiBDxspBzi2rxHHw==} peerDependencies: @@ -4568,22 +4564,6 @@ packages: - supports-color dev: false - /@nomicfoundation/hardhat-ignition-ethers@0.15.1(@nomicfoundation/hardhat-ethers@3.0.5)(@nomicfoundation/hardhat-ignition@0.15.1)(@nomicfoundation/ignition-core@0.15.1)(ethers@6.12.0)(hardhat@2.22.2): - resolution: {integrity: sha512-FPeE0EbJ+RcBGro9TxODyDffpSPhnG8ra43nJp7/1H2M0S+UkmJUeZlSjAIVfUut1zMwy+57j+PNn07dOr/YmQ==} - peerDependencies: - '@nomicfoundation/hardhat-ethers': ^3.0.4 - '@nomicfoundation/hardhat-ignition': ^0.15.1 - '@nomicfoundation/ignition-core': ^0.15.1 - ethers: ^6.7.0 - hardhat: ^2.18.0 - dependencies: - '@nomicfoundation/hardhat-ethers': 3.0.5(ethers@6.12.0)(hardhat@2.22.2) - '@nomicfoundation/hardhat-ignition': 0.15.1(@nomicfoundation/hardhat-verify@2.0.5)(hardhat@2.22.2) - '@nomicfoundation/ignition-core': 0.15.1 - ethers: 6.12.0 - hardhat: 2.22.2(ts-node@10.9.2)(typescript@5.4.5) - dev: false - /@nomicfoundation/hardhat-ignition-ethers@0.15.1(@nomicfoundation/hardhat-ethers@3.0.5)(@nomicfoundation/hardhat-ignition@0.15.1)(@nomicfoundation/ignition-core@0.15.1)(ethers@6.12.0)(hardhat@2.22.3): resolution: {integrity: sha512-FPeE0EbJ+RcBGro9TxODyDffpSPhnG8ra43nJp7/1H2M0S+UkmJUeZlSjAIVfUut1zMwy+57j+PNn07dOr/YmQ==} peerDependencies: @@ -4600,26 +4580,6 @@ packages: hardhat: 2.22.3(ts-node@10.9.2)(typescript@5.4.5) dev: false - /@nomicfoundation/hardhat-ignition@0.15.1(@nomicfoundation/hardhat-verify@2.0.5)(hardhat@2.22.2): - resolution: {integrity: sha512-hWV/W9ZdG9HIqUiQXexrwoBBGP4IrDLghlZPAXXEXETmJ2AVPnBKQG626YmAYgEk2G3vX9ojn16daT+H2i/mFA==} - peerDependencies: - '@nomicfoundation/hardhat-verify': ^2.0.1 - hardhat: ^2.18.0 - dependencies: - '@nomicfoundation/hardhat-verify': 2.0.5(hardhat@2.22.2) - '@nomicfoundation/ignition-core': 0.15.1 - '@nomicfoundation/ignition-ui': 0.15.1 - chalk: 4.1.2 - debug: 4.3.4(supports-color@8.1.1) - fs-extra: 10.1.0 - hardhat: 2.22.2(ts-node@10.9.2)(typescript@5.4.5) - prompts: 2.4.2 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - dev: false - /@nomicfoundation/hardhat-ignition@0.15.1(@nomicfoundation/hardhat-verify@2.0.5)(hardhat@2.22.3): resolution: {integrity: sha512-hWV/W9ZdG9HIqUiQXexrwoBBGP4IrDLghlZPAXXEXETmJ2AVPnBKQG626YmAYgEk2G3vX9ojn16daT+H2i/mFA==} peerDependencies: @@ -4640,15 +4600,6 @@ packages: - utf-8-validate dev: false - /@nomicfoundation/hardhat-network-helpers@1.0.10(hardhat@2.22.2): - resolution: {integrity: sha512-R35/BMBlx7tWN5V6d/8/19QCwEmIdbnA4ZrsuXgvs8i2qFx5i7h6mH5pBS4Pwi4WigLH+upl6faYusrNPuzMrQ==} - peerDependencies: - hardhat: ^2.9.5 - dependencies: - ethereumjs-util: 7.1.5 - hardhat: 2.22.2(ts-node@10.9.2)(typescript@5.4.5) - dev: false - /@nomicfoundation/hardhat-network-helpers@1.0.10(hardhat@2.22.3): resolution: {integrity: sha512-R35/BMBlx7tWN5V6d/8/19QCwEmIdbnA4ZrsuXgvs8i2qFx5i7h6mH5pBS4Pwi4WigLH+upl6faYusrNPuzMrQ==} peerDependencies: @@ -4658,48 +4609,6 @@ packages: hardhat: 2.22.3(ts-node@10.9.2)(typescript@5.4.5) dev: false - /@nomicfoundation/hardhat-toolbox@5.0.0(@nomicfoundation/hardhat-chai-matchers@2.0.6)(@nomicfoundation/hardhat-ethers@3.0.5)(@nomicfoundation/hardhat-ignition-ethers@0.15.1)(@nomicfoundation/hardhat-network-helpers@1.0.10)(@nomicfoundation/hardhat-verify@2.0.5)(@typechain/ethers-v6@0.5.1)(@typechain/hardhat@9.1.0)(@types/chai@4.3.14)(@types/mocha@10.0.6)(@types/node@20.12.7)(chai@4.4.1)(ethers@6.12.0)(hardhat-gas-reporter@1.0.10)(hardhat@2.22.2)(solidity-coverage@0.8.12)(ts-node@10.9.2)(typechain@8.3.2)(typescript@5.4.5): - resolution: {integrity: sha512-FnUtUC5PsakCbwiVNsqlXVIWG5JIb5CEZoSXbJUsEBun22Bivx2jhF1/q9iQbzuaGpJKFQyOhemPB2+XlEE6pQ==} - peerDependencies: - '@nomicfoundation/hardhat-chai-matchers': ^2.0.0 - '@nomicfoundation/hardhat-ethers': ^3.0.0 - '@nomicfoundation/hardhat-ignition-ethers': ^0.15.0 - '@nomicfoundation/hardhat-network-helpers': ^1.0.0 - '@nomicfoundation/hardhat-verify': ^2.0.0 - '@typechain/ethers-v6': ^0.5.0 - '@typechain/hardhat': ^9.0.0 - '@types/chai': ^4.2.0 - '@types/mocha': '>=9.1.0' - '@types/node': '>=18.0.0' - chai: ^4.2.0 - ethers: ^6.4.0 - hardhat: ^2.11.0 - hardhat-gas-reporter: ^1.0.8 - solidity-coverage: ^0.8.1 - ts-node: '>=8.0.0' - typechain: ^8.3.0 - typescript: '>=4.5.0' - dependencies: - '@nomicfoundation/hardhat-chai-matchers': 2.0.6(@nomicfoundation/hardhat-ethers@3.0.5)(chai@4.4.1)(ethers@6.12.0)(hardhat@2.22.2) - '@nomicfoundation/hardhat-ethers': 3.0.5(ethers@6.12.0)(hardhat@2.22.2) - '@nomicfoundation/hardhat-ignition-ethers': 0.15.1(@nomicfoundation/hardhat-ethers@3.0.5)(@nomicfoundation/hardhat-ignition@0.15.1)(@nomicfoundation/ignition-core@0.15.1)(ethers@6.12.0)(hardhat@2.22.2) - '@nomicfoundation/hardhat-network-helpers': 1.0.10(hardhat@2.22.2) - '@nomicfoundation/hardhat-verify': 2.0.5(hardhat@2.22.2) - '@typechain/ethers-v6': 0.5.1(ethers@6.12.0)(typechain@8.3.2)(typescript@5.4.5) - '@typechain/hardhat': 9.1.0(@typechain/ethers-v6@0.5.1)(ethers@6.12.0)(hardhat@2.22.2)(typechain@8.3.2) - '@types/chai': 4.3.14 - '@types/mocha': 10.0.6 - '@types/node': 20.12.7 - chai: 4.4.1 - ethers: 6.12.0 - hardhat: 2.22.2(ts-node@10.9.2)(typescript@5.4.5) - hardhat-gas-reporter: 1.0.10(hardhat@2.22.2) - solidity-coverage: 0.8.12(hardhat@2.22.2) - ts-node: 10.9.2(@types/node@20.12.7)(typescript@5.4.5) - typechain: 8.3.2(typescript@5.4.5) - typescript: 5.4.5 - dev: false - /@nomicfoundation/hardhat-toolbox@5.0.0(@nomicfoundation/hardhat-chai-matchers@2.0.6)(@nomicfoundation/hardhat-ethers@3.0.5)(@nomicfoundation/hardhat-ignition-ethers@0.15.1)(@nomicfoundation/hardhat-network-helpers@1.0.10)(@nomicfoundation/hardhat-verify@2.0.5)(@typechain/ethers-v6@0.5.1)(@typechain/hardhat@9.1.0)(@types/chai@4.3.14)(@types/mocha@10.0.6)(@types/node@20.12.7)(chai@4.4.1)(ethers@6.12.0)(hardhat-gas-reporter@1.0.10)(hardhat@2.22.3)(solidity-coverage@0.8.12)(ts-node@10.9.2)(typechain@8.3.2)(typescript@5.4.5): resolution: {integrity: sha512-FnUtUC5PsakCbwiVNsqlXVIWG5JIb5CEZoSXbJUsEBun22Bivx2jhF1/q9iQbzuaGpJKFQyOhemPB2+XlEE6pQ==} peerDependencies: @@ -4742,25 +4651,6 @@ packages: typescript: 5.4.5 dev: false - /@nomicfoundation/hardhat-verify@2.0.5(hardhat@2.22.2): - resolution: {integrity: sha512-Tg4zu8RkWpyADSFIgF4FlJIUEI4VkxcvELsmbJn2OokbvH2SnUrqKmw0BBfDrtvP0hhmx8wsnrRKP5DV/oTyTA==} - peerDependencies: - hardhat: ^2.0.4 - dependencies: - '@ethersproject/abi': 5.7.0 - '@ethersproject/address': 5.7.0 - cbor: 8.1.0 - chalk: 2.4.2 - debug: 4.3.4(supports-color@8.1.1) - hardhat: 2.22.2(ts-node@10.9.2)(typescript@5.4.5) - lodash.clonedeep: 4.5.0 - semver: 6.3.1 - table: 6.8.2 - undici: 5.28.4 - transitivePeerDependencies: - - supports-color - dev: false - /@nomicfoundation/hardhat-verify@2.0.5(hardhat@2.22.3): resolution: {integrity: sha512-Tg4zu8RkWpyADSFIgF4FlJIUEI4VkxcvELsmbJn2OokbvH2SnUrqKmw0BBfDrtvP0hhmx8wsnrRKP5DV/oTyTA==} peerDependencies: @@ -5735,21 +5625,6 @@ packages: typescript: 5.4.5 dev: false - /@typechain/hardhat@9.1.0(@typechain/ethers-v6@0.5.1)(ethers@6.12.0)(hardhat@2.22.2)(typechain@8.3.2): - resolution: {integrity: sha512-mtaUlzLlkqTlfPwB3FORdejqBskSnh+Jl8AIJGjXNAQfRQ4ofHADPl1+oU7Z3pAJzmZbUXII8MhOLQltcHgKnA==} - peerDependencies: - '@typechain/ethers-v6': ^0.5.1 - ethers: ^6.1.0 - hardhat: ^2.9.9 - typechain: ^8.3.2 - dependencies: - '@typechain/ethers-v6': 0.5.1(ethers@6.12.0)(typechain@8.3.2)(typescript@5.4.5) - ethers: 6.12.0 - fs-extra: 9.1.0 - hardhat: 2.22.2(ts-node@10.9.2)(typescript@5.4.5) - typechain: 8.3.2(typescript@5.4.5) - dev: false - /@typechain/hardhat@9.1.0(@typechain/ethers-v6@0.5.1)(ethers@6.12.0)(hardhat@2.22.3)(typechain@8.3.2): resolution: {integrity: sha512-mtaUlzLlkqTlfPwB3FORdejqBskSnh+Jl8AIJGjXNAQfRQ4ofHADPl1+oU7Z3pAJzmZbUXII8MhOLQltcHgKnA==} peerDependencies: @@ -11252,41 +11127,25 @@ packages: engines: {node: '>=6'} dev: true - /hardhat-artifactor@0.2.0(hardhat@2.22.2): + /hardhat-artifactor@0.2.0(hardhat@2.22.3): resolution: {integrity: sha512-034c0Ye3PjnPbBz6Adz7bNZ7T4LdPTSkjnzsBxToJKiqU4f4CwowFOqwSS0RqO2t9A7w/aWR49pLwbNzpVuDgQ==} peerDependencies: hardhat: ^2.0.0 dependencies: - hardhat: 2.22.2(ts-node@10.9.2)(typescript@5.4.5) + hardhat: 2.22.3(ts-node@10.9.2)(typescript@5.4.5) dev: true - /hardhat-contract-sizer@2.10.0(hardhat@2.22.2): + /hardhat-contract-sizer@2.10.0(hardhat@2.22.3): resolution: {integrity: sha512-QiinUgBD5MqJZJh1hl1jc9dNnpJg7eE/w4/4GEnrcmZJJTDbVFNe3+/3Ep24XqISSkYxRz36czcPHKHd/a0dwA==} peerDependencies: hardhat: ^2.0.0 dependencies: chalk: 4.1.2 cli-table3: 0.6.4 - hardhat: 2.22.2(ts-node@10.9.2)(typescript@5.4.5) + hardhat: 2.22.3(ts-node@10.9.2)(typescript@5.4.5) strip-ansi: 6.0.1 dev: true - /hardhat-gas-reporter@1.0.10(hardhat@2.22.2): - resolution: {integrity: sha512-02N4+So/fZrzJ88ci54GqwVA3Zrf0C9duuTyGt0CFRIh/CdNwbnTgkXkRfojOMLBQ+6t+lBIkgbsOtqMvNwikA==} - peerDependencies: - hardhat: ^2.0.2 - dependencies: - array-uniq: 1.0.3 - eth-gas-reporter: 0.2.27 - hardhat: 2.22.2(ts-node@10.9.2)(typescript@5.4.5) - sha1: 1.1.1 - transitivePeerDependencies: - - '@codechecks/client' - - bufferutil - - debug - - utf-8-validate - dev: false - /hardhat-gas-reporter@1.0.10(hardhat@2.22.3): resolution: {integrity: sha512-02N4+So/fZrzJ88ci54GqwVA3Zrf0C9duuTyGt0CFRIh/CdNwbnTgkXkRfojOMLBQ+6t+lBIkgbsOtqMvNwikA==} peerDependencies: @@ -11303,69 +11162,6 @@ packages: - utf-8-validate dev: false - /hardhat@2.22.2(ts-node@10.9.2)(typescript@5.4.5): - resolution: {integrity: sha512-0xZ7MdCZ5sJem4MrvpQWLR3R3zGDoHw5lsR+pBFimqwagimIOn3bWuZv69KA+veXClwI1s/zpqgwPwiFrd4Dxw==} - hasBin: true - peerDependencies: - ts-node: '*' - typescript: '*' - peerDependenciesMeta: - ts-node: - optional: true - typescript: - optional: true - dependencies: - '@ethersproject/abi': 5.7.0 - '@metamask/eth-sig-util': 4.0.1 - '@nomicfoundation/edr': 0.3.5 - '@nomicfoundation/ethereumjs-common': 4.0.4 - '@nomicfoundation/ethereumjs-tx': 5.0.4 - '@nomicfoundation/ethereumjs-util': 9.0.4 - '@nomicfoundation/solidity-analyzer': 0.1.1 - '@sentry/node': 5.30.0 - '@types/bn.js': 5.1.5 - '@types/lru-cache': 5.1.1 - adm-zip: 0.4.16 - aggregate-error: 3.1.0 - ansi-escapes: 4.3.2 - boxen: 5.1.2 - chalk: 2.4.2 - chokidar: 3.6.0 - ci-info: 2.0.0 - debug: 4.3.4(supports-color@8.1.1) - enquirer: 2.4.1 - env-paths: 2.2.1 - ethereum-cryptography: 1.2.0 - ethereumjs-abi: 0.6.8 - find-up: 2.1.0 - fp-ts: 1.19.3 - fs-extra: 7.0.1 - glob: 7.2.0 - immutable: 4.3.5 - io-ts: 1.10.4 - keccak: 3.0.4 - lodash: 4.17.21 - mnemonist: 0.38.5 - mocha: 10.4.0 - p-map: 4.0.0 - raw-body: 2.5.2 - resolve: 1.17.0 - semver: 6.3.1 - solc: 0.7.3(debug@4.3.4) - source-map-support: 0.5.21 - stacktrace-parser: 0.1.10 - ts-node: 10.9.2(@types/node@20.12.7)(typescript@5.4.5) - tsort: 0.0.1 - typescript: 5.4.5 - undici: 5.28.4 - uuid: 8.3.2 - ws: 7.5.9 - transitivePeerDependencies: - - bufferutil - - c-kzg - - supports-color - - utf-8-validate - /hardhat@2.22.3(ts-node@10.9.2)(typescript@5.4.5): resolution: {integrity: sha512-k8JV2ECWNchD6ahkg2BR5wKVxY0OiKot7fuxiIpRK0frRqyOljcR2vKwgWSLw6YIeDcNNA4xybj7Og7NSxr2hA==} hasBin: true @@ -11428,7 +11224,6 @@ packages: - c-kzg - supports-color - utf-8-validate - dev: false /has-bigints@1.0.2: resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==} @@ -11665,6 +11460,11 @@ packages: resolution: {integrity: sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg==} dev: false + /helmet@7.1.0: + resolution: {integrity: sha512-g+HZqgfbpXdCkme/Cd/mZkV0aV3BZZZSugecH03kl38m/Kmdx8jKjBikpDj2cr+Iynv4KpYEviojNdTJActJAg==} + engines: {node: '>=16.0.0'} + dev: false + /hexoid@1.0.0: resolution: {integrity: sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==} engines: {node: '>=8'} @@ -17941,34 +17741,6 @@ packages: resolution: {integrity: sha512-htM7Vn6LhHreR+EglVMd2s+sZhcXAirB1Zlyrv5zBuTxieCvjfnRpd7iZk75m/u6NOlEyQ94C6TWbBn2cY7w8g==} dev: true - /solidity-coverage@0.8.12(hardhat@2.22.2): - resolution: {integrity: sha512-8cOB1PtjnjFRqOgwFiD8DaUsYJtVJ6+YdXQtSZDrLGf8cdhhh8xzTtGzVTGeBf15kTv0v7lYPJlV/az7zLEPJw==} - hasBin: true - peerDependencies: - hardhat: ^2.11.0 - dependencies: - '@ethersproject/abi': 5.7.0 - '@solidity-parser/parser': 0.18.0 - chalk: 2.4.2 - death: 1.1.0 - difflib: 0.2.4 - fs-extra: 8.1.0 - ghost-testrpc: 0.0.2 - global-modules: 2.0.0 - globby: 10.0.2 - hardhat: 2.22.2(ts-node@10.9.2)(typescript@5.4.5) - jsonschema: 1.4.1 - lodash: 4.17.21 - mocha: 10.4.0 - node-emoji: 1.11.0 - pify: 4.0.1 - recursive-readdir: 2.2.3 - sc-istanbul: 0.4.6 - semver: 7.6.0 - shelljs: 0.8.5 - web3-utils: 1.10.4 - dev: false - /solidity-coverage@0.8.12(hardhat@2.22.3): resolution: {integrity: sha512-8cOB1PtjnjFRqOgwFiD8DaUsYJtVJ6+YdXQtSZDrLGf8cdhhh8xzTtGzVTGeBf15kTv0v7lYPJlV/az7zLEPJw==} hasBin: true @@ -17997,13 +17769,13 @@ packages: web3-utils: 1.10.4 dev: false - /solidity-docgen@0.6.0-beta.36(hardhat@2.22.2): + /solidity-docgen@0.6.0-beta.36(hardhat@2.22.3): resolution: {integrity: sha512-f/I5G2iJgU1h0XrrjRD0hHMr7C10u276vYvm//rw1TzFcYQ4xTOyAoi9oNAHRU0JU4mY9eTuxdVc2zahdMuhaQ==} peerDependencies: hardhat: ^2.8.0 dependencies: handlebars: 4.7.8 - hardhat: 2.22.2(ts-node@10.9.2)(typescript@5.4.5) + hardhat: 2.22.3(ts-node@10.9.2)(typescript@5.4.5) solidity-ast: 0.4.56 dev: false