mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 19:11:04 +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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user