-
Notifications
You must be signed in to change notification settings - Fork 353
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 scarb edition to 2024_07 #1138
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ggonzalez94, the PR is looking good. A couple of comments:
- We can consolidate imports into fewer lines (I signaled a couple of places, but this applies to the entire PR).
- Note that while adding pub to mocks (and presets) Storage struct makes sense because we access the storage directly in tests, generally, we shouldn't make contracts Storage public, since they are usually not accessed outside the contract itself. I think we shouldn't update doc site examples making the Storage struct public for example.
use starknet::storage::Map; | ||
use starknet::storage::StorageMapReadAccess; | ||
use starknet::storage::StorageMapWriteAccess; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use starknet::storage::Map; | |
use starknet::storage::StorageMapReadAccess; | |
use starknet::storage::StorageMapWriteAccess; | |
use starknet::storage::{Map, StorageMapReadAccess, StorageMapWriteAccess}; |
use starknet::storage::StoragePointerReadAccess; | ||
use starknet::storage::StoragePointerWriteAccess; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use starknet::storage::StoragePointerReadAccess; | |
use starknet::storage::StoragePointerWriteAccess; | |
use starknet::storage::{StoragePointerReadAccess, StoragePointerWriteAccess}; |
@ericnordelo thanks for taking a look even when this was in draft!
Agreed! This was just the IDE autocompletion, I was already planning to refactor this
When I applied the changes I did it so that it compiles with the edition changes and then we can figure out the best way forward. It is my understanding that before this edition the compiler automatically adds the pub modifier to struct and fields, is that correct? If that's the case then if we want to avoid breaking changes we should apply the same to our components. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even when this does not change the library's public API, we should add an entry to the CHANGELOG for consistency.
Absolutely! I was just waiting for #1137 to get merged to avoid merge conflicts. I added a simple entry under the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR looks good! I left a couple questions
struct Storage {} | ||
pub struct Storage {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better if we make empty storage structs not public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it makes much of a difference, right? But it might be easy to overlook adding the pub
keyword if we add some field to it. I can remove all pub
from all empty storage structs if you feel strongly about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it makes much of a difference, right?
Yeahhh this really just occurs with mocks, right? No strong opinions on this. I think it's okay as is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Fixes #1048
This PR upgades our codebase to scarb 2024_07 edition. Biggest changes are:
pub
by default anymore. So we have to manually define them aspub
.PR Checklist