fix: minor refactor

Co-authored-by: saleel <saleel@saleel.xyz>
This commit is contained in:
Shreyas Londhe
2024-11-22 12:06:50 +05:30
committed by GitHub
parent bb697f89e1
commit ff0094a2d6

View File

@@ -33,17 +33,11 @@ export async function poseidonModular(inputs: bigint[]): Promise<bigint> {
for (let i = 0; i < chunks; i++) {
const start = i * CHUNK_SIZE;
let end = start + CHUNK_SIZE;
let chunkHash: bigint;
if (end > numElements) {
// last chunk
end = numElements;
const lastChunk = inputs.slice(start, end);
chunkHash = poseidon.F.toObject(poseidon(lastChunk));
} else {
const chunk = inputs.slice(start, end);
chunkHash = poseidon.F.toObject(poseidon(chunk));
}
const chunk = inputs.slice(start, end);
const chunkHash = poseidon.F.toObject(poseidon(chunk));
if (i === 0) {
out = chunkHash;