Build relay-chain block with correct `ParachainInherents`
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
Step 1: 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::companionmacro to account for these changes
Step 2: Inherents with Signatures
NOTE: This might not be needed if the above works fine, as this will always introduce the need to switch the authority-keys on both the realy- and parachains.
This would actually mimic the real procedure of firstly generating the correct CommittedCandidateReceipt<H> on the parachain side, including signatures and then if these are available creating the correct availability bitffields in the next block. As written above this introduces the need to switch authority keys. And at least two relay-chain authorities are needed to sign as this is the minimum threshold currently (state: 03.2022).
Requires:
- Switching all or appending the authority keys on both parachain and relay-chain
Tasks
- [ ] Easily switch authority keys on the builder side. Possibily with capability to store the "original" keys in the builder and re-inserting them if wanted
- [ ] Signing stuff
- [ ] a looot more...