当货物在其自己的板条箱中使用托盘构建节点模板时出错
2021-07-05
782
我按照
在自己的 Crate 中编写 Pallet
教程进行操作。
我按照教程仔细检查了所有内容,但当我
cargo build --release
时,我收到 66 条错误消息。大多数错误消息与以下 2 条类似(更多详细信息请见下文):
cannot find type `Pallet` in crate/scope
the trait bound `Runtime: frame_system::pallet::Congig` is not satisfied
我创建了一个错误日志。在 stackoverflow.com 上发布错误日志或如此多错误消息的最佳方法是什么?
Information that should be included in a bug report.
Executing build command: "/home/df/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/target/release/wbuild/node-template-runtime/Cargo.toml" "--color=always" "--release"
Using rustc version: rustc 1.55.0-nightly (24bdc6d73 2021-06-12)
显示的第一个错误如下:
errorm: expected one of: `Pallet`, `Call`, `Storage`, `Event`, `Config`, `Origin`, `Inherent`, `ValidateUnsigned`
--> /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/runtime/src/lib.rs:338:29
|
338 | TestPallet: test_pallet::{Module, Call, Storage, Event<T>},
| ^^^^^^ `
因此,我从第 338 行删除了
Module
:
TestPallet: test_pallet::{Module, Call, Storage, Event<T>},
如果我再次
cargo build --release
,我会收到 14 条错误消息,我将在下面发布。您知道哪里出了问题吗?
Compiling node-template-runtime v3.0.0 (/mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/runtime)
error: failed to run custom build command for `node-template-runtime v3.0.0 (/mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/runtime)`
Caused by:
process didn't exit successfully: `/mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/target/release/build/node-template-runtime-10b4571a8bd12437/build-script-build` (exit status: 1)
--- stdout
Information that should be included in a bug report.
Executing build command: "/home/df/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/target/release/wbuild/node-template-runtime/Cargo.toml" "--color=always" "--release"
Using rustc version: rustc 1.55.0-nightly (24bdc6d73 2021-06-12)
--- stderr
Compiling node-template-runtime v3.0.0 (/mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/runtime)
error[E0412]: cannot find type `Pallet` in crate `test_pallet`
--> /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/runtime/src/lib.rs:321:1
|
321 | / construct_runtime!(
322 | | pub enum Runtime where
323 | | Block = Block,
324 | | NodeBlock = opaque::Block,
... |
340 | | }
341 | | );
| |__^ not found in `test_pallet`
|
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
|
9 | use crate::pallet_template::Pallet;
|
9 | use frame_system::Pallet;
|
9 | use pallet_aura::Pallet;
|
9 | use pallet_balances::Pallet;
|
and 7 other candidates
error: duplicate lang item in crate `sp_io` (which `frame_support` depends on): `panic_impl`.
|
= note: the lang item is first defined in crate `sp_io` (which `frame_support` depends on)
= note: first definition in `sp_io` loaded from /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/target/release/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-68d2ddc13c0ddd99.rmeta
= note: second definition in `sp_io` loaded from /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/target/release/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-0c3d7ed5f1bed9c8.rmeta
error: duplicate lang item in crate `sp_io` (which `frame_support` depends on): `oom`.
|
= note: the lang item is first defined in crate `sp_io` (which `frame_support` depends on)
= note: first definition in `sp_io` loaded from /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/target/release/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-68d2ddc13c0ddd99.rmeta
= note: second definition in `sp_io` loaded from /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/target/release/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-0c3d7ed5f1bed9c8.rmeta
error[E0277]: the trait bound `Runtime: frame_system::pallet::Config` is not satisfied
--> /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/runtime/src/lib.rs:316:6
|
316 | impl test_pallet::Config for Runtime {
| ^^^^^^^^^^^^^^^^^^^ the trait `frame_system::pallet::Config` is not implemented for `Runtime`
|
::: /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/pallets/test-pallet/src/lib.rs:17:19
|
17 | pub trait Config: frame_system::Config {
| -------------------- required by this bound in `test_pallet::Config`
error[E0277]: the trait bound `Runtime: frame_system::pallet::Config` is not satisfied
--> /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/runtime/src/lib.rs:321:1
|
321 | / construct_runtime!(
322 | | pub enum Runtime where
323 | | Block = Block,
324 | | NodeBlock = opaque::Block,
... |
340 | | }
341 | | );
| |__^ the trait `frame_system::pallet::Config` is not implemented for `Runtime`
|
= note: this error originates in the macro `$crate::impl_outer_event` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Runtime: frame_system::pallet::Config` is not satisfied
--> /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/runtime/src/lib.rs:321:1
|
321 | / construct_runtime!(
322 | | pub enum Runtime where
323 | | Block = Block,
324 | | NodeBlock = opaque::Block,
... |
340 | | }
341 | | );
| |__^ the trait `frame_system::pallet::Config` is not implemented for `Runtime`
|
= note: this error originates in the macro `$crate::impl_outer_event` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Event: TryInto<test_pallet::RawEvent<_>>` is not satisfied
--> /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/runtime/src/lib.rs:321:1
|
321 | / construct_runtime!(
322 | | pub enum Runtime where
323 | | Block = Block,
324 | | NodeBlock = opaque::Block,
... |
340 | | }
341 | | );
| |__^ the trait `TryInto<test_pallet::RawEvent<_>>` is not implemented for `Event`
|
= help: the following implementations were found:
<Event as TryInto<frame_system::Event<Runtime>>>
<Event as TryInto<pallet_balances::Event<Runtime>>>
<Event as TryInto<pallet_grandpa::Event>>
<Event as TryInto<pallet_nicks::RawEvent<AccountId32, u128>>>
and 3 others
= note: this error originates in the macro `$crate::impl_outer_event` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Runtime: frame_system::pallet::Config` is not satisfied
--> /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/runtime/src/lib.rs:321:1
|
321 | / construct_runtime!(
322 | | pub enum Runtime where
323 | | Block = Block,
324 | | NodeBlock = opaque::Block,
... |
340 | | }
341 | | );
| |__^ the trait `frame_system::pallet::Config` is not implemented for `Runtime`
|
= note: this error originates in the macro `$crate::impl_outer_event` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Runtime: frame_system::pallet::Config` is not satisfied
--> /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/runtime/src/lib.rs:321:1
|
321 | / construct_runtime!(
322 | | pub enum Runtime where
323 | | Block = Block,
324 | | NodeBlock = opaque::Block,
... |
340 | | }
341 | | );
| |__^ the trait `frame_system::pallet::Config` is not implemented for `Runtime`
|
= note: this error originates in the macro `$crate::impl_outer_event` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Runtime: frame_system::pallet::Config` is not satisfied
--> /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/runtime/src/lib.rs:321:1
|
321 | / construct_runtime!(
322 | | pub enum Runtime where
323 | | Block = Block,
324 | | NodeBlock = opaque::Block,
... |
340 | | }
341 | | );
| |__^ the trait `frame_system::pallet::Config` is not implemented for `Runtime`
|
= note: this error originates in the macro `$crate::impl_outer_event` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Runtime: frame_system::pallet::Config` is not satisfied
--> /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/runtime/src/lib.rs:321:1
|
321 | / construct_runtime!(
322 | | pub enum Runtime where
323 | | Block = Block,
324 | | NodeBlock = opaque::Block,
... |
340 | | }
341 | | );
| |__^ the trait `frame_system::pallet::Config` is not implemented for `Runtime`
|
= note: this error originates in the macro `$crate::impl_outer_event` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Event: TryInto<test_pallet::RawEvent<_>>` is not satisfied
--> /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/runtime/src/lib.rs:321:1
|
321 | / construct_runtime!(
322 | | pub enum Runtime where
323 | | Block = Block,
324 | | NodeBlock = opaque::Block,
... |
340 | | }
341 | | );
| |__^ the trait `TryInto<test_pallet::RawEvent<_>>` is not implemented for `Event`
|
= help: the following implementations were found:
<Event as TryInto<frame_system::Event<Runtime>>>
<Event as TryInto<pallet_balances::Event<Runtime>>>
<Event as TryInto<pallet_grandpa::Event>>
<Event as TryInto<pallet_nicks::RawEvent<AccountId32, u128>>>
and 3 others
= note: this error originates in the macro `$crate::impl_outer_event` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Runtime: frame_system::pallet::Config` is not satisfied
--> /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/runtime/src/lib.rs:321:1
|
321 | / construct_runtime!(
322 | | pub enum Runtime where
323 | | Block = Block,
324 | | NodeBlock = opaque::Block,
... |
340 | | }
341 | | );
| |__^ the trait `frame_system::pallet::Config` is not implemented for `Runtime`
|
= note: this error originates in the macro `$crate::impl_outer_event` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Event: TryInto<test_pallet::RawEvent<_>>` is not satisfied
--> /mnt/f/Etp/Substrate/tutorials/02/substrate-node-template/runtime/src/lib.rs:321:1
|
321 | / construct_runtime!(
322 | | pub enum Runtime where
323 | | Block = Block,
324 | | NodeBlock = opaque::Block,
... |
340 | | }
341 | | );
| |__^ the trait `TryInto<test_pallet::RawEvent<_>>` is not implemented for `Event`
|
= help: the following implementations were found:
<Event as TryInto<frame_system::Event<Runtime>>>
<Event as TryInto<pallet_balances::Event<Runtime>>>
<Event as TryInto<pallet_grandpa::Event>>
<Event as TryInto<pallet_nicks::RawEvent<AccountId32, u128>>>
and 3 others
= note: this error originates in the macro `$crate::impl_outer_event` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 14 previous errors
Some errors have detailed explanations: E0277, E0412.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `node-template-runtime`
To learn more, run the command again with --verbose.
2个回答
你可能必须在 test-pallet/lib.rs 中添加
pub use pallet::*;
Song Zhou
2021-07-13
您应该
用
Pallet
替换
Module
,而不是将其删除。
kianenigma
2021-07-05