Use primitives reexported from polkadot_primitives crate root (#2067)

* Use primitives reexported from `polkadot_primitives` crate root

* restart CI

* Fixes after merge

* update lockfile for {"polkadot", "substrate"}

Co-authored-by: parity-processbot <>
This commit is contained in:
s0me0ne-unkn0wn
2023-01-11 13:06:58 +01:00
committed by GitHub
parent d0f13b042a
commit 7871193f79
44 changed files with 373 additions and 558 deletions
+263 -441
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -37,7 +37,7 @@ use polkadot_node_primitives::{
};
use polkadot_node_subsystem::messages::{CollationGenerationMessage, CollatorProtocolMessage};
use polkadot_overseer::Handle as OverseerHandle;
use polkadot_primitives::v2::{CollatorPair, Id as ParaId};
use polkadot_primitives::{CollatorPair, Id as ParaId};
use codec::{Decode, Encode};
use futures::{channel::oneshot, FutureExt};
+1 -1
View File
@@ -26,7 +26,7 @@ use codec::{Decode, Encode};
use cumulus_client_consensus_common::{
ParachainBlockImportMarker, ParachainCandidate, ParachainConsensus,
};
use cumulus_primitives_core::{relay_chain::v2::Hash as PHash, PersistedValidationData};
use cumulus_primitives_core::{relay_chain::Hash as PHash, PersistedValidationData};
use futures::lock::Mutex;
use sc_client_api::{backend::AuxStore, BlockOf};
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use polkadot_primitives::v2::{Hash as PHash, PersistedValidationData};
use polkadot_primitives::{Hash as PHash, PersistedValidationData};
use sc_client_api::Backend;
use sc_consensus::{shared_data::SharedData, BlockImport, ImportResult};
@@ -25,7 +25,7 @@ use sp_runtime::traits::{Block as BlockT, Header as HeaderT};
use cumulus_client_pov_recovery::{RecoveryDelay, RecoveryKind, RecoveryRequest};
use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult};
use polkadot_primitives::v2::{Hash as PHash, Id as ParaId, OccupiedCoreAssumption};
use polkadot_primitives::{Hash as PHash, Id as ParaId, OccupiedCoreAssumption};
use codec::Decode;
use futures::{channel::mpsc::Sender, pin_mut, select, FutureExt, Stream, StreamExt};
@@ -36,7 +36,7 @@
use cumulus_client_consensus_common::{
ParachainBlockImportMarker, ParachainCandidate, ParachainConsensus,
};
use cumulus_primitives_core::{relay_chain::v2::Hash as PHash, ParaId, PersistedValidationData};
use cumulus_primitives_core::{relay_chain::Hash as PHash, ParaId, PersistedValidationData};
use cumulus_relay_chain_interface::RelayChainInterface;
use sc_consensus::{BlockImport, BlockImportParams};
+1 -1
View File
@@ -29,7 +29,7 @@ use sp_runtime::traits::{Block as BlockT, Header as HeaderT};
use cumulus_relay_chain_interface::RelayChainInterface;
use polkadot_node_primitives::{CollationSecondedSignal, Statement};
use polkadot_parachain::primitives::HeadData;
use polkadot_primitives::v2::{
use polkadot_primitives::{
CandidateReceipt, CompactStatement, Hash as PHash, Id as ParaId, OccupiedCoreAssumption,
SigningContext, UncheckedSigned,
};
+1 -1
View File
@@ -24,7 +24,7 @@ use cumulus_test_service::runtime::{Block, Hash, Header};
use futures::{executor::block_on, poll, task::Poll, FutureExt, Stream, StreamExt};
use parking_lot::Mutex;
use polkadot_node_primitives::{SignedFullStatement, Statement};
use polkadot_primitives::v2::{
use polkadot_primitives::{
CandidateCommitments, CandidateDescriptor, CollatorPair, CommittedCandidateReceipt,
Hash as PHash, HeadData, InboundDownwardMessage, InboundHrmpMessage, OccupiedCoreAssumption,
PersistedValidationData, SessionIndex, SigningContext, ValidationCodeHash, ValidatorId,
+1 -1
View File
@@ -48,7 +48,7 @@ use sp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor};
use polkadot_node_primitives::{AvailableData, POV_BOMB_LIMIT};
use polkadot_overseer::Handle as OverseerHandle;
use polkadot_primitives::v2::{
use polkadot_primitives::{
CandidateReceipt, CommittedCandidateReceipt, Id as ParaId, SessionIndex,
};
@@ -19,9 +19,9 @@ use std::{pin::Pin, sync::Arc, time::Duration};
use async_trait::async_trait;
use cumulus_primitives_core::{
relay_chain::{
runtime_api::ParachainHost,
v2::{CommittedCandidateReceipt, OccupiedCoreAssumption, SessionIndex, ValidatorId},
Block as PBlock, BlockId, Hash as PHash, Header as PHeader, InboundHrmpMessage,
runtime_api::ParachainHost, Block as PBlock, BlockId, CommittedCandidateReceipt,
Hash as PHash, Header as PHeader, InboundHrmpMessage, OccupiedCoreAssumption, SessionIndex,
ValidatorId,
},
InboundDownwardMessage, ParaId, PersistedValidationData,
};
@@ -388,7 +388,7 @@ pub fn build_inprocess_relay_chain(
mod tests {
use super::*;
use polkadot_primitives::v2::Block as PBlock;
use polkadot_primitives::Block as PBlock;
use polkadot_test_client::{
construct_transfer_extrinsic, BlockBuilderExt, Client, ClientBlockImportExt,
DefaultTestClientBuilderExt, ExecutionStrategy, InitPolkadotBlockBuilder,
@@ -29,8 +29,8 @@ use sp_api::ApiError;
pub use cumulus_primitives_core::{
relay_chain::{
v2::{CommittedCandidateReceipt, OccupiedCoreAssumption, SessionIndex, ValidatorId},
Hash as PHash, Header as PHeader, InboundHrmpMessage,
CommittedCandidateReceipt, Hash as PHash, Header as PHeader, InboundHrmpMessage,
OccupiedCoreAssumption, SessionIndex, ValidatorId,
},
InboundDownwardMessage, ParaId, PersistedValidationData,
};
@@ -82,7 +82,7 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
async fn validators(
&self,
at: Hash,
) -> Result<Vec<polkadot_primitives::v2::ValidatorId>, sp_api::ApiError> {
) -> Result<Vec<polkadot_primitives::ValidatorId>, sp_api::ApiError> {
Ok(self.rpc_client.parachain_host_validators(at).await?)
}
@@ -91,8 +91,8 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
at: Hash,
) -> Result<
(
Vec<Vec<polkadot_primitives::v2::ValidatorIndex>>,
polkadot_primitives::v2::GroupRotationInfo<polkadot_core_primitives::BlockNumber>,
Vec<Vec<polkadot_primitives::ValidatorIndex>>,
polkadot_primitives::GroupRotationInfo<polkadot_core_primitives::BlockNumber>,
),
sp_api::ApiError,
> {
@@ -103,7 +103,7 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
&self,
at: Hash,
) -> Result<
Vec<polkadot_primitives::v2::CoreState<Hash, polkadot_core_primitives::BlockNumber>>,
Vec<polkadot_primitives::CoreState<Hash, polkadot_core_primitives::BlockNumber>>,
sp_api::ApiError,
> {
Ok(self.rpc_client.parachain_host_availability_cores(at).await?)
@@ -113,7 +113,7 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
&self,
at: Hash,
para_id: cumulus_primitives_core::ParaId,
assumption: polkadot_primitives::v2::OccupiedCoreAssumption,
assumption: polkadot_primitives::OccupiedCoreAssumption,
) -> Result<
Option<
cumulus_primitives_core::PersistedValidationData<
@@ -140,7 +140,7 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
Hash,
polkadot_core_primitives::BlockNumber,
>,
polkadot_primitives::v2::ValidationCodeHash,
polkadot_primitives::ValidationCodeHash,
)>,
sp_api::ApiError,
> {
@@ -158,7 +158,7 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
&self,
at: Hash,
para_id: cumulus_primitives_core::ParaId,
outputs: polkadot_primitives::v2::CandidateCommitments,
outputs: polkadot_primitives::CandidateCommitments,
) -> Result<bool, sp_api::ApiError> {
Ok(self
.rpc_client
@@ -169,7 +169,7 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
async fn session_index_for_child(
&self,
at: Hash,
) -> Result<polkadot_primitives::v2::SessionIndex, sp_api::ApiError> {
) -> Result<polkadot_primitives::SessionIndex, sp_api::ApiError> {
Ok(self.rpc_client.parachain_host_session_index_for_child(at).await?)
}
@@ -177,8 +177,8 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
&self,
at: Hash,
para_id: cumulus_primitives_core::ParaId,
assumption: polkadot_primitives::v2::OccupiedCoreAssumption,
) -> Result<Option<polkadot_primitives::v2::ValidationCode>, sp_api::ApiError> {
assumption: polkadot_primitives::OccupiedCoreAssumption,
) -> Result<Option<polkadot_primitives::ValidationCode>, sp_api::ApiError> {
Ok(self.rpc_client.parachain_host_validation_code(at, para_id, assumption).await?)
}
@@ -186,8 +186,7 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
&self,
at: Hash,
para_id: cumulus_primitives_core::ParaId,
) -> Result<Option<polkadot_primitives::v2::CommittedCandidateReceipt<Hash>>, sp_api::ApiError>
{
) -> Result<Option<polkadot_primitives::CommittedCandidateReceipt<Hash>>, sp_api::ApiError> {
Ok(self
.rpc_client
.parachain_host_candidate_pending_availability(at, para_id)
@@ -197,7 +196,7 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
async fn candidate_events(
&self,
at: Hash,
) -> Result<Vec<polkadot_primitives::v2::CandidateEvent<Hash>>, sp_api::ApiError> {
) -> Result<Vec<polkadot_primitives::CandidateEvent<Hash>>, sp_api::ApiError> {
Ok(self.rpc_client.parachain_host_candidate_events(at).await?)
}
@@ -234,8 +233,8 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
async fn validation_code_by_hash(
&self,
at: Hash,
validation_code_hash: polkadot_primitives::v2::ValidationCodeHash,
) -> Result<Option<polkadot_primitives::v2::ValidationCode>, sp_api::ApiError> {
validation_code_hash: polkadot_primitives::ValidationCodeHash,
) -> Result<Option<polkadot_primitives::ValidationCode>, sp_api::ApiError> {
Ok(self
.rpc_client
.parachain_host_validation_code_by_hash(at, validation_code_hash)
@@ -245,31 +244,31 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
async fn on_chain_votes(
&self,
at: Hash,
) -> Result<Option<polkadot_primitives::v2::ScrapedOnChainVotes<Hash>>, sp_api::ApiError> {
) -> Result<Option<polkadot_primitives::ScrapedOnChainVotes<Hash>>, sp_api::ApiError> {
Ok(self.rpc_client.parachain_host_on_chain_votes(at).await?)
}
async fn session_info(
&self,
at: Hash,
index: polkadot_primitives::v2::SessionIndex,
) -> Result<Option<polkadot_primitives::v2::SessionInfo>, sp_api::ApiError> {
index: polkadot_primitives::SessionIndex,
) -> Result<Option<polkadot_primitives::SessionInfo>, sp_api::ApiError> {
Ok(self.rpc_client.parachain_host_session_info(at, index).await?)
}
async fn session_info_before_version_2(
&self,
at: Hash,
index: polkadot_primitives::v2::SessionIndex,
) -> Result<Option<polkadot_primitives::v2::OldV1SessionInfo>, sp_api::ApiError> {
index: polkadot_primitives::SessionIndex,
) -> Result<Option<polkadot_primitives::OldV1SessionInfo>, sp_api::ApiError> {
Ok(self.rpc_client.parachain_host_session_info_before_version_2(at, index).await?)
}
async fn submit_pvf_check_statement(
&self,
at: Hash,
stmt: polkadot_primitives::v2::PvfCheckStatement,
signature: polkadot_primitives::v2::ValidatorSignature,
stmt: polkadot_primitives::PvfCheckStatement,
signature: polkadot_primitives::ValidatorSignature,
) -> Result<(), sp_api::ApiError> {
Ok(self
.rpc_client
@@ -280,7 +279,7 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
async fn pvfs_require_precheck(
&self,
at: Hash,
) -> Result<Vec<polkadot_primitives::v2::ValidationCodeHash>, sp_api::ApiError> {
) -> Result<Vec<polkadot_primitives::ValidationCodeHash>, sp_api::ApiError> {
Ok(self.rpc_client.parachain_host_pvfs_require_precheck(at).await?)
}
@@ -288,8 +287,8 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
&self,
at: Hash,
para_id: cumulus_primitives_core::ParaId,
assumption: polkadot_primitives::v2::OccupiedCoreAssumption,
) -> Result<Option<polkadot_primitives::v2::ValidationCodeHash>, sp_api::ApiError> {
assumption: polkadot_primitives::OccupiedCoreAssumption,
) -> Result<Option<polkadot_primitives::ValidationCodeHash>, sp_api::ApiError> {
Ok(self
.rpc_client
.parachain_host_validation_code_hash(at, para_id, assumption)
@@ -303,7 +302,7 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
async fn authorities(
&self,
at: Hash,
) -> std::result::Result<Vec<polkadot_primitives::v2::AuthorityDiscoveryId>, sp_api::ApiError> {
) -> std::result::Result<Vec<polkadot_primitives::AuthorityDiscoveryId>, sp_api::ApiError> {
Ok(self.rpc_client.authority_discovery_authorities(at).await?)
}
@@ -317,9 +316,9 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
at: Hash,
) -> Result<
Vec<(
polkadot_primitives::v2::SessionIndex,
polkadot_primitives::v2::CandidateHash,
polkadot_primitives::v2::DisputeState<polkadot_primitives::v2::BlockNumber>,
polkadot_primitives::SessionIndex,
polkadot_primitives::CandidateHash,
polkadot_primitives::DisputeState<polkadot_primitives::BlockNumber>,
)>,
ApiError,
> {
@@ -332,7 +331,7 @@ impl AuthorityDiscovery<Block> for BlockChainRpcClient {
async fn authorities(
&self,
at: Hash,
) -> std::result::Result<Vec<polkadot_primitives::v2::AuthorityDiscoveryId>, sp_api::ApiError> {
) -> std::result::Result<Vec<polkadot_primitives::AuthorityDiscoveryId>, sp_api::ApiError> {
let result = self.rpc_client.authority_discovery_authorities(at).await?;
Ok(result)
}
@@ -28,7 +28,7 @@ use polkadot_overseer::{
BlockInfo, DummySubsystem, MetricsTrait, Overseer, OverseerHandle, OverseerMetrics, SpawnGlue,
KNOWN_LEAVES_CACHE_SIZE,
};
use polkadot_primitives::v2::CollatorPair;
use polkadot_primitives::CollatorPair;
use polkadot_service::{
overseer::{
AvailabilityRecoverySubsystem, CollationGenerationSubsystem, CollatorProtocolSubsystem,
@@ -25,7 +25,7 @@ use polkadot_node_network_protocol::{
};
use polkadot_node_subsystem_util::metrics::prometheus::Registry;
use polkadot_primitives::v2::CollatorPair;
use polkadot_primitives::CollatorPair;
use sc_authority_discovery::Service as AuthorityDiscoveryService;
use sc_network::{Event, NetworkService};
@@ -18,8 +18,8 @@ use async_trait::async_trait;
use core::time::Duration;
use cumulus_primitives_core::{
relay_chain::{
v2::{CommittedCandidateReceipt, OccupiedCoreAssumption, SessionIndex, ValidatorId},
Hash as RelayHash, Header as RelayHeader, InboundHrmpMessage,
CommittedCandidateReceipt, Hash as RelayHash, Header as RelayHeader, InboundHrmpMessage,
OccupiedCoreAssumption, SessionIndex, ValidatorId,
},
InboundDownwardMessage, ParaId, PersistedValidationData,
};
@@ -17,13 +17,11 @@
use crate::reconnecting_ws_client::ReconnectingWsClient;
use cumulus_primitives_core::{
relay_chain::{
v2::{
CandidateCommitments, CandidateEvent, CommittedCandidateReceipt, CoreState,
DisputeState, GroupRotationInfo, OccupiedCoreAssumption, OldV1SessionInfo,
PvfCheckStatement, ScrapedOnChainVotes, SessionIndex, SessionInfo, ValidationCode,
ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature,
},
CandidateHash, Hash as RelayHash, Header as RelayHeader, InboundHrmpMessage,
CandidateCommitments, CandidateEvent, CandidateHash, CommittedCandidateReceipt, CoreState,
DisputeState, GroupRotationInfo, Hash as RelayHash, Header as RelayHeader,
InboundHrmpMessage, OccupiedCoreAssumption, OldV1SessionInfo, PvfCheckStatement,
ScrapedOnChainVotes, SessionIndex, SessionInfo, ValidationCode, ValidationCodeHash,
ValidatorId, ValidatorIndex, ValidatorSignature,
},
InboundDownwardMessage, ParaId, PersistedValidationData,
};
+1 -1
View File
@@ -25,7 +25,7 @@ use cumulus_primitives_core::{CollectCollationInfo, ParaId};
use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain;
use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult};
use cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node;
use polkadot_primitives::v2::CollatorPair;
use polkadot_primitives::CollatorPair;
use sc_client_api::{
Backend as BackendT, BlockBackend, BlockchainEvents, Finalizer, UsageProvider,
+5 -5
View File
@@ -376,7 +376,7 @@ pub mod pallet {
.read_upgrade_go_ahead_signal()
.expect("Invalid upgrade go ahead signal");
match upgrade_go_ahead_signal {
Some(relay_chain::v2::UpgradeGoAhead::GoAhead) => {
Some(relay_chain::UpgradeGoAhead::GoAhead) => {
assert!(
<PendingValidationCode<T>>::exists(),
"No new validation function found in storage, GoAhead signal is not expected",
@@ -389,7 +389,7 @@ pub mod pallet {
relay_chain_block_num: vfp.relay_parent_number,
});
},
Some(relay_chain::v2::UpgradeGoAhead::Abort) => {
Some(relay_chain::UpgradeGoAhead::Abort) => {
<PendingValidationCode<T>>::kill();
Self::deposit_event(Event::ValidationFunctionDiscarded);
},
@@ -546,7 +546,7 @@ pub mod pallet {
/// set after the inherent.
#[pallet::storage]
pub(super) type UpgradeRestrictionSignal<T: Config> =
StorageValue<_, Option<relay_chain::v2::UpgradeRestriction>, ValueQuery>;
StorageValue<_, Option<relay_chain::UpgradeRestriction>, ValueQuery>;
/// The state proof for the last relay parent block.
///
@@ -605,7 +605,7 @@ pub mod pallet {
/// This will be cleared in `on_initialize` of each new block.
#[pallet::storage]
pub(super) type HrmpWatermark<T: Config> =
StorageValue<_, relay_chain::v2::BlockNumber, ValueQuery>;
StorageValue<_, relay_chain::BlockNumber, ValueQuery>;
/// HRMP messages that were sent in a block.
///
@@ -828,7 +828,7 @@ impl<T: Config> Pallet<T> {
fn process_inbound_horizontal_messages(
ingress_channels: &[(ParaId, cumulus_primitives_core::AbridgedHrmpChannel)],
horizontal_messages: BTreeMap<ParaId, Vec<InboundHrmpMessage>>,
relay_parent_number: relay_chain::v2::BlockNumber,
relay_parent_number: relay_chain::BlockNumber,
) -> Weight {
// First, check that all submitted messages are sent from channels that exist. The
// channel exists if its MQC head is present in `vfp.hrmp_mqc_heads`.
@@ -149,7 +149,7 @@ impl RelayChainStateProof {
/// `proof`.
pub fn new(
para_id: ParaId,
relay_parent_storage_root: relay_chain::v2::Hash,
relay_parent_storage_root: relay_chain::Hash,
proof: StorageProof,
) -> Result<Self, Error> {
let db = proof.into_memory_db::<HashFor<relay_chain::Block>>();
@@ -195,7 +195,7 @@ impl RelayChainStateProof {
let mut ingress_channels = Vec::with_capacity(ingress_channel_index.len());
for sender in ingress_channel_index {
let channel_id = relay_chain::v2::HrmpChannelId { sender, recipient: self.para_id };
let channel_id = relay_chain::HrmpChannelId { sender, recipient: self.para_id };
let hrmp_channel: AbridgedHrmpChannel = read_entry(
&self.trie_backend,
&relay_chain::well_known_keys::hrmp_channels(channel_id),
@@ -207,7 +207,7 @@ impl RelayChainStateProof {
let mut egress_channels = Vec::with_capacity(egress_channel_index.len());
for recipient in egress_channel_index {
let channel_id = relay_chain::v2::HrmpChannelId { sender: self.para_id, recipient };
let channel_id = relay_chain::HrmpChannelId { sender: self.para_id, recipient };
let hrmp_channel: AbridgedHrmpChannel = read_entry(
&self.trie_backend,
&relay_chain::well_known_keys::hrmp_channels(channel_id),
@@ -235,12 +235,12 @@ impl RelayChainStateProof {
.map_err(Error::Config)
}
/// Read the [`Slot`](relay_chain::v2::Slot) from the relay chain state proof.
/// Read the [`Slot`](relay_chain::Slot) from the relay chain state proof.
///
/// The slot is slot of the relay chain block this state proof was extracted from.
///
/// Returns an error if anything failed at reading or decoding.
pub fn read_slot(&self) -> Result<relay_chain::v2::Slot, Error> {
pub fn read_slot(&self) -> Result<relay_chain::Slot, Error> {
read_entry(&self.trie_backend, relay_chain::well_known_keys::CURRENT_SLOT, None)
.map_err(Error::Slot)
}
@@ -254,7 +254,7 @@ impl RelayChainStateProof {
/// Returns an error if anything failed at reading or decoding.
pub fn read_upgrade_go_ahead_signal(
&self,
) -> Result<Option<relay_chain::v2::UpgradeGoAhead>, Error> {
) -> Result<Option<relay_chain::UpgradeGoAhead>, Error> {
read_optional_entry(
&self.trie_backend,
&relay_chain::well_known_keys::upgrade_go_ahead_signal(self.para_id),
@@ -270,7 +270,7 @@ impl RelayChainStateProof {
/// Returns an error if anything failed at reading or decoding.
pub fn read_upgrade_restriction_signal(
&self,
) -> Result<Option<relay_chain::v2::UpgradeRestriction>, Error> {
) -> Result<Option<relay_chain::UpgradeRestriction>, Error> {
read_optional_entry(
&self.trie_backend,
&relay_chain::well_known_keys::upgrade_restriction_signal(self.para_id),
@@ -31,7 +31,7 @@ use frame_support::{
};
use frame_system::RawOrigin;
use hex_literal::hex;
use relay_chain::v2::HrmpChannelId;
use relay_chain::HrmpChannelId;
use sp_core::H256;
use sp_runtime::{
testing::Header,
@@ -391,7 +391,7 @@ fn events() {
BlockTests::new()
.with_relay_sproof_builder(|_, block_number, builder| {
if block_number > 123 {
builder.upgrade_go_ahead = Some(relay_chain::v2::UpgradeGoAhead::GoAhead);
builder.upgrade_go_ahead = Some(relay_chain::UpgradeGoAhead::GoAhead);
}
})
.add_with_post_test(
@@ -445,7 +445,7 @@ fn manipulates_storage() {
BlockTests::new()
.with_relay_sproof_builder(|_, block_number, builder| {
if block_number > 123 {
builder.upgrade_go_ahead = Some(relay_chain::v2::UpgradeGoAhead::GoAhead);
builder.upgrade_go_ahead = Some(relay_chain::UpgradeGoAhead::GoAhead);
}
})
.add(123, || {
@@ -473,7 +473,7 @@ fn aborted_upgrade() {
BlockTests::new()
.with_relay_sproof_builder(|_, block_number, builder| {
if block_number > 123 {
builder.upgrade_go_ahead = Some(relay_chain::v2::UpgradeGoAhead::Abort);
builder.upgrade_go_ahead = Some(relay_chain::UpgradeGoAhead::Abort);
}
})
.add(123, || {
@@ -18,7 +18,7 @@
use super::MemoryOptimizedValidationParams;
use cumulus_primitives_core::{
relay_chain::v2::Hash as RHash, ParachainBlockData, PersistedValidationData,
relay_chain::Hash as RHash, ParachainBlockData, PersistedValidationData,
};
use cumulus_primitives_parachain_inherent::ParachainInherentData;
@@ -53,6 +53,6 @@ pub use sp_std;
pub struct MemoryOptimizedValidationParams {
pub parent_head: bytes::Bytes,
pub block_data: bytes::Bytes,
pub relay_parent_number: cumulus_primitives_core::relay_chain::v2::BlockNumber,
pub relay_parent_storage_root: cumulus_primitives_core::relay_chain::v2::Hash,
pub relay_parent_number: cumulus_primitives_core::relay_chain::BlockNumber,
pub relay_parent_storage_root: cumulus_primitives_core::relay_chain::Hash,
}
+1 -1
View File
@@ -20,7 +20,7 @@ use cumulus_pallet_parachain_system as parachain_system;
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
pub use pallet::*;
use polkadot_primitives::v2::PersistedValidationData;
use polkadot_primitives::PersistedValidationData;
use sp_std::vec::Vec;
#[frame_support::pallet]
@@ -277,7 +277,7 @@ pub fn run() -> Result<()> {
let id = ParaId::from(para_id);
let parachain_account =
AccountIdConversion::<polkadot_primitives::v2::AccountId>::into_account_truncating(&id);
AccountIdConversion::<polkadot_primitives::AccountId>::into_account_truncating(&id);
let state_version = Cli::native_runtime_version(&config.chain_spec).state_version();
let block: Block = generate_genesis_block(&*config.chain_spec, state_version)
@@ -219,7 +219,7 @@ const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for 0.5 of a second of compute with a 12 second average block time.
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64,
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64,
);
/// The version information used to identify this runtime when compiled natively.
+4 -7
View File
@@ -39,8 +39,7 @@ pub struct ToStakingPot<R>(PhantomData<R>);
impl<R> OnUnbalanced<NegativeImbalance<R>> for ToStakingPot<R>
where
R: pallet_balances::Config + pallet_collator_selection::Config,
AccountIdOf<R>:
From<polkadot_primitives::v2::AccountId> + Into<polkadot_primitives::v2::AccountId>,
AccountIdOf<R>: From<polkadot_primitives::AccountId> + Into<polkadot_primitives::AccountId>,
<R as frame_system::Config>::RuntimeEvent: From<pallet_balances::Event<R>>,
{
fn on_nonzero_unbalanced(amount: NegativeImbalance<R>) {
@@ -55,8 +54,7 @@ pub struct DealWithFees<R>(PhantomData<R>);
impl<R> OnUnbalanced<NegativeImbalance<R>> for DealWithFees<R>
where
R: pallet_balances::Config + pallet_collator_selection::Config,
AccountIdOf<R>:
From<polkadot_primitives::v2::AccountId> + Into<polkadot_primitives::v2::AccountId>,
AccountIdOf<R>: From<polkadot_primitives::AccountId> + Into<polkadot_primitives::AccountId>,
<R as frame_system::Config>::RuntimeEvent: From<pallet_balances::Event<R>>,
{
fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance<R>>) {
@@ -75,8 +73,7 @@ pub struct AssetsToBlockAuthor<R>(PhantomData<R>);
impl<R> HandleCredit<AccountIdOf<R>, pallet_assets::Pallet<R>> for AssetsToBlockAuthor<R>
where
R: pallet_authorship::Config + pallet_assets::Config,
AccountIdOf<R>:
From<polkadot_primitives::v2::AccountId> + Into<polkadot_primitives::v2::AccountId>,
AccountIdOf<R>: From<polkadot_primitives::AccountId> + Into<polkadot_primitives::AccountId>,
{
fn handle_credit(credit: CreditOf<AccountIdOf<R>, pallet_assets::Pallet<R>>) {
if let Some(author) = pallet_authorship::Pallet::<R>::author() {
@@ -119,7 +116,7 @@ mod tests {
};
use frame_system::{limits, EnsureRoot};
use pallet_collator_selection::IdentityCollator;
use polkadot_primitives::v2::AccountId;
use polkadot_primitives::AccountId;
use sp_core::H256;
use sp_runtime::{
testing::Header,
+1 -1
View File
@@ -94,7 +94,7 @@ mod constants {
/// We allow for 0.5 seconds of compute with a 6 second average block time.
pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
polkadot_primitives::v2::MAX_POV_SIZE as u64,
polkadot_primitives::MAX_POV_SIZE as u64,
);
}
+1 -1
View File
@@ -93,7 +93,7 @@ where
<Runtime as pallet_assets::Config>::Balance,
>,
AccountIdOf<Runtime>:
From<polkadot_primitives::v2::AccountId> + Into<polkadot_primitives::v2::AccountId>,
From<polkadot_primitives::AccountId> + Into<polkadot_primitives::AccountId>,
{
fn charge_weight_in_fungibles(
asset_id: <pallet_assets::Pallet<Runtime> as Inspect<AccountIdOf<Runtime>>>::AssetId,
@@ -89,7 +89,7 @@ const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for .5 seconds of compute with a 12 second average block time.
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64,
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64,
);
parameter_types! {
@@ -96,7 +96,7 @@ const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for .5 seconds of compute with a 12 second average block time.
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64,
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64,
);
parameter_types! {
@@ -236,7 +236,7 @@ const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for 0.5 of a second of compute with a 12 second average block time.
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64,
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64,
);
/// The version information used to identify this runtime when compiled natively.
@@ -198,8 +198,7 @@ pub struct AssetsToBlockAuthor<R>(PhantomData<R>);
impl<R> HandleCredit<AccountIdOf<R>, pallet_assets::Pallet<R>> for AssetsToBlockAuthor<R>
where
R: pallet_authorship::Config + pallet_assets::Config,
AccountIdOf<R>:
From<polkadot_primitives::v2::AccountId> + Into<polkadot_primitives::v2::AccountId>,
AccountIdOf<R>: From<polkadot_primitives::AccountId> + Into<polkadot_primitives::AccountId>,
{
fn handle_credit(credit: CreditOf<AccountIdOf<R>, pallet_assets::Pallet<R>>) {
if let Some(author) = pallet_authorship::Pallet::<R>::author() {
@@ -141,7 +141,7 @@ const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for .5 seconds of compute with a 12 second average block time.
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64,
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64,
);
parameter_types! {
+1 -1
View File
@@ -781,7 +781,7 @@ pub fn run() -> Result<()> {
let id = ParaId::from(para_id);
let parachain_account =
AccountIdConversion::<polkadot_primitives::v2::AccountId>::into_account_truncating(&id);
AccountIdConversion::<polkadot_primitives::AccountId>::into_account_truncating(&id);
let state_version = Cli::native_runtime_version(&config.chain_spec).state_version();
+1 -1
View File
@@ -26,7 +26,7 @@ use cumulus_client_service::{
StartCollatorParams, StartFullNodeParams,
};
use cumulus_primitives_core::{
relay_chain::v2::{Hash as PHash, PersistedValidationData},
relay_chain::{Hash as PHash, PersistedValidationData},
ParaId,
};
use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface};
+8 -8
View File
@@ -28,21 +28,21 @@ pub use polkadot_parachain::primitives::{
DmpMessageHandler, Id as ParaId, IsSystem, UpwardMessage, ValidationParams, XcmpMessageFormat,
XcmpMessageHandler,
};
pub use polkadot_primitives::v2::{
pub use polkadot_primitives::{
AbridgedHostConfiguration, AbridgedHrmpChannel, PersistedValidationData,
};
/// A module that re-exports relevant relay chain definitions.
pub mod relay_chain {
pub use polkadot_core_primitives::*;
pub use polkadot_primitives::{runtime_api, v2, v2::well_known_keys};
pub use polkadot_primitives::*;
}
/// An inbound HRMP message.
pub type InboundHrmpMessage = polkadot_primitives::v2::InboundHrmpMessage<relay_chain::BlockNumber>;
pub type InboundHrmpMessage = polkadot_primitives::InboundHrmpMessage<relay_chain::BlockNumber>;
/// And outbound HRMP message
pub type OutboundHrmpMessage = polkadot_primitives::v2::OutboundHrmpMessage<ParaId>;
pub type OutboundHrmpMessage = polkadot_primitives::OutboundHrmpMessage<ParaId>;
/// Error description of a message send failure.
#[derive(Eq, PartialEq, Copy, Clone, RuntimeDebug, Encode, Decode)]
@@ -204,11 +204,11 @@ pub struct CollationInfoV1 {
/// The horizontal messages sent by the parachain.
pub horizontal_messages: Vec<OutboundHrmpMessage>,
/// New validation code.
pub new_validation_code: Option<relay_chain::v2::ValidationCode>,
pub new_validation_code: Option<relay_chain::ValidationCode>,
/// The number of messages processed from the DMQ.
pub processed_downward_messages: u32,
/// The mark which specifies the block number up to which all inbound HRMP messages are processed.
pub hrmp_watermark: relay_chain::v2::BlockNumber,
pub hrmp_watermark: relay_chain::BlockNumber,
}
impl CollationInfoV1 {
@@ -233,11 +233,11 @@ pub struct CollationInfo {
/// The horizontal messages sent by the parachain.
pub horizontal_messages: Vec<OutboundHrmpMessage>,
/// New validation code.
pub new_validation_code: Option<relay_chain::v2::ValidationCode>,
pub new_validation_code: Option<relay_chain::ValidationCode>,
/// The number of messages processed from the DMQ.
pub processed_downward_messages: u32,
/// The mark which specifies the block number up to which all inbound HRMP messages are processed.
pub hrmp_watermark: relay_chain::v2::BlockNumber,
pub hrmp_watermark: relay_chain::BlockNumber,
/// The head data, aka encoded header, of the block that corresponds to the collation.
pub head_data: HeadData,
}
@@ -19,7 +19,7 @@
use crate::ParachainInherentData;
use codec::Decode;
use cumulus_primitives_core::{
relay_chain::{self, v2::HrmpChannelId, Hash as PHash},
relay_chain::{self, Hash as PHash, HrmpChannelId},
ParaId, PersistedValidationData,
};
use cumulus_relay_chain_interface::RelayChainInterface;
+1 -1
View File
@@ -27,7 +27,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
use cumulus_primitives_core::relay_chain::v2::Slot;
use cumulus_primitives_core::relay_chain::Slot;
use sp_inherents::{Error, InherentData};
use sp_std::time::Duration;
+1 -1
View File
@@ -19,7 +19,7 @@ use cumulus_primitives_core::{ParachainBlockData, PersistedValidationData};
use cumulus_primitives_parachain_inherent::{ParachainInherentData, INHERENT_IDENTIFIER};
use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder;
use cumulus_test_runtime::{Block, GetLastTimestamp, Hash, Header};
use polkadot_primitives::v2::{BlockNumber as PBlockNumber, Hash as PHash};
use polkadot_primitives::{BlockNumber as PBlockNumber, Hash as PHash};
use sc_block_builder::{BlockBuilder, BlockBuilderProvider};
use sp_api::ProvideRuntimeApi;
use sp_runtime::{
+6 -6
View File
@@ -17,7 +17,7 @@
use cumulus_primitives_core::{
relay_chain, AbridgedHostConfiguration, AbridgedHrmpChannel, ParaId,
};
use polkadot_primitives::v2::UpgradeGoAhead;
use polkadot_primitives::UpgradeGoAhead;
use sp_runtime::traits::HashFor;
use sp_state_machine::MemoryDB;
use sp_std::collections::btree_map::BTreeMap;
@@ -41,8 +41,8 @@ pub struct RelayStateSproofBuilder {
pub relay_dispatch_queue_size: Option<(u32, u32)>,
pub hrmp_ingress_channel_index: Option<Vec<ParaId>>,
pub hrmp_egress_channel_index: Option<Vec<ParaId>>,
pub hrmp_channels: BTreeMap<relay_chain::v2::HrmpChannelId, AbridgedHrmpChannel>,
pub current_slot: relay_chain::v2::Slot,
pub hrmp_channels: BTreeMap<relay_chain::HrmpChannelId, AbridgedHrmpChannel>,
pub current_slot: relay_chain::Slot,
pub current_epoch: u64,
pub randomness: relay_chain::Hash,
}
@@ -88,7 +88,7 @@ impl RelayStateSproofBuilder {
}
self.hrmp_channels
.entry(relay_chain::v2::HrmpChannelId { sender, recipient: self.para_id })
.entry(relay_chain::HrmpChannelId { sender, recipient: self.para_id })
.or_insert_with(|| AbridgedHrmpChannel {
max_capacity: 0,
max_total_size: 0,
@@ -101,8 +101,8 @@ impl RelayStateSproofBuilder {
pub fn into_state_root_and_proof(
self,
) -> (polkadot_primitives::v2::Hash, sp_state_machine::StorageProof) {
let (db, root) = MemoryDB::<HashFor<polkadot_primitives::v2::Block>>::default_with_root();
) -> (polkadot_primitives::Hash, sp_state_machine::StorageProof) {
let (db, root) = MemoryDB::<HashFor<polkadot_primitives::Block>>::default_with_root();
let state_version = Default::default(); // for test using default.
let mut backend = sp_state_machine::TrieBackendBuilder::new(db, root).build();
+1 -1
View File
@@ -144,7 +144,7 @@ const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for .5 seconds of compute with a 12 second average block time.
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64,
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64,
);
parameter_types! {
+1 -1
View File
@@ -18,7 +18,7 @@ use codec::Encode;
use cumulus_client_cli::generate_genesis_block;
use cumulus_primitives_core::ParaId;
use cumulus_test_runtime::Block;
use polkadot_primitives::v2::HeadData;
use polkadot_primitives::HeadData;
use sp_runtime::traits::Block as BlockT;
/// Returns the initial head data for a parachain ID.
+1 -1
View File
@@ -45,7 +45,7 @@ use cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node;
use cumulus_test_runtime::{Hash, Header, NodeBlock as Block, RuntimeApi};
use frame_system_rpc_runtime_api::AccountNonceApi;
use polkadot_primitives::v2::{CollatorPair, Hash as PHash, PersistedValidationData};
use polkadot_primitives::{CollatorPair, Hash as PHash, PersistedValidationData};
use polkadot_service::ProvideRuntimeApi;
use sc_client_api::execution_extensions::ExecutionStrategies;
use sc_consensus::ImportQueue;
+2 -2
View File
@@ -20,7 +20,7 @@ use std::{io::Write, sync::Arc};
use cli::{RelayChainCli, Subcommand, TestCollatorCli};
use cumulus_client_cli::generate_genesis_block;
use cumulus_primitives_core::{relay_chain::v2::CollatorPair, ParaId};
use cumulus_primitives_core::{relay_chain::CollatorPair, ParaId};
use cumulus_test_service::AnnounceBlockFn;
use polkadot_service::runtime_traits::AccountIdConversion;
use sc_cli::{CliConfiguration, SubstrateCli};
@@ -99,7 +99,7 @@ fn main() -> Result<(), sc_cli::Error> {
);
let parachain_account =
AccountIdConversion::<polkadot_primitives::v2::AccountId>::into_account_truncating(
AccountIdConversion::<polkadot_primitives::AccountId>::into_account_truncating(
&parachain_id,
);