centrifuge/fudge

Build relay-chain block with correct `ParachainInherents`

mustermeiszer opened this issue · 1 comments

Currently we build the relay-chain block with the inherent like

 ParachainsInherentData::<HDR> {
	bitfields: vec![],
	backed_candidates: vec![],
	disputes: vec![],
	parent_header: self.parent_head.clone(),
};

Without manually mutating the state of the relay-chain after the next block has been build and injecting the new parachain heads there, the above inherent means, no parachain can make progress.

Actually generating this data "correctly" is essential to providing easy xcm support with a bigger hack.

There are two steps for this feature should be implemented in

Force Enact

The runtime-api of the parachain provides a method force_enact that allows to enact a parachain block. Usually this is only used with a state of a relay-chain that is afterwards not applied to the db. But we could hack this and use it in order to actually enact parachain-blocks after we have build the latest relay-chain-block.

Requires:

  • Correctly generated CommittedCandidateReceipt<H> (No valid signature needed, those are not checked)

Tasks

  • Alter the parachain-builder in a way that it can be used to generate CommittedCandidateReceipt<H> if called by the relay-chain inherent provider and if a block is "available"
  • Generate CommittedCandidateReceipt<H> with a parachain-builder
  • Alter relaychain-builder to receive a Vec<CommittedCandidateReceipt<H>> before building a block and inject those into its inherent data
  • Alter fudge::companion macro to account for these changes