Skip to content

Commit db5c568

Browse files
committed
fix: remove unused index param
1 parent e66adf2 commit db5c568

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

packages/rln/src/proof.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ describe("RLN Proof Integration Tests", function () {
7171

7272
const proof = await rlnInstance.zerokit.generateRLNProof(
7373
testMessage,
74-
Number(membershipIndex),
7574
new Date(),
7675
credential.identity.IDSecretHash,
7776
merkleProof.map((element) =>

packages/rln/src/zerokit.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { WitnessCalculator } from "./resources/witness_calculator";
77
import { BytesUtils } from "./utils/bytes.js";
88
import { dateToEpoch, epochIntToBytes } from "./utils/epoch.js";
99
import { poseidonHash, sha256 } from "./utils/hash.js";
10+
import { MERKLE_TREE_DEPTH } from "./utils/merkle.js";
1011

1112
export class Zerokit {
1213
public constructor(
@@ -83,7 +84,6 @@ export class Zerokit {
8384

8485
public async generateRLNProof(
8586
msg: Uint8Array,
86-
index: number, // index of the leaf in the merkle tree
8787
epoch: Uint8Array | Date | undefined,
8888
idSecretHash: Uint8Array,
8989
pathElements: Uint8Array[],
@@ -103,7 +103,10 @@ export class Zerokit {
103103
throw new Error(
104104
`ID secret hash must be 32 bytes, got ${idSecretHash.length}`
105105
);
106-
if (index < 0) throw new Error("index must be >= 0");
106+
if (pathElements.length !== MERKLE_TREE_DEPTH)
107+
throw new Error(`Path elements must be ${MERKLE_TREE_DEPTH} bytes`);
108+
if (identityPathIndex.length !== MERKLE_TREE_DEPTH)
109+
throw new Error(`Identity path index must be ${MERKLE_TREE_DEPTH} bytes`);
107110
if (
108111
rateLimit < RATE_LIMIT_PARAMS.MIN_RATE ||
109112
rateLimit > RATE_LIMIT_PARAMS.MAX_RATE

0 commit comments

Comments
 (0)