Move erasure root out of candidate commitments and into descriptor (#2010)

* guide: move erasure-root to candidate descriptor

* primitives: move erasure root to descriptor

* guide: unify candidate commitments and validation outputs

* primitives: unify validation outputs and candidate commitments

* parachains-runtime: fix fallout

* runtimes: fix fallout

* collation generation: fix fallout

* fix stray reference in primitives

* fix fallout in node-primitives

* fix remaining fallout in collation generation

* fix fallout in candidate validation

* fix fallout in runtime API subsystem

* fix fallout in subsystem messages

* fix fallout in candidate backing

* fix fallout in availability distribution

* don't clone

* clone

Co-authored-by: Sergei Shulepov <sergei@parity.io>
This commit is contained in:
Robert Habermeier
2020-11-27 11:39:42 -05:00
committed by GitHub
parent 4fba9df943
commit 0a79d663e4
18 changed files with 85 additions and 134 deletions
@@ -80,6 +80,8 @@ struct CandidateDescriptor {
persisted_validation_data_hash: Hash,
/// The blake2-256 hash of the pov-block.
pov_hash: Hash,
/// The root of a block's erasure encoding Merkle tree.
erasure_root: Hash,
/// Signature on blake2-256 of components of this receipt:
/// The parachain index, the relay parent, the validation data hash, and the pov_hash.
signature: CollatorSignature,
@@ -251,8 +253,6 @@ struct CandidateCommitments {
horizontal_messages: Vec<OutboundHrmpMessage>,
/// Messages destined to be interpreted by the Relay chain itself.
upward_messages: Vec<UpwardMessage>,
/// The root of a block's erasure encoding Merkle tree.
erasure_root: Hash,
/// New validation code.
new_validation_code: Option<ValidationCode>,
/// The head-data produced as a result of execution.
@@ -275,27 +275,4 @@ struct SigningContext {
/// The session index this signature is in the context of.
session_index: SessionIndex,
}
```
## Validation Outputs
This struct encapsulates the outputs of candidate validation.
```rust
struct ValidationOutputs {
/// The head-data produced by validation.
head_data: HeadData,
/// The validation data, persisted.
validation_data: PersistedValidationData,
/// Messages directed to other paras routed via the relay chain.
horizontal_messages: Vec<OutboundHrmpMessage>,
/// Upwards messages to the relay chain.
upwards_messages: Vec<UpwardsMessage>,
/// The new validation code submitted by the execution, if any.
new_validation_code: Option<ValidationCode>,
/// The number of messages processed from the DMQ.
processed_downward_messages: u32,
/// The mark which specifies the block number up to which all inbound HRMP messages are processed.
hrmp_watermark: BlockNumber,
}
```
```
@@ -503,7 +503,7 @@ Various modules request that the [Candidate Validation subsystem](../node/utilit
enum ValidationResult {
/// Candidate is valid, and here are the outputs and the validation data used to form inputs.
/// In practice, this should be a shared type so that validation caching can be done.
Valid(ValidationOutputs, PersistedValidationData),
Valid(CandidateCommitments, PersistedValidationData),
/// Candidate is invalid.
Invalid,
}