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

Migrate to the 2023_11 edition. #995

Merged

Conversation

ericnordelo
Copy link
Member

@ericnordelo ericnordelo commented May 27, 2024

Fixes #856

PR Checklist

  • Tests
  • Documentation
  • Added entry to CHANGELOG.md
  • Tried the feature on a public network

@ericnordelo ericnordelo marked this pull request as ready for review June 3, 2024 10:08
Copy link
Collaborator

@andrew-fleming andrew-fleming left a comment

Choose a reason for hiding this comment

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

Great work on the migration, Eric! I left some comments. Two more things:

  1. I believe we need to add pub to all the listed modules in src/lib.cairo. You can target your repo and branch in scarb to test this. Currently, nothing's accessible on my end. Let me know if I'm mistaken
  2. We also need to update the syntax in the docs...probably better to do it in a separate PR but IMO this should be a priority before we release

@@ -46,7 +47,7 @@ mod AccountUpgradeable {
}

#[constructor]
fn constructor(ref self: ContractState, public_key: felt252) {
pub(crate) fn constructor(ref self: ContractState, public_key: felt252) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We're just using pub(crate) so the tests can access this, right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Some of the other presets don't require this with testing. Should we directly test x::constructor in the other presets for consistency (thus making all preset constructors require pub(crate))?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we can address this in the migration to foundry issues, so that we can refactor the tests accordingly to be as consistent as possible (note that the udc for example require the pub keyword in the event struct, because there's no component, and this should be probably addressed as well).

@@ -1,5 +1,5 @@
mod test_accesscontrol;
mod test_dual_accesscontrol;
mod test_dual_ownable;
mod test_ownable;
pub(crate) mod test_ownable;
Copy link
Collaborator

Choose a reason for hiding this comment

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

For organizational purposes, do you think we should create shared or common test files for shared test helpers (like event assertions)? pub(crate)ing this particular test module appears a bit random

Copy link
Member Author

Choose a reason for hiding this comment

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

that's a great idea, I refactored the modules a bit to make the common module the only public one. Let me know what you think.

Copy link
Collaborator

Choose a reason for hiding this comment

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

MUCH much better :) nice work!

src/tests/account.cairo Outdated Show resolved Hide resolved
src/tests/token/test_erc20_votes.cairo Show resolved Hide resolved
src/tests/token/test_erc721.cairo Show resolved Hide resolved
src/tests/utils.cairo Show resolved Hide resolved
@ericnordelo
Copy link
Member Author

We also need to update the syntax in the docs...probably better to do it in a separate PR but IMO this should be a priority before we release

Agree, let's get this PR merged first, and then I will go through the docs to check each example.

Copy link
Collaborator

@andrew-fleming andrew-fleming left a comment

Choose a reason for hiding this comment

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

Nice work with the common file additions! I think we just need to remove the constants section in the utils docs since this won't be public anymore (https://docs.openzeppelin.com/contracts-cairo/0.13.0/api/utilities#constants). Other than that, I think this is good to go!

@ericnordelo ericnordelo merged commit 26d875f into OpenZeppelin:main Jun 13, 2024
6 checks passed
@ericnordelo ericnordelo deleted the feat/migrate-to-latest-edition-#856 branch June 13, 2024 11:00
@andrew-fleming andrew-fleming mentioned this pull request Jul 12, 2024
4 tasks
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.

Migrate to the 2023_11 edition
2 participants