create newtype for ValidationCodeHash (#3212)

* create newtype for ValidationCodeHash

* pvf: fix tests compilation

* primitives: fix test compilation
This commit is contained in:
André Silva
2021-06-12 17:44:07 +01:00
committed by GitHub
parent 693302bee0
commit 097cadca19
15 changed files with 102 additions and 58 deletions
@@ -9,5 +9,5 @@ fn validation_code(at: Block, ParaId, OccupiedCoreAssumption) -> Option<Validati
Fetch the validation code (past, present or future) by its hash.
```rust
fn validation_code_by_hash(at: Block, Hash) -> Option<ValidationCode>;
fn validation_code_by_hash(at: Block, ValidationCodeHash) -> Option<ValidationCode>;
```
@@ -117,9 +117,9 @@ ParaLifecycle: map ParaId => Option<ParaLifecycle>,
/// The head-data of every registered para.
Heads: map ParaId => Option<HeadData>;
/// The validation code hash of every live para.
CurrentCodeHash: map ParaId => Option<Hash>;
CurrentCodeHash: map ParaId => Option<ValidationCodeHash>;
/// Actual past code hash, indicated by the para id as well as the block number at which it became outdated.
PastCodeHash: map (ParaId, BlockNumber) => Option<Hash>;
PastCodeHash: map (ParaId, BlockNumber) => Option<ValidationCodeHash>;
/// Past code of parachains. The parachains themselves may not be registered anymore,
/// but we also keep their code on-chain for the same amount of time as outdated code
/// to keep it available for secondary checkers.
@@ -136,15 +136,15 @@ PastCodePruning: Vec<(ParaId, BlockNumber)>;
/// in the context of a relay chain block with a number >= `expected_at`.
FutureCodeUpgrades: map ParaId => Option<BlockNumber>;
/// The actual future code of a para.
FutureCodeHash: map ParaId => Option<Hash>;
FutureCodeHash: map ParaId => Option<ValidationCodeHash>;
/// The actions to perform during the start of a specific session index.
ActionsQueue: map SessionIndex => Vec<ParaId>;
/// Upcoming paras instantiation arguments.
UpcomingParasGenesis: map ParaId => Option<ParaGenesisArgs>;
/// The number of references on the validation code in `CodeByHash` storage.
CodeByHashRefs: map Hash => u32;
CodeByHashRefs: map ValidationCodeHash => u32;
/// Validation code stored by its hash.
CodeByHash: map Hash => Option<ValidationCode>
CodeByHash: map ValidationCodeHash => Option<ValidationCode>
```
## Session Change
@@ -87,6 +87,8 @@ struct CandidateDescriptor {
signature: CollatorSignature,
/// Hash of the para header that is being generated by this candidate.
para_head: Hash,
/// The blake2-256 hash of the validation code bytes.
validation_code_hash: ValidationCodeHash,
}
```