@semaphore-protocol/contracts 3.5.0 → 3.6.0-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Semaphore.sol
CHANGED
|
@@ -79,11 +79,10 @@ contract Semaphore is ISemaphore, SemaphoreGroups {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
/// @dev See {ISemaphore-updateGroupMerkleTreeDuration}.
|
|
82
|
-
function updateGroupMerkleTreeDuration(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
{
|
|
82
|
+
function updateGroupMerkleTreeDuration(
|
|
83
|
+
uint256 groupId,
|
|
84
|
+
uint256 newMerkleTreeDuration
|
|
85
|
+
) external override onlyGroupAdmin(groupId) {
|
|
87
86
|
uint256 oldMerkleTreeDuration = groups[groupId].merkleTreeDuration;
|
|
88
87
|
|
|
89
88
|
groups[groupId].merkleTreeDuration = newMerkleTreeDuration;
|
|
@@ -101,11 +100,10 @@ contract Semaphore is ISemaphore, SemaphoreGroups {
|
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
/// @dev See {ISemaphore-addMembers}.
|
|
104
|
-
function addMembers(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
{
|
|
103
|
+
function addMembers(
|
|
104
|
+
uint256 groupId,
|
|
105
|
+
uint256[] calldata identityCommitments
|
|
106
|
+
) external override onlyGroupAdmin(groupId) {
|
|
109
107
|
for (uint256 i = 0; i < identityCommitments.length; ) {
|
|
110
108
|
_addMember(groupId, identityCommitments[i]);
|
|
111
109
|
|
|
@@ -31,11 +31,7 @@ contract SemaphoreVoting is ISemaphoreVoting, SemaphoreGroups {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/// @dev See {ISemaphoreVoting-createPoll}.
|
|
34
|
-
function createPoll(
|
|
35
|
-
uint256 pollId,
|
|
36
|
-
address coordinator,
|
|
37
|
-
uint256 merkleTreeDepth
|
|
38
|
-
) public override {
|
|
34
|
+
function createPoll(uint256 pollId, address coordinator, uint256 merkleTreeDepth) public override {
|
|
39
35
|
if (merkleTreeDepth < 16 || merkleTreeDepth > 32) {
|
|
40
36
|
revert Semaphore__MerkleTreeDepthIsNotSupported();
|
|
41
37
|
}
|
|
@@ -68,12 +64,7 @@ contract SemaphoreVoting is ISemaphoreVoting, SemaphoreGroups {
|
|
|
68
64
|
}
|
|
69
65
|
|
|
70
66
|
/// @dev See {ISemaphoreVoting-castVote}.
|
|
71
|
-
function castVote(
|
|
72
|
-
uint256 vote,
|
|
73
|
-
uint256 nullifierHash,
|
|
74
|
-
uint256 pollId,
|
|
75
|
-
uint256[8] calldata proof
|
|
76
|
-
) public override {
|
|
67
|
+
function castVote(uint256 vote, uint256 nullifierHash, uint256 pollId, uint256[8] calldata proof) public override {
|
|
77
68
|
if (polls[pollId].state != PollState.Ongoing) {
|
|
78
69
|
revert Semaphore__PollIsNotOngoing();
|
|
79
70
|
}
|
|
@@ -33,11 +33,7 @@ contract SemaphoreWhistleblowing is ISemaphoreWhistleblowing, SemaphoreGroups {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/// @dev See {ISemaphoreWhistleblowing-createEntity}.
|
|
36
|
-
function createEntity(
|
|
37
|
-
uint256 entityId,
|
|
38
|
-
address editor,
|
|
39
|
-
uint256 merkleTreeDepth
|
|
40
|
-
) public override {
|
|
36
|
+
function createEntity(uint256 entityId, address editor, uint256 merkleTreeDepth) public override {
|
|
41
37
|
if (merkleTreeDepth < 16 || merkleTreeDepth > 32) {
|
|
42
38
|
revert Semaphore__MerkleTreeDepthIsNotSupported();
|
|
43
39
|
}
|
|
@@ -36,14 +36,14 @@ interface ISemaphore {
|
|
|
36
36
|
/// @dev Emitted when a Semaphore proof is verified.
|
|
37
37
|
/// @param groupId: Id of the group.
|
|
38
38
|
/// @param merkleTreeRoot: Root of the Merkle tree.
|
|
39
|
-
/// @param externalNullifier: External nullifier.
|
|
40
39
|
/// @param nullifierHash: Nullifier hash.
|
|
40
|
+
/// @param externalNullifier: External nullifier.
|
|
41
41
|
/// @param signal: Semaphore signal.
|
|
42
42
|
event ProofVerified(
|
|
43
43
|
uint256 indexed groupId,
|
|
44
44
|
uint256 indexed merkleTreeRoot,
|
|
45
|
-
uint256 indexed externalNullifier,
|
|
46
45
|
uint256 nullifierHash,
|
|
46
|
+
uint256 indexed externalNullifier,
|
|
47
47
|
uint256 signal
|
|
48
48
|
);
|
|
49
49
|
|
|
@@ -68,23 +68,14 @@ interface ISemaphore {
|
|
|
68
68
|
/// @param groupId: Id of the group.
|
|
69
69
|
/// @param depth: Depth of the tree.
|
|
70
70
|
/// @param admin: Admin of the group.
|
|
71
|
-
function createGroup(
|
|
72
|
-
uint256 groupId,
|
|
73
|
-
uint256 depth,
|
|
74
|
-
address admin
|
|
75
|
-
) external;
|
|
71
|
+
function createGroup(uint256 groupId, uint256 depth, address admin) external;
|
|
76
72
|
|
|
77
73
|
/// @dev Creates a new group. Only the admin will be able to add or remove members.
|
|
78
74
|
/// @param groupId: Id of the group.
|
|
79
75
|
/// @param depth: Depth of the tree.
|
|
80
76
|
/// @param admin: Admin of the group.
|
|
81
77
|
/// @param merkleTreeRootDuration: Time before the validity of a root expires.
|
|
82
|
-
function createGroup(
|
|
83
|
-
uint256 groupId,
|
|
84
|
-
uint256 depth,
|
|
85
|
-
address admin,
|
|
86
|
-
uint256 merkleTreeRootDuration
|
|
87
|
-
) external;
|
|
78
|
+
function createGroup(uint256 groupId, uint256 depth, address admin, uint256 merkleTreeRootDuration) external;
|
|
88
79
|
|
|
89
80
|
/// @dev Updates the group admin.
|
|
90
81
|
/// @param groupId: Id of the group.
|
|
@@ -52,11 +52,7 @@ interface ISemaphoreVoting {
|
|
|
52
52
|
/// @param pollId: Id of the poll.
|
|
53
53
|
/// @param coordinator: Coordinator of the poll.
|
|
54
54
|
/// @param merkleTreeDepth: Depth of the tree.
|
|
55
|
-
function createPoll(
|
|
56
|
-
uint256 pollId,
|
|
57
|
-
address coordinator,
|
|
58
|
-
uint256 merkleTreeDepth
|
|
59
|
-
) external;
|
|
55
|
+
function createPoll(uint256 pollId, address coordinator, uint256 merkleTreeDepth) external;
|
|
60
56
|
|
|
61
57
|
/// @dev Adds a voter to a poll.
|
|
62
58
|
/// @param pollId: Id of the poll.
|
|
@@ -73,12 +69,7 @@ interface ISemaphoreVoting {
|
|
|
73
69
|
/// @param nullifierHash: Nullifier hash.
|
|
74
70
|
/// @param pollId: Id of the poll.
|
|
75
71
|
/// @param proof: Private zk-proof parameters.
|
|
76
|
-
function castVote(
|
|
77
|
-
uint256 vote,
|
|
78
|
-
uint256 nullifierHash,
|
|
79
|
-
uint256 pollId,
|
|
80
|
-
uint256[8] calldata proof
|
|
81
|
-
) external;
|
|
72
|
+
function castVote(uint256 vote, uint256 nullifierHash, uint256 pollId, uint256[8] calldata proof) external;
|
|
82
73
|
|
|
83
74
|
/// @dev Ends a pull and publishes the key to decrypt the votes.
|
|
84
75
|
/// @param pollId: Id of the poll.
|
|
@@ -25,11 +25,7 @@ interface ISemaphoreWhistleblowing {
|
|
|
25
25
|
/// @param entityId: Id of the entity.
|
|
26
26
|
/// @param editor: Editor of the entity.
|
|
27
27
|
/// @param merkleTreeDepth: Depth of the tree.
|
|
28
|
-
function createEntity(
|
|
29
|
-
uint256 entityId,
|
|
30
|
-
address editor,
|
|
31
|
-
uint256 merkleTreeDepth
|
|
32
|
-
) external;
|
|
28
|
+
function createEntity(uint256 entityId, address editor, uint256 merkleTreeDepth) external;
|
|
33
29
|
|
|
34
30
|
/// @dev Adds a whistleblower to an entity.
|
|
35
31
|
/// @param entityId: Id of the entity.
|
|
@@ -53,10 +49,5 @@ interface ISemaphoreWhistleblowing {
|
|
|
53
49
|
/// @param nullifierHash: Nullifier hash.
|
|
54
50
|
/// @param entityId: Id of the entity.
|
|
55
51
|
/// @param proof: Private zk-proof parameters.
|
|
56
|
-
function publishLeak(
|
|
57
|
-
uint256 leak,
|
|
58
|
-
uint256 nullifierHash,
|
|
59
|
-
uint256 entityId,
|
|
60
|
-
uint256[8] calldata proof
|
|
61
|
-
) external;
|
|
52
|
+
function publishLeak(uint256 leak, uint256 nullifierHash, uint256 entityId, uint256[8] calldata proof) external;
|
|
62
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semaphore-protocol/contracts",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0-1",
|
|
4
4
|
"description": "Semaphore contracts to manage groups and broadcast anonymous signals.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -32,5 +32,6 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@openzeppelin/contracts": "4.7.3",
|
|
34
34
|
"@zk-kit/incremental-merkle-tree.sol": "1.3.3"
|
|
35
|
-
}
|
|
35
|
+
},
|
|
36
|
+
"stableVersion": "3.5.0"
|
|
36
37
|
}
|