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
Specifying build options #80
Comments
That makes reproducible builds significantly harder since you need to store options as well somewhere. Can't you use default features? What kind of feature flags do you need? |
Actually, I am developing a contract, and I want to use the contract in common on different chains. For example, Terra has a different concept called tax, and I am thinking about using only that part as |
Okay, makes sense. However, don't you need different cosmwasm-std versions for Terra and other chains anyways? Also isn't Terra tax 0 these days? |
Yes, it's a different version, but Terra keep following up on the latest version, and I think all projects will be the same. Eventually, I think there will be a release for each version. This is because I do not want to separate and manage the same logic. Terra tax is also currently 0, but since it is a parameter, it can be changed at any time, so there is a risk to remove it. 😅 |
I ran into a similar issue where I wanted to deploy a slightly tweaked version of a contract, but don't want to worry about a fork or branch going stale as other updates are made. Features are bread-and-butter in Rust dev and a must-have for this tool imho. In the meantime I just run cargo and wasm-opt manually. |
|
Which error do you get? The CosmWasm feature system is independent to the Rust feature system. It's a way to ensure the chain provides everything that the contract needs. |
|
@webmaster128
|
The problem with this comes from the code below. No problem with |
@JoowonYun cargo now allows for weak dependencies that are only compiled when a feature is requested. It was recently stabilized. I'd also like to compile/optimize my contracts based on feature flags that enable these optional dependencies as our infrastructure aims to be chain-agnostic. |
Yeah, this will require the feature "terra". If a chain does not have it, you cannot use terra-cosmwasm as a dependency of you contract. Those features are a different thing than Rust/Cargo features. Read more about them here: https://github.com/CosmWasm/cosmwasm/blob/main/docs/FEATURES.md |
Can't you create chain-specific wrapper contracts? Like foobar-terra, foobar-juno, foobar-tgrade that all depend on and re-export some variant of foobar. This way you can configure everything in the source code and your builds remain easily reproducible by just providing source code + rust-optimizer version. |
Yes but if you're working with a lot of contracts it becomes a pain to manage. I can fork and try to do it myself if it's not a feature you'd like to add. |
Hi, I am also looking for this because we have similar contracts with minor differences for different chains and will communicate with each other via IBC. They are tested and compiled with the features flag for different features. @CyberHoward / @webmaster128 any updates on your ends? |
I am also looking for the same feature, is this something that you guys are considering implementing? @webmaster128 |
To me this is basically blocked by reproducible builds. When you don't need reproducible builds, you can just compile your If you look at the discussions around gov proposals on Osmosis (most recent example here but happened multiple times before), people already have a very hard time providing the relevant information to allow contract verification. At the moment you need 1. source code, 2. builder image incl. version. I don't want to create the need for a 3rd parameter here which would be builder options. I don't see a solution that adds this flexibility without increasing the communication burden and the burden on verifiers. This is why I think those things should like in the source code with one (wrapper) contract for each target chain. |
I fully understand the request, and we should provide some easy solution here. My first thought is this.
Then I have no tried it, but would be happy for someone with such a project to try it out and report. If it works, we could at least document this possibility. This does not preclude adding support for feature flags in the optimiser, but would be a valid solution short-term, while we discuss if this is the best long-term solution, or use other. It does not involve changing core tools, but can be opted in per project, which is easy for adoption |
#129 shows a promising approach to solve this problem by letting the optimizer build multiple versions of the contract without taking additional build arguments. It keeps the problem as simple as source code + builder image for the folks reproducing. |
fwiw the way we're tackling this is perhaps a bit funny, but it works: SETUP
TYPICAL RUN
FEATURES RUN
Yeah it's a bit goofy, but it works and doesn't need any special support from the optimizer |
@dakom Would you be able to share the one liner? Need a quick fix to run on our CI. |
I didn't write this shell script, someone else did, and I suck at shell scripting... won't be able to answer any questions, but hope it helps! The setup here is that the feature is only needed on the also lastly,
|
Could you check #148? This should solve the issue. |
Often contracts have separate
features
developed.What does think about that option takes it as a parameter?
https://github.com/CosmWasm/rust-optimizer/blob/317e459b391f2ddd23422477edfd622e1362f10a/build_workspace/src/main.rs#L66-L71
The text was updated successfully, but these errors were encountered: