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
@@ -18,7 +18,7 @@
use futures::{channel::oneshot, prelude::*};
use polkadot_node_subsystem::{messages::ChainApiMessage, SubsystemSender};
use polkadot_primitives::v1::{BlockNumber, Hash, Header};
use polkadot_primitives::v2::{BlockNumber, Hash, Header};
/// Given a new chain-head hash, this determines the hashes of all new blocks we should track
/// metadata for, given this head.
+5 -8
View File
@@ -49,14 +49,11 @@ use futures::{
use parity_scale_codec::Encode;
use pin_project::pin_project;
use polkadot_primitives::{
v1::{
AuthorityDiscoveryId, CandidateEvent, CommittedCandidateReceipt, CoreState, EncodeAs,
GroupIndex, GroupRotationInfo, Hash, Id as ParaId, OccupiedCoreAssumption,
PersistedValidationData, SessionIndex, Signed, SigningContext, ValidationCode,
ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature,
},
v2::SessionInfo,
use polkadot_primitives::v2::{
AuthorityDiscoveryId, CandidateEvent, CommittedCandidateReceipt, CoreState, EncodeAs,
GroupIndex, GroupRotationInfo, Hash, Id as ParaId, OccupiedCoreAssumption,
PersistedValidationData, SessionIndex, SessionInfo, Signed, SigningContext, ValidationCode,
ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature,
};
use sp_application_crypto::AppKey;
use sp_core::{traits::SpawnNamed, ByteArray};
@@ -20,10 +20,7 @@
//! care about the state of particular blocks.
pub use polkadot_node_primitives::{new_session_window_size, SessionWindowSize};
use polkadot_primitives::{
v1::{Hash, SessionIndex},
v2::SessionInfo,
};
use polkadot_primitives::v2::{Hash, SessionIndex, SessionInfo};
use futures::channel::oneshot;
use polkadot_node_subsystem::{
@@ -279,7 +276,7 @@ mod tests {
use assert_matches::assert_matches;
use polkadot_node_subsystem::messages::{AllMessages, AvailabilityRecoveryMessage};
use polkadot_node_subsystem_test_helpers::make_subsystem_context;
use polkadot_primitives::v1::Header;
use polkadot_primitives::v2::Header;
use sp_core::testing::TaskExecutor;
pub const TEST_WINDOW_SIZE: SessionWindowSize = new_session_window_size!(6);
@@ -20,7 +20,7 @@
use futures::channel::oneshot;
use polkadot_node_subsystem::errors::RuntimeApiError;
use polkadot_primitives::v1::SessionIndex;
use polkadot_primitives::v2::SessionIndex;
#[allow(missing_docs)]
#[fatality::fatality(splitable)]
@@ -26,13 +26,10 @@ use sp_core::crypto::ByteArray;
use sp_keystore::{CryptoStore, SyncCryptoStorePtr};
use polkadot_node_subsystem::{SubsystemContext, SubsystemSender};
use polkadot_primitives::{
v1::{
CandidateEvent, CoreState, EncodeAs, GroupIndex, GroupRotationInfo, Hash, OccupiedCore,
SessionIndex, Signed, SigningContext, UncheckedSigned, ValidationCode, ValidationCodeHash,
ValidatorId, ValidatorIndex,
},
v2::SessionInfo,
use polkadot_primitives::v2::{
CandidateEvent, CoreState, EncodeAs, GroupIndex, GroupRotationInfo, Hash, OccupiedCore,
SessionIndex, SessionInfo, Signed, SigningContext, UncheckedSigned, ValidationCode,
ValidationCodeHash, ValidatorId, ValidatorIndex,
};
use crate::{
+1 -1
View File
@@ -24,7 +24,7 @@ use polkadot_node_subsystem::{
ActivatedLeaf, ActiveLeavesUpdate, FromOverseer, LeafStatus, OverseerSignal, SpawnedSubsystem,
};
use polkadot_node_subsystem_test_helpers::{self as test_helpers, make_subsystem_context};
use polkadot_primitives::v1::Hash;
use polkadot_primitives::v2::Hash;
use polkadot_primitives_test_helpers::{dummy_candidate_receipt, dummy_hash};
use std::{
pin::Pin,