substrate - 构建 PoE 去中心化应用程序基板教程错误:无法编译 `sp-arithmetic`
问题描述
我正在关注构建 PoE 分散式应用程序教程。我成功完成了构建您的第一个底物链教程。我将基板更新到 2.0.1,它使第一个教程完美运行。现在,当我使用 2.0.1 时,它修复了其中一个错误代码,但我仍然有一些。这是我的日志:
$ WASM_BUILD_TOOLCHAIN=nightly-2020-10-05 cargo run --release -- --dev --tmp
warning: TOML file found which contains invalid syntax and will soon not parse
at `pallets\template\Cargo.toml`.
The TOML spec requires that each table header is defined at most once, but
historical versions of Cargo have erroneously accepted this file. The table
definitions will need to be merged together with one table header to proceed,
and this will become a hard error in the future.
warning: TOML file found which contains invalid syntax and will soon not parse
at `pallets\template\Cargo.toml`.
The TOML spec requires that each table header is defined at most once, but
historical versions of Cargo have erroneously accepted this file. The table
definitions will need to be merged together with one table header to proceed,
and this will become a hard error in the future.
Compiling substrate-prometheus-endpoint v0.8.1
Compiling hyper-rustls v0.21.0
Compiling node-template-runtime v2.0.1 (C:\Users\matth\substrate-node-template\runtime)
Compiling libp2p-websocket v0.23.0
Compiling libp2p-mplex v0.22.0
Compiling libp2p-wasm-ext v0.22.0
Compiling libp2p-plaintext v0.22.0
Compiling libp2p-yamux v0.25.0
Compiling libp2p-dns v0.22.0
Compiling libp2p-noise v0.24.0
Compiling libp2p-tcp v0.22.0
Compiling libp2p-request-response v0.3.0
Compiling libp2p-ping v0.22.0
Compiling libp2p-identify v0.22.0
Compiling libp2p-kad v0.23.0
Compiling libp2p-mdns v0.22.0
Compiling libp2p-gossipsub v0.22.0
Compiling libp2p-floodsub v0.22.0
Compiling sc-proposer-metrics v0.8.1
Compiling sp-io v2.0.1
Compiling libp2p v0.28.1
Compiling sc-telemetry v2.0.1
Compiling sc-peerset v2.0.1
Compiling sp-application-crypto v2.0.1
Compiling sc-tracing v2.0.1
Compiling sp-runtime v2.0.1
Compiling sc-keystore v2.0.1
error: failed to run custom build command for `node-template-runtime v2.0.1 (C:\Users\matth\substrate-node-template\runtime)`
Caused by:
process didn't exit successfully: `C:\Users\matth\substrate-node-template\target\release\build\node-template-runtime-76c37493ab0ba7f5\build-script-build` (exit code: 1)
--- stdout
Information that should be included in a bug report.
Executing build command: "rustup" "run" "nightly-2020-10-05" "cargo" "-Zfeatures=build_dep" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=C:\\Users\\matth\\substrate-node-template\\target\\release\\wbuild\\node-template-runtime\\Cargo.toml" "--color=always" "--release"
Using rustc version: rustc 1.49.0-nightly (beb5ae474 2020-10-04)
--- stderr
warning: TOML file found which contains invalid syntax and will soon not parse
at `C:\Users\matth\substrate-node-template\pallets\template\Cargo.toml`.
The TOML spec requires that each table header is defined at most once, but
historical versions of Cargo have erroneously accepted this file. The table
definitions will need to be merged together with one table header to proceed,
and this will become a hard error in the future.
warning: TOML file found which contains invalid syntax and will soon not parse
at `C:\Users\matth\substrate-node-template\pallets\template\Cargo.toml`.
The TOML spec requires that each table header is defined at most once, but
historical versions of Cargo have erroneously accepted this file. The table
definitions will need to be merged together with one table header to proceed,
and this will become a hard error in the future.
Compiling substrate-wasm-builder v3.0.0
Compiling node-template-runtime v2.0.1 (C:\Users\matth\substrate-node-template\runtime)
Compiling pallet-template v2.0.1 (C:\Users\matth\substrate-node-template\pallets\template)
Compiling pallet-grandpa v2.0.1
error: Error { inner: ErrorInner { kind: DuplicateTable("dependencies"), line: Some(29), col: 0, at: Some(951), message: "", key: ["dependencies"] } }
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:18:1
|
18 | / decl_event! {
19 | | pub enum Event<T> where AccountId = <T as frame_system::Trait>::AccountId {
20 | | /// Event emitted when a proof has been claimed. [who, claim]
21 | | ClaimCreated(AccountId, Vec<u8>),
... |
24 | | }
25 | | }
| |_^
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: Error { inner: ErrorInner { kind: DuplicateTable("dependencies"), line: Some(29), col: 0, at: Some(951), message: "", key: ["dependencies"] } }
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:18:1
|
18 | / decl_event! {
19 | | pub enum Event<T> where AccountId = <T as frame_system::Trait>::AccountId {
20 | | /// Event emitted when a proof has been claimed. [who, claim]
21 | | ClaimCreated(AccountId, Vec<u8>),
... |
24 | | }
25 | | }
| |_^
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: Error { inner: ErrorInner { kind: DuplicateTable("dependencies"), line: Some(29), col: 0, at: Some(951), message: "", key: ["dependencies"] } }
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:42:1
|
42 | / decl_storage! {
43 | | trait Store for Module<T: Trait> as TemplateModule {
44 | | /// The storage item for our proofs.
45 | | /// It maps a proof to the user who made the claim and when they made it.
46 | | Proofs: map hasher(blake2_128_concat) Vec<u8> => (T::AccountId, T::BlockNumber);
47 | | }
48 | | }
| |_^
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: Error { inner: ErrorInner { kind: DuplicateTable("dependencies"), line: Some(29), col: 0, at: Some(951), message: "", key: ["dependencies"] } }
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:53:1
|
53 | / decl_module! {
54 | | pub struct Module<T: Trait> for enum Call where origin: T::Origin {
55 | | // Errors must be initialized if they are used by the pallet.
56 | | type Error = Error<T>;
... |
105 | | }
106 | | }
| |_^
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: Error { inner: ErrorInner { kind: DuplicateTable("dependencies"), line: Some(29), col: 0, at: Some(951), message: "", key: ["dependencies"] } }
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:53:1
|
53 | / decl_module! {
54 | | pub struct Module<T: Trait> for enum Call where origin: T::Origin {
55 | | // Errors must be initialized if they are used by the pallet.
56 | | type Error = Error<T>;
... |
105 | | }
106 | | }
| |_^
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: maybe a missing crate `sp_api_hidden_includes_decl_storage`?
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:42:1
|
42 | / decl_storage! {
43 | | trait Store for Module<T: Trait> as TemplateModule {
44 | | /// The storage item for our proofs.
45 | | /// It maps a proof to the user who made the claim and when they made it.
46 | | Proofs: map hasher(blake2_128_concat) Vec<u8> => (T::AccountId, T::BlockNumber);
47 | | }
48 | | }
| |_^ maybe a missing crate `sp_api_hidden_includes_decl_storage`?
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared crate or module `_parity_scale_codec`
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:18:1
|
18 | / decl_event! {
19 | | pub enum Event<T> where AccountId = <T as frame_system::Trait>::AccountId {
20 | | /// Event emitted when a proof has been claimed. [who, claim]
21 | | ClaimCreated(AccountId, Vec<u8>),
... |
24 | | }
25 | | }
| |_^ use of undeclared crate or module `_parity_scale_codec`
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared crate or module `_parity_scale_codec`
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:18:1
|
18 | / decl_event! {
19 | | pub enum Event<T> where AccountId = <T as frame_system::Trait>::AccountId {
20 | | /// Event emitted when a proof has been claimed. [who, claim]
21 | | ClaimCreated(AccountId, Vec<u8>),
... |
24 | | }
25 | | }
| |_^ use of undeclared crate or module `_parity_scale_codec`
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared type `Encode`
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:42:1
|
42 | / decl_storage! {
43 | | trait Store for Module<T: Trait> as TemplateModule {
44 | | /// The storage item for our proofs.
45 | | /// It maps a proof to the user who made the claim and when they made it.
46 | | Proofs: map hasher(blake2_128_concat) Vec<u8> => (T::AccountId, T::BlockNumber);
47 | | }
48 | | }
| |_^ use of undeclared type `Encode`
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared crate or module `_parity_scale_codec`
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:53:1
|
53 | / decl_module! {
54 | | pub struct Module<T: Trait> for enum Call where origin: T::Origin {
55 | | // Errors must be initialized if they are used by the pallet.
56 | | type Error = Error<T>;
... |
105 | | }
106 | | }
| |_^ use of undeclared crate or module `_parity_scale_codec`
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared crate or module `_parity_scale_codec`
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:53:1
|
53 | / decl_module! {
54 | | pub struct Module<T: Trait> for enum Call where origin: T::Origin {
55 | | // Errors must be initialized if they are used by the pallet.
56 | | type Error = Error<T>;
... |
105 | | }
106 | | }
| |_^ use of undeclared crate or module `_parity_scale_codec`
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared crate or module `_parity_scale_codec`
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:21:22
|
21 | ClaimCreated(AccountId, Vec<u8>),
| ^^^^^^^^^ not found in `_parity_scale_codec`
|
help: consider importing one of these items
|
3 | use codec::Decode;
|
3 | use frame_support::dispatch::Decode;
|
error[E0433]: failed to resolve: use of undeclared crate or module `_parity_scale_codec`
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:21:33
|
21 | ClaimCreated(AccountId, Vec<u8>),
| ^^^^^^^ not found in `_parity_scale_codec`
|
help: consider importing one of these items
|
3 | use codec::Decode;
|
3 | use frame_support::dispatch::Decode;
|
error[E0433]: failed to resolve: use of undeclared crate or module `_parity_scale_codec`
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:23:22
|
23 | ClaimRevoked(AccountId, Vec<u8>),
| ^^^^^^^^^ not found in `_parity_scale_codec`
|
help: consider importing one of these items
|
3 | use codec::Decode;
|
3 | use frame_support::dispatch::Decode;
|
error[E0433]: failed to resolve: use of undeclared crate or module `_parity_scale_codec`
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:23:33
|
23 | ClaimRevoked(AccountId, Vec<u8>),
| ^^^^^^^ not found in `_parity_scale_codec`
|
help: consider importing one of these items
|
3 | use codec::Decode;
|
3 | use frame_support::dispatch::Decode;
|
error[E0433]: failed to resolve: maybe a missing crate `sp_api_hidden_includes_decl_storage`?
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:42:1
|
42 | / decl_storage! {
43 | | trait Store for Module<T: Trait> as TemplateModule {
44 | | /// The storage item for our proofs.
45 | | /// It maps a proof to the user who made the claim and when they made it.
46 | | Proofs: map hasher(blake2_128_concat) Vec<u8> => (T::AccountId, T::BlockNumber);
47 | | }
48 | | }
| |_^ not found in `self::sp_api_hidden_includes_decl_storage::hidden_include::metadata`
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this enum
|
3 | use frame_support::error::DecodeDifferent;
|
error[E0433]: failed to resolve: use of undeclared crate or module `_parity_scale_codec`
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:53:1
|
53 | / decl_module! {
54 | | pub struct Module<T: Trait> for enum Call where origin: T::Origin {
55 | | // Errors must be initialized if they are used by the pallet.
56 | | type Error = Error<T>;
... |
105 | | }
106 | | }
| |_^ not found in `_parity_scale_codec`
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
|
3 | use codec::Decode;
|
3 | use frame_support::dispatch::Decode;
|
error[E0433]: failed to resolve: use of undeclared crate or module `_parity_scale_codec`
--> C:\Users\matth\substrate-node-template\pallets\template\src\lib.rs:53:1
|
53 | / decl_module! {
54 | | pub struct Module<T: Trait> for enum Call where origin: T::Origin {
55 | | // Errors must be initialized if they are used by the pallet.
56 | | type Error = Error<T>;
... |
105 | | }
106 | | }
| |_^ not found in `_parity_scale_codec`
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
|
3 | use codec::Decode;
|
3 | use frame_support::dispatch::Decode;
|
error: aborting due to 18 previous errors
For more information about this error, try `rustc --explain E0433`.
error: could not compile `pallet-template`
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
warning: build failed, waiting for other jobs to finish...
error: build failed
$ rustup show
Default host: x86_64-pc-windows-msvc
rustup home: C:\Users\matth\.rustup
installed toolchains
--------------------
stable-x86_64-pc-windows-msvc
nightly-2020-10-05-x86_64-pc-windows-msvc (default)
nightly-x86_64-pc-windows-msvc
installed targets for active toolchain
--------------------------------------
wasm32-unknown-unknown
x86_64-pc-windows-msvc
active toolchain
----------------
nightly-2020-10-05-x86_64-pc-windows-msvc (default)
rustc 1.49.0-nightly (beb5ae474 2020-10-04)
解决方案
NukeManDan 提供的答案应该可以正常工作。另外,cargo update -p <package_name>
我想应该做的伎俩。
推荐阅读
- javascript - 你如何在 JavaScript 中创建一个 12 小时的时间
- r - 使用 facet_wrap() 时在 ggplot 中手动标记轴
- r - 要在 R 中列出的数据框列的唯一值
- jenkins - 如何使用 curl 和身份验证令牌将参数传递给 Jenkins
- python - 将行中的所有值加 100 并更改零的函数
- database - 在 laravel 8 中使用 vuejs 从数据库中获取数据
- django - 设计问题:如何设计临时用户表?
- angular - 在Angular中将一个数据字段绑定到另一个?
- docker - 用户定义的桥接网络上的 Docker 容器无法通信
- python - 将什么 dtype 数据传递到 Tensorflow 模型中进行预测是否重要?