chore: regenerate umbrella crate, fix feature propagation

This commit is contained in:
2025-12-16 11:28:32 +03:00
parent dd6d48f528
commit 620b0e3aa0
1358 changed files with 9464 additions and 7656 deletions
@@ -16,6 +16,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use bizinikiwi_test_runtime_client::runtime;
use criterion::{
criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, PlotConfiguration,
Throughput,
@@ -33,7 +34,6 @@ use pezsc_network_common::{sync::message::BlockAnnouncesHandshake, ExHashT};
use pezsp_core::H256;
use pezsp_runtime::traits::{Block as BlockT, Zero};
use std::{sync::Arc, time::Duration};
use bizinikiwi_test_runtime_client::runtime;
use tokio::{sync::Mutex, task::JoinHandle};
const NUMBER_OF_NOTIFICATIONS: usize = 100;
@@ -16,6 +16,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use bizinikiwi_test_runtime_client::runtime;
use criterion::{
criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, PlotConfiguration,
Throughput,
@@ -33,7 +34,6 @@ use pezsc_network_common::{sync::message::BlockAnnouncesHandshake, ExHashT};
use pezsp_core::H256;
use pezsp_runtime::traits::{Block as BlockT, Zero};
use std::{sync::Arc, time::Duration};
use bizinikiwi_test_runtime_client::runtime;
use tokio::{sync::Mutex, task::JoinHandle};
const MAX_SIZE: u64 = 2u64.pow(30);
@@ -26,7 +26,6 @@ use crate::schema;
use codec::{self, Decode, Encode};
use futures::prelude::*;
use log::{debug, trace};
use prost::Message;
use pezsc_client_api::{BlockBackend, ProofProvider};
use pezsc_network::{
config::ProtocolId,
@@ -39,6 +38,7 @@ use pezsp_core::{
storage::{ChildInfo, ChildType, PrefixedStorageKey},
};
use pezsp_runtime::traits::Block;
use prost::Message;
use std::{marker::PhantomData, sync::Arc};
const LOG_TARGET: &str = "light-client-request-handler";
+9 -7
View File
@@ -30,14 +30,14 @@ use crate::{
use cid::{self, Version};
use futures::StreamExt;
use log::{debug, error, trace};
use prost::Message;
use pezsc_client_api::BlockBackend;
use pezsc_network_types::PeerId;
use pezsp_runtime::traits::Block as BlockT;
use prost::Message;
use schema::bitswap::{
message::{wantlist::WantType, Block as MessageBlock, BlockPresence, BlockPresenceType},
Message as BitswapMessage,
};
use pezsp_runtime::traits::Block as BlockT;
use std::{io, sync::Arc, time::Duration};
use unsigned_varint::encode as varint_encode;
@@ -292,16 +292,16 @@ pub enum BitswapError {
#[cfg(test)]
mod tests {
use super::*;
use bizinikiwi_test_runtime::ExtrinsicBuilder;
use bizinikiwi_test_runtime_client::{self, prelude::*, TestClientBuilder};
use futures::channel::oneshot;
use pezsc_block_builder::BlockBuilderBuilder;
use pezsp_consensus::BlockOrigin;
use pezsp_runtime::codec::Encode;
use schema::bitswap::{
message::{wantlist::Entry, Wantlist},
Message as BitswapMessage,
};
use pezsp_consensus::BlockOrigin;
use pezsp_runtime::codec::Encode;
use bizinikiwi_test_runtime::ExtrinsicBuilder;
use bizinikiwi_test_runtime_client::{self, prelude::*, TestClientBuilder};
#[tokio::test]
async fn undecodable_message() {
@@ -503,7 +503,9 @@ mod tests {
0x70,
cid::multihash::Multihash::wrap(
u64::from(cid::multihash::Code::Blake2b256),
&pezsp_crypto_hashing::blake2_256(&ext.encode()[pattern_index..]),
&pezsp_crypto_hashing::blake2_256(
&ext.encode()[pattern_index..],
),
)
.unwrap(),
)
+2 -1
View File
@@ -21,7 +21,8 @@
//! The `DiscoveryBehaviour` struct implements the `NetworkBehaviour` trait of libp2p and is
//! responsible for discovering other nodes that are part of the network.
//!
//! Bizinikiwi uses the following mechanisms in order to discover nodes that are part of the network:
//! Bizinikiwi uses the following mechanisms in order to discover nodes that are part of the
//! network:
//!
//! - Bootstrap nodes. These are hard-coded node identities and addresses passed in the constructor
//! of the `DiscoveryBehaviour`. You can also call `add_known_address` later to add an entry.
+2 -2
View File
@@ -265,8 +265,6 @@ pub mod utils;
pub use crate::litep2p::Litep2pNetworkBackend;
pub use event::{DhtEvent, Event};
#[doc(inline)]
pub use request_responses::{Config, IfDisconnected, RequestFailure};
pub use pezsc_network_common::{
role::{ObservedRole, Roles},
types::ReputationChange,
@@ -275,6 +273,8 @@ pub use pezsc_network_types::{
multiaddr::{self, Multiaddr},
PeerId,
};
#[doc(inline)]
pub use request_responses::{Config, IfDisconnected, RequestFailure};
pub use service::{
metrics::NotificationMetrics,
signature::Signature,
+1 -1
View File
@@ -71,8 +71,8 @@ use litep2p::{
},
Litep2p, Litep2pEvent, ProtocolName as Litep2pProtocolName,
};
use prometheus_endpoint::Registry;
use pezsc_network_types::kad::{Key as RecordKey, PeerRecord, Record as P2PRecord};
use prometheus_endpoint::Registry;
use pezsc_client_api::BlockBackend;
use pezsc_network_common::{role::Roles, ExHashT};
@@ -466,11 +466,17 @@ mod tests {
// Report 2 peers with a negative reputation.
handle.report_peer(
peer_a,
pezsc_network_common::types::ReputationChange { value: i32::MIN, reason: "test".into() },
pezsc_network_common::types::ReputationChange {
value: i32::MIN,
reason: "test".into(),
},
);
handle.report_peer(
peer_b,
pezsc_network_common::types::ReputationChange { value: i32::MIN, reason: "test".into() },
pezsc_network_common::types::ReputationChange {
value: i32::MIN,
reason: "test".into(),
},
);
// Advance time to propagate peers.
+9 -3
View File
@@ -25,8 +25,8 @@ use libp2p::PeerId;
use log::trace;
use parking_lot::Mutex;
use partial_sort::PartialSort;
use prometheus_endpoint::Registry;
use pezsc_network_common::{role::ObservedRole, types::ReputationChange};
use prometheus_endpoint::Registry;
use std::{
cmp::{Ord, Ordering, PartialOrd},
collections::{hash_map::Entry, HashMap, HashSet},
@@ -558,11 +558,17 @@ mod tests {
// Report 2 peers with a negative reputation.
handle.report_peer(
peer_a,
pezsc_network_common::types::ReputationChange { value: i32::MIN, reason: "test".into() },
pezsc_network_common::types::ReputationChange {
value: i32::MIN,
reason: "test".into(),
},
);
handle.report_peer(
peer_b,
pezsc_network_common::types::ReputationChange { value: i32::MIN, reason: "test".into() },
pezsc_network_common::types::ReputationChange {
value: i32::MIN,
reason: "test".into(),
},
);
// Advance time to propagate banned peers.
@@ -45,8 +45,8 @@ use libp2p::{
};
use log::{debug, error, trace, warn};
use parking_lot::RwLock;
use rand::distributions::{Distribution as _, Uniform};
use pezsc_utils::mpsc::TracingUnboundedReceiver;
use rand::distributions::{Distribution as _, Uniform};
use smallvec::SmallVec;
use tokio::sync::oneshot::error::RecvError;
use tokio_stream::StreamMap;
@@ -232,7 +232,11 @@ impl NotificationService for NotificationHandle {
}
/// Send synchronous `notification` to `peer`.
fn send_sync_notification(&mut self, peer: &pezsc_network_types::PeerId, notification: Vec<u8>) {
fn send_sync_notification(
&mut self,
peer: &pezsc_network_types::PeerId,
notification: Vec<u8>,
) {
if let Some(info) = self.peers.get(&((*peer).into())) {
metrics::register_notification_sent(
info.sink.metrics(),
@@ -813,7 +813,11 @@ impl ProtocolController {
.map(From::from)
.collect::<HashSet<pezsc_network_types::PeerId>>()
.union(
&self.nodes.keys().map(From::from).collect::<HashSet<pezsc_network_types::PeerId>>(),
&self
.nodes
.keys()
.map(From::from)
.collect::<HashSet<pezsc_network_types::PeerId>>(),
)
.cloned()
.collect();
+1 -1
View File
@@ -75,8 +75,8 @@ use libp2p::{
use log::{debug, error, info, trace, warn};
use metrics::{Histogram, MetricSources, Metrics};
use parking_lot::Mutex;
use prometheus_endpoint::Registry;
use pezsc_network_types::kad::{Key as KademliaKey, Record};
use prometheus_endpoint::Registry;
use pezsc_client_api::BlockBackend;
use pezsc_network_common::{
@@ -30,9 +30,6 @@ use crate::config::*;
use codec::{Decode, Encode};
use futures::{channel::oneshot, prelude::*, stream::FuturesUnordered, FutureExt};
use prometheus_endpoint::{
prometheus, register, Counter, Gauge, Histogram, HistogramOpts, PrometheusError, Registry, U64,
};
use pezsc_network::{
config::{NonReservedPeerMode, SetConfig},
error, multiaddr,
@@ -52,6 +49,9 @@ use pezsp_runtime::traits::Block as BlockT;
use pezsp_statement_store::{
Hash, NetworkPriority, Statement, StatementSource, StatementStore, SubmitResult,
};
use prometheus_endpoint::{
prometheus, register, Counter, Gauge, Histogram, HistogramOpts, PrometheusError, Registry, U64,
};
use std::{
collections::{hash_map::Entry, HashMap, HashSet},
iter,
@@ -797,7 +797,9 @@ mod tests {
unimplemented!()
}
async fn next_event(&mut self) -> Option<pezsc_network::service::traits::NotificationEvent> {
async fn next_event(
&mut self,
) -> Option<pezsc_network::service::traits::NotificationEvent> {
None
}
@@ -819,7 +821,8 @@ mod tests {
#[derive(Clone)]
struct TestStatementStore {
statements: Arc<Mutex<HashMap<pezsp_statement_store::Hash, pezsp_statement_store::Statement>>>,
statements:
Arc<Mutex<HashMap<pezsp_statement_store::Hash, pezsp_statement_store::Statement>>>,
recent_statements:
Arc<Mutex<HashMap<pezsp_statement_store::Hash, pezsp_statement_store::Statement>>>,
}
@@ -309,9 +309,9 @@ impl<B: BlockT> FusedStream for BlockAnnounceValidator<B> {
mod tests {
use super::*;
use crate::block_announce_validator::AllocateSlotForBlockAnnounceValidation;
use bizinikiwi_test_runtime_client::runtime::Block;
use pezsc_network_types::PeerId;
use pezsp_consensus::block_validation::DefaultBlockAnnounceValidator;
use bizinikiwi_test_runtime_client::runtime::Block;
#[test]
fn allocate_one_validation_slot() {
@@ -24,14 +24,14 @@ use crate::{
strategy::chain_sync::{PeerSync, PeerSyncState},
LOG_TARGET,
};
use pez_fork_tree::ForkTree;
use log::{debug, trace, warn};
use prometheus_endpoint::{
prometheus::core::GenericGauge, register, GaugeVec, Opts, PrometheusError, Registry, U64,
};
use pez_fork_tree::ForkTree;
use pezsc_network_types::PeerId;
use pezsp_blockchain::Error as ClientError;
use pezsp_runtime::traits::{Block as BlockT, NumberFor, Zero};
use prometheus_endpoint::{
prometheus::core::GenericGauge, register, GaugeVec, Opts, PrometheusError, Registry, U64,
};
use std::{
collections::{HashMap, HashSet, VecDeque},
time::{Duration, Instant},
@@ -441,9 +441,9 @@ impl<'a, B: BlockT> Matcher<'a, B> {
mod tests {
use super::*;
use crate::strategy::chain_sync::PeerSync;
use quickcheck::{Arbitrary, Gen, QuickCheck};
use pezsp_blockchain::Error as ClientError;
use pezsp_test_primitives::{Block, BlockNumber, Hash};
use quickcheck::{Arbitrary, Gen, QuickCheck};
use std::collections::{HashMap, HashSet};
#[test]
@@ -26,8 +26,8 @@ use crate::{
use codec::{Decode, Encode};
use futures::{channel::oneshot, stream::StreamExt};
use log::{debug, trace};
use prost::Message;
use pezsc_network_types::PeerId;
use prost::Message;
use schnellru::{ByLength, LruMap};
use pezsc_client_api::{BlockBackend, ProofProvider};
@@ -46,8 +46,6 @@ use crate::{
use futures::{channel::oneshot, FutureExt};
use log::{debug, error, info, trace, warn};
use prometheus_endpoint::{register, Gauge, PrometheusError, Registry, U64};
use prost::Message;
use pezsc_client_api::{blockchain::BlockGap, BlockBackend, ProofProvider};
use pezsc_consensus::{BlockImportError, BlockImportStatus, IncomingBlock};
use pezsc_network::{IfDisconnected, ProtocolName};
@@ -64,6 +62,8 @@ use pezsp_runtime::{
},
EncodedJustification, Justifications,
};
use prometheus_endpoint::{register, Gauge, PrometheusError, Registry, U64};
use prost::Message;
use std::{
any::Any,
@@ -142,8 +142,10 @@ impl Metrics {
fn register(r: &Registry) -> Result<Self, PrometheusError> {
Ok(Self {
queued_blocks: {
let g =
Gauge::new("bizinikiwi_sync_queued_blocks", "Number of blocks in import queue")?;
let g = Gauge::new(
"bizinikiwi_sync_queued_blocks",
"Number of blocks in import queue",
)?;
register(g, r)?
},
fork_targets: {
@@ -23,17 +23,17 @@ use crate::{
block_relay_protocol::BlockResponseError, mock::MockBlockDownloader,
service::network::NetworkServiceProvider,
};
use bizinikiwi_test_runtime_client::{
runtime::{Block, Hash, Header},
BlockBuilderExt, ClientBlockImportExt, ClientExt, DefaultTestClientBuilderExt, TestClient,
TestClientBuilder, TestClientBuilderExt,
};
use futures::{channel::oneshot::Canceled, executor::block_on};
use pezsc_block_builder::BlockBuilderBuilder;
use pezsc_network::RequestFailure;
use pezsc_network_common::sync::message::{BlockAnnounce, BlockData, BlockState, FromBlock};
use pezsp_blockchain::HeaderBackend;
use std::sync::Mutex;
use bizinikiwi_test_runtime_client::{
runtime::{Block, Hash, Header},
BlockBuilderExt, ClientBlockImportExt, ClientExt, DefaultTestClientBuilderExt, TestClient,
TestClientBuilder, TestClientBuilderExt,
};
#[derive(Debug)]
struct ProxyBlockDownloader {
@@ -33,7 +33,6 @@ use crate::{
LOG_TARGET,
};
use log::{debug, error, info, warn};
use prometheus_endpoint::Registry;
use pezsc_client_api::{BlockBackend, ProofProvider};
use pezsc_consensus::{BlockImportError, BlockImportStatus};
use pezsc_network::ProtocolName;
@@ -41,6 +40,7 @@ use pezsc_network_common::sync::{message::BlockAnnounce, SyncMode};
use pezsc_network_types::PeerId;
use pezsp_blockchain::{Error as ClientError, HeaderBackend, HeaderMetadata};
use pezsp_runtime::traits::{Block as BlockT, Header, NumberFor};
use prometheus_endpoint::Registry;
use std::{any::Any, collections::HashMap, sync::Arc};
/// Corresponding `ChainSync` mode.
@@ -31,7 +31,6 @@ use crate::{
};
use futures::{channel::oneshot, FutureExt};
use log::{debug, error, trace};
use prost::Message;
use pezsc_client_api::ProofProvider;
use pezsc_consensus::{BlockImportError, BlockImportStatus, IncomingBlock};
use pezsc_network::{IfDisconnected, ProtocolName};
@@ -42,6 +41,7 @@ use pezsp_runtime::{
traits::{Block as BlockT, Header, NumberFor},
Justifications, SaturatedConversion,
};
use prost::Message;
use std::{any::Any, collections::HashMap, sync::Arc};
mod rep {
@@ -398,16 +398,16 @@ mod test {
service::network::NetworkServiceProvider,
strategy::state_sync::{ImportResult, StateSyncProgress, StateSyncProvider},
};
use bizinikiwi_test_runtime_client::{
runtime::{Block, Hash},
BlockBuilderExt, DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
use codec::Decode;
use pezsc_block_builder::BlockBuilderBuilder;
use pezsc_client_api::KeyValueStates;
use pezsc_consensus::{ImportedAux, ImportedState};
use pezsp_core::H256;
use pezsp_runtime::traits::Zero;
use bizinikiwi_test_runtime_client::{
runtime::{Block, Hash},
BlockBuilderExt, DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
mockall::mock! {
pub StateSync<B: BlockT> {}
@@ -26,12 +26,12 @@ use codec::{Decode, Encode};
use log::debug;
use pezsc_client_api::{CompactProof, KeyValueStates, ProofProvider};
use pezsc_consensus::ImportedState;
use smallvec::SmallVec;
use pezsp_core::storage::well_known_keys;
use pezsp_runtime::{
traits::{Block as BlockT, Header, NumberFor},
Justifications,
};
use smallvec::SmallVec;
use std::{collections::HashMap, fmt, sync::Arc};
/// Generic state sync provider. Used for mocking in tests.
@@ -772,16 +772,16 @@ where
mod test {
use super::*;
use crate::{mock::MockBlockDownloader, service::network::NetworkServiceProvider};
use bizinikiwi_test_runtime_client::{
runtime::{Block, Hash},
BlockBuilderExt, DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
use pezsc_block_builder::BlockBuilderBuilder;
use pezsp_blockchain::{BlockStatus, Error as BlockchainError, HeaderBackend, Info};
use pezsp_consensus_grandpa::{AuthorityList, SetId, GRANDPA_ENGINE_ID};
use pezsp_core::H256;
use pezsp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor};
use std::{io::ErrorKind, sync::Arc};
use bizinikiwi_test_runtime_client::{
runtime::{Block, Hash},
BlockBuilderExt, DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
mockall::mock! {
pub Client<B: BlockT> {}
@@ -19,17 +19,17 @@
//! Testing block import logic.
use super::*;
use bizinikiwi_test_runtime_client::{
self,
prelude::*,
runtime::{Block, Hash},
};
use futures::executor::block_on;
use pezsc_consensus::{
import_single_block, BasicQueue, BlockImportError, BlockImportStatus, ImportedAux,
IncomingBlock,
};
use pezsp_consensus::BlockOrigin;
use bizinikiwi_test_runtime_client::{
self,
prelude::*,
runtime::{Block, Hash},
};
fn prepare_good_block() -> (TestClient, Hash, u64, PeerId, IncomingBlock<Block>) {
let client = bizinikiwi_test_runtime_client::new();
@@ -27,10 +27,10 @@ use pezsc_network::{
Roles,
};
use bizinikiwi_test_runtime_client::runtime;
use pezsc_network_common::sync::message::BlockAnnouncesHandshake;
use pezsp_runtime::traits::Zero;
use std::{sync::Arc, time::Duration};
use bizinikiwi_test_runtime_client::runtime;
use tokio::sync::Mutex;
/// High level network backend (litep2p or libp2p) test client.
+4 -4
View File
@@ -21,16 +21,16 @@
use futures::prelude::*;
use libp2p::PeerId;
use rand::{
distributions::{Distribution, Uniform, WeightedIndex},
seq::IteratorRandom,
};
use pezsc_network::{
peer_store::{PeerStore, PeerStoreProvider},
protocol_controller::{IncomingIndex, Message, ProtoSetConfig, ProtocolController, SetId},
ReputationChange,
};
use pezsc_utils::mpsc::tracing_unbounded;
use rand::{
distributions::{Distribution, Uniform, WeightedIndex},
seq::IteratorRandom,
};
use std::{
collections::{HashMap, HashSet},
sync::Arc,
+5 -5
View File
@@ -36,6 +36,11 @@ use std::{
time::Duration,
};
use bizinikiwi_test_runtime_client::Sr25519Keyring;
pub use bizinikiwi_test_runtime_client::{
runtime::{Block, ExtrinsicBuilder, Hash, Header, Transfer},
TestClient, TestClientBuilder, TestClientBuilderExt,
};
use futures::{future::BoxFuture, pin_mut, prelude::*};
use libp2p::PeerId;
use log::trace;
@@ -93,11 +98,6 @@ use pezsp_runtime::{
traits::{Block as BlockT, Header as HeaderT, NumberFor, Zero},
Justification, Justifications,
};
use bizinikiwi_test_runtime_client::Sr25519Keyring;
pub use bizinikiwi_test_runtime_client::{
runtime::{Block, ExtrinsicBuilder, Hash, Header, Transfer},
TestClient, TestClientBuilder, TestClientBuilderExt,
};
use tokio::time::timeout;
/// A Verifier that accepts all blocks and passes them on with the configured
@@ -18,6 +18,10 @@
use futures::prelude::*;
use bizinikiwi_test_runtime_client::{
runtime::{Block as TestBlock, Hash as TestHash},
TestClientBuilder, TestClientBuilderExt as _,
};
use pezsc_consensus::{ImportQueue, Link};
use pezsc_network::{
config::{self, FullNetworkConfiguration, MultiaddrWithPeerId, ProtocolId, TransportConfig},
@@ -38,10 +42,6 @@ use pezsc_network_sync::{
};
use pezsp_blockchain::HeaderBackend;
use pezsp_runtime::traits::{Block as BlockT, Zero};
use bizinikiwi_test_runtime_client::{
runtime::{Block as TestBlock, Hash as TestHash},
TestClientBuilder, TestClientBuilderExt as _,
};
use std::{sync::Arc, time::Duration};
+2 -2
View File
@@ -17,10 +17,10 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use super::*;
use bizinikiwi_test_runtime::Header;
use futures::Future;
use pezsp_consensus::{block_validation::Validation, BlockOrigin};
use pezsp_runtime::Justifications;
use bizinikiwi_test_runtime::Header;
async fn test_ancestor_search_when_common_is(n: usize) {
pezsp_tracing::try_init_simple();
@@ -1303,9 +1303,9 @@ async fn warp_sync_to_target_block() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn syncs_huge_blocks() {
use bizinikiwi_test_runtime_client::BlockBuilderExt;
use pezsp_core::storage::well_known_keys::HEAP_PAGES;
use pezsp_runtime::codec::Encode;
use bizinikiwi_test_runtime_client::BlockBuilderExt;
pezsp_tracing::try_init_simple();
let mut net = TestNet::new(2);
@@ -32,7 +32,6 @@ use codec::{Decode, Encode};
use futures::{prelude::*, stream::FuturesUnordered};
use log::{debug, trace, warn};
use prometheus_endpoint::{register, Counter, PrometheusError, Registry, U64};
use pezsc_network::{
config::{NonReservedPeerMode, ProtocolId, SetConfig},
error, multiaddr,
@@ -50,6 +49,7 @@ use pezsc_network_sync::{SyncEvent, SyncEventStream};
use pezsc_network_types::PeerId;
use pezsc_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnboundedSender};
use pezsp_runtime::traits::Block as BlockT;
use prometheus_endpoint::{register, Counter, PrometheusError, Registry, U64};
use std::{
collections::{hash_map::Entry, HashMap},