Re-export current primitives in crate root (#6487)

* Re-export current primitives in crate root

* Add missing exports

* restart CI
This commit is contained in:
s0me0ne-unkn0wn
2023-01-11 12:28:12 +01:00
committed by GitHub
parent b0f79c2039
commit 1cb1d03c08
221 changed files with 399 additions and 397 deletions
@@ -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},
@@ -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() {
@@ -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,
};
@@ -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};
@@ -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;
@@ -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,
};
@@ -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;
@@ -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,
};
@@ -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,
@@ -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)
}
@@ -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,
@@ -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};
@@ -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,
};
@@ -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,
};
@@ -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(
@@ -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)
@@ -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()),
);
+1 -1
View File
@@ -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,
};
+1 -1
View File
@@ -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,
};
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -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,
@@ -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> {
+1 -1
View File
@@ -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,
};
@@ -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};
@@ -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 {
@@ -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,
};
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
@@ -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;
@@ -38,7 +38,7 @@ use crate::{
};
use polkadot_node_primitives::BlockWeight;
use polkadot_primitives::v2::{BlockNumber, Hash};
use polkadot_primitives::{BlockNumber, Hash};
use parity_scale_codec::{Decode, Encode};
use polkadot_node_subsystem_util::database::{DBTransaction, Database};
@@ -24,7 +24,7 @@ use polkadot_node_subsystem::{
FromOrchestra, OverseerSignal, SpawnedSubsystem, SubsystemError,
};
use polkadot_node_subsystem_util::database::Database;
use polkadot_primitives::v2::{BlockNumber, ConsensusLog, Hash, Header};
use polkadot_primitives::{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::v2::{BlakeTwo256, ConsensusLog, HashT};
use polkadot_primitives::{BlakeTwo256, ConsensusLog, HashT};
#[derive(Default)]
struct TestBackendInner {
@@ -25,7 +25,7 @@
use polkadot_node_primitives::BlockWeight;
use polkadot_node_subsystem::ChainApiError;
use polkadot_primitives::v2::{BlockNumber, Hash};
use polkadot_primitives::{BlockNumber, Hash};
use std::collections::HashMap;
@@ -22,7 +22,7 @@
//! before any commit to the underlying storage is made.
use polkadot_node_subsystem::SubsystemResult;
use polkadot_primitives::v2::{CandidateHash, SessionIndex};
use polkadot_primitives::{CandidateHash, SessionIndex};
use std::collections::HashMap;
@@ -19,7 +19,7 @@
use polkadot_node_primitives::DisputeStatus;
use polkadot_node_subsystem::{SubsystemError, SubsystemResult};
use polkadot_node_subsystem_util::database::{DBTransaction, Database};
use polkadot_primitives::v2::{
use polkadot_primitives::{
CandidateHash, CandidateReceipt, Hash, InvalidDisputeStatementKind, SessionIndex,
ValidDisputeStatementKind, ValidatorIndex, ValidatorSignature,
};
@@ -373,7 +373,7 @@ mod tests {
use super::*;
use ::test_helpers::{dummy_candidate_receipt, dummy_hash};
use polkadot_node_primitives::DISPUTE_WINDOW;
use polkadot_primitives::v2::{Hash, Id as ParaId};
use polkadot_primitives::{Hash, Id as ParaId};
fn make_db() -> DbBackend {
let db = kvdb_memorydb::create(1);
@@ -32,7 +32,7 @@ use polkadot_node_primitives::{
disputes::ValidCandidateVotes, CandidateVotes, DisputeStatus, SignedDisputeStatement, Timestamp,
};
use polkadot_node_subsystem_util::rolling_session_window::RollingSessionWindow;
use polkadot_primitives::v2::{
use polkadot_primitives::{
CandidateReceipt, DisputeStatement, IndexedVec, SessionIndex, SessionInfo,
ValidDisputeStatementKind, ValidatorId, ValidatorIndex, ValidatorPair, ValidatorSignature,
};
@@ -188,15 +188,14 @@ impl CandidateVoteState<CandidateVotes> {
let n_validators = env.validators().len();
let supermajority_threshold =
polkadot_primitives::v2::supermajority_threshold(n_validators);
let supermajority_threshold = polkadot_primitives::supermajority_threshold(n_validators);
// We have a dispute, if we have votes on both sides:
let is_disputed = !votes.invalid.is_empty() && !votes.valid.raw().is_empty();
let dispute_status = if is_disputed {
let mut status = DisputeStatus::active();
let byzantine_threshold = polkadot_primitives::v2::byzantine_threshold(n_validators);
let byzantine_threshold = polkadot_primitives::byzantine_threshold(n_validators);
let is_confirmed = votes.voted_indices().len() > byzantine_threshold;
if is_confirmed {
status = status.confirm();
@@ -38,7 +38,7 @@ use polkadot_node_subsystem::{
use polkadot_node_subsystem_util::rolling_session_window::{
RollingSessionWindow, SessionWindowUpdate, SessionsUnavailable,
};
use polkadot_primitives::v2::{
use polkadot_primitives::{
BlockNumber, CandidateHash, CandidateReceipt, CompactStatement, DisputeStatement,
DisputeStatementSet, Hash, ScrapedOnChainVotes, SessionIndex, SessionInfo,
ValidDisputeStatementKind, ValidatorId, ValidatorIndex,
@@ -42,7 +42,7 @@ use polkadot_node_subsystem_util::{
database::Database,
rolling_session_window::{DatabaseParams, RollingSessionWindow},
};
use polkadot_primitives::v2::{DisputeStatement, ScrapedOnChainVotes, SessionInfo, ValidatorIndex};
use polkadot_primitives::{DisputeStatement, ScrapedOnChainVotes, SessionInfo, ValidatorIndex};
use crate::{
error::{FatalResult, JfyiError, Result},
@@ -31,7 +31,7 @@ use polkadot_node_subsystem::{
overseer, ActiveLeavesUpdate, RecoveryError,
};
use polkadot_node_subsystem_util::runtime::get_validation_code_by_hash;
use polkadot_primitives::v2::{BlockNumber, CandidateHash, CandidateReceipt, Hash, SessionIndex};
use polkadot_primitives::{BlockNumber, CandidateHash, CandidateReceipt, Hash, SessionIndex};
use crate::LOG_TARGET;
@@ -18,7 +18,7 @@ use std::{cmp::Ordering, collections::BTreeMap};
use futures::channel::oneshot;
use polkadot_node_subsystem::{messages::ChainApiMessage, overseer};
use polkadot_primitives::v2::{BlockNumber, CandidateHash, CandidateReceipt, Hash, SessionIndex};
use polkadot_primitives::{BlockNumber, CandidateHash, CandidateReceipt, Hash, SessionIndex};
use crate::{
error::{FatalError, FatalResult, Result},
@@ -17,7 +17,7 @@
use crate::ParticipationPriority;
use ::test_helpers::{dummy_candidate_receipt, dummy_hash};
use assert_matches::assert_matches;
use polkadot_primitives::v2::{BlockNumber, Hash};
use polkadot_primitives::{BlockNumber, Hash};
use super::{CandidateComparator, ParticipationRequest, QueueError, Queues};
@@ -38,7 +38,7 @@ use polkadot_node_subsystem::{
use polkadot_node_subsystem_test_helpers::{
make_subsystem_context, TestSubsystemContext, TestSubsystemContextHandle,
};
use polkadot_primitives::v2::{
use polkadot_primitives::{
BlakeTwo256, CandidateCommitments, HashT, Header, PersistedValidationData, ValidationCode,
};
@@ -1,4 +1,4 @@
use polkadot_primitives::v2::{BlockNumber, CandidateHash};
use polkadot_primitives::{BlockNumber, CandidateHash};
use std::collections::{BTreeMap, HashMap, HashSet};
/// Keeps `CandidateHash` in reference counted way.
@@ -44,7 +44,7 @@ impl RefCountedCandidates {
#[cfg(test)]
mod ref_counted_candidates_tests {
use super::*;
use polkadot_primitives::v2::{BlakeTwo256, HashT};
use polkadot_primitives::{BlakeTwo256, HashT};
#[test]
fn element_is_removed_when_refcount_reaches_zero() {
@@ -131,7 +131,7 @@ impl ScrapedCandidates {
#[cfg(test)]
mod scraped_candidates_tests {
use super::*;
use polkadot_primitives::v2::{BlakeTwo256, HashT};
use polkadot_primitives::{BlakeTwo256, HashT};
#[test]
fn stale_candidates_are_removed() {
@@ -25,7 +25,7 @@ use polkadot_node_subsystem::{
SubsystemSender,
};
use polkadot_node_subsystem_util::runtime::{get_candidate_events, get_on_chain_votes};
use polkadot_primitives::v2::{
use polkadot_primitives::{
BlockNumber, CandidateEvent, CandidateHash, CandidateReceipt, Hash, ScrapedOnChainVotes,
};
@@ -36,7 +36,7 @@ use polkadot_node_subsystem_test_helpers::{
make_subsystem_context, TestSubsystemContext, TestSubsystemContextHandle, TestSubsystemSender,
};
use polkadot_node_subsystem_util::{reexports::SubsystemContext, TimeoutExt};
use polkadot_primitives::v2::{
use polkadot_primitives::{
BlakeTwo256, BlockNumber, CandidateDescriptor, CandidateEvent, CandidateReceipt, CoreIndex,
GroupIndex, Hash, HashT, HeadData, Id as ParaId,
};
@@ -16,7 +16,7 @@
use std::collections::{BTreeSet, HashMap};
use polkadot_primitives::v2::{CandidateHash, SessionIndex, ValidatorIndex};
use polkadot_primitives::{CandidateHash, SessionIndex, ValidatorIndex};
use crate::LOG_TARGET;
@@ -15,7 +15,7 @@
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
use polkadot_node_primitives::{dispute_is_inactive, DisputeStatus, Timestamp};
use polkadot_primitives::v2::{CandidateHash, SessionIndex};
use polkadot_primitives::{CandidateHash, SessionIndex};
use std::time::{SystemTime, UNIX_EPOCH};
use crate::LOG_TARGET;
@@ -60,7 +60,7 @@ use polkadot_node_subsystem::{
use polkadot_node_subsystem_test_helpers::{
make_buffered_subsystem_context, TestSubsystemContextHandle,
};
use polkadot_primitives::v2::{
use polkadot_primitives::{
ApprovalVote, BlockNumber, CandidateCommitments, CandidateEvent, CandidateHash,
CandidateReceipt, CoreIndex, DisputeStatement, GroupIndex, Hash, HeadData, Header, IndexedVec,
MultiDisputeStatementSet, ScrapedOnChainVotes, SessionIndex, SessionInfo, SigningContext,
@@ -85,7 +85,7 @@ fn make_keystore(seeds: impl Iterator<Item = String>) -> LocalKeystore {
for s in seeds {
store
.sr25519_generate_new(polkadot_primitives::v2::PARACHAIN_KEY_TYPE_ID, Some(&s))
.sr25519_generate_new(polkadot_primitives::PARACHAIN_KEY_TYPE_ID, Some(&s))
.unwrap();
}
@@ -1803,7 +1803,7 @@ fn supermajority_valid_dispute_may_be_finalized() {
.await;
let supermajority_threshold =
polkadot_primitives::v2::supermajority_threshold(test_state.validators.len());
polkadot_primitives::supermajority_threshold(test_state.validators.len());
let (valid_vote, invalid_vote) = generate_opposing_votes_pair(
&test_state,
@@ -1942,7 +1942,7 @@ fn concluded_supermajority_for_non_active_after_time() {
.await;
let supermajority_threshold =
polkadot_primitives::v2::supermajority_threshold(test_state.validators.len());
polkadot_primitives::supermajority_threshold(test_state.validators.len());
let (valid_vote, invalid_vote) = generate_opposing_votes_pair(
&test_state,
@@ -2059,7 +2059,7 @@ fn concluded_supermajority_against_non_active_after_time() {
.await;
let supermajority_threshold =
polkadot_primitives::v2::supermajority_threshold(test_state.validators.len());
polkadot_primitives::supermajority_threshold(test_state.validators.len());
let (valid_vote, invalid_vote) = generate_opposing_votes_pair(
&test_state,
@@ -28,7 +28,7 @@ use futures::{select, FutureExt};
use polkadot_node_subsystem::{
errors::SubsystemError, messages::ProvisionerMessage, overseer::Handle,
};
use polkadot_primitives::v2::{Block, Hash, InherentData as ParachainsInherentData};
use polkadot_primitives::{Block, Hash, InherentData as ParachainsInherentData};
use std::{sync::Arc, time};
pub(crate) const LOG_TARGET: &str = "parachain::parachains-inherent";
@@ -140,7 +140,7 @@ impl<C: sp_blockchain::HeaderBackend<Block>> sp_inherents::InherentDataProvider
.map_err(|e| sp_inherents::Error::Application(Box::new(e)))?;
dst_inherent_data
.put_data(polkadot_primitives::v2::PARACHAINS_INHERENT_IDENTIFIER, &inherent_data)
.put_data(polkadot_primitives::PARACHAINS_INHERENT_IDENTIFIER, &inherent_data)
}
async fn try_handle_error(
@@ -25,7 +25,7 @@ use crate::LOG_TARGET;
use futures::channel::oneshot;
use polkadot_node_primitives::CandidateVotes;
use polkadot_node_subsystem::{messages::DisputeCoordinatorMessage, overseer};
use polkadot_primitives::v2::{CandidateHash, SessionIndex};
use polkadot_primitives::{CandidateHash, SessionIndex};
/// Request the relevant dispute statements for a set of disputes identified by `CandidateHash` and the `SessionIndex`.
async fn request_votes(
@@ -26,7 +26,7 @@ use polkadot_node_subsystem::{
messages::{DisputeCoordinatorMessage, RuntimeApiMessage, RuntimeApiRequest},
overseer, ActivatedLeaf,
};
use polkadot_primitives::v2::{
use polkadot_primitives::{
supermajority_threshold, CandidateHash, DisputeState, DisputeStatement, DisputeStatementSet,
Hash, MultiDisputeStatementSet, SessionIndex, ValidDisputeStatementKind, ValidatorIndex,
};
@@ -25,7 +25,7 @@ use polkadot_node_subsystem::messages::{
AllMessages, DisputeCoordinatorMessage, RuntimeApiMessage, RuntimeApiRequest,
};
use polkadot_node_subsystem_test_helpers::TestSubsystemSender;
use polkadot_primitives::v2::{
use polkadot_primitives::{
CandidateHash, DisputeState, InvalidDisputeStatementKind, SessionIndex,
ValidDisputeStatementKind, ValidatorSignature,
};
@@ -24,7 +24,7 @@
use crate::{metrics, LOG_TARGET};
use futures::channel::oneshot;
use polkadot_node_subsystem::{messages::DisputeCoordinatorMessage, overseer};
use polkadot_primitives::v2::{
use polkadot_primitives::{
CandidateHash, DisputeStatement, DisputeStatementSet, MultiDisputeStatementSet, SessionIndex,
};
use std::collections::HashSet;
+1 -1
View File
@@ -19,7 +19,7 @@ use fatality::Nested;
use futures::channel::{mpsc, oneshot};
use polkadot_node_subsystem::errors::{ChainApiError, RuntimeApiError, SubsystemError};
use polkadot_node_subsystem_util as util;
use polkadot_primitives::v2::Hash;
use polkadot_primitives::Hash;
pub type FatalResult<T> = std::result::Result<T, FatalError>;
pub type Result<T> = std::result::Result<T, Error>;
+1 -1
View File
@@ -37,7 +37,7 @@ use polkadot_node_subsystem::{
use polkadot_node_subsystem_util::{
request_availability_cores, request_persisted_validation_data, TimeoutExt,
};
use polkadot_primitives::v2::{
use polkadot_primitives::{
BackedCandidate, BlockNumber, CandidateReceipt, CoreState, Hash, OccupiedCoreAssumption,
SignedAvailabilityBitfield, ValidatorIndex,
};
+3 -3
View File
@@ -1,7 +1,7 @@
use super::*;
use ::test_helpers::{dummy_candidate_descriptor, dummy_hash};
use bitvec::bitvec;
use polkadot_primitives::v2::{OccupiedCore, ScheduledCore};
use polkadot_primitives::{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::v2::{ScheduledCore, SigningContext, ValidatorId, ValidatorIndex};
use polkadot_primitives::{ScheduledCore, SigningContext, ValidatorId, ValidatorIndex};
use sp_application_crypto::AppKey;
use sp_keystore::{testing::KeyStore, CryptoStore, SyncCryptoStorePtr};
use std::sync::Arc;
@@ -234,7 +234,7 @@ mod select_candidates {
},
};
use polkadot_node_subsystem_test_helpers::TestSubsystemSender;
use polkadot_primitives::v2::{
use polkadot_primitives::{
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::v2::{Hash, ValidationCodeHash};
use polkadot_primitives::{Hash, ValidationCodeHash};
use std::collections::{
btree_map::{self, BTreeMap},
HashSet,
+1 -1
View File
@@ -26,7 +26,7 @@ use polkadot_node_subsystem::{
overseer, ActiveLeavesUpdate, FromOrchestra, OverseerSignal, SpawnedSubsystem, SubsystemError,
SubsystemResult, SubsystemSender,
};
use polkadot_primitives::v2::{
use polkadot_primitives::{
BlockNumber, Hash, PvfCheckStatement, SessionIndex, ValidationCodeHash, ValidatorId,
ValidatorIndex,
};
@@ -21,7 +21,7 @@ use polkadot_node_subsystem::{
messages::{RuntimeApiMessage, RuntimeApiRequest},
SubsystemSender,
};
use polkadot_primitives::v2::{
use polkadot_primitives::{
Hash, PvfCheckStatement, SessionIndex, ValidationCodeHash, ValidatorId, ValidatorSignature,
};
+1 -1
View File
@@ -25,7 +25,7 @@ use polkadot_node_subsystem::{
ActivatedLeaf, ActiveLeavesUpdate, FromOrchestra, LeafStatus, OverseerSignal, RuntimeApiError,
};
use polkadot_node_subsystem_test_helpers::{make_subsystem_context, TestSubsystemContextHandle};
use polkadot_primitives::v2::{
use polkadot_primitives::{
BlockNumber, Hash, Header, PvfCheckStatement, SessionIndex, ValidationCode, ValidationCodeHash,
ValidatorId,
};
+1 -1
View File
@@ -19,7 +19,7 @@ use std::{collections::btree_map::BTreeMap, num::NonZeroUsize};
use lru::LruCache;
use sp_consensus_babe::Epoch;
use polkadot_primitives::v2::{
use polkadot_primitives::{
AuthorityDiscoveryId, BlockNumber, CandidateCommitments, CandidateEvent, CandidateHash,
CommittedCandidateReceipt, CoreState, DisputeState, GroupRotationInfo, Hash, Id as ParaId,
InboundDownwardMessage, InboundHrmpMessage, OccupiedCoreAssumption, PersistedValidationData,
+1 -1
View File
@@ -28,7 +28,7 @@ use polkadot_node_subsystem::{
overseer, FromOrchestra, OverseerSignal, SpawnedSubsystem, SubsystemError, SubsystemResult,
};
use polkadot_node_subsystem_types::RuntimeApiSubsystemClient;
use polkadot_primitives::v2::Hash;
use polkadot_primitives::Hash;
use cache::{RequestResult, RequestResultCache};
use futures::{channel::oneshot, prelude::*, select, stream::FuturesUnordered};
+8 -11
View File
@@ -21,14 +21,11 @@ use polkadot_node_primitives::{BabeAllowedSlots, BabeEpoch, BabeEpochConfigurati
use polkadot_node_subsystem::SpawnGlue;
use polkadot_node_subsystem_test_helpers::make_subsystem_context;
use polkadot_primitives::{
runtime_api::ParachainHost,
v2::{
AuthorityDiscoveryId, Block, CandidateEvent, CommittedCandidateReceipt, CoreState,
GroupRotationInfo, Id as ParaId, InboundDownwardMessage, InboundHrmpMessage,
OccupiedCoreAssumption, PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes,
SessionIndex, SessionInfo, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex,
ValidatorSignature,
},
runtime_api::ParachainHost, AuthorityDiscoveryId, Block, CandidateEvent,
CommittedCandidateReceipt, CoreState, GroupRotationInfo, Id as ParaId, InboundDownwardMessage,
InboundHrmpMessage, OccupiedCoreAssumption, PersistedValidationData, PvfCheckStatement,
ScrapedOnChainVotes, SessionIndex, SessionInfo, ValidationCode, ValidationCodeHash,
ValidatorId, ValidatorIndex, ValidatorSignature,
};
use sp_api::ProvideRuntimeApi;
use sp_authority_discovery::AuthorityDiscoveryApi;
@@ -115,7 +112,7 @@ sp_api::mock_impl_runtime_apis! {
fn check_validation_outputs(
&self,
para_id: ParaId,
_commitments: polkadot_primitives::v2::CandidateCommitments,
_commitments: polkadot_primitives::CandidateCommitments,
) -> bool {
self.validation_outputs_results
.get(&para_id)
@@ -223,7 +220,7 @@ sp_api::mock_impl_runtime_apis! {
}
fn submit_report_equivocation_unsigned_extrinsic(
_equivocation_proof: sp_consensus_babe::EquivocationProof<polkadot_primitives::v2::Header>,
_equivocation_proof: sp_consensus_babe::EquivocationProof<polkadot_primitives::Header>,
_key_owner_proof: sp_consensus_babe::OpaqueKeyOwnershipProof,
) -> Option<()> {
None
@@ -452,7 +449,7 @@ fn requests_check_validation_outputs() {
let relay_parent = [1; 32].into();
let para_a = ParaId::from(5_u32);
let para_b = ParaId::from(6_u32);
let commitments = polkadot_primitives::v2::CandidateCommitments::default();
let commitments = polkadot_primitives::CandidateCommitments::default();
let spawner = sp_core::testing::TaskExecutor::new();
runtime_api.validation_outputs_results.insert(para_a, false);