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
@@ -21,8 +21,8 @@
use std::{fmt::Debug, sync::Arc};
use codec::Codec;
use pez_fork_tree::ForkTree;
use parking_lot::RwLock;
use pez_fork_tree::ForkTree;
use pezsp_api::ProvideRuntimeApi;
use pezsp_blockchain::{HeaderBackend, HeaderMetadata};
use pezsp_consensus_aura::{AuraApi, ConsensusLog, AURA_ENGINE_ID};
@@ -108,7 +108,8 @@ where
compatibility_mode,
)
.map_err(|e| format!("Could not fetch authorities at {:?}: {}", parent_hash, e))?;
let is_descendent_of = pezsc_client_api::utils::is_descendent_of(&*self.client, None);
let is_descendent_of =
pezsc_client_api::utils::is_descendent_of(&*self.client, None);
let mut authorities_cache = self.authorities.write();
authorities_cache
.import(
@@ -24,7 +24,6 @@ use crate::{
};
use codec::Codec;
use log::{debug, info, trace};
use prometheus_endpoint::Registry;
use pezsc_client_api::{backend::AuxStore, BlockOf, UsageProvider};
use pezsc_consensus::{
block_import::{BlockImport, BlockImportParams, ForkChoiceStrategy},
@@ -44,6 +43,7 @@ use pezsp_runtime::{
traits::{Block as BlockT, Header, NumberFor},
DigestItem,
};
use prometheus_endpoint::Registry;
use std::{fmt::Debug, sync::Arc};
/// check a header has been signed by the right key. If the slot is too far in the future, an error
+4 -4
View File
@@ -546,6 +546,10 @@ where
#[cfg(test)]
mod tests {
use super::*;
use bizinikiwi_test_runtime_client::{
runtime::{Header, H256},
TestClient,
};
use parking_lot::Mutex;
use pezsc_block_builder::BlockBuilderBuilder;
use pezsc_client_api::BlockchainEvents;
@@ -568,10 +572,6 @@ mod tests {
task::Poll,
time::{Duration, Instant},
};
use bizinikiwi_test_runtime_client::{
runtime::{Header, H256},
TestClient,
};
const SLOT_DURATION_MS: u64 = 1000;
@@ -193,6 +193,10 @@ impl From<Error> for ErrorObjectOwned {
#[cfg(test)]
mod tests {
use super::*;
use bizinikiwi_test_runtime_client::{
runtime::Block, Backend, DefaultTestClientBuilderExt, TestClient, TestClientBuilder,
TestClientBuilderExt,
};
use pezsc_consensus_babe::ImportQueueParams;
use pezsc_rpc_api::DenyUnsafe;
use pezsc_transaction_pool_api::{OffchainTransactionPoolFactory, RejectAllTxPool};
@@ -200,10 +204,6 @@ mod tests {
use pezsp_core::{crypto::key_types::BABE, testing::TaskExecutor};
use pezsp_keyring::Sr25519Keyring;
use pezsp_keystore::{testing::MemoryKeystore, Keystore};
use bizinikiwi_test_runtime_client::{
runtime::Block, Backend, DefaultTestClientBuilderExt, TestClient, TestClientBuilder,
TestClientBuilderExt,
};
fn create_keystore(authority: Sr25519Keyring) -> KeystorePtr {
let keystore = MemoryKeystore::new();
@@ -213,8 +213,8 @@ mod tests {
keystore.into()
}
fn test_babe_rpc_module() -> Babe<Block, TestClient, pezsc_consensus::LongestChain<Backend, Block>>
{
fn test_babe_rpc_module(
) -> Babe<Block, TestClient, pezsc_consensus::LongestChain<Backend, Block>> {
let builder = TestClientBuilder::new();
let (client, longest_chain) = builder.build_with_longest_chain();
let client = Arc::new(client);
@@ -139,6 +139,7 @@ pub fn load_block_weight<H: Encode, B: AuxStore>(
mod test {
use super::*;
use crate::migration::EpochV0;
use bizinikiwi_test_runtime_client;
use pez_fork_tree::ForkTree;
use pezsc_consensus_epochs::{EpochHeader, PersistedEpoch, PersistedEpochHeader};
use pezsc_network_test::Block as TestBlock;
@@ -146,7 +147,6 @@ mod test {
use pezsp_consensus_babe::AllowedSlots;
use pezsp_core::H256;
use pezsp_runtime::traits::NumberFor;
use bizinikiwi_test_runtime_client;
#[test]
fn load_decode_from_v0_epoch_changes() {
@@ -20,6 +20,7 @@
use super::*;
use authorship::claim_slot;
use bizinikiwi_test_runtime_client::DefaultTestClientBuilderExt;
use pezsc_block_builder::{BlockBuilder, BlockBuilderBuilder};
use pezsc_client_api::{BlockchainEvents, Finalizer};
use pezsc_consensus::{BoxBlockImport, BoxJustificationImport};
@@ -43,7 +44,6 @@ use pezsp_runtime::{
traits::Block as BlockT,
};
use std::{cell::RefCell, task::Poll, time::Duration};
use bizinikiwi_test_runtime_client::DefaultTestClientBuilderExt;
type Item = DigestItem;
@@ -163,6 +163,7 @@ where
mod tests {
use super::*;
use bizinikiwi_test_runtime_client::runtime::Block;
use codec::{Decode, Encode};
use jsonrpsee::{core::EmptyServerParams as EmptyParams, RpcModule};
use pezsc_consensus_beefy::{
@@ -171,7 +172,6 @@ mod tests {
};
use pezsp_consensus_beefy::{ecdsa_crypto, known_payloads, Payload, SignedCommitment};
use pezsp_runtime::traits::{BlakeTwo256, Hash};
use bizinikiwi_test_runtime_client::runtime::Block;
fn setup_io_handler() -> (
RpcModule<Beefy<Block, ecdsa_crypto::AuthorityId>>,
@@ -190,9 +190,12 @@ mod tests {
let (finality_proof_sender, finality_proof_stream) =
BeefyVersionedFinalityProofStream::<Block, ecdsa_crypto::AuthorityId>::channel();
let handler =
Beefy::new(finality_proof_stream, best_block_stream, pezsc_rpc::testing::test_executor())
.expect("Setting up the BEEFY RPC handler works");
let handler = Beefy::new(
finality_proof_stream,
best_block_stream,
pezsc_rpc::testing::test_executor(),
)
.expect("Setting up the BEEFY RPC handler works");
(handler.into_rpc(), finality_proof_sender)
}
@@ -607,7 +607,12 @@ pub(crate) mod tests {
unimplemented!()
}
fn send_topic(&mut self, _who: &pezsc_network_types::PeerId, _topic: B::Hash, _force: bool) {
fn send_topic(
&mut self,
_who: &pezsc_network_types::PeerId,
_topic: B::Hash,
_force: bool,
) {
unimplemented!()
}
}
@@ -81,12 +81,12 @@ pub(crate) fn verify_with_validator_set<'a, Block: BlockT, AuthorityId: Authorit
#[cfg(test)]
pub(crate) mod tests {
use bizinikiwi_test_runtime_client::runtime::Block;
use codec::Encode;
use pezsp_consensus_beefy::{
ecdsa_crypto, known_payloads, test_utils::Keyring, Commitment, Payload, SignedCommitment,
VersionedFinalityProof,
};
use bizinikiwi_test_runtime_client::runtime::Block;
use super::*;
use crate::tests::make_beefy_ids;
+4 -3
View File
@@ -34,7 +34,6 @@ use crate::{
use futures::{stream::Fuse, FutureExt, StreamExt};
use log::{debug, error, info, trace, warn};
use parking_lot::Mutex;
use prometheus_endpoint::Registry;
use pezsc_client_api::{Backend, BlockBackend, BlockchainEvents, FinalityNotification, Finalizer};
use pezsc_consensus::BlockImport;
use pezsc_network::{NetworkRequest, NotificationService, ProtocolName};
@@ -48,6 +47,7 @@ use pezsp_consensus_beefy::{
};
use pezsp_keystore::KeystorePtr;
use pezsp_runtime::traits::{Block, Header as HeaderT, NumberFor, Zero};
use prometheus_endpoint::Registry;
use std::{
collections::{BTreeMap, VecDeque},
future::Future,
@@ -557,8 +557,9 @@ pub async fn start_beefy_gadget<B, BE, C, N, P, R, S, AuthorityId>(
let mut block_import_justif = links.from_block_import_justif_stream.subscribe(100_000).fuse();
// Subscribe to finality notifications and justifications before waiting for runtime pezpallet and
// reuse the streams, so we don't miss notifications while waiting for pezpallet to be available.
// Subscribe to finality notifications and justifications before waiting for runtime pezpallet
// and reuse the streams, so we don't miss notifications while waiting for pezpallet to be
// available.
let finality_notifications = client.finality_notification_stream();
let (mut transformer, mut finality_notifications) =
finality_notification_transformer_future(finality_notifications);
@@ -36,6 +36,7 @@ use crate::{
worker::PersistedState,
BeefyRPCLinks, BeefyVoterLinks, BeefyWorkerBuilder, KnownPeers, UnpinnedFinalityNotification,
};
use bizinikiwi_test_runtime_client::{BlockBuilderExt, ClientExt};
use futures::{
future,
stream::{Fuse, FuturesUnordered},
@@ -43,7 +44,9 @@ use futures::{
};
use parking_lot::Mutex;
use pezsc_block_builder::BlockBuilderBuilder;
use pezsc_client_api::{Backend as BackendT, BlockchainEvents, FinalityNotifications, HeaderBackend};
use pezsc_client_api::{
Backend as BackendT, BlockchainEvents, FinalityNotifications, HeaderBackend,
};
use pezsc_consensus::{
BlockImport, BlockImportParams, BoxJustificationImport, ForkChoiceStrategy, ImportResult,
ImportedAux,
@@ -54,7 +57,6 @@ use pezsc_network_test::{
PeersFullClient, TestNetFactory,
};
use pezsc_utils::{mpsc::TracingUnboundedReceiver, notification::NotificationReceiver};
use serde::{Deserialize, Serialize};
use pezsp_api::{ApiRef, ProvideRuntimeApi};
use pezsp_application_crypto::key_types::BEEFY as BEEFY_KEY_TYPE;
use pezsp_consensus::BlockOrigin;
@@ -76,8 +78,8 @@ use pezsp_runtime::{
traits::{Header as HeaderT, NumberFor},
BuildStorage, DigestItem, EncodedJustification, Justifications, Storage,
};
use serde::{Deserialize, Serialize};
use std::{marker::PhantomData, sync::Arc, task::Poll};
use bizinikiwi_test_runtime_client::{BlockBuilderExt, ClientExt};
use tokio::time::Duration;
const GENESIS_HASH: H256 = H256::zero();
@@ -1395,7 +1397,8 @@ async fn beefy_finalizing_after_pallet_genesis() {
// Minimum BEEFY block delta is 1.
// GRANDPA finalize blocks leading up to BEEFY pezpallet genesis -> BEEFY should finalize nothing.
// GRANDPA finalize blocks leading up to BEEFY pezpallet genesis -> BEEFY should finalize
// nothing.
finalize_block_and_wait_for_beefy(&net, peers.clone(), &hashes[14], &[]).await;
// GRANDPA finalize block #16 -> BEEFY should finalize #15 (genesis mandatory) and #16.
@@ -1035,6 +1035,10 @@ pub(crate) mod tests {
},
BeefyRPCLinks, KnownPeers,
};
use bizinikiwi_test_runtime_client::{
runtime::{Block, Digest, DigestItem, Header},
Backend,
};
use futures::{future::poll_fn, task::Poll};
use parking_lot::Mutex;
use pezsc_client_api::{Backend as BackendT, HeaderBackend};
@@ -1050,10 +1054,6 @@ pub(crate) mod tests {
ConsensusLog, Payload, SignedCommitment,
};
use pezsp_runtime::traits::{Header as HeaderT, One};
use bizinikiwi_test_runtime_client::{
runtime::{Block, Digest, DigestItem, Header},
Backend,
};
impl<B: super::Block, AuthorityId: AuthorityIdBound> PersistedState<B, AuthorityId> {
pub fn active_round(&self) -> Result<&Rounds<B, AuthorityId>, Error> {
@@ -18,11 +18,11 @@
//! Block import helpers.
use serde::{Deserialize, Serialize};
use pezsp_runtime::{
traits::{Block as BlockT, HashingFor, Header as HeaderT, NumberFor},
DigestItem, Justification, Justifications,
};
use serde::{Deserialize, Serialize};
use std::{any::Any, borrow::Cow, collections::HashMap, sync::Arc};
use pezsp_consensus::{BlockOrigin, Error};
@@ -20,13 +20,13 @@ use futures::{
task::{Context, Poll},
};
use log::{debug, trace};
use prometheus_endpoint::Registry;
use pezsc_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnboundedSender};
use pezsp_consensus::BlockOrigin;
use pezsp_runtime::{
traits::{Block as BlockT, Header as HeaderT, NumberFor},
Justification, Justifications,
};
use prometheus_endpoint::Registry;
use std::pin::Pin;
use crate::{
@@ -36,13 +36,13 @@ mod report;
use error::Error;
use finality::{EncodedFinalityProof, RpcFinalityProofProvider};
use notification::JustificationNotification;
use report::{ReportAuthoritySet, ReportVoterState, ReportedRoundStates};
use pezsc_consensus_grandpa::GrandpaJustificationStream;
use pezsc_rpc::{
utils::{BoundedVecDeque, PendingSubscription},
SubscriptionTaskExecutor,
};
use pezsp_runtime::traits::{Block as BlockT, NumberFor};
use report::{ReportAuthoritySet, ReportVoterState, ReportedRoundStates};
/// Provides RPC methods for interacting with GRANDPA.
#[rpc(client, server)]
@@ -133,6 +133,10 @@ mod tests {
use super::*;
use std::{collections::HashSet, sync::Arc};
use bizinikiwi_test_runtime_client::{
runtime::{Block, Header, H256},
DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
use codec::{Decode, Encode};
use jsonrpsee::{core::EmptyServerParams as EmptyParams, types::SubscriptionId, RpcModule};
use pezsc_block_builder::BlockBuilderBuilder;
@@ -144,10 +148,6 @@ mod tests {
use pezsp_core::crypto::ByteArray;
use pezsp_keyring::Ed25519Keyring;
use pezsp_runtime::traits::{Block as BlockT, Header as HeaderT};
use bizinikiwi_test_runtime_client::{
runtime::{Block, Header, H256},
DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
struct TestAuthoritySet;
struct TestVoterState;
@@ -18,8 +18,8 @@
use codec::Encode;
use pezsc_consensus_grandpa::GrandpaJustification;
use serde::{Deserialize, Serialize};
use pezsp_runtime::traits::Block as BlockT;
use serde::{Deserialize, Serialize};
/// An encoded justification proving that the given header has been finalized
#[derive(Clone, Serialize, Deserialize)]
@@ -22,9 +22,9 @@ use std::{cmp::Ord, fmt::Debug, ops::Add};
use codec::{Decode, Encode};
use finality_grandpa::voter_set::VoterSet;
use pez_fork_tree::{FilterAction, ForkTree};
use log::debug;
use parking_lot::MappedMutexGuard;
use pez_fork_tree::{FilterAction, ForkTree};
use pezsc_consensus::shared_data::{SharedData, SharedDataLocked};
use pezsc_telemetry::{telemetry, TelemetryHandle, CONSENSUS_INFO};
use pezsp_consensus_grandpa::{AuthorityId, AuthorityList};
@@ -504,9 +504,9 @@ pub(crate) fn load_authorities<B: AuxStore, H: Decode, N: Decode + Clone + Ord>(
#[cfg(test)]
mod test {
use super::*;
use bizinikiwi_test_runtime_client::{self, runtime::Block};
use pezsp_consensus_grandpa::AuthorityId;
use pezsp_core::{crypto::UncheckedFrom, H256};
use bizinikiwi_test_runtime_client::{self, runtime::Block};
fn dummy_id() -> AuthorityId {
AuthorityId::unchecked_from([1; 32])
@@ -88,8 +88,6 @@
use ahash::{AHashMap, AHashSet};
use codec::{Decode, DecodeAll, Encode};
use log::{debug, trace};
use prometheus_endpoint::{register, CounterVec, Opts, PrometheusError, Registry, U64};
use rand::seq::SliceRandom;
use pezsc_network::ReputationChange;
use pezsc_network_common::role::ObservedRole;
use pezsc_network_gossip::{MessageIntent, ValidatorContext};
@@ -98,6 +96,8 @@ use pezsc_telemetry::{telemetry, TelemetryHandle, CONSENSUS_DEBUG};
use pezsc_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnboundedSender};
use pezsp_consensus_grandpa::AuthorityId;
use pezsp_runtime::traits::{Block as BlockT, NumberFor, Zero};
use prometheus_endpoint::{register, CounterVec, Opts, PrometheusError, Registry, U64};
use rand::seq::SliceRandom;
use super::{benefit, cost, Round, SetId, NEIGHBOR_REBROADCAST_PERIOD};
use crate::{environment, CatchUp, CompactCommit, SignedMessage, LOG_TARGET};
@@ -1666,11 +1666,11 @@ pub(super) struct PeerReport {
mod tests {
use super::{super::NEIGHBOR_REBROADCAST_PERIOD, environment::SharedVoterSetState, *};
use crate::communication;
use bizinikiwi_test_runtime_client::runtime::{Block, Header};
use pezsc_network::config::Role;
use pezsc_network_gossip::Validator as GossipValidatorT;
use pezsp_core::{crypto::UncheckedFrom, H256};
use std::time::Instant;
use bizinikiwi_test_runtime_client::runtime::{Block, Header};
// some random config (not really needed)
fn config() -> crate::Config {
@@ -389,7 +389,8 @@ fn good_commit_leads_to_relay() {
for (i, key) in private.iter().enumerate() {
precommits.push(precommit.clone());
let signature = pezsp_consensus_grandpa::AuthoritySignature::from(key.sign(&payload[..]));
let signature =
pezsp_consensus_grandpa::AuthoritySignature::from(key.sign(&payload[..]));
auth_data.push((signature, public[i].0.clone()))
}
@@ -540,7 +541,8 @@ fn bad_commit_leads_to_report() {
for (i, key) in private.iter().enumerate() {
precommits.push(precommit.clone());
let signature = pezsp_consensus_grandpa::AuthoritySignature::from(key.sign(&payload[..]));
let signature =
pezsp_consensus_grandpa::AuthoritySignature::from(key.sign(&payload[..]));
auth_data.push((signature, public[i].0.clone()))
}
@@ -400,7 +400,10 @@ impl Metrics {
) -> Result<Self, PrometheusError> {
Ok(Self {
finality_grandpa_round: register(
Gauge::new("bizinikiwi_finality_grandpa_round", "Highest completed GRANDPA round.")?,
Gauge::new(
"bizinikiwi_finality_grandpa_round",
"Highest completed GRANDPA round.",
)?,
registry,
)?,
finality_grandpa_prevotes: register(
@@ -260,6 +260,11 @@ where
mod tests {
use super::*;
use crate::{authorities::AuthoritySetChanges, BlockNumberOps, ClientError, SetId};
use bizinikiwi_test_runtime_client::{
runtime::{Block, Header, H256},
Backend as TestBackend, ClientBlockImportExt, ClientExt, DefaultTestClientBuilderExt,
TestClient, TestClientBuilder, TestClientBuilderExt,
};
use futures::executor::block_on;
use pezsc_block_builder::BlockBuilderBuilder;
use pezsc_client_api::{apply_aux, LockImportRun};
@@ -267,11 +272,6 @@ mod tests {
use pezsp_consensus_grandpa::GRANDPA_ENGINE_ID as ID;
use pezsp_core::crypto::UncheckedFrom;
use pezsp_keyring::Ed25519Keyring;
use bizinikiwi_test_runtime_client::{
runtime::{Block, Header, H256},
Backend as TestBackend, ClientBlockImportExt, ClientExt, DefaultTestClientBuilderExt,
TestClient, TestClientBuilder, TestClientBuilderExt,
};
/// Check GRANDPA proof-of-finality for the given block.
///
@@ -32,7 +32,9 @@ use pezsc_utils::mpsc::TracingUnboundedSender;
use pezsp_api::{Core, RuntimeApiInfo};
use pezsp_blockchain::BlockStatus;
use pezsp_consensus::{BlockOrigin, Error as ConsensusError, SelectChain};
use pezsp_consensus_grandpa::{ConsensusLog, GrandpaApi, ScheduledChange, SetId, GRANDPA_ENGINE_ID};
use pezsp_consensus_grandpa::{
ConsensusLog, GrandpaApi, ScheduledChange, SetId, GRANDPA_ENGINE_ID,
};
use pezsp_runtime::{
generic::OpaqueDigestItemId,
traits::{Block as BlockT, Header as HeaderT, NumberFor, Zero},
@@ -60,7 +60,6 @@ use codec::Decode;
use futures::{prelude::*, StreamExt};
use log::{debug, error, info};
use parking_lot::RwLock;
use prometheus_endpoint::{PrometheusError, Registry};
use pezsc_client_api::{
backend::{AuxStore, Backend},
utils::is_descendent_of,
@@ -73,7 +72,9 @@ use pezsc_transaction_pool_api::OffchainTransactionPoolFactory;
use pezsc_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver};
use pezsp_api::ProvideRuntimeApi;
use pezsp_application_crypto::AppCrypto;
use pezsp_blockchain::{Error as ClientError, HeaderBackend, HeaderMetadata, Result as ClientResult};
use pezsp_blockchain::{
Error as ClientError, HeaderBackend, HeaderMetadata, Result as ClientResult,
};
use pezsp_consensus::SelectChain;
use pezsp_consensus_grandpa::{
AuthorityList, AuthoritySignature, SetId, CLIENT_LOG_TARGET as LOG_TARGET,
@@ -84,6 +85,7 @@ use pezsp_runtime::{
generic::BlockId,
traits::{Block as BlockT, NumberFor, Zero},
};
use prometheus_endpoint::{PrometheusError, Registry};
pub use finality_grandpa::BlockNumberOps;
use finality_grandpa::{voter, voter_set::VoterSet, Error as GrandpaError};
@@ -682,8 +684,8 @@ pub struct GrandpaParams<Block: BlockT, C, N, S, SC, VR> {
/// The Network instance.
///
/// It is assumed that this network will feed us Grandpa notifications. When using the
/// `pezsc_network` crate, it is assumed that the Grandpa notifications protocol has been passed
/// to the configuration of the networking. See [`grandpa_peers_set_config`].
/// `pezsc_network` crate, it is assumed that the Grandpa notifications protocol has been
/// passed to the configuration of the networking. See [`grandpa_peers_set_config`].
pub network: N,
/// Event stream for syncing-related events.
pub sync: S,
@@ -410,10 +410,10 @@ mod tests {
communication::tests::{make_test_network, Event},
};
use assert_matches::assert_matches;
use bizinikiwi_test_runtime_client::{TestClientBuilder, TestClientBuilderExt};
use pezsc_network_types::PeerId;
use pezsc_utils::mpsc::tracing_unbounded;
use pezsp_blockchain::HeaderBackend as _;
use bizinikiwi_test_runtime_client::{TestClientBuilder, TestClientBuilderExt};
use futures::executor;
@@ -21,6 +21,7 @@
use super::*;
use assert_matches::assert_matches;
use async_trait::async_trait;
use bizinikiwi_test_runtime_client::{runtime::BlockNumber, BlockBuilderExt};
use environment::HasVoted;
use futures_timer::Delay;
use parking_lot::{Mutex, RwLock};
@@ -49,7 +50,6 @@ use pezsp_runtime::{
Justifications,
};
use std::{collections::HashSet, pin::Pin};
use bizinikiwi_test_runtime_client::{runtime::BlockNumber, BlockBuilderExt};
use tokio::runtime::Handle;
use authorities::AuthoritySet;
@@ -35,11 +35,11 @@ use futures::{
use futures_timer::Delay;
use log::{debug, warn};
use parking_lot::Mutex;
use prometheus_endpoint::{register, Gauge, PrometheusError, Registry, U64};
use pezsc_client_api::{BlockImportNotification, ImportNotifications};
use pezsc_utils::mpsc::TracingUnboundedReceiver;
use pezsp_consensus_grandpa::AuthorityId;
use pezsp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor};
use prometheus_endpoint::{register, Gauge, PrometheusError, Registry, U64};
use std::{
collections::{HashMap, VecDeque},
@@ -562,6 +562,7 @@ pub(crate) type UntilGlobalMessageBlocksImported<Block, BlockStatus, BlockSyncRe
mod tests {
use super::*;
use crate::{CatchUp, CompactCommit};
use bizinikiwi_test_runtime_client::runtime::{Block, Hash, Header};
use finality_grandpa::Precommit;
use futures::future::Either;
use futures_timer::Delay;
@@ -569,7 +570,6 @@ mod tests {
use pezsc_utils::mpsc::{tracing_unbounded, TracingUnboundedSender};
use pezsp_consensus::BlockOrigin;
use pezsp_core::crypto::UncheckedFrom;
use bizinikiwi_test_runtime_client::runtime::{Block, Hash, Header};
#[derive(Clone)]
struct TestChainState {
@@ -347,18 +347,18 @@ where
mod tests {
use super::WarpSyncProof;
use crate::{AuthoritySetChanges, GrandpaJustification};
use bizinikiwi_test_runtime_client::{
BlockBuilderExt, ClientBlockImportExt, ClientExt, DefaultTestClientBuilderExt,
TestClientBuilder, TestClientBuilderExt,
};
use codec::Encode;
use rand::prelude::*;
use pezsc_block_builder::BlockBuilderBuilder;
use pezsp_blockchain::HeaderBackend;
use pezsp_consensus::BlockOrigin;
use pezsp_consensus_grandpa::GRANDPA_ENGINE_ID;
use pezsp_keyring::Ed25519Keyring;
use rand::prelude::*;
use std::sync::Arc;
use bizinikiwi_test_runtime_client::{
BlockBuilderExt, ClientBlockImportExt, ClientExt, DefaultTestClientBuilderExt,
TestClientBuilder, TestClientBuilderExt,
};
#[test]
fn warp_sync_proof_generate_verify() {
@@ -426,7 +426,8 @@ mod tests {
let precommit = finality_grandpa::Precommit { target_hash, target_number };
let msg = finality_grandpa::Message::Precommit(precommit.clone());
let encoded = pezsp_consensus_grandpa::localized_payload(42, current_set_id, &msg);
let encoded =
pezsp_consensus_grandpa::localized_payload(42, current_set_id, &msg);
let signature = keyring.sign(&encoded[..]).into();
let precommit = finality_grandpa::SignedPrecommit {
@@ -82,8 +82,9 @@ impl SlotTimestampProvider {
let slot_duration = pezsc_consensus_aura::slot_duration(&*client)?;
let time = Self::with_header(&client, slot_duration, |header| {
let slot_number = *pezsc_consensus_aura::find_pre_digest::<B, AuthoritySignature>(&header)
.map_err(|err| format!("{}", err))?;
let slot_number =
*pezsc_consensus_aura::find_pre_digest::<B, AuthoritySignature>(&header)
.map_err(|err| format!("{}", err))?;
Ok(slot_number)
})?;
@@ -21,7 +21,6 @@
use futures::prelude::*;
use futures_timer::Delay;
use prometheus_endpoint::Registry;
use pezsc_client_api::{
backend::{Backend as ClientBackend, Finalizer},
client::BlockchainEvents,
@@ -35,6 +34,7 @@ use pezsp_consensus::{Environment, Proposer, SelectChain};
use pezsp_core::traits::SpawnNamed;
use pezsp_inherents::CreateInherentDataProviders;
use pezsp_runtime::{traits::Block as BlockT, ConsensusEngineId};
use prometheus_endpoint::Registry;
use std::{marker::PhantomData, sync::Arc, time::Duration};
mod error;
@@ -346,16 +346,18 @@ pub async fn run_delayed_finalize<B, CB, C, S>(
#[cfg(test)]
mod tests {
use super::*;
use pezsc_basic_authorship::ProposerFactory;
use pezsc_consensus::ImportedAux;
use pezsc_transaction_pool::{BasicPool, FullChainApi, Options, RevalidationType};
use pezsc_transaction_pool_api::{MaintainedTransactionPool, TransactionPool, TransactionSource};
use pezsp_inherents::InherentData;
use pezsp_runtime::generic::{Digest, DigestItem};
use bizinikiwi_test_runtime_client::{
DefaultTestClientBuilderExt, Sr25519Keyring::*, TestClientBuilder, TestClientBuilderExt,
};
use bizinikiwi_test_runtime_transaction_pool::{uxt, TestApi};
use pezsc_basic_authorship::ProposerFactory;
use pezsc_consensus::ImportedAux;
use pezsc_transaction_pool::{BasicPool, FullChainApi, Options, RevalidationType};
use pezsc_transaction_pool_api::{
MaintainedTransactionPool, TransactionPool, TransactionSource,
};
use pezsp_inherents::InherentData;
use pezsp_runtime::generic::{Digest, DigestItem};
fn api() -> Arc<TestApi> {
Arc::new(TestApi::empty())
@@ -25,8 +25,8 @@ use futures::{
};
use jsonrpsee::{core::async_trait, proc_macros::rpc};
use pezsc_consensus::ImportedAux;
use serde::{Deserialize, Serialize};
use pezsp_runtime::EncodedJustification;
use serde::{Deserialize, Serialize};
/// Sender passed to the authorship task to report errors or successes.
pub type Sender<T> = Option<oneshot::Sender<std::result::Result<T, Error>>>;
@@ -20,7 +20,9 @@
use crate::{rpc, ConsensusDataProvider, CreatedBlock, Error};
use futures::prelude::*;
use pezsc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy, ImportResult, StateAction};
use pezsc_consensus::{
BlockImport, BlockImportParams, ForkChoiceStrategy, ImportResult, StateAction,
};
use pezsc_transaction_pool_api::TransactionPool;
use pezsp_api::ProvideRuntimeApi;
use pezsp_blockchain::HeaderBackend;
+1 -1
View File
@@ -47,7 +47,6 @@ use crate::worker::UntilImportedOrTimeout;
use codec::{Decode, Encode};
use futures::{Future, StreamExt};
use log::*;
use prometheus_endpoint::Registry;
use pezsc_client_api::{self, backend::AuxStore, BlockOf, BlockchainEvents};
use pezsc_consensus::{
BasicQueue, BlockCheckParams, BlockImport, BlockImportParams, BoxBlockImport,
@@ -63,6 +62,7 @@ use pezsp_runtime::{
generic::{BlockId, Digest, DigestItem},
traits::{Block as BlockT, Header as HeaderT},
};
use prometheus_endpoint::Registry;
use std::{cmp::Ordering, marker::PhantomData, sync::Arc, time::Duration};
const LOG_TARGET: &str = "pow";
@@ -134,9 +134,9 @@ where
#[cfg(test)]
mod test {
use bizinikiwi_test_runtime_client;
use pezsp_core::{hash::H256, sr25519, Pair};
use pezsp_runtime::testing::{Digest as DigestTest, Header as HeaderTest};
use bizinikiwi_test_runtime_client;
use super::{check_equivocation, MAX_SLOT_CAPACITY, PRUNING_BOUND};
+6 -3
View File
@@ -36,7 +36,9 @@ use futures::{future::Either, Future, TryFutureExt};
use futures_timer::Delay;
use log::{debug, info, warn};
use pezsc_consensus::{BlockImport, JustificationSyncLink};
use pezsc_telemetry::{telemetry, TelemetryHandle, CONSENSUS_DEBUG, CONSENSUS_INFO, CONSENSUS_WARN};
use pezsc_telemetry::{
telemetry, TelemetryHandle, CONSENSUS_DEBUG, CONSENSUS_INFO, CONSENSUS_WARN,
};
use pezsp_arithmetic::traits::BaseArithmetic;
use pezsp_consensus::{Proposal, Proposer, SelectChain, SyncOracle};
use pezsp_consensus_slots::{Slot, SlotDuration};
@@ -469,7 +471,8 @@ impl<T: SimpleSlotWorker<B> + Send + Sync, B: BlockT>
/// Slot specific extension that the inherent data provider needs to implement.
pub trait InherentDataProviderExt {
/// The current slot that will be found in the [`InherentData`](`pezsp_inherents::InherentData`).
/// The current slot that will be found in the
/// [`InherentData`](`pezsp_inherents::InherentData`).
fn slot(&self) -> Slot;
}
@@ -809,9 +812,9 @@ impl<N> BackoffAuthoringBlocksStrategy<N> for () {
#[cfg(test)]
mod test {
use super::*;
use bizinikiwi_test_runtime_client::runtime::{Block, Header};
use pezsp_runtime::traits::NumberFor;
use std::time::{Duration, Instant};
use bizinikiwi_test_runtime_client::runtime::{Block, Header};
const SLOT_DURATION: Duration = Duration::from_millis(6000);