paritytech / paritytech/try-runtime-cli

No digest item for a custom consensus engine

未关闭
#116 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Rust
星标
25
派生
29
PR 合并指标
30 天内没有已合并 PR

描述

Hello! I work on a Substrate-based chain with a custom consensus engine and as suggested in https://github.com/paritytech/try-runtime-cli/blob/b45be7dfce89fd881be27171d3ea114ef19d832c/core/src/common/empty_block/inherents/providers.rs#L96-L98 reporting a case when SmartInherentProvider doesn't work for me.

Currently, providers.rs only accounts for BABE and AURA when constructing the digest for the empty block. In my case for QF Network's blockchain node QuantumFusion-network/qf-solochain we are developing a custom consensus engine called SPIN with its own engine ID SPIN_ENGINE_ID. Because of this there is no slot with the expected engine ID in the empty block and the slot number validation fails during try-runtime usage.

It is easy to add custom engine ID in a fork project like:

// core/src/common/empty_block/inherents/providers.rs#L128
let digest = vec![
    DigestItem::PreRuntime(
        BABE_ENGINE_ID,
        PreDigest::SecondaryPlain(SecondaryPlainPreDigest {
            slot,
            authority_index: 0,
        })
        .encode(),
    ),
    DigestItem::PreRuntime(AURA_ENGINE_ID, slot.encode()),
    DigestItem::PreRuntime(*b"spin", slot.encode()),
];

But perhaps there are some recommendations on how to properly support custom engine IDs in the digest? Thank you.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 core/src/common/empty_block/inherents/providers.rs 开始,重点查看 SmartInherentProvider 以及 129-140 行附近的 digest 构造。检查 BABE 和 AURA 的处理方式以及所引用的验证路径;当建立并测试了一种受支持的方式,使自定义共识引擎 ID(例如 SPIN)能够提供预期的 digest 项时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
rust
领域
blockchain
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。