web3labs / ink-verifier-image

Container image for Ink! smart contracts source code verification
Apache License 2.0
3 stars 2 forks source link

Detect custom rust version in the dir #17

Open deuszx opened 1 year ago

deuszx commented 1 year ago

It's possible to specify a custom rust version via rust-toolchain file in the directory/project. For example in https://github.com/Cardinal-Cryptography/zk-apps, there's a rust-toolchain file which gest picked up:

~/aleph/zk-apps/shielder/contract$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/mateusz/.rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu (default)
1.68-x86_64-unknown-linux-gnu
1.65.0-x86_64-unknown-linux-gnu
1.66.0-x86_64-unknown-linux-gnu

installed targets for active toolchain
--------------------------------------

wasm32-unknown-unknown
x86_64-unknown-linux-gnu

active toolchain
----------------

nightly-2022-11-28-x86_64-unknown-linux-gnu (overridden by '/home/mateusz/aleph/zk-apps/rust-toolchain')
rustc 1.67.0-nightly (1eb62b123 2022-11-27)

I think it makes sense to detect that and use the active toolchain as the default when running the tool. Unless user specifies otherwise.

In the example above, tool would set RUST_TOOLCHAIN=nightly-2022-11-28-x86_64-unknown-linux-gnu automatically.

abhijeetbhagat commented 1 year ago

hi! we are awaiting cargo contract build --verifiable feature to be released. we'll add active toolchain detection then.