编译所有 cw-plus 合约时需要错误 edition2021

Error `edition2021` is required when compiling all cw-plus contracts

我正在尝试编译报告根目录 (https://github.com/CosmWasm/cw-plus) 上的所有合约

Wehn 运行ning:

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

我得到:

"contracts/cw20-base", "contracts/cw20-ics20", "contracts/cw3-fixed-multisig", "contracts/cw3-flex-multisig", "contracts/cw4-group", "contracts/cw4-stake"]
Building "contracts/cw1-subkeys" ...
 Downloading crates ...
error: failed to download `pkcs8 v0.8.0`

Caused by:
  unable to get packages from source

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

Caused by:
  feature `edition2021` is required

  The package requires the Cargo feature called `edition2021`, but that feature is not stabilized in this version of Cargo (1.55.0 (32da73ab1 2021-08-23)).
  Consider trying a newer version of Cargo (this may require the nightly release).
  See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2021 for more information about the status of this feature.

我累到运行:

cargo fix --edition 

https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2021

所述

还有rustup default nightly && rustup update 发现了类似的issues,但是还是不行。

当前货物版本

cargo 1.63.0-nightly (a4c1cd0eb 2022-05-18)

但与稳定的结果相同。

关于尝试遵守这些合同的任何想法或方向?

您的 Docker 版本中的 Rust 编译器与您系统上的版本不同,并且图像中的版本不够新,无法支持 2021 版。您可以使用具有更新的 Rust 编译器的更新版本的 Docker 图像来解决此问题:

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