Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Re-export current primitives in crate root #6487

Merged
merged 6 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion erasure-coding/fuzzer/src/round_trip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use polkadot_erasure_coding::*;
use primitives::{AvailableData, BlockData, PoV};
use std::sync::Arc;
use honggfuzz::fuzz;
use polkadot_primitives::v2::PersistedValidationData;
use polkadot_primitives::PersistedValidationData;


fn main() {
Expand Down
2 changes: 1 addition & 1 deletion erasure-coding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

use parity_scale_codec::{Decode, Encode};
use polkadot_node_primitives::{AvailableData, Proof};
use polkadot_primitives::v2::{BlakeTwo256, Hash as H256, HashT};
use polkadot_primitives::{BlakeTwo256, Hash as H256, HashT};
use sp_core::Blake2Hasher;
use sp_trie::{
trie_types::{TrieDBBuilder, TrieDBMutBuilderV0 as TrieDBMutBuilder},
Expand Down
6 changes: 3 additions & 3 deletions node/client/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

//! Code related to benchmarking a [`crate::Client`].

use polkadot_primitives::v2::{AccountId, Balance};
use polkadot_primitives::{AccountId, Balance};
use sp_core::{Pair, H256};
use sp_keyring::Sr25519Keyring;
use sp_runtime::OpaqueExtrinsic;
Expand Down Expand Up @@ -361,14 +361,14 @@ pub fn benchmark_inherent_data(
let timestamp = sp_timestamp::InherentDataProvider::new(d.into());
futures::executor::block_on(timestamp.provide_inherent_data(&mut inherent_data))?;

let para_data = polkadot_primitives::v2::InherentData {
let para_data = polkadot_primitives::InherentData {
bitfields: Vec::new(),
backed_candidates: Vec::new(),
disputes: Vec::new(),
parent_header: header,
};

inherent_data.put_data(polkadot_primitives::v2::PARACHAINS_INHERENT_IDENTIFIER, &para_data)?;
inherent_data.put_data(polkadot_primitives::PARACHAINS_INHERENT_IDENTIFIER, &para_data)?;

Ok(inherent_data)
}
Expand Down
3 changes: 1 addition & 2 deletions node/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
//! There is also the [`Client`] enum that combines all the different clients into one common structure.

use polkadot_primitives::{
runtime_api::ParachainHost,
v2::{AccountId, Balance, Block, BlockNumber, Hash, Header, Nonce},
runtime_api::ParachainHost, AccountId, Balance, Block, BlockNumber, Hash, Header, Nonce,
};
use sc_client_api::{AuxStore, Backend as BackendT, BlockchainEvents, KeyIterator, UsageProvider};
use sc_executor::NativeElseWasmExecutor;
Expand Down
2 changes: 1 addition & 1 deletion node/collation-generation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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::v2::{
use polkadot_primitives::{
collator_signature_payload, CandidateCommitments, CandidateDescriptor, CandidateReceipt,
CoreState, Hash, Id as ParaId, OccupiedCoreAssumption, PersistedValidationData,
ValidationCodeHash,
Expand Down
2 changes: 1 addition & 1 deletion node/collation-generation/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ mod handle_new_activations {
use polkadot_node_subsystem_test_helpers::{
subsystem_test_harness, TestSubsystemContextHandle,
};
use polkadot_primitives::v2::{
use polkadot_primitives::{
CollatorPair, Id as ParaId, PersistedValidationData, ScheduledCore, ValidationCode,
};
use std::pin::Pin;
Expand Down
4 changes: 2 additions & 2 deletions node/core/approval-voting/src/approval_checking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

use bitvec::{order::Lsb0 as BitOrderLsb0, slice::BitSlice};
use polkadot_node_primitives::approval::DelayTranche;
use polkadot_primitives::v2::ValidatorIndex;
use polkadot_primitives::ValidatorIndex;

use crate::{
persisted_entries::{ApprovalEntry, CandidateEntry, TrancheEntry},
Expand Down Expand Up @@ -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::v2::GroupIndex;
use polkadot_primitives::GroupIndex;

#[test]
fn pending_is_not_approved() {
Expand Down
2 changes: 1 addition & 1 deletion node/core/approval-voting/src/approval_db/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::v2::{
use polkadot_primitives::{
BlockNumber, CandidateHash, CandidateReceipt, CoreIndex, GroupIndex, Hash, SessionIndex,
ValidatorIndex, ValidatorSignature,
};
Expand Down
2 changes: 1 addition & 1 deletion node/core/approval-voting/src/approval_db/v1/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::{
ops::{add_block_entry, canonicalize, force_approve, NewCandidateInfo},
};
use polkadot_node_subsystem_util::database::Database;
use polkadot_primitives::v2::Id as ParaId;
use polkadot_primitives::Id as ParaId;
use std::{collections::HashMap, sync::Arc};

use ::test_helpers::{dummy_candidate_receipt, dummy_candidate_receipt_bad_sig, dummy_hash};
Expand Down
2 changes: 1 addition & 1 deletion node/core/approval-voting/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
//! before any commit to the underlying storage is made.

use polkadot_node_subsystem::SubsystemResult;
use polkadot_primitives::v2::{BlockNumber, CandidateHash, Hash};
use polkadot_primitives::{BlockNumber, CandidateHash, Hash};

use std::collections::HashMap;

Expand Down
4 changes: 2 additions & 2 deletions node/core/approval-voting/src/criteria.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use parity_scale_codec::{Decode, Encode};
use polkadot_node_primitives::approval::{
self as approval_types, AssignmentCert, AssignmentCertKind, DelayTranche, RelayVRFStory,
};
use polkadot_primitives::v2::{
use polkadot_primitives::{
AssignmentId, AssignmentPair, CandidateHash, CoreIndex, GroupIndex, IndexedVec, SessionInfo,
ValidatorIndex,
};
Expand Down Expand Up @@ -553,7 +553,7 @@ fn is_in_backing_group(
mod tests {
use super::*;
use polkadot_node_primitives::approval::{VRFOutput, VRFProof};
use polkadot_primitives::v2::{Hash, ASSIGNMENT_KEY_TYPE_ID};
use polkadot_primitives::{Hash, ASSIGNMENT_KEY_TYPE_ID};
use sp_application_crypto::sr25519;
use sp_core::crypto::Pair as PairT;
use sp_keyring::sr25519::Keyring as Sr25519Keyring;
Expand Down
18 changes: 8 additions & 10 deletions node/core/approval-voting/src/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use polkadot_node_subsystem_util::{
determine_new_blocks,
rolling_session_window::{RollingSessionWindow, SessionWindowUpdate},
};
use polkadot_primitives::v2::{
use polkadot_primitives::{
BlockNumber, CandidateEvent, CandidateHash, CandidateReceipt, ConsensusLog, CoreIndex,
GroupIndex, Hash, Header, SessionIndex,
};
Expand Down Expand Up @@ -617,9 +617,7 @@ pub(crate) mod tests {
use polkadot_node_subsystem::messages::{AllMessages, ApprovalVotingMessage};
use polkadot_node_subsystem_test_helpers::make_subsystem_context;
use polkadot_node_subsystem_util::database::Database;
use polkadot_primitives::v2::{
Id as ParaId, IndexedVec, SessionInfo, ValidatorId, ValidatorIndex,
};
use polkadot_primitives::{Id as ParaId, IndexedVec, SessionInfo, ValidatorId, ValidatorIndex};
pub(crate) use sp_consensus_babe::{
digests::{CompatibleDigestItem, PreDigest, SecondaryVRFPreDigest},
AllowedSlots, BabeEpochConfiguration, Epoch as BabeEpoch,
Expand Down Expand Up @@ -683,21 +681,21 @@ pub(crate) mod tests {
_config: &criteria::Config,
_leaving_cores: Vec<(
CandidateHash,
polkadot_primitives::v2::CoreIndex,
polkadot_primitives::v2::GroupIndex,
polkadot_primitives::CoreIndex,
polkadot_primitives::GroupIndex,
)>,
) -> HashMap<polkadot_primitives::v2::CoreIndex, criteria::OurAssignment> {
) -> HashMap<polkadot_primitives::CoreIndex, criteria::OurAssignment> {
HashMap::new()
}

fn check_assignment_cert(
&self,
_claimed_core_index: polkadot_primitives::v2::CoreIndex,
_validator_index: polkadot_primitives::v2::ValidatorIndex,
_claimed_core_index: polkadot_primitives::CoreIndex,
_validator_index: polkadot_primitives::ValidatorIndex,
_config: &criteria::Config,
_relay_vrf_story: polkadot_node_primitives::approval::RelayVRFStory,
_assignment: &polkadot_node_primitives::approval::AssignmentCert,
_backing_group: polkadot_primitives::v2::GroupIndex,
_backing_group: polkadot_primitives::GroupIndex,
) -> Result<polkadot_node_primitives::approval::DelayTranche, criteria::InvalidAssignment> {
Ok(0)
}
Expand Down
2 changes: 1 addition & 1 deletion node/core/approval-voting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use polkadot_node_subsystem_util::{
},
TimeoutExt,
};
use polkadot_primitives::v2::{
use polkadot_primitives::{
ApprovalVote, BlockNumber, CandidateHash, CandidateIndex, CandidateReceipt, DisputeStatement,
GroupIndex, Hash, SessionIndex, SessionInfo, ValidDisputeStatementKind, ValidatorId,
ValidatorIndex, ValidatorPair, ValidatorSignature,
Expand Down
2 changes: 1 addition & 1 deletion node/core/approval-voting/src/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use polkadot_node_subsystem::{SubsystemError, SubsystemResult};

use bitvec::order::Lsb0 as BitOrderLsb0;
use polkadot_primitives::v2::{BlockNumber, CandidateHash, CandidateReceipt, GroupIndex, Hash};
use polkadot_primitives::{BlockNumber, CandidateHash, CandidateReceipt, GroupIndex, Hash};

use std::collections::{hash_map::Entry, BTreeMap, HashMap};

Expand Down
2 changes: 1 addition & 1 deletion node/core/approval-voting/src/persisted_entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//! data and logic are intertwined.

use polkadot_node_primitives::approval::{AssignmentCert, DelayTranche, RelayVRFStory};
use polkadot_primitives::v2::{
use polkadot_primitives::{
BlockNumber, CandidateHash, CandidateReceipt, CoreIndex, GroupIndex, Hash, SessionIndex,
ValidatorIndex, ValidatorSignature,
};
Expand Down
21 changes: 9 additions & 12 deletions node/core/approval-voting/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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::v2::{
use polkadot_primitives::{
CandidateCommitments, CandidateEvent, CoreIndex, GroupIndex, Header, Id as ParaId, IndexedVec,
ValidationCode, ValidatorSignature,
};
Expand Down Expand Up @@ -227,7 +227,7 @@ struct MockAssignmentCriteria<Compute, Check>(Compute, Check);

impl<Compute, Check> AssignmentCriteria for MockAssignmentCriteria<Compute, Check>
where
Compute: Fn() -> HashMap<polkadot_primitives::v2::CoreIndex, criteria::OurAssignment>,
Compute: Fn() -> HashMap<polkadot_primitives::CoreIndex, criteria::OurAssignment>,
Check: Fn(ValidatorIndex) -> Result<DelayTranche, criteria::InvalidAssignment>,
{
fn compute_assignments(
Expand All @@ -237,31 +237,28 @@ where
_config: &criteria::Config,
_leaving_cores: Vec<(
CandidateHash,
polkadot_primitives::v2::CoreIndex,
polkadot_primitives::v2::GroupIndex,
polkadot_primitives::CoreIndex,
polkadot_primitives::GroupIndex,
)>,
) -> HashMap<polkadot_primitives::v2::CoreIndex, criteria::OurAssignment> {
) -> HashMap<polkadot_primitives::CoreIndex, criteria::OurAssignment> {
self.0()
}

fn check_assignment_cert(
&self,
_claimed_core_index: polkadot_primitives::v2::CoreIndex,
_claimed_core_index: polkadot_primitives::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::v2::GroupIndex,
_backing_group: polkadot_primitives::GroupIndex,
) -> Result<polkadot_node_primitives::approval::DelayTranche, criteria::InvalidAssignment> {
self.1(validator_index)
}
}

impl<F>
MockAssignmentCriteria<
fn() -> HashMap<polkadot_primitives::v2::CoreIndex, criteria::OurAssignment>,
F,
>
MockAssignmentCriteria<fn() -> HashMap<polkadot_primitives::CoreIndex, criteria::OurAssignment>, F>
{
fn check_only(f: F) -> Self {
MockAssignmentCriteria(Default::default, f)
Expand Down Expand Up @@ -480,7 +477,7 @@ fn test_harness<T: Future<Output = VirtualOverseer>>(

let keystore = LocalKeystore::in_memory();
let _ = keystore.sr25519_generate_new(
polkadot_primitives::v2::PARACHAIN_KEY_TYPE_ID,
polkadot_primitives::PARACHAIN_KEY_TYPE_ID,
Some(&Sr25519Keyring::Alice.to_seed()),
);

Expand Down
2 changes: 1 addition & 1 deletion node/core/av-store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use polkadot_node_subsystem::{
overseer, ActiveLeavesUpdate, FromOrchestra, OverseerSignal, SpawnedSubsystem, SubsystemError,
};
use polkadot_node_subsystem_util as util;
use polkadot_primitives::v2::{
use polkadot_primitives::{
BlockNumber, CandidateEvent, CandidateHash, CandidateReceipt, Hash, Header, ValidatorIndex,
};

Expand Down
2 changes: 1 addition & 1 deletion node/core/av-store/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use polkadot_node_subsystem::{
};
use polkadot_node_subsystem_test_helpers as test_helpers;
use polkadot_node_subsystem_util::{database::Database, TimeoutExt};
use polkadot_primitives::v2::{
use polkadot_primitives::{
CandidateHash, CandidateReceipt, CoreIndex, GroupIndex, HeadData, Header,
PersistedValidationData, ValidatorId,
};
Expand Down
2 changes: 1 addition & 1 deletion node/core/backing/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use futures::channel::{mpsc, oneshot};

use polkadot_node_subsystem::{messages::ValidationFailed, SubsystemError};
use polkadot_node_subsystem_util::Error as UtilError;
use polkadot_primitives::v2::BackedCandidate;
use polkadot_primitives::BackedCandidate;

use crate::LOG_TARGET;

Expand Down
4 changes: 2 additions & 2 deletions node/core/backing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use polkadot_node_subsystem_util::{
self as util, request_from_runtime, request_session_index_for_child, request_validator_groups,
request_validators, Validator,
};
use polkadot_primitives::v2::{
use polkadot_primitives::{
BackedCandidate, CandidateCommitments, CandidateHash, CandidateReceipt, CollatorId,
CommittedCandidateReceipt, CoreIndex, CoreState, Hash, Id as ParaId, SigningContext,
ValidatorId, ValidatorIndex, ValidatorSignature, ValidityAttestation,
Expand Down Expand Up @@ -587,7 +587,7 @@ async fn make_pov_available(
n_validators: usize,
pov: Arc<PoV>,
candidate_hash: CandidateHash,
validation_data: polkadot_primitives::v2::PersistedValidationData,
validation_data: polkadot_primitives::PersistedValidationData,
expected_erasure_root: Hash,
span: Option<&jaeger::Span>,
) -> Result<Result<(), InvalidErasureRoot>, Error> {
Expand Down
2 changes: 1 addition & 1 deletion node/core/backing/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use polkadot_node_subsystem::{
ActivatedLeaf, ActiveLeavesUpdate, FromOrchestra, LeafStatus, OverseerSignal,
};
use polkadot_node_subsystem_test_helpers as test_helpers;
use polkadot_primitives::v2::{
use polkadot_primitives::{
CandidateDescriptor, CollatorId, GroupRotationInfo, HeadData, PersistedValidationData,
ScheduledCore,
};
Expand Down
2 changes: 1 addition & 1 deletion node/core/bitfield-signing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use polkadot_node_subsystem::{
SpawnedSubsystem, SubsystemError, SubsystemResult, SubsystemSender,
};
use polkadot_node_subsystem_util::{self as util, Validator};
use polkadot_primitives::v2::{AvailabilityBitfield, CoreState, Hash, ValidatorIndex};
use polkadot_primitives::{AvailabilityBitfield, CoreState, Hash, ValidatorIndex};
use sp_keystore::{Error as KeystoreError, SyncCryptoStorePtr};
use std::{collections::HashMap, iter::FromIterator, time::Duration};
use wasm_timer::{Delay, Instant};
Expand Down
2 changes: 1 addition & 1 deletion node/core/bitfield-signing/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use super::*;
use futures::{executor::block_on, pin_mut, StreamExt};
use polkadot_node_subsystem::messages::AllMessages;
use polkadot_primitives::v2::{CandidateHash, OccupiedCore};
use polkadot_primitives::{CandidateHash, OccupiedCore};
use test_helpers::dummy_candidate_descriptor;

fn occupied_core(para_id: u32, candidate_hash: CandidateHash) -> CoreState {
Expand Down
2 changes: 1 addition & 1 deletion node/core/candidate-validation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use polkadot_node_subsystem::{
SubsystemSender,
};
use polkadot_parachain::primitives::{ValidationParams, ValidationResult as WasmValidationResult};
use polkadot_primitives::v2::{
use polkadot_primitives::{
CandidateCommitments, CandidateDescriptor, CandidateReceipt, Hash, OccupiedCoreAssumption,
PersistedValidationData, ValidationCode, ValidationCodeHash,
};
Expand Down
2 changes: 1 addition & 1 deletion node/core/candidate-validation/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::v2::{HeadData, Id as ParaId, UpwardMessage};
use polkadot_primitives::{HeadData, Id as ParaId, UpwardMessage};
use sp_core::testing::TaskExecutor;
use sp_keyring::Sr25519Keyring;

Expand Down
2 changes: 1 addition & 1 deletion node/core/chain-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use polkadot_node_subsystem::{
messages::ChainApiMessage, overseer, FromOrchestra, OverseerSignal, SpawnedSubsystem,
SubsystemError, SubsystemResult,
};
use polkadot_primitives::v2::Block;
use polkadot_primitives::Block;

mod metrics;
use self::metrics::Metrics;
Expand Down
2 changes: 1 addition & 1 deletion node/core/chain-api/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::v2::{BlockNumber, Hash, Header};
use polkadot_primitives::{BlockNumber, Hash, Header};
use sp_blockchain::Info as BlockInfo;
use sp_core::testing::TaskExecutor;

Expand Down
2 changes: 1 addition & 1 deletion node/core/chain-selection/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//! [`Backend`], maintaining consistency between queries and temporary writes,
//! before any commit to the underlying storage is made.

use polkadot_primitives::v2::{BlockNumber, Hash};
use polkadot_primitives::{BlockNumber, Hash};

use std::collections::HashMap;

Expand Down
Loading