Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Added Poseidon Modular Tests #234

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shreyas-londhe
Copy link
Member

Description

This PR includes a test for the PoseidonModular template, which will help others to utilise this template elsewhere.

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • I have discussed with the team prior to submitting this PR
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

Comment on lines +36 to +46
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));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional cleanup:

Suggested change
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));
}
if (end > numElements) {
end = numElements;
}
const chunk = inputs.slice(start, end);
const chunkHash = poseidon.F.toObject(poseidon(chunk));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants