Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/CRISP/packages/crisp-contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import type { HardhatUserConfig } from 'hardhat/config'
import { cleanDeploymentsTask } from '@enclave-e3/contracts/tasks/utils'
import { ciphernodeAdd, ciphernodeAdminAdd, ciphernodeMintTokens } from '@enclave-e3/contracts/tasks/ciphernode'
import { ciphernodeAdd, ciphernodeAdminAdd, ciphernodeMintTokens, updateSubmissionWindow } from '@enclave-e3/contracts/tasks/ciphernode'
import dotenv from 'dotenv'

import hardhatEthersChaiMatchers from '@nomicfoundation/hardhat-ethers-chai-matchers'
Expand Down Expand Up @@ -63,7 +63,7 @@ function getChainConfig(chain: keyof typeof chainIds, apiUrl: string) {

const config: HardhatUserConfig = {
plugins: [hardhatTypechainPlugin, hardhatEthersChaiMatchers, hardhatNetworkHelpers, hardhatToolboxMochaEthersPlugin, hardhatVerify],
tasks: [cleanDeploymentsTask, ciphernodeAdd, ciphernodeAdminAdd, ciphernodeMintTokens],
tasks: [cleanDeploymentsTask, ciphernodeAdd, ciphernodeAdminAdd, ciphernodeMintTokens, updateSubmissionWindow],
networks: {
default: {
accounts: {
Expand Down
5 changes: 3 additions & 2 deletions examples/CRISP/packages/crisp-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@
"ciphernode:add:self": "hardhat ciphernode:add",
"clean:deployments": "hardhat utils:clean-deployments",
"deploy:contracts": "hardhat run deploy/deploy.ts",
"deploy:contracts:full": "export DEPLOY_ENCLAVE=true && pnpm deploy:contracts",
"deploy:contracts:full": "export DEPLOY_ENCLAVE=true USE_MOCK_VERIFIER=true && pnpm deploy:contracts",
"test": "hardhat test mocha",
"verify": "hardhat run deploy/verify.ts"
"verify": "hardhat run deploy/verify.ts",
"updateSubmissionWindow": "hardhat ciphernode:window"
},
"dependencies": {
"@enclave-e3/contracts": "workspace:*",
Expand Down
2 changes: 2 additions & 0 deletions packages/enclave-contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
ciphernodeMintTokens,
ciphernodeRemove,
ciphernodeSiblings,
updateSubmissionWindow,
} from "./tasks/ciphernode";
import {
activateE3,
Expand Down Expand Up @@ -101,6 +102,7 @@ const config: HardhatUserConfig = {
publishCommittee,
enableE3,
cleanDeploymentsTask,
updateSubmissionWindow,
],
networks: {
hardhat: {
Expand Down
3 changes: 2 additions & 1 deletion packages/enclave-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@
"test:ciphernodeRegistry": "pnpm run test test/CiphernodeRegistry/CiphernodeRegistryOwnable.spec.ts",
"prerelease": "pnpm clean && pnpm compile && pnpm typechain",
"release": "pnpm publish",
"verify:contracts": "hardhat run scripts/runVerification.ts"
"verify:contracts": "hardhat run scripts/runVerification.ts",
"updateSubmissionWindow": "hardhat ciphernode:window"
},
"dependencies": {
"@openzeppelin/contracts-upgradeable": "^5.0.2",
Expand Down
39 changes: 39 additions & 0 deletions packages/enclave-contracts/tasks/ciphernode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { LeanIMT } from "@zk-kit/lean-imt";
import { ZeroAddress } from "ethers";
import { task } from "hardhat/config";
import { ArgumentType } from "hardhat/types/arguments";
import { poseidon2 } from "poseidon-lite";

export const ciphernodeAdd = task(
Expand Down Expand Up @@ -532,3 +533,41 @@ export const ciphernodeSiblings = task(
},
}))
.build();

export const updateSubmissionWindow = task(
"ciphernode:window",
"Update the submission window for the ciphernode registry",
)
.addOption({
name: "newWindow",
description: "the new submission window",
defaultValue: 10,
type: ArgumentType.INT,
})
.setAction(async () => ({
default: async ({ newWindow }, hre) => {
const { deployAndSaveCiphernodeRegistryOwnable } = await import(
"../scripts/deployAndSave/ciphernodeRegistryOwnable"
);

const { deployAndSavePoseidonT3 } = await import(
"../scripts/deployAndSave/poseidonT3"
);
const poseidonT3 = await deployAndSavePoseidonT3({ hre });

const { ciphernodeRegistry } =
await deployAndSaveCiphernodeRegistryOwnable({
hre,
poseidonT3Address: poseidonT3,
});

const tx =
await ciphernodeRegistry.setSortitionSubmissionWindow(newWindow);

console.log("Updating submission window... ", tx.hash);
await tx.wait();

console.log(`Submission window update to ${newWindow}`);
},
}))
.build();
Loading