【发布时间】:2021-12-02 20:43:19
【问题描述】:
目前,在完成基板教程时,我已经到了"Build the runtime with your new pallet" 部分。按照教程更新和仔细检查文件。
我在预构建检查中收到以下错误(之前的教程已经构建好,Ubuntu 20.04.3):
cargo check -p node-template-runtime
给予:
cargo check -p node-template-runtime
Updating git repository `https://github.com/paritytech/substrate.git`
Checking sp-std v4.0.0-dev (https://github.com/paritytech/substrate.git?tag=monthly-2021-11-1#352c46a6)
Compiling node-template-runtime v4.0.0-dev (/myPath/substrate/att2/substrate-node-template/runtime)
Checking pallet-template v4.0.0-dev (/myPath/substrate/att2/substrate-node-template/pallets/template)
error[E0277]: the trait bound `Vec<u8>: MaxEncodedLen` is not satisfied
--> pallets/template/src/lib.rs:40:11
|
40 | #[pallet::generate_storage_info]
| ^^^^^^^^^^^^^^^^^^^^^ the trait `MaxEncodedLen` is not implemented for `Vec<u8>`
|
= note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageMap<_GeneratedPrefixForStorageProofs<T>, frame_support::Blake2_128Concat, Vec<u8>, (<T as frame_system::Config>::AccountId, <T as frame_system::Config>::BlockNumber), frame_support::pallet_prelude::ValueQuery>`
note: required by `storage_info`
--> /myPath/.cargo/git/checkouts/substrate-7e08433d4c370a21/352c46a/frame/support/src/traits/storage.rs:71:2
|
71 | fn storage_info() -> Vec<StorageInfo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0277`.
error: could not compile `pallet-template` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed
我的Cargo.toml 中有以下内容:
[dependencies.sp-std]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
tag = 'monthly-2021-11-1' # or the latest monthly
version = '4.0.0-dev' # or the latest version
是否有一些明显的事情可能出错了? 我该如何开始调试/修复此问题?
【问题讨论】:
-
@NukeManDan 谢谢,我会更新问题:-)
-
PS:github.com/substrate-developer-hub/substrate-docs/issues/627 是我们将很快解决的问题,以解决同样的问题。
-
@NukeManDan 是的,谢谢,那里的建议有效,可以在这里添加作为答案(我不确定它是否会影响教程 atm 的后面部分)。
-
嗨 Atomh33ls,您能支持我们的 Substrate StackExchange 提案吗:area51.stackexchange.com/proposals/126136
-
@ShawnTabrizi 我几周前做过,现在很接近了!