Skip to content

Commit 66261ed

Browse files
committed
Lint
1 parent c5f4331 commit 66261ed

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

sdk/zklogin/src/poseidon.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ const poseidonNumToHashFN = [
3939
poseidon16,
4040
];
4141

42-
export const BN254_FIELD_SIZE = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;
42+
export const BN254_FIELD_SIZE =
43+
21888242871839275222246405745257275088548364400416034343698204186575808495617n;
4344

4445
export function poseidonHash(inputs: (number | bigint | string)[]): bigint {
45-
inputs.forEach(x => {
46+
inputs.forEach((x) => {
4647
const b = BigInt(x);
4748
if (b < 0 || b >= BN254_FIELD_SIZE) {
4849
throw new Error(`Element ${b} not in the BN254 field`);

sdk/zklogin/test/poseidon.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
// Copyright (c) Mysten Labs, Inc.
2+
// SPDX-License-Identifier: Apache-2.0
13
import { expect, test } from 'vitest';
4+
25
import { BN254_FIELD_SIZE, poseidonHash } from '../src/poseidon';
36

47
test('can hash single input', () => {
@@ -16,5 +19,7 @@ test('throws error for invalid input', () => {
1619
});
1720

1821
test('throws error for invalid input greater than BN254_FIELD_SIZE', () => {
19-
expect(() => poseidonHash([BN254_FIELD_SIZE])).toThrowError('Element 21888242871839275222246405745257275088548364400416034343698204186575808495617 not in the BN254 field');
22+
expect(() => poseidonHash([BN254_FIELD_SIZE])).toThrowError(
23+
'Element 21888242871839275222246405745257275088548364400416034343698204186575808495617 not in the BN254 field',
24+
);
2025
});

0 commit comments

Comments
 (0)