CosmWasm / cw-plus

Production Quality contracts under open source licenses
Apache License 2.0
504 stars 353 forks source link

thread 'main' panicked at 'called `Result::unwrap() #867

Closed dev573 closed 1 year ago

dev573 commented 1 year ago

While running the command

  --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.8

in cw2-base smart contract getting error

cargo 1.63.0 (fd9c4297c 2022-07-01)
Building artifacts in workspace...
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { inner: ErrorInner { kind: Custom, line: None, col: 0, message: "missing field `workspace`", key: [] } }', src/main.rs:35:55
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Git Branch: main

hashedone commented 1 year ago

You don't run workspace optimizer on the smart contract level - instead, you execute it in the root folder so you build all contracts in the workspace. If you want to build only a single contract, you don't use workspace optimizer, but rust optimizer:

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/rust-optimizer:0.12.13