如果你运行cargo check
,你会得到以下结果:
error: failed to load manifest for workspace member `/root/cumulus/pallets/dex`
Caused by:
failed to load manifest for dependency `acala-primitives`
Caused by:
failed to load manifest for dependency `module-evm-utiltity`
Caused by:
failed to read `/root/cumulus/primitives/modules/evm-utiltity/Cargo.toml`
Caused by:
No such file or directory (os error 2)
问题在于
/root/cumulus/primitives/modules/evm-utiltity/Cargo.toml
未找到,因为您未将此pallet包含在本地或该pallet被放错位置并位于其他地方。
简单的解决方案:
1. 定位和更正
找到pallet所在位置,并正确链接到它,或将pallet导入到位置
root/cumulus/primitives/modules/evm-utiltity/Cargo.toml
,以便可以找到它。
2. 外部链接而不是本地导入pallets
您可以从其外部来源链接到pallet,而不是在本地导入它,否则您将发现需要采取更多的依赖关系并将它们存储在本地,就像上面提到的错误中的
/root/cumulus/primitives/modules/evm-utiltity/Cargo.toml
一样。
您可以这样做:
直接转到运行时目录,即
/root/cumulus/parachain-template/runtime/Cargo.toml
,并直接从github.com/acala-network/acala链接到外部dex,类似于以下内容:
[dependencies.pallet-dexl]
default-features = false
git = 'https://github.com/Acala-Network/acala.git'
branch = polkadot-v0.9.13
version = '3.0.0'
实际上它仍然使用旧的依赖版本,就像这样:
pallet-dex = { git = "https://github.com/Acala-Network/acala", default-features = false, branch = "polkadot-v0.9.13" }
对于这个错误,需要更加具体的设置:
module-evm-utlity = { git = "https://github.com/Acala-Network/acala", default-features = false, branch = "polkadot-v0.9.13" }
但是如果您从外部源链接到pallet-dex
,错误应该会消失,并且您可能不需要链接 acala-primitives
或者 module-evm-utility
。
https://docs.substrate.io/how-to-guides/v3/basics/pallet-integration/
此外,evm-utiltity
拼写不正确(应该是 utility)。
[dependencies.module-dex] default-features = false git = 'https://github.com/AcalaNetwork/Acala.git' branch = 'release-acala-2.0.3' version = '2.0.3'
如你建议的,将其添加到runtime/Cargo.toml
中。这次我遇到了不同的问题,请查看下面的图片:https://i.stack.imgur.com/l5Rsa.png - P.E