chore: regenerate umbrella crate, fix feature propagation

This commit is contained in:
2025-12-16 11:28:32 +03:00
parent ee6e42c461
commit 193f6b9294
1358 changed files with 9464 additions and 7656 deletions
Generated
+2 -8
View File
@@ -13784,7 +13784,7 @@ dependencies = [
[[package]]
name = "pezkuwi-sdk"
version = "1.11.0"
version = "0.0.0"
dependencies = [
"asset-test-pezutils",
"assets-common",
@@ -13796,6 +13796,7 @@ dependencies = [
"bizinikiwi-prometheus-endpoint",
"bizinikiwi-rpc-client",
"bizinikiwi-state-trie-migration-rpc",
"bizinikiwi-txtesttool",
"bizinikiwi-wasm-builder",
"bp-header-pez-chain",
"bp-messages",
@@ -13806,7 +13807,6 @@ dependencies = [
"bp-xcm-bridge-hub",
"bp-xcm-bridge-hub-router",
"bridge-hub-common",
"emulated-integration-tests-common",
"frame-remote-externalities",
"pez-ethereum-standards",
"pez-fork-tree",
@@ -13851,7 +13851,6 @@ dependencies = [
"pezcumulus-relay-chain-minimal-node",
"pezcumulus-relay-chain-rpc-interface",
"pezcumulus-relay-chain-streams",
"pezcumulus-test-relay-sproof-builder",
"pezframe-benchmarking",
"pezframe-benchmarking-cli",
"pezframe-benchmarking-pezpallet-pov",
@@ -13866,7 +13865,6 @@ dependencies = [
"pezframe-system",
"pezframe-system-benchmarking",
"pezframe-system-rpc-runtime-api",
"pezframe-try-runtime",
"pezkuwi-approval-distribution",
"pezkuwi-availability-bitfield-distribution",
"pezkuwi-availability-distribution",
@@ -13957,7 +13955,6 @@ dependencies = [
"pezpallet-delegated-staking",
"pezpallet-democracy",
"pezpallet-derivatives",
"pezpallet-dev-mode",
"pezpallet-dummy-dim",
"pezpallet-election-provider-multi-block",
"pezpallet-election-provider-multi-phase",
@@ -14005,7 +14002,6 @@ dependencies = [
"pezpallet-revive-proc-macro",
"pezpallet-revive-uapi",
"pezpallet-root-offences",
"pezpallet-root-testing",
"pezpallet-safe-mode",
"pezpallet-salary",
"pezpallet-scheduler",
@@ -14040,7 +14036,6 @@ dependencies = [
"pezpallet-vesting",
"pezpallet-whitelist",
"pezpallet-xcm",
"pezpallet-xcm-benchmarks",
"pezpallet-xcm-bridge-hub",
"pezpallet-xcm-bridge-hub-router",
"pezpallet-xcm-precompiles",
@@ -14135,7 +14130,6 @@ dependencies = [
"pezsp-offchain",
"pezsp-panic-handler",
"pezsp-rpc",
"pezsp-runtime",
"pezsp-runtime-interface",
"pezsp-runtime-interface-proc-macro",
"pezsp-session",
+888 -888
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -20,9 +20,9 @@
use hash_db::Prefix;
use kvdb::KeyValueDB;
use rand::Rng;
use pezsp_state_machine::Backend as _;
use pezsp_trie::{trie_types::TrieDBMutBuilderV1, TrieMut as _};
use rand::Rng;
use std::{
borrow::Cow,
collections::HashMap,
@@ -20,8 +20,8 @@ use pezkuwi_sdk::*;
use criterion::{criterion_group, criterion_main, BatchSize, Criterion, Throughput};
use pez_kitchensink_runtime::{constants::currency::*, BalancesCall};
use node_cli::service::{create_extrinsic, FullClient};
use pez_kitchensink_runtime::{constants::currency::*, BalancesCall};
use pezkuwi_sdk::pezsc_service::config::{ExecutorConfiguration, RpcConfiguration};
use pezsc_block_builder::{BlockBuilderBuilder, BuiltBlock};
use pezsc_consensus::{
+1 -1
View File
@@ -20,13 +20,13 @@ use pezkuwi_sdk::*;
use codec::{Decode, Encode};
use criterion::{criterion_group, criterion_main, BatchSize, Criterion};
use pezframe_support::Hashable;
use pez_kitchensink_runtime::{
constants::currency::*, Block, BuildStorage, CheckedExtrinsic, Header, RuntimeCall,
RuntimeGenesisConfig, UncheckedExtrinsic,
};
use pez_node_primitives::{BlockNumber, Hash};
use pez_node_testing::keyring::*;
use pezframe_support::Hashable;
use pezsc_executor::{Externalities, RuntimeVersionOf};
use pezsp_core::{
storage::well_known_keys,
@@ -18,8 +18,8 @@
use criterion::{criterion_group, criterion_main, BatchSize, Criterion, Throughput};
use futures::{future, StreamExt};
use pez_kitchensink_runtime::{constants::currency::*, BalancesCall, SudoCall};
use node_cli::service::{create_extrinsic, fetch_nonce, FullClient, TransactionPool};
use pez_kitchensink_runtime::{constants::currency::*, BalancesCall, SudoCall};
use pez_node_primitives::AccountId;
use pezkuwi_sdk::{
pezsc_service::config::{ExecutorConfiguration, RpcConfiguration},
+20 -12
View File
@@ -30,13 +30,13 @@ use pezpallet_revive::is_eth_derived;
use pezsc_chain_spec::ChainSpecExtension;
use pezsc_service::ChainType;
use pezsc_telemetry::TelemetryEndpoints;
use serde::{Deserialize, Serialize};
use pezsp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
use pezsp_consensus_babe::AuthorityId as BabeId;
use pezsp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId;
use pezsp_consensus_grandpa::AuthorityId as GrandpaId;
use pezsp_core::crypto::UncheckedInto;
use pezsp_mixnet::types::AuthorityId as MixnetId;
use serde::{Deserialize, Serialize};
pub use pez_kitchensink_runtime::RuntimeGenesisConfig;
pub use pez_node_primitives::{AccountId, Balance, Signature};
@@ -466,17 +466,25 @@ pub(crate) mod tests {
fn test_connectivity() {
pezsp_tracing::try_init_simple();
pezsc_service_test::connectivity(integration_test_config_with_two_authorities(), |config| {
let NewFullBase { task_manager, client, network, sync, transaction_pool, .. } =
new_full_base::<pezsc_network::NetworkWorker<_, _>>(config, None, false, |_, _| ())?;
Ok(pezsc_service_test::TestNetComponents::new(
task_manager,
client,
network,
sync,
transaction_pool,
))
});
pezsc_service_test::connectivity(
integration_test_config_with_two_authorities(),
|config| {
let NewFullBase { task_manager, client, network, sync, transaction_pool, .. } =
new_full_base::<pezsc_network::NetworkWorker<_, _>>(
config,
None,
false,
|_, _| (),
)?;
Ok(pezsc_service_test::TestNetComponents::new(
task_manager,
client,
network,
sync,
transaction_pool,
))
},
);
}
#[test]
+6 -3
View File
@@ -24,10 +24,10 @@ use crate::{
service::{new_partial, FullClient},
Cli, Subcommand,
};
use pezframe_benchmarking_cli::*;
use pez_kitchensink_runtime::{ExistentialDeposit, RuntimeApi};
use pez_node_primitives::Block;
use pezsc_cli::{Result, BizinikiwiCli};
use pezframe_benchmarking_cli::*;
use pezsc_cli::{BizinikiwiCli, Result};
use pezsc_service::PartialComponents;
use pezsp_keyring::Sr25519Keyring;
use pezsp_runtime::traits::HashingFor;
@@ -59,7 +59,10 @@ impl BizinikiwiCli for Cli {
2017
}
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn pezsc_service::ChainSpec>, String> {
fn load_spec(
&self,
id: &str,
) -> std::result::Result<Box<dyn pezsc_service::ChainSpec>, String> {
let spec = match id {
"" =>
return Err(
+34 -26
View File
@@ -28,18 +28,20 @@ use pezkuwi_sdk::{
use crate::Cli;
use codec::Encode;
use pezframe_benchmarking_cli::BIZINIKIWI_REFERENCE_HARDWARE;
use pezframe_system_rpc_runtime_api::AccountNonceApi;
use futures::prelude::*;
use pez_kitchensink_runtime::RuntimeApi;
use pez_node_primitives::Block;
use pezframe_benchmarking_cli::BIZINIKIWI_REFERENCE_HARDWARE;
use pezframe_system_rpc_runtime_api::AccountNonceApi;
use pezsc_client_api::{Backend, BlockBackend};
use pezsc_consensus_babe::{self, SlotProportion};
use pezsc_network::{
event::Event, service::traits::NetworkService, NetworkBackend, NetworkEventStream,
};
use pezsc_network_sync::{strategy::warp::WarpSyncConfig, SyncingService};
use pezsc_service::{config::Configuration, error::Error as ServiceError, RpcHandlers, TaskManager};
use pezsc_service::{
config::Configuration, error::Error as ServiceError, RpcHandlers, TaskManager,
};
use pezsc_statement_store::Store as StatementStore;
use pezsc_telemetry::{Telemetry, TelemetryWorker};
use pezsc_transaction_pool::TransactionPoolHandle;
@@ -121,28 +123,28 @@ pub fn create_extrinsic(
.map(|c| c / 2)
.unwrap_or(2) as u64;
let tip = 0;
let tx_ext: pez_kitchensink_runtime::TxExtension =
(
pezframe_system::AuthorizeCall::<pez_kitchensink_runtime::Runtime>::new(),
pezframe_system::CheckNonZeroSender::<pez_kitchensink_runtime::Runtime>::new(),
pezframe_system::CheckSpecVersion::<pez_kitchensink_runtime::Runtime>::new(),
pezframe_system::CheckTxVersion::<pez_kitchensink_runtime::Runtime>::new(),
pezframe_system::CheckGenesis::<pez_kitchensink_runtime::Runtime>::new(),
pezframe_system::CheckEra::<pez_kitchensink_runtime::Runtime>::from(generic::Era::mortal(
period,
best_block.saturated_into(),
)),
pezframe_system::CheckNonce::<pez_kitchensink_runtime::Runtime>::from(nonce),
pezframe_system::CheckWeight::<pez_kitchensink_runtime::Runtime>::new(),
pezpallet_skip_feeless_payment::SkipCheckIfFeeless::from(
pezpallet_asset_conversion_tx_payment::ChargeAssetTxPayment::<
pez_kitchensink_runtime::Runtime,
>::from(tip, None),
),
pezframe_metadata_hash_extension::CheckMetadataHash::new(false),
pezpallet_revive::evm::tx_extension::SetOrigin::<pez_kitchensink_runtime::Runtime>::default(),
pezframe_system::WeightReclaim::<pez_kitchensink_runtime::Runtime>::new(),
);
let tx_ext: pez_kitchensink_runtime::TxExtension = (
pezframe_system::AuthorizeCall::<pez_kitchensink_runtime::Runtime>::new(),
pezframe_system::CheckNonZeroSender::<pez_kitchensink_runtime::Runtime>::new(),
pezframe_system::CheckSpecVersion::<pez_kitchensink_runtime::Runtime>::new(),
pezframe_system::CheckTxVersion::<pez_kitchensink_runtime::Runtime>::new(),
pezframe_system::CheckGenesis::<pez_kitchensink_runtime::Runtime>::new(),
pezframe_system::CheckEra::<pez_kitchensink_runtime::Runtime>::from(generic::Era::mortal(
period,
best_block.saturated_into(),
)),
pezframe_system::CheckNonce::<pez_kitchensink_runtime::Runtime>::from(nonce),
pezframe_system::CheckWeight::<pez_kitchensink_runtime::Runtime>::new(),
pezpallet_skip_feeless_payment::SkipCheckIfFeeless::from(
pezpallet_asset_conversion_tx_payment::ChargeAssetTxPayment::<
pez_kitchensink_runtime::Runtime,
>::from(tip, None),
),
pezframe_metadata_hash_extension::CheckMetadataHash::new(false),
pezpallet_revive::evm::tx_extension::SetOrigin::<pez_kitchensink_runtime::Runtime>::default(
),
pezframe_system::WeightReclaim::<pez_kitchensink_runtime::Runtime>::new(),
);
let raw_payload = pez_kitchensink_runtime::SignedPayload::from_raw(
function.clone(),
@@ -934,7 +936,13 @@ mod tests {
config,
None,
false,
|block_import: &pezsc_consensus_babe::BabeBlockImport<Block, _, _, _, _>,
|block_import: &pezsc_consensus_babe::BabeBlockImport<
Block,
_,
_,
_,
_,
>,
babe_link: &pezsc_consensus_babe::BabeLink<Block>| {
setup_handles = Some((block_import.clone(), babe_link.clone()));
},
+22 -14
View File
@@ -176,11 +176,15 @@ fn block_with_size(time: u64, nonce: u32, size: usize) -> (Vec<u8>, Hash) {
vec![
CheckedExtrinsic {
format: pezsp_runtime::generic::ExtrinsicFormat::Bare,
function: RuntimeCall::Timestamp(pezpallet_timestamp::Call::set { now: time * 1000 }),
function: RuntimeCall::Timestamp(pezpallet_timestamp::Call::set {
now: time * 1000,
}),
},
CheckedExtrinsic {
format: pezsp_runtime::generic::ExtrinsicFormat::Signed(alice(), tx_ext(nonce, 0)),
function: RuntimeCall::System(pezframe_system::Call::remark { remark: vec![0; size] }),
function: RuntimeCall::System(pezframe_system::Call::remark {
remark: vec![0; size],
}),
},
],
(time * 1000 / SLOT_DURATION).into(),
@@ -700,8 +704,12 @@ fn deploying_wasm_contract_should_work() {
let transfer_code = wat::parse_str(CODE_TRANSFER).unwrap();
let transfer_ch = <Runtime as pezframe_system::Config>::Hashing::hash(&transfer_code);
let addr =
pezpallet_contracts::Pezpallet::<Runtime>::contract_address(&charlie(), &transfer_ch, &[], &[]);
let addr = pezpallet_contracts::Pezpallet::<Runtime>::contract_address(
&charlie(),
&transfer_ch,
&[],
&[],
);
let time = 42 * 1000;
let b = construct_block(
@@ -715,16 +723,16 @@ fn deploying_wasm_contract_should_work() {
},
CheckedExtrinsic {
format: pezsp_runtime::generic::ExtrinsicFormat::Signed(charlie(), tx_ext(0, 0)),
function: RuntimeCall::Contracts(pezpallet_contracts::Call::instantiate_with_code::<
Runtime,
> {
value: 0,
gas_limit: Weight::from_parts(500_000_000, 0),
storage_deposit_limit: None,
code: transfer_code,
data: Vec::new(),
salt: Vec::new(),
}),
function: RuntimeCall::Contracts(
pezpallet_contracts::Call::instantiate_with_code::<Runtime> {
value: 0,
gas_limit: Weight::from_parts(500_000_000, 0),
storage_deposit_limit: None,
code: transfer_code,
data: Vec::new(),
salt: Vec::new(),
},
),
},
CheckedExtrinsic {
format: pezsp_runtime::generic::ExtrinsicFormat::Signed(charlie(), tx_ext(1, 0)),
@@ -42,11 +42,21 @@ fn benchmark_pallet_args_work() {
true,
);
benchmark_pallet_args(
&["--list", "--pezpallet=pezpallet_balances", "--chain=dev", "--genesis-builder=spec-genesis"],
&[
"--list",
"--pezpallet=pezpallet_balances",
"--chain=dev",
"--genesis-builder=spec-genesis",
],
true,
);
benchmark_pallet_args(
&["--list", "--pezpallet=pezpallet_balances", "--chain=dev", "--genesis-builder=spec-runtime"],
&[
"--list",
"--pezpallet=pezpallet_balances",
"--chain=dev",
"--genesis-builder=spec-runtime",
],
true,
);
// Error because no runtime is provided:
@@ -42,11 +42,21 @@ fn benchmark_pezpallet_args_work() {
true,
);
benchmark_pezpallet_args(
&["--list", "--pezpallet=pezpallet_balances", "--chain=dev", "--genesis-builder=spec-genesis"],
&[
"--list",
"--pezpallet=pezpallet_balances",
"--chain=dev",
"--genesis-builder=spec-genesis",
],
true,
);
benchmark_pezpallet_args(
&["--list", "--pezpallet=pezpallet_balances", "--chain=dev", "--genesis-builder=spec-runtime"],
&[
"--list",
"--pezpallet=pezpallet_balances",
"--chain=dev",
"--genesis-builder=spec-runtime",
],
true,
);
// Error because no runtime is provided:
+8 -6
View File
@@ -17,11 +17,6 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use codec::{Encode, Joiner};
use pezframe_support::{
dispatch::GetDispatchInfo,
traits::Currency,
weights::{constants::ExtrinsicBaseWeight, IdentityFee, WeightToFee},
};
use pez_kitchensink_runtime::{
constants::{currency::*, time::SLOT_DURATION},
Balances, CheckedExtrinsic, Multiplier, Runtime, RuntimeCall, TransactionByteFee,
@@ -29,6 +24,11 @@ use pez_kitchensink_runtime::{
};
use pez_node_primitives::Balance;
use pez_node_testing::keyring::*;
use pezframe_support::{
dispatch::GetDispatchInfo,
traits::Currency,
weights::{constants::ExtrinsicBaseWeight, IdentityFee, WeightToFee},
};
use pezkuwi_sdk::*;
use pezsp_runtime::{traits::One, Perbill};
@@ -63,7 +63,9 @@ fn fee_multiplier_increases_and_decreases_on_big_weight() {
format: pezsp_runtime::generic::ExtrinsicFormat::Signed(charlie(), tx_ext(0, 0)),
function: RuntimeCall::Sudo(pezpallet_sudo::Call::sudo {
call: Box::new(RuntimeCall::RootTesting(
pezpallet_root_testing::Call::fill_block { ratio: Perbill::from_percent(60) },
pezpallet_root_testing::Call::fill_block {
ratio: Perbill::from_percent(60),
},
)),
}),
},
@@ -17,8 +17,10 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use codec::Decode;
use pez_kitchensink_runtime::{
Executive, ExistentialDeposit, Indices, Runtime, UncheckedExtrinsic,
};
use pezframe_system::offchain::{SendSignedTransaction, Signer, SubmitTransaction};
use pez_kitchensink_runtime::{Executive, ExistentialDeposit, Indices, Runtime, UncheckedExtrinsic};
use pezkuwi_sdk::*;
use pezsp_application_crypto::AppCrypto;
use pezsp_core::offchain::{testing::TestTransactionPoolExt, TransactionPoolExt};
+4 -1
View File
@@ -27,7 +27,10 @@ fn expected_regex() -> Regex {
#[test]
fn version_is_full() {
let expected = expected_regex();
let output = Command::new(cargo_bin("bizinikiwi-node")).args(&["--version"]).output().unwrap();
let output = Command::new(cargo_bin("bizinikiwi-node"))
.args(&["--version"])
.output()
.unwrap();
assert!(output.status.success(), "command returned with non-success exit code");
+7 -3
View File
@@ -135,7 +135,11 @@ where
+ Send
+ 'static,
C::Api: bizinikiwi_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
C::Api: pezmmr_rpc::MmrRuntimeApi<Block, <Block as pezsp_runtime::traits::Block>::Hash, BlockNumber>,
C::Api: pezmmr_rpc::MmrRuntimeApi<
Block,
<Block as pezsp_runtime::traits::Block>::Hash,
BlockNumber,
>,
C::Api: pezpallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
C::Api: BabeApi<Block>,
C::Api: BlockBuilder<Block>,
@@ -146,6 +150,8 @@ where
AuthorityId: AuthorityIdBound,
<AuthorityId as RuntimeAppPublic>::Signature: Send + Sync,
{
use bizinikiwi_frame_rpc_system::{System, SystemApiServer};
use bizinikiwi_state_trie_migration_rpc::{StateMigration, StateMigrationApiServer};
use pezmmr_rpc::{Mmr, MmrApiServer};
use pezpallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
use pezsc_consensus_babe_rpc::{Babe, BabeApiServer};
@@ -157,8 +163,6 @@ where
statement::StatementApiServer,
};
use pezsc_sync_state_rpc::{SyncState, SyncStateApiServer};
use bizinikiwi_frame_rpc_system::{System, SystemApiServer};
use bizinikiwi_state_trie_migration_rpc::{StateMigration, StateMigrationApiServer};
let mut io = RpcModule::new(());
+7 -6
View File
@@ -25,10 +25,10 @@ use pezframe_support::{
Currency, OnUnbalanced,
},
};
use pezkuwi_sdk::*;
use pezpallet_alliance::{IdentityVerifier, ProposalIndex, ProposalProvider};
use pezpallet_asset_tx_payment::HandleCredit;
use pezpallet_identity::legacy::IdentityField;
use pezkuwi_sdk::*;
use crate::{
AccountId, AllianceCollective, AllianceMotion, Assets, Authorship, Balances, Hash,
@@ -119,8 +119,8 @@ mod multiplier_tests {
dispatch::DispatchClass,
weights::{Weight, WeightToFee},
};
use pezpallet_transaction_payment::{Multiplier, TargetedFeeAdjustment};
use pezkuwi_sdk::*;
use pezpallet_transaction_payment::{Multiplier, TargetedFeeAdjustment};
use pezsp_runtime::{
assert_eq_error_rate,
traits::{Convert, One, Zero},
@@ -201,10 +201,11 @@ mod multiplier_tests {
where
F: Fn() -> (),
{
let mut t: pezsp_io::TestExternalities = pezframe_system::GenesisConfig::<Runtime>::default()
.build_storage()
.unwrap()
.into();
let mut t: pezsp_io::TestExternalities =
pezframe_system::GenesisConfig::<Runtime>::default()
.build_storage()
.unwrap()
.into();
t.execute_with(|| {
System::set_block_consumed_resources(w, 0);
assertions()
+24 -15
View File
@@ -23,19 +23,21 @@
extern crate alloc;
#[cfg(feature = "runtime-benchmarks")]
use pezkuwi_sdk::pezsp_core::crypto::FromEntropy;
#[cfg(feature = "runtime-benchmarks")]
use pezpallet_asset_rate::AssetKindFactory;
#[cfg(feature = "runtime-benchmarks")]
use pezpallet_multi_asset_bounties::ArgumentsFactory as PalletMultiAssetBountiesArgumentsFactory;
#[cfg(feature = "runtime-benchmarks")]
use pezpallet_treasury::ArgumentsFactory as PalletTreasuryArgumentsFactory;
#[cfg(feature = "runtime-benchmarks")]
use pezkuwi_sdk::pezsp_core::crypto::FromEntropy;
use pezkuwi_sdk::*;
use alloc::{vec, vec::Vec};
use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
pub use pez_node_primitives::{AccountId, Signature};
use pez_node_primitives::{AccountIndex, Balance, BlockNumber, Hash, Moment, Nonce};
use pezframe_election_provider_support::{
bounds::{ElectionBounds, ElectionBoundsBuilder},
onchain, BalancingConfig, ElectionDataProvider, SequentialPhragmen, VoteWeight,
@@ -46,9 +48,8 @@ use pezframe_support::{
dynamic_params::{dynamic_pallet_params, dynamic_params},
genesis_builder_helper::{build_state, get_preset},
instances::{Instance1, Instance2},
ord_parameter_types,
ord_parameter_types, parameter_types,
pezpallet_prelude::Get,
parameter_types,
traits::{
fungible::{
Balanced, Credit, HoldConsideration, ItemOf, NativeFromLeft, NativeOrWithId, UnionOf,
@@ -76,8 +77,6 @@ use pezframe_system::{
limits::{BlockLength, BlockWeights},
EnsureRoot, EnsureRootWithSuccess, EnsureSigned, EnsureSignedBy, EnsureWithSuccess,
};
pub use pez_node_primitives::{AccountId, Signature};
use pez_node_primitives::{AccountIndex, Balance, BlockNumber, Hash, Moment, Nonce};
use pezpallet_asset_conversion::{AccountIdConverter, Ascending, Chain, WithFirstAsset};
use pezpallet_asset_conversion_tx_payment::SwapAssetAdapter;
use pezpallet_assets_precompiles::{InlineIdConfig, ERC20};
@@ -826,11 +825,14 @@ parameter_types! {
pub MaxActiveValidators: u32 = 1000;
}
/// The numbers configured here could always be more than the the maximum limits of staking pezpallet
/// to ensure election snapshot will not run out of memory. For now, we set them to smaller values
/// since the staking is bounded and the weight pipeline takes hours for this single pezpallet.
/// The numbers configured here could always be more than the the maximum limits of staking
/// pezpallet to ensure election snapshot will not run out of memory. For now, we set them to
/// smaller values since the staking is bounded and the weight pipeline takes hours for this single
/// pezpallet.
pub struct ElectionProviderBenchmarkConfig;
impl pezpallet_election_provider_multi_phase::BenchmarkingConfig for ElectionProviderBenchmarkConfig {
impl pezpallet_election_provider_multi_phase::BenchmarkingConfig
for ElectionProviderBenchmarkConfig
{
const VOTERS: [u32; 2] = [1000, 2000];
const TARGETS: [u32; 2] = [500, 1000];
const ACTIVE_VOTERS: [u32; 2] = [500, 800];
@@ -1424,7 +1426,8 @@ impl pezpallet_multi_asset_bounties::Config for Runtime {
type WeightInfo = pezpallet_multi_asset_bounties::weights::BizinikiwiWeight<Runtime>;
type FundingSource =
pezpallet_multi_asset_bounties::PalletIdAsFundingSource<TreasuryPalletId, Runtime>;
type BountySource = pezpallet_multi_asset_bounties::BountySourceAccount<TreasuryPalletId, Runtime>;
type BountySource =
pezpallet_multi_asset_bounties::BountySourceAccount<TreasuryPalletId, Runtime>;
type ChildBountySource =
pezpallet_multi_asset_bounties::ChildBountySourceAccount<TreasuryPalletId, Runtime>;
type Paymaster = PayWithFungibles<NativeAndAssets, AccountId>;
@@ -1659,7 +1662,9 @@ where
pezframe_system::CheckNonce::<Runtime>::from(0),
pezframe_system::CheckWeight::<Runtime>::new(),
pezpallet_skip_feeless_payment::SkipCheckIfFeeless::from(
pezpallet_asset_conversion_tx_payment::ChargeAssetTxPayment::<Runtime>::from(0, None),
pezpallet_asset_conversion_tx_payment::ChargeAssetTxPayment::<Runtime>::from(
0, None,
),
),
pezframe_metadata_hash_extension::CheckMetadataHash::new(false),
pezpallet_revive::evm::tx_extension::SetOrigin::<Runtime>::default(),
@@ -2623,7 +2628,8 @@ mod runtime {
pub type AssetConversionTxPayment = pezpallet_asset_conversion_tx_payment::Pezpallet<Runtime>;
#[runtime::pezpallet_index(10)]
pub type ElectionProviderMultiPhase = pezpallet_election_provider_multi_phase::Pezpallet<Runtime>;
pub type ElectionProviderMultiPhase =
pezpallet_election_provider_multi_phase::Pezpallet<Runtime>;
#[runtime::pezpallet_index(11)]
pub type Staking = pezpallet_staking::Pezpallet<Runtime>;
@@ -2674,7 +2680,8 @@ mod runtime {
pub type Historical = pezpallet_session_historical::Pezpallet<Runtime>;
#[runtime::pezpallet_index(27)]
pub type RandomnessCollectiveFlip = pezpallet_insecure_randomness_collective_flip::Pezpallet<Runtime>;
pub type RandomnessCollectiveFlip =
pezpallet_insecure_randomness_collective_flip::Pezpallet<Runtime>;
#[runtime::pezpallet_index(28)]
pub type Identity = pezpallet_identity::Pezpallet<Runtime>;
@@ -2983,7 +2990,9 @@ parameter_types! {
pub struct OracleBenchmarkingHelper;
#[cfg(feature = "runtime-benchmarks")]
impl pezpallet_oracle::BenchmarkHelper<u32, u128, OracleMaxFeedValues> for OracleBenchmarkingHelper {
impl pezpallet_oracle::BenchmarkHelper<u32, u128, OracleMaxFeedValues>
for OracleBenchmarkingHelper
{
fn get_currency_id_value_pairs() -> BoundedVec<(u32, u128), OracleMaxFeedValues> {
use rand::{distributions::Uniform, prelude::*};
+3 -1
View File
@@ -42,7 +42,9 @@ use pez_node_primitives::Block;
use pezsc_block_builder::BlockBuilderBuilder;
use pezsc_client_api::{execution_extensions::ExecutionExtensions, UsageProvider};
use pezsc_client_db::PruningMode;
use pezsc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy, ImportResult, ImportedAux};
use pezsc_consensus::{
BlockImport, BlockImportParams, ForkChoiceStrategy, ImportResult, ImportedAux,
};
use pezsc_executor::{WasmExecutionMethod, WasmtimeInstantiationStrategy};
use pezsp_api::ProvideRuntimeApi;
use pezsp_block_builder::BlockBuilder;
+1 -1
View File
@@ -18,9 +18,9 @@
//! Utilities to build a `TestClient` for `pez-kitchensink-runtime`.
use pezsp_runtime::BuildStorage;
/// Re-export test-client utilities.
pub use bizinikiwi_test_client::*;
use pezsp_runtime::BuildStorage;
/// Call executor for `pez-kitchensink-runtime` `TestClient`.
use node_cli::service::RuntimeExecutor;
@@ -21,10 +21,10 @@ use std::fs::File;
use clap::Parser;
use cmd_lib::spawn_with_output;
use pretty_assertions::assert_eq;
use pezsc_chain_spec::update_code_in_json_chain_spec;
use serde_json::{from_reader, from_str, Value};
use pezstaging_chain_spec_builder::ChainSpecBuilder;
use pretty_assertions::assert_eq;
use serde_json::{from_reader, from_str, Value};
// note: the runtime path will not be read, runtime code will be set directly, to avoid hassle with
// creating the wasm file or providing a valid existing path during test execution.
+12 -12
View File
@@ -18,20 +18,20 @@
//! # Subkey
//!
//! Subkey is a commandline utility included with Bizinikiwi. It allows generating and restoring keys
//! for Bizinikiwi based chains such as Pezkuwi, Kusama and a growing number of teyrchains and
//! Subkey is a commandline utility included with Bizinikiwi. It allows generating and restoring
//! keys for Bizinikiwi based chains such as Pezkuwi, Kusama and a growing number of teyrchains and
//! Bizinikiwi based projects.
//! `pez_subkey` provides a few sub-commands to generate keys, check keys, sign messages, verify
//! messages, etc...
//!
//! You can see the full list of commands with `pez_subkey --help`. Most commands have additional help
//! available with for instance `pez_subkey generate --help` for the `generate` command.
//! You can see the full list of commands with `pez_subkey --help`. Most commands have additional
//! help available with for instance `pez_subkey generate --help` for the `generate` command.
//!
//! ## Safety first
//!
//! `pez_subkey` does not need an internet connection to work. Indeed, for the best security, you should
//! be using `pez_subkey` on a machine that is **not connected** to the internet.
//! `pez_subkey` does not need an internet connection to work. Indeed, for the best security, you
//! should be using `pez_subkey` on a machine that is **not connected** to the internet.
//!
//! `pez_subkey` deals with **seeds** and **private keys**. Make sure to use `pez_subkey` in a safe
//! environment (ie. no one looking over your shoulder) and on a safe computer (ie. no one able to
@@ -42,8 +42,8 @@
//!
//! ## Usage
//!
//! The following guide explains *some* of the `pez_subkey` commands. For the full list and the most up
//! to date documentation, make sure to check the integrated help with `pez_subkey --help`.
//! The following guide explains *some* of the `pez_subkey` commands. For the full list and the most
//! up to date documentation, make sure to check the integrated help with `pez_subkey --help`.
//!
//! ### Install with Cargo
//!
@@ -146,8 +146,8 @@
//!
//! ### Additional user-defined password
//!
//! `pez_subkey` supports an additional user-defined secret that will be appended to the seed. Let's see
//! the following example:
//! `pez_subkey` supports an additional user-defined secret that will be appended to the seed. Let's
//! see the following example:
//!
//! ```bash
//! pez_subkey generate --password extra_secret
@@ -184,8 +184,8 @@
//!
//! ### Inspecting a key
//!
//! If you have *some data* about a key, `pez_subkey inspect` will help you discover more information
//! about it.
//! If you have *some data* about a key, `pez_subkey inspect` will help you discover more
//! information about it.
//!
//! If you have **secrets** that you would like to verify for instance, you can use:
//!
+4 -2
View File
@@ -241,8 +241,10 @@ pub trait BlockImportOperation<Block: BlockT> {
fn mark_head(&mut self, hash: Block::Hash) -> pezsp_blockchain::Result<()>;
/// Add a transaction index operation.
fn update_transaction_index(&mut self, index: Vec<IndexOperation>)
-> pezsp_blockchain::Result<()>;
fn update_transaction_index(
&mut self,
index: Vec<IndexOperation>,
) -> pezsp_blockchain::Result<()>;
/// Configure whether to create a block gap if newly imported block is missing parent
fn set_create_gap(&mut self, create_gap: bool);
+12 -4
View File
@@ -137,19 +137,27 @@ pub trait BlockBackend<Block: BlockT> {
///
/// Note that this will only fetch transactions
/// that are indexed by the runtime with `storage_index_transaction`.
fn block_indexed_body(&self, hash: Block::Hash) -> pezsp_blockchain::Result<Option<Vec<Vec<u8>>>>;
fn block_indexed_body(
&self,
hash: Block::Hash,
) -> pezsp_blockchain::Result<Option<Vec<Vec<u8>>>>;
/// Get full block by hash.
fn block(&self, hash: Block::Hash) -> pezsp_blockchain::Result<Option<SignedBlock<Block>>>;
/// Get block status by block hash.
fn block_status(&self, hash: Block::Hash) -> pezsp_blockchain::Result<pezsp_consensus::BlockStatus>;
fn block_status(
&self,
hash: Block::Hash,
) -> pezsp_blockchain::Result<pezsp_consensus::BlockStatus>;
/// Get block justifications for the block with the given hash.
fn justifications(&self, hash: Block::Hash) -> pezsp_blockchain::Result<Option<Justifications>>;
fn justifications(&self, hash: Block::Hash)
-> pezsp_blockchain::Result<Option<Justifications>>;
/// Get block hash by number.
fn block_hash(&self, number: NumberFor<Block>) -> pezsp_blockchain::Result<Option<Block::Hash>>;
fn block_hash(&self, number: NumberFor<Block>)
-> pezsp_blockchain::Result<Option<Block::Hash>>;
/// Get single indexed transaction by content hash.
///
+9 -3
View File
@@ -407,7 +407,10 @@ impl<Block: BlockT> blockchain::Backend<Block> for Blockchain<Block> {
.and_then(|b| b.extrinsics().map(|x| x.to_vec())))
}
fn justifications(&self, hash: Block::Hash) -> pezsp_blockchain::Result<Option<Justifications>> {
fn justifications(
&self,
hash: Block::Hash,
) -> pezsp_blockchain::Result<Option<Justifications>> {
Ok(self.storage.read().blocks.get(&hash).and_then(|b| b.justifications().cloned()))
}
@@ -672,7 +675,10 @@ impl<Block: BlockT> backend::Backend<Block> for Backend<Block> {
Ok(())
}
fn commit_operation(&self, operation: Self::BlockImportOperation) -> pezsp_blockchain::Result<()> {
fn commit_operation(
&self,
operation: Self::BlockImportOperation,
) -> pezsp_blockchain::Result<()> {
if !operation.finalized_blocks.is_empty() {
for (block, justification) in operation.finalized_blocks {
self.blockchain.finalize_header(block, justification)?;
@@ -804,9 +810,9 @@ pub fn check_genesis_storage(storage: &Storage) -> pezsp_blockchain::Result<()>
#[cfg(test)]
mod tests {
use crate::{in_mem::Blockchain, NewBlockState};
use bizinikiwi_test_runtime::{Block, Header, H256};
use pezsp_blockchain::Backend;
use pezsp_runtime::{traits::Header as HeaderT, ConsensusEngineId, Justifications};
use bizinikiwi_test_runtime::{Block, Header, H256};
pub const ID1: ConsensusEngineId = *b"TST1";
pub const ID2: ConsensusEngineId = *b"TST2";
+1 -1
View File
@@ -32,9 +32,9 @@ pub use backend::*;
pub use call_executor::*;
pub use client::*;
pub use notifications::*;
pub use proof_provider::*;
pub use pezsp_blockchain as blockchain;
pub use pezsp_blockchain::HeaderBackend;
pub use proof_provider::*;
pub use pezsp_state_machine::{CompactProof, StorageProof};
pub use pezsp_storage::{ChildInfo, PrefixedStorageKey, StorageData, StorageKey};
@@ -48,7 +48,6 @@ use pezsc_network::{
Multiaddr, NetworkDHTProvider, NetworkSigner, NetworkStateInfo,
};
use pezsc_network_types::{multihash::Code, PeerId};
use schema::PeerSignature;
use pezsp_api::{ApiError, ProvideRuntimeApi};
use pezsp_authority_discovery::{
AuthorityDiscoveryApi, AuthorityId, AuthorityPair, AuthoritySignature,
@@ -60,6 +59,7 @@ use pezsp_core::{
};
use pezsp_keystore::{Keystore, KeystorePtr};
use pezsp_runtime::traits::Block as BlockT;
use schema::PeerSignature;
mod addr_cache;
/// Dht payload schemas generated from Protobuf definitions via Prost crate in build.rs.
@@ -20,9 +20,9 @@ use crate::error::Error;
use log::{info, warn};
use pezsc_network::{multiaddr::Protocol, Multiaddr};
use pezsc_network_types::PeerId;
use serde::{Deserialize, Serialize};
use pezsp_authority_discovery::AuthorityId;
use pezsp_runtime::DeserializeOwned;
use serde::{Deserialize, Serialize};
use std::{
collections::{hash_map::Entry, HashMap, HashSet},
fs::File,
@@ -300,8 +300,8 @@ mod tests {
use super::*;
use quickcheck::{Arbitrary, Gen, QuickCheck, TestResult};
use pezsc_network_types::multihash::{Code, Multihash};
use quickcheck::{Arbitrary, Gen, QuickCheck, TestResult};
use pezsp_authority_discovery::{AuthorityId, AuthorityPair};
use pezsp_core::crypto::Pair;
@@ -26,9 +26,9 @@ mod schema_v2 {
use super::*;
use codec::Encode;
use prost::Message;
use pezsc_network::{Multiaddr, PeerId};
use pezsc_network_types::ed25519::Keypair;
use prost::Message;
#[test]
fn v2_decodes_v1() {
@@ -26,6 +26,7 @@ use std::{
use crate::tests::{create_spawner, test_config};
use super::*;
use bizinikiwi_test_runtime_client::runtime::Block;
use futures::{
channel::mpsc::{self, channel},
executor::{block_on, LocalPool},
@@ -33,7 +34,6 @@ use futures::{
sink::SinkExt,
task::LocalSpawn,
};
use prometheus_endpoint::prometheus::default_registry;
use pezsc_client_api::HeaderBackend;
use pezsc_network::{
service::signature::{Keypair, SigningError},
@@ -47,7 +47,7 @@ use pezsc_network_types::{
use pezsp_api::{ApiRef, ProvideRuntimeApi};
use pezsp_keystore::{testing::MemoryKeystore, Keystore};
use pezsp_runtime::traits::{Block as BlockT, NumberFor, Zero};
use bizinikiwi_test_runtime_client::runtime::Block;
use prometheus_endpoint::prometheus::default_registry;
#[derive(Clone)]
pub(crate) struct TestApi {
@@ -135,8 +135,9 @@ pub struct TestNetwork {
pub put_value_call: Arc<Mutex<Vec<(KademliaKey, Vec<u8>)>>>,
pub put_value_to_call: Arc<Mutex<Vec<(Record, HashSet<pezsc_network_types::PeerId>, bool)>>>,
pub get_value_call: Arc<Mutex<Vec<KademliaKey>>>,
pub store_value_call:
Arc<Mutex<Vec<(KademliaKey, Vec<u8>, Option<pezsc_network_types::PeerId>, Option<Instant>)>>>,
pub store_value_call: Arc<
Mutex<Vec<(KademliaKey, Vec<u8>, Option<pezsc_network_types::PeerId>, Option<Instant>)>>,
>,
event_sender: mpsc::UnboundedSender<TestNetworkEvent>,
event_receiver: Option<mpsc::UnboundedReceiver<TestNetworkEvent>>,
@@ -27,13 +27,14 @@ use futures::{
future::{Future, FutureExt},
};
use log::{debug, error, info, log_enabled, trace, warn, Level};
use prometheus_endpoint::Registry as PrometheusRegistry;
use pezsc_block_builder::{BlockBuilderApi, BlockBuilderBuilder};
use pezsc_proposer_metrics::{EndProposingReason, MetricsLink as PrometheusMetrics};
use pezsc_telemetry::{telemetry, TelemetryHandle, CONSENSUS_INFO};
use pezsc_transaction_pool_api::{InPoolTransaction, TransactionPool, TxInvalidityReportMap};
use pezsp_api::{ApiExt, CallApiAt, ProofRecorder, ProvideRuntimeApi};
use pezsp_blockchain::{ApplyExtrinsicFailed::Validity, Error::ApplyExtrinsicFailed, HeaderBackend};
use pezsp_blockchain::{
ApplyExtrinsicFailed::Validity, Error::ApplyExtrinsicFailed, HeaderBackend,
};
use pezsp_consensus::{DisableProofRecording, EnableProofRecording, ProofRecording, Proposal};
use pezsp_core::traits::SpawnNamed;
use pezsp_inherents::InherentData;
@@ -42,6 +43,7 @@ use pezsp_runtime::{
Digest, ExtrinsicInclusionMode, Percent, SaturatedConversion,
};
use pezsp_trie::recorder::IgnoredNodes;
use prometheus_endpoint::Registry as PrometheusRegistry;
use std::{marker::PhantomData, pin::Pin, sync::Arc, time};
/// Default block size limit in bytes used by [`Proposer`].
@@ -68,8 +70,8 @@ pub struct ProposerFactory<A, C, PR> {
metrics: PrometheusMetrics,
/// The default block size limit.
///
/// If no `block_size_limit` is passed to [`pezsp_consensus::Proposer::propose`], this block size
/// limit will be used.
/// If no `block_size_limit` is passed to [`pezsp_consensus::Proposer::propose`], this block
/// size limit will be used.
default_block_size_limit: usize,
/// Soft deadline percentage of hard deadline.
///
@@ -672,6 +674,11 @@ where
#[cfg(test)]
mod tests {
use super::*;
use bizinikiwi_test_runtime_client::{
prelude::*,
runtime::{Block as TestBlock, Extrinsic, ExtrinsicBuilder, Transfer},
TestClientBuilder, TestClientBuilderExt,
};
use futures::executor::block_on;
use parking_lot::Mutex;
use pezsc_client_api::{Backend, TrieCacheContext};
@@ -681,11 +688,6 @@ mod tests {
use pezsp_blockchain::HeaderBackend;
use pezsp_consensus::{BlockOrigin, Environment};
use pezsp_runtime::{generic::BlockId, traits::NumberFor, Perbill};
use bizinikiwi_test_runtime_client::{
prelude::*,
runtime::{Block as TestBlock, Extrinsic, ExtrinsicBuilder, Transfer},
TestClientBuilder, TestClientBuilderExt,
};
const SOURCE: TransactionSource = TransactionSource::External;
+8 -6
View File
@@ -378,12 +378,12 @@ where
#[cfg(test)]
mod tests {
use super::*;
use pezsp_blockchain::HeaderBackend;
use pezsp_core::Blake2Hasher;
use pezsp_state_machine::Backend;
use bizinikiwi_test_runtime_client::{
runtime::ExtrinsicBuilder, DefaultTestClientBuilderExt, TestClientBuilderExt,
};
use pezsp_blockchain::HeaderBackend;
use pezsp_core::Blake2Hasher;
use pezsp_state_machine::Backend;
#[test]
fn block_building_storage_proof_does_not_include_runtime_by_default() {
@@ -404,9 +404,11 @@ mod tests {
let proof = block.proof.expect("Proof is build on request");
let genesis_state_root = client.header(genesis_hash).unwrap().unwrap().state_root;
let backend =
pezsp_state_machine::create_proof_check_backend::<Blake2Hasher>(genesis_state_root, proof)
.unwrap();
let backend = pezsp_state_machine::create_proof_check_backend::<Blake2Hasher>(
genesis_state_root,
proof,
)
.unwrap();
assert!(backend
.storage(&pezsp_core::storage::well_known_keys::CODE)
+10 -9
View File
@@ -24,13 +24,13 @@ use crate::{
};
use pezsc_network::config::MultiaddrWithPeerId;
use pezsc_telemetry::TelemetryEndpoints;
use serde::{Deserialize, Serialize};
use serde_json as json;
use pezsp_core::{
storage::{ChildInfo, Storage, StorageChild, StorageData, StorageKey},
Bytes,
};
use pezsp_runtime::BuildStorage;
use serde::{Deserialize, Serialize};
use serde_json as json;
use std::{
borrow::Cow,
collections::{BTreeMap, VecDeque},
@@ -166,8 +166,8 @@ where
});
},
// The `StateRootHash` variant exists as a way to keep note that other clients support
// it, but Bizinikiwi itself isn't capable of loading chain specs with just a hash at the
// moment.
// it, but Bizinikiwi itself isn't capable of loading chain specs with just a hash at
// the moment.
Genesis::StateRootHash(_) =>
return Err("Genesis storage in hash format not supported".into()),
Genesis::RuntimeGenesis(RuntimeGenesisInner {
@@ -795,11 +795,11 @@ pub fn set_code_substitute_in_json_chain_spec(
#[cfg(test)]
mod tests {
use super::*;
use pretty_assertions::assert_eq;
use serde_json::{from_str, json, Value};
use pezsp_application_crypto::Ss58Codec;
use pezsp_core::storage::well_known_keys;
use pezsp_keyring::Sr25519Keyring;
use pretty_assertions::assert_eq;
use serde_json::{from_str, json, Value};
type TestSpec = ChainSpec;
@@ -966,9 +966,10 @@ mod tests {
.build();
let actual = output.as_json(false).unwrap();
let expected =
from_str::<Value>(include_str!("../res/bizinikiwi_test_runtime_from_named_preset.json"))
.unwrap();
let expected = from_str::<Value>(include_str!(
"../res/bizinikiwi_test_runtime_from_named_preset.json"
))
.unwrap();
//wasm blob may change overtime so let's zero it. Also ensure it is there:
let actual = zeroize_code_key_in_json(false, actual.as_str());
@@ -106,8 +106,9 @@ impl<Block: BlockT, B: Backend<Block>, E: RuntimeVersionOf> GenesisBlockBuilder<
backend: Arc<B>,
executor: E,
) -> pezsp_blockchain::Result<Self> {
let genesis_storage =
build_genesis_storage.build_storage().map_err(pezsp_blockchain::Error::Storage)?;
let genesis_storage = build_genesis_storage
.build_storage()
.map_err(pezsp_blockchain::Error::Storage)?;
Self::new_with_storage(genesis_storage, commit_genesis_state, backend, executor)
}
@@ -21,7 +21,6 @@
use codec::{Decode, Encode};
pub use pezsc_executor::pezsp_wasm_interface::HostFunctions;
use pezsc_executor::{error::Result, WasmExecutor};
use serde_json::{from_slice, Value};
use pezsp_core::{
storage::Storage,
traits::{CallContext, CodeExecutor, Externalities, FetchRuntimeCode, RuntimeCode},
@@ -29,6 +28,7 @@ use pezsp_core::{
use pezsp_genesis_builder::{PresetId, Result as BuildResult};
pub use pezsp_genesis_builder::{DEV_RUNTIME_PRESET, LOCAL_TESTNET_RUNTIME_PRESET};
use pezsp_state_machine::BasicExternalities;
use serde_json::{from_slice, Value};
use std::borrow::Cow;
/// A utility that facilitates calling the GenesisBuilder API from the runtime wasm code blob.
@@ -85,8 +85,8 @@ where
/// Returns a json representation of the default `RuntimeGenesisConfig` provided by the
/// `runtime`.
///
/// Calls [`GenesisBuilder::get_preset`](pezsp_genesis_builder::GenesisBuilder::get_preset) in the
/// `runtime` with `None` argument.
/// Calls [`GenesisBuilder::get_preset`](pezsp_genesis_builder::GenesisBuilder::get_preset) in
/// the `runtime` with `None` argument.
pub fn get_default_config(&self) -> core::result::Result<Value, String> {
self.get_named_preset(None)
}
@@ -176,9 +176,9 @@ where
#[cfg(test)]
mod tests {
use super::*;
use serde_json::{from_str, json};
pub use pezsp_consensus_babe::{AllowedSlots, BabeEpochConfiguration};
pub use pezsp_genesis_builder::PresetId;
use serde_json::{from_str, json};
#[test]
fn list_presets_works() {
+3 -3
View File
@@ -192,9 +192,9 @@
//!
//! This interaction involves passing the runtime genesis config JSON blob to the runtime using the
//! [`pezsp_genesis_builder::GenesisBuilder::build_state`] function. During this operation, the
//! runtime converts the JSON representation of the genesis config into [`pezsp_io::storage`] items. It
//! is a crucial step for computing the storage root hash, which is a key component in determining
//! the genesis hash.
//! runtime converts the JSON representation of the genesis config into [`pezsp_io::storage`] items.
//! It is a crucial step for computing the storage root hash, which is a key component in
//! determining the genesis hash.
//!
//! Consequently, the runtime must support the [`pezsp_genesis_builder::GenesisBuilder`] API to
//! utilize either `patch` or `full` formats.
@@ -19,7 +19,7 @@
//! Implementation of the `insert` subcommand
use crate::{
utils, with_crypto_scheme, CryptoScheme, Error, KeystoreParams, SharedParams, BizinikiwiCli,
utils, with_crypto_scheme, BizinikiwiCli, CryptoScheme, Error, KeystoreParams, SharedParams,
};
use clap::Parser;
use pezsc_keystore::LocalKeystore;
+1 -1
View File
@@ -22,7 +22,7 @@ use super::{
generate::GenerateCmd, generate_node_key::GenerateNodeKeyCmd, insert_key::InsertKeyCmd,
inspect_key::InspectKeyCmd, inspect_node_key::InspectNodeKeyCmd,
};
use crate::{Error, BizinikiwiCli};
use crate::{BizinikiwiCli, Error};
/// Key utilities for the cli.
#[derive(Debug, clap::Subcommand)]
@@ -25,7 +25,6 @@ use crate::{
CliConfiguration, PrometheusParams, RpcParams, RuntimeParams, TelemetryParams,
};
use clap::Parser;
use regex::Regex;
use pezsc_service::{
config::{
BasePath, IpNetwork, PrometheusConfig, RpcBatchRequestConfig, TransactionPoolOptions,
@@ -33,6 +32,7 @@ use pezsc_service::{
ChainSpec, Role,
};
use pezsc_telemetry::TelemetryEndpoints;
use regex::Regex;
use std::num::NonZeroU32;
/// The `run` command used to run a node.
+1 -1
View File
@@ -21,7 +21,6 @@ use crate::{
error::{self, Error},
OutputType,
};
use serde_json::json;
use pezsp_core::{
crypto::{
unwrap_or_default_ss58_version, ExposeSecret, SecretString, Ss58AddressFormat, Ss58Codec,
@@ -31,6 +30,7 @@ use pezsp_core::{
Pair,
};
use pezsp_runtime::{traits::IdentifyAccount, MultiSigner};
use serde_json::json;
use std::path::PathBuf;
/// Public key type for Runtime
+1 -1
View File
@@ -22,9 +22,9 @@ use crate::{
error, utils, with_crypto_scheme, CryptoSchemeFlag, NetworkSchemeFlag, OutputTypeFlag,
};
use clap::Parser;
use rand::{rngs::OsRng, RngCore};
use pezsp_core::crypto::{unwrap_or_default_ss58_version, Ss58AddressFormat, Ss58Codec};
use pezsp_runtime::traits::IdentifyAccount;
use rand::{rngs::OsRng, RngCore};
use utils::print_from_uri;
/// The `vanity` command
+3 -3
View File
@@ -19,9 +19,9 @@
//! Configuration trait for a CLI based on bizinikiwi
use crate::{
arg_enums::Database, error::Result, DatabaseParams, ImportParams, KeystoreParams,
NetworkParams, NodeKeyParams, OffchainWorkerParams, PruningParams, RpcEndpoint, SharedParams,
BizinikiwiCli,
arg_enums::Database, error::Result, BizinikiwiCli, DatabaseParams, ImportParams,
KeystoreParams, NetworkParams, NodeKeyParams, OffchainWorkerParams, PruningParams, RpcEndpoint,
SharedParams,
};
use log::warn;
use names::{Generator, Name};
+2 -2
View File
@@ -42,11 +42,11 @@ pub use commands::*;
pub use config::*;
pub use error::*;
pub use params::*;
pub use runner::*;
pub use pezsc_service::{ChainSpec, Role};
pub use pezsc_tracing::logging::LoggerBuilder;
pub use signals::Signals;
pub use pezsp_version::RuntimeVersion;
pub use runner::*;
pub use signals::Signals;
/// Bizinikiwi client CLI
///
@@ -34,7 +34,8 @@ impl Into<pezsc_transaction_pool::TransactionPoolType> for TransactionPoolType {
match self {
TransactionPoolType::SingleState =>
pezsc_transaction_pool::TransactionPoolType::SingleState,
TransactionPoolType::ForkAware => pezsc_transaction_pool::TransactionPoolType::ForkAware,
TransactionPoolType::ForkAware =>
pezsc_transaction_pool::TransactionPoolType::ForkAware,
}
}
}
+1 -1
View File
@@ -16,7 +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 crate::{error::Error as CliError, Result, Signals, BizinikiwiCli};
use crate::{error::Error as CliError, BizinikiwiCli, Result, Signals};
use chrono::prelude::*;
use futures::{future::FutureExt, Future};
use log::info;
@@ -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);
+1 -1
View File
@@ -17,7 +17,6 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use criterion::{criterion_group, criterion_main, BatchSize, Criterion};
use rand::{distributions::Uniform, rngs::StdRng, Rng, SeedableRng};
use pezsc_client_api::{
Backend as _, BlockImportOperation, NewBlockState, StateBackend, TrieCacheContext,
};
@@ -27,6 +26,7 @@ use pezsp_runtime::{
testing::{Block as RawBlock, Header, MockCallU64, TestXt},
StateVersion, Storage,
};
use rand::{distributions::Uniform, rngs::StdRng, Rng, SeedableRng};
use tempfile::TempDir;
pub(crate) type Block = RawBlock<TestXt<MockCallU64, ()>>;
+26 -8
View File
@@ -615,7 +615,9 @@ impl<Block: BlockT> BlockchainDb<Block> {
match Decode::decode(&mut &body[..]) {
Ok(body) => return Ok(Some(body)),
Err(err) =>
return Err(pezsp_blockchain::Error::Backend(format!("Error decoding body: {err}"))),
return Err(pezsp_blockchain::Error::Backend(format!(
"Error decoding body: {err}"
))),
}
}
@@ -1186,7 +1188,9 @@ impl<Block: BlockT> Backend<Block> {
///
/// Should only be needed for benchmarking.
#[cfg(feature = "runtime-benchmarks")]
pub fn expose_db(&self) -> (Arc<dyn pezsp_database::Database<DbHash>>, pezsp_database::ColumnId) {
pub fn expose_db(
&self,
) -> (Arc<dyn pezsp_database::Database<DbHash>>, pezsp_database::ColumnId) {
(self.storage.db.clone(), columns::STATE)
}
@@ -1323,7 +1327,8 @@ impl<Block: BlockT> Backend<Block> {
// Cannot find tree route with empty DB or when imported a detached block.
if meta.best_hash != Default::default() && parent_exists {
let tree_route = pezsp_blockchain::tree_route(&self.blockchain, meta.best_hash, route_to)?;
let tree_route =
pezsp_blockchain::tree_route(&self.blockchain, meta.best_hash, route_to)?;
// uncanonicalize: check safety violations and ensure the numbers no longer
// point to these block hashes in the key mapping.
@@ -1888,7 +1893,9 @@ impl<Block: BlockT> Backend<Block> {
LastCanonicalized::NotCanonicalizing => false,
};
if requires_canonicalization && pezsc_client_api::Backend::have_state_at(self, f_hash, f_num) {
if requires_canonicalization &&
pezsc_client_api::Backend::have_state_at(self, f_hash, f_num)
{
let commit = self.storage.state_db.canonicalize_block(&f_hash).map_err(
pezsp_blockchain::Error::from_state_db::<
pezsc_state_db::Error<pezsp_database::error::DatabaseError>,
@@ -2460,7 +2467,9 @@ impl<Block: BlockT> pezsc_client_api::backend::Backend<Block> for Backend<Block>
let best_hash = self.blockchain.info().best_hash;
if best_hash == hash {
return Err(pezsp_blockchain::Error::Backend(format!("Can't remove best block {hash:?}")));
return Err(pezsp_blockchain::Error::Backend(format!(
"Can't remove best block {hash:?}"
)));
}
let hdr = self.blockchain.header_metadata(hash)?;
@@ -2974,7 +2983,10 @@ pub(crate) mod tests {
backend
.storage
.db
.get(columns::STATE, &pezsp_trie::prefixed_key::<BlakeTwo256>(&key, EMPTY_PREFIX))
.get(
columns::STATE,
&pezsp_trie::prefixed_key::<BlakeTwo256>(&key, EMPTY_PREFIX)
)
.unwrap(),
&b"hello"[..]
);
@@ -3011,7 +3023,10 @@ pub(crate) mod tests {
backend
.storage
.db
.get(columns::STATE, &pezsp_trie::prefixed_key::<BlakeTwo256>(&key, EMPTY_PREFIX))
.get(
columns::STATE,
&pezsp_trie::prefixed_key::<BlakeTwo256>(&key, EMPTY_PREFIX)
)
.unwrap(),
&b"hello"[..]
);
@@ -4261,7 +4276,10 @@ pub(crate) mod tests {
};
let mut op = backend.begin_operation().unwrap();
op.set_block_data(header, None, None, None, NewBlockState::Best).unwrap();
assert!(matches!(backend.commit_operation(op), Err(pezsp_blockchain::Error::SetHeadTooOld)));
assert!(matches!(
backend.commit_operation(op),
Err(pezsp_blockchain::Error::SetHeadTooOld)
));
// Insert 2 as best again.
let header = backend.blockchain().header(block2).unwrap().unwrap();
@@ -16,8 +16,8 @@
// 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 schnellru::{Limiter, LruMap};
use pezsp_runtime::{traits::Block as BlockT, Justifications};
use schnellru::{Limiter, LruMap};
const LOG_TARGET: &str = "db::pin";
const PINNING_CACHE_SIZE: usize = 2048;
+8 -3
View File
@@ -478,7 +478,10 @@ pub fn read_header<Block: BlockT>(
pub fn read_meta<Block>(
db: &dyn Database<DbHash>,
col_header: u32,
) -> Result<Meta<<<Block as BlockT>::Header as HeaderT>::Number, Block::Hash>, pezsp_blockchain::Error>
) -> Result<
Meta<<<Block as BlockT>::Header as HeaderT>::Number, Block::Hash>,
pezsp_blockchain::Error,
>
where
Block: BlockT,
{
@@ -569,8 +572,10 @@ pub fn read_genesis_hash<Hash: Decode>(
match db.get(COLUMN_META, meta_keys::GENESIS_HASH) {
Some(h) => match Decode::decode(&mut &h[..]) {
Ok(h) => Ok(Some(h)),
Err(err) =>
Err(pezsp_blockchain::Error::Backend(format!("Error decoding genesis hash: {}", err))),
Err(err) => Err(pezsp_blockchain::Error::Backend(format!(
"Error decoding genesis hash: {}",
err
))),
},
None => Ok(None),
}
+3 -1
View File
@@ -88,7 +88,9 @@ fn initialize(
>(&path, config)
}
} else {
pezsc_executor_wasmtime::create_runtime::<pezsp_io::BizinikiwiHostFunctions>(blob, config)
pezsc_executor_wasmtime::create_runtime::<pezsp_io::BizinikiwiHostFunctions>(
blob, config,
)
}
.map(|runtime| -> Box<dyn WasmModule> { Box::new(runtime) })
},
@@ -16,7 +16,6 @@
// 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 polkavm::{CallError, Caller, Reg};
use pezsc_executor_common::{
error::{Error, WasmError},
wasm_runtime::{AllocationStats, WasmInstance, WasmModule},
@@ -24,6 +23,7 @@ use pezsc_executor_common::{
use pezsp_wasm_interface::{
Function, FunctionContext, HostFunctions, Pointer, Value, ValueType, WordSize,
};
use polkavm::{CallError, Caller, Reg};
#[repr(transparent)]
pub struct InstancePre(polkavm::InstancePre<(), String>);
@@ -140,7 +140,11 @@ impl<'r, 'a> FunctionContext for Context<'r, 'a> {
.map(|_| ())
}
fn write_memory(&mut self, address: Pointer<u8>, data: &[u8]) -> pezsp_wasm_interface::Result<()> {
fn write_memory(
&mut self,
address: Pointer<u8>,
data: &[u8],
) -> pezsp_wasm_interface::Result<()> {
self.0
.instance
.write_memory(u32::from(address), data)
+6 -3
View File
@@ -573,8 +573,9 @@ pub struct NativeElseWasmExecutor<D: NativeExecutionDispatch> {
/// Native runtime version info.
native_version: NativeVersion,
/// Fallback wasm executor.
wasm:
WasmExecutor<ExtendedHostFunctions<pezsp_io::BizinikiwiHostFunctions, D::ExtendHostFunctions>>,
wasm: WasmExecutor<
ExtendedHostFunctions<pezsp_io::BizinikiwiHostFunctions, D::ExtendHostFunctions>,
>,
use_native: bool,
}
@@ -745,7 +746,9 @@ impl<D: NativeExecutionDispatch> Clone for NativeElseWasmExecutor<D> {
}
#[allow(deprecated)]
impl<D: NativeExecutionDispatch> pezsp_core::traits::ReadRuntimeVersion for NativeElseWasmExecutor<D> {
impl<D: NativeExecutionDispatch> pezsp_core::traits::ReadRuntimeVersion
for NativeElseWasmExecutor<D>
{
fn read_runtime_version(
&self,
wasm_code: &[u8],
@@ -29,10 +29,10 @@ use pezsc_executor_common::{
runtime_blob::RuntimeBlob,
wasm_runtime::{HeapAllocStrategy, WasmInstance, WasmModule},
};
use schnellru::{ByLength, LruMap};
use pezsp_core::traits::{Externalities, FetchRuntimeCode, RuntimeCode};
use pezsp_version::RuntimeVersion;
use pezsp_wasm_interface::HostFunctions;
use schnellru::{ByLength, LruMap};
use std::{
panic::AssertUnwindSafe,
@@ -53,7 +53,8 @@ pub enum WasmExecutionMethod {
impl Default for WasmExecutionMethod {
fn default() -> Self {
Self::Compiled {
instantiation_strategy: pezsc_executor_wasmtime::InstantiationStrategy::PoolingCopyOnWrite,
instantiation_strategy:
pezsc_executor_wasmtime::InstantiationStrategy::PoolingCopyOnWrite,
}
}
}
@@ -445,11 +446,11 @@ mod tests {
use super::*;
use alloc::borrow::Cow;
use bizinikiwi_test_runtime::Block;
use codec::Encode;
use pezsp_api::{Core, RuntimeApiInfo};
use pezsp_version::{create_apis_vec, RuntimeVersion};
use pezsp_wasm_interface::HostFunctions;
use bizinikiwi_test_runtime::Block;
#[derive(Encode)]
pub struct OldRuntimeVersion {
@@ -82,7 +82,11 @@ impl<'a> pezsp_wasm_interface::FunctionContext for HostContext<'a> {
util::read_memory_into(&self.caller, address, dest).map_err(|e| e.to_string())
}
fn write_memory(&mut self, address: Pointer<u8>, data: &[u8]) -> pezsp_wasm_interface::Result<()> {
fn write_memory(
&mut self,
address: Pointer<u8>,
data: &[u8],
) -> pezsp_wasm_interface::Result<()> {
util::write_memory_from(&mut self.caller, address, data).map_err(|e| e.to_string())
}
@@ -37,12 +37,12 @@ mod util;
#[cfg(test)]
mod tests;
pub use pezsc_executor_common::{
runtime_blob::RuntimeBlob,
wasm_runtime::{HeapAllocStrategy, WasmModule},
};
pub use runtime::{
create_runtime, create_runtime_from_artifact, create_runtime_from_artifact_bytes,
prepare_runtime_artifact, Config, DeterministicStackLimit, InstantiationStrategy, Semantics,
WasmtimeRuntime,
};
pub use pezsc_executor_common::{
runtime_blob::RuntimeBlob,
wasm_runtime::{HeapAllocStrategy, WasmModule},
};
@@ -101,11 +101,13 @@ where
#[cfg(test)]
pub(crate) mod tests {
use super::*;
use crate::test_utils::{run_test_with_pezmmr_gadget_pre_post_using_client, MmrBlock, MockClient};
use crate::test_utils::{
run_test_with_pezmmr_gadget_pre_post_using_client, MmrBlock, MockClient,
};
use bizinikiwi_test_runtime_client::{runtime::Block, Backend};
use parking_lot::Mutex;
use pezsp_runtime::generic::BlockId;
use std::{sync::Arc, time::Duration};
use bizinikiwi_test_runtime_client::{runtime::Block, Backend};
#[test]
fn should_load_persistent_sanity_checks() {
@@ -19,6 +19,11 @@
//! Test utilities.
use crate::MmrGadget;
use bizinikiwi_test_runtime_client::{
runtime::{Block, BlockNumber, Hash, Header},
Backend, BlockBuilderExt, Client, ClientBlockImportExt, ClientExt, DefaultTestClientBuilderExt,
TestClientBuilder, TestClientBuilderExt,
};
use parking_lot::Mutex;
use pezsc_block_builder::BlockBuilderBuilder;
use pezsc_client_api::{
@@ -40,11 +45,6 @@ use pezsp_runtime::{
traits::{Block as BlockT, Header as HeaderT},
};
use std::{future::Future, sync::Arc, time::Duration};
use bizinikiwi_test_runtime_client::{
runtime::{Block, BlockNumber, Hash, Header},
Backend, BlockBuilderExt, Client, ClientBlockImportExt, ClientExt, DefaultTestClientBuilderExt,
TestClientBuilder, TestClientBuilderExt,
};
use tokio::runtime::Runtime;
type MmrHash = H256;
+1 -1
View File
@@ -36,7 +36,7 @@ mod sync_with_runtime;
pub use self::{
api::{Api, ApiBackend},
config::{Config, CoreConfig, BizinikiwiConfig},
config::{BizinikiwiConfig, Config, CoreConfig},
error::{Error, RemoteErr},
protocol::{peers_set_config, protocol_name},
run::run,
+1 -1
View File
@@ -20,7 +20,7 @@
use super::{
api::ApiBackend,
config::{Config, BizinikiwiConfig},
config::{BizinikiwiConfig, Config},
error::RemoteErr,
extrinsic_queue::ExtrinsicQueue,
maybe_inf_delay::MaybeInfDelay,
@@ -33,9 +33,9 @@ use futures::{
prelude::*,
};
use log::trace;
use prometheus_endpoint::Registry;
use pezsc_network_types::PeerId;
use pezsp_runtime::traits::Block as BlockT;
use prometheus_endpoint::Registry;
use std::{
collections::{HashMap, VecDeque},
pin::Pin,
@@ -347,13 +347,13 @@ impl<B: BlockT> futures::future::FusedFuture for GossipEngine<B> {
mod tests {
use super::*;
use crate::{ValidationResult, ValidatorContext};
use bizinikiwi_test_runtime_client::runtime::Block;
use codec::{DecodeAll, Encode};
use futures::{
channel::mpsc::{unbounded, UnboundedReceiver, UnboundedSender},
executor::{block_on, block_on_stream},
future::poll_fn,
};
use quickcheck::{Arbitrary, Gen, QuickCheck};
use pezsc_network::{
config::MultiaddrWithPeerId,
service::traits::{Direction, MessageSink, NotificationEvent},
@@ -366,11 +366,11 @@ mod tests {
testing::H256,
traits::{Block as BlockT, NumberFor},
};
use quickcheck::{Arbitrary, Gen, QuickCheck};
use std::{
collections::HashSet,
sync::{Arc, Mutex},
};
use bizinikiwi_test_runtime_client::runtime::Block;
#[derive(Clone, Default)]
struct TestNetwork {}
@@ -22,10 +22,10 @@ use ahash::AHashSet;
use pezsc_network_types::PeerId;
use schnellru::{ByLength, LruMap};
use prometheus_endpoint::{register, Counter, PrometheusError, Registry, U64};
use pezsc_network::{types::ProtocolName, NotificationService};
use pezsc_network_common::role::ObservedRole;
use pezsp_runtime::traits::{Block as BlockT, Hash, HashingFor};
use prometheus_endpoint::{register, Counter, PrometheusError, Registry, U64};
use std::{collections::HashMap, iter, sync::Arc, time, time::Instant};
// FIXME: Add additional spam/DoS attack protection: https://github.com/pezkuwichain/kurdistan-sdk/issues/7
@@ -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(),
)

Some files were not shown because too many files have changed in this diff Show More