Skip to content

Commit 93cd86b

Browse files
committed
refactor(contracts): update SemaphoreVerifierKeyPts library to be internal
re semaphore-protocol#330
1 parent 163c9c1 commit 93cd86b

File tree

3 files changed

+6
-27
lines changed

3 files changed

+6
-27
lines changed

packages/contracts/contracts/base/SemaphoreVerifierKeyPts.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ library SemaphoreVerifierKeyPts {
974974
hex"1ff343732becbc72450b2faedef7112b951edf2ee03bebe4b71365755e6d5518"
975975
hex"10e06fbbc2176bff93433750bcbfec05aea120f193a1e4c5bf5993e098916f96";
976976

977-
function get_pts(uint256 merkleTreeDepth) public pure returns (uint256[SET_SIZE] memory pts) {
977+
function get_pts(uint256 merkleTreeDepth) internal pure returns (uint256[SET_SIZE] memory pts) {
978978
bytes memory pt_bytes = VK_POINT_BYTES;
979979
uint256 byte_offset = 32 + (merkleTreeDepth - 1) * SET_SIZE * 32;
980980

packages/contracts/scripts/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { readFileSync, writeFileSync } from "fs"
33
import { FactoryOptions } from "hardhat/types"
44

55
export type NetworkDeployedContracts = {
6-
name: "Semaphore" | "SemaphoreVerifier" | "PoseidonT3" | "SemaphoreVerifierKeyPts"
6+
name: "Semaphore" | "SemaphoreVerifier" | "PoseidonT3"
77
address: string
88
startBlock: number
99
}[]

packages/contracts/tasks/deploy.ts

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,26 @@ import { task, types } from "hardhat/config"
33
import { deploy, saveDeployedContracts } from "../scripts/utils"
44

55
task("deploy", "Deploy a Semaphore contract")
6-
.addOptionalParam<string>("verifierKeyPts", "Verifier key points library address", undefined, types.string)
76
.addOptionalParam<string>("verifier", "Verifier contract address", undefined, types.string)
87
.addOptionalParam<string>("poseidon", "Poseidon library address", undefined, types.string)
98
.addOptionalParam<boolean>("logs", "Print the logs", true, types.boolean)
109
.setAction(
1110
async (
12-
{
13-
logs,
14-
verifierKeyPts: verifierKeyPtsAddress,
15-
verifier: semaphoreVerifierAddress,
16-
poseidon: poseidonT3Address
17-
},
11+
{ logs, verifier: semaphoreVerifierAddress, poseidon: poseidonT3Address },
1812
{ ethers, hardhatArguments }
1913
): Promise<any> => {
2014
const startBlock = await ethers.provider.getBlockNumber()
2115

22-
if (!verifierKeyPtsAddress) {
23-
verifierKeyPtsAddress = await deploy(ethers, "SemaphoreVerifierKeyPts", hardhatArguments.network)
24-
if (logs) {
25-
console.info(`SemaphoreVerifierKeyPts library has been deployed to: ${verifierKeyPtsAddress}`)
26-
}
27-
}
28-
2916
if (!semaphoreVerifierAddress) {
30-
semaphoreVerifierAddress = await deploy(ethers, "SemaphoreVerifier", hardhatArguments.network, [], {
31-
libraries: {
32-
SemaphoreVerifierKeyPts: verifierKeyPtsAddress
33-
}
34-
})
17+
semaphoreVerifierAddress = await deploy(ethers, "SemaphoreVerifier", hardhatArguments.network)
3518
if (logs) {
3619
console.info(`SemaphoreVerifier contract has been deployed to: ${semaphoreVerifierAddress}`)
3720
}
3821
}
3922

4023
if (!poseidonT3Address) {
4124
poseidonT3Address = await deploy(ethers, "PoseidonT3", hardhatArguments.network)
25+
4226
if (logs) {
4327
console.info(`PoseidonT3 library has been deployed to: ${poseidonT3Address}`)
4428
}
@@ -55,17 +39,13 @@ task("deploy", "Deploy a Semaphore contract")
5539
}
5640
}
5741
)
42+
5843
if (logs) {
5944
console.info(`Semaphore contract has been deployed to: ${semaphoreAddress}`)
6045
}
6146

6247
saveDeployedContracts(
6348
[
64-
{
65-
name: "SemaphoreVerifierKeyPts",
66-
address: verifierKeyPtsAddress,
67-
startBlock
68-
},
6949
{
7050
name: "SemaphoreVerifier",
7151
address: semaphoreVerifierAddress,
@@ -88,7 +68,6 @@ task("deploy", "Deploy a Semaphore contract")
8868
return {
8969
semaphore: await ethers.getContractAt("Semaphore", semaphoreAddress),
9070
verifierAddress: semaphoreVerifierAddress,
91-
verifierKeyPtsAddress,
9271
poseidonAddress: poseidonT3Address
9372
}
9473
}

0 commit comments

Comments
 (0)