mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 23:15:42 +00:00
Move non runtime related stuff into node/primitives (#2743)
* Remove stuff out of the runtime that does not belong there. There might be more, but it is a start. * White space fixes. * Fix tests. * Leave whitespace in ui tests alone. * Add back zstd for no reason. * Fix browser wasm (hopefully)
This commit is contained in:
Generated
+9
-1
@@ -5373,6 +5373,7 @@ dependencies = [
|
|||||||
"polkadot-erasure-coding",
|
"polkadot-erasure-coding",
|
||||||
"polkadot-node-core-runtime-api",
|
"polkadot-node-core-runtime-api",
|
||||||
"polkadot-node-network-protocol",
|
"polkadot-node-network-protocol",
|
||||||
|
"polkadot-node-primitives",
|
||||||
"polkadot-node-subsystem",
|
"polkadot-node-subsystem",
|
||||||
"polkadot-node-subsystem-test-helpers",
|
"polkadot-node-subsystem-test-helpers",
|
||||||
"polkadot-node-subsystem-util",
|
"polkadot-node-subsystem-util",
|
||||||
@@ -5403,6 +5404,7 @@ dependencies = [
|
|||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
"polkadot-erasure-coding",
|
"polkadot-erasure-coding",
|
||||||
"polkadot-node-network-protocol",
|
"polkadot-node-network-protocol",
|
||||||
|
"polkadot-node-primitives",
|
||||||
"polkadot-node-subsystem",
|
"polkadot-node-subsystem",
|
||||||
"polkadot-node-subsystem-test-helpers",
|
"polkadot-node-subsystem-test-helpers",
|
||||||
"polkadot-node-subsystem-util",
|
"polkadot-node-subsystem-util",
|
||||||
@@ -5478,6 +5480,7 @@ name = "polkadot-erasure-coding"
|
|||||||
version = "0.8.30"
|
version = "0.8.30"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
|
"polkadot-node-primitives",
|
||||||
"polkadot-primitives",
|
"polkadot-primitives",
|
||||||
"reed-solomon-novelpoly",
|
"reed-solomon-novelpoly",
|
||||||
"sp-core",
|
"sp-core",
|
||||||
@@ -5590,6 +5593,7 @@ dependencies = [
|
|||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
"parking_lot 0.11.1",
|
"parking_lot 0.11.1",
|
||||||
"polkadot-erasure-coding",
|
"polkadot-erasure-coding",
|
||||||
|
"polkadot-node-primitives",
|
||||||
"polkadot-node-subsystem",
|
"polkadot-node-subsystem",
|
||||||
"polkadot-node-subsystem-test-helpers",
|
"polkadot-node-subsystem-test-helpers",
|
||||||
"polkadot-node-subsystem-util",
|
"polkadot-node-subsystem-util",
|
||||||
@@ -5759,6 +5763,7 @@ dependencies = [
|
|||||||
"mick-jaeger",
|
"mick-jaeger",
|
||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
"parking_lot 0.11.1",
|
"parking_lot 0.11.1",
|
||||||
|
"polkadot-node-primitives",
|
||||||
"polkadot-primitives",
|
"polkadot-primitives",
|
||||||
"sc-network",
|
"sc-network",
|
||||||
"sp-core",
|
"sp-core",
|
||||||
@@ -5785,15 +5790,18 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"futures 0.3.13",
|
"futures 0.3.13",
|
||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
|
"polkadot-parachain",
|
||||||
"polkadot-primitives",
|
"polkadot-primitives",
|
||||||
"polkadot-statement-table",
|
"polkadot-statement-table",
|
||||||
"schnorrkel",
|
"schnorrkel",
|
||||||
|
"serde",
|
||||||
"sp-application-crypto",
|
"sp-application-crypto",
|
||||||
"sp-consensus-babe",
|
"sp-consensus-babe",
|
||||||
"sp-consensus-vrf",
|
"sp-consensus-vrf",
|
||||||
"sp-core",
|
"sp-core",
|
||||||
"sp-runtime",
|
"sp-runtime",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
"zstd",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5953,7 +5961,6 @@ dependencies = [
|
|||||||
"sp-trie",
|
"sp-trie",
|
||||||
"sp-version",
|
"sp-version",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"zstd",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6207,6 +6214,7 @@ dependencies = [
|
|||||||
"polkadot-node-core-proposer",
|
"polkadot-node-core-proposer",
|
||||||
"polkadot-node-core-provisioner",
|
"polkadot-node-core-provisioner",
|
||||||
"polkadot-node-core-runtime-api",
|
"polkadot-node-core-runtime-api",
|
||||||
|
"polkadot-node-primitives",
|
||||||
"polkadot-node-subsystem",
|
"polkadot-node-subsystem",
|
||||||
"polkadot-node-subsystem-util",
|
"polkadot-node-subsystem-util",
|
||||||
"polkadot-overseer",
|
"polkadot-overseer",
|
||||||
|
|||||||
@@ -72,9 +72,9 @@ impl std::fmt::Display for CandidateHash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl sp_std::fmt::Debug for CandidateHash {
|
impl sp_std::fmt::Debug for CandidateHash {
|
||||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
|
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
|
||||||
write!(f, "{:?}", self.0)
|
write!(f, "{:?}", self.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Index of a transaction in the relay chain. 32-bit should be plenty.
|
/// Index of a transaction in the relay chain. 32-bit should be plenty.
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
primitives = { package = "polkadot-primitives", path = "../primitives" }
|
polkadot-primitives = { package = "polkadot-primitives", path = "../primitives" }
|
||||||
|
polkadot-node-primitives = { package = "polkadot-node-primitives", path = "../node/primitives" }
|
||||||
novelpoly = { package = "reed-solomon-novelpoly", version = "1.0.0" }
|
novelpoly = { package = "reed-solomon-novelpoly", version = "1.0.0" }
|
||||||
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["std", "derive"] }
|
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["std", "derive"] }
|
||||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
//! The data is coded so any f+1 chunks can be used to reconstruct the full data.
|
//! The data is coded so any f+1 chunks can be used to reconstruct the full data.
|
||||||
|
|
||||||
use parity_scale_codec::{Encode, Decode};
|
use parity_scale_codec::{Encode, Decode};
|
||||||
use primitives::v0::{self, Hash as H256, BlakeTwo256, HashT};
|
use polkadot_primitives::v0::{self, Hash as H256, BlakeTwo256, HashT};
|
||||||
use primitives::v1;
|
use polkadot_node_primitives::AvailableData;
|
||||||
use sp_core::Blake2Hasher;
|
use sp_core::Blake2Hasher;
|
||||||
use trie::{EMPTY_PREFIX, MemoryDB, Trie, TrieMut, trie_types::{TrieDBMut, TrieDB}};
|
use trie::{EMPTY_PREFIX, MemoryDB, Trie, TrieMut, trie_types::{TrieDBMut, TrieDB}};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
@@ -122,7 +122,7 @@ pub fn obtain_chunks_v0(n_validators: usize, data: &v0::AvailableData)
|
|||||||
/// Obtain erasure-coded chunks for v1 `AvailableData`, one for each validator.
|
/// Obtain erasure-coded chunks for v1 `AvailableData`, one for each validator.
|
||||||
///
|
///
|
||||||
/// Works only up to 65536 validators, and `n_validators` must be non-zero.
|
/// Works only up to 65536 validators, and `n_validators` must be non-zero.
|
||||||
pub fn obtain_chunks_v1(n_validators: usize, data: &v1::AvailableData)
|
pub fn obtain_chunks_v1(n_validators: usize, data: &AvailableData)
|
||||||
-> Result<Vec<Vec<u8>>, Error>
|
-> Result<Vec<Vec<u8>>, Error>
|
||||||
{
|
{
|
||||||
obtain_chunks(n_validators, data)
|
obtain_chunks(n_validators, data)
|
||||||
@@ -169,7 +169,7 @@ pub fn reconstruct_v0<'a, I: 'a>(n_validators: usize, chunks: I)
|
|||||||
///
|
///
|
||||||
/// Works only up to 65536 validators, and `n_validators` must be non-zero.
|
/// Works only up to 65536 validators, and `n_validators` must be non-zero.
|
||||||
pub fn reconstruct_v1<'a, I: 'a>(n_validators: usize, chunks: I)
|
pub fn reconstruct_v1<'a, I: 'a>(n_validators: usize, chunks: I)
|
||||||
-> Result<v1::AvailableData, Error>
|
-> Result<AvailableData, Error>
|
||||||
where I: IntoIterator<Item=(&'a [u8], usize)>
|
where I: IntoIterator<Item=(&'a [u8], usize)>
|
||||||
{
|
{
|
||||||
reconstruct(n_validators, chunks)
|
reconstruct(n_validators, chunks)
|
||||||
@@ -368,14 +368,14 @@ impl<'a, I: Iterator<Item=&'a [u8]>> parity_scale_codec::Input for ShardInput<'a
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use primitives::v0::{AvailableData, BlockData, PoVBlock};
|
use polkadot_primitives::v0::{AvailableData, BlockData, PoVBlock};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn field_order_is_right_size() {
|
fn field_order_is_right_size() {
|
||||||
assert_eq!(MAX_VALIDATORS, 65536);
|
assert_eq!(MAX_VALIDATORS, 65536);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn round_trip_works() {
|
fn round_trip_works() {
|
||||||
let pov_block = PoVBlock {
|
let pov_block = PoVBlock {
|
||||||
block_data: BlockData((0..255).collect()),
|
block_data: BlockData((0..255).collect()),
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ use futures::{
|
|||||||
sink::SinkExt,
|
sink::SinkExt,
|
||||||
stream::StreamExt,
|
stream::StreamExt,
|
||||||
};
|
};
|
||||||
use polkadot_node_primitives::CollationGenerationConfig;
|
use polkadot_node_primitives::{CollationGenerationConfig, AvailableData, PoV};
|
||||||
use polkadot_node_subsystem::{
|
use polkadot_node_subsystem::{
|
||||||
messages::{AllMessages, CollationGenerationMessage, CollatorProtocolMessage},
|
messages::{AllMessages, CollationGenerationMessage, CollatorProtocolMessage},
|
||||||
FromOverseer, SpawnedSubsystem, Subsystem, SubsystemContext, SubsystemResult,
|
FromOverseer, SpawnedSubsystem, Subsystem, SubsystemContext, SubsystemResult,
|
||||||
@@ -37,9 +37,9 @@ use polkadot_node_subsystem_util::{
|
|||||||
metrics::{self, prometheus},
|
metrics::{self, prometheus},
|
||||||
};
|
};
|
||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
collator_signature_payload, AvailableData, CandidateCommitments,
|
collator_signature_payload, CandidateCommitments,
|
||||||
CandidateDescriptor, CandidateReceipt, CoreState, Hash, OccupiedCoreAssumption,
|
CandidateDescriptor, CandidateReceipt, CoreState, Hash, OccupiedCoreAssumption,
|
||||||
PersistedValidationData, PoV,
|
PersistedValidationData,
|
||||||
};
|
};
|
||||||
use sp_core::crypto::Pair;
|
use sp_core::crypto::Pair;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@@ -465,7 +465,7 @@ mod tests {
|
|||||||
task::{Context as FuturesContext, Poll},
|
task::{Context as FuturesContext, Poll},
|
||||||
Future,
|
Future,
|
||||||
};
|
};
|
||||||
use polkadot_node_primitives::{Collation, CollationResult};
|
use polkadot_node_primitives::{Collation, CollationResult, BlockData, PoV};
|
||||||
use polkadot_node_subsystem::messages::{
|
use polkadot_node_subsystem::messages::{
|
||||||
AllMessages, RuntimeApiMessage, RuntimeApiRequest,
|
AllMessages, RuntimeApiMessage, RuntimeApiRequest,
|
||||||
};
|
};
|
||||||
@@ -473,8 +473,8 @@ mod tests {
|
|||||||
subsystem_test_harness, TestSubsystemContextHandle,
|
subsystem_test_harness, TestSubsystemContextHandle,
|
||||||
};
|
};
|
||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
BlockData, BlockNumber, CollatorPair, Id as ParaId,
|
BlockNumber, CollatorPair, Id as ParaId,
|
||||||
PersistedValidationData, PoV, ScheduledCore,
|
PersistedValidationData, ScheduledCore,
|
||||||
};
|
};
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ pub enum RequiredTranches {
|
|||||||
needed: DelayTranche,
|
needed: DelayTranche,
|
||||||
/// The amount of missing votes that should be tolerated.
|
/// The amount of missing votes that should be tolerated.
|
||||||
tolerated_missing: usize,
|
tolerated_missing: usize,
|
||||||
/// When the next no-show would be, if any. This is used to schedule the next wakeup in the
|
/// When the next no-show would be, if any. This is used to schedule the next wakeup in the
|
||||||
/// event that there are some assignments that don't have corresponding approval votes. If this
|
/// event that there are some assignments that don't have corresponding approval votes. If this
|
||||||
/// is `None`, all assignments have approvals.
|
/// is `None`, all assignments have approvals.
|
||||||
next_no_show: Option<Tick>,
|
next_no_show: Option<Tick>,
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ use polkadot_node_subsystem_util::{
|
|||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
ValidatorIndex, Hash, SessionIndex, SessionInfo, CandidateHash,
|
ValidatorIndex, Hash, SessionIndex, SessionInfo, CandidateHash,
|
||||||
CandidateReceipt, BlockNumber, PersistedValidationData,
|
CandidateReceipt, BlockNumber, PersistedValidationData,
|
||||||
ValidationCode, CandidateDescriptor, PoV, ValidatorPair, ValidatorSignature, ValidatorId,
|
ValidationCode, CandidateDescriptor, ValidatorPair, ValidatorSignature, ValidatorId,
|
||||||
CandidateIndex, GroupIndex,
|
CandidateIndex, GroupIndex,
|
||||||
};
|
};
|
||||||
use polkadot_node_primitives::ValidationResult;
|
use polkadot_node_primitives::{ValidationResult, PoV};
|
||||||
use polkadot_node_primitives::approval::{
|
use polkadot_node_primitives::approval::{
|
||||||
IndirectAssignmentCert, IndirectSignedApprovalVote, ApprovalVote, DelayTranche,
|
IndirectAssignmentCert, IndirectSignedApprovalVote, ApprovalVote, DelayTranche,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsys
|
|||||||
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
|
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
|
||||||
polkadot-overseer = { path = "../../overseer" }
|
polkadot-overseer = { path = "../../overseer" }
|
||||||
polkadot-primitives = { path = "../../../primitives" }
|
polkadot-primitives = { path = "../../../primitives" }
|
||||||
|
polkadot-node-primitives = { path = "../../primitives" }
|
||||||
|
|
||||||
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
|
|
||||||
|
|||||||
@@ -32,9 +32,12 @@ use kvdb_rocksdb::{Database, DatabaseConfig};
|
|||||||
use kvdb::{KeyValueDB, DBTransaction};
|
use kvdb::{KeyValueDB, DBTransaction};
|
||||||
|
|
||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
Hash, AvailableData, BlockNumber, CandidateEvent, ErasureChunk, ValidatorIndex, CandidateHash,
|
Hash, BlockNumber, CandidateEvent, ValidatorIndex, CandidateHash,
|
||||||
CandidateReceipt,
|
CandidateReceipt,
|
||||||
};
|
};
|
||||||
|
use polkadot_node_primitives::{
|
||||||
|
ErasureChunk, AvailableData,
|
||||||
|
};
|
||||||
use polkadot_subsystem::{
|
use polkadot_subsystem::{
|
||||||
FromOverseer, OverseerSignal, SubsystemError, Subsystem, SubsystemContext, SpawnedSubsystem,
|
FromOverseer, OverseerSignal, SubsystemError, Subsystem, SubsystemContext, SpawnedSubsystem,
|
||||||
ActiveLeavesUpdate,
|
ActiveLeavesUpdate,
|
||||||
|
|||||||
@@ -25,10 +25,11 @@ use futures::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
AvailableData, BlockData, CandidateDescriptor, CandidateReceipt, HeadData,
|
CandidateDescriptor, CandidateReceipt, HeadData,
|
||||||
PersistedValidationData, PoV, Id as ParaId, CandidateHash, Header, ValidatorId,
|
PersistedValidationData, Id as ParaId, CandidateHash, Header, ValidatorId,
|
||||||
CoreIndex, GroupIndex,
|
CoreIndex, GroupIndex,
|
||||||
};
|
};
|
||||||
|
use polkadot_node_primitives::{AvailableData, BlockData, PoV};
|
||||||
use polkadot_node_subsystem_util::TimeoutExt;
|
use polkadot_node_subsystem_util::TimeoutExt;
|
||||||
use polkadot_subsystem::{
|
use polkadot_subsystem::{
|
||||||
ActiveLeavesUpdate, errors::RuntimeApiError, jaeger, messages::AllMessages, ActivatedLeaf,
|
ActiveLeavesUpdate, errors::RuntimeApiError, jaeger, messages::AllMessages, ActivatedLeaf,
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ use futures::{channel::{mpsc, oneshot}, Future, FutureExt, SinkExt, StreamExt};
|
|||||||
|
|
||||||
use sp_keystore::SyncCryptoStorePtr;
|
use sp_keystore::SyncCryptoStorePtr;
|
||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
AvailableData, BackedCandidate, CandidateCommitments, CandidateDescriptor, CandidateHash,
|
BackedCandidate, CandidateCommitments, CandidateDescriptor, CandidateHash,
|
||||||
CandidateReceipt, CollatorId, CommittedCandidateReceipt, CoreIndex, CoreState, Hash, Id as ParaId,
|
CandidateReceipt, CollatorId, CommittedCandidateReceipt, CoreIndex, CoreState, Hash, Id as ParaId,
|
||||||
PoV, SigningContext, ValidatorId, ValidatorIndex, ValidatorSignature, ValidityAttestation,
|
SigningContext, ValidatorId, ValidatorIndex, ValidatorSignature, ValidityAttestation,
|
||||||
};
|
};
|
||||||
use polkadot_node_primitives::{
|
use polkadot_node_primitives::{
|
||||||
Statement, SignedFullStatement, ValidationResult,
|
Statement, SignedFullStatement, ValidationResult, PoV, AvailableData,
|
||||||
};
|
};
|
||||||
use polkadot_subsystem::{
|
use polkadot_subsystem::{
|
||||||
PerLeafSpan, Stage, SubsystemSender,
|
PerLeafSpan, Stage, SubsystemSender,
|
||||||
@@ -1348,12 +1348,12 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use assert_matches::assert_matches;
|
use assert_matches::assert_matches;
|
||||||
use futures::{future, Future};
|
use futures::{future, Future};
|
||||||
use polkadot_primitives::v1::{BlockData, GroupRotationInfo, HeadData, PersistedValidationData, ScheduledCore};
|
use polkadot_primitives::v1::{GroupRotationInfo, HeadData, PersistedValidationData, ScheduledCore};
|
||||||
use polkadot_subsystem::{
|
use polkadot_subsystem::{
|
||||||
messages::{RuntimeApiRequest, RuntimeApiMessage},
|
messages::{RuntimeApiRequest, RuntimeApiMessage},
|
||||||
ActiveLeavesUpdate, FromOverseer, OverseerSignal, ActivatedLeaf,
|
ActiveLeavesUpdate, FromOverseer, OverseerSignal, ActivatedLeaf,
|
||||||
};
|
};
|
||||||
use polkadot_node_primitives::InvalidCandidate;
|
use polkadot_node_primitives::{InvalidCandidate, BlockData};
|
||||||
use sp_keyring::Sr25519Keyring;
|
use sp_keyring::Sr25519Keyring;
|
||||||
use sp_application_crypto::AppKey;
|
use sp_application_crypto::AppKey;
|
||||||
use sp_keystore::{CryptoStore, SyncCryptoStore};
|
use sp_keystore::{CryptoStore, SyncCryptoStore};
|
||||||
@@ -2763,7 +2763,7 @@ mod tests {
|
|||||||
virtual_overseer.send(FromOverseer::Communication{ msg: statement }).await;
|
virtual_overseer.send(FromOverseer::Communication{ msg: statement }).await;
|
||||||
|
|
||||||
// Not deterministic which message comes first:
|
// Not deterministic which message comes first:
|
||||||
for _ in 0..2 {
|
for _ in 0u32..2 {
|
||||||
match virtual_overseer.recv().await {
|
match virtual_overseer.recv().await {
|
||||||
AllMessages::Provisioner(
|
AllMessages::Provisioner(
|
||||||
ProvisionerMessage::ProvisionableData(
|
ProvisionerMessage::ProvisionableData(
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ use polkadot_node_subsystem_util::{
|
|||||||
JobTrait, JobSender, Validator, metrics::{self, prometheus},
|
JobTrait, JobSender, Validator, metrics::{self, prometheus},
|
||||||
};
|
};
|
||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
CandidateReceipt, CollatorId, CoreState, CoreIndex, Hash, Id as ParaId, PoV, BlockNumber,
|
CandidateReceipt, CollatorId, CoreState, CoreIndex, Hash, Id as ParaId, BlockNumber,
|
||||||
};
|
};
|
||||||
use polkadot_node_primitives::SignedFullStatement;
|
use polkadot_node_primitives::{SignedFullStatement, PoV};
|
||||||
use std::{pin::Pin, sync::Arc};
|
use std::{pin::Pin, sync::Arc};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
@@ -510,7 +510,7 @@ pub type CandidateSelectionSubsystem<Spawner> = JobSubsystem<CandidateSelectionJ
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use futures::lock::Mutex;
|
use futures::lock::Mutex;
|
||||||
use polkadot_primitives::v1::BlockData;
|
use polkadot_node_primitives::BlockData;
|
||||||
use polkadot_node_subsystem::messages::AllMessages;
|
use polkadot_node_subsystem::messages::AllMessages;
|
||||||
use sp_core::crypto::Public;
|
use sp_core::crypto::Public;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ use polkadot_subsystem::{
|
|||||||
};
|
};
|
||||||
use polkadot_node_subsystem_util::metrics::{self, prometheus};
|
use polkadot_node_subsystem_util::metrics::{self, prometheus};
|
||||||
use polkadot_subsystem::errors::RuntimeApiError;
|
use polkadot_subsystem::errors::RuntimeApiError;
|
||||||
use polkadot_node_primitives::{ValidationResult, InvalidCandidate};
|
use polkadot_node_primitives::{ValidationResult, InvalidCandidate, PoV};
|
||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
ValidationCode, PoV, CandidateDescriptor, PersistedValidationData,
|
ValidationCode, CandidateDescriptor, PersistedValidationData,
|
||||||
OccupiedCoreAssumption, Hash, CandidateCommitments,
|
OccupiedCoreAssumption, Hash, CandidateCommitments,
|
||||||
};
|
};
|
||||||
use polkadot_parachain::wasm_executor::{
|
use polkadot_parachain::wasm_executor::{
|
||||||
@@ -568,7 +568,8 @@ impl metrics::Metrics for Metrics {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use polkadot_node_subsystem_test_helpers as test_helpers;
|
use polkadot_node_subsystem_test_helpers as test_helpers;
|
||||||
use polkadot_primitives::v1::{HeadData, BlockData, UpwardMessage};
|
use polkadot_primitives::v1::{HeadData, UpwardMessage};
|
||||||
|
use polkadot_node_primitives::BlockData;
|
||||||
use sp_core::testing::TaskExecutor;
|
use sp_core::testing::TaskExecutor;
|
||||||
use futures::executor;
|
use futures::executor;
|
||||||
use assert_matches::assert_matches;
|
use assert_matches::assert_matches;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ mick-jaeger = "0.1.4"
|
|||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
parking_lot = "0.11.1"
|
parking_lot = "0.11.1"
|
||||||
polkadot-primitives = { path = "../../primitives" }
|
polkadot-primitives = { path = "../../primitives" }
|
||||||
|
polkadot-node-primitives = { path = "../primitives" }
|
||||||
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
thiserror = "1.0.23"
|
thiserror = "1.0.23"
|
||||||
|
|||||||
@@ -84,7 +84,8 @@
|
|||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
use parity_scale_codec::Encode;
|
use parity_scale_codec::Encode;
|
||||||
use polkadot_primitives::v1::{BlakeTwo256, CandidateHash, Hash, HashT, Id as ParaId, PoV, ValidatorIndex};
|
use polkadot_primitives::v1::{BlakeTwo256, CandidateHash, Hash, HashT, Id as ParaId, ValidatorIndex};
|
||||||
|
use polkadot_node_primitives::PoV;
|
||||||
use sc_network::PeerId;
|
use sc_network::PeerId;
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|||||||
@@ -91,9 +91,9 @@ impl<T> MeteredReceiver<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T> futures::stream::FusedStream for MeteredReceiver<T> {
|
impl<T> futures::stream::FusedStream for MeteredReceiver<T> {
|
||||||
fn is_terminated(&self) -> bool {
|
fn is_terminated(&self) -> bool {
|
||||||
self.inner.is_terminated()
|
self.inner.is_terminated()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -155,32 +155,32 @@ impl<T> MeteredSender<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T> futures::sink::Sink<T> for MeteredSender<T> {
|
impl<T> futures::sink::Sink<T> for MeteredSender<T> {
|
||||||
type Error = mpsc::SendError;
|
type Error = mpsc::SendError;
|
||||||
|
|
||||||
fn start_send(mut self: Pin<&mut Self>, item: T) -> Result<(), Self::Error> {
|
fn start_send(mut self: Pin<&mut Self>, item: T) -> Result<(), Self::Error> {
|
||||||
Pin::new(&mut self.inner).start_send(item)
|
Pin::new(&mut self.inner).start_send(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn poll_ready(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_ready(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
Pin::new(&mut self.inner).poll_ready(cx)
|
Pin::new(&mut self.inner).poll_ready(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
match Pin::new(&mut self.inner).poll_close(cx) {
|
match Pin::new(&mut self.inner).poll_close(cx) {
|
||||||
val @ Poll::Ready(_)=> {
|
val @ Poll::Ready(_)=> {
|
||||||
val
|
val
|
||||||
}
|
}
|
||||||
other => other,
|
other => other,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
match Pin::new(&mut self.inner).poll_flush(cx) {
|
match Pin::new(&mut self.inner).poll_flush(cx) {
|
||||||
val @ Poll::Ready(_)=> {
|
val @ Poll::Ready(_)=> {
|
||||||
self.meter.note_sent();
|
self.meter.note_sent();
|
||||||
val
|
val
|
||||||
}
|
}
|
||||||
other => other,
|
other => other,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,74 +26,74 @@ use super::Meter;
|
|||||||
|
|
||||||
/// Create a wrapped `mpsc::channel` pair of `MeteredSender` and `MeteredReceiver`.
|
/// Create a wrapped `mpsc::channel` pair of `MeteredSender` and `MeteredReceiver`.
|
||||||
pub fn unbounded<T>() -> (UnboundedMeteredSender<T>, UnboundedMeteredReceiver<T>) {
|
pub fn unbounded<T>() -> (UnboundedMeteredSender<T>, UnboundedMeteredReceiver<T>) {
|
||||||
let (tx, rx) = mpsc::unbounded();
|
let (tx, rx) = mpsc::unbounded();
|
||||||
let shared_meter = Meter::default();
|
let shared_meter = Meter::default();
|
||||||
let tx = UnboundedMeteredSender { meter: shared_meter.clone(), inner: tx };
|
let tx = UnboundedMeteredSender { meter: shared_meter.clone(), inner: tx };
|
||||||
let rx = UnboundedMeteredReceiver { meter: shared_meter, inner: rx };
|
let rx = UnboundedMeteredReceiver { meter: shared_meter, inner: rx };
|
||||||
(tx, rx)
|
(tx, rx)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A receiver tracking the messages consumed by itself.
|
/// A receiver tracking the messages consumed by itself.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct UnboundedMeteredReceiver<T> {
|
pub struct UnboundedMeteredReceiver<T> {
|
||||||
// count currently contained messages
|
// count currently contained messages
|
||||||
meter: Meter,
|
meter: Meter,
|
||||||
inner: mpsc::UnboundedReceiver<T>,
|
inner: mpsc::UnboundedReceiver<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> std::ops::Deref for UnboundedMeteredReceiver<T> {
|
impl<T> std::ops::Deref for UnboundedMeteredReceiver<T> {
|
||||||
type Target = mpsc::UnboundedReceiver<T>;
|
type Target = mpsc::UnboundedReceiver<T>;
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
&self.inner
|
&self.inner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> std::ops::DerefMut for UnboundedMeteredReceiver<T> {
|
impl<T> std::ops::DerefMut for UnboundedMeteredReceiver<T> {
|
||||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||||
&mut self.inner
|
&mut self.inner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Stream for UnboundedMeteredReceiver<T> {
|
impl<T> Stream for UnboundedMeteredReceiver<T> {
|
||||||
type Item = T;
|
type Item = T;
|
||||||
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
||||||
match mpsc::UnboundedReceiver::poll_next(Pin::new(&mut self.inner), cx) {
|
match mpsc::UnboundedReceiver::poll_next(Pin::new(&mut self.inner), cx) {
|
||||||
Poll::Ready(x) => {
|
Poll::Ready(x) => {
|
||||||
self.meter.note_received();
|
self.meter.note_received();
|
||||||
Poll::Ready(x)
|
Poll::Ready(x)
|
||||||
}
|
}
|
||||||
other => other,
|
other => other,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Don't rely on the unreliable size hint.
|
/// Don't rely on the unreliable size hint.
|
||||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||||
self.inner.size_hint()
|
self.inner.size_hint()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> UnboundedMeteredReceiver<T> {
|
impl<T> UnboundedMeteredReceiver<T> {
|
||||||
/// Get an updated accessor object for all metrics collected.
|
/// Get an updated accessor object for all metrics collected.
|
||||||
pub fn meter(&self) -> &Meter {
|
pub fn meter(&self) -> &Meter {
|
||||||
&self.meter
|
&self.meter
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempt to receive the next item.
|
/// Attempt to receive the next item.
|
||||||
pub fn try_next(&mut self) -> Result<Option<T>, mpsc::TryRecvError> {
|
pub fn try_next(&mut self) -> Result<Option<T>, mpsc::TryRecvError> {
|
||||||
match self.inner.try_next()? {
|
match self.inner.try_next()? {
|
||||||
Some(x) => {
|
Some(x) => {
|
||||||
self.meter.note_received();
|
self.meter.note_received();
|
||||||
Ok(Some(x))
|
Ok(Some(x))
|
||||||
}
|
}
|
||||||
None => Ok(None),
|
None => Ok(None),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> futures::stream::FusedStream for UnboundedMeteredReceiver<T> {
|
impl<T> futures::stream::FusedStream for UnboundedMeteredReceiver<T> {
|
||||||
fn is_terminated(&self) -> bool {
|
fn is_terminated(&self) -> bool {
|
||||||
self.inner.is_terminated()
|
self.inner.is_terminated()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -101,8 +101,8 @@ impl<T> futures::stream::FusedStream for UnboundedMeteredReceiver<T> {
|
|||||||
/// sent across it.
|
/// sent across it.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct UnboundedMeteredSender<T> {
|
pub struct UnboundedMeteredSender<T> {
|
||||||
meter: Meter,
|
meter: Meter,
|
||||||
inner: mpsc::UnboundedSender<T>,
|
inner: mpsc::UnboundedSender<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Clone for UnboundedMeteredSender<T> {
|
impl<T> Clone for UnboundedMeteredSender<T> {
|
||||||
@@ -112,76 +112,76 @@ impl<T> Clone for UnboundedMeteredSender<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T> std::ops::Deref for UnboundedMeteredSender<T> {
|
impl<T> std::ops::Deref for UnboundedMeteredSender<T> {
|
||||||
type Target = mpsc::UnboundedSender<T>;
|
type Target = mpsc::UnboundedSender<T>;
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
&self.inner
|
&self.inner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> std::ops::DerefMut for UnboundedMeteredSender<T> {
|
impl<T> std::ops::DerefMut for UnboundedMeteredSender<T> {
|
||||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||||
&mut self.inner
|
&mut self.inner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> UnboundedMeteredSender<T> {
|
impl<T> UnboundedMeteredSender<T> {
|
||||||
/// Get an updated accessor object for all metrics collected.
|
/// Get an updated accessor object for all metrics collected.
|
||||||
pub fn meter(&self) -> &Meter {
|
pub fn meter(&self) -> &Meter {
|
||||||
&self.meter
|
&self.meter
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send message, wait until capacity is available.
|
/// Send message, wait until capacity is available.
|
||||||
pub async fn send(&mut self, item: T) -> result::Result<(), mpsc::SendError>
|
pub async fn send(&mut self, item: T) -> result::Result<(), mpsc::SendError>
|
||||||
where
|
where
|
||||||
Self: Unpin,
|
Self: Unpin,
|
||||||
{
|
{
|
||||||
self.meter.note_sent();
|
self.meter.note_sent();
|
||||||
let fut = self.inner.send(item);
|
let fut = self.inner.send(item);
|
||||||
futures::pin_mut!(fut);
|
futures::pin_mut!(fut);
|
||||||
fut.await.map_err(|e| {
|
fut.await.map_err(|e| {
|
||||||
self.meter.retract_sent();
|
self.meter.retract_sent();
|
||||||
e
|
e
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Attempt to send message or fail immediately.
|
/// Attempt to send message or fail immediately.
|
||||||
pub fn unbounded_send(&self, msg: T) -> result::Result<(), mpsc::TrySendError<T>> {
|
pub fn unbounded_send(&self, msg: T) -> result::Result<(), mpsc::TrySendError<T>> {
|
||||||
self.meter.note_sent();
|
self.meter.note_sent();
|
||||||
self.inner.unbounded_send(msg).map_err(|e| {
|
self.inner.unbounded_send(msg).map_err(|e| {
|
||||||
self.meter.retract_sent();
|
self.meter.retract_sent();
|
||||||
e
|
e
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> futures::sink::Sink<T> for UnboundedMeteredSender<T> {
|
impl<T> futures::sink::Sink<T> for UnboundedMeteredSender<T> {
|
||||||
type Error = <futures::channel::mpsc::UnboundedSender<T> as futures::sink::Sink<T>>::Error;
|
type Error = <futures::channel::mpsc::UnboundedSender<T> as futures::sink::Sink<T>>::Error;
|
||||||
|
|
||||||
fn start_send(mut self: Pin<&mut Self>, item: T) -> Result<(), Self::Error> {
|
fn start_send(mut self: Pin<&mut Self>, item: T) -> Result<(), Self::Error> {
|
||||||
Pin::new(&mut self.inner).start_send(item)
|
Pin::new(&mut self.inner).start_send(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn poll_ready(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_ready(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
Pin::new(&mut self.inner).poll_ready(cx)
|
Pin::new(&mut self.inner).poll_ready(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
match Pin::new(&mut self.inner).poll_ready(cx) {
|
match Pin::new(&mut self.inner).poll_ready(cx) {
|
||||||
val @ Poll::Ready(_)=> {
|
val @ Poll::Ready(_)=> {
|
||||||
val
|
val
|
||||||
}
|
}
|
||||||
other => other,
|
other => other,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
match Pin::new(&mut self.inner).poll_ready(cx) {
|
match Pin::new(&mut self.inner).poll_ready(cx) {
|
||||||
val @ Poll::Ready(_)=> {
|
val @ Poll::Ready(_)=> {
|
||||||
self.meter.note_sent();
|
self.meter.note_sent();
|
||||||
val
|
val
|
||||||
}
|
}
|
||||||
other => other,
|
other => other,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ polkadot-erasure-coding = { path = "../../../erasure-coding" }
|
|||||||
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
|
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
|
||||||
polkadot-node-network-protocol = { path = "../../network/protocol" }
|
polkadot-node-network-protocol = { path = "../../network/protocol" }
|
||||||
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
|
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
|
||||||
|
polkadot-node-primitives = { path = "../../primitives" }
|
||||||
polkadot-node-core-runtime-api = { path = "../../core/runtime-api" }
|
polkadot-node-core-runtime-api = { path = "../../core/runtime-api" }
|
||||||
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", features = ["std"] }
|
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", features = ["std"] }
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ use thiserror::Error;
|
|||||||
use futures::channel::oneshot;
|
use futures::channel::oneshot;
|
||||||
|
|
||||||
use polkadot_node_subsystem_util::Error as UtilError;
|
use polkadot_node_subsystem_util::Error as UtilError;
|
||||||
use polkadot_primitives::v1::{CompressedPoVError, SessionIndex};
|
use polkadot_primitives::v1::SessionIndex;
|
||||||
|
use polkadot_node_primitives::CompressedPoVError;
|
||||||
use polkadot_subsystem::{errors::RuntimeApiError, SubsystemError};
|
use polkadot_subsystem::{errors::RuntimeApiError, SubsystemError};
|
||||||
|
|
||||||
use crate::LOG_TARGET;
|
use crate::LOG_TARGET;
|
||||||
|
|||||||
@@ -26,8 +26,9 @@ use polkadot_node_network_protocol::{
|
|||||||
v1::{PoVFetchingRequest, PoVFetchingResponse}}
|
v1::{PoVFetchingRequest, PoVFetchingResponse}}
|
||||||
};
|
};
|
||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
AuthorityDiscoveryId, CandidateHash, Hash, PoV, SessionIndex, ValidatorIndex
|
AuthorityDiscoveryId, CandidateHash, Hash, SessionIndex, ValidatorIndex
|
||||||
};
|
};
|
||||||
|
use polkadot_node_primitives::PoV;
|
||||||
use polkadot_subsystem::{
|
use polkadot_subsystem::{
|
||||||
ActiveLeavesUpdate, SubsystemContext, ActivatedLeaf,
|
ActiveLeavesUpdate, SubsystemContext, ActivatedLeaf,
|
||||||
messages::{AllMessages, NetworkBridgeMessage, IfDisconnected}
|
messages::{AllMessages, NetworkBridgeMessage, IfDisconnected}
|
||||||
@@ -241,7 +242,8 @@ mod tests {
|
|||||||
use parity_scale_codec::Encode;
|
use parity_scale_codec::Encode;
|
||||||
use sp_core::testing::TaskExecutor;
|
use sp_core::testing::TaskExecutor;
|
||||||
|
|
||||||
use polkadot_primitives::v1::{BlockData, CandidateHash, CompressedPoV, Hash, ValidatorIndex};
|
use polkadot_primitives::v1::{CandidateHash, Hash, ValidatorIndex};
|
||||||
|
use polkadot_node_primitives::{BlockData, CompressedPoV};
|
||||||
use polkadot_subsystem_testhelpers as test_helpers;
|
use polkadot_subsystem_testhelpers as test_helpers;
|
||||||
use polkadot_subsystem::messages::{AvailabilityDistributionMessage, RuntimeApiMessage, RuntimeApiRequest};
|
use polkadot_subsystem::messages::{AvailabilityDistributionMessage, RuntimeApiMessage, RuntimeApiRequest};
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,10 @@ use polkadot_node_network_protocol::request_response::{
|
|||||||
v1::{ChunkFetchingRequest, ChunkFetchingResponse},
|
v1::{ChunkFetchingRequest, ChunkFetchingResponse},
|
||||||
};
|
};
|
||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
AuthorityDiscoveryId, BlakeTwo256, ErasureChunk, GroupIndex, Hash, HashT, OccupiedCore,
|
AuthorityDiscoveryId, BlakeTwo256, GroupIndex, Hash, HashT, OccupiedCore,
|
||||||
SessionIndex,
|
SessionIndex,
|
||||||
};
|
};
|
||||||
|
use polkadot_node_primitives::ErasureChunk;
|
||||||
use polkadot_subsystem::messages::{
|
use polkadot_subsystem::messages::{
|
||||||
AllMessages, AvailabilityStoreMessage, NetworkBridgeMessage, IfDisconnected,
|
AllMessages, AvailabilityStoreMessage, NetworkBridgeMessage, IfDisconnected,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ use futures::task::{Poll, Context, noop_waker};
|
|||||||
use sc_network as network;
|
use sc_network as network;
|
||||||
use sp_keyring::Sr25519Keyring;
|
use sp_keyring::Sr25519Keyring;
|
||||||
|
|
||||||
use polkadot_primitives::v1::{BlockData, CandidateHash, PoV, ValidatorIndex};
|
use polkadot_primitives::v1::{CandidateHash, ValidatorIndex};
|
||||||
|
use polkadot_node_primitives::{BlockData, PoV};
|
||||||
use polkadot_node_network_protocol::request_response::v1;
|
use polkadot_node_network_protocol::request_response::v1;
|
||||||
use polkadot_node_network_protocol::request_response::Recipient;
|
use polkadot_node_network_protocol::request_response::Recipient;
|
||||||
use polkadot_subsystem::messages::AllMessages;
|
use polkadot_subsystem::messages::AllMessages;
|
||||||
|
|||||||
@@ -19,7 +19,8 @@
|
|||||||
use futures::channel::oneshot;
|
use futures::channel::oneshot;
|
||||||
|
|
||||||
use polkadot_node_network_protocol::request_response::{request::IncomingRequest, v1};
|
use polkadot_node_network_protocol::request_response::{request::IncomingRequest, v1};
|
||||||
use polkadot_primitives::v1::{AvailableData, CandidateHash, CompressedPoV, ErasureChunk, ValidatorIndex};
|
use polkadot_primitives::v1::{CandidateHash, ValidatorIndex};
|
||||||
|
use polkadot_node_primitives::{AvailableData, CompressedPoV, ErasureChunk};
|
||||||
use polkadot_subsystem::{
|
use polkadot_subsystem::{
|
||||||
messages::{AllMessages, AvailabilityStoreMessage},
|
messages::{AllMessages, AvailabilityStoreMessage},
|
||||||
SubsystemContext, jaeger,
|
SubsystemContext, jaeger,
|
||||||
|
|||||||
@@ -25,10 +25,11 @@ use sp_application_crypto::AppKey;
|
|||||||
|
|
||||||
use polkadot_erasure_coding::{branches, obtain_chunks_v1 as obtain_chunks};
|
use polkadot_erasure_coding::{branches, obtain_chunks_v1 as obtain_chunks};
|
||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
AvailableData, BlockData, CandidateCommitments, CandidateDescriptor, CandidateHash,
|
CandidateCommitments, CandidateDescriptor, CandidateHash,
|
||||||
CommittedCandidateReceipt, ErasureChunk, GroupIndex, Hash, HeadData, Id as ParaId,
|
CommittedCandidateReceipt, GroupIndex, Hash, HeadData, Id as ParaId,
|
||||||
OccupiedCore, PersistedValidationData, PoV, SessionInfo, ValidatorId, ValidatorIndex
|
OccupiedCore, PersistedValidationData, SessionInfo, ValidatorId, ValidatorIndex
|
||||||
};
|
};
|
||||||
|
use polkadot_node_primitives::{PoV, ErasureChunk, AvailableData, BlockData};
|
||||||
use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr};
|
use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr};
|
||||||
|
|
||||||
/// Get mock keystore with `Ferdie` key.
|
/// Get mock keystore with `Ferdie` key.
|
||||||
|
|||||||
@@ -35,11 +35,13 @@ use polkadot_subsystem::{ActiveLeavesUpdate, FromOverseer, OverseerSignal, Activ
|
|||||||
RuntimeApiMessage, RuntimeApiRequest,
|
RuntimeApiMessage, RuntimeApiRequest,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
use polkadot_primitives::v1::{CandidateHash, CoreState, ErasureChunk, GroupIndex, Hash, Id
|
use polkadot_primitives::v1::{CandidateHash, CoreState, GroupIndex, Hash, Id
|
||||||
as ParaId, ScheduledCore, SessionInfo,
|
as ParaId, ScheduledCore, SessionInfo,
|
||||||
ValidatorIndex
|
ValidatorIndex
|
||||||
};
|
};
|
||||||
use polkadot_node_network_protocol::{jaeger,
|
use polkadot_node_primitives::ErasureChunk;
|
||||||
|
use polkadot_node_network_protocol::{
|
||||||
|
jaeger,
|
||||||
request_response::{IncomingRequest, OutgoingRequest, Requests, v1}
|
request_response::{IncomingRequest, OutgoingRequest, Requests, v1}
|
||||||
};
|
};
|
||||||
use polkadot_subsystem_testhelpers as test_helpers;
|
use polkadot_subsystem_testhelpers as test_helpers;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ tracing = "0.1.25"
|
|||||||
|
|
||||||
polkadot-erasure-coding = { path = "../../../erasure-coding" }
|
polkadot-erasure-coding = { path = "../../../erasure-coding" }
|
||||||
polkadot-primitives = { path = "../../../primitives" }
|
polkadot-primitives = { path = "../../../primitives" }
|
||||||
|
polkadot-node-primitives = { path = "../../primitives" }
|
||||||
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
|
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
|
||||||
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
|
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
|
||||||
polkadot-node-network-protocol = { path = "../../network/protocol" }
|
polkadot-node-network-protocol = { path = "../../network/protocol" }
|
||||||
|
|||||||
@@ -26,10 +26,11 @@ use lru::LruCache;
|
|||||||
use rand::seq::SliceRandom;
|
use rand::seq::SliceRandom;
|
||||||
|
|
||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
AuthorityDiscoveryId, AvailableData, CandidateReceipt, CandidateHash,
|
AuthorityDiscoveryId, CandidateReceipt, CandidateHash,
|
||||||
Hash, ErasureChunk, ValidatorId, ValidatorIndex,
|
Hash, ValidatorId, ValidatorIndex,
|
||||||
SessionInfo, SessionIndex, BlakeTwo256, HashT, GroupIndex, BlockNumber,
|
SessionInfo, SessionIndex, BlakeTwo256, HashT, GroupIndex, BlockNumber,
|
||||||
};
|
};
|
||||||
|
use polkadot_node_primitives::{ErasureChunk, AvailableData};
|
||||||
use polkadot_subsystem::{
|
use polkadot_subsystem::{
|
||||||
SubsystemContext, SubsystemResult, SubsystemError, Subsystem, SpawnedSubsystem, FromOverseer,
|
SubsystemContext, SubsystemResult, SubsystemError, Subsystem, SpawnedSubsystem, FromOverseer,
|
||||||
OverseerSignal, ActiveLeavesUpdate,
|
OverseerSignal, ActiveLeavesUpdate,
|
||||||
|
|||||||
@@ -27,8 +27,9 @@ use parity_scale_codec::Encode;
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
AuthorityDiscoveryId, PersistedValidationData, PoV, BlockData, HeadData,
|
AuthorityDiscoveryId, PersistedValidationData, HeadData,
|
||||||
};
|
};
|
||||||
|
use polkadot_node_primitives::{PoV, BlockData};
|
||||||
use polkadot_erasure_coding::{branches, obtain_chunks_v1 as obtain_chunks};
|
use polkadot_erasure_coding::{branches, obtain_chunks_v1 as obtain_chunks};
|
||||||
use polkadot_node_subsystem_util::TimeoutExt;
|
use polkadot_node_subsystem_util::TimeoutExt;
|
||||||
use polkadot_subsystem_testhelpers as test_helpers;
|
use polkadot_subsystem_testhelpers as test_helpers;
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ use futures::{select, FutureExt, channel::oneshot};
|
|||||||
use sp_core::Pair;
|
use sp_core::Pair;
|
||||||
|
|
||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
CandidateHash, CandidateReceipt, CollatorPair, CompressedPoV, CoreIndex, CoreState, Hash,
|
CandidateHash, CandidateReceipt, CollatorPair, CoreIndex, CoreState, Hash,
|
||||||
Id as ParaId, PoV, ValidatorId
|
Id as ParaId, ValidatorId
|
||||||
};
|
};
|
||||||
use polkadot_subsystem::{
|
use polkadot_subsystem::{
|
||||||
jaeger, PerLeafSpan,
|
jaeger, PerLeafSpan,
|
||||||
@@ -42,7 +42,7 @@ use polkadot_node_subsystem_util::{
|
|||||||
request_availability_cores_ctx,
|
request_availability_cores_ctx,
|
||||||
metrics::{self, prometheus},
|
metrics::{self, prometheus},
|
||||||
};
|
};
|
||||||
use polkadot_node_primitives::{SignedFullStatement, Statement};
|
use polkadot_node_primitives::{SignedFullStatement, Statement, PoV, CompressedPoV};
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct Metrics(Option<MetricsInner>);
|
pub struct Metrics(Option<MetricsInner>);
|
||||||
@@ -949,9 +949,10 @@ mod tests {
|
|||||||
};
|
};
|
||||||
use polkadot_node_subsystem_util::TimeoutExt;
|
use polkadot_node_subsystem_util::TimeoutExt;
|
||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
AuthorityDiscoveryId, BlockData, CandidateDescriptor, CollatorPair, GroupRotationInfo,
|
AuthorityDiscoveryId, CandidateDescriptor, CollatorPair, GroupRotationInfo,
|
||||||
ScheduledCore, SessionIndex, SessionInfo, ValidatorIndex,
|
ScheduledCore, SessionIndex, SessionInfo, ValidatorIndex,
|
||||||
};
|
};
|
||||||
|
use polkadot_node_primitives::BlockData;
|
||||||
use polkadot_subsystem::{
|
use polkadot_subsystem::{
|
||||||
jaeger,
|
jaeger,
|
||||||
messages::{RuntimeApiMessage, RuntimeApiRequest},
|
messages::{RuntimeApiMessage, RuntimeApiRequest},
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ use polkadot_node_network_protocol::{
|
|||||||
},
|
},
|
||||||
OurView, PeerId, UnifiedReputationChange as Rep, View,
|
OurView, PeerId, UnifiedReputationChange as Rep, View,
|
||||||
};
|
};
|
||||||
use polkadot_node_primitives::{SignedFullStatement, Statement};
|
use polkadot_node_primitives::{SignedFullStatement, Statement, PoV};
|
||||||
use polkadot_node_subsystem_util::metrics::{self, prometheus};
|
use polkadot_node_subsystem_util::metrics::{self, prometheus};
|
||||||
use polkadot_primitives::v1::{CandidateReceipt, CollatorId, Hash, Id as ParaId, PoV};
|
use polkadot_primitives::v1::{CandidateReceipt, CollatorId, Hash, Id as ParaId};
|
||||||
use polkadot_subsystem::{
|
use polkadot_subsystem::{
|
||||||
jaeger,
|
jaeger,
|
||||||
messages::{
|
messages::{
|
||||||
@@ -896,7 +896,8 @@ mod tests {
|
|||||||
use sp_core::{crypto::Pair, Encode};
|
use sp_core::{crypto::Pair, Encode};
|
||||||
use assert_matches::assert_matches;
|
use assert_matches::assert_matches;
|
||||||
|
|
||||||
use polkadot_primitives::v1::{BlockData, CollatorPair, CompressedPoV};
|
use polkadot_primitives::v1::CollatorPair;
|
||||||
|
use polkadot_node_primitives::{BlockData, CompressedPoV};
|
||||||
use polkadot_subsystem_testhelpers as test_helpers;
|
use polkadot_subsystem_testhelpers as test_helpers;
|
||||||
use polkadot_node_network_protocol::{our_view, ObservedRole,
|
use polkadot_node_network_protocol::{our_view, ObservedRole,
|
||||||
request_response::Requests
|
request_response::Requests
|
||||||
|
|||||||
@@ -122,12 +122,12 @@ impl<T> Index<PeerSet> for PerPeerSet<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T> IndexMut<PeerSet> for PerPeerSet<T> {
|
impl<T> IndexMut<PeerSet> for PerPeerSet<T> {
|
||||||
fn index_mut(&mut self, index: PeerSet) -> &mut T {
|
fn index_mut(&mut self, index: PeerSet) -> &mut T {
|
||||||
match index {
|
match index {
|
||||||
PeerSet::Validation => &mut self.validation,
|
PeerSet::Validation => &mut self.validation,
|
||||||
PeerSet::Collation => &mut self.collation,
|
PeerSet::Collation => &mut self.collation,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get `NonDefaultSetConfig`s for all available peer sets.
|
/// Get `NonDefaultSetConfig`s for all available peer sets.
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ use std::borrow::Cow;
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use futures::channel::mpsc;
|
use futures::channel::mpsc;
|
||||||
use polkadot_primitives::v1::MAX_COMPRESSED_POV_SIZE;
|
use polkadot_node_primitives::MAX_COMPRESSED_POV_SIZE;
|
||||||
use strum::EnumIter;
|
use strum::EnumIter;
|
||||||
|
|
||||||
pub use sc_network::config as network;
|
pub use sc_network::config as network;
|
||||||
|
|||||||
@@ -19,10 +19,11 @@
|
|||||||
use parity_scale_codec::{Decode, Encode};
|
use parity_scale_codec::{Decode, Encode};
|
||||||
|
|
||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
AvailableData, CandidateHash, CandidateReceipt, ErasureChunk, ValidatorIndex,
|
CandidateHash, CandidateReceipt, ValidatorIndex,
|
||||||
CompressedPoV, Hash,
|
Hash,
|
||||||
};
|
};
|
||||||
use polkadot_primitives::v1::Id as ParaId;
|
use polkadot_primitives::v1::Id as ParaId;
|
||||||
|
use polkadot_node_primitives::{AvailableData, CompressedPoV, ErasureChunk};
|
||||||
|
|
||||||
use super::request::IsRequest;
|
use super::request::IsRequest;
|
||||||
use super::Protocol;
|
use super::Protocol;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ use futures::{
|
|||||||
};
|
};
|
||||||
use futures_timer::Delay;
|
use futures_timer::Delay;
|
||||||
|
|
||||||
use polkadot_primitives::v1::{BlockData, PoV};
|
use polkadot_node_primitives::{PoV, BlockData};
|
||||||
use polkadot_overseer::{Overseer, AllSubsystems};
|
use polkadot_overseer::{Overseer, AllSubsystems};
|
||||||
|
|
||||||
use polkadot_subsystem::{Subsystem, SubsystemContext, SpawnedSubsystem, FromOverseer};
|
use polkadot_subsystem::{Subsystem, SubsystemContext, SpawnedSubsystem, FromOverseer};
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ use std::task::Poll;
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::collections::{hash_map, HashMap};
|
use std::collections::{hash_map, HashMap};
|
||||||
|
|
||||||
use futures::channel::{oneshot};
|
use futures::channel::oneshot;
|
||||||
use futures::{
|
use futures::{
|
||||||
poll, select,
|
poll, select,
|
||||||
future::BoxFuture,
|
future::BoxFuture,
|
||||||
@@ -2680,9 +2680,9 @@ mod tests {
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use futures::{executor, pin_mut, select, FutureExt, pending};
|
use futures::{executor, pin_mut, select, FutureExt, pending};
|
||||||
|
|
||||||
use polkadot_primitives::v1::{BlockData, CollatorPair, PoV, CandidateHash};
|
use polkadot_primitives::v1::{CollatorPair, CandidateHash};
|
||||||
use polkadot_subsystem::{messages::RuntimeApiRequest, messages::NetworkBridgeEvent, jaeger};
|
use polkadot_subsystem::{messages::RuntimeApiRequest, messages::NetworkBridgeEvent, jaeger};
|
||||||
use polkadot_node_primitives::{CollationResult, CollationGenerationConfig};
|
use polkadot_node_primitives::{CollationResult, CollationGenerationConfig, PoV, BlockData};
|
||||||
use polkadot_node_network_protocol::{PeerId, UnifiedReputationChange};
|
use polkadot_node_network_protocol::{PeerId, UnifiedReputationChange};
|
||||||
use polkadot_node_subsystem_util::metered;
|
use polkadot_node_subsystem_util::metered;
|
||||||
|
|
||||||
|
|||||||
@@ -15,5 +15,10 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
|||||||
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
sp-consensus-vrf = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sp-consensus-vrf = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
|
polkadot-parachain = { path = "../../parachain", default-features = false }
|
||||||
schnorrkel = "0.9.1"
|
schnorrkel = "0.9.1"
|
||||||
thiserror = "1.0.22"
|
thiserror = "1.0.22"
|
||||||
|
serde = { version = "1.0.123", features = ["derive"] }
|
||||||
|
|
||||||
|
[target.'cfg(not(target_os = "unknown"))'.dependencies]
|
||||||
|
zstd = "0.5.0"
|
||||||
|
|||||||
@@ -22,20 +22,21 @@
|
|||||||
|
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
|
use std::pin::Pin;
|
||||||
|
|
||||||
|
use serde::{Serialize, Deserialize};
|
||||||
use futures::Future;
|
use futures::Future;
|
||||||
use parity_scale_codec::{Decode, Encode};
|
use parity_scale_codec::{Decode, Encode};
|
||||||
use polkadot_primitives::v1::{
|
|
||||||
CandidateCommitments, CandidateHash, CollatorPair, CommittedCandidateReceipt, CompactStatement,
|
|
||||||
EncodeAs, Hash, HeadData, Id as ParaId, OutboundHrmpMessage, PersistedValidationData, PoV,
|
|
||||||
Signed, UpwardMessage, ValidationCode,
|
|
||||||
};
|
|
||||||
use std::pin::Pin;
|
|
||||||
|
|
||||||
pub use sp_core::traits::SpawnNamed;
|
pub use sp_core::traits::SpawnNamed;
|
||||||
pub use sp_consensus_babe::{
|
pub use sp_consensus_babe::{
|
||||||
Epoch as BabeEpoch, BabeEpochConfiguration, AllowedSlots as BabeAllowedSlots,
|
Epoch as BabeEpoch, BabeEpochConfiguration, AllowedSlots as BabeAllowedSlots,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use polkadot_primitives::v1::{CandidateCommitments, CandidateHash, CollatorPair, CommittedCandidateReceipt, CompactStatement, EncodeAs, Hash, HeadData, Id as ParaId, OutboundHrmpMessage, PersistedValidationData, Signed, UpwardMessage, ValidationCode, BlakeTwo256, HashT, ValidatorIndex};
|
||||||
|
pub use polkadot_parachain::primitives::BlockData;
|
||||||
|
|
||||||
|
|
||||||
pub mod approval;
|
pub mod approval;
|
||||||
|
|
||||||
/// A statement, where the candidate receipt is included in the `Seconded` variant.
|
/// A statement, where the candidate receipt is included in the `Seconded` variant.
|
||||||
@@ -140,6 +141,102 @@ pub enum ValidationResult {
|
|||||||
Invalid(InvalidCandidate),
|
Invalid(InvalidCandidate),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Maximum PoV size we support right now.
|
||||||
|
pub const MAX_POV_SIZE: u32 = 50 * 1024 * 1024;
|
||||||
|
|
||||||
|
/// Very conservative (compression ratio of 1).
|
||||||
|
///
|
||||||
|
/// Experiments showed that we have a typical compression ratio of 3.4.
|
||||||
|
/// https://github.com/ordian/bench-compression-algorithms/
|
||||||
|
///
|
||||||
|
/// So this could be reduced if deemed necessary.
|
||||||
|
pub const MAX_COMPRESSED_POV_SIZE: u32 = MAX_POV_SIZE;
|
||||||
|
|
||||||
|
/// A Proof-of-Validity
|
||||||
|
#[derive(PartialEq, Eq, Clone, Encode, Decode, Debug)]
|
||||||
|
pub struct PoV {
|
||||||
|
/// The block witness data.
|
||||||
|
pub block_data: BlockData,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PoV {
|
||||||
|
/// Get the blake2-256 hash of the PoV.
|
||||||
|
pub fn hash(&self) -> Hash {
|
||||||
|
BlakeTwo256::hash_of(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// SCALE and Zstd encoded [`PoV`].
|
||||||
|
#[derive(Clone, Encode, Decode, PartialEq, Eq)]
|
||||||
|
pub struct CompressedPoV(Vec<u8>);
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
|
||||||
|
#[allow(missing_docs)]
|
||||||
|
pub enum CompressedPoVError {
|
||||||
|
#[error("Failed to compress a PoV")]
|
||||||
|
Compress,
|
||||||
|
#[error("Failed to decompress a PoV")]
|
||||||
|
Decompress,
|
||||||
|
#[error("Failed to decode the uncompressed PoV")]
|
||||||
|
Decode,
|
||||||
|
#[error("Architecture is not supported")]
|
||||||
|
NotSupported,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CompressedPoV {
|
||||||
|
/// Compress the given [`PoV`] and returns a [`CompressedPoV`].
|
||||||
|
#[cfg(not(target_os = "unknown"))]
|
||||||
|
pub fn compress(pov: &PoV) -> Result<Self, CompressedPoVError> {
|
||||||
|
zstd::encode_all(pov.encode().as_slice(), 3).map_err(|_| CompressedPoVError::Compress).map(Self)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Compress the given [`PoV`] and returns a [`CompressedPoV`].
|
||||||
|
#[cfg(target_os = "unknown")]
|
||||||
|
pub fn compress(_: &PoV) -> Result<Self, CompressedPoVError> {
|
||||||
|
Err(CompressedPoVError::NotSupported)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Decompress `self` and returns the [`PoV`] on success.
|
||||||
|
#[cfg(not(target_os = "unknown"))]
|
||||||
|
pub fn decompress(&self) -> Result<PoV, CompressedPoVError> {
|
||||||
|
use std::io::Read;
|
||||||
|
|
||||||
|
struct InputDecoder<'a, T: std::io::BufRead>(&'a mut zstd::Decoder<T>, usize);
|
||||||
|
impl<'a, T: std::io::BufRead> parity_scale_codec::Input for InputDecoder<'a, T> {
|
||||||
|
fn read(&mut self, into: &mut [u8]) -> Result<(), parity_scale_codec::Error> {
|
||||||
|
self.1 = self.1.saturating_add(into.len());
|
||||||
|
if self.1 > MAX_POV_SIZE as usize {
|
||||||
|
return Err("pov block too big".into())
|
||||||
|
}
|
||||||
|
self.0.read_exact(into).map_err(Into::into)
|
||||||
|
}
|
||||||
|
fn remaining_len(&mut self) -> Result<Option<usize>, parity_scale_codec::Error> {
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut decoder = zstd::Decoder::new(self.0.as_slice()).map_err(|_| CompressedPoVError::Decompress)?;
|
||||||
|
PoV::decode(&mut InputDecoder(&mut decoder, 0)).map_err(|_| CompressedPoVError::Decode)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Decompress `self` and returns the [`PoV`] on success.
|
||||||
|
#[cfg(target_os = "unknown")]
|
||||||
|
pub fn decompress(&self) -> Result<PoV, CompressedPoVError> {
|
||||||
|
Err(CompressedPoVError::NotSupported)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get compressed data size.
|
||||||
|
pub fn len(&self) -> usize {
|
||||||
|
self.0.len()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::fmt::Debug for CompressedPoV {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(f, "CompressedPoV({} bytes)", self.0.len())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// The output of a collator.
|
/// The output of a collator.
|
||||||
///
|
///
|
||||||
/// This differs from `CandidateCommitments` in two ways:
|
/// This differs from `CandidateCommitments` in two ways:
|
||||||
@@ -210,3 +307,36 @@ impl std::fmt::Debug for CollationGenerationConfig {
|
|||||||
write!(f, "CollationGenerationConfig {{ ... }}")
|
write!(f, "CollationGenerationConfig {{ ... }}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// This is the data we keep available for each candidate included in the relay chain.
|
||||||
|
#[derive(Clone, Encode, Decode, PartialEq, Eq, Debug)]
|
||||||
|
pub struct AvailableData {
|
||||||
|
/// The Proof-of-Validation of the candidate.
|
||||||
|
pub pov: std::sync::Arc<PoV>,
|
||||||
|
/// The persisted validation data needed for secondary checks.
|
||||||
|
pub validation_data: PersistedValidationData,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A chunk of erasure-encoded block data.
|
||||||
|
#[derive(PartialEq, Eq, Clone, Encode, Decode, Serialize, Deserialize, Debug, Hash)]
|
||||||
|
pub struct ErasureChunk {
|
||||||
|
/// The erasure-encoded chunk of data belonging to the candidate block.
|
||||||
|
pub chunk: Vec<u8>,
|
||||||
|
/// The index of this erasure-encoded chunk of data.
|
||||||
|
pub index: ValidatorIndex,
|
||||||
|
/// Proof for this chunk's branch in the Merkle tree.
|
||||||
|
pub proof: Vec<Vec<u8>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::{CompressedPoV, CompressedPoVError, PoV};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn decompress_huge_pov_block_fails() {
|
||||||
|
let pov = PoV { block_data: vec![0; 63 * 1024 * 1024].into() };
|
||||||
|
|
||||||
|
let compressed = CompressedPoV::compress(&pov).unwrap();
|
||||||
|
assert_eq!(CompressedPoVError::Decode, compressed.decompress().unwrap_err());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ polkadot-node-core-proposer = { path = "../core/proposer" }
|
|||||||
polkadot-overseer = { path = "../overseer" }
|
polkadot-overseer = { path = "../overseer" }
|
||||||
polkadot-parachain = { path = "../../parachain" }
|
polkadot-parachain = { path = "../../parachain" }
|
||||||
polkadot-primitives = { path = "../../primitives" }
|
polkadot-primitives = { path = "../../primitives" }
|
||||||
|
polkadot-node-primitives = { path = "../primitives" }
|
||||||
polkadot-rpc = { path = "../../rpc" }
|
polkadot-rpc = { path = "../../rpc" }
|
||||||
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../subsystem" }
|
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../subsystem" }
|
||||||
polkadot-node-subsystem-util = { path = "../subsystem-util" }
|
polkadot-node-subsystem-util = { path = "../subsystem-util" }
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ use kusama_runtime as kusama;
|
|||||||
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
|
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
|
||||||
use pallet_staking::Forcing;
|
use pallet_staking::Forcing;
|
||||||
use polkadot::constants::currency::DOTS;
|
use polkadot::constants::currency::DOTS;
|
||||||
use polkadot_primitives::v1::{AccountId, AccountPublic, AssignmentId, MAX_POV_SIZE, ValidatorId};
|
use polkadot_node_primitives::MAX_POV_SIZE;
|
||||||
|
use polkadot_primitives::v1::{AccountId, AccountPublic, AssignmentId, ValidatorId};
|
||||||
use polkadot_runtime as polkadot;
|
use polkadot_runtime as polkadot;
|
||||||
use rococo_runtime as rococo;
|
use rococo_runtime as rococo;
|
||||||
use rococo_runtime::constants::currency::DOTS as ROC;
|
use rococo_runtime::constants::currency::DOTS as ROC;
|
||||||
|
|||||||
@@ -34,14 +34,14 @@ use polkadot_node_network_protocol::{
|
|||||||
use polkadot_node_primitives::{
|
use polkadot_node_primitives::{
|
||||||
CollationGenerationConfig, SignedFullStatement, ValidationResult,
|
CollationGenerationConfig, SignedFullStatement, ValidationResult,
|
||||||
approval::{BlockApprovalMeta, IndirectAssignmentCert, IndirectSignedApprovalVote},
|
approval::{BlockApprovalMeta, IndirectAssignmentCert, IndirectSignedApprovalVote},
|
||||||
BabeEpoch,
|
BabeEpoch, AvailableData, PoV, ErasureChunk
|
||||||
};
|
};
|
||||||
use polkadot_primitives::v1::{
|
use polkadot_primitives::v1::{
|
||||||
AuthorityDiscoveryId, AvailableData, BackedCandidate, BlockNumber, SessionInfo,
|
AuthorityDiscoveryId, BackedCandidate, BlockNumber, SessionInfo,
|
||||||
Header as BlockHeader, CandidateDescriptor, CandidateEvent, CandidateReceipt,
|
Header as BlockHeader, CandidateDescriptor, CandidateEvent, CandidateReceipt,
|
||||||
CollatorId, CommittedCandidateReceipt, CoreState, ErasureChunk,
|
CollatorId, CommittedCandidateReceipt, CoreState,
|
||||||
GroupRotationInfo, Hash, Id as ParaId, OccupiedCoreAssumption,
|
GroupRotationInfo, Hash, Id as ParaId, OccupiedCoreAssumption,
|
||||||
PersistedValidationData, PoV, SessionIndex, SignedAvailabilityBitfield,
|
PersistedValidationData, SessionIndex, SignedAvailabilityBitfield,
|
||||||
ValidationCode, ValidatorId, CandidateHash,
|
ValidationCode, ValidatorId, CandidateHash,
|
||||||
ValidatorIndex, ValidatorSignature, InboundDownwardMessage, InboundHrmpMessage,
|
ValidatorIndex, ValidatorSignature, InboundDownwardMessage, InboundHrmpMessage,
|
||||||
CandidateIndex, GroupIndex,
|
CandidateIndex, GroupIndex,
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ pub trait AccountIdConversion<AccountId>: Sized {
|
|||||||
/// Convert into an account ID. This is infallible.
|
/// Convert into an account ID. This is infallible.
|
||||||
fn into_account(&self) -> AccountId;
|
fn into_account(&self) -> AccountId;
|
||||||
|
|
||||||
/// Try to convert an account ID into this type. Might not succeed.
|
/// Try to convert an account ID into this type. Might not succeed.
|
||||||
fn try_from_account(a: &AccountId) -> Option<Self>;
|
fn try_from_account(a: &AccountId) -> Option<Self>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ impl<T: Encode + Decode + Default> AccountIdConversion<T> for Id {
|
|||||||
).unwrap_or_default()
|
).unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_from_account(x: &T) -> Option<Self> {
|
fn try_from_account(x: &T) -> Option<Self> {
|
||||||
x.using_encoded(|d| {
|
x.using_encoded(|d| {
|
||||||
if &d[0..4] != b"para" { return None }
|
if &d[0..4] != b"para" { return None }
|
||||||
let mut cursor = &d[4..];
|
let mut cursor = &d[4..];
|
||||||
|
|||||||
@@ -18,7 +18,8 @@
|
|||||||
|
|
||||||
use futures_timer::Delay;
|
use futures_timer::Delay;
|
||||||
use polkadot_node_primitives::{Collation, CollatorFn, CollationResult, Statement, SignedFullStatement};
|
use polkadot_node_primitives::{Collation, CollatorFn, CollationResult, Statement, SignedFullStatement};
|
||||||
use polkadot_primitives::v1::{CollatorId, CollatorPair, PoV};
|
use polkadot_primitives::v1::{CollatorId, CollatorPair};
|
||||||
|
use polkadot_node_primitives::PoV;
|
||||||
use parity_scale_codec::{Encode, Decode};
|
use parity_scale_codec::{Encode, Decode};
|
||||||
use sp_core::{Pair, traits::SpawnNamed};
|
use sp_core::{Pair, traits::SpawnNamed};
|
||||||
use std::{
|
use std::{
|
||||||
|
|||||||
@@ -28,9 +28,6 @@ hex-literal = "0.3.1"
|
|||||||
parity-util-mem = { version = "0.9.0", default-features = false, optional = true }
|
parity-util-mem = { version = "0.9.0", default-features = false, optional = true }
|
||||||
thiserror = "1.0.23"
|
thiserror = "1.0.23"
|
||||||
|
|
||||||
[target.'cfg(not(target_os = "unknown"))'.dependencies]
|
|
||||||
zstd = "0.5.0"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
sp-serializer = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sp-serializer = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
pretty_assertions = "0.6.1"
|
pretty_assertions = "0.6.1"
|
||||||
|
|||||||
@@ -665,18 +665,6 @@ pub struct AvailableData {
|
|||||||
// In the future, outgoing messages as well.
|
// In the future, outgoing messages as well.
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A chunk of erasure-encoded block data.
|
|
||||||
#[derive(PartialEq, Eq, Clone, Encode, Decode)]
|
|
||||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug, Hash))]
|
|
||||||
pub struct ErasureChunk {
|
|
||||||
/// The erasure-encoded chunk of data belonging to the candidate block.
|
|
||||||
pub chunk: Vec<u8>,
|
|
||||||
/// The index of this erasure-encoded chunk of data.
|
|
||||||
pub index: ValidatorIndex,
|
|
||||||
/// Proof for this chunk's branch in the Merkle tree.
|
|
||||||
pub proof: Vec<Vec<u8>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
const BACKING_STATEMENT_MAGIC: [u8; 4] = *b"BKNG";
|
const BACKING_STATEMENT_MAGIC: [u8; 4] = *b"BKNG";
|
||||||
|
|
||||||
/// Statements that can be made about parachain candidates. These are the
|
/// Statements that can be made about parachain candidates. These are the
|
||||||
|
|||||||
@@ -38,14 +38,14 @@ pub use polkadot_core_primitives::v1::{
|
|||||||
|
|
||||||
// Export some polkadot-parachain primitives
|
// Export some polkadot-parachain primitives
|
||||||
pub use polkadot_parachain::primitives::{
|
pub use polkadot_parachain::primitives::{
|
||||||
Id, LOWEST_USER_ID, HrmpChannelId, UpwardMessage, HeadData, BlockData, ValidationCode,
|
Id, LOWEST_USER_ID, HrmpChannelId, UpwardMessage, HeadData, ValidationCode,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Export some basic parachain primitives from v0.
|
// Export some basic parachain primitives from v0.
|
||||||
pub use crate::v0::{
|
pub use crate::v0::{
|
||||||
CollatorId, CollatorSignature, PARACHAIN_KEY_TYPE_ID, ValidatorId, ValidatorIndex,
|
CollatorId, CollatorSignature, PARACHAIN_KEY_TYPE_ID, ValidatorId, ValidatorIndex,
|
||||||
ValidatorSignature, SigningContext, Signed, ValidityAttestation,
|
ValidatorSignature, SigningContext, Signed, ValidityAttestation,
|
||||||
CompactStatement, SignedStatement, ErasureChunk, EncodeAs,
|
CompactStatement, SignedStatement, EncodeAs,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
@@ -438,106 +438,6 @@ impl CandidateCommitments {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Proof-of-Validity
|
|
||||||
#[derive(PartialEq, Eq, Clone, Encode, Decode)]
|
|
||||||
#[cfg_attr(feature = "std", derive(Debug))]
|
|
||||||
pub struct PoV {
|
|
||||||
/// The block witness data.
|
|
||||||
pub block_data: BlockData,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PoV {
|
|
||||||
/// Get the blake2-256 hash of the PoV.
|
|
||||||
#[cfg(feature = "std")]
|
|
||||||
pub fn hash(&self) -> Hash {
|
|
||||||
BlakeTwo256::hash_of(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// SCALE and Zstd encoded [`PoV`].
|
|
||||||
#[derive(Clone, Encode, Decode, PartialEq, Eq)]
|
|
||||||
pub struct CompressedPoV(Vec<u8>);
|
|
||||||
|
|
||||||
/// Maximum PoV size we support right now.
|
|
||||||
pub const MAX_POV_SIZE: u32 = 50 * 1024 * 1024;
|
|
||||||
|
|
||||||
/// Very conservative (compression ratio of 1).
|
|
||||||
///
|
|
||||||
/// Experiments showed that we have a typical compression ratio of 3.4.
|
|
||||||
/// https://github.com/ordian/bench-compression-algorithms/
|
|
||||||
///
|
|
||||||
/// So this could be reduced if deemed necessary.
|
|
||||||
pub const MAX_COMPRESSED_POV_SIZE: u32 = MAX_POV_SIZE;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
|
|
||||||
#[cfg(feature = "std")]
|
|
||||||
#[allow(missing_docs)]
|
|
||||||
pub enum CompressedPoVError {
|
|
||||||
#[error("Failed to compress a PoV")]
|
|
||||||
Compress,
|
|
||||||
#[error("Failed to decompress a PoV")]
|
|
||||||
Decompress,
|
|
||||||
#[error("Failed to decode the uncompressed PoV")]
|
|
||||||
Decode,
|
|
||||||
#[error("Architecture is not supported")]
|
|
||||||
NotSupported,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
|
||||||
impl CompressedPoV {
|
|
||||||
/// Compress the given [`PoV`] and returns a [`CompressedPoV`].
|
|
||||||
#[cfg(not(target_os = "unknown"))]
|
|
||||||
pub fn compress(pov: &PoV) -> Result<Self, CompressedPoVError> {
|
|
||||||
zstd::encode_all(pov.encode().as_slice(), 3).map_err(|_| CompressedPoVError::Compress).map(Self)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Compress the given [`PoV`] and returns a [`CompressedPoV`].
|
|
||||||
#[cfg(target_os = "unknown")]
|
|
||||||
pub fn compress(_: &PoV) -> Result<Self, CompressedPoVError> {
|
|
||||||
Err(CompressedPoVError::NotSupported)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Decompress `self` and returns the [`PoV`] on success.
|
|
||||||
#[cfg(not(target_os = "unknown"))]
|
|
||||||
pub fn decompress(&self) -> Result<PoV, CompressedPoVError> {
|
|
||||||
use std::io::Read;
|
|
||||||
|
|
||||||
struct InputDecoder<'a, T: std::io::BufRead>(&'a mut zstd::Decoder<T>, usize);
|
|
||||||
impl<'a, T: std::io::BufRead> parity_scale_codec::Input for InputDecoder<'a, T> {
|
|
||||||
fn read(&mut self, into: &mut [u8]) -> Result<(), parity_scale_codec::Error> {
|
|
||||||
self.1 = self.1.saturating_add(into.len());
|
|
||||||
if self.1 > MAX_POV_SIZE as usize {
|
|
||||||
return Err("pov block too big".into())
|
|
||||||
}
|
|
||||||
self.0.read_exact(into).map_err(Into::into)
|
|
||||||
}
|
|
||||||
fn remaining_len(&mut self) -> Result<Option<usize>, parity_scale_codec::Error> {
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut decoder = zstd::Decoder::new(self.0.as_slice()).map_err(|_| CompressedPoVError::Decompress)?;
|
|
||||||
PoV::decode(&mut InputDecoder(&mut decoder, 0)).map_err(|_| CompressedPoVError::Decode)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Decompress `self` and returns the [`PoV`] on success.
|
|
||||||
#[cfg(target_os = "unknown")]
|
|
||||||
pub fn decompress(&self) -> Result<PoV, CompressedPoVError> {
|
|
||||||
Err(CompressedPoVError::NotSupported)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get compressed data size.
|
|
||||||
pub fn len(&self) -> usize {
|
|
||||||
self.0.len()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
|
||||||
impl std::fmt::Debug for CompressedPoV {
|
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
||||||
write!(f, "CompressedPoV({} bytes)", self.0.len())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A bitfield concerning availability of backed candidates.
|
/// A bitfield concerning availability of backed candidates.
|
||||||
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)]
|
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)]
|
||||||
@@ -681,16 +581,6 @@ pub enum CoreOccupied {
|
|||||||
Parachain,
|
Parachain,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This is the data we keep available for each candidate included in the relay chain.
|
|
||||||
#[cfg(feature = "std")]
|
|
||||||
#[derive(Clone, Encode, Decode, PartialEq, Eq, Debug)]
|
|
||||||
pub struct AvailableData {
|
|
||||||
/// The Proof-of-Validation of the candidate.
|
|
||||||
pub pov: std::sync::Arc<PoV>,
|
|
||||||
/// The persisted validation data needed for secondary checks.
|
|
||||||
pub validation_data: PersistedValidationData,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A helper data-type for tracking validator-group rotations.
|
/// A helper data-type for tracking validator-group rotations.
|
||||||
#[derive(Clone, Encode, Decode)]
|
#[derive(Clone, Encode, Decode)]
|
||||||
#[cfg_attr(feature = "std", derive(PartialEq, Debug, MallocSizeOf))]
|
#[cfg_attr(feature = "std", derive(PartialEq, Debug, MallocSizeOf))]
|
||||||
@@ -1104,7 +994,6 @@ impl<H> From<ConsensusLog> for runtime_primitives::DigestItem<H> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use super::{CompressedPoV, CompressedPoVError, PoV};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn group_rotation_info_calculations() {
|
fn group_rotation_info_calculations() {
|
||||||
@@ -1131,14 +1020,4 @@ mod tests {
|
|||||||
&Hash::repeat_byte(3),
|
&Hash::repeat_byte(3),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[cfg(not(target_os = "unknown"))]
|
|
||||||
#[test]
|
|
||||||
fn decompress_huge_pov_block_fails() {
|
|
||||||
let pov = PoV { block_data: vec![0; 63 * 1024 * 1024].into() };
|
|
||||||
|
|
||||||
let compressed = CompressedPoV::compress(&pov).unwrap();
|
|
||||||
assert_eq!(CompressedPoVError::Decode, compressed.decompress().unwrap_err());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2081,7 +2081,7 @@ mod tests {
|
|||||||
let thread_a = ParaId::from(3);
|
let thread_a = ParaId::from(3);
|
||||||
|
|
||||||
// The block number of the relay-parent for testing.
|
// The block number of the relay-parent for testing.
|
||||||
const RELAY_PARENT_NUM: BlockNumber = 4;
|
const RELAY_PARENT_NUM: BlockNumber = 4;
|
||||||
|
|
||||||
let paras = vec![(chain_a, true), (chain_b, true), (thread_a, false)];
|
let paras = vec![(chain_a, true), (chain_b, true), (thread_a, false)];
|
||||||
let validators = vec![
|
let validators = vec![
|
||||||
|
|||||||
Reference in New Issue
Block a user