Skip to content
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.

fix: Fixes type Field cannot be used in for loop error #2

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

Conversation

mw2000
Copy link

@mw2000 mw2000 commented Oct 9, 2024

Fixes #1

Tweaked the type of nRounds, which should fix the issue. Also specified datatypes for the generics, and added a README update to import the package.

Tweaked the type of , which should fix the issue. Also specified datatypes for the generics, and added a README update to import the package.
@mw2000
Copy link
Author

mw2000 commented Oct 9, 2024

New to noir, lmk if anything doesn't look good!

@KumaCrypto
Copy link
Owner

Hey @mw2000! Thanks for reaching out and for your PR!

I originally wrote this library when the latest beta version of Noir was 0.23.0. It seems there have been some syntax changes since then, so I’ll need to update the library and tag it accordingly.

I’ll look into the language updates and get back to you with my thoughts on your PR 😄 My initial thoughts are that I understand the compiler error; it seems we can no longer use Field types in for loops, so updating the nRounds type makes sense. However, I’m not clear on the need for unsigned integer types for generics, as it adds constraint overhead. Perhaps Field would work better here? But as I said, I’ll explore it further!

And regarding the README fix - nice catch, thanks 😅

@KumaCrypto KumaCrypto self-requested a review October 9, 2024 05:42
@mw2000
Copy link
Author

mw2000 commented Oct 9, 2024

Thank you for the quick response 🫡

I appreciate the feedback. The generics was a warning in compiler 0.33.0; we can eliminate that particular change.

However, I believe it's internally converting it into a u32 without specifying the generics since it's being used in the for loops here -> https://github.com/KumaCrypto/mimc_sponge_noir/pull/2/files#diff-7d9659023f15743be35b9fdc7638990bb804588e410a7f778802dd2be3c87707R14

https://github.com/KumaCrypto/mimc_sponge_noir/pull/2/files#diff-7d9659023f15743be35b9fdc7638990bb804588e410a7f778802dd2be3c87707R19

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

Successfully merging this pull request may close these issues.

Running into type Field cannot be used in for loop error
2 participants