-
Notifications
You must be signed in to change notification settings - Fork 480
Introduce entrance crate #1223
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
Introduce entrance crate #1223
Conversation
|
Could you add the changes to the unreleased section of the |
|
This is maybe shaving the yak but we should also re-export crates that are simply necessary for a contract to import. Otherwise it is just a chore to keep the versions in-sync. Talking about |
Codecov Report
@@ Coverage Diff @@
## master #1223 +/- ##
==========================================
- Coverage 71.87% 71.68% -0.20%
==========================================
Files 186 187 +1
Lines 5827 5844 +17
==========================================
+ Hits 4188 4189 +1
- Misses 1639 1655 +16
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
cmichi
left a comment
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.
This is so nice! 🚀
athei
left a comment
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 think we should renameink_lang_macro to ink_macro.
Co-authored-by: Michael Müller <[email protected]>
It would be nice and that was also my original intention, however it does introduce a wrinkle: when using these reexported crates for Of course in our codegen we can apply that attribute ourselves but if the user wants to use them like So I think it is definitely worth exploring to see if we can make it work, as a follow up. I would also like to see just a single crate. |
|
I didn't think about that. This is a complication. Yeah let's put more thought into that and do it as a follow up. |
Closes #825.
This PR:
inkcrate, simply renames theink_langcrate toink.inkcrate.::ink::envinstead of::ink_env.ink_storage_derivewill produce code which assumes theinkcrate is imported e.g.::ink::storage, so will not work if used as a standalone crate (see below)In this case, specifically this is a problem with the storage derive macros. Where previously the derives, reexported via the
ink_storagecrate, could safely assume the presence of that crate e.g.::ink_storage::traits::Storable. Now it generates::ink::storage::traits::Storableinstead, assuming the usage of theinkcrate rather than the standaloneink_storagecrate.To overcome this in an opinionated way (for now), we will assume that a contract is uses the
inkentrance crate, instead of individual crates. This means that theink_storagemacros will no longer work when using as a standalone crate.I believe that this can be solved, but I will do that as a follow up so it easier to review and discuss. See #1400
NOTE:I've temporarily updated the CI to use that PR branch to check whether all the examples still compile.gitlab-examples-contract-buildCI will fail because use-ink/cargo-contract#728 is required forcargo-contractto work with the new entrance crate