mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 13:31: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:
@@ -180,7 +180,7 @@ impl<A, C, PR> ProposerFactory<A, C, PR> {
|
||||
/// The soft deadline indicates where we should stop attempting to add transactions
|
||||
/// to the block, which exhaust resources. After soft deadline is reached,
|
||||
/// we switch to a fixed-amount mode, in which after we see `MAX_SKIPPED_TRANSACTIONS`
|
||||
/// transactions which exhaust resrouces, we will conclude that the block is full.
|
||||
/// transactions which exhaust resources, we will conclude that the block is full.
|
||||
///
|
||||
/// Setting the value too low will significantly limit the amount of transactions
|
||||
/// we try in case they exhaust resources. Setting the value too high can
|
||||
|
||||
@@ -52,7 +52,7 @@ enum GenesisSource<G> {
|
||||
File(PathBuf),
|
||||
Binary(Cow<'static, [u8]>),
|
||||
/// factory function + code
|
||||
//Factory and G type parameter shall be removed togheter with `ChainSpec::from_genesis`
|
||||
//Factory and G type parameter shall be removed together with `ChainSpec::from_genesis`
|
||||
Factory(Arc<dyn Fn() -> G + Send + Sync>, Vec<u8>),
|
||||
Storage(Storage),
|
||||
/// build action + code
|
||||
@@ -264,7 +264,7 @@ struct RuntimeInnerWrapper<G> {
|
||||
enum Genesis<G> {
|
||||
/// (Deprecated) Contains the JSON representation of G (the native type representing the
|
||||
/// runtime's `RuntimeGenesisConfig` struct) (will be removed with `ChainSpec::from_genesis`)
|
||||
/// without the runtime code. It is required to deserialize the legacy chainspecs genereted
|
||||
/// without the runtime code. It is required to deserialize the legacy chainspecs generated
|
||||
/// with `ChainsSpec::from_genesis` method.
|
||||
Runtime(G),
|
||||
/// (Deprecated) Contains the JSON representation of G (the native type representing the
|
||||
@@ -276,13 +276,13 @@ enum Genesis<G> {
|
||||
Raw(RawGenesis),
|
||||
/// State root hash of the genesis storage.
|
||||
StateRootHash(StorageData),
|
||||
/// Represents the runtime genesis config in JSON format toghether with runtime code.
|
||||
/// Represents the runtime genesis config in JSON format together with runtime code.
|
||||
RuntimeGenesis(RuntimeGenesisInner),
|
||||
}
|
||||
|
||||
/// A configuration of a client. Does not include runtime storage initialization.
|
||||
/// Note: `genesis` field is ignored due to way how the chain specification is serialized into
|
||||
/// JSON file. Refer to [`ChainSpecJsonContainer`], which flattens [`ClientSpec`] and denies uknown
|
||||
/// JSON file. Refer to [`ChainSpecJsonContainer`], which flattens [`ClientSpec`] and denies unknown
|
||||
/// fields.
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
@@ -508,7 +508,7 @@ impl<G, E, EHF> ChainSpec<G, E, EHF> {
|
||||
self.client_spec.fork_id.as_deref()
|
||||
}
|
||||
|
||||
/// Additional loosly-typed properties of the chain.
|
||||
/// Additional loosely-typed properties of the chain.
|
||||
///
|
||||
/// Returns an empty JSON object if 'properties' not defined in config
|
||||
pub fn properties(&self) -> Properties {
|
||||
|
||||
@@ -284,7 +284,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// A subset of the `Extension` trait that only allows for quering extensions.
|
||||
/// A subset of the `Extension` trait that only allows for querying extensions.
|
||||
pub trait GetExtension {
|
||||
/// Get an extension of specific type.
|
||||
fn get_any(&self, t: TypeId) -> &dyn Any;
|
||||
|
||||
@@ -33,7 +33,7 @@ use std::borrow::Cow;
|
||||
/// A utility that facilitates calling the GenesisBuilder API from the runtime wasm code blob.
|
||||
///
|
||||
/// `EHF` type allows to specify the extended host function required for building runtime's genesis
|
||||
/// config. The type will be compbined with default `sp_io::SubstrateHostFunctions`.
|
||||
/// config. The type will be combined with default `sp_io::SubstrateHostFunctions`.
|
||||
pub struct GenesisConfigBuilderRuntimeCaller<'a, EHF = ()>
|
||||
where
|
||||
EHF: HostFunctions,
|
||||
|
||||
@@ -393,7 +393,7 @@ pub trait ChainSpec: BuildStorage + Send + Sync {
|
||||
fn protocol_id(&self) -> Option<&str>;
|
||||
/// Optional network fork identifier. `None` by default.
|
||||
fn fork_id(&self) -> Option<&str>;
|
||||
/// Additional loosly-typed properties of the chain.
|
||||
/// Additional loosely-typed properties of the chain.
|
||||
///
|
||||
/// Returns an empty JSON object if 'properties' not defined in config
|
||||
fn properties(&self) -> Properties;
|
||||
|
||||
@@ -51,7 +51,7 @@ pub struct VanityCmd {
|
||||
impl VanityCmd {
|
||||
/// Run the command
|
||||
pub fn run(&self) -> error::Result<()> {
|
||||
let formated_seed = with_crypto_scheme!(
|
||||
let formatted_seed = with_crypto_scheme!(
|
||||
self.crypto_scheme.scheme,
|
||||
generate_key(
|
||||
&self.pattern,
|
||||
@@ -62,7 +62,7 @@ impl VanityCmd {
|
||||
with_crypto_scheme!(
|
||||
self.crypto_scheme.scheme,
|
||||
print_from_uri(
|
||||
&formated_seed,
|
||||
&formatted_seed,
|
||||
None,
|
||||
self.network_scheme.network,
|
||||
self.output_scheme.output_type,
|
||||
|
||||
@@ -310,7 +310,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sync_ingores_case() {
|
||||
fn sync_ignores_case() {
|
||||
let params = Cli::try_parse_from(["", "--sync", "wArP"]).expect("Parses network params");
|
||||
|
||||
assert_eq!(SyncMode::Warp, params.network_params.sync);
|
||||
|
||||
@@ -82,7 +82,7 @@ pub enum CompatibilityMode<N> {
|
||||
None,
|
||||
/// Call `initialize_block` before doing any runtime calls.
|
||||
///
|
||||
/// Previously the node would execute `initialize_block` before fetchting the authorities
|
||||
/// Previously the node would execute `initialize_block` before fetching the authorities
|
||||
/// from the runtime. This behaviour changed in: <https://github.com/paritytech/substrate/pull/9132>
|
||||
///
|
||||
/// By calling `initialize_block` before fetching the authorities, on a block that
|
||||
|
||||
@@ -59,7 +59,7 @@ pub(super) fn calculate_primary_threshold(
|
||||
assert!(theta > 0.0, "authority with weight 0.");
|
||||
|
||||
// NOTE: in the equation `p = 1 - (1 - c)^theta` the value of `p` is always
|
||||
// capped by `c`. For all pratical purposes `c` should always be set to a
|
||||
// capped by `c`. For all practical purposes `c` should always be set to a
|
||||
// value < 0.5, as such in the computations below we should never be near
|
||||
// edge cases like `0.999999`.
|
||||
|
||||
|
||||
@@ -1418,7 +1418,7 @@ where
|
||||
|
||||
// Skip babe logic if block already in chain or importing blocks during initial sync,
|
||||
// otherwise the check for epoch changes will error because trying to re-import an
|
||||
// epoch change or because of missing epoch data in the tree, respectivelly.
|
||||
// epoch change or because of missing epoch data in the tree, respectively.
|
||||
if info.block_gap.map_or(false, |(s, e)| s <= number && number <= e) ||
|
||||
block_status == BlockStatus::InChain
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ impl EpochT for EpochV0 {
|
||||
|
||||
// Implement From<EpochV0> for Epoch
|
||||
impl EpochV0 {
|
||||
/// Migrate the sturct to current epoch version.
|
||||
/// Migrate the struct to current epoch version.
|
||||
pub fn migrate(self, config: &BabeConfiguration) -> Epoch {
|
||||
sp_consensus_babe::Epoch {
|
||||
epoch_index: self.epoch_index,
|
||||
|
||||
@@ -297,7 +297,7 @@ periodically on the global topic. Let's now dive into description of the message
|
||||
- Justification is considered worthwhile to gossip when:
|
||||
- It is for a recent (implementation specific) round or the latest mandatory round.
|
||||
- All signatures are valid and there is at least `2/3rd + 1` of them.
|
||||
- Signatorees are part of the current validator set.
|
||||
- Signatories are part of the current validator set.
|
||||
- Mandatory justifications should be announced periodically.
|
||||
|
||||
## Misbehavior
|
||||
|
||||
@@ -99,7 +99,7 @@ mod cost {
|
||||
// On-demand request was refused by peer.
|
||||
pub(super) const REFUSAL_RESPONSE: Rep = Rep::new(-100, "BEEFY: Proof request refused");
|
||||
// On-demand request for a proof that can't be found in the backend.
|
||||
pub(super) const UNKOWN_PROOF_REQUEST: Rep = Rep::new(-150, "BEEFY: Unknown proof request");
|
||||
pub(super) const UNKNOWN_PROOF_REQUEST: Rep = Rep::new(-150, "BEEFY: Unknown proof request");
|
||||
}
|
||||
|
||||
// benefit scalars for reporting peers.
|
||||
|
||||
+1
-1
@@ -170,7 +170,7 @@ where
|
||||
.flatten()
|
||||
.and_then(|hash| self.client.justifications(hash).ok().flatten())
|
||||
.and_then(|justifs| justifs.get(BEEFY_ENGINE_ID).cloned())
|
||||
.ok_or_else(|| reputation_changes.push(cost::UNKOWN_PROOF_REQUEST));
|
||||
.ok_or_else(|| reputation_changes.push(cost::UNKNOWN_PROOF_REQUEST));
|
||||
request
|
||||
.pending_response
|
||||
.send(netconfig::OutgoingResponse {
|
||||
|
||||
@@ -404,7 +404,7 @@ pub mod tests {
|
||||
|
||||
let store: BeefyKeystore<AuthorityId> = Some(store).into();
|
||||
|
||||
let msg = b"are you involved or commited?";
|
||||
let msg = b"are you involved or committed?";
|
||||
|
||||
let sig1 = store.sign(&alice, msg).unwrap();
|
||||
let sig2 = Keyring::<AuthorityId>::Alice.sign(msg);
|
||||
@@ -440,7 +440,7 @@ pub mod tests {
|
||||
|
||||
let alice = Keyring::Alice.public();
|
||||
|
||||
let msg = b"are you involved or commited?";
|
||||
let msg = b"are you involved or committed?";
|
||||
let sig = store.sign(&alice, msg).err().unwrap();
|
||||
let err = Error::Signature(expected_error_message.to_string());
|
||||
|
||||
@@ -463,7 +463,7 @@ pub mod tests {
|
||||
let store: BeefyKeystore<ecdsa_crypto::Public> = None.into();
|
||||
|
||||
let alice = Keyring::Alice.public();
|
||||
let msg = b"are you involved or commited";
|
||||
let msg = b"are you involved or committed";
|
||||
|
||||
let sig = store.sign(&alice, msg).err().unwrap();
|
||||
let err = Error::Keystore("no Keystore".to_string());
|
||||
@@ -487,7 +487,7 @@ pub mod tests {
|
||||
let alice = Keyring::Alice.public();
|
||||
|
||||
// `msg` and `sig` match
|
||||
let msg = b"are you involved or commited?";
|
||||
let msg = b"are you involved or committed?";
|
||||
let sig = store.sign(&alice, msg).unwrap();
|
||||
assert!(BeefyKeystore::verify(&alice, &sig, msg));
|
||||
|
||||
|
||||
@@ -76,13 +76,13 @@ pub(crate) enum RoundAction {
|
||||
pub(crate) struct VoterOracle<B: Block> {
|
||||
/// Queue of known sessions. Keeps track of voting rounds (block numbers) within each session.
|
||||
///
|
||||
/// There are three voter states coresponding to three queue states:
|
||||
/// There are three voter states corresponding to three queue states:
|
||||
/// 1. voter uninitialized: queue empty,
|
||||
/// 2. up-to-date - all mandatory blocks leading up to current GRANDPA finalized: queue has ONE
|
||||
/// element, the 'current session' where `mandatory_done == true`,
|
||||
/// 3. lagging behind GRANDPA: queue has [1, N] elements, where all `mandatory_done == false`.
|
||||
/// In this state, everytime a session gets its mandatory block BEEFY finalized, it's popped
|
||||
/// off the queue, eventually getting to state `2. up-to-date`.
|
||||
/// In this state, every time a session gets its mandatory block BEEFY finalized, it's
|
||||
/// popped off the queue, eventually getting to state `2. up-to-date`.
|
||||
sessions: VecDeque<Rounds<B>>,
|
||||
/// Min delta in block numbers between two blocks, BEEFY should vote on.
|
||||
min_block_delta: u32,
|
||||
|
||||
@@ -6,7 +6,7 @@ edition.workspace = true
|
||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
homepage = "https://substrate.io"
|
||||
repository.workspace = true
|
||||
description = "Collection of common consensus specific imlementations for Substrate (client)"
|
||||
description = "Collection of common consensus specific implementations for Substrate (client)"
|
||||
readme = "README.md"
|
||||
|
||||
[lints]
|
||||
|
||||
@@ -133,7 +133,7 @@ pub trait ImportQueue<B: BlockT>: Send {
|
||||
/// Start asynchronous runner for import queue.
|
||||
///
|
||||
/// Takes an object implementing [`Link`] which allows the import queue to
|
||||
/// influece the synchronization process.
|
||||
/// influence the synchronization process.
|
||||
async fn run(self, link: Box<dyn Link<B>>);
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ impl<B: BlockT> ImportQueue<B> for BasicQueue<B> {
|
||||
/// Start asynchronous runner for import queue.
|
||||
///
|
||||
/// Takes an object implementing [`Link`] which allows the import queue to
|
||||
/// influece the synchronization process.
|
||||
/// influence the synchronization process.
|
||||
async fn run(mut self, mut link: Box<dyn Link<B>>) {
|
||||
loop {
|
||||
if let Err(_) = self.result_port.next_action(&mut *link).await {
|
||||
@@ -198,7 +198,7 @@ impl<B: BlockT> ImportQueue<B> for BasicQueue<B> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Messages destinated to the background worker.
|
||||
/// Messages designated to the background worker.
|
||||
mod worker_messages {
|
||||
use super::*;
|
||||
|
||||
|
||||
@@ -326,7 +326,7 @@ impl<E: Epoch> AsRef<E> for IncrementedEpoch<E> {
|
||||
///
|
||||
/// The first epoch, epoch_0, is special cased by saying that it starts at
|
||||
/// slot number of the first block in the chain. When bootstrapping a chain,
|
||||
/// there can be multiple competing block #1s, so we have to ensure that the overlayed
|
||||
/// there can be multiple competing block #1s, so we have to ensure that the overlaid
|
||||
/// DAG doesn't get confused.
|
||||
///
|
||||
/// The first block of every epoch should be producing a descriptor for the next
|
||||
@@ -655,7 +655,7 @@ where
|
||||
|
||||
/// Revert to a specified block given its `hash` and `number`.
|
||||
/// This removes all the epoch changes information that were announced by
|
||||
/// all the given block descendents.
|
||||
/// all the given block descendants.
|
||||
pub fn revert<D: IsDescendentOfBuilder<Hash>>(
|
||||
&mut self,
|
||||
descendent_of_builder: D,
|
||||
|
||||
@@ -222,13 +222,13 @@ pub(crate) struct NetworkBridge<B: BlockT, N: Network<B>, S: Syncing<B>> {
|
||||
neighbor_sender: periodic::NeighborPacketSender<B>,
|
||||
|
||||
/// `NeighborPacketWorker` processing packets sent through the `NeighborPacketSender`.
|
||||
// `NetworkBridge` is required to be cloneable, thus one needs to be able to clone its
|
||||
// `NetworkBridge` is required to be clonable, thus one needs to be able to clone its
|
||||
// children, thus one has to wrap `neighbor_packet_worker` with an `Arc` `Mutex`.
|
||||
neighbor_packet_worker: Arc<Mutex<periodic::NeighborPacketWorker<B>>>,
|
||||
|
||||
/// Receiver side of the peer report stream populated by the gossip validator, forwarded to the
|
||||
/// gossip engine.
|
||||
// `NetworkBridge` is required to be cloneable, thus one needs to be able to clone its
|
||||
// `NetworkBridge` is required to be clonable, thus one needs to be able to clone its
|
||||
// children, thus one has to wrap gossip_validator_report_stream with an `Arc` `Mutex`. Given
|
||||
// that it is just an `UnboundedReceiver`, one could also switch to a
|
||||
// multi-producer-*multi*-consumer channel implementation.
|
||||
@@ -766,7 +766,7 @@ impl<Block: BlockT> Sink<Message<Block::Header>> for OutgoingMessages<Block> {
|
||||
)
|
||||
.ok_or_else(|| {
|
||||
Error::Signing(format!(
|
||||
"Failed to sign GRANDPA vote for round {} targetting {:?}",
|
||||
"Failed to sign GRANDPA vote for round {} targeting {:?}",
|
||||
self.round, target_hash
|
||||
))
|
||||
})?;
|
||||
|
||||
@@ -106,7 +106,7 @@ impl<B: BlockT> Stream for NeighborPacketWorker<B> {
|
||||
|
||||
// Make sure the underlying task is scheduled for wake-up.
|
||||
//
|
||||
// Note: In case poll_unpin is called after the resetted delay fires again, this
|
||||
// Note: In case poll_unpin is called after the reset delay fires again, this
|
||||
// will drop one tick. Deemed as very unlikely and also not critical.
|
||||
while this.delay.poll_unpin(cx).is_ready() {}
|
||||
|
||||
|
||||
@@ -1805,7 +1805,7 @@ async fn grandpa_environment_checks_if_best_block_is_descendent_of_finality_targ
|
||||
);
|
||||
|
||||
// best block is higher than finality target and it's on the same fork,
|
||||
// the best block passed to the voting rule should not be overriden
|
||||
// the best block passed to the voting rule should not be overridden
|
||||
select_chain.set_best_chain(client.expect_header(hashof10_a).unwrap());
|
||||
select_chain.set_finality_target(client.expect_header(hashof5_a).unwrap().hash());
|
||||
voting_rule.set_expected_best_block(hashof10_a);
|
||||
@@ -1940,7 +1940,7 @@ async fn justification_with_equivocation() {
|
||||
precommits.push(precommit);
|
||||
}
|
||||
|
||||
// we create an equivocation for the 67th validator targetting blocks #1 and #2.
|
||||
// we create an equivocation for the 67th validator targeting blocks #1 and #2.
|
||||
// this should be accounted as "voting for all blocks" and therefore block #3 will
|
||||
// have 67/100 votes, reaching finality threshold.
|
||||
{
|
||||
|
||||
@@ -1002,7 +1002,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn block_global_message_wait_completed_return_none_on_block_number_missmatch() {
|
||||
fn block_global_message_wait_completed_return_none_on_block_number_mismatch() {
|
||||
let msg_inner = test_catch_up();
|
||||
|
||||
let waiting_block_1 =
|
||||
|
||||
@@ -196,7 +196,7 @@ where
|
||||
target_header = backend
|
||||
.header(target_hash)
|
||||
.ok()?
|
||||
.expect("Header known to exist due to the existence of one of its descendents; qed");
|
||||
.expect("Header known to exist due to the existence of one of its descendants; qed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ impl<Block: BlockT, Backend: ClientBackend<Block>> NetworkProvider<Block, Backen
|
||||
where
|
||||
NumberFor<Block>: BlockNumberOps,
|
||||
{
|
||||
/// Create a new istance for a given backend and authority set.
|
||||
/// Create a new instance for a given backend and authority set.
|
||||
pub fn new(
|
||||
backend: Arc<Backend>,
|
||||
authority_set: SharedAuthoritySet<Block::Hash, NumberFor<Block>>,
|
||||
|
||||
@@ -82,7 +82,7 @@ pub struct BabeVerifier<B: BlockT, C> {
|
||||
}
|
||||
|
||||
impl<B: BlockT, C> BabeVerifier<B, C> {
|
||||
/// create a nrew verifier
|
||||
/// create a new verifier
|
||||
pub fn new(epoch_changes: SharedEpochChanges<B, Epoch>, client: Arc<C>) -> BabeVerifier<B, C> {
|
||||
BabeVerifier { epoch_changes, client }
|
||||
}
|
||||
|
||||
@@ -555,7 +555,7 @@ impl SlotProportion {
|
||||
Self(inner.clamp(0.0, 1.0))
|
||||
}
|
||||
|
||||
/// Returns the inner that is guaranted to be in the range `[0,1]`.
|
||||
/// Returns the inner that is guaranteed to be in the range `[0,1]`.
|
||||
pub fn get(&self) -> f32 {
|
||||
self.0
|
||||
}
|
||||
@@ -648,7 +648,7 @@ pub fn proposing_remaining_duration<Block: BlockT>(
|
||||
}
|
||||
|
||||
/// Calculate a slot duration lenience based on the number of missed slots from current
|
||||
/// to parent. If the number of skipped slots is greated than 0 this method will apply
|
||||
/// to parent. If the number of skipped slots is greater than 0 this method will apply
|
||||
/// an exponential backoff of at most `2^7 * slot_duration`, if no slots were skipped
|
||||
/// this method will return `None.`
|
||||
pub fn slot_lenience_exponential<Block: BlockT>(
|
||||
@@ -680,7 +680,7 @@ pub fn slot_lenience_exponential<Block: BlockT>(
|
||||
}
|
||||
|
||||
/// Calculate a slot duration lenience based on the number of missed slots from current
|
||||
/// to parent. If the number of skipped slots is greated than 0 this method will apply
|
||||
/// to parent. If the number of skipped slots is greater than 0 this method will apply
|
||||
/// a linear backoff of at most `20 * slot_duration`, if no slots were skipped
|
||||
/// this method will return `None.`
|
||||
pub fn slot_lenience_linear<Block: BlockT>(
|
||||
|
||||
@@ -79,7 +79,7 @@ impl fmt::Display for UpgradeError {
|
||||
write!(f, "Database version comes from future version of the client: {}", version)
|
||||
},
|
||||
UpgradeError::DecodingJustificationBlock => {
|
||||
write!(f, "Decodoning justification block failed")
|
||||
write!(f, "Decoding justification block failed")
|
||||
},
|
||||
UpgradeError::Io(err) => write!(f, "Io error: {}", err),
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ fn open_kvdb_rocksdb<Block: BlockT>(
|
||||
db_config.memory_budget = memory_budget;
|
||||
|
||||
let db = kvdb_rocksdb::Database::open(&db_config, path)?;
|
||||
// write database version only after the database is succesfully opened
|
||||
// write database version only after the database is successfully opened
|
||||
crate::upgrade::update_version(path)?;
|
||||
Ok(sp_database::as_database(db))
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ pub enum WasmError {
|
||||
#[error("{0}")]
|
||||
Instantiation(String),
|
||||
|
||||
/// Other error happenend.
|
||||
/// Other error happened.
|
||||
#[error("Other error happened while constructing the runtime: {0}")]
|
||||
Other(String),
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ pub struct Semantics {
|
||||
pub struct Config {
|
||||
/// The WebAssembly standard requires all imports of an instantiated module to be resolved,
|
||||
/// otherwise, the instantiation fails. If this option is set to `true`, then this behavior is
|
||||
/// overriden and imports that are requested by the module and not provided by the host
|
||||
/// overridden and imports that are requested by the module and not provided by the host
|
||||
/// functions will be resolved using stubs. These stubs will trap upon a call.
|
||||
pub allow_missing_func_imports: bool,
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ fn test_nan_canonicalization(instantiation_strategy: InstantiationStrategy) {
|
||||
|
||||
/// A NaN with canonical payload bits.
|
||||
const CANONICAL_NAN_BITS: u32 = 0x7fc00000;
|
||||
/// A NaN value with an abitrary payload.
|
||||
/// A NaN value with an arbitrary payload.
|
||||
const ARBITRARY_NAN_BITS: u32 = 0x7f812345;
|
||||
|
||||
// This test works like this: we essentially do
|
||||
@@ -272,7 +272,7 @@ fn test_nan_canonicalization(instantiation_strategy: InstantiationStrategy) {
|
||||
// However, with the `canonicalize_nans` option turned on above, we expect that the output will
|
||||
// be a canonical NaN.
|
||||
//
|
||||
// We exterpolate the results of this tests so that we assume that all intermediate computations
|
||||
// We extrapolate the results of this tests so that we assume that all intermediate computations
|
||||
// that involve floats are sanitized and cannot produce a non-deterministic NaN.
|
||||
|
||||
let params = (u32::to_le_bytes(ARBITRARY_NAN_BITS), u32::to_le_bytes(1)).encode();
|
||||
|
||||
@@ -301,7 +301,7 @@ mod tests {
|
||||
use substrate_test_runtime_client::{self, prelude::*, TestClientBuilder};
|
||||
|
||||
#[tokio::test]
|
||||
async fn undecodeable_message() {
|
||||
async fn undecodable_message() {
|
||||
let client = substrate_test_runtime_client::new();
|
||||
let (bitswap, config) = BitswapRequestHandler::new(Arc::new(client));
|
||||
|
||||
|
||||
@@ -2668,7 +2668,7 @@ mod tests {
|
||||
//
|
||||
// there is not straight-forward way of adding backoff to `PeerState::Disabled`
|
||||
// so manually adjust the value in order to progress on to the next stage.
|
||||
// This modification together with `ConnectionClosed` will conver the peer
|
||||
// This modification together with `ConnectionClosed` will convert the peer
|
||||
// state into `PeerState::Backoff`.
|
||||
if let Some(PeerState::Disabled { ref mut backoff_until, .. }) =
|
||||
notif.peers.get_mut(&(peer, set_id))
|
||||
|
||||
@@ -211,7 +211,7 @@ enum State {
|
||||
/// consequently trying to open the various notifications substreams.
|
||||
///
|
||||
/// A [`NotifsHandlerOut::OpenResultOk`] or a [`NotifsHandlerOut::OpenResultErr`] event must
|
||||
/// be emitted when transitionning to respectively [`State::Open`] or [`State::Closed`].
|
||||
/// be emitted when transitioning to respectively [`State::Open`] or [`State::Closed`].
|
||||
Opening {
|
||||
/// Substream opened by the remote. If `Some`, has been accepted.
|
||||
in_substream: Option<NotificationsInSubstream<NegotiatedSubstream>>,
|
||||
|
||||
@@ -54,7 +54,7 @@ const COMMAND_QUEUE_SIZE: usize = 64;
|
||||
/// Type representing subscribers of a notification protocol.
|
||||
type Subscribers = Arc<Mutex<Vec<TracingUnboundedSender<InnerNotificationEvent>>>>;
|
||||
|
||||
/// Type represending a distributable message sink.
|
||||
/// Type representing a distributable message sink.
|
||||
/// Detached message sink must carry the protocol name for registering metrics.
|
||||
///
|
||||
/// See documentation for [`PeerContext`] for more details.
|
||||
@@ -175,11 +175,11 @@ pub enum NotificationCommand {
|
||||
/// and an additional, distributable `NotificationsSink` which the protocol may acquire
|
||||
/// if it wishes to send notifications through `NotificationsSink` directly.
|
||||
///
|
||||
/// The distributable `NoticationsSink` is wrapped in an `Arc<Mutex<>>` to allow
|
||||
/// The distributable `NotificationsSink` is wrapped in an `Arc<Mutex<>>` to allow
|
||||
/// `NotificationsService` to swap the underlying sink in case it's replaced.
|
||||
#[derive(Debug, Clone)]
|
||||
struct PeerContext {
|
||||
/// Sink for sending notificaitons.
|
||||
/// Sink for sending notifications.
|
||||
sink: NotificationsSink,
|
||||
|
||||
/// Distributable notification sink.
|
||||
|
||||
@@ -437,7 +437,7 @@ async fn peer_disconnects_then_async_notification_is_sent() {
|
||||
notif.send_async_notification(&peer_id, vec![1, 3, 3, 7]).await
|
||||
{
|
||||
} else {
|
||||
panic!("invalid state after calling `send_async_notificatio()` on closed connection")
|
||||
panic!("invalid state after calling `send_async_notification()` on closed connection")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Yielded by the [`NotificationsIn`] after a successfuly upgrade.
|
||||
/// Yielded by the [`NotificationsIn`] after a successfully upgrade.
|
||||
pub struct NotificationsInOpen<TSubstream> {
|
||||
/// Handshake sent by the remote.
|
||||
pub handshake: Vec<u8>,
|
||||
@@ -415,7 +415,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Yielded by the [`NotificationsOut`] after a successfuly upgrade.
|
||||
/// Yielded by the [`NotificationsOut`] after a successfully upgrade.
|
||||
pub struct NotificationsOutOpen<TSubstream> {
|
||||
/// Handshake returned by the remote.
|
||||
pub handshake: Vec<u8>,
|
||||
|
||||
@@ -448,7 +448,7 @@ impl ProtocolController {
|
||||
self.peer_store.report_disconnect(peer_id);
|
||||
}
|
||||
|
||||
/// Ask `Peerset` if the peer has a reputation value not sufficent for connection with it.
|
||||
/// Ask `Peerset` if the peer has a reputation value not sufficient for connection with it.
|
||||
fn is_banned(&self, peer_id: &PeerId) -> bool {
|
||||
self.peer_store.is_banned(peer_id)
|
||||
}
|
||||
@@ -2020,7 +2020,7 @@ mod tests {
|
||||
ProtocolController::new(SetId::from(0), config, tx, Box::new(peer_store));
|
||||
assert!(matches!(controller.reserved_nodes.get(&reserved1), Some(PeerState::NotConnected)));
|
||||
|
||||
// Initiate connectios
|
||||
// Initiate connections
|
||||
controller.alloc_slots();
|
||||
assert!(matches!(controller.reserved_nodes.get(&reserved1), Some(PeerState::NotConnected)));
|
||||
assert_eq!(rx.try_recv().unwrap_err(), TryRecvError::Empty);
|
||||
|
||||
@@ -110,7 +110,7 @@ const INACTIVITY_EVICT_THRESHOLD: Duration = Duration::from_secs(30);
|
||||
/// Parachain collator may incorrectly get evicted because it's waiting to receive a number of
|
||||
/// relaychain blocks before it can start creating parachain blocks. During this wait,
|
||||
/// `SyncingEngine` still counts it as active and as the peer is not sending blocks, it may get
|
||||
/// evicted if a block is not received within the first 30 secons since the peer connected.
|
||||
/// evicted if a block is not received within the first 30 seconds since the peer connected.
|
||||
///
|
||||
/// To prevent this from happening, define a threshold for how long `SyncingEngine` should wait
|
||||
/// before it starts evicting peers.
|
||||
@@ -424,7 +424,7 @@ where
|
||||
.expect("Genesis block exists; qed"),
|
||||
);
|
||||
|
||||
// Split warp sync params into warp sync config and a channel to retreive target block
|
||||
// Split warp sync params into warp sync config and a channel to retrieve target block
|
||||
// header.
|
||||
let (warp_sync_config, warp_sync_target_block_header_rx) =
|
||||
warp_sync_params.map_or((None, None), |params| {
|
||||
@@ -1057,7 +1057,7 @@ where
|
||||
// still be under validation. If the peer has different genesis than the
|
||||
// local node the validation fails but the peer cannot be reported in
|
||||
// `validate_connection()` as that is also called by
|
||||
// `ValiateInboundSubstream` which means that the peer is still being
|
||||
// `ValidateInboundSubstream` which means that the peer is still being
|
||||
// validated and banning the peer when handling that event would
|
||||
// result in peer getting dropped twice.
|
||||
//
|
||||
|
||||
@@ -185,7 +185,7 @@ where
|
||||
+ Sync
|
||||
+ 'static,
|
||||
{
|
||||
/// Initialize a new syncing startegy.
|
||||
/// Initialize a new syncing strategy.
|
||||
pub fn new(
|
||||
config: SyncingConfig,
|
||||
client: Arc<Client>,
|
||||
@@ -418,7 +418,7 @@ where
|
||||
self.state.is_some() ||
|
||||
match self.chain_sync {
|
||||
Some(ref s) => s.status().state.is_major_syncing(),
|
||||
None => unreachable!("At least one syncing startegy is active; qed"),
|
||||
None => unreachable!("At least one syncing strategy is active; qed"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,7 +429,7 @@ where
|
||||
|
||||
/// Returns the current sync status.
|
||||
pub fn status(&self) -> SyncStatus<B> {
|
||||
// This function presumes that startegies are executed serially and must be refactored
|
||||
// This function presumes that strategies are executed serially and must be refactored
|
||||
// once we have parallel strategies.
|
||||
if let Some(ref warp) = self.warp {
|
||||
warp.status()
|
||||
@@ -438,7 +438,7 @@ where
|
||||
} else if let Some(ref chain_sync) = self.chain_sync {
|
||||
chain_sync.status()
|
||||
} else {
|
||||
unreachable!("At least one syncing startegy is always active; qed")
|
||||
unreachable!("At least one syncing strategy is always active; qed")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -518,7 +518,7 @@ where
|
||||
|
||||
/// Proceed with the next strategy if the active one finished.
|
||||
pub fn proceed_to_next(&mut self) -> Result<(), ClientError> {
|
||||
// The strategies are switched as `WarpSync` -> `StateStartegy` -> `ChainSync`.
|
||||
// The strategies are switched as `WarpSync` -> `StateStrategy` -> `ChainSync`.
|
||||
if let Some(ref mut warp) = self.warp {
|
||||
match warp.take_result() {
|
||||
Some(res) => {
|
||||
@@ -569,7 +569,7 @@ where
|
||||
},
|
||||
}
|
||||
} else if let Some(state) = &self.state {
|
||||
if state.is_succeded() {
|
||||
if state.is_succeeded() {
|
||||
info!(target: LOG_TARGET, "State sync is complete, continuing with block sync.");
|
||||
} else {
|
||||
error!(target: LOG_TARGET, "State sync failed. Falling back to full sync.");
|
||||
|
||||
@@ -117,7 +117,7 @@ mod rep {
|
||||
/// Reputation change for peers which send us a block with bad justifications.
|
||||
pub const BAD_JUSTIFICATION: Rep = Rep::new(-(1 << 16), "Bad justification");
|
||||
|
||||
/// Reputation change when a peer sent us invlid ancestry result.
|
||||
/// Reputation change when a peer sent us invalid ancestry result.
|
||||
pub const UNKNOWN_ANCESTOR: Rep = Rep::new(-(1 << 16), "DB Error");
|
||||
|
||||
/// Peer response data does not have requested bits.
|
||||
@@ -1334,7 +1334,7 @@ where
|
||||
PeerSyncState::DownloadingJustification(_) => {
|
||||
// Peers that were downloading justifications
|
||||
// should be kept in that state.
|
||||
// We make sure our commmon number is at least something we have.
|
||||
// We make sure our common number is at least something we have.
|
||||
trace!(
|
||||
target: LOG_TARGET,
|
||||
"Keeping peer {} after restart, updating common number from={} => to={} (our best).",
|
||||
|
||||
@@ -189,7 +189,7 @@ fn restart_doesnt_affect_peers_downloading_finality_data() {
|
||||
assert_eq!(sync.peers.get(&peer_id3).unwrap().common_number, 50);
|
||||
}
|
||||
|
||||
/// Send a block annoucnement for the given `header`.
|
||||
/// Send a block announcement for the given `header`.
|
||||
fn send_block_announce(header: Header, peer_id: PeerId, sync: &mut ChainSync<Block, TestClient>) {
|
||||
let announce = BlockAnnounce {
|
||||
header: header.clone(),
|
||||
@@ -278,7 +278,7 @@ fn unwrap_from_block_number(from: FromBlock<Hash, u64>) -> u64 {
|
||||
/// announcement from this node in its sync process. Meaning our common number didn't change. It
|
||||
/// is now expected that we start an ancestor search to find the common number.
|
||||
#[test]
|
||||
fn do_ancestor_search_when_common_block_to_best_qeued_gap_is_to_big() {
|
||||
fn do_ancestor_search_when_common_block_to_best_queued_gap_is_to_big() {
|
||||
sp_tracing::try_init_simple();
|
||||
|
||||
let blocks = {
|
||||
@@ -472,7 +472,7 @@ fn can_sync_huge_fork() {
|
||||
let actions = sync.take_actions().collect::<Vec<_>>();
|
||||
|
||||
request = if actions.is_empty() {
|
||||
// We found the ancenstor
|
||||
// We found the ancestor
|
||||
break
|
||||
} else {
|
||||
assert_eq!(actions.len(), 1);
|
||||
@@ -607,7 +607,7 @@ fn syncs_fork_without_duplicate_requests() {
|
||||
let actions = sync.take_actions().collect::<Vec<_>>();
|
||||
|
||||
request = if actions.is_empty() {
|
||||
// We found the ancenstor
|
||||
// We found the ancestor
|
||||
break
|
||||
} else {
|
||||
assert_eq!(actions.len(), 1);
|
||||
|
||||
@@ -79,7 +79,7 @@ pub struct StateStrategy<B: BlockT> {
|
||||
state_sync: Box<dyn StateSyncProvider<B>>,
|
||||
peers: HashMap<PeerId, Peer<B>>,
|
||||
actions: Vec<StateStrategyAction<B>>,
|
||||
succeded: bool,
|
||||
succeeded: bool,
|
||||
}
|
||||
|
||||
impl<B: BlockT> StateStrategy<B> {
|
||||
@@ -110,7 +110,7 @@ impl<B: BlockT> StateStrategy<B> {
|
||||
)),
|
||||
peers,
|
||||
actions: Vec::new(),
|
||||
succeded: false,
|
||||
succeeded: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ impl<B: BlockT> StateStrategy<B> {
|
||||
})
|
||||
.collect(),
|
||||
actions: Vec::new(),
|
||||
succeded: false,
|
||||
succeeded: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ impl<B: BlockT> StateStrategy<B> {
|
||||
"Failed to import target block with state: {e:?}."
|
||||
);
|
||||
});
|
||||
self.succeded |= results.into_iter().any(|result| result.is_ok());
|
||||
self.succeeded |= results.into_iter().any(|result| result.is_ok());
|
||||
self.actions.push(StateStrategyAction::Finished);
|
||||
}
|
||||
}
|
||||
@@ -342,10 +342,10 @@ impl<B: BlockT> StateStrategy<B> {
|
||||
std::mem::take(&mut self.actions).into_iter()
|
||||
}
|
||||
|
||||
/// Check if state sync has succeded.
|
||||
/// Check if state sync has succeeded.
|
||||
#[must_use]
|
||||
pub fn is_succeded(&self) -> bool {
|
||||
self.succeded
|
||||
pub fn is_succeeded(&self) -> bool {
|
||||
self.succeeded
|
||||
}
|
||||
}
|
||||
|
||||
@@ -669,7 +669,7 @@ mod test {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn succesfully_importing_target_block_finishes_strategy() {
|
||||
fn successfully_importing_target_block_finishes_strategy() {
|
||||
let target_hash = Hash::random();
|
||||
let mut state_sync_provider = MockStateSync::<Block>::new();
|
||||
state_sync_provider.expect_target_hash().return_const(target_hash);
|
||||
|
||||
@@ -968,7 +968,7 @@ mod test {
|
||||
|
||||
warp_sync.on_warp_proof_response(&request_peer_id, EncodedProof(Vec::new()));
|
||||
|
||||
// We only interested in alredy generated actions, not new requests.
|
||||
// We only interested in already generated actions, not new requests.
|
||||
let actions = std::mem::take(&mut warp_sync.actions);
|
||||
assert_eq!(actions.len(), 1);
|
||||
assert!(matches!(
|
||||
|
||||
@@ -57,7 +57,7 @@ pub fn generate_request_response_config<Hash: AsRef<[u8]>>(
|
||||
}
|
||||
}
|
||||
|
||||
/// Generate the grandpa warp sync protocol name from the genesi hash and fork id.
|
||||
/// Generate the grandpa warp sync protocol name from the genesis hash and fork id.
|
||||
fn generate_protocol_name<Hash: AsRef<[u8]>>(genesis_hash: Hash, fork_id: Option<&str>) -> String {
|
||||
let genesis_hash = genesis_hash.as_ref();
|
||||
if let Some(fork_id) = fork_id {
|
||||
|
||||
@@ -749,7 +749,7 @@ async fn sync_blocks_when_block_announce_validator_says_it_is_new_best() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Waits for some time until the validation is successfull.
|
||||
/// Waits for some time until the validation is successful.
|
||||
struct DeferredBlockAnnounceValidator;
|
||||
|
||||
impl BlockAnnounceValidator<Block> for DeferredBlockAnnounceValidator {
|
||||
|
||||
@@ -604,7 +604,7 @@ enum WorkerToApi {
|
||||
/// because we don't want the `HttpApi` to have to drive the reading.
|
||||
/// Instead, reading an item from the channel will notify the worker task, which will push
|
||||
/// the next item.
|
||||
/// Can also be used to send an error, in case an error happend on the HTTP socket. After
|
||||
/// Can also be used to send an error, in case an error happened on the HTTP socket. After
|
||||
/// an error is sent, the channel will close.
|
||||
body: mpsc::Receiver<Result<hyper::body::Bytes, hyper::Error>>,
|
||||
},
|
||||
|
||||
@@ -182,7 +182,7 @@ impl RpcMetrics {
|
||||
transport_label,
|
||||
req.method_name(),
|
||||
// the label "is_error", so `success` should be regarded as false
|
||||
// and vice-versa to be registrered correctly.
|
||||
// and vice-versa to be registered correctly.
|
||||
if rp.is_success() { "false" } else { "true" },
|
||||
if is_rate_limited { "true" } else { "false" },
|
||||
])
|
||||
|
||||
@@ -435,7 +435,7 @@ async fn archive_storage_closest_merkle_value() {
|
||||
|
||||
/// The core of this test.
|
||||
///
|
||||
/// Checks keys that are exact match, keys with descedant and keys that should not return
|
||||
/// Checks keys that are exact match, keys with descendant and keys that should not return
|
||||
/// values.
|
||||
///
|
||||
/// Returns (key, merkle value) pairs.
|
||||
@@ -459,7 +459,7 @@ async fn archive_storage_closest_merkle_value() {
|
||||
query_type: StorageQueryType::ClosestDescendantMerkleValue,
|
||||
pagination_start_key: None,
|
||||
},
|
||||
// Key with descedent.
|
||||
// Key with descendant.
|
||||
PaginatedStorageQuery {
|
||||
key: hex_string(b":A"),
|
||||
query_type: StorageQueryType::ClosestDescendantMerkleValue,
|
||||
|
||||
@@ -111,7 +111,7 @@ impl From<ApiError> for RuntimeEvent {
|
||||
#[derive(Debug, Clone, PartialEq, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Initialized<Hash> {
|
||||
/// The hash of the lastest finalized blocks.
|
||||
/// The hash of the latest finalized blocks.
|
||||
pub finalized_block_hashes: Vec<Hash>,
|
||||
/// The runtime version of the finalized block.
|
||||
///
|
||||
@@ -315,7 +315,7 @@ pub enum FollowEvent<Hash> {
|
||||
Stop,
|
||||
}
|
||||
|
||||
/// The method respose of `chainHead_body`, `chainHead_call` and `chainHead_storage`.
|
||||
/// The method response of `chainHead_body`, `chainHead_call` and `chainHead_storage`.
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[serde(tag = "result")]
|
||||
|
||||
@@ -2786,7 +2786,7 @@ async fn ensure_operation_limits_works() {
|
||||
FollowEvent::OperationStorageDone(done) if done.operation_id == operation_id
|
||||
);
|
||||
|
||||
// The storage is finished and capactiy must be released.
|
||||
// The storage is finished and capacity must be released.
|
||||
let alice_id = AccountKeyring::Alice.to_account_id();
|
||||
// Hex encoded scale encoded bytes representing the call parameters.
|
||||
let call_parameters = hex_string(&alice_id.encode());
|
||||
@@ -3113,7 +3113,7 @@ async fn storage_closest_merkle_value() {
|
||||
|
||||
/// The core of this test.
|
||||
///
|
||||
/// Checks keys that are exact match, keys with descedant and keys that should not return
|
||||
/// Checks keys that are exact match, keys with descendant and keys that should not return
|
||||
/// values.
|
||||
///
|
||||
/// Returns (key, merkle value) pairs.
|
||||
@@ -3139,7 +3139,7 @@ async fn storage_closest_merkle_value() {
|
||||
key: hex_string(b":AAAB"),
|
||||
query_type: StorageQueryType::ClosestDescendantMerkleValue
|
||||
},
|
||||
// Key with descedent.
|
||||
// Key with descendant.
|
||||
StorageQuery {
|
||||
key: hex_string(b":A"),
|
||||
query_type: StorageQueryType::ClosestDescendantMerkleValue
|
||||
|
||||
@@ -372,7 +372,7 @@ async fn tx_broadcast_resubmits_invalid_tx() {
|
||||
client_mock.trigger_import_stream(block_2_header).await;
|
||||
|
||||
// Ensure we propagate the temporary ban error to `submit_and_watch`.
|
||||
// This ensures we'll loop again with the next annmounced block and try to resubmit the
|
||||
// This ensures we'll loop again with the next announced block and try to resubmit the
|
||||
// transaction. The transaction remains temporarily banned until the pool is maintained.
|
||||
let event = get_next_event!(&mut pool_middleware);
|
||||
assert_matches!(event, MiddlewarePoolEvent::PoolError { transaction, err } if transaction == xt && err.contains("Transaction temporarily Banned"));
|
||||
@@ -429,7 +429,7 @@ async fn tx_broadcast_resubmits_invalid_tx() {
|
||||
}
|
||||
|
||||
/// This is similar to `tx_broadcast_resubmits_invalid_tx`.
|
||||
/// However, it forces the tx to be resubmited because of the pool
|
||||
/// However, it forces the tx to be resubmitted because of the pool
|
||||
/// limits. Which is a different code path than the invalid tx.
|
||||
#[tokio::test]
|
||||
async fn tx_broadcast_resubmits_dropped_tx() {
|
||||
@@ -509,7 +509,7 @@ async fn tx_broadcast_resubmits_dropped_tx() {
|
||||
pool.inner_pool.maintain(event).await;
|
||||
client_mock.trigger_import_stream(block_3_header.clone()).await;
|
||||
|
||||
// The first tx is in a finalzied block; the future tx must enter the pool.
|
||||
// The first tx is in a finalized block; the future tx must enter the pool.
|
||||
let events = get_next_tx_events!(&mut pool_middleware, 3);
|
||||
assert_eq!(
|
||||
events.get(¤t_xt).unwrap(),
|
||||
|
||||
@@ -44,7 +44,7 @@ pub struct TransactionBroadcast<Pool, Client> {
|
||||
pool: Arc<Pool>,
|
||||
/// Executor to spawn subscriptions.
|
||||
executor: SubscriptionTaskExecutor,
|
||||
/// The brodcast operation IDs.
|
||||
/// The broadcast operation IDs.
|
||||
broadcast_ids: Arc<RwLock<HashMap<String, BroadcastState>>>,
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the last element of the providided stream, or `None` if the stream is closed.
|
||||
/// Returns the last element of the provided stream, or `None` if the stream is closed.
|
||||
async fn last_stream_element<S>(stream: &mut S) -> Option<S::Item>
|
||||
where
|
||||
S: Stream + Unpin,
|
||||
|
||||
@@ -89,7 +89,7 @@ impl StatementApiServer for StatementStore {
|
||||
|
||||
fn submit(&self, encoded: Bytes) -> RpcResult<()> {
|
||||
let statement = Decode::decode(&mut &*encoded)
|
||||
.map_err(|e| Error::StatementStore(format!("Eror decoding statement: {:?}", e)))?;
|
||||
.map_err(|e| Error::StatementStore(format!("Error decoding statement: {:?}", e)))?;
|
||||
match self.store.submit(statement, StatementSource::Local) {
|
||||
SubmitResult::New(_) | SubmitResult::Known => Ok(()),
|
||||
// `KnownExpired` should not happen. Expired statements submitted with
|
||||
|
||||
@@ -73,7 +73,7 @@ where
|
||||
reader: CodecIoReader<R>,
|
||||
},
|
||||
Json {
|
||||
// Nubmer of blocks we have decoded thus far.
|
||||
// Number of blocks we have decoded thus far.
|
||||
read_block_count: u64,
|
||||
// Stream to the data, used for decoding new blocks.
|
||||
reader: StreamDeserializer<'static, JsonIoRead<R>, SignedBlock<B>>,
|
||||
|
||||
@@ -236,7 +236,7 @@ impl Configuration {
|
||||
ProtocolId::from(protocol_id_full)
|
||||
}
|
||||
|
||||
/// Returns true if the genesis state writting will be skipped while initializing the genesis
|
||||
/// Returns true if the genesis state writing will be skipped while initializing the genesis
|
||||
/// block.
|
||||
pub fn no_genesis(&self) -> bool {
|
||||
matches!(self.network.sync_mode, SyncMode::LightState { .. } | SyncMode::Warp { .. })
|
||||
|
||||
@@ -872,7 +872,7 @@ mod tests {
|
||||
fn check_stored_and_requested_mode_compatibility(
|
||||
mode_when_created: Option<PruningMode>,
|
||||
mode_when_reopened: Option<PruningMode>,
|
||||
expected_effective_mode_when_reopenned: Result<PruningMode, ()>,
|
||||
expected_effective_mode_when_reopened: Result<PruningMode, ()>,
|
||||
) {
|
||||
let mut db = make_db(&[]);
|
||||
let (state_db_init, state_db) =
|
||||
@@ -883,7 +883,7 @@ mod tests {
|
||||
|
||||
let state_db_reopen_result =
|
||||
StateDb::<H256, H256, TestDb>::open(db.clone(), mode_when_reopened, false, false);
|
||||
if let Ok(expected_mode) = expected_effective_mode_when_reopenned {
|
||||
if let Ok(expected_mode) = expected_effective_mode_when_reopened {
|
||||
let (state_db_init, state_db_reopened) = state_db_reopen_result.unwrap();
|
||||
db.commit(&state_db_init);
|
||||
assert_eq!(state_db_reopened.pruning_mode(), expected_mode,)
|
||||
|
||||
@@ -46,26 +46,26 @@ pub struct NonCanonicalOverlay<BlockHash: Hash, Key: Hash> {
|
||||
#[cfg_attr(test, derive(PartialEq, Debug))]
|
||||
struct OverlayLevel<BlockHash: Hash, Key: Hash> {
|
||||
blocks: Vec<BlockOverlay<BlockHash, Key>>,
|
||||
used_indicies: u64, // Bitmask of available journal indicies.
|
||||
used_indices: u64, // Bitmask of available journal indices.
|
||||
}
|
||||
|
||||
impl<BlockHash: Hash, Key: Hash> OverlayLevel<BlockHash, Key> {
|
||||
fn push(&mut self, overlay: BlockOverlay<BlockHash, Key>) {
|
||||
self.used_indicies |= 1 << overlay.journal_index;
|
||||
self.used_indices |= 1 << overlay.journal_index;
|
||||
self.blocks.push(overlay)
|
||||
}
|
||||
|
||||
fn available_index(&self) -> u64 {
|
||||
self.used_indicies.trailing_ones() as u64
|
||||
self.used_indices.trailing_ones() as u64
|
||||
}
|
||||
|
||||
fn remove(&mut self, index: usize) -> BlockOverlay<BlockHash, Key> {
|
||||
self.used_indicies &= !(1 << self.blocks[index].journal_index);
|
||||
self.used_indices &= !(1 << self.blocks[index].journal_index);
|
||||
self.blocks.remove(index)
|
||||
}
|
||||
|
||||
fn new() -> OverlayLevel<BlockHash, Key> {
|
||||
OverlayLevel { blocks: Vec::new(), used_indicies: 0 }
|
||||
OverlayLevel { blocks: Vec::new(), used_indices: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -413,7 +413,7 @@ impl Telemetry {
|
||||
.map_err(|_| Error::TelemetryWorkerDropped)
|
||||
}
|
||||
|
||||
/// Make a new cloneable handle to this [`Telemetry`]. This is used for reporting telemetries.
|
||||
/// Make a new clonable handle to this [`Telemetry`]. This is used for reporting telemetries.
|
||||
pub fn handle(&self) -> TelemetryHandle {
|
||||
TelemetryHandle {
|
||||
message_sender: Arc::new(Mutex::new(self.message_sender.clone())),
|
||||
|
||||
@@ -171,7 +171,7 @@ This parameter instructs the pool propagate/gossip a transaction to node peers.
|
||||
By default this should be `true`, however in some cases it might be undesirable
|
||||
to propagate transactions further. Examples might include heavy transactions
|
||||
produced by block authors in offchain workers (DoS) or risking being front
|
||||
runned by someone else after finding some non trivial solution or equivocation,
|
||||
ran by someone else after finding some non trivial solution or equivocation,
|
||||
etc.
|
||||
|
||||
### 'TransactionSource`
|
||||
|
||||
@@ -999,7 +999,7 @@ fn import_notification_to_pool_maintain_works() {
|
||||
.0,
|
||||
);
|
||||
|
||||
// Prepare the extrisic, push it to the pool and check that it was added.
|
||||
// Prepare the extrinsic, push it to the pool and check that it was added.
|
||||
let xt = uxt(Alice, 0);
|
||||
block_on(pool.submit_one(
|
||||
pool.api().block_id_to_hash(&BlockId::Number(0)).unwrap().unwrap(),
|
||||
|
||||
@@ -44,7 +44,7 @@ mod tests;
|
||||
/// and identify the mpsc channels.
|
||||
pub trait TracingKeyStr {
|
||||
/// Const `str` representing the "tracing key" used to tag and identify
|
||||
/// the mpsc channels owned by the object implemeting this trait.
|
||||
/// the mpsc channels owned by the object implementing this trait.
|
||||
const TRACING_KEY: &'static str;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user