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
+9 -9
View File
@@ -24,7 +24,7 @@ use kusama_runtime as kusama;
use kusama_runtime_constants::currency::UNITS as KSM;
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use pallet_staking::Forcing;
use polkadot_primitives::v1::{AccountId, AccountPublic, AssignmentId, ValidatorId};
use polkadot_primitives::v2::{AccountId, AccountPublic, AssignmentId, ValidatorId};
#[cfg(feature = "polkadot-native")]
use polkadot_runtime as polkadot;
#[cfg(feature = "polkadot-native")]
@@ -64,9 +64,9 @@ const DEFAULT_PROTOCOL_ID: &str = "dot";
#[serde(rename_all = "camelCase")]
pub struct Extensions {
/// Block numbers with known hashes.
pub fork_blocks: sc_client_api::ForkBlocks<polkadot_primitives::v1::Block>,
pub fork_blocks: sc_client_api::ForkBlocks<polkadot_primitives::v2::Block>,
/// Known bad block hashes.
pub bad_blocks: sc_client_api::BadBlocks<polkadot_primitives::v1::Block>,
pub bad_blocks: sc_client_api::BadBlocks<polkadot_primitives::v2::Block>,
/// The light sync state.
///
/// This value will be set by the `sync-state rpc` implementation.
@@ -174,9 +174,9 @@ pub fn wococo_config() -> Result<RococoChainSpec, String> {
))]
fn default_parachains_host_configuration(
) -> polkadot_runtime_parachains::configuration::HostConfiguration<
polkadot_primitives::v1::BlockNumber,
polkadot_primitives::v2::BlockNumber,
> {
use polkadot_primitives::v1::{MAX_CODE_SIZE, MAX_POV_SIZE};
use polkadot_primitives::v2::{MAX_CODE_SIZE, MAX_POV_SIZE};
polkadot_runtime_parachains::configuration::HostConfiguration {
validation_upgrade_cooldown: 2u32,
@@ -569,7 +569,7 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Genesi
},
paras: Default::default(),
registrar: westend_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
next_free_para_id: polkadot_primitives::v2::LOWEST_PUBLIC_ID,
},
xcm_pallet: Default::default(),
}
@@ -1062,7 +1062,7 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
config: default_parachains_host_configuration(),
},
registrar: rococo_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
next_free_para_id: polkadot_primitives::v2::LOWEST_PUBLIC_ID,
},
xcm_pallet: Default::default(),
transaction_payment: Default::default(),
@@ -1502,7 +1502,7 @@ pub fn westend_testnet_genesis(
},
paras: Default::default(),
registrar: westend_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
next_free_para_id: polkadot_primitives::v2::LOWEST_PUBLIC_ID,
},
xcm_pallet: Default::default(),
}
@@ -1576,7 +1576,7 @@ pub fn rococo_testnet_genesis(
},
paras: rococo_runtime::ParasConfig { paras: vec![] },
registrar: rococo_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
next_free_para_id: polkadot_primitives::v2::LOWEST_PUBLIC_ID,
},
xcm_pallet: Default::default(),
transaction_payment: Default::default(),
+1 -1
View File
@@ -23,7 +23,7 @@ use sp_runtime::traits::{Block as BlockT, Header as _, NumberFor};
use crate::HeaderProvider;
#[cfg(feature = "full-node")]
use polkadot_primitives::v1::{Block, Hash};
use polkadot_primitives::v2::{Block, Hash};
/// Returns the block hash of the block at the given `target_number` by walking
/// backwards from the given `current_header`.
+1 -1
View File
@@ -94,7 +94,7 @@ pub use polkadot_client::{
AbstractClient, Client, ClientHandle, ExecuteWithClient, FullBackend, FullClient,
RuntimeApiCollection,
};
pub use polkadot_primitives::v1::{Block, BlockId, CollatorPair, Hash, Id as ParaId};
pub use polkadot_primitives::v2::{Block, BlockId, CollatorPair, Hash, Id as ParaId};
pub use sc_client_api::{Backend, CallExecutor, ExecutionStrategy};
pub use sc_consensus::{BlockImport, LongestChain};
use sc_executor::NativeElseWasmExecutor;
@@ -40,7 +40,7 @@ use consensus_common::{Error as ConsensusError, SelectChain};
use futures::channel::oneshot;
use polkadot_node_subsystem_util::metrics::{self, prometheus};
use polkadot_overseer::{AllMessages, Handle};
use polkadot_primitives::v1::{
use polkadot_primitives::v2::{
Block as PolkadotBlock, BlockNumber, Hash, Header as PolkadotHeader,
};
use polkadot_subsystem::messages::{
@@ -55,7 +55,7 @@ use std::sync::Arc;
/// This is a safety net that should be removed at some point in the future.
// Until it's not, make sure to also update `MAX_HEADS_LOOK_BACK` in `approval-voting`
// and `MAX_BATCH_SCRAPE_ANCESTORS` in `dispute-coordinator` when changing its value.
const MAX_FINALITY_LAG: polkadot_primitives::v1::BlockNumber = 500;
const MAX_FINALITY_LAG: polkadot_primitives::v2::BlockNumber = 500;
const LOG_TARGET: &str = "parachain::chain-selection";
+1 -1
View File
@@ -36,7 +36,7 @@ use assert_matches::assert_matches;
use std::{sync::Arc, time::Duration};
use futures::{channel::oneshot, prelude::*};
use polkadot_primitives::v1::{Block, BlockNumber, Hash, Header};
use polkadot_primitives::v2::{Block, BlockNumber, Hash, Header};
use polkadot_subsystem::messages::{
ApprovalVotingMessage, ChainSelectionMessage, DisputeCoordinatorMessage,
HighestApprovedAncestorBlock,