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
5 changes: 5 additions & 0 deletions packages/interfold-contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ To request a new committee, run
pnpm run hardhat committee:new --network [network]
```

The task requests the BFV parameter set of the active circuit build
(`ACTIVE_BFV_PARAM_SET` in `scripts/utils.ts`). To request another set, add
`--param-set 0` (insecure-512) or `--param-set 1` (secure-8192). The task stops
before it sends a transaction when the deployment has not registered that set.

To publish the public key of a committee, run

```sh
Expand Down
25 changes: 20 additions & 5 deletions packages/interfold-contracts/tasks/interfold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { task } from "hardhat/config";
import { ArgumentType } from "hardhat/types/arguments";
import path from "path";

import { readDeploymentArgs } from "../scripts/utils";
import { ACTIVE_BFV_PARAM_SET, readDeploymentArgs } from "../scripts/utils";
import { assertCommitteeOwnerCapacity } from "./committeeCapacity";
import { assembleUniqueCommitteePublicKey } from "./committeePublicKey";
import { stageMockDataAvailabilityObject } from "./mockDataAvailability";
Expand Down Expand Up @@ -206,6 +206,13 @@ export const requestCommittee = task(
defaultValue: 0,
type: ArgumentType.INT,
})
.addOption({
name: "paramSet",
description:
"BFV parameter set (0=insecure-512, 1=secure-8192; default: the set of the active circuit build)",
defaultValue: ACTIVE_BFV_PARAM_SET,
type: ArgumentType.INT,
})
.addOption({
name: "inputWindowStart",
description: "start of input submission window (default: now + 300)",
Expand Down Expand Up @@ -246,6 +253,7 @@ export const requestCommittee = task(
default: async (
{
committeeSize,
paramSet,
inputWindowStart,
inputWindowEnd,
e3Address,
Expand All @@ -260,6 +268,8 @@ export const requestCommittee = task(
"Invalid committee size - expected 0 (Minimum), 1 (Micro), or 2 (Small).",
);
}
// Throws for an unknown set before the task sends a transaction.
const expectedCryptoConfigId = cryptoConfigIdForParamSet(paramSet);

const connection = await hre.network.connect();
const { ethers } = connection;
Expand All @@ -270,6 +280,14 @@ export const requestCommittee = task(

const { interfold } = await getInterfoldConnection(hre);

// getE3Quote also rejects an unregistered set, but the build strips revert strings, so that
// revert carries no reason.
if ((await interfold.paramSetRegistry(paramSet)) === "0x") {
throw new Error(
`BFV parameter set ${paramSet} is not registered on this Interfold deployment. No E3 was requested.`,
);
}

const { mockStableToken: mockUSDC } = await deployAndSaveMockStableToken({
hre,
});
Expand Down Expand Up @@ -310,9 +328,6 @@ export const requestCommittee = task(
hre.globalOptions.network,
);

// paramSet: 0 = Insecure512, 1 = Secure8192
const paramSet = 0;

let computeProviderParams = computeParams;
const mockDecryptionVerifierArgs = readDeploymentArgs(
"MockDecryptionVerifier",
Expand Down Expand Up @@ -347,7 +362,7 @@ export const requestCommittee = task(
computeProviderParams,
customParams,
expectedFeeToken: await mockUSDCContract.getAddress(),
expectedCryptoConfigId: cryptoConfigIdForParamSet(paramSet),
expectedCryptoConfigId,
maxFee: MaxUint256,
};

Expand Down
Loading