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

[BUG] "error: failed to download uint v0.9.3" when execute with docker run .... command #38

Open
haxpor opened this issue Apr 10, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@haxpor
Copy link

haxpor commented Apr 10, 2022

Describe the bug
I'm trying to verify deployed smart contract against git's commit hash in order to see which revision in git that is actually deployed on chain. But I'm stuck at the execution of docker command (as seen in README.md file i.e. docker run --rm -v ....).

It shows the following error (please excuse that I use sudo as my user is not added as part of docker group)

$ sudo docker run --rm -v "$(pwd)":/code   --mount type=volume,source="$(basename "$(pwd)")_cache",target=
/code/target   --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry   cosmwasm/workspace-optimizer:0.11.5
1.54.0-x86_64-unknown-linux-musl (default)
cargo 1.54.0 (5ae8d74b3 2021-06-22)
Building artifacts in workspace ...
Found workspace member entries: ['packages/*', 'contracts/*']
Package directories: ['contracts/custody_base', 'contracts/custody_beth', 'contracts/custody_bluna', 'contracts/distribution_model', 'contracts/interest_model', 'contracts/liquidation', 'contracts/liquidation_queue', 'contracts/market', 'contracts/oracle', 'contracts/overseer', 'packages/moneymarket']
Contracts to be built: ['contracts/custody_base', 'contracts/custody_beth', 'contracts/custody_bluna', 'contracts/distribution_model', 'contracts/interest_model', 'contracts/liquidation', 'contracts/liquidation_queue', 'contracts/market', 'contracts/oracle', 'contracts/overseer']
Building contracts/custody_base ...
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/packages/moneymarket/Cargo.toml
workspace: /code/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/contracts/custody_base/Cargo.toml
workspace: /code/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/contracts/custody_beth/Cargo.toml
workspace: /code/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/contracts/custody_bluna/Cargo.toml
workspace: /code/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/contracts/distribution_model/Cargo.toml
workspace: /code/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/contracts/interest_model/Cargo.toml
workspace: /code/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/contracts/liquidation/Cargo.toml
workspace: /code/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/contracts/liquidation_queue/Cargo.toml
workspace: /code/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/contracts/market/Cargo.toml
workspace: /code/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/contracts/oracle/Cargo.toml
workspace: /code/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/contracts/overseer/Cargo.toml
workspace: /code/Cargo.toml
 Downloading crates ...
error: failed to download `uint v0.9.3`

Caused by:
  unable to get packages from source

Caused by:
  failed to parse manifest at `/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/uint-0.9.3/Cargo.toml`

Caused by:
  feature `edition2021` is required

  this Cargo does not support nightly features, but if you
  switch to nightly channel you can add
  `cargo-features = ["edition2021"]` to enable this feature
Traceback (most recent call last):
  File "/usr/local/bin/build_workspace.py", line 38, in <module>
    subprocess.check_call(cmd, cwd=contract)
  File "/usr/lib/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cargo', 'build', '--release', '--target=wasm32-unknown-unknown', '--locked']' returned non-zero exit status 101.

To Reproduce

  • git clone [email protected]:Anchor-Protocol/anchor-token-contracts.git (specifically I'm at the tip at the time of cloning which is b99f561)
  • cd anchor-token-contracts
  • rust up default stable (i'm using rust 1.60.0 for both cargo 1.60.0 (d1fd9fe 2022-03-01), and rustc 1.60.0 (7737e0b5c 2022-04-04))
  • rustup target add wasm32-unknown-unknown
  • docker run --rm -v "$(pwd)":/code --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry cosmwasm/workspace-optimizer:0.11.5
  • Then it shows error as above

Context & versions

  • Run on Ubuntu 20.04,
  • I'm using Rust 1.60.0, stable.
  • Anchor-Protocol/anchor-token-contracts -> at b99f561.
  • Docker: Docker version 20.10.14, build a224086

(if applicable) suggested solution
I didn't think about solution yet. But I work around by executing steps involved (compile, optimize, and get checksum for each contract file) manually by looking at cosmwasm/rust-optimizer's Dockfile and optimize.sh to see what commands it uses, then I do it manually to achieve my goal of verify the contract code.

So yeah, at last I would like to know if I did something wrong in order to be able to use docker run --rm -v ... command to ease in generating checksums for all contracts.

@haxpor haxpor added the bug Something isn't working label Apr 10, 2022
@haxpor haxpor changed the title [BUG] title_of_bug [BUG] "error: failed to download uint v0.9.3" when execute with docker run .... command Apr 10, 2022
@0xoscario
Copy link

Can you try to with following command?

docker run --rm -v "$(pwd)":/code \
  --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
  --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
  cosmwasm/workspace-optimizer:0.12.6

@haxpor
Copy link
Author

haxpor commented Apr 12, 2022

Hey thanks, I then got the following.

$ sudo docker run --rm -v "$(pwd)":/code   --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target   --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry   cosmwasm/workspace-optimizer:0.12.6
[sudo] password for <REDACTED>: 
Unable to find image 'cosmwasm/workspace-optimizer:0.12.6' locally
0.12.6: Pulling from cosmwasm/workspace-optimizer
df9b9388f04a: Pull complete 
2113a6fa04a6: Pull complete 
c82ca4327e1d: Pull complete 
ec5d9cea9b05: Pull complete  
71bc9354b9d4: Pull complete   
87d32d65b652: Pull complete    
456b0d6270de: Pull complete     
acbc78a68d21: Pull complete 
21bcedb39953: Pull complete 
Digest: sha256:e6565a5e87c830ef3e8775a9035006b38ad0aaf0a96319158c802457b1dd1d08
Status: Downloaded newer image for cosmwasm/workspace-optimizer:0.12.6
1.60.0-x86_64-unknown-linux-musl (default)
cargo 1.60.0 (d1fd9fe2c 2022-03-01)
Building artifacts in workspace ...
Found workspace member entries: ["packages/*", "contracts/*"]
Package directories: ["contracts/airdrop", "contracts/collector", "contracts/community", "contracts/distributor", "contracts/gov", "contracts/staking", "contracts/vesting", "packages/anchor_token"]
Contracts to be built: ["contracts/airdrop", "contracts/collector", "contracts/community", "contracts/distributor", "contracts/gov", "contracts/staking", "contracts/vesting"]
Building "contracts/airdrop" ...
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/packages/anchor_token/Cargo.toml
workspace: /code/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/contracts/airdrop/Cargo.toml
workspace: /code/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/contracts/collector/Cargo.toml
workspace: /code/Cargo.toml  
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/contracts/community/Cargo.toml
workspace: /code/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/contracts/distributor/Cargo.toml
workspace: /code/Cargo.toml       
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/contracts/gov/Cargo.toml
workspace: /code/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/contracts/staking/Cargo.toml
workspace: /code/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /code/contracts/vesting/Cargo.toml
workspace: /code/Cargo.toml
    Updating crates.io index
error: the lock file /code/Cargo.lock needs to be updated but --locked was passed to prevent this
If you want to try to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.
thread 'main' panicked at 'assertion failed: error_code.success()', src/main.rs:77:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants