Skip to content

No digest item for a custom consensus engine #116

@khssnv

Description

@khssnv

Hello! I work on a Substrate-based chain with a custom consensus engine and as suggested in

/// If it does not work for your Substrate-based chain, [please open an issue](https://github.com/paritytech/try-runtime-cli/issues)
/// and we will look into supporting it.
struct SmartInherentProvider {
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions