From 0c98a266e2cfaa4fcfa3075b6a3d39f71041b1b6 Mon Sep 17 00:00:00 2001 From: Sasha <118575614+weboko@users.noreply.github.com> Date: Fri, 1 Dec 2023 13:20:48 +0100 Subject: [PATCH] fix: idCommitmnet little endianess (#86) * fix: idCommitmnet little endianess * stop double conversion --- src/rln_contract.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/rln_contract.ts b/src/rln_contract.ts index 58091e9..798f370 100644 --- a/src/rln_contract.ts +++ b/src/rln_contract.ts @@ -1,3 +1,4 @@ +import { hexToBytes } from "@waku/utils/bytes"; import { ethers } from "ethers"; import { RLN_REGISTRY_ABI, RLN_STORAGE_ABI } from "./constants.js"; @@ -169,15 +170,11 @@ export class RLNContract { return; } - const idCommitment = ethers.utils.zeroPad( - ethers.utils.arrayify(_idCommitment), - 32 - ); + const idCommitment = hexToBytes(_idCommitment?._hex); rlnInstance.insertMember(idCommitment); this._members.set(index.toNumber(), { index, - idCommitment: - _idCommitment?._hex || ethers.utils.hexlify(idCommitment), + idCommitment: _idCommitment?._hex, }); });