Skip to content

Commit

Permalink
fix: minor refactor
Browse files Browse the repository at this point in the history
Co-authored-by: saleel <[email protected]>
  • Loading branch information
shreyas-londhe and saleel authored Nov 22, 2024
1 parent bb697f8 commit ff0094a
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions packages/helpers/src/hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ff0094a

Please sign in to comment.