mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
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:
committed by
GitHub
parent
3394cbb142
commit
49f7e5cce4
@@ -16,7 +16,7 @@
|
||||
|
||||
use beefy_primitives::crypto::AuthorityId as BeefyId;
|
||||
use bp_rialto::derive_account_from_millau_id;
|
||||
use polkadot_primitives::v1::{AssignmentId, ValidatorId};
|
||||
use polkadot_primitives::v2::{AssignmentId, ValidatorId};
|
||||
use rialto_runtime::{
|
||||
AccountId, BabeConfig, BalancesConfig, BeefyConfig, BridgeMillauMessagesConfig,
|
||||
ConfigurationConfig, GenesisConfig, GrandpaConfig, SessionConfig, SessionKeys, Signature,
|
||||
@@ -250,8 +250,8 @@ fn testnet_genesis(
|
||||
validation_upgrade_frequency: 1u32,
|
||||
validation_upgrade_delay: 1,
|
||||
code_retention_period: 1200,
|
||||
max_code_size: polkadot_primitives::v1::MAX_CODE_SIZE,
|
||||
max_pov_size: polkadot_primitives::v1::MAX_POV_SIZE,
|
||||
max_code_size: polkadot_primitives::v2::MAX_CODE_SIZE,
|
||||
max_pov_size: polkadot_primitives::v2::MAX_POV_SIZE,
|
||||
max_head_data_size: 32 * 1024,
|
||||
group_rotation_frequency: 20,
|
||||
chain_availability_period: 4,
|
||||
|
||||
@@ -36,7 +36,7 @@ use polkadot_overseer::{
|
||||
metrics::Metrics as OverseerMetrics, BlockInfo, MetricsTrait, Overseer, InitializedOverseerBuilder,
|
||||
OverseerConnector, OverseerHandle,
|
||||
};
|
||||
use polkadot_primitives::v1::ParachainHost;
|
||||
use polkadot_primitives::v2::ParachainHost;
|
||||
use sc_authority_discovery::Service as AuthorityDiscoveryService;
|
||||
use sc_client_api::AuxStore;
|
||||
use sc_keystore::LocalKeystore;
|
||||
|
||||
@@ -29,7 +29,7 @@ use polkadot_node_core_chain_selection::Config as ChainSelectionConfig;
|
||||
use polkadot_node_core_dispute_coordinator::Config as DisputeCoordinatorConfig;
|
||||
use polkadot_node_network_protocol::request_response::IncomingRequest;
|
||||
use polkadot_overseer::{BlockInfo, OverseerConnector};
|
||||
use polkadot_primitives::v1::BlockId;
|
||||
use polkadot_primitives::v2::BlockId;
|
||||
use rialto_runtime::{self, opaque::Block, RuntimeApi};
|
||||
use sc_client_api::ExecutorProvider;
|
||||
use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch};
|
||||
@@ -43,7 +43,7 @@ use std::{sync::Arc, time::Duration};
|
||||
use substrate_prometheus_endpoint::Registry;
|
||||
|
||||
pub use polkadot_overseer::Handle;
|
||||
pub use polkadot_primitives::v1::ParachainHost;
|
||||
pub use polkadot_primitives::v2::ParachainHost;
|
||||
pub use sc_client_api::AuxStore;
|
||||
pub use sp_authority_discovery::AuthorityDiscoveryApi;
|
||||
pub use sp_blockchain::HeaderBackend;
|
||||
|
||||
@@ -747,64 +747,64 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl polkadot_primitives::v1::ParachainHost<Block, Hash, BlockNumber> for Runtime {
|
||||
fn validators() -> Vec<polkadot_primitives::v1::ValidatorId> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v1::validators::<Runtime>()
|
||||
impl polkadot_primitives::v2::ParachainHost<Block, Hash, BlockNumber> for Runtime {
|
||||
fn validators() -> Vec<polkadot_primitives::v2::ValidatorId> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v2::validators::<Runtime>()
|
||||
}
|
||||
|
||||
fn validator_groups() -> (
|
||||
Vec<Vec<polkadot_primitives::v1::ValidatorIndex>>,
|
||||
polkadot_primitives::v1::GroupRotationInfo<BlockNumber>,
|
||||
Vec<Vec<polkadot_primitives::v2::ValidatorIndex>>,
|
||||
polkadot_primitives::v2::GroupRotationInfo<BlockNumber>,
|
||||
) {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v1::validator_groups::<Runtime>()
|
||||
polkadot_runtime_parachains::runtime_api_impl::v2::validator_groups::<Runtime>()
|
||||
}
|
||||
|
||||
fn availability_cores() -> Vec<polkadot_primitives::v1::CoreState<Hash, BlockNumber>> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v1::availability_cores::<Runtime>()
|
||||
fn availability_cores() -> Vec<polkadot_primitives::v2::CoreState<Hash, BlockNumber>> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v2::availability_cores::<Runtime>()
|
||||
}
|
||||
|
||||
fn persisted_validation_data(
|
||||
para_id: polkadot_primitives::v1::Id,
|
||||
assumption: polkadot_primitives::v1::OccupiedCoreAssumption,
|
||||
para_id: polkadot_primitives::v2::Id,
|
||||
assumption: polkadot_primitives::v2::OccupiedCoreAssumption,
|
||||
)
|
||||
-> Option<polkadot_primitives::v1::PersistedValidationData<Hash, BlockNumber>> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v1::persisted_validation_data::<Runtime>(para_id, assumption)
|
||||
-> Option<polkadot_primitives::v2::PersistedValidationData<Hash, BlockNumber>> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v2::persisted_validation_data::<Runtime>(para_id, assumption)
|
||||
}
|
||||
|
||||
fn assumed_validation_data(
|
||||
para_id: polkadot_primitives::v1::Id,
|
||||
para_id: polkadot_primitives::v2::Id,
|
||||
expected_persisted_validation_data_hash: Hash,
|
||||
) -> Option<(polkadot_primitives::v1::PersistedValidationData<Hash, BlockNumber>, polkadot_primitives::v1::ValidationCodeHash)> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v1::assumed_validation_data::<Runtime>(para_id, expected_persisted_validation_data_hash)
|
||||
) -> Option<(polkadot_primitives::v2::PersistedValidationData<Hash, BlockNumber>, polkadot_primitives::v2::ValidationCodeHash)> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v2::assumed_validation_data::<Runtime>(para_id, expected_persisted_validation_data_hash)
|
||||
}
|
||||
|
||||
fn check_validation_outputs(
|
||||
para_id: polkadot_primitives::v1::Id,
|
||||
outputs: polkadot_primitives::v1::CandidateCommitments,
|
||||
para_id: polkadot_primitives::v2::Id,
|
||||
outputs: polkadot_primitives::v2::CandidateCommitments,
|
||||
) -> bool {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v1::check_validation_outputs::<Runtime>(para_id, outputs)
|
||||
polkadot_runtime_parachains::runtime_api_impl::v2::check_validation_outputs::<Runtime>(para_id, outputs)
|
||||
}
|
||||
|
||||
fn session_index_for_child() -> polkadot_primitives::v1::SessionIndex {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v1::session_index_for_child::<Runtime>()
|
||||
fn session_index_for_child() -> polkadot_primitives::v2::SessionIndex {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v2::session_index_for_child::<Runtime>()
|
||||
}
|
||||
|
||||
fn validation_code(
|
||||
para_id: polkadot_primitives::v1::Id,
|
||||
assumption: polkadot_primitives::v1::OccupiedCoreAssumption,
|
||||
para_id: polkadot_primitives::v2::Id,
|
||||
assumption: polkadot_primitives::v2::OccupiedCoreAssumption,
|
||||
)
|
||||
-> Option<polkadot_primitives::v1::ValidationCode> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v1::validation_code::<Runtime>(para_id, assumption)
|
||||
-> Option<polkadot_primitives::v2::ValidationCode> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v2::validation_code::<Runtime>(para_id, assumption)
|
||||
}
|
||||
|
||||
fn candidate_pending_availability(
|
||||
para_id: polkadot_primitives::v1::Id,
|
||||
) -> Option<polkadot_primitives::v1::CommittedCandidateReceipt<Hash>> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v1::candidate_pending_availability::<Runtime>(para_id)
|
||||
para_id: polkadot_primitives::v2::Id,
|
||||
) -> Option<polkadot_primitives::v2::CommittedCandidateReceipt<Hash>> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v2::candidate_pending_availability::<Runtime>(para_id)
|
||||
}
|
||||
|
||||
fn candidate_events() -> Vec<polkadot_primitives::v1::CandidateEvent<Hash>> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v1::candidate_events::<Runtime, _>(|ev| {
|
||||
fn candidate_events() -> Vec<polkadot_primitives::v2::CandidateEvent<Hash>> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v2::candidate_events::<Runtime, _>(|ev| {
|
||||
match ev {
|
||||
Event::Inclusion(ev) => {
|
||||
Some(ev)
|
||||
@@ -814,36 +814,36 @@ impl_runtime_apis! {
|
||||
})
|
||||
}
|
||||
|
||||
fn session_info(index: polkadot_primitives::v1::SessionIndex) -> Option<polkadot_primitives::v1::SessionInfo> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v1::session_info::<Runtime>(index)
|
||||
fn session_info(index: polkadot_primitives::v2::SessionIndex) -> Option<polkadot_primitives::v2::SessionInfo> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v2::session_info::<Runtime>(index)
|
||||
}
|
||||
|
||||
fn dmq_contents(
|
||||
recipient: polkadot_primitives::v1::Id,
|
||||
) -> Vec<polkadot_primitives::v1::InboundDownwardMessage<BlockNumber>> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v1::dmq_contents::<Runtime>(recipient)
|
||||
recipient: polkadot_primitives::v2::Id,
|
||||
) -> Vec<polkadot_primitives::v2::InboundDownwardMessage<BlockNumber>> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v2::dmq_contents::<Runtime>(recipient)
|
||||
}
|
||||
|
||||
fn inbound_hrmp_channels_contents(
|
||||
recipient: polkadot_primitives::v1::Id
|
||||
) -> BTreeMap<polkadot_primitives::v1::Id, Vec<polkadot_primitives::v1::InboundHrmpMessage<BlockNumber>>> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v1::inbound_hrmp_channels_contents::<Runtime>(recipient)
|
||||
recipient: polkadot_primitives::v2::Id
|
||||
) -> BTreeMap<polkadot_primitives::v2::Id, Vec<polkadot_primitives::v2::InboundHrmpMessage<BlockNumber>>> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v2::inbound_hrmp_channels_contents::<Runtime>(recipient)
|
||||
}
|
||||
|
||||
fn validation_code_by_hash(
|
||||
hash: polkadot_primitives::v1::ValidationCodeHash,
|
||||
) -> Option<polkadot_primitives::v1::ValidationCode> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v1::validation_code_by_hash::<Runtime>(hash)
|
||||
hash: polkadot_primitives::v2::ValidationCodeHash,
|
||||
) -> Option<polkadot_primitives::v2::ValidationCode> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v2::validation_code_by_hash::<Runtime>(hash)
|
||||
}
|
||||
|
||||
fn on_chain_votes() -> Option<polkadot_primitives::v1::ScrapedOnChainVotes<Hash>> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v1::on_chain_votes::<Runtime>()
|
||||
fn on_chain_votes() -> Option<polkadot_primitives::v2::ScrapedOnChainVotes<Hash>> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v2::on_chain_votes::<Runtime>()
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_authority_discovery::AuthorityDiscoveryApi<Block> for Runtime {
|
||||
fn authorities() -> Vec<AuthorityDiscoveryId> {
|
||||
polkadot_runtime_parachains::runtime_api_impl::v1::relevant_authority_ids::<Runtime>()
|
||||
polkadot_runtime_parachains::runtime_api_impl::v2::relevant_authority_ids::<Runtime>()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ use crate::{AccountId, Balance, Balances, BlockNumber, Event, Origin, Registrar,
|
||||
|
||||
use frame_support::{parameter_types, weights::Weight};
|
||||
use frame_system::EnsureRoot;
|
||||
use polkadot_primitives::v1::ValidatorIndex;
|
||||
use polkadot_primitives::v2::ValidatorIndex;
|
||||
use polkadot_runtime_common::{paras_registrar, paras_sudo_wrapper, slots};
|
||||
use polkadot_runtime_parachains::{
|
||||
configuration as parachains_configuration, dmp as parachains_dmp, hrmp as parachains_hrmp,
|
||||
|
||||
@@ -106,8 +106,8 @@ impl RegisterParachain {
|
||||
let para_id: ParaId = relay_client
|
||||
.storage_value(StorageKey(para_id_key.to_vec()), None)
|
||||
.await?
|
||||
.unwrap_or(polkadot_primitives::v1::LOWEST_PUBLIC_ID)
|
||||
.max(polkadot_primitives::v1::LOWEST_PUBLIC_ID);
|
||||
.unwrap_or(polkadot_primitives::v2::LOWEST_PUBLIC_ID)
|
||||
.max(polkadot_primitives::v2::LOWEST_PUBLIC_ID);
|
||||
log::info!(target: "bridge", "Going to reserve parachain id: {:?}", para_id);
|
||||
|
||||
// step 1: reserve a parachain id
|
||||
|
||||
@@ -149,7 +149,7 @@ pub struct OutboundHrmpMessage<Id> {
|
||||
pub data: sp_std::vec::Vec<u8>,
|
||||
}
|
||||
|
||||
/// `V1` primitives.
|
||||
pub mod v1 {
|
||||
/// `V2` primitives.
|
||||
pub mod v2 {
|
||||
pub use super::*;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ use std::convert::TryFrom;
|
||||
|
||||
use parity_scale_codec::{Decode, Encode};
|
||||
use polkadot_node_primitives::{AvailableData, Proof};
|
||||
use polkadot_primitives::v0::{self, BlakeTwo256, Hash as H256, HashT};
|
||||
use polkadot_primitives::v2::{BlakeTwo256, Hash as H256, HashT};
|
||||
use sp_core::Blake2Hasher;
|
||||
use thiserror::Error;
|
||||
use trie::{
|
||||
@@ -115,16 +115,6 @@ fn code_params(n_validators: usize) -> Result<CodeParams, Error> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Obtain erasure-coded chunks for v0 `AvailableData`, one for each validator.
|
||||
///
|
||||
/// Works only up to 65536 validators, and `n_validators` must be non-zero.
|
||||
pub fn obtain_chunks_v0(
|
||||
n_validators: usize,
|
||||
data: &v0::AvailableData,
|
||||
) -> Result<Vec<Vec<u8>>, Error> {
|
||||
obtain_chunks(n_validators, data)
|
||||
}
|
||||
|
||||
/// Obtain erasure-coded chunks for v1 `AvailableData`, one for each validator.
|
||||
///
|
||||
/// Works only up to 65536 validators, and `n_validators` must be non-zero.
|
||||
@@ -151,20 +141,6 @@ pub fn obtain_chunks<T: Encode>(n_validators: usize, data: &T) -> Result<Vec<Vec
|
||||
Ok(shards.into_iter().map(|w: WrappedShard| w.into_inner()).collect())
|
||||
}
|
||||
|
||||
/// Reconstruct the v0 available data from a set of chunks.
|
||||
///
|
||||
/// Provide an iterator containing chunk data and the corresponding index.
|
||||
/// The indices of the present chunks must be indicated. If too few chunks
|
||||
/// are provided, recovery is not possible.
|
||||
///
|
||||
/// Works only up to 65536 validators, and `n_validators` must be non-zero.
|
||||
pub fn reconstruct_v0<'a, I: 'a>(n_validators: usize, chunks: I) -> Result<v0::AvailableData, Error>
|
||||
where
|
||||
I: IntoIterator<Item = (&'a [u8], usize)>,
|
||||
{
|
||||
reconstruct(n_validators, chunks)
|
||||
}
|
||||
|
||||
/// Reconstruct the v1 available data from a set of chunks.
|
||||
///
|
||||
/// Provide an iterator containing chunk data and the corresponding index.
|
||||
@@ -370,7 +346,7 @@ impl<'a, I: Iterator<Item = &'a [u8]>> parity_scale_codec::Input for ShardInput<
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use polkadot_primitives::v0::{AvailableData, BlockData, OmittedValidationData, PoVBlock};
|
||||
use polkadot_node_primitives::{AvailableData, BlockData, PoV};
|
||||
|
||||
// In order to adequately compute the number of entries in the Merkle
|
||||
// trie, we must account for the fixed 16-ary trie structure.
|
||||
@@ -383,10 +359,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn round_trip_works() {
|
||||
let pov_block = PoVBlock { block_data: BlockData((0..255).collect()) };
|
||||
let pov = PoV { block_data: BlockData((0..255).collect()) };
|
||||
|
||||
let available_data =
|
||||
AvailableData { pov_block, omitted_validation: OmittedValidationData::default() };
|
||||
let available_data = AvailableData { pov: pov.into(), validation_data: Default::default() };
|
||||
let chunks = obtain_chunks(10, &available_data).unwrap();
|
||||
|
||||
assert_eq!(chunks.len(), 10);
|
||||
@@ -411,11 +386,9 @@ mod tests {
|
||||
|
||||
fn generate_trie_and_generate_proofs(magnitude: u32) {
|
||||
let n_validators = 2_u32.pow(magnitude) as usize;
|
||||
let pov_block =
|
||||
PoVBlock { block_data: BlockData(vec![2; n_validators / KEY_INDEX_NIBBLE_SIZE]) };
|
||||
let pov = PoV { block_data: BlockData(vec![2; n_validators / KEY_INDEX_NIBBLE_SIZE]) };
|
||||
|
||||
let available_data =
|
||||
AvailableData { pov_block, omitted_validation: OmittedValidationData::default() };
|
||||
let available_data = AvailableData { pov: pov.into(), validation_data: Default::default() };
|
||||
|
||||
let chunks = obtain_chunks(magnitude as usize, &available_data).unwrap();
|
||||
|
||||
|
||||
@@ -19,9 +19,8 @@
|
||||
//! Provides the [`AbstractClient`] trait that is a super trait that combines all the traits the client implements.
|
||||
//! There is also the [`Client`] enum that combines all the different clients into one common structure.
|
||||
|
||||
use polkadot_primitives::{
|
||||
v1::{AccountId, Balance, Block, BlockNumber, Hash, Header, Nonce},
|
||||
v2::ParachainHost,
|
||||
use polkadot_primitives::v2::{
|
||||
AccountId, Balance, Block, BlockNumber, Hash, Header, Nonce, ParachainHost,
|
||||
};
|
||||
use sc_client_api::{AuxStore, Backend as BackendT, BlockchainEvents, KeyIterator, UsageProvider};
|
||||
use sc_executor::NativeElseWasmExecutor;
|
||||
|
||||
@@ -31,7 +31,7 @@ use polkadot_node_subsystem_util::{
|
||||
request_availability_cores, request_persisted_validation_data, request_validation_code,
|
||||
request_validation_code_hash, request_validators,
|
||||
};
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
collator_signature_payload, CandidateCommitments, CandidateDescriptor, CandidateReceipt,
|
||||
CoreState, Hash, Id as ParaId, OccupiedCoreAssumption, PersistedValidationData,
|
||||
ValidationCodeHash,
|
||||
|
||||
@@ -32,7 +32,7 @@ mod handle_new_activations {
|
||||
use polkadot_node_subsystem_test_helpers::{
|
||||
subsystem_test_harness, TestSubsystemContextHandle,
|
||||
};
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
CollatorPair, Id as ParaId, PersistedValidationData, ScheduledCore, ValidationCode,
|
||||
};
|
||||
use std::pin::Pin;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use bitvec::{order::Lsb0 as BitOrderLsb0, slice::BitSlice};
|
||||
use polkadot_node_primitives::approval::DelayTranche;
|
||||
use polkadot_primitives::v1::ValidatorIndex;
|
||||
use polkadot_primitives::v2::ValidatorIndex;
|
||||
|
||||
use crate::{
|
||||
persisted_entries::{ApprovalEntry, CandidateEntry, TrancheEntry},
|
||||
@@ -460,7 +460,7 @@ mod tests {
|
||||
use crate::{approval_db, BTreeMap};
|
||||
use ::test_helpers::{dummy_candidate_receipt, dummy_hash};
|
||||
use bitvec::{bitvec, order::Lsb0 as BitOrderLsb0, vec::BitVec};
|
||||
use polkadot_primitives::v1::GroupIndex;
|
||||
use polkadot_primitives::v2::GroupIndex;
|
||||
|
||||
#[test]
|
||||
fn pending_is_not_approved() {
|
||||
|
||||
@@ -20,7 +20,7 @@ use parity_scale_codec::{Decode, Encode};
|
||||
use polkadot_node_primitives::approval::{AssignmentCert, DelayTranche};
|
||||
use polkadot_node_subsystem::{SubsystemError, SubsystemResult};
|
||||
use polkadot_node_subsystem_util::database::{DBTransaction, Database};
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
BlockNumber, CandidateHash, CandidateReceipt, CoreIndex, GroupIndex, Hash, SessionIndex,
|
||||
ValidatorIndex, ValidatorSignature,
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ use crate::{
|
||||
ops::{add_block_entry, canonicalize, force_approve, NewCandidateInfo},
|
||||
};
|
||||
use polkadot_node_subsystem_util::database::Database;
|
||||
use polkadot_primitives::v1::Id as ParaId;
|
||||
use polkadot_primitives::v2::Id as ParaId;
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
use ::test_helpers::{dummy_candidate_receipt, dummy_candidate_receipt_bad_sig, dummy_hash};
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//! before any commit to the underlying storage is made.
|
||||
|
||||
use polkadot_node_subsystem::SubsystemResult;
|
||||
use polkadot_primitives::v1::{BlockNumber, CandidateHash, Hash};
|
||||
use polkadot_primitives::v2::{BlockNumber, CandidateHash, Hash};
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
||||
@@ -20,9 +20,8 @@ use parity_scale_codec::{Decode, Encode};
|
||||
use polkadot_node_primitives::approval::{
|
||||
self as approval_types, AssignmentCert, AssignmentCertKind, DelayTranche, RelayVRFStory,
|
||||
};
|
||||
use polkadot_primitives::{
|
||||
v1::{AssignmentId, AssignmentPair, CandidateHash, CoreIndex, GroupIndex, ValidatorIndex},
|
||||
v2::SessionInfo,
|
||||
use polkadot_primitives::v2::{
|
||||
AssignmentId, AssignmentPair, CandidateHash, CoreIndex, GroupIndex, SessionInfo, ValidatorIndex,
|
||||
};
|
||||
use sc_keystore::LocalKeystore;
|
||||
use sp_application_crypto::ByteArray;
|
||||
@@ -537,7 +536,7 @@ fn is_in_backing_group(
|
||||
mod tests {
|
||||
use super::*;
|
||||
use polkadot_node_primitives::approval::{VRFOutput, VRFProof};
|
||||
use polkadot_primitives::v1::{Hash, ASSIGNMENT_KEY_TYPE_ID};
|
||||
use polkadot_primitives::v2::{Hash, ASSIGNMENT_KEY_TYPE_ID};
|
||||
use sp_application_crypto::sr25519;
|
||||
use sp_core::crypto::Pair as PairT;
|
||||
use sp_keyring::sr25519::Keyring as Sr25519Keyring;
|
||||
|
||||
@@ -43,7 +43,7 @@ use polkadot_node_subsystem_util::{
|
||||
determine_new_blocks,
|
||||
rolling_session_window::{RollingSessionWindow, SessionWindowUpdate},
|
||||
};
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
BlockNumber, CandidateEvent, CandidateHash, CandidateReceipt, ConsensusLog, CoreIndex,
|
||||
GroupIndex, Hash, Header, SessionIndex,
|
||||
};
|
||||
@@ -584,7 +584,7 @@ pub(crate) mod tests {
|
||||
use polkadot_node_subsystem::messages::AllMessages;
|
||||
use polkadot_node_subsystem_test_helpers::make_subsystem_context;
|
||||
use polkadot_node_subsystem_util::database::Database;
|
||||
use polkadot_primitives::{v1::ValidatorIndex, v2::SessionInfo};
|
||||
use polkadot_primitives::v2::{SessionInfo, ValidatorIndex};
|
||||
pub(crate) use sp_consensus_babe::{
|
||||
digests::{CompatibleDigestItem, PreDigest, SecondaryVRFPreDigest},
|
||||
AllowedSlots, BabeEpochConfiguration, Epoch as BabeEpoch,
|
||||
@@ -646,21 +646,21 @@ pub(crate) mod tests {
|
||||
_config: &criteria::Config,
|
||||
_leaving_cores: Vec<(
|
||||
CandidateHash,
|
||||
polkadot_primitives::v1::CoreIndex,
|
||||
polkadot_primitives::v1::GroupIndex,
|
||||
polkadot_primitives::v2::CoreIndex,
|
||||
polkadot_primitives::v2::GroupIndex,
|
||||
)>,
|
||||
) -> HashMap<polkadot_primitives::v1::CoreIndex, criteria::OurAssignment> {
|
||||
) -> HashMap<polkadot_primitives::v2::CoreIndex, criteria::OurAssignment> {
|
||||
HashMap::new()
|
||||
}
|
||||
|
||||
fn check_assignment_cert(
|
||||
&self,
|
||||
_claimed_core_index: polkadot_primitives::v1::CoreIndex,
|
||||
_validator_index: polkadot_primitives::v1::ValidatorIndex,
|
||||
_claimed_core_index: polkadot_primitives::v2::CoreIndex,
|
||||
_validator_index: polkadot_primitives::v2::ValidatorIndex,
|
||||
_config: &criteria::Config,
|
||||
_relay_vrf_story: polkadot_node_primitives::approval::RelayVRFStory,
|
||||
_assignment: &polkadot_node_primitives::approval::AssignmentCert,
|
||||
_backing_group: polkadot_primitives::v1::GroupIndex,
|
||||
_backing_group: polkadot_primitives::v2::GroupIndex,
|
||||
) -> Result<polkadot_node_primitives::approval::DelayTranche, criteria::InvalidAssignment> {
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
@@ -50,13 +50,10 @@ use polkadot_node_subsystem_util::{
|
||||
},
|
||||
TimeoutExt,
|
||||
};
|
||||
use polkadot_primitives::{
|
||||
v1::{
|
||||
ApprovalVote, BlockNumber, CandidateHash, CandidateIndex, CandidateReceipt,
|
||||
DisputeStatement, GroupIndex, Hash, SessionIndex, ValidDisputeStatementKind, ValidatorId,
|
||||
ValidatorIndex, ValidatorPair, ValidatorSignature,
|
||||
},
|
||||
v2::SessionInfo,
|
||||
use polkadot_primitives::v2::{
|
||||
ApprovalVote, BlockNumber, CandidateHash, CandidateIndex, CandidateReceipt, DisputeStatement,
|
||||
GroupIndex, Hash, SessionIndex, SessionInfo, ValidDisputeStatementKind, ValidatorId,
|
||||
ValidatorIndex, ValidatorPair, ValidatorSignature,
|
||||
};
|
||||
use sc_keystore::LocalKeystore;
|
||||
use sp_application_crypto::Pair;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
use polkadot_node_subsystem::SubsystemResult;
|
||||
|
||||
use bitvec::order::Lsb0 as BitOrderLsb0;
|
||||
use polkadot_primitives::v1::{BlockNumber, CandidateHash, CandidateReceipt, GroupIndex, Hash};
|
||||
use polkadot_primitives::v2::{BlockNumber, CandidateHash, CandidateReceipt, GroupIndex, Hash};
|
||||
|
||||
use std::{
|
||||
collections::{hash_map::Entry, BTreeMap, HashMap},
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
//! data and logic are intertwined.
|
||||
|
||||
use polkadot_node_primitives::approval::{AssignmentCert, DelayTranche, RelayVRFStory};
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
BlockNumber, CandidateHash, CandidateReceipt, CoreIndex, GroupIndex, Hash, SessionIndex,
|
||||
ValidatorIndex, ValidatorSignature,
|
||||
};
|
||||
|
||||
@@ -31,7 +31,7 @@ use polkadot_node_subsystem::{
|
||||
use polkadot_node_subsystem_test_helpers as test_helpers;
|
||||
use polkadot_node_subsystem_util::TimeoutExt;
|
||||
use polkadot_overseer::HeadSupportsParachains;
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
CandidateCommitments, CandidateEvent, CoreIndex, GroupIndex, Header, Id as ParaId,
|
||||
ValidationCode, ValidatorSignature,
|
||||
};
|
||||
@@ -220,7 +220,7 @@ struct MockAssignmentCriteria<Compute, Check>(Compute, Check);
|
||||
|
||||
impl<Compute, Check> AssignmentCriteria for MockAssignmentCriteria<Compute, Check>
|
||||
where
|
||||
Compute: Fn() -> HashMap<polkadot_primitives::v1::CoreIndex, criteria::OurAssignment>,
|
||||
Compute: Fn() -> HashMap<polkadot_primitives::v2::CoreIndex, criteria::OurAssignment>,
|
||||
Check: Fn(ValidatorIndex) -> Result<DelayTranche, criteria::InvalidAssignment>,
|
||||
{
|
||||
fn compute_assignments(
|
||||
@@ -230,21 +230,21 @@ where
|
||||
_config: &criteria::Config,
|
||||
_leaving_cores: Vec<(
|
||||
CandidateHash,
|
||||
polkadot_primitives::v1::CoreIndex,
|
||||
polkadot_primitives::v1::GroupIndex,
|
||||
polkadot_primitives::v2::CoreIndex,
|
||||
polkadot_primitives::v2::GroupIndex,
|
||||
)>,
|
||||
) -> HashMap<polkadot_primitives::v1::CoreIndex, criteria::OurAssignment> {
|
||||
) -> HashMap<polkadot_primitives::v2::CoreIndex, criteria::OurAssignment> {
|
||||
self.0()
|
||||
}
|
||||
|
||||
fn check_assignment_cert(
|
||||
&self,
|
||||
_claimed_core_index: polkadot_primitives::v1::CoreIndex,
|
||||
_claimed_core_index: polkadot_primitives::v2::CoreIndex,
|
||||
validator_index: ValidatorIndex,
|
||||
_config: &criteria::Config,
|
||||
_relay_vrf_story: polkadot_node_primitives::approval::RelayVRFStory,
|
||||
_assignment: &polkadot_node_primitives::approval::AssignmentCert,
|
||||
_backing_group: polkadot_primitives::v1::GroupIndex,
|
||||
_backing_group: polkadot_primitives::v2::GroupIndex,
|
||||
) -> Result<polkadot_node_primitives::approval::DelayTranche, criteria::InvalidAssignment> {
|
||||
self.1(validator_index)
|
||||
}
|
||||
@@ -252,7 +252,7 @@ where
|
||||
|
||||
impl<F>
|
||||
MockAssignmentCriteria<
|
||||
fn() -> HashMap<polkadot_primitives::v1::CoreIndex, criteria::OurAssignment>,
|
||||
fn() -> HashMap<polkadot_primitives::v2::CoreIndex, criteria::OurAssignment>,
|
||||
F,
|
||||
>
|
||||
{
|
||||
@@ -470,7 +470,7 @@ fn test_harness<T: Future<Output = VirtualOverseer>>(
|
||||
|
||||
let keystore = LocalKeystore::in_memory();
|
||||
let _ = keystore.sr25519_generate_new(
|
||||
polkadot_primitives::v1::PARACHAIN_KEY_TYPE_ID,
|
||||
polkadot_primitives::v2::PARACHAIN_KEY_TYPE_ID,
|
||||
Some(&Sr25519Keyring::Alice.to_seed()),
|
||||
);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ use polkadot_node_subsystem_util::database::{DBTransaction, Database};
|
||||
use bitvec::{order::Lsb0 as BitOrderLsb0, vec::BitVec};
|
||||
use polkadot_node_primitives::{AvailableData, ErasureChunk};
|
||||
use polkadot_node_subsystem_util as util;
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
BlockNumber, CandidateEvent, CandidateHash, CandidateReceipt, Hash, Header, ValidatorIndex,
|
||||
};
|
||||
use polkadot_subsystem::{
|
||||
|
||||
@@ -26,7 +26,7 @@ use parking_lot::Mutex;
|
||||
use polkadot_node_primitives::{AvailableData, BlockData, PoV, Proof};
|
||||
use polkadot_node_subsystem_test_helpers as test_helpers;
|
||||
use polkadot_node_subsystem_util::{database::Database, TimeoutExt};
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
CandidateHash, CandidateReceipt, CoreIndex, GroupIndex, HeadData, Header,
|
||||
PersistedValidationData, ValidatorId,
|
||||
};
|
||||
|
||||
@@ -40,7 +40,7 @@ use polkadot_node_subsystem_util::{
|
||||
request_from_runtime, request_session_index_for_child, request_validator_groups,
|
||||
request_validators, FromJobCommand, JobSender, Validator,
|
||||
};
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
BackedCandidate, CandidateCommitments, CandidateDescriptor, CandidateHash, CandidateReceipt,
|
||||
CollatorId, CommittedCandidateReceipt, CoreIndex, CoreState, Hash, Id as ParaId, SessionIndex,
|
||||
SigningContext, ValidatorId, ValidatorIndex, ValidatorSignature, ValidityAttestation,
|
||||
@@ -58,7 +58,7 @@ use polkadot_subsystem::{
|
||||
use sp_keystore::SyncCryptoStorePtr;
|
||||
use statement_table::{
|
||||
generic::AttestedCandidate as TableAttestedCandidate,
|
||||
v1::{
|
||||
v2::{
|
||||
SignedStatement as TableSignedStatement, Statement as TableStatement,
|
||||
Summary as TableSummary,
|
||||
},
|
||||
@@ -326,7 +326,7 @@ async fn make_pov_available(
|
||||
n_validators: usize,
|
||||
pov: Arc<PoV>,
|
||||
candidate_hash: CandidateHash,
|
||||
validation_data: polkadot_primitives::v1::PersistedValidationData,
|
||||
validation_data: polkadot_primitives::v2::PersistedValidationData,
|
||||
expected_erasure_root: Hash,
|
||||
span: Option<&jaeger::Span>,
|
||||
) -> Result<Result<(), InvalidErasureRoot>, Error> {
|
||||
|
||||
@@ -23,7 +23,7 @@ use assert_matches::assert_matches;
|
||||
use futures::{future, Future};
|
||||
use polkadot_node_primitives::{BlockData, InvalidCandidate};
|
||||
use polkadot_node_subsystem_test_helpers as test_helpers;
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
CollatorId, GroupRotationInfo, HeadData, PersistedValidationData, ScheduledCore,
|
||||
};
|
||||
use polkadot_subsystem::{
|
||||
@@ -34,7 +34,7 @@ use sp_application_crypto::AppKey;
|
||||
use sp_keyring::Sr25519Keyring;
|
||||
use sp_keystore::{CryptoStore, SyncCryptoStore};
|
||||
use sp_tracing as _;
|
||||
use statement_table::v1::Misbehavior;
|
||||
use statement_table::v2::Misbehavior;
|
||||
use std::collections::HashMap;
|
||||
|
||||
fn validator_pubkeys(val_ids: &[Sr25519Keyring]) -> Vec<ValidatorId> {
|
||||
|
||||
@@ -41,7 +41,7 @@ use polkadot_node_subsystem_util::{
|
||||
metrics::{self, prometheus},
|
||||
JobSender, JobSubsystem, JobTrait, Validator,
|
||||
};
|
||||
use polkadot_primitives::v1::{AvailabilityBitfield, CoreState, Hash, ValidatorIndex};
|
||||
use polkadot_primitives::v2::{AvailabilityBitfield, CoreState, Hash, ValidatorIndex};
|
||||
use sp_keystore::{Error as KeystoreError, SyncCryptoStorePtr};
|
||||
use std::{iter::FromIterator, pin::Pin, time::Duration};
|
||||
use wasm_timer::{Delay, Instant};
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use super::*;
|
||||
use futures::{executor::block_on, pin_mut};
|
||||
use polkadot_node_subsystem::messages::AllMessages;
|
||||
use polkadot_primitives::v1::{CandidateHash, OccupiedCore};
|
||||
use polkadot_primitives::v2::{CandidateHash, OccupiedCore};
|
||||
use test_helpers::dummy_candidate_descriptor;
|
||||
|
||||
fn occupied_core(para_id: u32, candidate_hash: CandidateHash) -> CoreState {
|
||||
|
||||
@@ -40,7 +40,7 @@ use polkadot_node_subsystem::{
|
||||
};
|
||||
use polkadot_node_subsystem_util::metrics::{self, prometheus};
|
||||
use polkadot_parachain::primitives::{ValidationParams, ValidationResult as WasmValidationResult};
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
CandidateCommitments, CandidateDescriptor, Hash, OccupiedCoreAssumption,
|
||||
PersistedValidationData, ValidationCode, ValidationCodeHash,
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ use polkadot_node_core_pvf::PrepareError;
|
||||
use polkadot_node_subsystem::messages::AllMessages;
|
||||
use polkadot_node_subsystem_test_helpers as test_helpers;
|
||||
use polkadot_node_subsystem_util::reexports::SubsystemContext;
|
||||
use polkadot_primitives::v1::{HeadData, UpwardMessage};
|
||||
use polkadot_primitives::v2::{HeadData, UpwardMessage};
|
||||
use sp_core::testing::TaskExecutor;
|
||||
use sp_keyring::Sr25519Keyring;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ use sc_client_api::AuxStore;
|
||||
use sp_blockchain::HeaderBackend;
|
||||
|
||||
use polkadot_node_subsystem_util::metrics::{self, prometheus};
|
||||
use polkadot_primitives::v1::{Block, BlockId};
|
||||
use polkadot_primitives::v2::{Block, BlockId};
|
||||
use polkadot_subsystem::{
|
||||
messages::ChainApiMessage, overseer, FromOverseer, OverseerSignal, SpawnedSubsystem,
|
||||
SubsystemContext, SubsystemError, SubsystemResult,
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::collections::BTreeMap;
|
||||
|
||||
use polkadot_node_primitives::BlockWeight;
|
||||
use polkadot_node_subsystem_test_helpers::{make_subsystem_context, TestSubsystemContextHandle};
|
||||
use polkadot_primitives::v1::{BlockId, BlockNumber, Hash, Header};
|
||||
use polkadot_primitives::v2::{BlockId, BlockNumber, Hash, Header};
|
||||
use sp_blockchain::Info as BlockInfo;
|
||||
use sp_core::testing::TaskExecutor;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
//! [`Backend`], maintaining consistency between queries and temporary writes,
|
||||
//! before any commit to the underlying storage is made.
|
||||
|
||||
use polkadot_primitives::v1::{BlockNumber, Hash};
|
||||
use polkadot_primitives::v2::{BlockNumber, Hash};
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ use crate::{
|
||||
};
|
||||
|
||||
use polkadot_node_primitives::BlockWeight;
|
||||
use polkadot_primitives::v1::{BlockNumber, Hash};
|
||||
use polkadot_primitives::v2::{BlockNumber, Hash};
|
||||
|
||||
use parity_scale_codec::{Decode, Encode};
|
||||
use polkadot_node_subsystem_util::database::{DBTransaction, Database};
|
||||
|
||||
@@ -23,7 +23,7 @@ use polkadot_node_subsystem::{
|
||||
overseer, FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemContext, SubsystemError,
|
||||
};
|
||||
use polkadot_node_subsystem_util::database::Database;
|
||||
use polkadot_primitives::v1::{BlockNumber, ConsensusLog, Hash, Header};
|
||||
use polkadot_primitives::v2::{BlockNumber, ConsensusLog, Hash, Header};
|
||||
|
||||
use futures::{channel::oneshot, future::Either, prelude::*};
|
||||
use parity_scale_codec::Error as CodecError;
|
||||
|
||||
@@ -39,7 +39,7 @@ use polkadot_node_subsystem::{
|
||||
jaeger, messages::AllMessages, ActivatedLeaf, ActiveLeavesUpdate, LeafStatus,
|
||||
};
|
||||
use polkadot_node_subsystem_test_helpers as test_helpers;
|
||||
use polkadot_primitives::v1::{BlakeTwo256, ConsensusLog, HashT};
|
||||
use polkadot_primitives::v2::{BlakeTwo256, ConsensusLog, HashT};
|
||||
|
||||
#[derive(Default)]
|
||||
struct TestBackendInner {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
//! and as the finalized block advances, orphaned sub-trees are entirely pruned.
|
||||
|
||||
use polkadot_node_primitives::BlockWeight;
|
||||
use polkadot_primitives::v1::{BlockNumber, Hash};
|
||||
use polkadot_primitives::v2::{BlockNumber, Hash};
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ use polkadot_node_subsystem::{
|
||||
messages::DisputeCoordinatorMessage, overseer, FromOverseer, OverseerSignal, SpawnedSubsystem,
|
||||
SubsystemContext, SubsystemError,
|
||||
};
|
||||
use polkadot_primitives::v1::BlockNumber;
|
||||
use polkadot_primitives::v2::BlockNumber;
|
||||
|
||||
use futures::prelude::*;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//! before any commit to the underlying storage is made.
|
||||
|
||||
use polkadot_node_subsystem::SubsystemResult;
|
||||
use polkadot_primitives::v1::{CandidateHash, SessionIndex};
|
||||
use polkadot_primitives::v2::{CandidateHash, SessionIndex};
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use polkadot_node_subsystem::{SubsystemError, SubsystemResult};
|
||||
use polkadot_node_subsystem_util::database::{DBTransaction, Database};
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
CandidateHash, CandidateReceipt, Hash, InvalidDisputeStatementKind, SessionIndex,
|
||||
ValidDisputeStatementKind, ValidatorIndex, ValidatorSignature,
|
||||
};
|
||||
@@ -264,7 +264,7 @@ pub(crate) fn note_current_session(
|
||||
mod tests {
|
||||
use super::*;
|
||||
use ::test_helpers::{dummy_candidate_receipt, dummy_hash};
|
||||
use polkadot_primitives::v1::{Hash, Id as ParaId};
|
||||
use polkadot_primitives::v2::{Hash, Id as ParaId};
|
||||
|
||||
fn make_db() -> DbBackend {
|
||||
let db = kvdb_memorydb::create(1);
|
||||
|
||||
@@ -43,13 +43,10 @@ use polkadot_node_subsystem::{
|
||||
use polkadot_node_subsystem_util::rolling_session_window::{
|
||||
RollingSessionWindow, SessionWindowUpdate, SessionsUnavailable,
|
||||
};
|
||||
use polkadot_primitives::{
|
||||
v1::{
|
||||
byzantine_threshold, BlockNumber, CandidateHash, CandidateReceipt, CompactStatement,
|
||||
DisputeStatement, DisputeStatementSet, Hash, ScrapedOnChainVotes, SessionIndex,
|
||||
ValidDisputeStatementKind, ValidatorId, ValidatorIndex, ValidatorPair, ValidatorSignature,
|
||||
},
|
||||
v2::SessionInfo,
|
||||
use polkadot_primitives::v2::{
|
||||
byzantine_threshold, BlockNumber, CandidateHash, CandidateReceipt, CompactStatement,
|
||||
DisputeStatement, DisputeStatementSet, Hash, ScrapedOnChainVotes, SessionIndex, SessionInfo,
|
||||
ValidDisputeStatementKind, ValidatorId, ValidatorIndex, ValidatorPair, ValidatorSignature,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@@ -771,7 +768,7 @@ impl Initialized {
|
||||
let n_validators = validators.len();
|
||||
|
||||
let supermajority_threshold =
|
||||
polkadot_primitives::v1::supermajority_threshold(n_validators);
|
||||
polkadot_primitives::v2::supermajority_threshold(n_validators);
|
||||
|
||||
// In case we are not provided with a candidate receipt
|
||||
// we operate under the assumption, that a previous vote
|
||||
|
||||
@@ -38,7 +38,7 @@ use polkadot_node_subsystem::{
|
||||
use polkadot_node_subsystem_util::{
|
||||
database::Database, rolling_session_window::RollingSessionWindow,
|
||||
};
|
||||
use polkadot_primitives::v1::{ValidatorIndex, ValidatorPair};
|
||||
use polkadot_primitives::v2::{ValidatorIndex, ValidatorPair};
|
||||
|
||||
use crate::{
|
||||
error::{FatalResult, JfyiError, Result},
|
||||
|
||||
@@ -26,7 +26,7 @@ use polkadot_node_subsystem::{
|
||||
messages::ChainApiMessage, ActivatedLeaf, ActiveLeavesUpdate, ChainApiError, SubsystemSender,
|
||||
};
|
||||
use polkadot_node_subsystem_util::runtime::get_candidate_events;
|
||||
use polkadot_primitives::v1::{BlockNumber, CandidateEvent, CandidateHash, CandidateReceipt, Hash};
|
||||
use polkadot_primitives::v2::{BlockNumber, CandidateEvent, CandidateHash, CandidateReceipt, Hash};
|
||||
|
||||
use crate::{
|
||||
error::{FatalError, FatalResult, Result},
|
||||
|
||||
@@ -35,7 +35,7 @@ use polkadot_node_subsystem_test_helpers::{
|
||||
make_subsystem_context, TestSubsystemContext, TestSubsystemContextHandle, TestSubsystemSender,
|
||||
};
|
||||
use polkadot_node_subsystem_util::{reexports::SubsystemContext, TimeoutExt};
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
BlakeTwo256, BlockNumber, CandidateDescriptor, CandidateEvent, CandidateReceipt, CoreIndex,
|
||||
GroupIndex, Hash, HashT, HeadData,
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ use polkadot_node_subsystem::{
|
||||
ActiveLeavesUpdate, RecoveryError, SubsystemContext, SubsystemSender,
|
||||
};
|
||||
use polkadot_node_subsystem_util::runtime::get_validation_code_by_hash;
|
||||
use polkadot_primitives::v1::{BlockNumber, CandidateHash, CandidateReceipt, Hash, SessionIndex};
|
||||
use polkadot_primitives::v2::{BlockNumber, CandidateHash, CandidateReceipt, Hash, SessionIndex};
|
||||
|
||||
use crate::real::LOG_TARGET;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
|
||||
use polkadot_primitives::v1::{CandidateHash, CandidateReceipt, SessionIndex};
|
||||
use polkadot_primitives::v2::{CandidateHash, CandidateReceipt, SessionIndex};
|
||||
|
||||
use crate::real::ordering::CandidateComparator;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
use ::test_helpers::{dummy_candidate_receipt, dummy_hash};
|
||||
use assert_matches::assert_matches;
|
||||
use polkadot_primitives::v1::{BlockNumber, Hash};
|
||||
use polkadot_primitives::v2::{BlockNumber, Hash};
|
||||
|
||||
use crate::real::ordering::CandidateComparator;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ use polkadot_node_subsystem::{
|
||||
use polkadot_node_subsystem_test_helpers::{
|
||||
make_subsystem_context, TestSubsystemContext, TestSubsystemContextHandle,
|
||||
};
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
BlakeTwo256, CandidateCommitments, HashT, Header, PersistedValidationData, ValidationCode,
|
||||
};
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
use polkadot_primitives::v1::{CandidateHash, SessionIndex, ValidatorIndex};
|
||||
use polkadot_primitives::v2::{CandidateHash, SessionIndex, ValidatorIndex};
|
||||
|
||||
use crate::real::LOG_TARGET;
|
||||
|
||||
|
||||
@@ -54,13 +54,10 @@ use polkadot_node_subsystem::{
|
||||
ActivatedLeaf, ActiveLeavesUpdate, LeafStatus,
|
||||
};
|
||||
use polkadot_node_subsystem_test_helpers::{make_subsystem_context, TestSubsystemContextHandle};
|
||||
use polkadot_primitives::{
|
||||
v1::{
|
||||
BlakeTwo256, BlockNumber, CandidateCommitments, CandidateHash, CandidateReceipt, Hash,
|
||||
HashT, Header, MultiDisputeStatementSet, ScrapedOnChainVotes, SessionIndex, SigningContext,
|
||||
ValidatorId, ValidatorIndex,
|
||||
},
|
||||
v2::SessionInfo,
|
||||
use polkadot_primitives::v2::{
|
||||
BlakeTwo256, BlockNumber, CandidateCommitments, CandidateHash, CandidateReceipt, Hash, HashT,
|
||||
Header, MultiDisputeStatementSet, ScrapedOnChainVotes, SessionIndex, SessionInfo,
|
||||
SigningContext, ValidatorId, ValidatorIndex,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@@ -83,7 +80,7 @@ fn make_keystore(seeds: impl Iterator<Item = String>) -> LocalKeystore {
|
||||
|
||||
for s in seeds {
|
||||
store
|
||||
.sr25519_generate_new(polkadot_primitives::v1::PARACHAIN_KEY_TYPE_ID, Some(&s))
|
||||
.sr25519_generate_new(polkadot_primitives::v2::PARACHAIN_KEY_TYPE_ID, Some(&s))
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
@@ -1299,7 +1296,7 @@ fn supermajority_valid_dispute_may_be_finalized() {
|
||||
test_state.activate_leaf_at_session(&mut virtual_overseer, session, 1).await;
|
||||
|
||||
let supermajority_threshold =
|
||||
polkadot_primitives::v1::supermajority_threshold(test_state.validators.len());
|
||||
polkadot_primitives::v2::supermajority_threshold(test_state.validators.len());
|
||||
|
||||
let valid_vote = test_state
|
||||
.issue_explicit_statement_with_index(2, candidate_hash, session, true)
|
||||
@@ -1419,7 +1416,7 @@ fn concluded_supermajority_for_non_active_after_time() {
|
||||
test_state.activate_leaf_at_session(&mut virtual_overseer, session, 1).await;
|
||||
|
||||
let supermajority_threshold =
|
||||
polkadot_primitives::v1::supermajority_threshold(test_state.validators.len());
|
||||
polkadot_primitives::v2::supermajority_threshold(test_state.validators.len());
|
||||
|
||||
let valid_vote = test_state
|
||||
.issue_explicit_statement_with_index(2, candidate_hash, session, true)
|
||||
@@ -1517,7 +1514,7 @@ fn concluded_supermajority_against_non_active_after_time() {
|
||||
test_state.activate_leaf_at_session(&mut virtual_overseer, session, 1).await;
|
||||
|
||||
let supermajority_threshold =
|
||||
polkadot_primitives::v1::supermajority_threshold(test_state.validators.len());
|
||||
polkadot_primitives::v2::supermajority_threshold(test_state.validators.len());
|
||||
|
||||
let valid_vote = test_state
|
||||
.issue_explicit_statement_with_index(2, candidate_hash, session, true)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
use parity_scale_codec::{Decode, Encode};
|
||||
use polkadot_primitives::v1::{CandidateHash, SessionIndex};
|
||||
use polkadot_primitives::v2::{CandidateHash, SessionIndex};
|
||||
|
||||
use crate::LOG_TARGET;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ use futures::{select, FutureExt};
|
||||
use polkadot_node_subsystem::{
|
||||
errors::SubsystemError, messages::ProvisionerMessage, overseer::Handle,
|
||||
};
|
||||
use polkadot_primitives::v1::{Block, Hash, InherentData as ParachainsInherentData};
|
||||
use polkadot_primitives::v2::{Block, Hash, InherentData as ParachainsInherentData};
|
||||
use sp_blockchain::HeaderBackend;
|
||||
use sp_runtime::generic::BlockId;
|
||||
use std::time;
|
||||
@@ -112,7 +112,7 @@ impl sp_inherents::InherentDataProvider for ParachainsInherentDataProvider {
|
||||
dst_inherent_data: &mut sp_inherents::InherentData,
|
||||
) -> Result<(), sp_inherents::Error> {
|
||||
dst_inherent_data
|
||||
.put_data(polkadot_primitives::v1::PARACHAINS_INHERENT_IDENTIFIER, &self.inherent_data)
|
||||
.put_data(polkadot_primitives::v2::PARACHAINS_INHERENT_IDENTIFIER, &self.inherent_data)
|
||||
}
|
||||
|
||||
async fn try_handle_error(
|
||||
|
||||
@@ -39,7 +39,7 @@ use polkadot_node_subsystem_util::{
|
||||
self as util, request_availability_cores, request_persisted_validation_data, JobSender,
|
||||
JobSubsystem, JobTrait,
|
||||
};
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
BackedCandidate, BlockNumber, CandidateHash, CandidateReceipt, CoreState, DisputeStatement,
|
||||
DisputeStatementSet, Hash, MultiDisputeStatementSet, OccupiedCoreAssumption, SessionIndex,
|
||||
SignedAvailabilityBitfield, ValidatorIndex,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::*;
|
||||
use ::test_helpers::{dummy_candidate_descriptor, dummy_hash};
|
||||
use bitvec::bitvec;
|
||||
use polkadot_primitives::v1::{OccupiedCore, ScheduledCore};
|
||||
use polkadot_primitives::v2::{OccupiedCore, ScheduledCore};
|
||||
|
||||
pub fn occupied_core(para_id: u32) -> CoreState {
|
||||
CoreState::Occupied(OccupiedCore {
|
||||
@@ -41,7 +41,7 @@ pub fn scheduled_core(id: u32) -> ScheduledCore {
|
||||
mod select_availability_bitfields {
|
||||
use super::{super::*, default_bitvec, occupied_core};
|
||||
use futures::executor::block_on;
|
||||
use polkadot_primitives::v1::{ScheduledCore, SigningContext, ValidatorId, ValidatorIndex};
|
||||
use polkadot_primitives::v2::{ScheduledCore, SigningContext, ValidatorId, ValidatorIndex};
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_keystore::{testing::KeyStore, CryptoStore, SyncCryptoStorePtr};
|
||||
use std::sync::Arc;
|
||||
@@ -201,7 +201,7 @@ mod select_candidates {
|
||||
},
|
||||
};
|
||||
use polkadot_node_subsystem_test_helpers::TestSubsystemSender;
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
BlockNumber, CandidateCommitments, CommittedCandidateReceipt, PersistedValidationData,
|
||||
};
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use polkadot_primitives::v1::{Hash, ValidationCodeHash};
|
||||
use polkadot_primitives::v2::{Hash, ValidationCodeHash};
|
||||
use std::collections::{
|
||||
btree_map::{self, BTreeMap},
|
||||
HashSet,
|
||||
|
||||
@@ -26,9 +26,9 @@ use polkadot_node_subsystem::{
|
||||
overseer, ActiveLeavesUpdate, FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemContext,
|
||||
SubsystemError, SubsystemResult, SubsystemSender,
|
||||
};
|
||||
use polkadot_primitives::{
|
||||
v1::{BlockNumber, Hash, SessionIndex, ValidationCodeHash, ValidatorId, ValidatorIndex},
|
||||
v2::PvfCheckStatement,
|
||||
use polkadot_primitives::v2::{
|
||||
BlockNumber, Hash, PvfCheckStatement, SessionIndex, ValidationCodeHash, ValidatorId,
|
||||
ValidatorIndex,
|
||||
};
|
||||
use sp_keystore::SyncCryptoStorePtr;
|
||||
use std::collections::HashSet;
|
||||
|
||||
@@ -21,9 +21,8 @@ use polkadot_node_subsystem::{
|
||||
messages::{RuntimeApiMessage, RuntimeApiRequest},
|
||||
SubsystemSender,
|
||||
};
|
||||
use polkadot_primitives::{
|
||||
v1::{Hash, SessionIndex, ValidationCodeHash, ValidatorId, ValidatorSignature},
|
||||
v2::PvfCheckStatement,
|
||||
use polkadot_primitives::v2::{
|
||||
Hash, PvfCheckStatement, SessionIndex, ValidationCodeHash, ValidatorId, ValidatorSignature,
|
||||
};
|
||||
|
||||
pub(crate) async fn session_index_for_child(
|
||||
|
||||
@@ -25,11 +25,9 @@ use polkadot_node_subsystem::{
|
||||
ActivatedLeaf, ActiveLeavesUpdate, FromOverseer, LeafStatus, OverseerSignal, RuntimeApiError,
|
||||
};
|
||||
use polkadot_node_subsystem_test_helpers::{make_subsystem_context, TestSubsystemContextHandle};
|
||||
use polkadot_primitives::{
|
||||
v1::{
|
||||
BlockNumber, Hash, Header, SessionIndex, ValidationCode, ValidationCodeHash, ValidatorId,
|
||||
},
|
||||
v2::PvfCheckStatement,
|
||||
use polkadot_primitives::v2::{
|
||||
BlockNumber, Hash, Header, PvfCheckStatement, SessionIndex, ValidationCode, ValidationCodeHash,
|
||||
ValidatorId,
|
||||
};
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_core::testing::TaskExecutor;
|
||||
|
||||
@@ -20,15 +20,12 @@ use memory_lru::{MemoryLruCache, ResidentSize};
|
||||
use parity_util_mem::{MallocSizeOf, MallocSizeOfExt};
|
||||
use sp_consensus_babe::Epoch;
|
||||
|
||||
use polkadot_primitives::{
|
||||
v1::{
|
||||
AuthorityDiscoveryId, BlockNumber, CandidateCommitments, CandidateEvent,
|
||||
CommittedCandidateReceipt, CoreState, GroupRotationInfo, Hash, Id as ParaId,
|
||||
InboundDownwardMessage, InboundHrmpMessage, OccupiedCoreAssumption,
|
||||
PersistedValidationData, ScrapedOnChainVotes, SessionIndex, ValidationCode,
|
||||
ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature,
|
||||
},
|
||||
v2::{PvfCheckStatement, SessionInfo},
|
||||
use polkadot_primitives::v2::{
|
||||
AuthorityDiscoveryId, BlockNumber, CandidateCommitments, CandidateEvent,
|
||||
CommittedCandidateReceipt, CoreState, GroupRotationInfo, Hash, Id as ParaId,
|
||||
InboundDownwardMessage, InboundHrmpMessage, OccupiedCoreAssumption, PersistedValidationData,
|
||||
PvfCheckStatement, ScrapedOnChainVotes, SessionIndex, SessionInfo, ValidationCode,
|
||||
ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature,
|
||||
};
|
||||
|
||||
const AUTHORITIES_CACHE_SIZE: usize = 128 * 1024;
|
||||
@@ -49,6 +46,7 @@ const CURRENT_BABE_EPOCH_CACHE_SIZE: usize = 64 * 1024;
|
||||
const ON_CHAIN_VOTES_CACHE_SIZE: usize = 3 * 1024;
|
||||
const PVFS_REQUIRE_PRECHECK_SIZE: usize = 1024;
|
||||
const VALIDATION_CODE_HASH_CACHE_SIZE: usize = 64 * 1024;
|
||||
const VERSION_CACHE_SIZE: usize = 4 * 1024;
|
||||
|
||||
struct ResidentSizeOf<T>(T);
|
||||
|
||||
@@ -116,6 +114,7 @@ pub(crate) struct RequestResultCache {
|
||||
(Hash, ParaId, OccupiedCoreAssumption),
|
||||
ResidentSizeOf<Option<ValidationCodeHash>>,
|
||||
>,
|
||||
version: MemoryLruCache<Hash, ResidentSizeOf<u32>>,
|
||||
}
|
||||
|
||||
impl Default for RequestResultCache {
|
||||
@@ -142,6 +141,7 @@ impl Default for RequestResultCache {
|
||||
on_chain_votes: MemoryLruCache::new(ON_CHAIN_VOTES_CACHE_SIZE),
|
||||
pvfs_require_precheck: MemoryLruCache::new(PVFS_REQUIRE_PRECHECK_SIZE),
|
||||
validation_code_hash: MemoryLruCache::new(VALIDATION_CODE_HASH_CACHE_SIZE),
|
||||
version: MemoryLruCache::new(VERSION_CACHE_SIZE),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -399,6 +399,14 @@ impl RequestResultCache {
|
||||
) {
|
||||
self.validation_code_hash.insert(key, ResidentSizeOf(value));
|
||||
}
|
||||
|
||||
pub(crate) fn version(&mut self, relay_parent: &Hash) -> Option<&u32> {
|
||||
self.version.get(&relay_parent).map(|v| &v.0)
|
||||
}
|
||||
|
||||
pub(crate) fn cache_version(&mut self, key: Hash, value: u32) {
|
||||
self.version.insert(key, ResidentSizeOf(value));
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) enum RequestResult {
|
||||
@@ -433,4 +441,5 @@ pub(crate) enum RequestResult {
|
||||
// This is a request with side-effects and no result, hence ().
|
||||
SubmitPvfCheckStatement(Hash, PvfCheckStatement, ValidatorSignature, ()),
|
||||
ValidationCodeHash(Hash, ParaId, OccupiedCoreAssumption, Option<ValidationCodeHash>),
|
||||
Version(Hash, u32),
|
||||
}
|
||||
|
||||
@@ -23,10 +23,7 @@
|
||||
#![warn(missing_docs)]
|
||||
|
||||
use polkadot_node_subsystem_util::metrics::{self, prometheus};
|
||||
use polkadot_primitives::{
|
||||
v1::{Block, BlockId, Hash},
|
||||
v2::ParachainHost,
|
||||
};
|
||||
use polkadot_primitives::v2::{Block, BlockId, Hash, ParachainHost};
|
||||
use polkadot_subsystem::{
|
||||
errors::RuntimeApiError,
|
||||
messages::{RuntimeApiMessage, RuntimeApiRequest as Request},
|
||||
@@ -165,6 +162,8 @@ where
|
||||
ValidationCodeHash(relay_parent, para_id, assumption, hash) => self
|
||||
.requests_cache
|
||||
.cache_validation_code_hash((relay_parent, para_id, assumption), hash),
|
||||
Version(relay_parent, version) =>
|
||||
self.requests_cache.cache_version(relay_parent, version),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,6 +194,8 @@ where
|
||||
}
|
||||
|
||||
match request {
|
||||
Request::Version(sender) =>
|
||||
query!(version(), sender).map(|sender| Request::Version(sender)),
|
||||
Request::Authorities(sender) =>
|
||||
query!(authorities(), sender).map(|sender| Request::Authorities(sender)),
|
||||
Request::Validators(sender) =>
|
||||
@@ -360,6 +361,8 @@ where
|
||||
Client: ProvideRuntimeApi<Block>,
|
||||
Client::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
|
||||
{
|
||||
use sp_api::ApiExt;
|
||||
|
||||
let _timer = metrics.time_make_runtime_api_request();
|
||||
|
||||
macro_rules! query {
|
||||
@@ -367,7 +370,6 @@ where
|
||||
let sender = $sender;
|
||||
let api = client.runtime_api();
|
||||
|
||||
use sp_api::ApiExt;
|
||||
let runtime_version = api.api_version::<dyn ParachainHost<Block>>(&BlockId::Hash(relay_parent))
|
||||
.unwrap_or_else(|e| {
|
||||
tracing::warn!(
|
||||
@@ -404,6 +406,24 @@ where
|
||||
}
|
||||
|
||||
match request {
|
||||
Request::Version(sender) => {
|
||||
let api = client.runtime_api();
|
||||
|
||||
let runtime_version = match api
|
||||
.api_version::<dyn ParachainHost<Block>>(&BlockId::Hash(relay_parent))
|
||||
{
|
||||
Ok(Some(v)) => Ok(v),
|
||||
Ok(None) => Err(RuntimeApiError::NotSupported { runtime_api_name: "api_version" }),
|
||||
Err(e) => Err(RuntimeApiError::Execution {
|
||||
runtime_api_name: "api_version",
|
||||
source: std::sync::Arc::new(e),
|
||||
}),
|
||||
};
|
||||
|
||||
let _ = sender.send(runtime_version.clone());
|
||||
runtime_version.ok().map(|v| RequestResult::Version(relay_parent, v))
|
||||
},
|
||||
|
||||
Request::Authorities(sender) => query!(Authorities, authorities(), ver = 1, sender),
|
||||
Request::Validators(sender) => query!(Validators, validators(), ver = 1, sender),
|
||||
Request::ValidatorGroups(sender) =>
|
||||
@@ -448,8 +468,6 @@ where
|
||||
Request::CandidateEvents(sender) =>
|
||||
query!(CandidateEvents, candidate_events(), ver = 1, sender),
|
||||
Request::SessionInfo(index, sender) => {
|
||||
use sp_api::ApiExt;
|
||||
|
||||
let api = client.runtime_api();
|
||||
let block_id = BlockId::Hash(relay_parent);
|
||||
|
||||
|
||||
@@ -20,14 +20,11 @@ use ::test_helpers::{dummy_committed_candidate_receipt, dummy_validation_code};
|
||||
use futures::channel::oneshot;
|
||||
use polkadot_node_primitives::{BabeAllowedSlots, BabeEpoch, BabeEpochConfiguration};
|
||||
use polkadot_node_subsystem_test_helpers::make_subsystem_context;
|
||||
use polkadot_primitives::{
|
||||
v1::{
|
||||
AuthorityDiscoveryId, CandidateEvent, CommittedCandidateReceipt, CoreState,
|
||||
GroupRotationInfo, Id as ParaId, InboundDownwardMessage, InboundHrmpMessage,
|
||||
OccupiedCoreAssumption, PersistedValidationData, ScrapedOnChainVotes, SessionIndex,
|
||||
ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature,
|
||||
},
|
||||
v2::{PvfCheckStatement, SessionInfo},
|
||||
use polkadot_primitives::v2::{
|
||||
AuthorityDiscoveryId, CandidateEvent, CommittedCandidateReceipt, CoreState, GroupRotationInfo,
|
||||
Id as ParaId, InboundDownwardMessage, InboundHrmpMessage, OccupiedCoreAssumption,
|
||||
PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes, SessionIndex, SessionInfo,
|
||||
ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature,
|
||||
};
|
||||
use sp_core::testing::TaskExecutor;
|
||||
use std::{
|
||||
@@ -111,7 +108,7 @@ sp_api::mock_impl_runtime_apis! {
|
||||
fn check_validation_outputs(
|
||||
&self,
|
||||
para_id: ParaId,
|
||||
_commitments: polkadot_primitives::v1::CandidateCommitments,
|
||||
_commitments: polkadot_primitives::v2::CandidateCommitments,
|
||||
) -> bool {
|
||||
self.validation_outputs_results
|
||||
.get(¶_id)
|
||||
@@ -219,7 +216,7 @@ sp_api::mock_impl_runtime_apis! {
|
||||
}
|
||||
|
||||
fn submit_report_equivocation_unsigned_extrinsic(
|
||||
_equivocation_proof: sp_consensus_babe::EquivocationProof<polkadot_primitives::v1::Header>,
|
||||
_equivocation_proof: sp_consensus_babe::EquivocationProof<polkadot_primitives::v2::Header>,
|
||||
_key_owner_proof: sp_consensus_babe::OpaqueKeyOwnershipProof,
|
||||
) -> Option<()> {
|
||||
None
|
||||
@@ -442,7 +439,7 @@ fn requests_check_validation_outputs() {
|
||||
let relay_parent = [1; 32].into();
|
||||
let para_a = 5.into();
|
||||
let para_b = 6.into();
|
||||
let commitments = polkadot_primitives::v1::CandidateCommitments::default();
|
||||
let commitments = polkadot_primitives::v2::CandidateCommitments::default();
|
||||
let spawner = sp_core::testing::TaskExecutor::new();
|
||||
|
||||
runtime_api.validation_outputs_results.insert(para_a, false);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! Polkadot Jaeger span definitions.
|
||||
//!
|
||||
//! ```rust
|
||||
//! # use polkadot_primitives::v1::{CandidateHash, Hash};
|
||||
//! # use polkadot_primitives::v2::{CandidateHash, Hash};
|
||||
//! # fn main() {
|
||||
//! use polkadot_node_jaeger as jaeger;
|
||||
//!
|
||||
@@ -51,7 +51,7 @@
|
||||
//! over the course of a function, for this purpose use the non-consuming
|
||||
//! `fn` variants, i.e.
|
||||
//! ```rust
|
||||
//! # use polkadot_primitives::v1::{CandidateHash, Hash};
|
||||
//! # use polkadot_primitives::v2::{CandidateHash, Hash};
|
||||
//! # fn main() {
|
||||
//! # use polkadot_node_jaeger as jaeger;
|
||||
//!
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
use parity_scale_codec::Encode;
|
||||
use polkadot_node_primitives::PoV;
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
BlakeTwo256, CandidateHash, Hash, HashT, Id as ParaId, ValidatorIndex,
|
||||
};
|
||||
use sc_network::PeerId;
|
||||
|
||||
@@ -40,7 +40,7 @@ use polkadot_node_subsystem_util as util;
|
||||
use crate::{interceptor::*, shared::*};
|
||||
use polkadot_node_primitives::{PoV, ValidationResult};
|
||||
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
CandidateCommitments, CandidateDescriptor, CandidateReceipt, PersistedValidationData,
|
||||
ValidationCode,
|
||||
};
|
||||
|
||||
@@ -42,7 +42,7 @@ use polkadot_node_subsystem::{
|
||||
use polkadot_node_subsystem_util as util;
|
||||
// Filter wrapping related types.
|
||||
use crate::interceptor::*;
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
CandidateCommitments, CandidateReceipt, CommittedCandidateReceipt, CompactStatement, Hash,
|
||||
Signed,
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#![cfg(feature = "runtime-metrics")]
|
||||
|
||||
use codec::Decode;
|
||||
use primitives::v1::{
|
||||
use primitives::v2::{
|
||||
metric_definitions::{CounterDefinition, CounterVecDefinition},
|
||||
RuntimeMetricLabelValues, RuntimeMetricOp, RuntimeMetricUpdate,
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
//! All of the metrics have a correspondent runtime metric definition.
|
||||
|
||||
use crate::runtime::RuntimeMetricsProvider;
|
||||
use primitives::v1::metric_definitions::{
|
||||
use primitives::v2::metric_definitions::{
|
||||
PARACHAIN_CREATE_INHERENT_BITFIELDS_SIGNATURE_CHECKS,
|
||||
PARACHAIN_INHERENT_DATA_BITFIELDS_PROCESSED, PARACHAIN_INHERENT_DATA_CANDIDATES_PROCESSED,
|
||||
PARACHAIN_INHERENT_DATA_DISPUTE_SETS_INCLUDED, PARACHAIN_INHERENT_DATA_DISPUTE_SETS_PROCESSED,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use hyper::{Client, Uri};
|
||||
use polkadot_test_service::{node_config, run_validator_node, test_prometheus_config};
|
||||
use primitives::v1::metric_definitions::PARACHAIN_INHERENT_DATA_BITFIELDS_PROCESSED;
|
||||
use primitives::v2::metric_definitions::PARACHAIN_INHERENT_DATA_BITFIELDS_PROCESSED;
|
||||
use sc_client_api::{execution_extensions::ExecutionStrategies, ExecutionStrategy};
|
||||
use sp_keyring::AccountKeyring::*;
|
||||
use std::{collections::HashMap, convert::TryFrom};
|
||||
|
||||
@@ -40,7 +40,7 @@ use polkadot_node_subsystem_util::{
|
||||
metrics::{self, prometheus},
|
||||
MIN_GOSSIP_PEERS,
|
||||
};
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
BlockNumber, CandidateIndex, Hash, ValidatorIndex, ValidatorSignature,
|
||||
};
|
||||
use std::collections::{hash_map, BTreeMap, HashMap, HashSet};
|
||||
|
||||
@@ -28,7 +28,7 @@ use std::time::Duration;
|
||||
|
||||
type VirtualOverseer = test_helpers::TestSubsystemContextHandle<ApprovalDistributionMessage>;
|
||||
|
||||
fn dummy_signature() -> polkadot_primitives::v1::ValidatorSignature {
|
||||
fn dummy_signature() -> polkadot_primitives::v2::ValidatorSignature {
|
||||
sp_core::crypto::UncheckedFrom::unchecked_from([1u8; 64])
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
use fatality::Nested;
|
||||
use polkadot_node_network_protocol::request_response::outgoing::RequestError;
|
||||
use polkadot_primitives::v1::SessionIndex;
|
||||
use polkadot_primitives::v2::SessionIndex;
|
||||
|
||||
use futures::channel::oneshot;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ use polkadot_node_network_protocol::request_response::{
|
||||
};
|
||||
use polkadot_node_primitives::PoV;
|
||||
use polkadot_node_subsystem_util::runtime::RuntimeInfo;
|
||||
use polkadot_primitives::v1::{AuthorityDiscoveryId, CandidateHash, Hash, ValidatorIndex};
|
||||
use polkadot_primitives::v2::{AuthorityDiscoveryId, CandidateHash, Hash, ValidatorIndex};
|
||||
use polkadot_subsystem::{
|
||||
jaeger,
|
||||
messages::{IfDisconnected, NetworkBridgeMessage},
|
||||
@@ -133,7 +133,7 @@ mod tests {
|
||||
use sp_core::testing::TaskExecutor;
|
||||
|
||||
use polkadot_node_primitives::BlockData;
|
||||
use polkadot_primitives::v1::{CandidateHash, Hash, ValidatorIndex};
|
||||
use polkadot_primitives::v2::{CandidateHash, Hash, ValidatorIndex};
|
||||
use polkadot_subsystem::messages::{
|
||||
AllMessages, AvailabilityDistributionMessage, RuntimeApiMessage, RuntimeApiRequest,
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ use polkadot_node_network_protocol::request_response::{
|
||||
v1::{ChunkFetchingRequest, ChunkFetchingResponse},
|
||||
};
|
||||
use polkadot_node_primitives::ErasureChunk;
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
AuthorityDiscoveryId, BlakeTwo256, CandidateHash, GroupIndex, Hash, HashT, OccupiedCore,
|
||||
SessionIndex,
|
||||
};
|
||||
|
||||
@@ -30,7 +30,7 @@ use sp_keyring::Sr25519Keyring;
|
||||
|
||||
use polkadot_node_network_protocol::request_response::{v1, Recipient};
|
||||
use polkadot_node_primitives::{BlockData, PoV, Proof};
|
||||
use polkadot_primitives::v1::{CandidateHash, ValidatorIndex};
|
||||
use polkadot_primitives::v2::{CandidateHash, ValidatorIndex};
|
||||
|
||||
use super::*;
|
||||
use crate::{metrics::Metrics, tests::mock::get_valid_chunk_data};
|
||||
|
||||
@@ -33,7 +33,7 @@ use futures::{
|
||||
};
|
||||
|
||||
use polkadot_node_subsystem_util::runtime::{get_occupied_cores, RuntimeInfo};
|
||||
use polkadot_primitives::v1::{CandidateHash, Hash, OccupiedCore};
|
||||
use polkadot_primitives::v2::{CandidateHash, Hash, OccupiedCore};
|
||||
use polkadot_subsystem::{
|
||||
messages::{AllMessages, ChainApiMessage},
|
||||
ActivatedLeaf, ActiveLeavesUpdate, LeafStatus, SubsystemContext,
|
||||
|
||||
@@ -20,7 +20,7 @@ use lru::LruCache;
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
|
||||
use polkadot_node_subsystem_util::runtime::RuntimeInfo;
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
AuthorityDiscoveryId, GroupIndex, Hash, SessionIndex, ValidatorIndex,
|
||||
};
|
||||
use polkadot_subsystem::SubsystemContext;
|
||||
|
||||
@@ -21,9 +21,8 @@ use futures::FutureExt;
|
||||
use polkadot_node_network_protocol::jaeger;
|
||||
use polkadot_node_primitives::{BlockData, ErasureChunk, PoV, SpawnNamed};
|
||||
use polkadot_node_subsystem_util::runtime::RuntimeInfo;
|
||||
use polkadot_primitives::{
|
||||
v1::{BlockNumber, CoreState, GroupIndex, Hash, Id, ScheduledCore, SessionIndex},
|
||||
v2::SessionInfo,
|
||||
use polkadot_primitives::v2::{
|
||||
BlockNumber, CoreState, GroupIndex, Hash, Id, ScheduledCore, SessionIndex, SessionInfo,
|
||||
};
|
||||
|
||||
use polkadot_subsystem::{
|
||||
|
||||
@@ -26,7 +26,7 @@ use polkadot_node_network_protocol::{
|
||||
UnifiedReputationChange as Rep,
|
||||
};
|
||||
use polkadot_node_primitives::{AvailableData, ErasureChunk};
|
||||
use polkadot_primitives::v1::{CandidateHash, ValidatorIndex};
|
||||
use polkadot_primitives::v2::{CandidateHash, ValidatorIndex};
|
||||
use polkadot_subsystem::{jaeger, messages::AvailabilityStoreMessage, SubsystemSender};
|
||||
|
||||
use crate::{
|
||||
|
||||
@@ -22,13 +22,10 @@ use sp_keyring::Sr25519Keyring;
|
||||
|
||||
use polkadot_erasure_coding::{branches, obtain_chunks_v1 as obtain_chunks};
|
||||
use polkadot_node_primitives::{AvailableData, BlockData, ErasureChunk, PoV, Proof};
|
||||
use polkadot_primitives::{
|
||||
v1::{
|
||||
CandidateCommitments, CandidateDescriptor, CandidateHash, CommittedCandidateReceipt,
|
||||
GroupIndex, Hash, HeadData, Id as ParaId, OccupiedCore, PersistedValidationData,
|
||||
ValidatorIndex,
|
||||
},
|
||||
v2::SessionInfo,
|
||||
use polkadot_primitives::v2::{
|
||||
CandidateCommitments, CandidateDescriptor, CandidateHash, CommittedCandidateReceipt,
|
||||
GroupIndex, Hash, HeadData, Id as ParaId, OccupiedCore, PersistedValidationData, SessionInfo,
|
||||
ValidatorIndex,
|
||||
};
|
||||
use polkadot_primitives_test_helpers::{
|
||||
dummy_collator, dummy_collator_signature, dummy_hash, dummy_validation_code,
|
||||
|
||||
@@ -19,7 +19,7 @@ use std::collections::HashSet;
|
||||
use futures::{executor, future, Future};
|
||||
|
||||
use polkadot_node_network_protocol::request_response::IncomingRequest;
|
||||
use polkadot_primitives::v1::CoreState;
|
||||
use polkadot_primitives::v2::CoreState;
|
||||
use sp_keystore::SyncCryptoStorePtr;
|
||||
|
||||
use polkadot_subsystem_testhelpers as test_helpers;
|
||||
|
||||
@@ -39,9 +39,9 @@ use polkadot_node_network_protocol::{
|
||||
request_response::{v1, IncomingRequest, OutgoingRequest, Requests},
|
||||
};
|
||||
use polkadot_node_primitives::ErasureChunk;
|
||||
use polkadot_primitives::{
|
||||
v1::{CandidateHash, CoreState, GroupIndex, Hash, Id as ParaId, ScheduledCore, ValidatorIndex},
|
||||
v2::SessionInfo,
|
||||
use polkadot_primitives::v2::{
|
||||
CandidateHash, CoreState, GroupIndex, Hash, Id as ParaId, ScheduledCore, SessionInfo,
|
||||
ValidatorIndex,
|
||||
};
|
||||
use polkadot_subsystem::{
|
||||
messages::{
|
||||
|
||||
@@ -49,12 +49,9 @@ use polkadot_node_network_protocol::{
|
||||
};
|
||||
use polkadot_node_primitives::{AvailableData, ErasureChunk};
|
||||
use polkadot_node_subsystem_util::request_session_info;
|
||||
use polkadot_primitives::{
|
||||
v1::{
|
||||
AuthorityDiscoveryId, BlakeTwo256, BlockNumber, CandidateHash, CandidateReceipt,
|
||||
GroupIndex, Hash, HashT, SessionIndex, ValidatorId, ValidatorIndex,
|
||||
},
|
||||
v2::SessionInfo,
|
||||
use polkadot_primitives::v2::{
|
||||
AuthorityDiscoveryId, BlakeTwo256, BlockNumber, CandidateHash, CandidateReceipt, GroupIndex,
|
||||
Hash, HashT, SessionIndex, SessionInfo, ValidatorId, ValidatorIndex,
|
||||
};
|
||||
use polkadot_subsystem::{
|
||||
errors::RecoveryError,
|
||||
|
||||
@@ -30,7 +30,7 @@ use sc_network::config::RequestResponseConfig;
|
||||
use polkadot_erasure_coding::{branches, obtain_chunks_v1 as obtain_chunks};
|
||||
use polkadot_node_primitives::{BlockData, PoV, Proof};
|
||||
use polkadot_node_subsystem_util::TimeoutExt;
|
||||
use polkadot_primitives::v1::{AuthorityDiscoveryId, HeadData, PersistedValidationData};
|
||||
use polkadot_primitives::v2::{AuthorityDiscoveryId, HeadData, PersistedValidationData};
|
||||
use polkadot_primitives_test_helpers::{dummy_candidate_receipt, dummy_hash};
|
||||
use polkadot_subsystem::{
|
||||
jaeger,
|
||||
|
||||
@@ -32,7 +32,7 @@ use polkadot_node_subsystem_util::{
|
||||
metrics::{self, prometheus},
|
||||
MIN_GOSSIP_PEERS,
|
||||
};
|
||||
use polkadot_primitives::v1::{Hash, SignedAvailabilityBitfield, SigningContext, ValidatorId};
|
||||
use polkadot_primitives::v2::{Hash, SignedAvailabilityBitfield, SigningContext, ValidatorId};
|
||||
use polkadot_subsystem::{
|
||||
jaeger, messages::*, overseer, ActiveLeavesUpdate, FromOverseer, OverseerSignal, PerLeafSpan,
|
||||
SpawnedSubsystem, SubsystemContext, SubsystemError, SubsystemResult,
|
||||
|
||||
@@ -22,7 +22,7 @@ use maplit::hashmap;
|
||||
use polkadot_node_network_protocol::{our_view, view, ObservedRole};
|
||||
use polkadot_node_subsystem_test_helpers::make_subsystem_context;
|
||||
use polkadot_node_subsystem_util::TimeoutExt;
|
||||
use polkadot_primitives::v1::{AvailabilityBitfield, Signed, ValidatorIndex};
|
||||
use polkadot_primitives::v2::{AvailabilityBitfield, Signed, ValidatorIndex};
|
||||
use polkadot_subsystem::jaeger;
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_keystore::{testing::KeyStore, SyncCryptoStore, SyncCryptoStorePtr};
|
||||
|
||||
@@ -31,7 +31,7 @@ use polkadot_node_network_protocol::{
|
||||
};
|
||||
use polkadot_node_subsystem_util::metrics::{self, prometheus};
|
||||
use polkadot_overseer::gen::{OverseerError, Subsystem};
|
||||
use polkadot_primitives::v1::{BlockNumber, Hash};
|
||||
use polkadot_primitives::v2::{BlockNumber, Hash};
|
||||
use polkadot_subsystem::{
|
||||
errors::{SubsystemError, SubsystemResult},
|
||||
messages::{AllMessages, CollatorProtocolMessage, NetworkBridgeEvent, NetworkBridgeMessage},
|
||||
|
||||
@@ -31,7 +31,7 @@ use polkadot_node_network_protocol::{
|
||||
request_response::{OutgoingRequest, Recipient, Requests},
|
||||
PeerId, UnifiedReputationChange as Rep,
|
||||
};
|
||||
use polkadot_primitives::v1::{AuthorityDiscoveryId, Block, Hash};
|
||||
use polkadot_primitives::v2::{AuthorityDiscoveryId, Block, Hash};
|
||||
|
||||
use crate::validator_discovery::AuthorityDiscovery;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ use polkadot_node_subsystem_test_helpers::{
|
||||
SingleItemSink, SingleItemStream, TestSubsystemContextHandle,
|
||||
};
|
||||
use polkadot_node_subsystem_util::metered;
|
||||
use polkadot_primitives::v1::AuthorityDiscoveryId;
|
||||
use polkadot_primitives::v2::AuthorityDiscoveryId;
|
||||
use polkadot_primitives_test_helpers::dummy_collator_signature;
|
||||
use polkadot_subsystem::{
|
||||
jaeger,
|
||||
|
||||
@@ -30,7 +30,7 @@ use polkadot_node_network_protocol::{
|
||||
peer_set::{PeerSet, PerPeerSet},
|
||||
PeerId,
|
||||
};
|
||||
use polkadot_primitives::v1::AuthorityDiscoveryId;
|
||||
use polkadot_primitives::v2::AuthorityDiscoveryId;
|
||||
|
||||
const LOG_TARGET: &str = "parachain::validator-discovery";
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ use polkadot_node_subsystem_util::{
|
||||
runtime::{get_availability_cores, get_group_rotation_info, RuntimeInfo},
|
||||
TimeoutExt,
|
||||
};
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
AuthorityDiscoveryId, CandidateHash, CandidateReceipt, CollatorPair, CoreIndex, CoreState,
|
||||
Hash, Id as ParaId,
|
||||
};
|
||||
|
||||
@@ -32,12 +32,9 @@ use sp_runtime::traits::AppVerify;
|
||||
use polkadot_node_network_protocol::{our_view, request_response::IncomingRequest, view};
|
||||
use polkadot_node_primitives::BlockData;
|
||||
use polkadot_node_subsystem_util::TimeoutExt;
|
||||
use polkadot_primitives::{
|
||||
v1::{
|
||||
AuthorityDiscoveryId, CollatorPair, GroupRotationInfo, ScheduledCore, SessionIndex,
|
||||
ValidatorId, ValidatorIndex,
|
||||
},
|
||||
v2::SessionInfo,
|
||||
use polkadot_primitives::v2::{
|
||||
AuthorityDiscoveryId, CollatorPair, GroupRotationInfo, ScheduledCore, SessionIndex,
|
||||
SessionInfo, ValidatorId, ValidatorIndex,
|
||||
};
|
||||
use polkadot_primitives_test_helpers::TestCandidateBuilder;
|
||||
use polkadot_subsystem::{
|
||||
|
||||
@@ -31,7 +31,7 @@ use polkadot_node_network_protocol::{
|
||||
request_response::{v1 as request_v1, IncomingRequestReceiver},
|
||||
PeerId, UnifiedReputationChange as Rep,
|
||||
};
|
||||
use polkadot_primitives::v1::CollatorPair;
|
||||
use polkadot_primitives::v2::CollatorPair;
|
||||
|
||||
use polkadot_subsystem::{
|
||||
errors::SubsystemError,
|
||||
|
||||
@@ -44,7 +44,7 @@ use polkadot_node_network_protocol::{
|
||||
};
|
||||
use polkadot_node_primitives::{PoV, SignedFullStatement};
|
||||
use polkadot_node_subsystem_util::metrics::{self, prometheus};
|
||||
use polkadot_primitives::v1::{CandidateReceipt, CollatorId, Hash, Id as ParaId};
|
||||
use polkadot_primitives::v2::{CandidateReceipt, CollatorId, Hash, Id as ParaId};
|
||||
use polkadot_subsystem::{
|
||||
jaeger,
|
||||
messages::{
|
||||
|
||||
@@ -29,7 +29,7 @@ use polkadot_node_network_protocol::{
|
||||
};
|
||||
use polkadot_node_primitives::BlockData;
|
||||
use polkadot_node_subsystem_util::TimeoutExt;
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
CollatorPair, CoreState, GroupIndex, GroupRotationInfo, OccupiedCore, ScheduledCore,
|
||||
ValidatorId, ValidatorIndex,
|
||||
};
|
||||
@@ -132,7 +132,7 @@ fn test_harness<T: Future<Output = VirtualOverseer>>(test: impl FnOnce(TestHarne
|
||||
let keystore = TestKeyStore::new();
|
||||
keystore
|
||||
.sr25519_generate_new(
|
||||
polkadot_primitives::v1::PARACHAIN_KEY_TYPE_ID,
|
||||
polkadot_primitives::v2::PARACHAIN_KEY_TYPE_ID,
|
||||
Some(&Sr25519Keyring::Alice.to_seed()),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -21,7 +21,7 @@ use futures::channel::{mpsc, oneshot};
|
||||
use polkadot_node_network_protocol::request_response::v1::DisputeRequest;
|
||||
use polkadot_node_primitives::{CandidateVotes, DisputeMessage, SignedDisputeStatement};
|
||||
use polkadot_node_subsystem_util::runtime::RuntimeInfo;
|
||||
use polkadot_primitives::v1::{CandidateHash, DisputeStatement, Hash, SessionIndex};
|
||||
use polkadot_primitives::v2::{CandidateHash, DisputeStatement, Hash, SessionIndex};
|
||||
use polkadot_subsystem::{
|
||||
messages::{AllMessages, DisputeCoordinatorMessage},
|
||||
ActiveLeavesUpdate, SubsystemContext,
|
||||
|
||||
@@ -27,7 +27,7 @@ use polkadot_node_network_protocol::{
|
||||
IfDisconnected,
|
||||
};
|
||||
use polkadot_node_subsystem_util::{metrics, runtime::RuntimeInfo};
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
AuthorityDiscoveryId, CandidateHash, Hash, SessionIndex, ValidatorIndex,
|
||||
};
|
||||
use polkadot_subsystem::{
|
||||
|
||||
@@ -32,12 +32,9 @@ use sp_keyring::Sr25519Keyring;
|
||||
use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr};
|
||||
|
||||
use polkadot_node_primitives::{DisputeMessage, SignedDisputeStatement};
|
||||
use polkadot_primitives::{
|
||||
v1::{
|
||||
AuthorityDiscoveryId, CandidateHash, CandidateReceipt, Hash, SessionIndex, ValidatorId,
|
||||
ValidatorIndex,
|
||||
},
|
||||
v2::SessionInfo,
|
||||
use polkadot_primitives::v2::{
|
||||
AuthorityDiscoveryId, CandidateHash, CandidateReceipt, Hash, SessionIndex, SessionInfo,
|
||||
ValidatorId, ValidatorIndex,
|
||||
};
|
||||
use polkadot_primitives_test_helpers::dummy_candidate_descriptor;
|
||||
|
||||
@@ -198,7 +195,7 @@ impl MockAuthorityDiscovery {
|
||||
impl AuthorityDiscovery for MockAuthorityDiscovery {
|
||||
async fn get_addresses_by_authority_id(
|
||||
&mut self,
|
||||
_authority: polkadot_primitives::v1::AuthorityDiscoveryId,
|
||||
_authority: polkadot_primitives::v2::AuthorityDiscoveryId,
|
||||
) -> Option<HashSet<sc_network::Multiaddr>> {
|
||||
panic!("Not implemented");
|
||||
}
|
||||
@@ -206,7 +203,7 @@ impl AuthorityDiscovery for MockAuthorityDiscovery {
|
||||
async fn get_authority_ids_by_peer_id(
|
||||
&mut self,
|
||||
peer_id: polkadot_node_network_protocol::PeerId,
|
||||
) -> Option<HashSet<polkadot_primitives::v1::AuthorityDiscoveryId>> {
|
||||
) -> Option<HashSet<polkadot_primitives::v2::AuthorityDiscoveryId>> {
|
||||
for (a, p) in self.peer_ids.iter() {
|
||||
if p == &peer_id {
|
||||
return Some(HashSet::from([MOCK_VALIDATORS_DISCOVERY_KEYS
|
||||
|
||||
@@ -41,9 +41,8 @@ use polkadot_node_network_protocol::{
|
||||
IfDisconnected,
|
||||
};
|
||||
use polkadot_node_primitives::{CandidateVotes, UncheckedDisputeMessage};
|
||||
use polkadot_primitives::{
|
||||
v1::{AuthorityDiscoveryId, CandidateHash, Hash, SessionIndex},
|
||||
v2::SessionInfo,
|
||||
use polkadot_primitives::v2::{
|
||||
AuthorityDiscoveryId, CandidateHash, Hash, SessionIndex, SessionInfo,
|
||||
};
|
||||
use polkadot_subsystem::{
|
||||
messages::{
|
||||
|
||||
@@ -52,7 +52,7 @@ use polkadot_node_subsystem::{
|
||||
SubsystemError, SubsystemSender,
|
||||
};
|
||||
use polkadot_node_subsystem_util as util;
|
||||
use polkadot_primitives::v1::{AuthorityDiscoveryId, Hash, SessionIndex};
|
||||
use polkadot_primitives::v2::{AuthorityDiscoveryId, Hash, SessionIndex};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
@@ -91,14 +91,14 @@ impl MockAuthorityDiscovery {
|
||||
impl AuthorityDiscovery for MockAuthorityDiscovery {
|
||||
async fn get_addresses_by_authority_id(
|
||||
&mut self,
|
||||
authority: polkadot_primitives::v1::AuthorityDiscoveryId,
|
||||
authority: polkadot_primitives::v2::AuthorityDiscoveryId,
|
||||
) -> Option<HashSet<sc_network::Multiaddr>> {
|
||||
self.addrs.get(&authority).cloned()
|
||||
}
|
||||
async fn get_authority_ids_by_peer_id(
|
||||
&mut self,
|
||||
peer_id: polkadot_node_network_protocol::PeerId,
|
||||
) -> Option<HashSet<polkadot_primitives::v1::AuthorityDiscoveryId>> {
|
||||
) -> Option<HashSet<polkadot_primitives::v2::AuthorityDiscoveryId>> {
|
||||
self.authorities.get(&peer_id).cloned()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ use async_trait::async_trait;
|
||||
|
||||
use sc_authority_discovery::Service as AuthorityDiscoveryService;
|
||||
|
||||
use polkadot_primitives::v1::AuthorityDiscoveryId;
|
||||
use polkadot_primitives::v2::AuthorityDiscoveryId;
|
||||
use sc_network::{Multiaddr, PeerId};
|
||||
|
||||
/// An abstraction over the authority discovery service.
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#![warn(missing_docs)]
|
||||
|
||||
use parity_scale_codec::{Decode, Encode};
|
||||
use polkadot_primitives::v1::{BlockNumber, Hash};
|
||||
use polkadot_primitives::v2::{BlockNumber, Hash};
|
||||
use std::{collections::HashMap, fmt};
|
||||
|
||||
#[doc(hidden)]
|
||||
@@ -169,7 +169,7 @@ impl std::ops::Deref for OurView {
|
||||
///
|
||||
/// ```
|
||||
/// # use polkadot_node_network_protocol::our_view;
|
||||
/// # use polkadot_primitives::v1::Hash;
|
||||
/// # use polkadot_primitives::v2::Hash;
|
||||
/// let our_view = our_view![Hash::repeat_byte(1), Hash::repeat_byte(2)];
|
||||
/// ```
|
||||
#[macro_export]
|
||||
@@ -203,7 +203,7 @@ pub struct View {
|
||||
///
|
||||
/// ```
|
||||
/// # use polkadot_node_network_protocol::view;
|
||||
/// # use polkadot_primitives::v1::Hash;
|
||||
/// # use polkadot_primitives::v2::Hash;
|
||||
/// let view = view![Hash::repeat_byte(1), Hash::repeat_byte(2)];
|
||||
/// ```
|
||||
#[macro_export]
|
||||
@@ -284,7 +284,7 @@ pub mod v1 {
|
||||
use parity_scale_codec::{Decode, Encode};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
use polkadot_primitives::v1::{
|
||||
use polkadot_primitives::v2::{
|
||||
CandidateHash, CandidateIndex, CollatorId, CollatorSignature, CompactStatement, Hash,
|
||||
Id as ParaId, UncheckedSignedAvailabilityBitfield, ValidatorIndex, ValidatorSignature,
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user