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
+10 -10
View File
@@ -17,12 +17,12 @@
//! Bizinikiwi runtime api
//!
//! The Bizinikiwi runtime api is the interface between the node and the runtime. There isn't a fixed
//! set of runtime apis, instead it is up to the user to declare and implement these runtime apis.
//! The declaration of a runtime api is normally done outside of a runtime, while the implementation
//! of it has to be done in the runtime. We provide the [`decl_runtime_apis!`] macro for declaring
//! a runtime api and the [`impl_runtime_apis!`] for implementing them. The macro docs provide more
//! information on how to use them and what kind of attributes we support.
//! The Bizinikiwi runtime api is the interface between the node and the runtime. There isn't a
//! fixed set of runtime apis, instead it is up to the user to declare and implement these runtime
//! apis. The declaration of a runtime api is normally done outside of a runtime, while the
//! implementation of it has to be done in the runtime. We provide the [`decl_runtime_apis!`] macro
//! for declaring a runtime api and the [`impl_runtime_apis!`] for implementing them. The macro docs
//! provide more information on how to use them and what kind of attributes we support.
//!
//! It is required that each runtime implements at least the [`Core`] runtime api. This runtime api
//! provides all the core functions that Bizinikiwi expects from a runtime.
@@ -95,7 +95,6 @@ pub mod __private {
pub use alloc::vec;
pub use codec::{self, Decode, DecodeLimit, Encode};
pub use core::{mem, slice};
pub use scale_info;
pub use pezsp_core::offchain;
#[cfg(not(feature = "std"))]
pub use pezsp_core::to_bizinikiwi_wasm_fn_return_value;
@@ -108,6 +107,7 @@ pub mod __private {
ExtrinsicInclusionMode, TransactionOutcome,
};
pub use pezsp_version::{create_apis_vec, ApiId, ApisVec, RuntimeVersion};
pub use scale_info;
#[cfg(all(any(target_arch = "riscv32", target_arch = "riscv64"), bizinikiwi_runtime))]
pub use pezsp_runtime_interface::polkavm::{polkavm_abi, polkavm_export};
@@ -395,9 +395,9 @@ pub use pezsp_api_proc_macro::decl_runtime_apis;
/// [`decl_runtime_apis!`] declares two version of the api - 1 (the default one, which is
/// considered stable in our example) and 99 (which is considered staging). In
/// `impl_runtime_apis!` a `cfg_attr` attribute is attached to the `ApiWithStagingMethod`
/// implementation. If the code is compiled with `enable-pezstaging-api` feature a version 99 of
/// the runtime api will be built which will include `pezstaging_one`. Note that `pezstaging_one`
/// implementation is feature gated by `#[cfg(feature = ... )]` attribute.
/// implementation. If the code is compiled with `enable-pezstaging-api` feature a version 99
/// of the runtime api will be built which will include `pezstaging_one`. Note that
/// `pezstaging_one` implementation is feature gated by `#[cfg(feature = ... )]` attribute.
///
/// If the code is compiled without `enable-pezstaging-api` version 1 (the default one) will be
/// built which doesn't include `pezstaging_one`.
@@ -15,11 +15,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use criterion::{criterion_group, criterion_main, Criterion};
use pezsp_api::ProvideRuntimeApi;
use bizinikiwi_test_runtime_client::{
runtime::TestAPI, DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
use criterion::{criterion_group, criterion_main, Criterion};
use pezsp_api::ProvideRuntimeApi;
fn pezsp_api_benchmark(c: &mut Criterion) {
c.bench_function("add one with same runtime api", |b| {
@@ -38,9 +38,9 @@ use bizinikiwi_test_runtime_client::{
DefaultTestClientBuilderExt, TestClient, TestClientBuilder,
};
use bizinikiwi_test_runtime_client::pezsc_executor::WasmExecutor;
use codec::Encode;
use pezsp_consensus::SelectChain;
use bizinikiwi_test_runtime_client::pezsc_executor::WasmExecutor;
#[test]
fn calling_runtime_function() {
@@ -71,7 +71,11 @@ impl RuntimePublic for Public {
proof_of_possession: &Self::ProofOfPossession,
) -> bool {
let proof_of_possession_statement = Pair::proof_of_possession_statement(owner);
pezsp_io::crypto::ed25519_verify(&proof_of_possession, &proof_of_possession_statement, &self)
pezsp_io::crypto::ed25519_verify(
&proof_of_possession,
&proof_of_possession_statement,
&self,
)
}
fn to_raw_vec(&self) -> Vec<u8> {
@@ -68,7 +68,11 @@ impl RuntimePublic for Public {
proof_of_possession: &Self::ProofOfPossession,
) -> bool {
let proof_of_possession_statement = Pair::proof_of_possession_statement(owner);
pezsp_io::crypto::sr25519_verify(&proof_of_possession, &proof_of_possession_statement, &self)
pezsp_io::crypto::sr25519_verify(
&proof_of_possession,
&proof_of_possession_statement,
&self,
)
}
fn to_raw_vec(&self) -> Vec<u8> {
@@ -20,7 +20,9 @@ use scale_info::TypeInfo;
use alloc::vec::Vec;
use core::fmt::Debug;
use pezsp_core::crypto::{CryptoType, CryptoTypeId, IsWrappedBy, KeyTypeId, Pair, Public, Signature};
use pezsp_core::crypto::{
CryptoType, CryptoTypeId, IsWrappedBy, KeyTypeId, Pair, Public, Signature,
};
/// Application-specific cryptographic object.
///
@@ -17,6 +17,10 @@
//! Integration tests for bls12-381
use bizinikiwi_test_runtime_client::{
runtime::{TestAPI, TEST_OWNER},
DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
use pezsp_api::{ApiExt, ProvideRuntimeApi};
use pezsp_application_crypto::{bls381::AppPair, RuntimePublic};
use pezsp_core::{
@@ -28,10 +32,6 @@ use pezsp_core::{
};
use pezsp_keystore::{testing::MemoryKeystore, Keystore, KeystoreExt};
use std::sync::Arc;
use bizinikiwi_test_runtime_client::{
runtime::{TestAPI, TEST_OWNER},
DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
#[test]
fn bls381_works_in_runtime() {
@@ -16,6 +16,10 @@
// limitations under the License.
//! Integration tests for ecdsa
use bizinikiwi_test_runtime_client::{
runtime::{TestAPI, TEST_OWNER},
DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
use pezsp_api::{ApiExt, ProvideRuntimeApi};
use pezsp_application_crypto::{ecdsa::AppPair, RuntimePublic};
use pezsp_core::{
@@ -26,10 +30,6 @@ use pezsp_core::{
};
use pezsp_keystore::{testing::MemoryKeystore, Keystore, KeystoreExt};
use std::sync::Arc;
use bizinikiwi_test_runtime_client::{
runtime::{TestAPI, TEST_OWNER},
DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
#[test]
fn ecdsa_works_in_runtime() {
@@ -17,6 +17,10 @@
//! Integration tests for ecdsa-bls12-381
use bizinikiwi_test_runtime_client::{
runtime::{TestAPI, TEST_OWNER},
DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
use pezsp_api::{ApiExt, ProvideRuntimeApi};
use pezsp_application_crypto::{ecdsa_bls381::AppPair, RuntimePublic};
use pezsp_core::{
@@ -28,10 +32,6 @@ use pezsp_core::{
};
use pezsp_keystore::{testing::MemoryKeystore, Keystore, KeystoreExt};
use std::sync::Arc;
use bizinikiwi_test_runtime_client::{
runtime::{TestAPI, TEST_OWNER},
DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
#[test]
fn ecdsa_bls381_works_in_runtime() {
@@ -17,6 +17,10 @@
//! Integration tests for ed25519
use bizinikiwi_test_runtime_client::{
runtime::{TestAPI, TEST_OWNER},
DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
use pezsp_api::{ApiExt, ProvideRuntimeApi};
use pezsp_application_crypto::{ed25519::AppPair, RuntimePublic};
use pezsp_core::{
@@ -27,10 +31,6 @@ use pezsp_core::{
};
use pezsp_keystore::{testing::MemoryKeystore, Keystore, KeystoreExt};
use std::sync::Arc;
use bizinikiwi_test_runtime_client::{
runtime::{TestAPI, TEST_OWNER},
DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
#[test]
fn ed25519_works_in_runtime() {
@@ -17,6 +17,10 @@
//! Integration tests for sr25519
use bizinikiwi_test_runtime_client::{
runtime::{TestAPI, TEST_OWNER},
DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
use pezsp_api::{ApiExt, ProvideRuntimeApi};
use pezsp_application_crypto::{sr25519::AppPair, RuntimePublic};
use pezsp_core::{
@@ -27,10 +31,6 @@ use pezsp_core::{
};
use pezsp_keystore::{testing::MemoryKeystore, Keystore, KeystoreExt};
use std::sync::Arc;
use bizinikiwi_test_runtime_client::{
runtime::{TestAPI, TEST_OWNER},
DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
#[test]
fn sr25519_works_in_runtime() {
@@ -16,8 +16,8 @@
// limitations under the License.
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
use rand::Rng;
use pezsp_arithmetic::biguint::{BigUint, Single};
use rand::Rng;
fn random_big_uint(size: usize) -> BigUint {
let mut rng = rand::thread_rng();
@@ -40,8 +40,8 @@
//!
//! Each of these can be used to construct and represent ratios within our runtime.
//! You will find types like [`Perbill`](Perbill) being used often in pezpallet
//! development. `pezpallet_referenda` is a good example of a pezpallet which makes good use of fixed
//! point arithmetic, as it relies on representing various curves and thresholds relating to
//! development. `pezpallet_referenda` is a good example of a pezpallet which makes good use of
//! fixed point arithmetic, as it relies on representing various curves and thresholds relating to
//! governance.
//!
//! #### Fixed Point Arithmetic with [`PerThing`](PerThing)
@@ -19,12 +19,12 @@
//! to compute routes efficiently over the tree of headers.
use parking_lot::Mutex;
use schnellru::{ByLength, LruMap};
use pezsp_core::U256;
use pezsp_runtime::{
traits::{Block as BlockT, Header, NumberFor, One},
Saturating,
};
use schnellru::{ByLength, LruMap};
/// Set to the expected max difference between `best` and `finalized` blocks at sync.
pub(crate) const LRU_CACHE_SIZE: u32 = 5_000;
@@ -28,10 +28,10 @@ pub mod inherents;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
use pezsp_runtime::{traits::Header, ConsensusEngineId, RuntimeDebug};
use scale_info::TypeInfo;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use pezsp_runtime::{traits::Header, ConsensusEngineId, RuntimeDebug};
use crate::digests::{NextConfigDescriptor, NextEpochDescriptor};
@@ -18,9 +18,9 @@
use alloc::{vec, vec::Vec};
use codec::{Decode, DecodeWithMemTracking, Encode, Error, Input};
use core::cmp;
use scale_info::TypeInfo;
use pezsp_application_crypto::RuntimeAppPublic;
use pezsp_runtime::traits::Hash;
use scale_info::TypeInfo;
use crate::{BeefyAuthorityId, Payload, ValidatorSet, ValidatorSetId};
@@ -49,7 +49,6 @@ pub use payload::{known_payloads, BeefyPayloadId, Payload, PayloadProvider};
use alloc::vec::Vec;
use codec::{Codec, Decode, DecodeWithMemTracking, Encode};
use core::fmt::{Debug, Display};
use scale_info::TypeInfo;
use pezsp_application_crypto::{AppPublic, RuntimeAppPublic};
use pezsp_core::H256;
use pezsp_runtime::{
@@ -57,6 +56,7 @@ use pezsp_runtime::{
OpaqueValue,
};
use pezsp_weights::Weight;
use scale_info::TypeInfo;
/// Key type for BEEFY module.
pub const KEY_TYPE: pezsp_core::crypto::KeyTypeId = pezsp_application_crypto::key_types::BEEFY;
@@ -29,11 +29,11 @@
use crate::{ecdsa_crypto::AuthorityId, ConsensusLog, MmrRootHash, BEEFY_ENGINE_ID};
use alloc::vec::Vec;
use codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use pezsp_runtime::{
generic::OpaqueDigestItemId,
traits::{Block, Header},
};
use scale_info::TypeInfo;
/// A provider for extra data that gets added to the Mmr leaf
pub trait BeefyDataProvider<ExtraData> {
@@ -48,7 +48,8 @@ impl BeefyDataProvider<Vec<u8>> for () {
}
}
/// A standard leaf that gets added every block to the MMR constructed by Bizinikiwi's `pezpallet_mmr`.
/// A standard leaf that gets added every block to the MMR constructed by Bizinikiwi's
/// `pezpallet_mmr`.
#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode, TypeInfo)]
pub struct MmrLeaf<BlockNumber, Hash, MerkleRoot, ExtraData> {
/// Version of the leaf format.
@@ -17,8 +17,8 @@
use alloc::{vec, vec::Vec};
use codec::{Decode, DecodeWithMemTracking, Encode};
use scale_info::TypeInfo;
use pezsp_runtime::traits::Block;
use scale_info::TypeInfo;
/// Id of different payloads in the [`crate::Commitment`] data.
pub type BeefyPayloadId = [u8; 2];
@@ -35,9 +35,9 @@ pub mod error;
mod select_chain;
pub use self::error::Error;
pub use select_chain::SelectChain;
pub use pezsp_inherents::InherentData;
pub use pezsp_state_machine::Backend as StateBackend;
pub use select_chain::SelectChain;
/// Block status.
#[derive(Debug, PartialEq, Eq, Clone)]
@@ -26,13 +26,13 @@ use serde::Serialize;
use alloc::vec::Vec;
use codec::{Codec, Decode, DecodeWithMemTracking, Encode};
use scale_info::TypeInfo;
#[cfg(feature = "std")]
use pezsp_keystore::KeystorePtr;
use pezsp_runtime::{
traits::{Header as HeaderT, NumberFor},
ConsensusEngineId, OpaqueValue, RuntimeDebug,
};
use scale_info::TypeInfo;
/// The log target to be used by client code.
pub const CLIENT_LOG_TARGET: &str = "grandpa";
@@ -25,9 +25,9 @@ extern crate alloc;
use alloc::vec::Vec;
use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use pezsp_core::crypto::KeyTypeId;
use pezsp_runtime::{ConsensusEngineId, RuntimeDebug};
use scale_info::TypeInfo;
pub use pezsp_consensus_slots::{Slot, SlotDuration};
@@ -20,8 +20,8 @@
#![cfg_attr(not(feature = "std"), no_std)]
use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use pezsp_timestamp::Timestamp;
use scale_info::TypeInfo;
/// Unit type wrapper that represents a slot.
#[derive(
@@ -18,12 +18,12 @@
#![no_main]
extern crate libfuzzer_sys;
extern crate regex;
extern crate pezsp_core;
extern crate regex;
use libfuzzer_sys::fuzz_target;
use regex::Regex;
use pezsp_core::crypto::AddressUri;
use regex::Regex;
use std::sync::LazyLock;
static SECRET_PHRASE_REGEX: LazyLock<Regex> = LazyLock::new(|| {
+6 -5
View File
@@ -60,9 +60,9 @@
//! Such error messages should always be interpreted as "code accessing host functions accessed
//! outside of externalities".
//!
//! An externality is any type that implements [`pezsp_externalities::Externalities`]. A simple example
//! of which is [`TestExternalities`], which is commonly used in tests and is exported from this
//! crate.
//! An externality is any type that implements [`pezsp_externalities::Externalities`]. A simple
//! example of which is [`TestExternalities`], which is commonly used in tests and is exported from
//! this crate.
//!
//! ```
//! use pezsp_io::{storage::get, TestExternalities};
@@ -288,8 +288,9 @@ pub trait Storage {
/// operating on the same prefix should always pass `Some`, and this should be equal to the
/// previous call result's `maybe_cursor` field.
///
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result. Once
/// the resultant `maybe_cursor` field is `None`, then no further items remain to be deleted.
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result.
/// Once the resultant `maybe_cursor` field is `None`, then no further items remain to be
/// deleted.
///
/// NOTE: After the initial call for any given prefix, it is important that no keys further
/// keys under the same prefix are inserted. If so, then they may or may not be deleted by
@@ -28,9 +28,9 @@ pub use mmr_lib;
use alloc::vec::Vec;
use codec::{Decode, DecodeWithMemTracking, Encode};
use core::fmt;
use scale_info::TypeInfo;
use pezsp_debug_derive::RuntimeDebug;
use pezsp_runtime::traits;
use scale_info::TypeInfo;
pub mod utils;
@@ -192,8 +192,8 @@ pub struct PalletMetadataIR<T: Form = MetaForm> {
pub error: Option<PalletErrorMetadataIR<T>>,
/// Config's trait associated types.
pub associated_types: Vec<PalletAssociatedTypeMetadataIR<T>>,
/// Define the index of the pezpallet, this index will be used for the encoding of pezpallet event,
/// call and origin variants.
/// Define the index of the pezpallet, this index will be used for the encoding of pezpallet
/// event, call and origin variants.
pub index: u8,
/// Pezpallet documentation.
pub docs: Vec<T::String>,
@@ -534,8 +534,9 @@ pub struct OuterEnumsIR<T: Form = MetaForm> {
///
/// # Note
///
/// - This type cannot be used directly to decode `pezsp_runtime::DispatchError` from the chain.
/// It provides just the information needed to decode `pezsp_runtime::DispatchError::Module`.
/// - This type cannot be used directly to decode `pezsp_runtime::DispatchError` from the
/// chain. It provides just the information needed to decode
/// `pezsp_runtime::DispatchError::Module`.
/// - Decoding the 5 error bytes into this type will not always lead to all of the bytes being
/// consumed; many error types do not require all of the bytes to represent them fully.
pub error_enum_ty: T::Type,
@@ -20,9 +20,9 @@
// Each function will be used based on which fuzzer binary is being used.
#![allow(dead_code)]
use rand::{self, seq::SliceRandom, Rng, RngCore};
use pezsp_npos_elections::{phragmms, seq_phragmen, BalancingConfig, ElectionResult, VoteWeight};
use pezsp_runtime::Perbill;
use rand::{self, seq::SliceRandom, Rng, RngCore};
use std::collections::{BTreeMap, HashSet};
/// converts x into the range [a, b] in a pseudo-fair way.
@@ -21,11 +21,11 @@ mod common;
use common::*;
use honggfuzz::fuzz;
use rand::{self, SeedableRng};
use pezsp_npos_elections::{
assignment_ratio_to_staked_normalized, seq_phragmen, to_supports, BalancingConfig,
ElectionResult, EvaluateSupport, VoteWeight,
};
use rand::{self, SeedableRng};
fn main() {
loop {
@@ -46,8 +46,8 @@ use clap::Parser;
mod common;
use common::{generate_random_npos_inputs, to_range};
use rand::{self, SeedableRng};
use pezsp_npos_elections::{pjr_check_core, seq_phragmen_core, setup_inputs, standard_threshold};
use rand::{self, SeedableRng};
type AccountId = u64;
@@ -21,12 +21,12 @@ mod common;
use common::*;
use honggfuzz::fuzz;
use rand::{self, SeedableRng};
use pezsp_npos_elections::{
assignment_ratio_to_staked_normalized, phragmms, to_supports, BalancingConfig, ElectionResult,
EvaluateSupport, VoteWeight,
};
use pezsp_runtime::Perbill;
use rand::{self, SeedableRng};
fn main() {
loop {
@@ -34,8 +34,8 @@ use honggfuzz::fuzz;
mod common;
use common::to_range;
use rand::{self, Rng, RngCore, SeedableRng};
use pezsp_npos_elections::{reduce, to_support_map, ExtendedBalance, StakedAssignment};
use rand::{self, Rng, RngCore, SeedableRng};
type Balance = u128;
type AccountId = u64;
@@ -79,11 +79,11 @@ extern crate alloc;
use alloc::{collections::btree_map::BTreeMap, rc::Rc, vec, vec::Vec};
use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
use core::{cell::RefCell, cmp::Ordering};
use pezsp_arithmetic::{traits::Zero, Normalizable, PerThing, Rational128, ThresholdOrd};
use pezsp_core::RuntimeDebug;
use scale_info::TypeInfo;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use pezsp_arithmetic::{traits::Zero, Normalizable, PerThing, Rational128, ThresholdOrd};
use pezsp_core::RuntimeDebug;
#[cfg(test)]
mod mock;
@@ -481,8 +481,8 @@ pub struct ElectionResult<AccountId, P: PerThing> {
///
/// This complements the [`ElectionResult`] and is needed to run the balancing post-processing.
///
/// This, at the current version, resembles the `Exposure` defined in the Staking pezpallet, yet they
/// do not necessarily have to be the same.
/// This, at the current version, resembles the `Exposure` defined in the Staking pezpallet, yet
/// they do not necessarily have to be the same.
#[derive(RuntimeDebug, Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, TypeInfo)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Support<AccountId> {
@@ -21,8 +21,8 @@ use crate::{
balancing, helpers::*, mock::*, seq_phragmen, seq_phragmen_core, setup_inputs, to_support_map,
Assignment, BalancingConfig, ElectionResult, ExtendedBalance, StakedAssignment, Support, Voter,
};
use pezsp_arithmetic::{PerU16, Perbill, Percent, Permill};
use bizinikiwi_test_utils::assert_eq_uvec;
use pezsp_arithmetic::{PerU16, Perbill, Percent, Permill};
#[test]
fn float_phragmen_poc_works() {
+1 -1
View File
@@ -18,8 +18,8 @@
//! A number type that can be serialized both as a number or a string that encodes a number in a
//! string.
use serde::{Deserialize, Serialize};
use pezsp_core::U256;
use serde::{Deserialize, Serialize};
use std::fmt::Debug;
/// A number type that can be serialized both as a number or a string that encodes a number in a
@@ -23,9 +23,9 @@ use crate::{
scale_info::TypeInfo,
traits::{self, AtLeast32BitUnsigned, BlockNumber, Hash as HashT, MaybeDisplay, Member},
};
use pezsp_core::U256;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use pezsp_core::U256;
/// Abstraction over a block header for a bizinikiwi chain.
#[derive(
@@ -35,9 +35,9 @@ use codec::{
Input,
};
use core::fmt;
use scale_info::{build::Fields, meta_type, Path, StaticTypeInfo, Type, TypeInfo, TypeParameter};
use pezsp_io::hashing::blake2_256;
use pezsp_weights::Weight;
use scale_info::{build::Fields, meta_type, Path, StaticTypeInfo, Type, TypeInfo, TypeParameter};
/// Type to represent the version of the [Extension](TransactionExtension) used in this extrinsic.
pub type ExtensionVersion = u8;
+2 -2
View File
@@ -53,12 +53,12 @@ pub use alloc::vec::Vec;
#[doc(hidden)]
pub use codec;
#[doc(hidden)]
pub use pezsp_std;
#[doc(hidden)]
pub use scale_info;
#[cfg(feature = "serde")]
#[doc(hidden)]
pub use serde;
#[doc(hidden)]
pub use pezsp_std;
#[doc(hidden)]
pub use paste;
@@ -327,7 +327,8 @@ impl Response {
/// Retrieve the headers for this response.
pub fn headers(&mut self) -> &Headers {
if self.headers.is_none() {
self.headers = Some(Headers { raw: pezsp_io::offchain::http_response_headers(self.id) });
self.headers =
Some(Headers { raw: pezsp_io::offchain::http_response_headers(self.id) });
}
self.headers.as_ref().expect("Headers were just set; qed")
}
@@ -406,8 +407,11 @@ impl Iterator for ResponseBody {
}
if self.filled_up_to.is_none() {
let result =
pezsp_io::offchain::http_response_read_body(self.id, &mut self.buffer, self.deadline);
let result = pezsp_io::offchain::http_response_read_body(
self.id,
&mut self.buffer,
self.deadline,
);
match result {
Err(e) => {
self.error = Some(e);
@@ -65,11 +65,11 @@ impl log::Log for RuntimeLogger {
#[cfg(test)]
mod tests {
use pezsp_api::ProvideRuntimeApi;
use std::env;
use bizinikiwi_test_runtime_client::{
runtime::TestAPI, DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
};
use pezsp_api::ProvideRuntimeApi;
use std::env;
#[test]
fn ensure_runtime_logger_works() {
+1 -1
View File
@@ -24,9 +24,9 @@ use crate::{
traits::{self, BlakeTwo256, Dispatchable, LazyExtrinsic, OpaqueKeys},
DispatchResultWithInfo, KeyTypeId, OpaqueExtrinsic,
};
use serde::{de::Error as DeError, Deserialize, Deserializer, Serialize};
use pezsp_core::crypto::{key_types, ByteArray, CryptoType, Dummy};
pub use pezsp_core::{sr25519, H256};
use serde::{de::Error as DeError, Deserialize, Deserializer, Serialize};
use std::{cell::RefCell, fmt::Debug};
/// A dummy type which can be used instead of regular cryptographic primitives.
@@ -33,8 +33,6 @@ use codec::{
#[doc(hidden)]
pub use core::{fmt::Debug, marker::PhantomData};
use impl_trait_for_tuples::impl_for_tuples;
#[cfg(feature = "serde")]
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use pezsp_application_crypto::AppCrypto;
pub use pezsp_arithmetic::traits::{
checked_pow, ensure_pow, AtLeast32Bit, AtLeast32BitUnsigned, Bounded, CheckedAdd, CheckedDiv,
@@ -50,6 +48,8 @@ pub use pezsp_core::{
ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, ConstUint, Get, GetDefault, TryCollect,
TypedGet,
};
#[cfg(feature = "serde")]
use serde::{de::DeserializeOwned, Deserialize, Serialize};
#[cfg(feature = "std")]
use std::fmt::Display;
#[cfg(feature = "std")]
@@ -157,8 +157,9 @@ pub trait AppVerify {
}
impl<
S: Verify<Signer = <<T as AppCrypto>::Public as pezsp_application_crypto::AppPublic>::Generic>
+ From<T>,
S: Verify<
Signer = <<T as AppCrypto>::Public as pezsp_application_crypto::AppPublic>::Generic,
> + From<T>,
T: pezsp_application_crypto::Wraps<Inner = S>
+ pezsp_application_crypto::AppCrypto
+ pezsp_application_crypto::AppSignature
@@ -1279,8 +1280,8 @@ pub trait Header:
// via `HeaderFor` or `BlockNumberFor`.
//
// This is needed to fix the "cyclical" issue in loading Header/BlockNumber as part of a
// `pezpallet::call`. Essentially, `construct_runtime` aggregates all calls to create a `RuntimeCall`
// that is then used to define `UncheckedExtrinsic`.
// `pezpallet::call`. Essentially, `construct_runtime` aggregates all calls to create a
// `RuntimeCall` that is then used to define `UncheckedExtrinsic`.
// ```ignore
// pub type UncheckedExtrinsic =
// generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>;
@@ -20,8 +20,8 @@
#![allow(deprecated)]
use scale_info::TypeInfo;
use pezsp_core::RuntimeDebug;
use scale_info::TypeInfo;
use crate::{
traits::{AsSystemOriginSigner, SignedExtension, ValidateResult},
@@ -22,8 +22,8 @@ use crate::{
RuntimeDebug,
};
use alloc::{vec, vec::Vec};
use scale_info::TypeInfo;
use pezsp_weights::Weight;
use scale_info::TypeInfo;
/// Priority for a transaction. Additive. Higher is better.
pub type TransactionPriority = u64;
@@ -31,8 +31,8 @@ use num_traits::{
CheckedAdd, CheckedDiv, CheckedMul, CheckedNeg, CheckedRem, CheckedShl, CheckedShr, CheckedSub,
Num, NumCast, PrimInt, Saturating, ToPrimitive,
};
use scale_info::{StaticTypeInfo, TypeInfo};
use pezsp_core::Get;
use scale_info::{StaticTypeInfo, TypeInfo};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
@@ -523,9 +523,9 @@ impl<T: HasCompact, D: Get<T>> CompactAs for TypeWithDefault<T, D> {
#[cfg(test)]
mod tests {
use super::TypeWithDefault;
use scale_info::TypeInfo;
use pezsp_arithmetic::traits::{AtLeast16Bit, AtLeast32Bit, AtLeast8Bit};
use pezsp_core::Get;
use scale_info::TypeInfo;
#[test]
#[allow(dead_code)]
+3 -3
View File
@@ -26,11 +26,11 @@ use crate::currency_to_vote::CurrencyToVote;
use alloc::{collections::btree_map::BTreeMap, vec, vec::Vec};
use codec::{Decode, DecodeWithMemTracking, Encode, FullCodec, HasCompact, MaxEncodedLen};
use core::ops::{Add, AddAssign, Sub, SubAssign};
use scale_info::TypeInfo;
use pezsp_runtime::{
traits::{AtLeast32BitUnsigned, Zero},
DispatchError, DispatchResult, Perbill, RuntimeDebug, Saturating,
};
use scale_info::TypeInfo;
pub mod offence;
@@ -330,8 +330,8 @@ pub trait StakingUnchecked: StakingInterface {
/// Book-keep a new bond for `keyless_who` without applying any locks (hence virtual).
///
/// It is important that `keyless_who` is a keyless account and therefore cannot interact with
/// staking pezpallet directly. Caller is responsible for ensuring the passed amount is locked and
/// valid.
/// staking pezpallet directly. Caller is responsible for ensuring the passed amount is locked
/// and valid.
fn virtual_bond(
keyless_who: &Self::AccountId,
value: Self::Balance,
+3 -1
View File
@@ -169,7 +169,9 @@ impl<Reporter, Offender, Res: Default> OnOffenceHandler<Reporter, Offender, Res>
}
/// A details about an offending authority for a particular kind of offence.
#[derive(Clone, PartialEq, Eq, Encode, Decode, pezsp_runtime::RuntimeDebug, scale_info::TypeInfo)]
#[derive(
Clone, PartialEq, Eq, Encode, Decode, pezsp_runtime::RuntimeDebug, scale_info::TypeInfo,
)]
pub struct OffenceDetails<Reporter, Offender> {
/// The offending authority id
pub offender: Offender,
@@ -165,7 +165,6 @@ mod execution {
use super::*;
use codec::Codec;
use hash_db::Hasher;
use smallvec::SmallVec;
use pezsp_core::{
hexdisplay::HexDisplay,
storage::{ChildInfo, ChildType, PrefixedStorageKey},
@@ -173,6 +172,7 @@ mod execution {
};
use pezsp_externalities::Extensions;
use pezsp_trie::PrefixedMemoryDB;
use smallvec::SmallVec;
use std::collections::{HashMap, HashSet};
pub(crate) type CallResult<E> = Result<Vec<u8>, E>;
@@ -143,7 +143,12 @@ where
/// Insert key/value into backend.
///
/// This only supports inserting keys in child tries.
pub fn insert_child(&mut self, c: pezsp_core::storage::ChildInfo, k: StorageKey, v: StorageValue) {
pub fn insert_child(
&mut self,
c: pezsp_core::storage::ChildInfo,
k: StorageKey,
v: StorageValue,
) {
self.backend.insert(vec![(Some(c), vec![(k, Some(v))])], self.state_version);
}
@@ -260,7 +265,8 @@ where
let mut proving_ext =
Ext::new(&mut self.overlay, &proving_backend, Some(&mut self.extensions));
let outcome = pezsp_externalities::set_and_run_with_externalities(&mut proving_ext, execute);
let outcome =
pezsp_externalities::set_and_run_with_externalities(&mut proving_ext, execute);
let proof = proving_backend.extract_proof().expect("Failed to extract storage proof");
(outcome, proof)
@@ -394,7 +400,10 @@ where
self.extension_by_type_id(TypeId::of::<T>()).and_then(<dyn Any>::downcast_mut)
}
fn register_extension<T: Extension>(&mut self, ext: T) -> Result<(), pezsp_externalities::Error> {
fn register_extension<T: Extension>(
&mut self,
ext: T,
) -> Result<(), pezsp_externalities::Error> {
self.register_extension_with_type_id(TypeId::of::<T>(), Box::new(ext))
}
@@ -20,9 +20,9 @@
// end::description[]
use aes_gcm::{aead::Aead, AeadCore, KeyInit};
use pezsp_core::crypto::Pair;
use rand::rngs::OsRng;
use sha2::Digest;
use pezsp_core::crypto::Pair;
/// x25519 secret key.
pub type SecretKey = x25519_dalek::StaticSecret;
@@ -92,7 +92,10 @@ pub fn encrypt_x25519(pk: &PublicKey, plaintext: &[u8]) -> Result<Vec<u8>, Error
/// Encrypt `plaintext` with the given ed25519 public key. Decryption can be performed with the
/// matching secret key.
pub fn encrypt_ed25519(pk: &pezsp_core::ed25519::Public, plaintext: &[u8]) -> Result<Vec<u8>, Error> {
pub fn encrypt_ed25519(
pk: &pezsp_core::ed25519::Public,
plaintext: &[u8],
) -> Result<Vec<u8>, Error> {
let ed25519 = curve25519_dalek::edwards::CompressedEdwardsY(pk.0);
let x25519 = ed25519.decompress().ok_or(Error::BadData)?.to_montgomery();
let montgomery = x25519_dalek::PublicKey::from(x25519.to_bytes());
@@ -118,7 +121,10 @@ pub fn decrypt_x25519(sk: &SecretKey, encrypted: &[u8]) -> Result<Vec<u8>, Error
}
/// Decrypt with the given ed25519 key pair.
pub fn decrypt_ed25519(pair: &pezsp_core::ed25519::Pair, encrypted: &[u8]) -> Result<Vec<u8>, Error> {
pub fn decrypt_ed25519(
pair: &pezsp_core::ed25519::Pair,
encrypted: &[u8],
) -> Result<Vec<u8>, Error> {
let raw = pair.to_raw_vec();
let hash: [u8; 32] = sha2::Sha512::digest(&raw).as_slice()[..32]
.try_into()
@@ -130,8 +136,8 @@ pub fn decrypt_ed25519(pair: &pezsp_core::ed25519::Pair, encrypted: &[u8]) -> Re
#[cfg(test)]
mod test {
use super::*;
use rand::rngs::OsRng;
use pezsp_core::crypto::Pair;
use rand::rngs::OsRng;
#[test]
fn basic_x25519_encryption() {
@@ -24,10 +24,10 @@ extern crate alloc;
use alloc::vec::Vec;
use codec::{Decode, DecodeWithMemTracking, Encode};
use scale_info::TypeInfo;
use pezsp_application_crypto::RuntimeAppPublic;
#[cfg(feature = "std")]
use pezsp_core::Pair;
use scale_info::TypeInfo;
/// Statement topic.
pub type Topic = [u8; 32];
@@ -175,7 +175,9 @@ impl Field {
}
/// Statement structure.
#[derive(DecodeWithMemTracking, TypeInfo, pezsp_core::RuntimeDebug, Clone, PartialEq, Eq, Default)]
#[derive(
DecodeWithMemTracking, TypeInfo, pezsp_core::RuntimeDebug, Clone, PartialEq, Eq, Default,
)]
pub struct Statement {
proof: Option<Proof>,
decryption_key: Option<DecryptionKey>,
@@ -20,7 +20,6 @@
use crate::{Hash, Statement, Topic};
use alloc::vec::Vec;
use codec::{Decode, Encode};
use scale_info::TypeInfo;
use pezsp_runtime::RuntimeDebug;
use pezsp_runtime_interface::{
pass_by::{
@@ -29,6 +28,7 @@ use pezsp_runtime_interface::{
},
runtime_interface,
};
use scale_info::TypeInfo;
#[cfg(feature = "std")]
use pezsp_externalities::ExternalitiesExt;
+1 -1
View File
@@ -21,9 +21,9 @@
extern crate alloc;
use pezsp_debug_derive::RuntimeDebug;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use pezsp_debug_derive::RuntimeDebug;
use alloc::vec::Vec;
use codec::{Decode, Encode};
@@ -19,8 +19,8 @@
use alloc::collections::BTreeSet;
use core::hash::Hash;
use scale_info::TypeInfo;
use pezsp_core::{Decode, Encode};
use scale_info::TypeInfo;
use trie_db::{RecordedForKey, TrieAccess, TrieRecorder};
/// Error associated with the `AccessedNodesTracker` module.
+1 -1
View File
@@ -856,8 +856,8 @@ impl<'a, H: Hasher> trie_db::TrieCache<NodeCodec<H>> for TrieCache<'a, H> {
#[cfg(test)]
mod tests {
use super::*;
use rand::{thread_rng, Rng};
use pezsp_core::H256;
use rand::{thread_rng, Rng};
use trie_db::{Bytes, Trie, TrieDBBuilder, TrieDBMutBuilder, TrieHash, TrieMut};
type MemoryDB = crate::MemoryDB<pezsp_core::Blake2Hasher>;
+4 -2
View File
@@ -80,7 +80,8 @@ where
let mut iter = trie.iter()?;
let childtrie_roots = pezsp_core::storage::well_known_keys::DEFAULT_CHILD_STORAGE_KEY_PREFIX;
let childtrie_roots =
pezsp_core::storage::well_known_keys::DEFAULT_CHILD_STORAGE_KEY_PREFIX;
if iter.seek(childtrie_roots).is_ok() {
loop {
match iter.next() {
@@ -161,7 +162,8 @@ where
let mut iter = trie.iter()?;
let childtrie_roots = pezsp_core::storage::well_known_keys::DEFAULT_CHILD_STORAGE_KEY_PREFIX;
let childtrie_roots =
pezsp_core::storage::well_known_keys::DEFAULT_CHILD_STORAGE_KEY_PREFIX;
if iter.seek(childtrie_roots).is_ok() {
loop {
match iter.next() {
@@ -289,8 +289,11 @@ mod tests {
.encode();
assert_eq!(
pezsp_version::RuntimeVersion::decode_with_version_hint(&mut &version_bytes[..], Some(4))
.unwrap(),
pezsp_version::RuntimeVersion::decode_with_version_hint(
&mut &version_bytes[..],
Some(4)
)
.unwrap(),
pezsp_version::RuntimeVersion {
spec_name: "hello".into(),
impl_name: "world".into(),
+11 -11
View File
@@ -45,11 +45,11 @@ use std::collections::HashSet;
#[doc(hidden)]
pub use alloc::borrow::Cow;
use codec::{Decode, Encode, Input};
use scale_info::TypeInfo;
#[allow(deprecated)]
pub use pezsp_runtime::{create_runtime_str, StateVersion};
#[doc(hidden)]
pub use pezsp_std;
use scale_info::TypeInfo;
#[cfg(feature = "std")]
use pezsp_runtime::traits::Block as BlockT;
@@ -208,18 +208,18 @@ pub struct RuntimeVersion {
///
/// This number must change when an existing call (pezpallet index, call index) is changed,
/// either through an alteration in its user-level semantics, a parameter
/// added/removed, a parameter type changed, or a call/pezpallet changing its index. An alteration
/// of the user level semantics is for example when the call was before `transfer` and now is
/// `transfer_all`, the semantics of the call changed completely.
/// added/removed, a parameter type changed, or a call/pezpallet changing its index. An
/// alteration of the user level semantics is for example when the call was before `transfer`
/// and now is `transfer_all`, the semantics of the call changed completely.
///
/// Removing a pezpallet or a call doesn't require a *bump* as long as no pezpallet or call is put at
/// the same index. Removing doesn't require a bump as the chain will reject a transaction
/// referencing this removed call/pezpallet while decoding and thus, the user isn't at risk to
/// execute any unknown call. FRAME runtime devs have control over the index of a call/pezpallet
/// to prevent that an index gets reused.
/// Removing a pezpallet or a call doesn't require a *bump* as long as no pezpallet or call is
/// put at the same index. Removing doesn't require a bump as the chain will reject a
/// transaction referencing this removed call/pezpallet while decoding and thus, the user
/// isn't at risk to execute any unknown call. FRAME runtime devs have control over the index
/// of a call/pezpallet to prevent that an index gets reused.
///
/// Adding a new pezpallet or call also doesn't require a *bump* as long as they also don't reuse
/// any previously used index.
/// Adding a new pezpallet or call also doesn't require a *bump* as long as they also don't
/// reuse any previously used index.
///
/// This number should never decrease.
pub transaction_version: u32,
@@ -25,5 +25,10 @@ wasmtime = { optional = true, workspace = true }
[features]
default = ["std"]
std = ["anyhow?/std", "codec/std", "log/std"]
std = [
"anyhow?/std",
"codec/std",
"log/std",
"wasmtime?/std"
]
wasmtime = ["anyhow", "dep:wasmtime"]
+4 -4
View File
@@ -26,15 +26,15 @@ mod weight_v2;
use bounded_collections::Get;
use codec::{Decode, Encode};
use scale_info::TypeInfo;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use smallvec::SmallVec;
use pezsp_arithmetic::{
traits::{BaseArithmetic, SaturatedConversion, Unsigned},
Perbill,
};
use pezsp_debug_derive::RuntimeDebug;
use scale_info::TypeInfo;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use smallvec::SmallVec;
pub use weight_meter::*;
pub use weight_v2::*;