Substrate 节点模板无法创建运行时错误=其他(“无法反序列化模块:UnknownOpcode(192)”)

dra*_*ise 7 rust blockchain substrate

我正在尝试按照此过程https://docs.substrate.io/tutorials/build-a-blockchain/build-local-blockchain/#start-the-local-node启动本地节点。但它总是给我错误:

\n
\xe2\x9e\x9c  substrate-node-template git:(my-wip-branch) ./target/release/node-template --dev\n\n2023-04-07 12:59:26 Substrate Node    \n2023-04-07 12:59:26 \xe2\x9c\x8c\xef\xb8\x8f  version 4.0.0-dev-700c3a186e5    \n2023-04-07 12:59:26 \xe2\x9d\xa4\xef\xb8\x8f  by Substrate DevHub <https://github.com/substrate-developer-hub>, 2017-2023    \n2023-04-07 12:59:26  Chain specification: Development    \n2023-04-07 12:59:26   Node name: extra-large-arch-5066    \n2023-04-07 12:59:26  Role: AUTHORITY    \n2023-04-07 12:59:26  Database: RocksDb at /var/folders/dy/1hb072zd0g1d5ppckgm48ml40000gn/T/substrateekR4s0/chains/dev/db/full    \n2023-04-07 12:59:26 \xe2\x9b\x93  Native runtime: node-template-100 (node-template-1.tx1.au1)    \nError: Service(Client(VersionInvalid("cannot deserialize module: UnknownOpcode(192)")))\n2023-04-07 12:59:26 Cannot create a runtime error=Other("cannot deserialize module: UnknownOpcode(192)")\n
Run Code Online (Sandbox Code Playgroud)\n

我在另一个页面看到我必须没有最新版本的 rustup,所以我目前的版本已于 2023/01/01 更新:

\n
\xe2\x9e\x9c  substrate-node-template git:(my-wip-branch) rustup toolchain list\nstable-aarch64-apple-darwin\nnightly-2021-03-14-aarch64-apple-darwin\nnightly-2022-03-14-aarch64-apple-darwin\nnightly-2022-06-30-aarch64-apple-darwin\nnightly-2023-01-01-aarch64-apple-darwin (default)\n
Run Code Online (Sandbox Code Playgroud)\n

但随后它仍然无法运行。我怀疑这是因为我必须将名称更改为 ,nightly-2023-01-01-aarch64-apple-darwinnightly-aarch64-apple-darwin我不知道该怎么做。感谢您的帮助!

\n

小智 7

要解决这个问题,对我来说最简单的方法是在主文件夹中创建一个rust-toolchain.toml文件,其中包含以下内容:

[toolchain]
channel = "nightly-2023-01-01"
components = [ "rustfmt" ]
targets = [ "wasm32-unknown-unknown" ]
profile = "minimal"
Run Code Online (Sandbox Code Playgroud)