mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 19:21:13 +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:
@@ -145,7 +145,7 @@ fn prepare_benchmark(client: &FullClient) -> (usize, Vec<OpaqueExtrinsic>) {
|
||||
let src = Sr25519Keyring::Alice.pair();
|
||||
let dst: MultiAddress<AccountId32, u32> = Sr25519Keyring::Bob.to_account_id().into();
|
||||
|
||||
// Add as many tranfer extrinsics as possible into a single block.
|
||||
// Add as many transfer extrinsics as possible into a single block.
|
||||
for nonce in 0.. {
|
||||
let extrinsic: OpaqueExtrinsic = create_extrinsic(
|
||||
client,
|
||||
@@ -179,7 +179,7 @@ fn block_production(c: &mut Criterion) {
|
||||
let node = new_node(tokio_handle.clone());
|
||||
let client = &*node.client;
|
||||
|
||||
// Buliding the very first block is around ~30x slower than any subsequent one,
|
||||
// Building the very first block is around ~30x slower than any subsequent one,
|
||||
// so let's make sure it's built and imported before we benchmark anything.
|
||||
let mut block_builder = BlockBuilderBuilder::new(client)
|
||||
.on_parent_block(client.chain_info().best_hash)
|
||||
|
||||
@@ -49,7 +49,7 @@ pub struct Cli {
|
||||
/// Possible subcommands of the main binary.
|
||||
#[derive(Debug, clap::Subcommand)]
|
||||
pub enum Subcommand {
|
||||
/// The custom inspect subcommmand for decoding blocks and extrinsics.
|
||||
/// The custom inspect subcommand for decoding blocks and extrinsics.
|
||||
#[command(
|
||||
name = "inspect",
|
||||
about = "Decode given block or extrinsic using current native runtime."
|
||||
|
||||
@@ -53,7 +53,7 @@ pub type HostFunctions = (
|
||||
frame_benchmarking::benchmarking::HostFunctions,
|
||||
);
|
||||
|
||||
/// A specialized `WasmExecutor` intended to use accross substrate node. It provides all required
|
||||
/// A specialized `WasmExecutor` intended to use across substrate node. It provides all required
|
||||
/// HostFunctions.
|
||||
pub type RuntimeExecutor = sc_executor::WasmExecutor<HostFunctions>;
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ fn transaction_fee_is_correct() {
|
||||
// if weight of the cheapest weight would be 10^7, this would be 10^9, which is:
|
||||
// - 1 MILLICENTS in substrate node.
|
||||
// - 1 milli-dot based on current polkadot runtime.
|
||||
// (this baed on assigning 0.1 CENT to the cheapest tx with `weight = 100`)
|
||||
// (this based on assigning 0.1 CENT to the cheapest tx with `weight = 100`)
|
||||
let mut t = new_test_ext(compact_code_unwrap());
|
||||
t.insert(<frame_system::Account<Runtime>>::hashed_key_for(alice()), new_account_info(100));
|
||||
t.insert(<frame_system::Account<Runtime>>::hashed_key_for(bob()), new_account_info(10));
|
||||
|
||||
@@ -84,7 +84,7 @@ impl BenchPair {
|
||||
|
||||
/// Drop system cache.
|
||||
///
|
||||
/// Will panic if cache drop is impossbile.
|
||||
/// Will panic if cache drop is impossible.
|
||||
pub fn drop_system_cache() {
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
@@ -173,7 +173,7 @@ impl Clone for BenchDb {
|
||||
|
||||
// We clear system cache after db clone but before any warmups.
|
||||
// This populates system cache with some data unrelated to actual
|
||||
// data we will be quering further under benchmark (like what
|
||||
// data we will be querying further under benchmark (like what
|
||||
// would have happened in real system that queries random entries
|
||||
// from database).
|
||||
drop_system_cache();
|
||||
@@ -443,7 +443,7 @@ impl BenchDb {
|
||||
BlockContentIterator::new(content, &self.keyring, client)
|
||||
}
|
||||
|
||||
/// Get cliet for this database operations.
|
||||
/// Get client for this database operations.
|
||||
pub fn client(&mut self) -> Client {
|
||||
let (client, _backend, _task_executor) =
|
||||
Self::bench_client(self.database_type, self.directory_guard.path(), &self.keyring);
|
||||
|
||||
@@ -185,7 +185,7 @@ pub struct ConvertToRawCmd {
|
||||
/// Verifies the provided input chain spec.
|
||||
///
|
||||
/// Silently checks if given input chain spec can be converted to raw. It allows to check if all
|
||||
/// RuntimeGenesisConfig fiels are properly initialized and if the json does not contain invalid
|
||||
/// RuntimeGenesisConfig fields are properly initialized and if the json does not contain invalid
|
||||
/// fields.
|
||||
#[derive(Parser, Debug, Clone)]
|
||||
pub struct VerifyCmd {
|
||||
|
||||
@@ -77,7 +77,7 @@ below can be derived from those secrets.
|
||||
The output above also show the **public key** and the **Account ID**. Those are the independent from the network where
|
||||
you will use the key.
|
||||
|
||||
The **SS58 address** (or **Public Address**) of a new account is a reprensentation of the public keys of an account for
|
||||
The **SS58 address** (or **Public Address**) of a new account is a representation of the public keys of an account for
|
||||
a given network (for instance Kusama or Polkadot).
|
||||
|
||||
You can read more about the [SS58 format in the Substrate Docs](https://docs.substrate.io/reference/address-formats/)
|
||||
@@ -143,7 +143,7 @@ Secret phrase `soup lyrics media market way crouch elevator put moon useful ques
|
||||
SS58 Address: 5He5pZpc7AJ8evPuab37vJF6KkFDqq9uDq2WXh877Qw6iaVC
|
||||
```
|
||||
|
||||
Using the `inspect` command (see more details below), we see that knowning only the **secret seed** is no longer
|
||||
Using the `inspect` command (see more details below), we see that knowing only the **secret seed** is no longer
|
||||
sufficient to recover the account:
|
||||
|
||||
```bash
|
||||
|
||||
@@ -94,10 +94,10 @@
|
||||
//! seed** (also called **Private Key**). Those 2 secrets are the pieces of information you MUST
|
||||
//! keep safe and secret. All the other information below can be derived from those secrets.
|
||||
//!
|
||||
//! The output above also show the **public key** and the **Account ID**. Those are the independant
|
||||
//! The output above also show the **public key** and the **Account ID**. Those are the independent
|
||||
//! from the network where you will use the key.
|
||||
//!
|
||||
//! The **SS58 address** (or **Public Address**) of a new account is a reprensentation of the public
|
||||
//! The **SS58 address** (or **Public Address**) of a new account is a representation of the public
|
||||
//! keys of an account for a given network (for instance Kusama or Polkadot).
|
||||
//!
|
||||
//! You can read more about the [SS58 format in the Substrate Docs](https://docs.substrate.io/reference/address-formats/) and see the list of reserved prefixes in the [SS58 Registry](https://github.com/paritytech/ss58-registry).
|
||||
@@ -110,7 +110,7 @@
|
||||
//!
|
||||
//! ### Json output
|
||||
//!
|
||||
//! `subkey` can calso generate the output as *json*. This is useful for automation.
|
||||
//! `subkey` can also generate the output as *json*. This is useful for automation.
|
||||
//!
|
||||
//! command:
|
||||
//!
|
||||
@@ -163,7 +163,7 @@
|
||||
//! SS58 Address: 5He5pZpc7AJ8evPuab37vJF6KkFDqq9uDq2WXh877Qw6iaVC
|
||||
//! ```
|
||||
//!
|
||||
//! Using the `inspect` command (see more details below), we see that knowning only the **secret
|
||||
//! Using the `inspect` command (see more details below), we see that knowing only the **secret
|
||||
//! seed** is no longer sufficient to recover the account:
|
||||
//!
|
||||
//! ```bash
|
||||
@@ -184,7 +184,7 @@
|
||||
//!
|
||||
//! ### Inspecting a key
|
||||
//!
|
||||
//! If you have *some data* about a key, `subkey inpsect` will help you discover more information
|
||||
//! If you have *some data* about a key, `subkey inspect` will help you discover more information
|
||||
//! about it.
|
||||
//!
|
||||
//! If you have **secrets** that you would like to verify for instance, you can use:
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ to update the Alliance's rule and make announcements.
|
||||
- `add_unscrupulous_items` - Add some items, either accounts or websites, to the list of
|
||||
unscrupulous items.
|
||||
- `remove_unscrupulous_items` - Remove some items from the list of unscrupulous items.
|
||||
- `abdicate_fellow_status` - Abdicate one's voting rights, demoting themself to Ally.
|
||||
- `abdicate_fellow_status` - Abdicate one's voting rights, demoting themselves to Ally.
|
||||
|
||||
#### Root Calls
|
||||
|
||||
|
||||
@@ -505,10 +505,10 @@ pub mod pallet {
|
||||
proposal: Box<<T as Config<I>>::Proposal>,
|
||||
#[pallet::compact] length_bound: u32,
|
||||
) -> DispatchResult {
|
||||
let proposor = ensure_signed(origin)?;
|
||||
ensure!(Self::has_voting_rights(&proposor), Error::<T, I>::NoVotingRights);
|
||||
let proposer = ensure_signed(origin)?;
|
||||
ensure!(Self::has_voting_rights(&proposer), Error::<T, I>::NoVotingRights);
|
||||
|
||||
T::ProposalProvider::propose_proposal(proposor, threshold, proposal, length_bound)?;
|
||||
T::ProposalProvider::propose_proposal(proposer, threshold, proposal, length_bound)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ use crate::mock::*;
|
||||
type AllianceMotionEvent = pallet_collective::Event<Test, pallet_collective::Instance1>;
|
||||
|
||||
fn assert_powerless(user: RuntimeOrigin, user_is_member: bool) {
|
||||
//vote / veto with a valid propsal
|
||||
//vote / veto with a valid proposal
|
||||
let cid = test_cid();
|
||||
let (proposal, _, _) = make_kick_member_proposal(42);
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ pub mod pallet {
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T: Config> {
|
||||
/// A successful call of the `CretaPool` extrinsic will create this event.
|
||||
/// A successful call of the `CreatePool` extrinsic will create this event.
|
||||
PoolCreated {
|
||||
/// The account that created the pool.
|
||||
creator: T::AccountId,
|
||||
|
||||
@@ -112,7 +112,7 @@ pub mod pallet {
|
||||
/// The origin permissioned to remove an existing conversion rate for an asset.
|
||||
type RemoveOrigin: EnsureOrigin<Self::RuntimeOrigin>;
|
||||
|
||||
/// The origin permissioned to update an existiing conversion rate for an asset.
|
||||
/// The origin permissioned to update an existing conversion rate for an asset.
|
||||
type UpdateOrigin: EnsureOrigin<Self::RuntimeOrigin>;
|
||||
|
||||
/// The currency mechanism for this pallet.
|
||||
|
||||
@@ -183,7 +183,7 @@ pub use weights::WeightInfo;
|
||||
type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source;
|
||||
const LOG_TARGET: &str = "runtime::assets";
|
||||
|
||||
/// Trait with callbacks that are executed after successfull asset creation or destruction.
|
||||
/// Trait with callbacks that are executed after successful asset creation or destruction.
|
||||
pub trait AssetsCallback<AssetId, AccountId> {
|
||||
/// Indicates that asset with `id` was successfully created by the `owner`
|
||||
fn created(_id: &AssetId, _owner: &AccountId) -> Result<(), ()> {
|
||||
|
||||
@@ -1453,7 +1453,7 @@ fn force_asset_status_should_work() {
|
||||
));
|
||||
assert_eq!(Assets::balance(0, 1), 50);
|
||||
|
||||
// account can recieve assets for balance < min_balance
|
||||
// account can receive assets for balance < min_balance
|
||||
assert_ok!(Assets::transfer(RuntimeOrigin::signed(2), 0, 1, 1));
|
||||
assert_eq!(Assets::balance(0, 1), 51);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ benchmarks! {
|
||||
// NOTE: generated with the test below `test_generate_equivocation_report_blob`.
|
||||
// the output is not deterministic since keys are generated randomly (and therefore
|
||||
// signature content changes). it should not affect the benchmark.
|
||||
// with the current benchmark setup it is not possible to generate this programatically
|
||||
// with the current benchmark setup it is not possible to generate this programmatically
|
||||
// from the benchmark setup.
|
||||
const EQUIVOCATION_PROOF_BLOB: [u8; 416] = [
|
||||
222, 241, 46, 66, 243, 228, 135, 233, 177, 64, 149, 170, 141, 92, 193, 106, 51, 73, 31,
|
||||
|
||||
@@ -431,7 +431,7 @@ mod list {
|
||||
#[test]
|
||||
fn insert_at_unchecked_at_is_only_node() {
|
||||
// Note that this `insert_at_unchecked` test should fail post checks because node 42 does
|
||||
// not get re-assigned the correct bagu pper. This is because `insert_at_unchecked` assumes
|
||||
// not get re-assigned the correct bag upper. This is because `insert_at_unchecked` assumes
|
||||
// both nodes are already in the same bag with the correct bag upper.
|
||||
ExtBuilder::default().build_and_execute_no_post_check(|| {
|
||||
// given
|
||||
|
||||
@@ -677,7 +677,7 @@ pub mod pallet {
|
||||
///
|
||||
/// This will waive the transaction fee if at least all but 10% of the accounts needed to
|
||||
/// be upgraded. (We let some not have to be upgraded just in order to allow for the
|
||||
/// possibililty of churn).
|
||||
/// possibility of churn).
|
||||
#[pallet::call_index(6)]
|
||||
#[pallet::weight(T::WeightInfo::upgrade_accounts(who.len() as u32))]
|
||||
pub fn upgrade_accounts(
|
||||
@@ -905,14 +905,14 @@ pub mod pallet {
|
||||
Self::try_mutate_account(who, |a, _| -> Result<R, DispatchError> { Ok(f(a)) })
|
||||
}
|
||||
|
||||
/// Returns `true` when `who` has some providers or `insecure_zero_ed` feature is disnabled.
|
||||
/// Returns `true` when `who` has some providers or `insecure_zero_ed` feature is disabled.
|
||||
/// Returns `false` otherwise.
|
||||
#[cfg(not(feature = "insecure_zero_ed"))]
|
||||
fn have_providers_or_no_zero_ed(_: &T::AccountId) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// Returns `true` when `who` has some providers or `insecure_zero_ed` feature is disnabled.
|
||||
/// Returns `true` when `who` has some providers or `insecure_zero_ed` feature is disabled.
|
||||
/// Returns `false` otherwise.
|
||||
#[cfg(feature = "insecure_zero_ed")]
|
||||
fn have_providers_or_no_zero_ed(who: &T::AccountId) -> bool {
|
||||
|
||||
@@ -1024,7 +1024,7 @@ fn slash_consumed_slash_partial_works() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn slash_on_non_existant_works() {
|
||||
fn slash_on_non_existent_works() {
|
||||
ExtBuilder::default().existential_deposit(100).build_and_execute_with(|| {
|
||||
// Slash on non-existent account is okay.
|
||||
assert_eq!(Balances::slash(&12345, 1_300), (NegativeImbalance::new(0), 1300));
|
||||
@@ -1071,7 +1071,7 @@ fn slash_reserved_overslash_does_not_touch_free_balance() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn slash_reserved_on_non_existant_works() {
|
||||
fn slash_reserved_on_non_existent_works() {
|
||||
ExtBuilder::default().existential_deposit(100).build_and_execute_with(|| {
|
||||
// Slash on non-existent account is okay.
|
||||
assert_eq!(Balances::slash_reserved(&12345, 1_300), (NegativeImbalance::new(0), 1300));
|
||||
|
||||
@@ -44,7 +44,7 @@ fn transfer_dust_removal_tst1_should_work() {
|
||||
assert_eq!(Balances::free_balance(&2), 0);
|
||||
|
||||
// As expected beneficiary account 3
|
||||
// received the transfered fund.
|
||||
// received the transferred fund.
|
||||
assert_eq!(Balances::free_balance(&3), 450);
|
||||
|
||||
// Dust balance is deposited to account 1
|
||||
@@ -123,7 +123,7 @@ fn repatriating_reserved_balance_dust_removal_should_work() {
|
||||
|
||||
// Reserve a value on account 2,
|
||||
// Such that free balance is lower than
|
||||
// Exestintial deposit.
|
||||
// Existential deposit.
|
||||
assert_ok!(Balances::transfer_allow_death(RuntimeOrigin::signed(2), 1, 450));
|
||||
|
||||
// Since free balance of account 2 is lower than
|
||||
|
||||
@@ -41,7 +41,7 @@ pub enum BenchmarkSelector {
|
||||
|
||||
/// Multiplies the value by 1000 and converts it into an u128.
|
||||
fn mul_1000_into_u128(value: f64) -> u128 {
|
||||
// This is slighly more precise than the alternative of `(value * 1000.0) as u128`.
|
||||
// This is slightly more precise than the alternative of `(value * 1000.0) as u128`.
|
||||
(value as u128)
|
||||
.saturating_mul(1000)
|
||||
.saturating_add((value.fract() * 1000.0) as u128)
|
||||
|
||||
@@ -203,7 +203,7 @@ pub use v1::*;
|
||||
/// ## Where Clause
|
||||
///
|
||||
/// Some pallets require a where clause specifying constraints on their generics to make
|
||||
/// writing benchmarks feasible. To accomodate this situation, you can provide such a where
|
||||
/// writing benchmarks feasible. To accommodate this situation, you can provide such a where
|
||||
/// clause as the (only) argument to the `#[benchmarks]` or `#[instance_benchmarks]` attribute
|
||||
/// macros. Below is an example of this taken from the `message-queue` pallet.
|
||||
///
|
||||
|
||||
@@ -874,7 +874,7 @@ macro_rules! impl_bench_name_tests {
|
||||
$crate::BenchmarkError::Override(_) => {
|
||||
// This is still considered a success condition.
|
||||
$crate::__private::log::error!(
|
||||
"WARNING: benchmark error overrided - {}",
|
||||
"WARNING: benchmark error overridden - {}",
|
||||
stringify!($name),
|
||||
);
|
||||
},
|
||||
@@ -1704,7 +1704,7 @@ macro_rules! impl_test_function {
|
||||
$crate::BenchmarkError::Override(_) => {
|
||||
// This is still considered a success condition.
|
||||
$crate::__private::log::error!(
|
||||
"WARNING: benchmark error overrided - {}",
|
||||
"WARNING: benchmark error overridden - {}",
|
||||
$crate::__private::str::from_utf8(benchmark_name)
|
||||
.expect("benchmark name is always a valid string!"),
|
||||
);
|
||||
@@ -1851,7 +1851,7 @@ macro_rules! add_benchmark {
|
||||
Err($crate::BenchmarkError::Override(mut result)) => {
|
||||
// Insert override warning as the first storage key.
|
||||
$crate::__private::log::error!(
|
||||
"WARNING: benchmark error overrided - {}",
|
||||
"WARNING: benchmark error overridden - {}",
|
||||
$crate::__private::str::from_utf8(benchmark)
|
||||
.expect("benchmark name is always a valid string!")
|
||||
);
|
||||
|
||||
@@ -683,7 +683,7 @@ pub mod pallet {
|
||||
/// - `origin`: Must be a Signed origin of the account which owns the Region `region_id`.
|
||||
/// - `region_id`: The Region which was assigned to the Pool.
|
||||
/// - `max_timeslices`: The maximum number of timeslices which should be processed. This may
|
||||
/// effect the weight of the call but should be ideally made equivalant to the length of
|
||||
/// effect the weight of the call but should be ideally made equivalent to the length of
|
||||
/// the Region `region_id`. If it is less than this, then further dispatches will be
|
||||
/// required with the `region_id` which makes up any remainders of the region to be
|
||||
/// collected.
|
||||
|
||||
@@ -55,7 +55,7 @@ pub enum Finality {
|
||||
pub struct RegionId {
|
||||
/// The timeslice at which this Region begins.
|
||||
pub begin: Timeslice,
|
||||
/// The index of the Polakdot Core on which this Region will be scheduled.
|
||||
/// The index of the Polkadot Core on which this Region will be scheduled.
|
||||
pub core: CoreIndex,
|
||||
/// The regularity parts in which this Region will be scheduled.
|
||||
pub mask: CoreMask,
|
||||
@@ -198,7 +198,7 @@ pub struct PoolIoRecord {
|
||||
/// The total change of the portion of the pool supplied by purchased Bulk Coretime, measured
|
||||
/// in Core Mask Bits.
|
||||
pub private: SignedCoreMaskBitCount,
|
||||
/// The total change of the portion of the pool supplied by the Polkaot System, measured in
|
||||
/// The total change of the portion of the pool supplied by the Polkadot System, measured in
|
||||
/// Core Mask Bits.
|
||||
pub system: SignedCoreMaskBitCount,
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ calculations, but enforces this neither in `set_members` nor in `change_members_
|
||||
A "prime" member may be set to help determine the default vote behavior based on chain
|
||||
config. If `PrimeDefaultVote` is used, the prime vote acts as the default vote in case of any
|
||||
abstentions after the voting period. If `MoreThanMajorityThenPrimeDefaultVote` is used, then
|
||||
abstentations will first follow the majority of the collective voting, and then the prime
|
||||
abstentions will first follow the majority of the collective voting, and then the prime
|
||||
member.
|
||||
|
||||
Voting happens through motions comprising a proposal (i.e. a dispatchable) plus a
|
||||
|
||||
@@ -283,7 +283,7 @@ pub mod pallet {
|
||||
pub type Members<T: Config<I>, I: 'static = ()> =
|
||||
StorageValue<_, Vec<T::AccountId>, ValueQuery>;
|
||||
|
||||
/// The prime member that helps determine the default vote behavior in case of absentations.
|
||||
/// The prime member that helps determine the default vote behavior in case of abstentions.
|
||||
#[pallet::storage]
|
||||
pub type Prime<T: Config<I>, I: 'static = ()> = StorageValue<_, T::AccountId, OptionQuery>;
|
||||
|
||||
|
||||
@@ -995,7 +995,7 @@ fn motions_all_first_vote_free_works() {
|
||||
Collective::vote(RuntimeOrigin::signed(3), hash, 0, false);
|
||||
assert_eq!(vote_rval.unwrap().pays_fee, Pays::Yes);
|
||||
|
||||
// Test close() Extrincis | Check DispatchResultWithPostInfo with Pay Info
|
||||
// Test close() Extrinsics | Check DispatchResultWithPostInfo with Pay Info
|
||||
|
||||
let proposal_weight = proposal.get_dispatch_info().weight;
|
||||
let close_rval: DispatchResultWithPostInfo =
|
||||
|
||||
@@ -59,7 +59,7 @@ In general, a contract execution needs to be deterministic so that all nodes com
|
||||
it. To that end we disallow any instructions that could cause indeterminism. Most notable are any floating point
|
||||
arithmetic. That said, sometimes contracts are executed off-chain and hence are not subject to consensus. If code is
|
||||
only executed by a single node and implicitly trusted by other actors is such a case. Trusted execution environments
|
||||
come to mind. To that end we allow the execution of indeterminstic code for off-chain usages with the following
|
||||
come to mind. To that end we allow the execution of indeterministic code for off-chain usages with the following
|
||||
constraints:
|
||||
|
||||
1. No contract can ever be instantiated from an indeterministic code. The only way to execute the code is to use a
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Does two stores to two seperate storage items
|
||||
//! Does two stores to two separate storage items
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ impl<T: Config> From<ModuleDefinition> for WasmModule<T> {
|
||||
|
||||
// Grant access to linear memory.
|
||||
// Every contract module is required to have an imported memory.
|
||||
// If no memory is specified in the passed ModuleDefenition, then
|
||||
// If no memory is specified in the passed ModuleDefinition, then
|
||||
// default to (1, 1).
|
||||
let (init, max) = if let Some(memory) = &def.memory {
|
||||
(memory.min_pages, Some(memory.max_pages))
|
||||
|
||||
@@ -340,7 +340,7 @@ mod benchmarks {
|
||||
assert_eq!(StorageVersion::get::<Pallet<T>>(), version);
|
||||
}
|
||||
|
||||
// This benchmarks the weight of dispatching migrate to execute 1 `NoopMigraton`
|
||||
// This benchmarks the weight of dispatching migrate to execute 1 `NoopMigration`
|
||||
#[benchmark(pov_mode = Measured)]
|
||||
fn migrate() {
|
||||
let latest_version = LATEST_MIGRATION_VERSION;
|
||||
@@ -1859,7 +1859,7 @@ mod benchmarks {
|
||||
|
||||
// We call unique accounts.
|
||||
//
|
||||
// This is a slow call: We redeuce the number of runs.
|
||||
// This is a slow call: We reduce the number of runs.
|
||||
#[benchmark(pov_mode = Measured)]
|
||||
fn seal_call(r: Linear<0, { API_BENCHMARK_RUNS / 2 }>) -> Result<(), BenchmarkError> {
|
||||
let dummy_code = WasmModule::<T>::dummy_with_bytes(0);
|
||||
@@ -1937,7 +1937,7 @@ mod benchmarks {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// This is a slow call: We redeuce the number of runs.
|
||||
// This is a slow call: We reduce the number of runs.
|
||||
#[benchmark(pov_mode = Measured)]
|
||||
fn seal_delegate_call(r: Linear<0, { API_BENCHMARK_RUNS / 2 }>) -> Result<(), BenchmarkError> {
|
||||
let hashes = (0..r)
|
||||
@@ -2473,7 +2473,7 @@ mod benchmarks {
|
||||
|
||||
// Only calling the function itself for the list of
|
||||
// generated different ECDSA keys.
|
||||
// This is a slow call: We redeuce the number of runs.
|
||||
// This is a slow call: We reduce the number of runs.
|
||||
#[benchmark(pov_mode = Measured)]
|
||||
fn seal_ecdsa_to_eth_address(
|
||||
r: Linear<0, { API_BENCHMARK_RUNS / 10 }>,
|
||||
|
||||
@@ -531,9 +531,9 @@ enum FrameArgs<'a, T: Config, E> {
|
||||
nonce: u64,
|
||||
/// The executable whose `deploy` function is run.
|
||||
executable: E,
|
||||
/// A salt used in the contract address deriviation of the new contract.
|
||||
/// A salt used in the contract address derivation of the new contract.
|
||||
salt: &'a [u8],
|
||||
/// The input data is used in the contract address deriviation of the new contract.
|
||||
/// The input data is used in the contract address derivation of the new contract.
|
||||
input_data: &'a [u8],
|
||||
},
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ mod tests {
|
||||
assert!(gas_meter.charge(SimpleToken(1)).is_err());
|
||||
}
|
||||
|
||||
// Make sure that the gas meter does not charge in case of overcharger
|
||||
// Make sure that the gas meter does not charge in case of overcharge
|
||||
#[test]
|
||||
fn overcharge_does_not_charge() {
|
||||
let mut gas_meter = GasMeter::<Test>::new(Weight::from_parts(200, 0));
|
||||
|
||||
@@ -1104,7 +1104,7 @@ pub mod pallet {
|
||||
/// A more detailed error can be found on the node console if debug messages are enabled
|
||||
/// by supplying `-lruntime::contracts=debug`.
|
||||
CodeRejected,
|
||||
/// An indetermistic code was used in a context where this is not permitted.
|
||||
/// An indeterministic code was used in a context where this is not permitted.
|
||||
Indeterministic,
|
||||
/// A pending migration needs to complete before the extrinsic can be called.
|
||||
MigrationInProgress,
|
||||
|
||||
@@ -131,7 +131,7 @@ impl<T: Config> MigrationStep for Migration<T> {
|
||||
let module = CodeStorage::<T>::get(&code_hash).unwrap();
|
||||
ensure!(
|
||||
module.instruction_weights_version == old.instruction_weights_version,
|
||||
"invalid isntruction weights version"
|
||||
"invalid instruction weights version"
|
||||
);
|
||||
ensure!(module.determinism == Determinism::Enforced, "invalid determinism");
|
||||
ensure!(module.initial == old.initial, "invalid initial");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user