Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

ValidationData refactoring #1539

@rphmeier

Description

@rphmeier

#1503 (review)

Rephrased more abstractly here:

We currently maintain an invariant that everything that is backed in the relay chain satisfies a number of checks on the commitments of the candidate - that they meet size limits, only send messages on valid channels, etc.

However, it is not clear to me how the validators are meant to check those things off-chain, because there is currently no runtime API that exposes these things. It's also not clear to me how collators are meant to construct blocks that satisfy these limits. I think we want to expose this data from the runtime API, but we don't need to keep it available for secondary checkers because of the invariant I mentioned at the beginning.

I think we should have two main changes to ValidationData with a couple of implied secondary changes.

Main changes:

  1. Combine LocalValidationData and GlobalValidationData into a single ValidationData struct.
  2. Split ValidationData into PersistedValidationData and NonPersistedValidationData.

The result would look something like this:

struct ValidationData {
    /// Validation data that needs to be persisted for secondary checkers.
    ///
    /// These validation data are generally derived from some relay-chain state to form inputs to 
    /// the validation function, and as such need to be persisted by the availability system
    ///  to avoid dependence on availability of the relay-chain state.
    persisted: PersistedValidationData,
    /// These validation data are derived from some relay-chain state to check outputs of the validation
    /// function. Since the commitments of the validation function are checked by the relay-chain,
    /// secondary checkers can rely on the invariant that the relay-chain only includes para-blocks
    /// for which these checks have already been done. As such, there is no need for this information
    /// to be persisted by the availability system. Nevertheless, we expose it so the backing validators
    /// can validate the outputs of a candidate before voting to submit it to the relay-chain and so
    /// collators can collate candidates that satisfy the criteria implied by this field.
    non_persisted: NonPersistedValidationData,
}

Secondary changes:

  1. Combine the global_validation_data and local_validation_data runtime APIs
  2. The validation_data_hash in candidate descriptors should reference only the persisted validation data.
  3. The AvailableData struct should store only the persisted validation data.

These changes encompass both the guide and the code-base.

Metadata

Metadata

Assignees

Labels

I8-refactorCode needs refactoring.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions