From 66261ed529ab1f383bef279778b0e5568a1a0047 Mon Sep 17 00:00:00 2001 From: Deepak Maram Date: Tue, 26 Mar 2024 17:30:45 -0400 Subject: [PATCH] Lint --- sdk/zklogin/src/poseidon.ts | 5 +++-- sdk/zklogin/test/poseidon.test.ts | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sdk/zklogin/src/poseidon.ts b/sdk/zklogin/src/poseidon.ts index 2c6d5340c0834..c002176e7df3a 100644 --- a/sdk/zklogin/src/poseidon.ts +++ b/sdk/zklogin/src/poseidon.ts @@ -39,10 +39,11 @@ const poseidonNumToHashFN = [ poseidon16, ]; -export const BN254_FIELD_SIZE = 21888242871839275222246405745257275088548364400416034343698204186575808495617n; +export const BN254_FIELD_SIZE = + 21888242871839275222246405745257275088548364400416034343698204186575808495617n; export function poseidonHash(inputs: (number | bigint | string)[]): bigint { - inputs.forEach(x => { + inputs.forEach((x) => { const b = BigInt(x); if (b < 0 || b >= BN254_FIELD_SIZE) { throw new Error(`Element ${b} not in the BN254 field`); diff --git a/sdk/zklogin/test/poseidon.test.ts b/sdk/zklogin/test/poseidon.test.ts index 314c567dabad6..7499b7164e5b4 100644 --- a/sdk/zklogin/test/poseidon.test.ts +++ b/sdk/zklogin/test/poseidon.test.ts @@ -1,4 +1,7 @@ +// Copyright (c) Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 import { expect, test } from 'vitest'; + import { BN254_FIELD_SIZE, poseidonHash } from '../src/poseidon'; test('can hash single input', () => { @@ -16,5 +19,7 @@ test('throws error for invalid input', () => { }); test('throws error for invalid input greater than BN254_FIELD_SIZE', () => { - expect(() => poseidonHash([BN254_FIELD_SIZE])).toThrowError('Element 21888242871839275222246405745257275088548364400416034343698204186575808495617 not in the BN254 field'); + expect(() => poseidonHash([BN254_FIELD_SIZE])).toThrowError( + 'Element 21888242871839275222246405745257275088548364400416034343698204186575808495617 not in the BN254 field', + ); });