CosmWasm/optimizer

unresolved import cosmwasm_std::testing on Cosmwasm/cw-plus

albertchon opened this issue · 2 comments

Inside https://github.com/CosmWasm/cw-plus/tree/v0.13.0, upon running

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-arm64:0.12.5
Info: RUSTC_WRAPPER=sccache
Info: sccache stats before build
Compile requests                      0
Compile requests executed             0
Cache hits                            0
Cache misses                          0
Cache timeouts                        0
Cache read errors                     0
Forced recaches                       0
Cache write errors                    0
Compilation failures                  0
Cache errors                          0
Non-cacheable compilations            0
Non-cacheable calls                   0
Non-compilation calls                 0
Unsupported compiler calls            0
Average cache write               0.000 s
Average cache read miss           0.000 s
Average cache read hit            0.000 s
Failed distributed compilations       0
Cache location                  Local disk: "/root/.cache/sccache"
Cache size                            0 bytes
Max cache size                       10 GiB
Building contract in /code ...
   Compiling cw-storage-plus v0.13.0 (/code/packages/storage-plus)
   Compiling cw2 v0.13.0 (/code/packages/cw2)
   Compiling cw4 v0.13.0 (/code/packages/cw4)
   Compiling cw-controllers v0.13.0 (/code/packages/controllers)
   Compiling cw-multi-test v0.13.0 (/code/packages/multi-test)
error[E0432]: unresolved import `cosmwasm_std::testing`
 --> packages/multi-test/src/app.rs:5:19
  |
5 | use cosmwasm_std::testing::{mock_env, MockApi, MockStorage};
  |                   ^^^^^^^ could not find `testing` in `cosmwasm_std`

error[E0432]: unresolved import `cosmwasm_std::testing`
  --> packages/multi-test/src/wasm.rs:24:19
   |
24 | use cosmwasm_std::testing::mock_wasmd_attr;
   |                   ^^^^^^^ could not find `testing` in `cosmwasm_std`

warning: ignoring -C extra-filename flag due to -o flag

For more information about this error, try `rustc --explain E0432`.
warning: `cw-multi-test` (lib) generated 1 warning
error: could not compile `cw-multi-test` due to 2 previous errors; 1 warning emitted
warning: build failed, waiting for other jobs to finish...
error: build failed

cargo build however works just fine.

See CosmWasm/cw-plus#681 for additional context

Please see https://github.com/CosmWasm/rust-optimizer#mono-repos for the difference between rust-optimizer and workspace-optimizer. cw-plus must always be built using the workspace optimizer.

Ah you're right it works with workspace-optimizer-arm64!