Skip to content
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

iroha_wasm_builder: remove cargo invocation #2152

Open
Arjentix opened this issue Apr 26, 2022 · 7 comments
Open

iroha_wasm_builder: remove cargo invocation #2152

Arjentix opened this issue Apr 26, 2022 · 7 comments
Labels
build iroha2-dev The re-implementation of a BFT hyperledger in RUST research

Comments

@Arjentix
Copy link
Contributor

Arjentix commented Apr 26, 2022

Right now there is a problem -- we have to invoke cargo from our iroha_wasm_builder to be able to build Rust Smartcontract in WASM. That can cause problems with cargo recursion problem (cargo doesn't like to be invoked multiple times from it self).

There is a wasm-builder crate which can help us with that. But I'm not 100% sure it can do all what we need. We need to do a research and try to use it

@Arjentix Arjentix added iroha2-dev The re-implementation of a BFT hyperledger in RUST build labels Apr 26, 2022
@appetrosyan appetrosyan added Chore This is a small task that can be done at any point in time and is easier than others and removed Chore This is a small task that can be done at any point in time and is easier than others labels Jun 8, 2022
@Erigara
Copy link
Contributor

Erigara commented Feb 2, 2023

Maybe we can use cargo as library.

@Arjentix
Copy link
Contributor Author

@Erigara , cool idea

@Arjentix Arjentix changed the title build.rs: use wasm-builder iroha_wasm_builder: remove cargo invocation Apr 17, 2023
@Arjentix Arjentix self-assigned this Apr 17, 2023
@Arjentix
Copy link
Contributor Author

Blocked by hyperledger-archives/ursa#232

@DCNick3
Copy link
Contributor

DCNick3 commented Oct 16, 2023

That can cause problems with cargo recursion problem (cargo doesn't like to be invoked multiple times from it self).

@Arjentix, What are some of the problems that can be encountered? I only seem to find rust-lang/cargo#6412, and this one:

  1. is already worked around by setting CARGO_TARGET_DIR to OUT_DIR in wasm_builder
  2. wouldn't be solved by using cargo as a library, as the build dir lock is still there

@Arjentix
Copy link
Contributor Author

@DCNick3 , the problem was found when we were using our cargo lints. Because of that in iroha_wasm_builder we unset CARGO_RECURSION env var. Probably now there's no problem, need to test it.

@DCNick3 DCNick3 self-assigned this Oct 17, 2023
@DCNick3
Copy link
Contributor

DCNick3 commented Oct 17, 2023

I think it's actually called RUST_RECURSION_COUNT..

@DCNick3
Copy link
Contributor

DCNick3 commented Oct 18, 2023

I don't think that using cargo as a library is a good idea.

Mainly because its API is perma-unstable and is not gonna be stabilized soon.

Other problem I can see is ignoring the rustup config, but ig with us using a pinned nightly version for building smart contracts that's wouldn't be a problem.

And, well, it doesn't seem necessary IMO: the RUST_RECURSION_COUNT workaround is not necessary w/o cargo lints (I wasn't getting any problems when disabling it).

There's also CARGO_ENCODED_RUSTFLAGS workaround: (https://github.com/hyperledger/iroha/blob/f9f5ede6791a99ec788a05755867e1fcb497a9e2/wasm_builder/src/lib.rs#L402C1-L406C47). This one still seems to still be required, but I think it's better then chasing a perma-unstable API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build iroha2-dev The re-implementation of a BFT hyperledger in RUST research
Projects
None yet
Development

No branches or pull requests

4 participants