You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Substrate节点授权开发遇signature版本冲突问题求助

问题:Substrate Runtime构建时signature版本冲突解决思路

在WSL2 Kali Linux环境下,按照Substrate官方教程《授权特定节点》开发,此前构建substrate-node-template正常,但执行cargo check -p node-template-runtime --release时出现signature版本冲突,陷入停滞。此前曾遇到libp2p版本冲突,通过在runtime的cargo.toml中添加指定配置解决。

此前解决libp2p冲突的配置

libp2p = { version = "0.50.0", default-features = false, features = [
  'gossipsub',
  'kad',
  'identify',
  'ping',
  'mdns',
  'noise',
  'yamux',
  'tcp',
  'websocket',
  'dns',
  'request-response',
  'metrics',
  'tokio',
  'macros',
] }

当前signature冲突错误日志

error: failed to select a version for `signature`.
    ... required by package `ecdsa v0.14.4`
    ... which satisfies dependency `ecdsa-core = "^0.14"` of package `p256 v0.11.1`
    ... which satisfies dependency `p256 = "^0.11.1"` of package `webrtc-dtls v0.7.0`
    ... which satisfies dependency `dtls = "^0.7.0"` of package `webrtc v0.6.0`
    ... which satisfies dependency `webrtc = "^0.6.0"` of package `libp2p-webrtc v0.4.0-alpha.2`
    ... which satisfies dependency `libp2p-webrtc = "^0.4.0-alpha"` of package `libp2p v0.50.0`
    ... which satisfies dependency `libp2p = "^0.50.0"` of package `node-template-runtime v4.0.0-dev (/home/devri/substrate-node-template/runtime)`
    ... which satisfies path dependency `node-template-runtime` (locked to 4.0.0-dev) of package `node-template v4.0.0-dev (/home/devri/substrate-node-template/node)`
versions that meet the requirements `>=1.5, <1.7` are: 1.6.4, 1.6.3, 1.6.2, 1.5.0

all possible versions conflict with previously selected packages.

  previously selected package `signature v1.4.0`
    ... which satisfies dependency `signature = ">=1.3.1, <1.5"` of package `ecdsa v0.13.4`
    ... which satisfies dependency `ecdsa-core = "^0.13"` of package `k256 v0.10.4`
    ... which satisfies dependency `k256 = "^0.10.4"` of package `frame-support v4.0.0-dev (https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.28#ce10b9f2)`
    ... which satisfies git dependency `frame-support` of package `frame-system v4.0.0-dev (https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.28#ce10b9f2)`
    ... which satisfies git dependency `frame-system` of package `pallet-node-authorization v4.0.0-dev (https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.28#ce10b9f2)`
    ... which satisfies git dependency `pallet-node-authorization` of package `node-template-runtime v4.0.0-dev (/home/devri/substrate-node-template/runtime)`
    ... which satisfies path dependency `node-template-runtime` (locked to 4.0.0-dev) of package `node-template v4.0.0-dev (/home/devri/substrate-node-template/node)`

此前libp2p冲突错误日志

error: failed to select a version for `libp2p`.
    ... required by package `sc-telemetry v4.0.0-dev (https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#bca8a29d)`
    ... which satisfies git dependency `sc-telemetry` (locked to 4.0.0-dev) of package `node-template v4.0.0-dev (/home/devri/substrate-node-template/node)`
versions that meet the requirements `^0.50.0` are: 0.50.1, 0.50.0

all possible versions conflict with previously selected packages.

  previously selected package `node-template-runtime v4.0.0-dev (/home/devri/substrate-node-template/runtime)`
    ... which satisfies path dependency `node-template-runtime` (locked to 4.0.0-dev) of package `node-template v4.0.0-dev (/home/devri/substrate-node-template/node)`

  previously selected package `libp2p v0.50.0`
    ... which satisfies dependency `libp2p = "^0.50.0"` of package `sc-cli v0.10.0-dev (https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#bca8a29d)`
    ... which satisfies git dependency `sc-cli` (locked to 0.10.0-dev) of package `frame-benchmarking-cli v4.0.0-dev (https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#bca8a29d)`
    ... which satisfies git dependency `frame-benchmarking-cli` (locked to 4.0.0-dev) of package `node-template v4.0.0-dev (/home/devri/substrate-node-template/node)`

failed to select a version for `libp2p` which could resolve this conflict

解决思路

  • 核心问题:libp2p v0.50.0依赖链要求signature版本>=1.5且<1.7,而Substrate框架(polkadot-v0.9.28分支)依赖的signature版本是1.4.0,两者版本范围不兼容。
  • 方案1:移除libp2p的WebRTC相关特性。冲突源于libp2p-webrtc依赖链,若节点不需要WebRTC传输,可修改runtime的cargo.toml中libp2p配置,去掉websocket特性,避免引入该依赖链:
    libp2p = { version = "0.50.0", default-features = false, features = [
      'gossipsub',
      'kad',
      'identify',
      'ping',
      'mdns',
      'noise',
      'yamux',
      'tcp',
      'dns',
      'request-response',
      'metrics',
      'tokio',
      'macros',
    ] }
    
  • 方案2:统一Substrate依赖分支版本。当前日志显示frame-support用polkadot-v0.9.28分支,sc-telemetry用polkadot-v0.9.42分支,版本不一致加剧依赖冲突。将所有Substrate相关依赖统一为同一分支(如polkadot-v0.9.42),更新runtime中pallet-node-authorization等依赖的git分支后,重新执行cargo update。
  • 方案3:强制指定兼容的signature版本。通过[patch.crates-io]强制所有依赖使用兼容版本:
    [patch.crates-io]
    signature = { version = "1.4.0" }
    
    若libp2p无法兼容1.4.0,则降级libp2p到与polkadot-v0.9.28分支匹配的版本,替换runtime中libp2p的版本号后重新构建。

内容的提问来源于stack exchange,提问作者DeviousxDeveloper

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 22:44:55