From a20fac086e290723933765bf72b633edd0285e7b Mon Sep 17 00:00:00 2001 From: Arseniy Klempner Date: Mon, 15 Dec 2025 19:40:27 -0800 Subject: [PATCH] fix: remove unused index param --- packages/rln/src/proof.spec.ts | 1 - packages/rln/src/zerokit.ts | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/rln/src/proof.spec.ts b/packages/rln/src/proof.spec.ts index 61b084e617..6a1499db86 100644 --- a/packages/rln/src/proof.spec.ts +++ b/packages/rln/src/proof.spec.ts @@ -71,7 +71,6 @@ describe("RLN Proof Integration Tests", function () { const proof = await rlnInstance.zerokit.generateRLNProof( testMessage, - Number(membershipIndex), new Date(), credential.identity.IDSecretHash, merkleProof.map((element) => diff --git a/packages/rln/src/zerokit.ts b/packages/rln/src/zerokit.ts index e82a9089c2..d39aebde85 100644 --- a/packages/rln/src/zerokit.ts +++ b/packages/rln/src/zerokit.ts @@ -7,6 +7,7 @@ import { WitnessCalculator } from "./resources/witness_calculator"; import { BytesUtils } from "./utils/bytes.js"; import { dateToEpoch, epochIntToBytes } from "./utils/epoch.js"; import { poseidonHash, sha256 } from "./utils/hash.js"; +import { MERKLE_TREE_DEPTH } from "./utils/merkle.js"; export class Zerokit { public constructor( @@ -83,7 +84,6 @@ export class Zerokit { public async generateRLNProof( msg: Uint8Array, - index: number, // index of the leaf in the merkle tree epoch: Uint8Array | Date | undefined, idSecretHash: Uint8Array, pathElements: Uint8Array[], @@ -103,7 +103,10 @@ export class Zerokit { throw new Error( `ID secret hash must be 32 bytes, got ${idSecretHash.length}` ); - if (index < 0) throw new Error("index must be >= 0"); + if (pathElements.length !== MERKLE_TREE_DEPTH) + throw new Error(`Path elements must be ${MERKLE_TREE_DEPTH} bytes`); + if (identityPathIndex.length !== MERKLE_TREE_DEPTH) + throw new Error(`Identity path index must be ${MERKLE_TREE_DEPTH} bytes`); if ( rateLimit < RATE_LIMIT_PARAMS.MIN_RATE || rateLimit > RATE_LIMIT_PARAMS.MAX_RATE