mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 01:11:10 +00:00
Fix spelling mistakes across the whole repository (#3808)
**Update:** Pushed additional changes based on the review comments. **This pull request fixes various spelling mistakes in this repository.** Most of the changes are contained in the first **3** commits: - `Fix spelling mistakes in comments and docs` - `Fix spelling mistakes in test names` - `Fix spelling mistakes in error messages, panic messages, logs and tracing` Other source code spelling mistakes are separated into individual commits for easier reviewing: - `Fix the spelling of 'authority'` - `Fix the spelling of 'REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY'` - `Fix the spelling of 'prev_enqueud_messages'` - `Fix the spelling of 'endpoint'` - `Fix the spelling of 'children'` - `Fix the spelling of 'PenpalSiblingSovereignAccount'` - `Fix the spelling of 'PenpalSudoAccount'` - `Fix the spelling of 'insufficient'` - `Fix the spelling of 'PalletXcmExtrinsicsBenchmark'` - `Fix the spelling of 'subtracted'` - `Fix the spelling of 'CandidatePendingAvailability'` - `Fix the spelling of 'exclusive'` - `Fix the spelling of 'until'` - `Fix the spelling of 'discriminator'` - `Fix the spelling of 'nonexistent'` - `Fix the spelling of 'subsystem'` - `Fix the spelling of 'indices'` - `Fix the spelling of 'committed'` - `Fix the spelling of 'topology'` - `Fix the spelling of 'response'` - `Fix the spelling of 'beneficiary'` - `Fix the spelling of 'formatted'` - `Fix the spelling of 'UNKNOWN_PROOF_REQUEST'` - `Fix the spelling of 'succeeded'` - `Fix the spelling of 'reopened'` - `Fix the spelling of 'proposer'` - `Fix the spelling of 'InstantiationNonce'` - `Fix the spelling of 'depositor'` - `Fix the spelling of 'expiration'` - `Fix the spelling of 'phantom'` - `Fix the spelling of 'AggregatedKeyValue'` - `Fix the spelling of 'randomness'` - `Fix the spelling of 'defendant'` - `Fix the spelling of 'AquaticMammal'` - `Fix the spelling of 'transactions'` - `Fix the spelling of 'PassingTracingSubscriber'` - `Fix the spelling of 'TxSignaturePayload'` - `Fix the spelling of 'versioning'` - `Fix the spelling of 'descendant'` - `Fix the spelling of 'overridden'` - `Fix the spelling of 'network'` Let me know if this structure is adequate. **Note:** The usage of the words `Merkle`, `Merkelize`, `Merklization`, `Merkelization`, `Merkleization`, is somewhat inconsistent but I left it as it is. ~~**Note:** In some places the term `Receival` is used to refer to message reception, IMO `Reception` is the correct word here, but I left it as it is.~~ ~~**Note:** In some places the term `Overlayed` is used instead of the more acceptable version `Overlaid` but I also left it as it is.~~ ~~**Note:** In some places the term `Applyable` is used instead of the correct version `Applicable` but I also left it as it is.~~ **Note:** Some usage of British vs American english e.g. `judgement` vs `judgment`, `initialise` vs `initialize`, `optimise` vs `optimize` etc. are both present in different places, but I suppose that's understandable given the number of contributors. ~~**Note:** There is a spelling mistake in `.github/CODEOWNERS` but it triggers errors in CI when I make changes to it, so I left it as it is.~~
This commit is contained in:
@@ -66,7 +66,7 @@ fn main() {
|
||||
let c = FixedI64::saturating_from_integer(x.saturating_add(y));
|
||||
assert_eq!(a.saturating_add(b), c);
|
||||
|
||||
// Check substraction.
|
||||
// Check subtraction.
|
||||
let a = FixedI64::saturating_from_integer(x);
|
||||
let b = FixedI64::saturating_from_integer(y);
|
||||
let c = FixedI64::saturating_from_integer(x.saturating_sub(y));
|
||||
|
||||
@@ -568,7 +568,7 @@ macro_rules! implement_fixed {
|
||||
let v = self.0 as u128;
|
||||
|
||||
// Want x' = sqrt(x) where x = n/D and x' = n'/D (D is fixed)
|
||||
// Our prefered way is:
|
||||
// Our preferred way is:
|
||||
// sqrt(n/D) = sqrt(nD / D^2) = sqrt(nD)/sqrt(D^2) = sqrt(nD)/D
|
||||
// ergo n' = sqrt(nD)
|
||||
// but this requires nD to fit into our type.
|
||||
|
||||
@@ -187,7 +187,7 @@ pub trait Backend<Block: BlockT>:
|
||||
/// a block with the given `base_hash`.
|
||||
///
|
||||
/// The search space is always limited to blocks which are in the finalized
|
||||
/// chain or descendents of it.
|
||||
/// chain or descendants of it.
|
||||
///
|
||||
/// Returns `Ok(None)` if `base_hash` is not found in search space.
|
||||
// TODO: document time complexity of this, see [#1444](https://github.com/paritytech/substrate/issues/1444)
|
||||
|
||||
@@ -34,7 +34,7 @@ pub enum ApplyExtrinsicFailed {
|
||||
/// The transaction cannot be included into the current block.
|
||||
///
|
||||
/// This doesn't necessary mean that the transaction itself is invalid, but it might be just
|
||||
/// unappliable onto the current block.
|
||||
/// unapplicable onto the current block.
|
||||
#[error("Extrinsic is not valid: {0:?}")]
|
||||
Validity(#[from] TransactionValidityError),
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ pub struct TreeRoute<Block: BlockT> {
|
||||
impl<Block: BlockT> TreeRoute<Block> {
|
||||
/// Creates a new `TreeRoute`.
|
||||
///
|
||||
/// To preserve the structure safety invariats it is required that `pivot < route.len()`.
|
||||
/// To preserve the structure safety invariants it is required that `pivot < route.len()`.
|
||||
pub fn new(route: Vec<HashAndNumber<Block>>, pivot: usize) -> Result<Self, String> {
|
||||
if pivot < route.len() {
|
||||
Ok(TreeRoute { route, pivot })
|
||||
@@ -212,7 +212,7 @@ impl<Block: BlockT> TreeRoute<Block> {
|
||||
)
|
||||
}
|
||||
|
||||
/// Get a slice of enacted blocks (descendents of the common ancestor)
|
||||
/// Get a slice of enacted blocks (descendants of the common ancestor)
|
||||
pub fn enacted(&self) -> &[HashAndNumber<Block>] {
|
||||
&self.route[self.pivot + 1..]
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ impl Default for BabeEpochConfiguration {
|
||||
}
|
||||
|
||||
/// Verifies the equivocation proof by making sure that: both headers have
|
||||
/// different hashes, are targetting the same slot, and have valid signatures by
|
||||
/// different hashes, are targeting the same slot, and have valid signatures by
|
||||
/// the same authority.
|
||||
pub fn check_equivocation_proof<H>(proof: EquivocationProof<H>) -> bool
|
||||
where
|
||||
@@ -298,7 +298,7 @@ where
|
||||
let first_pre_digest = find_pre_digest(&proof.first_header)?;
|
||||
let second_pre_digest = find_pre_digest(&proof.second_header)?;
|
||||
|
||||
// both headers must be targetting the same slot and it must
|
||||
// both headers must be targeting the same slot and it must
|
||||
// be the same as the one in the proof.
|
||||
if proof.slot != first_pre_digest.slot() ||
|
||||
first_pre_digest.slot() != second_pre_digest.slot()
|
||||
|
||||
@@ -200,7 +200,7 @@ pub mod ecdsa_bls_crypto {
|
||||
fn verify(&self, signature: &<Self as RuntimeAppPublic>::Signature, msg: &[u8]) -> bool {
|
||||
// We can not simply call
|
||||
// `EcdsaBlsPair::verify(signature.as_inner_ref(), msg, self.as_inner_ref())`
|
||||
// because that invokes ECDSA default verification which perfoms Blake2b hash
|
||||
// because that invokes ECDSA default verification which performs Blake2b hash
|
||||
// which we don't want. This is because ECDSA signatures are meant to be verified
|
||||
// on Ethereum network where Keccak hasher is significantly cheaper than Blake2b.
|
||||
// See Figure 3 of [OnSc21](https://www.scitepress.org/Papers/2021/106066/106066.pdf)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! BEEFY + MMR utilties.
|
||||
//! BEEFY + MMR utilities.
|
||||
//!
|
||||
//! While BEEFY can be used completely independently as an additional consensus gadget,
|
||||
//! it is designed around a main use case of bridging standalone networks together.
|
||||
@@ -77,7 +77,7 @@ pub struct MmrLeaf<BlockNumber, Hash, MerkleRoot, ExtraData> {
|
||||
///
|
||||
/// Given that adding new struct elements in SCALE is backward compatible (i.e. old format can be
|
||||
/// still decoded, the new fields will simply be ignored). We expect the major version to be bumped
|
||||
/// very rarely (hopefuly never).
|
||||
/// very rarely (hopefully never).
|
||||
#[derive(Debug, Default, PartialEq, Eq, Clone, Encode, Decode, TypeInfo)]
|
||||
pub struct MmrLeafVersion(u8);
|
||||
impl MmrLeafVersion {
|
||||
|
||||
@@ -43,7 +43,7 @@ pub mod known_payloads {
|
||||
pub struct Payload(Vec<(BeefyPayloadId, Vec<u8>)>);
|
||||
|
||||
impl Payload {
|
||||
/// Construct a new payload given an initial vallue
|
||||
/// Construct a new payload given an initial value
|
||||
pub fn from_single_entry(id: BeefyPayloadId, value: Vec<u8>) -> Self {
|
||||
Self(vec![(id, value)])
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ pub trait Proposer<B: BlockT> {
|
||||
+ Send
|
||||
+ Unpin
|
||||
+ 'static;
|
||||
/// The supported proof recording by the implementator of this trait. See [`ProofRecording`]
|
||||
/// The supported proof recording by the implementor of this trait. See [`ProofRecording`]
|
||||
/// for more information.
|
||||
type ProofRecording: self::ProofRecording<Proof = Self::Proof> + Send + Sync + 'static;
|
||||
/// The proof type used by [`Self::ProofRecording`].
|
||||
|
||||
@@ -115,7 +115,7 @@ mod tests {
|
||||
let threshold = ticket_id_threshold(redundancy, slots, attempts, validators);
|
||||
let threshold = threshold as f64 / TicketId::MAX as f64;
|
||||
|
||||
// We expect that the total number of tickets allowed to be submited
|
||||
// We expect that the total number of tickets allowed to be submitted
|
||||
// is slots*redundancy
|
||||
let avt = ((attempts * validators) as f64 * threshold) as u32;
|
||||
assert_eq!(avt, slots * redundancy);
|
||||
|
||||
@@ -101,7 +101,7 @@ pub fn make_ticket_id(input: &VrfInput, pre_output: &VrfPreOutput) -> TicketId {
|
||||
u128::from_le_bytes(bytes)
|
||||
}
|
||||
|
||||
/// Make revealed key seed from a given VRF input and pre-ouput.
|
||||
/// Make revealed key seed from a given VRF input and pre-output.
|
||||
///
|
||||
/// Input should have been obtained via [`revealed_key_input`].
|
||||
/// Pre-output should have been obtained from the input directly using the vrf
|
||||
|
||||
@@ -85,7 +85,7 @@ impl Error {
|
||||
|
||||
/// Complementary error information.
|
||||
///
|
||||
/// Strucutre contains complementary information about parsing address URI string.
|
||||
/// Structure contains complementary information about parsing address URI string.
|
||||
/// String contains a copy of an original URI string, 0-based integer indicates position of invalid
|
||||
/// character.
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
|
||||
@@ -249,7 +249,7 @@ pub mod vrf {
|
||||
///
|
||||
/// The `transcript` summarizes a set of messages which are defining a particular
|
||||
/// protocol by automating the Fiat-Shamir transform for challenge generation.
|
||||
/// A good explaination of the topic can be found in Merlin [docs](https://merlin.cool/)
|
||||
/// A good explanation of the topic can be found in Merlin [docs](https://merlin.cool/)
|
||||
///
|
||||
/// The `inputs` is a sequence of [`VrfInput`]s which, during the signing procedure, are
|
||||
/// first transformed to [`VrfPreOutput`]s. Both inputs and pre-outputs are then appended to
|
||||
|
||||
@@ -73,7 +73,7 @@ pub mod ecdsa_bls377 {
|
||||
|
||||
#[cfg(feature = "full_crypto")]
|
||||
impl Pair {
|
||||
/// Hashes the `message` with the specified [`Hasher`] before signing sith the ECDSA secret
|
||||
/// Hashes the `message` with the specified [`Hasher`] before signing with the ECDSA secret
|
||||
/// component.
|
||||
///
|
||||
/// The hasher does not affect the BLS12-377 component. This generates BLS12-377 Signature
|
||||
|
||||
@@ -23,7 +23,7 @@ use sp_runtime::traits::Block as BlockT;
|
||||
/// It is possible for the caller to provide custom arguments to the callee by setting the
|
||||
/// `ExtraArgs` generic parameter.
|
||||
///
|
||||
/// The crate already provides some convience implementations of this trait for
|
||||
/// The crate already provides some convince implementations of this trait for
|
||||
/// `Box<dyn CreateInherentDataProviders>` and closures. So, it should not be required to implement
|
||||
/// this trait manually.
|
||||
#[async_trait::async_trait]
|
||||
|
||||
@@ -85,7 +85,7 @@ disable_allocator = []
|
||||
# This gives the caller direct programmatic access to the error message.
|
||||
#
|
||||
# When disabled the error message will only be printed out in the
|
||||
# logs, with the caller receving a generic "wasm `unreachable` instruction executed"
|
||||
# logs, with the caller receiving a generic "wasm `unreachable` instruction executed"
|
||||
# error message.
|
||||
#
|
||||
# This has no effect if both `disable_panic_handler` and `disable_oom`
|
||||
|
||||
@@ -1081,7 +1081,7 @@ pub trait Crypto {
|
||||
/// Register a `ecdsa` signature for batch verification.
|
||||
///
|
||||
/// Batch verification must be enabled by calling [`start_batch_verify`].
|
||||
/// If batch verification is not enabled, the signature will be verified immediatley.
|
||||
/// If batch verification is not enabled, the signature will be verified immediately.
|
||||
/// To get the result of the batch verification, [`finish_batch_verify`]
|
||||
/// needs to be called.
|
||||
///
|
||||
@@ -1696,9 +1696,9 @@ mod tracing_setup {
|
||||
|
||||
/// The PassingTracingSubscriber implements `tracing_core::Subscriber`
|
||||
/// and pushes the information across the runtime interface to the host
|
||||
struct PassingTracingSubsciber;
|
||||
struct PassingTracingSubscriber;
|
||||
|
||||
impl tracing_core::Subscriber for PassingTracingSubsciber {
|
||||
impl tracing_core::Subscriber for PassingTracingSubscriber {
|
||||
fn enabled(&self, metadata: &Metadata<'_>) -> bool {
|
||||
wasm_tracing::enabled(Crossing(metadata.into()))
|
||||
}
|
||||
@@ -1731,7 +1731,7 @@ mod tracing_setup {
|
||||
/// set the global bridging subscriber once.
|
||||
pub fn init_tracing() {
|
||||
if TRACING_SET.load(Ordering::Relaxed) == false {
|
||||
set_global_default(Dispatch::new(PassingTracingSubsciber {}))
|
||||
set_global_default(Dispatch::new(PassingTracingSubscriber {}))
|
||||
.expect("We only ever call this once");
|
||||
TRACING_SET.store(true, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ edition.workspace = true
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository.workspace = true
|
||||
description = "Handling of blobs, usually Wasm code, which may be compresed"
|
||||
description = "Handling of blobs, usually Wasm code, which may be compressed"
|
||||
documentation = "https://docs.rs/sp-maybe-compressed-blob"
|
||||
readme = "README.md"
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ pub struct ExtrinsicMetadataIR<T: Form = MetaForm> {
|
||||
pub ty: T::Type,
|
||||
/// Extrinsic version.
|
||||
pub version: u8,
|
||||
/// The type of the address that signes the extrinsic
|
||||
/// The type of the address that signs the extrinsic
|
||||
pub address_ty: T::Type,
|
||||
/// The type of the outermost Call enum.
|
||||
pub call_ty: T::Type,
|
||||
|
||||
@@ -261,7 +261,7 @@ fn prepare_pjr_input<AccountId: IdentifierT>(
|
||||
}
|
||||
}
|
||||
|
||||
// Convert Suppports into a SupportMap
|
||||
// Convert Supports into a SupportMap
|
||||
//
|
||||
// As a flat list, we're limited to linear search. That gives the production of `candidates`,
|
||||
// below, a complexity of `O(s*c)`, where `s == supports.len()` and `c == all_candidates.len()`.
|
||||
|
||||
@@ -393,7 +393,7 @@ fn reduce_all<A: IdentifierT>(assignments: &mut Vec<StakedAssignment<A>>) -> u32
|
||||
// voter_root_path.last().unwrap()); TODO: @kian
|
||||
// the common path must be non-void..
|
||||
debug_assert!(common_count > 0);
|
||||
// and smaller than btoh
|
||||
// and smaller than both
|
||||
debug_assert!(common_count <= voter_root_path.len());
|
||||
debug_assert!(common_count <= target_root_path.len());
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ pub use sp_std;
|
||||
/// /// `key` holds the pointer and the length to the `data` slice.
|
||||
/// pub fn call(data: &[u8]) -> Vec<u8> {
|
||||
/// extern "C" { pub fn ext_call_version_2(key: u64); }
|
||||
/// // Should call into extenal `ext_call_version_2(<[u8] as IntoFFIValue>::into_ffi_value(key))`
|
||||
/// // Should call into external `ext_call_version_2(<[u8] as IntoFFIValue>::into_ffi_value(key))`
|
||||
/// // But this is too much to replicate in a doc test so here we just return a dummy vector.
|
||||
/// // Note that we jump into the latest version not marked as `register_only` (i.e. version 2).
|
||||
/// Vec::new()
|
||||
|
||||
@@ -45,19 +45,19 @@ pub fn import_sp_io() {
|
||||
|
||||
#[runtime_interface]
|
||||
pub trait TestApi {
|
||||
fn test_versionning(&self, _data: u32) -> bool {
|
||||
fn test_versioning(&self, _data: u32) -> bool {
|
||||
// should not be called
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
wasm_export_functions! {
|
||||
fn test_versionning_works() {
|
||||
fn test_versioning_works() {
|
||||
// old api allows only 42 and 50
|
||||
assert!(test_api::test_versionning(42));
|
||||
assert!(test_api::test_versionning(50));
|
||||
assert!(test_api::test_versioning(42));
|
||||
assert!(test_api::test_versioning(50));
|
||||
|
||||
assert!(!test_api::test_versionning(142));
|
||||
assert!(!test_api::test_versionning(0));
|
||||
assert!(!test_api::test_versioning(142));
|
||||
assert!(!test_api::test_versioning(0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,21 +126,21 @@ pub trait TestApi {
|
||||
val
|
||||
}
|
||||
|
||||
fn test_versionning(&self, data: u32) -> bool {
|
||||
fn test_versioning(&self, data: u32) -> bool {
|
||||
data == 42 || data == 50
|
||||
}
|
||||
|
||||
#[version(2)]
|
||||
fn test_versionning(&self, data: u32) -> bool {
|
||||
fn test_versioning(&self, data: u32) -> bool {
|
||||
data == 42
|
||||
}
|
||||
|
||||
fn test_versionning_register_only(&self, data: u32) -> bool {
|
||||
fn test_versioning_register_only(&self, data: u32) -> bool {
|
||||
data == 80
|
||||
}
|
||||
|
||||
#[version(2, register_only)]
|
||||
fn test_versionning_register_only(&self, data: u32) -> bool {
|
||||
fn test_versioning_register_only(&self, data: u32) -> bool {
|
||||
data == 42
|
||||
}
|
||||
|
||||
@@ -282,21 +282,21 @@ wasm_export_functions! {
|
||||
assert_eq!(0, len);
|
||||
}
|
||||
|
||||
fn test_versionning_works() {
|
||||
fn test_versioning_works() {
|
||||
// we fix new api to accept only 42 as a proper input
|
||||
// as opposed to sp-runtime-interface-test-wasm-deprecated::test_api::verify_input
|
||||
// which accepted 42 and 50.
|
||||
assert!(test_api::test_versionning(42));
|
||||
assert!(test_api::test_versioning(42));
|
||||
|
||||
assert!(!test_api::test_versionning(50));
|
||||
assert!(!test_api::test_versionning(102));
|
||||
assert!(!test_api::test_versioning(50));
|
||||
assert!(!test_api::test_versioning(102));
|
||||
}
|
||||
|
||||
fn test_versionning_register_only_works() {
|
||||
fn test_versioning_register_only_works() {
|
||||
// Ensure that we will import the version of the runtime interface function that
|
||||
// isn't tagged with `register_only`.
|
||||
assert!(!test_api::test_versionning_register_only(42));
|
||||
assert!(test_api::test_versionning_register_only(80));
|
||||
assert!(!test_api::test_versioning_register_only(42));
|
||||
assert!(test_api::test_versioning_register_only(80));
|
||||
}
|
||||
|
||||
fn test_return_input_as_tuple() {
|
||||
|
||||
@@ -163,18 +163,18 @@ fn test_array_return_value_memory_is_freed() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_versionining_with_new_host_works() {
|
||||
fn test_versioning_with_new_host_works() {
|
||||
// We call to the new wasm binary with new host function.
|
||||
call_wasm_method::<HostFunctions>(wasm_binary_unwrap(), "test_versionning_works");
|
||||
call_wasm_method::<HostFunctions>(wasm_binary_unwrap(), "test_versioning_works");
|
||||
|
||||
// we call to the old wasm binary with a new host functions
|
||||
// old versions of host functions should be called and test should be ok!
|
||||
call_wasm_method::<HostFunctions>(wasm_binary_deprecated_unwrap(), "test_versionning_works");
|
||||
call_wasm_method::<HostFunctions>(wasm_binary_deprecated_unwrap(), "test_versioning_works");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_versionining_register_only() {
|
||||
call_wasm_method::<HostFunctions>(wasm_binary_unwrap(), "test_versionning_register_only_works");
|
||||
fn test_versioning_register_only() {
|
||||
call_wasm_method::<HostFunctions>(wasm_binary_unwrap(), "test_versioning_register_only_works");
|
||||
}
|
||||
|
||||
fn run_test_in_another_process(
|
||||
|
||||
@@ -40,7 +40,7 @@ use sp_std::{fmt, prelude::*};
|
||||
/// the decoding fails.
|
||||
const EXTRINSIC_FORMAT_VERSION: u8 = 4;
|
||||
|
||||
/// The `SingaturePayload` of `UncheckedExtrinsic`.
|
||||
/// The `SignaturePayload` of `UncheckedExtrinsic`.
|
||||
type UncheckedSignaturePayload<Address, Signature, Extra> = (Address, Signature, Extra);
|
||||
|
||||
/// An extrinsic right from the external world. This is unchecked and so can contain a signature.
|
||||
|
||||
@@ -556,7 +556,7 @@ mod tests {
|
||||
let res = lock.try_lock();
|
||||
assert_eq!(res.is_ok(), false);
|
||||
|
||||
// sleep again untill sleep_until > deadline
|
||||
// sleep again until sleep_until > deadline
|
||||
offchain::sleep_until(offchain::timestamp().add(Duration::from_millis(200)));
|
||||
|
||||
// the lock has expired, failed to extend it
|
||||
|
||||
@@ -284,9 +284,9 @@ where
|
||||
}
|
||||
|
||||
/// The signature payload of a `TestXt`.
|
||||
type TxSingaturePayload<Extra> = (u64, Extra);
|
||||
type TxSignaturePayload<Extra> = (u64, Extra);
|
||||
|
||||
impl<Extra: TypeInfo> SignaturePayload for TxSingaturePayload<Extra> {
|
||||
impl<Extra: TypeInfo> SignaturePayload for TxSignaturePayload<Extra> {
|
||||
type SignatureAddress = u64;
|
||||
type Signature = ();
|
||||
type SignatureExtra = Extra;
|
||||
@@ -299,7 +299,7 @@ impl<Extra: TypeInfo> SignaturePayload for TxSingaturePayload<Extra> {
|
||||
#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)]
|
||||
pub struct TestXt<Call, Extra> {
|
||||
/// Signature of the extrinsic.
|
||||
pub signature: Option<TxSingaturePayload<Extra>>,
|
||||
pub signature: Option<TxSignaturePayload<Extra>>,
|
||||
/// Call of the extrinsic.
|
||||
pub call: Call,
|
||||
}
|
||||
@@ -348,7 +348,7 @@ impl<Call: Codec + Sync + Send + TypeInfo, Extra: TypeInfo> traits::Extrinsic
|
||||
for TestXt<Call, Extra>
|
||||
{
|
||||
type Call = Call;
|
||||
type SignaturePayload = TxSingaturePayload<Extra>;
|
||||
type SignaturePayload = TxSignaturePayload<Extra>;
|
||||
|
||||
fn is_signed(&self) -> Option<bool> {
|
||||
Some(self.signature.is_some())
|
||||
|
||||
@@ -330,7 +330,7 @@ impl<T, A: Into<T>> Morph<A> for MorphInto<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Implementation of `TryMorph` which attmepts to convert between types using `TryInto`.
|
||||
/// Implementation of `TryMorph` which attempts to convert between types using `TryInto`.
|
||||
pub struct TryMorphInto<T>(sp_std::marker::PhantomData<T>);
|
||||
impl<T, A: TryInto<T>> TryMorph<A> for TryMorphInto<T> {
|
||||
type Outcome = T;
|
||||
@@ -1449,7 +1449,7 @@ pub trait Dispatchable {
|
||||
/// to represent the dispatch class and weight.
|
||||
type Info;
|
||||
/// Additional information that is returned by `dispatch`. Can be used to supply the caller
|
||||
/// with information about a `Dispatchable` that is ownly known post dispatch.
|
||||
/// with information about a `Dispatchable` that is only known post dispatch.
|
||||
type PostInfo: Eq + PartialEq + Clone + Copy + Encode + Decode + Printable;
|
||||
/// Actually dispatch this call and return the result of it.
|
||||
fn dispatch(self, origin: Self::RuntimeOrigin)
|
||||
|
||||
@@ -117,7 +117,7 @@ pub trait Offence<Offender> {
|
||||
/// Errors that may happen on offence reports.
|
||||
#[derive(PartialEq, sp_runtime::RuntimeDebug)]
|
||||
pub enum OffenceError {
|
||||
/// The report has already been sumbmitted.
|
||||
/// The report has already been submitted.
|
||||
DuplicateReport,
|
||||
|
||||
/// Other error has happened.
|
||||
|
||||
@@ -44,7 +44,7 @@ const EXT_NOT_ALLOWED_TO_FAIL: &str = "Externalities not allowed to fail within
|
||||
const BENCHMARKING_FN: &str = "\
|
||||
This is a special fn only for benchmarking where a database commit happens from the runtime.
|
||||
For that reason client started transactions before calling into runtime are not allowed.
|
||||
Without client transactions the loop condition garantuees the success of the tx close.";
|
||||
Without client transactions the loop condition guarantees the success of the tx close.";
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
fn guard() -> sp_panic_handler::AbortGuard {
|
||||
@@ -722,7 +722,7 @@ impl Encode for EncodeOpaqueValue {
|
||||
}
|
||||
}
|
||||
|
||||
/// Auxialiary structure for appending a value to a storage item.
|
||||
/// Auxiliary structure for appending a value to a storage item.
|
||||
pub(crate) struct StorageAppend<'a>(&'a mut Vec<u8>);
|
||||
|
||||
impl<'a> StorageAppend<'a> {
|
||||
|
||||
@@ -1451,7 +1451,7 @@ mod tests {
|
||||
enum Item {
|
||||
InitializationItem,
|
||||
DiscardedItem,
|
||||
CommitedItem,
|
||||
CommittedItem,
|
||||
}
|
||||
|
||||
let key = b"events".to_vec();
|
||||
@@ -1488,21 +1488,21 @@ mod tests {
|
||||
|
||||
assert_eq!(ext.storage(key.as_slice()), Some(vec![Item::InitializationItem].encode()));
|
||||
|
||||
ext.storage_append(key.clone(), Item::CommitedItem.encode());
|
||||
ext.storage_append(key.clone(), Item::CommittedItem.encode());
|
||||
|
||||
assert_eq!(
|
||||
ext.storage(key.as_slice()),
|
||||
Some(vec![Item::InitializationItem, Item::CommitedItem].encode()),
|
||||
Some(vec![Item::InitializationItem, Item::CommittedItem].encode()),
|
||||
);
|
||||
}
|
||||
overlay.start_transaction();
|
||||
|
||||
// Then only initlaization item and second (committed) item should persist.
|
||||
// Then only initialization item and second (committed) item should persist.
|
||||
{
|
||||
let ext = Ext::new(&mut overlay, backend, None);
|
||||
assert_eq!(
|
||||
ext.storage(key.as_slice()),
|
||||
Some(vec![Item::InitializationItem, Item::CommitedItem].encode()),
|
||||
Some(vec![Item::InitializationItem, Item::CommittedItem].encode()),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1866,7 +1866,7 @@ mod tests {
|
||||
// a inner hashable node
|
||||
(&b"k"[..], Some(&long_vec[..])),
|
||||
// need to ensure this is not an inline node
|
||||
// otherwhise we do not know what is accessed when
|
||||
// otherwise we do not know what is accessed when
|
||||
// storing proof.
|
||||
(&b"key1"[..], Some(&vec![5u8; 32][..])),
|
||||
(&b"key2"[..], Some(&b"val3"[..])),
|
||||
|
||||
@@ -47,7 +47,7 @@ pub struct NoOpenTransaction;
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
pub struct AlreadyInRuntime;
|
||||
|
||||
/// Error when calling `exit_runtime` when not being in runtime exection mdde.
|
||||
/// Error when calling `exit_runtime` when not being in runtime execution mode.
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
pub struct NotInRuntime;
|
||||
@@ -269,7 +269,7 @@ impl<K: Ord + Hash + Clone, V> OverlayedMap<K, V> {
|
||||
///
|
||||
/// Panics:
|
||||
/// Panics if there are open transactions: `transaction_depth() > 0`
|
||||
pub fn drain_commited(self) -> impl Iterator<Item = (K, V)> {
|
||||
pub fn drain_committed(self) -> impl Iterator<Item = (K, V)> {
|
||||
assert!(self.transaction_depth() == 0, "Drain is not allowed with open transactions.");
|
||||
self.changes.into_iter().map(|(k, mut v)| (k, v.pop_transaction().value))
|
||||
}
|
||||
@@ -281,7 +281,7 @@ impl<K: Ord + Hash + Clone, V> OverlayedMap<K, V> {
|
||||
self.dirty_keys.len()
|
||||
}
|
||||
|
||||
/// Call this before transfering control to the runtime.
|
||||
/// Call this before transferring control to the runtime.
|
||||
///
|
||||
/// This protects all existing transactions from being removed by the runtime.
|
||||
/// Calling this while already inside the runtime will return an error.
|
||||
@@ -471,7 +471,7 @@ mod test {
|
||||
}
|
||||
|
||||
fn assert_drained_changes(is: OverlayedChangeSet, expected: Changes) {
|
||||
let is = is.drain_commited().collect::<Vec<_>>();
|
||||
let is = is.drain_committed().collect::<Vec<_>>();
|
||||
let expected = expected
|
||||
.iter()
|
||||
.map(|(k, v)| (k.to_vec(), v.0.map(From::from)))
|
||||
@@ -480,7 +480,7 @@ mod test {
|
||||
}
|
||||
|
||||
fn assert_drained(is: OverlayedChangeSet, expected: Drained) {
|
||||
let is = is.drain_commited().collect::<Vec<_>>();
|
||||
let is = is.drain_committed().collect::<Vec<_>>();
|
||||
let expected = expected
|
||||
.iter()
|
||||
.map(|(k, v)| (k.to_vec(), v.map(From::from)))
|
||||
@@ -526,7 +526,7 @@ mod test {
|
||||
changeset.set(b"key0".to_vec(), Some(b"val0-rolled".to_vec()), Some(1000));
|
||||
changeset.set(b"key5".to_vec(), Some(b"val5-rolled".to_vec()), None);
|
||||
|
||||
// changes contain all changes not only the commmited ones.
|
||||
// changes contain all changes not only the committed ones.
|
||||
let all_changes: Changes = vec![
|
||||
(b"key0", (Some(b"val0-rolled"), vec![1, 10, 1000])),
|
||||
(b"key1", (Some(b"val1"), vec![1])),
|
||||
@@ -807,7 +807,7 @@ mod test {
|
||||
fn drain_with_open_transaction_panics() {
|
||||
let mut changeset = OverlayedChangeSet::default();
|
||||
changeset.start_transaction();
|
||||
let _ = changeset.drain_commited();
|
||||
let _ = changeset.drain_committed();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -480,7 +480,7 @@ impl<H: Hasher> OverlayedChanges<H> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Call this before transfering control to the runtime.
|
||||
/// Call this before transferring control to the runtime.
|
||||
///
|
||||
/// This protects all existing transactions from being removed by the runtime.
|
||||
/// Calling this while already inside the runtime will return an error.
|
||||
@@ -575,10 +575,10 @@ impl<H: Hasher> OverlayedChanges<H> {
|
||||
};
|
||||
|
||||
use core::mem::take;
|
||||
let main_storage_changes = take(&mut self.top).drain_commited();
|
||||
let main_storage_changes = take(&mut self.top).drain_committed();
|
||||
let child_storage_changes = take(&mut self.children)
|
||||
.into_iter()
|
||||
.map(|(key, (val, info))| (key, (val.drain_commited(), info)));
|
||||
.map(|(key, (val, info))| (key, (val.drain_committed(), info)));
|
||||
|
||||
let offchain_storage_changes = self.offchain_drain_committed().collect();
|
||||
|
||||
@@ -809,7 +809,7 @@ pub struct OverlayedExtensions<'a> {
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<'a> OverlayedExtensions<'a> {
|
||||
/// Create a new instance of overalyed extensions from the given extensions.
|
||||
/// Create a new instance of overlaid extensions from the given extensions.
|
||||
pub fn new(extensions: &'a mut Extensions) -> Self {
|
||||
Self {
|
||||
extensions: extensions
|
||||
|
||||
@@ -417,7 +417,7 @@ mod tests {
|
||||
original_ext.backend.clone().into_storage(),
|
||||
);
|
||||
|
||||
// Ensure all have the correct ref counrt
|
||||
// Ensure all have the correct ref count
|
||||
assert!(original_ext.backend.backend_storage().keys().values().all(|r| *r == 2));
|
||||
|
||||
// Drain the raw storage and root.
|
||||
|
||||
@@ -34,8 +34,8 @@ use parking_lot::RwLock;
|
||||
use sp_core::storage::{ChildInfo, ChildType, StateVersion};
|
||||
use sp_trie::{
|
||||
child_delta_trie_root, delta_trie_root, empty_child_trie_root,
|
||||
read_child_trie_first_descedant_value, read_child_trie_hash, read_child_trie_value,
|
||||
read_trie_first_descedant_value, read_trie_value,
|
||||
read_child_trie_first_descendant_value, read_child_trie_hash, read_child_trie_value,
|
||||
read_trie_first_descendant_value, read_trie_value,
|
||||
trie_types::{TrieDBBuilder, TrieError},
|
||||
DBValue, KeySpacedDB, MerkleValue, NodeCodec, PrefixedMemoryDB, Trie, TrieCache,
|
||||
TrieDBRawIterator, TrieRecorder, TrieRecorderProvider,
|
||||
@@ -554,7 +554,7 @@ where
|
||||
let map_e = |e| format!("Trie lookup error: {}", e);
|
||||
|
||||
self.with_recorder_and_cache(None, |recorder, cache| {
|
||||
read_trie_first_descedant_value::<Layout<H>, _>(self, &self.root, key, recorder, cache)
|
||||
read_trie_first_descendant_value::<Layout<H>, _>(self, &self.root, key, recorder, cache)
|
||||
.map_err(map_e)
|
||||
})
|
||||
}
|
||||
@@ -570,7 +570,7 @@ where
|
||||
let map_e = |e| format!("Trie lookup error: {}", e);
|
||||
|
||||
self.with_recorder_and_cache(Some(child_root), |recorder, cache| {
|
||||
read_child_trie_first_descedant_value::<Layout<H>, _>(
|
||||
read_child_trie_first_descendant_value::<Layout<H>, _>(
|
||||
child_info.keyspace(),
|
||||
self,
|
||||
&child_root,
|
||||
|
||||
@@ -452,7 +452,7 @@ impl TryFrom<u8> for StateVersion {
|
||||
impl StateVersion {
|
||||
/// If defined, values in state of size bigger or equal
|
||||
/// to this threshold will use a separate trie node.
|
||||
/// Otherwhise, value will be inlined in branch or leaf
|
||||
/// Otherwise, value will be inlined in branch or leaf
|
||||
/// node.
|
||||
pub fn state_value_threshold(&self) -> Option<u32> {
|
||||
match self {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
//! Substrate tracing primitives and macros.
|
||||
//!
|
||||
//! To trace functions or invidual code in Substrate, this crate provides [`within_span`]
|
||||
//! To trace functions or individual code in Substrate, this crate provides [`within_span`]
|
||||
//! and [`enter_span`]. See the individual docs for how to use these macros.
|
||||
//!
|
||||
//! Note that to allow traces from wasm execution environment there are
|
||||
@@ -70,7 +70,7 @@ pub use crate::types::{WASM_NAME_KEY, WASM_TARGET_KEY, WASM_TRACE_IDENTIFIER};
|
||||
/// directly as they yield nothing without the feature present. Instead you should use
|
||||
/// `enter_span!` and `within_span!` – which would strip away even any parameter conversion
|
||||
/// you do within the span-definition (and thus optimise your performance). For your
|
||||
/// convineience you directly specify the `Level` and name of the span or use the full
|
||||
/// convenience you directly specify the `Level` and name of the span or use the full
|
||||
/// feature set of `span!`/`span_*!` on it:
|
||||
///
|
||||
/// # Example
|
||||
@@ -98,7 +98,7 @@ pub use crate::types::{WASM_NAME_KEY, WASM_TARGET_KEY, WASM_TRACE_IDENTIFIER};
|
||||
/// This project only provides the macros and facilities to manage tracing
|
||||
/// it doesn't implement the tracing subscriber or backend directly – that is
|
||||
/// up to the developer integrating it into a specific environment. In native
|
||||
/// this can and must be done through the regular `tracing`-facitilies, please
|
||||
/// this can and must be done through the regular `tracing`-facilities, please
|
||||
/// see their documentation for details.
|
||||
///
|
||||
/// On the wasm-side we've adopted a similar approach of having a global
|
||||
@@ -139,7 +139,7 @@ pub fn init_for_tests() {
|
||||
/// Runs given code within a tracing span, measuring it's execution time.
|
||||
///
|
||||
/// If tracing is not enabled, the code is still executed. Pass in level and name or
|
||||
/// use any valid `sp_tracing::Span`followe by `;` and the code to execute,
|
||||
/// use any valid `sp_tracing::Span`followed by `;` and the code to execute,
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
use alloc::{vec, vec::Vec};
|
||||
use codec::{Decode, Encode};
|
||||
/// Types for wasm based tracing. Loosly inspired by `tracing-core` but
|
||||
/// Types for wasm based tracing. Loosely inspired by `tracing-core` but
|
||||
/// optimised for the specific use case.
|
||||
use core::{fmt::Debug, format_args};
|
||||
|
||||
@@ -54,7 +54,7 @@ impl core::default::Default for WasmLevel {
|
||||
}
|
||||
}
|
||||
|
||||
/// A paramter value provided to the span/event
|
||||
/// A parameter value provided to the span/event
|
||||
#[derive(Encode, Decode, Clone)]
|
||||
pub enum WasmValue {
|
||||
U8(u8),
|
||||
@@ -180,9 +180,9 @@ impl From<i64> for WasmValue {
|
||||
}
|
||||
}
|
||||
|
||||
/// The name of a field provided as the argument name when contstructing an
|
||||
/// The name of a field provided as the argument name when constructing an
|
||||
/// `event!` or `span!`.
|
||||
/// Generally generated automaticaly via `stringify` from an `'static &str`.
|
||||
/// Generally generated automatically via `stringify` from an `'static &str`.
|
||||
/// Likely print-able.
|
||||
#[derive(Encode, Decode, Clone)]
|
||||
pub struct WasmFieldName(Vec<u8>);
|
||||
@@ -320,7 +320,7 @@ impl tracing_core::field::Visit for WasmValuesSet {
|
||||
self.0.push((field.name().into(), Some(WasmValue::from(value))))
|
||||
}
|
||||
}
|
||||
/// Metadata provides generic information about the specifc location of the
|
||||
/// Metadata provides generic information about the specific location of the
|
||||
/// `span!` or `event!` call on the wasm-side.
|
||||
#[derive(Encode, Decode, Clone)]
|
||||
pub struct WasmMetadata {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Storage proof primitives. Constains types and basic code to extract storage
|
||||
//! Storage proof primitives. Contains types and basic code to extract storage
|
||||
//! proofs for indexed transactions.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
+1
-1
@@ -323,7 +323,7 @@ type ValueAccessSet =
|
||||
///
|
||||
/// This cache should be used per state instance created by the backend. One state instance is
|
||||
/// referring to the state of one block. It will cache all the accesses that are done to the state
|
||||
/// which could not be fullfilled by the [`SharedTrieCache`]. These locally cached items are merged
|
||||
/// which could not be fulfilled by the [`SharedTrieCache`]. These locally cached items are merged
|
||||
/// back to the shared trie cache when this instance is dropped.
|
||||
///
|
||||
/// When using [`Self::as_trie_db_cache`] or [`Self::as_trie_db_mut_cache`], it will lock Mutexes.
|
||||
|
||||
@@ -326,7 +326,7 @@ pub fn read_trie_value<L: TrieLayout, DB: hash_db::HashDBRef<L::Hash, trie_db::D
|
||||
|
||||
/// Read the [`trie_db::MerkleValue`] of the node that is the closest descendant for
|
||||
/// the provided key.
|
||||
pub fn read_trie_first_descedant_value<L: TrieLayout, DB>(
|
||||
pub fn read_trie_first_descendant_value<L: TrieLayout, DB>(
|
||||
db: &DB,
|
||||
root: &TrieHash<L>,
|
||||
key: &[u8],
|
||||
@@ -447,7 +447,7 @@ where
|
||||
|
||||
/// Read the [`trie_db::MerkleValue`] of the node that is the closest descendant for
|
||||
/// the provided child key.
|
||||
pub fn read_child_trie_first_descedant_value<L: TrieConfiguration, DB>(
|
||||
pub fn read_child_trie_first_descendant_value<L: TrieConfiguration, DB>(
|
||||
keyspace: &[u8],
|
||||
db: &DB,
|
||||
root: &TrieHash<L>,
|
||||
|
||||
@@ -52,7 +52,7 @@ fn decl_runtime_version_impl_inner(item: ItemConst) -> Result<TokenStream> {
|
||||
/// enable `std` feature even for `no_std` wasm runtime builds.
|
||||
///
|
||||
/// One difference from the original definition is the `apis` field. Since we don't actually parse
|
||||
/// `apis` from this macro it will always be emitteed as empty. An empty vector can be encoded as
|
||||
/// `apis` from this macro it will always be emitted as empty. An empty vector can be encoded as
|
||||
/// a zero-byte, thus `u8` is sufficient here.
|
||||
#[derive(Encode)]
|
||||
struct RuntimeVersion {
|
||||
|
||||
@@ -327,7 +327,7 @@ impl RuntimeVersion {
|
||||
///
|
||||
/// For runtime with core api version less than 4,
|
||||
/// V0 trie version will be applied to state.
|
||||
/// Otherwhise, V1 trie version will be use.
|
||||
/// Otherwise, V1 trie version will be use.
|
||||
pub fn state_version(&self) -> StateVersion {
|
||||
// If version > than 1, keep using latest version.
|
||||
self.state_version.try_into().unwrap_or(StateVersion::V1)
|
||||
|
||||
Reference in New Issue
Block a user