-
Notifications
You must be signed in to change notification settings - Fork 360
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
Convention: Negate "library" feature? #1627
Comments
I was thinking about it a long time ago, but I remember there were some problems with that - I don't remember exactly, but I think something with the dependency resolver. I would vote strongly "for" this feature. I would start with picking up some repo with more than one, but not too many contracts, try to apply the change there and then see if there are any issues (I can easily be wrong about that, I remember I tried to do something around that over a year ago so maybe I did something stupid, and that was causing problems). |
Assuming there will be an cw20-base = { version = "*", default-features = false, features = [ /* remaining default features */ ] } instead of: cw20-base = { version = "*", features = [ "library"] } I don't think it makes it much harder because currently there is no additional default features that is needed to be included, the only default feature will be
Do you mean whether this can cause any problem if a dependency depends on another package with
I am also interested in seeing the use case here (how the failure happened). |
Actually I think this may be an interesting approach. All importable code in src and some minor shim in bin/wasm.rs or whatever to provide the exports. Not sure how doable this is or if it makes sense, but it would make sure that no one importing the source code could ever activate the external "C" exports (which is what we want to achieve with all this) |
We can detect whether the current compilation unit (i.e. crate) is a dependency or not. Cargo sets the environment variable option_env!("CARGO_PRIMARY_PACKAGE").is_none() |
This is not really a topic of this repository but a larger CosmWasm ecosystem convention. cw-plus introduced a "library" feature convention to be able to use one contract package as a dependency of another contract. As brought up by multiple community members1 2 3, the
library
feature used to disable entry points is not additive.https://doc.rust-lang.org/cargo/reference/features.html
While I think in general this is the right™ way, there are a few things that are no clear to me yet:
Footnotes
https://github.com/CosmWasm/cw-template/issues/140 ↩
Who can help me find that earlier Twitter conversation that also included Shame and others? ↩
https://twitter.com/TheCyberHoward/status/1633833986182254594 ↩
The text was updated successfully, but these errors were encountered: