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

Upgrade to 2.7.0 #321

Merged
merged 35 commits into from
Aug 14, 2024
Merged

Upgrade to 2.7.0 #321

merged 35 commits into from
Aug 14, 2024

Conversation

gaetbout
Copy link
Collaborator

@gaetbout gaetbout commented Jul 24, 2024

Pull Request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

What is the new behavior?

Made some function deprecated.
Upgrade the code to 2.7
Fixed all warnings
Tried to make some fn generic (didn't look through all of em)
Replaced some while pop_front to for loop
Updated all assert to assert! and removed their error message as the default one is a good enough default value

@gaetbout gaetbout changed the title [DRAFT] Upgrade to 2.7.0-rc3 [DRAFT] Upgrade to 2.7.0 Aug 5, 2024
@gaetbout gaetbout marked this pull request as ready for review August 5, 2024 16:48
@gaetbout
Copy link
Collaborator Author

gaetbout commented Aug 5, 2024

@0xLucqs Ready for review.
An upgrade to latest edition should still be performed, will open an issue

Copy link
Collaborator

@0xLucqs 0xLucqs left a comment

Choose a reason for hiding this comment

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

^

Copy link
Contributor

@milancermak milancermak left a comment

Choose a reason for hiding this comment

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

Random things I've noticed (not necessarily enabled by 2.7.0):

  • in bytes/src/utils.cairo, uint_min can be removed, replaced by core::cmp::min
  • there's probably something that can be done with iterators on ByteReader, Queue, Stack, Vec and elsewhere(?)

Since we now have const arrays (❤️ dw ❤️), IMO it's worth adding optimized pow2 and pow10 as these are the most commonly used power functions. Even in Alexandria, all the bitshift fns use pow(2, n).

packages/bytes/src/storage.cairo Outdated Show resolved Hide resolved
packages/bytes/src/storage.cairo Outdated Show resolved Hide resolved
packages/linalg/src/kron.cairo Outdated Show resolved Hide resolved
packages/storage/src/list.cairo Show resolved Hide resolved
@gaetbout
Copy link
Collaborator Author

gaetbout commented Aug 6, 2024

Random things I've noticed (not necessarily enabled by 2.7.0):

  • in bytes/src/utils.cairo, uint_min can be removed, replaced by core::cmp::min
  • there's probably something that can be done with iterators on ByteReader, Queue, Stack, Vec and elsewhere(?)

Since we now have const arrays (❤️ dw ❤️), IMO it's worth adding optimized pow2 and pow10 as these are the most commonly used power functions. Even in Alexandria, all the bitshift fns use pow(2, n).

  • updated utils.cairo
  • y, but I'd leave it for another PR as those are "extra" changes and this PR is big enough

Also would leave for another PR 😅 , please open an issue for that

@enitrat
Copy link
Collaborator

enitrat commented Aug 7, 2024

@gaetbout we should suppress the warnings on compilation otherwise it's going to appear on all dependent repositories

@gaetbout
Copy link
Collaborator Author

gaetbout commented Aug 7, 2024

I removed all warnings that are from the code of alexandria lib.
I believe the new warnings are from using now deprecated Alexandria stuff

packages/bytes/src/bytes.cairo Show resolved Hide resolved
packages/bytes/src/bytes.cairo Show resolved Hide resolved
packages/bytes/src/storage.cairo Outdated Show resolved Hide resolved
@enitrat
Copy link
Collaborator

enitrat commented Aug 7, 2024

my point is: what currently is used inside alexandria itself should not be triggering warnings

@gaetbout
Copy link
Collaborator Author

gaetbout commented Aug 7, 2024

Ok, I understood your point thanks!
Will look into it when I have some time.
Nice to have lots of eyes on this 😃

@gaetbout
Copy link
Collaborator Author

@0xLucqs ?

@0xLucqs 0xLucqs requested review from enitrat and milancermak August 12, 2024 08:18
@enitrat enitrat requested a review from 0xLucqs August 12, 2024 12:48
@gaetbout
Copy link
Collaborator Author

@0xLucqs ? :D

@0xLucqs
Copy link
Collaborator

0xLucqs commented Aug 14, 2024

I want @milancermak to approve as well

Copy link
Contributor

@milancermak milancermak left a comment

Choose a reason for hiding this comment

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

LGTM! Leaving just a bunch of nits.

If you fancy, there's a bunch of places where the while-let can be updated to a for-in (e.g. in array_ext.cairo or sha256.cairo, though the latter is deprecated, so meh).

packages/numeric/src/trapezoidal_rule.cairo Outdated Show resolved Hide resolved
packages/merkle_tree/src/merkle_tree.cairo Outdated Show resolved Hide resolved
packages/merkle_tree/src/merkle_tree.cairo Outdated Show resolved Hide resolved
@0xLucqs 0xLucqs merged commit e1b0805 into keep-starknet-strange:main Aug 14, 2024
4 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 16, 2024
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.

4 participants