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

Update code to be compatible with Winterfell 0.8 #1234

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

Fumuran
Copy link
Contributor

@Fumuran Fumuran commented Feb 7, 2024

This PR updates the code to be compatible with new 0.8 version of the Winterfell.

This update mostly contains changes in Felt creation, since casting of u64 to FieldElement was removed. It also updates the serialization and deserialization of the structs, which contain vectors of Felts or RpoDigests.

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Thank you! Looks good! Not a full review yet, but I've reviewed most of the files and left some comments inline.

Comment on lines 33 to +34
const FMP_MIN: Felt = Felt::new(crate::FMP_MIN);
const SYSCALL_FMP_MIN: Felt = Felt::new(crate::SYSCALL_FMP_MIN);
const SYSCALL_FMP_MIN: Felt = Felt::new(crate::SYSCALL_FMP_MIN as u64);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think FMP_MIN and SYSCALL_FMP_MIN are actually just 32 bit values. Maybe we should declare them as such?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to do so, but it turns out that there are quite a lot of places where we use these constants (mostly FMP_MIN) as a stack elements in tests, so I decided that it will be better just to use Felt::new() in some places and don't cast them to the u64 in a large number of places in the tests

Comment on lines 744 to 751
+ alphas[2].mul_base(
Felt::try_from((i + 1) as u64)
.expect("value is greater than or equal to the field modulus"),
Copy link
Contributor

Choose a reason for hiding this comment

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

i is guaranteed to be a u32 here because it the row index, I believe. Ideally, we should change the function signature to reflect this. If this is too much for this PR, then we should leave a TODO comment and use as u32 for i.

@Fumuran Fumuran force-pushed the andrew-integrate-winterfell branch 2 times, most recently from a6613c0 to 5e94731 Compare February 8, 2024 17:42
@Fumuran Fumuran force-pushed the andrew-integrate-winterfell branch 2 times, most recently from 4cd5712 to 42861af Compare February 8, 2024 22:43
@Fumuran Fumuran requested a review from bobbinth February 8, 2024 22:50
@Fumuran Fumuran force-pushed the andrew-integrate-winterfell branch from 42861af to e7479c2 Compare February 9, 2024 00:10
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you! I left a few small comments inline.

Before merging, let's make corresponding PRs in miden base and miden node (if needed).

Copy link
Collaborator

@Al-Kindi-0 Al-Kindi-0 left a comment

Choose a reason for hiding this comment

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

Looks good to me, thank you!

@Fumuran Fumuran force-pushed the andrew-integrate-winterfell branch from e7479c2 to 55d3359 Compare February 9, 2024 21:08
Base automatically changed from al-simplify-aux to next February 13, 2024 22:40
@bobbinth bobbinth force-pushed the andrew-integrate-winterfell branch from 55d3359 to 66c7a10 Compare February 13, 2024 22:46
@Fumuran Fumuran force-pushed the andrew-integrate-winterfell branch from 66c7a10 to 83d5e41 Compare February 14, 2024 15:48
@Fumuran Fumuran force-pushed the andrew-integrate-winterfell branch from 83d5e41 to 0f8f103 Compare February 14, 2024 19:33
@bobbinth bobbinth merged commit a11888e into next Feb 14, 2024
15 checks passed
@bobbinth bobbinth deleted the andrew-integrate-winterfell branch February 14, 2024 19:39
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.

3 participants