Closed Buckram123 closed 1 year ago
thanks for reporting!
@Buckram123: cw-core gets imported (with everything)
can we get around this by adding the library feature to the cw-core
import in voting, or is this something more complex? would just need to do that here: https://github.com/DA0-DA0/dao-contracts/blob/693a5d6a36ada1505c5a52e8029b1b80ea557393/packages/voting/Cargo.toml#L15
Contracts being used by other packages/contracts as library dependencies has caused other problems (and likely will be a hard to debug landmine for future devs even once these are ironed out). The ones I know about:
Honestly, I think we should see how bad it is to just split out the shared library code out of the contracts and into packages. What do you think?
I think its fine to keep them as dev-deps, and used by things that aren't depended on by other packages.
@ezekiiel you are right it is enough, you can check fix
branch here: https://github.com/Buckram123/duplicate_example
@de-husk but I agree with you, IMO it's better to not use contracts as a dependency, should be easy to remove that dependency, it's only one function. What you think is the best solution?
definitely think @de-husk is right here. :) the structure of having a package with the external api and the contract is slick.
this would be a nice refactor to get in with the renaming work, but also adding library flags is fast 🤷♂️
This would be a good thing to get in before the v2 release.
@Buckram123 is this still an issue since we switch to rust workspaces?
@Buckram123 is this still an issue since we switch to rust workspaces?
Don't think so, updated this repo, still same issue, if I didn't miss anything. This time I used rust-optimizer:0.12.10 which uses 1.65.0 rustc
Closing. Feel free to re-open if it re-appears.
Short description
So, what happened: we have a lib that wants to import
voting
, and then contract depend on that lib, what happens: cw-core gets imported (with everything)Error
Minimal example
https://github.com/Buckram123/duplicate_example This is minimal template from here: https://github.com/InterWasm/cw-template One difference is here: https://github.com/Buckram123/duplicate_example/blob/57859b4e0997b7eba359b3da393ae55f2b563d30/duplicate-bug/src/msg.rs#L1 And instantiate method
Reproduce
To reproduce on my machine, simply run optimizer or just wasm
Version
rustc 1.63.0 (4b91a6ea7 2022-08-08), (optimizer uses 1.60.0) 5.19.8-arch1-1