Finish migration to v2 primitives (#5037)

* remove v0 primitives from polkadot-primitives

* first pass: remove v0

* fix fallout in erasure-coding

* remove v1 primitives, consolidate to v2

* the great import update

* update runtime_api_impl_v1 to v2 as well

* guide: add `Version` request for runtime API

* add version query to runtime API

* reintroduce OldV1SessionInfo in a limited way
This commit is contained in:
Robert Habermeier
2022-03-09 14:01:13 -06:00
committed by GitHub
parent 3394cbb142
commit 49f7e5cce4
215 changed files with 2312 additions and 3123 deletions
@@ -12,8 +12,6 @@ Output: None
On receipt of `RuntimeApiMessage::Request(relay_parent, request)`, answer the request using the post-state of the `relay_parent` provided and provide the response to the side-channel embedded within the request.
> TODO Do some caching. The underlying rocksdb already has a cache of trie nodes so duplicate requests are unlikely to hit disk. Not required for functionality.
## Jobs
> TODO Don't limit requests based on parent hash, but limit caching. No caching should be done for any requests on `relay_parent`s that are not active based on `ActiveLeavesUpdate` messages. Maybe with some leeway for things that have just been stopped.
@@ -32,7 +32,7 @@ digraph {
CandidateDescriptor:persisted_validation_data_hash -> PersistedValidationDataHash
Id [label="polkadot_parachain::primitives::Id"]
CollatorId [label="polkadot_primitives::v0::CollatorId"]
CollatorId [label="polkadot_primitives::v2::CollatorId"]
PoVHash [label = "Hash", shape="doublecircle", fill="gray90"]
@@ -114,7 +114,7 @@ digraph {
</table>
>]
TransientValidationData:balance -> "polkadot_core_primitives::v1::Balance":w
TransientValidationData:balance -> "polkadot_core_primitives::v2::Balance":w
CandidateCommitments [label = <
<table>
@@ -129,7 +129,7 @@ digraph {
>]
CandidateCommitments:upward_messages -> "polkadot_parachain::primitives::UpwardMessage":w
CandidateCommitments:horizontal_messages -> "polkadot_core_primitives::v1::OutboundHrmpMessage":w
CandidateCommitments:horizontal_messages -> "polkadot_core_primitives::v2::OutboundHrmpMessage":w
CandidateCommitments:head_data -> HeadData:w
CandidateCommitments:horizontal_messages -> "polkadot_parachain::primitives::Id":w
CandidateCommitments:new_validation_code -> "polkadot_parachain::primitives::ValidationCode":w
@@ -302,9 +302,9 @@ digraph {
SessionInfo:discovery_keys -> AuthorityDiscoveryId:w
SessionInfo:validator_groups -> ValidatorIndex:w
ValidatorId [label = "polkadot_primitives::v0::ValidatorId"]
ValidatorId [label = "polkadot_primitives::v2::ValidatorId"]
AuthorityDiscoveryId [label = "sp_authority_discovery::AuthorityId"]
ValidatorIndex [label = "polkadot_primitives::v0::ValidatorIndex"]
ValidatorIndex [label = "polkadot_primitives::v2::ValidatorIndex"]
AbridgedHostConfiguration [label = <
<table>
@@ -679,6 +679,8 @@ This is fueled by an auxiliary type encapsulating all request types defined in t
```rust
enum RuntimeApiRequest {
/// Get the version of the runtime API at the given parent hash, if any.
Version(ResponseChannel<u32>),
/// Get the current validator set.
Validators(ResponseChannel<Vec<ValidatorId>>),
/// Get the validator groups and rotation info.
@@ -723,6 +725,8 @@ enum RuntimeApiRequest {
enum RuntimeApiMessage {
/// Make a request of the runtime API against the post-state of the given relay-parent.
Request(Hash, RuntimeApiRequest),
/// Get the version of the runtime API at the given parent hash, if any.
Version(Hash, ResponseChannel<Option<u32>>)
}
```