paritytech / paritytech/try-runtime-cli
No digest item for a custom consensus engine
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 25
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in core/src/common/empty_block/inherents/providers.rs, especially SmartInherentProvider and the digest construction around lines 129-140. Review how BABE and AURA are handled and the referenced validation path; done means establishing and testing a supported way for custom consensus engine IDs such as SPIN to provide the expected digest item.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- blockchain
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100