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:
Dcompoze
2024-03-26 13:57:57 +00:00
committed by GitHub
parent b839c995c0
commit 002d9260f9
463 changed files with 1119 additions and 1017 deletions
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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(())
}
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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<(), ()> {
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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.
///
+3 -3
View File
@@ -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!")
);
+1 -1
View File
@@ -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.
+2 -2
View File
@@ -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,
}
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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>;
+1 -1
View File
@@ -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 =
+1 -1
View File
@@ -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 }>,
+2 -2
View File
@@ -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],
},
}
+1 -1
View File
@@ -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));
+1 -1
View File
@@ -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");
+1 -1
View File
@@ -193,7 +193,7 @@ pub struct HostFnWeights<T: Config> {
/// Weight of calling `seal_set_storage`.
pub set_storage: Weight,
/// Weight per written byten of an item stored with `seal_set_storage`.
/// Weight per written byte of an item stored with `seal_set_storage`.
pub set_storage_per_new_byte: Weight,
/// Weight per overwritten byte of an item stored with `seal_set_storage`.
+9 -9
View File
@@ -1347,7 +1347,7 @@ fn transfer_expendable_cannot_kill_account() {
}
#[test]
fn cannot_self_destruct_through_draning() {
fn cannot_self_destruct_through_draining() {
let (wasm, _code_hash) = compile_module::<Test>("drain").unwrap();
ExtBuilder::default().existential_deposit(200).build().execute_with(|| {
let _ = <Test as Config>::Currency::set_balance(&ALICE, 1_000_000);
@@ -1662,7 +1662,7 @@ fn cannot_self_destruct_in_constructor() {
ExtBuilder::default().existential_deposit(50).build().execute_with(|| {
let _ = <Test as Config>::Currency::set_balance(&ALICE, 1_000_000);
// Fail to instantiate the BOB because the contructor calls seal_terminate.
// Fail to instantiate the BOB because the constructor calls seal_terminate.
assert_err_ignore_postinfo!(
Contracts::instantiate_with_code(
RuntimeOrigin::signed(ALICE),
@@ -5096,7 +5096,7 @@ fn cannot_instantiate_indeterministic_code() {
<Error<Test>>::CodeRejected,
);
// Try to upload a non deterministic code as deterministic
// Try to upload a non-deterministic code as deterministic
assert_err!(
Contracts::upload_code(
RuntimeOrigin::signed(ALICE),
@@ -5176,7 +5176,7 @@ fn cannot_instantiate_indeterministic_code() {
<Error<Test>>::Indeterministic,
);
// Instantiations are not allowed even in non determinism mode
// Instantiations are not allowed even in non-determinism mode
assert_err!(
<Pallet<Test>>::bare_call(
ALICE,
@@ -5202,7 +5202,7 @@ fn cannot_set_code_indeterministic_code() {
ExtBuilder::default().existential_deposit(200).build().execute_with(|| {
let _ = <Test as Config>::Currency::set_balance(&ALICE, 1_000_000);
// Put the non deterministic contract on-chain
// Put the non-deterministic contract on-chain
assert_ok!(Contracts::upload_code(
RuntimeOrigin::signed(ALICE),
wasm,
@@ -5226,7 +5226,7 @@ fn cannot_set_code_indeterministic_code() {
.unwrap()
.account_id;
// We do not allow to set the code hash to a non determinstic wasm
// We do not allow to set the code hash to a non-deterministic wasm
assert_err!(
<Pallet<Test>>::bare_call(
ALICE,
@@ -5252,7 +5252,7 @@ fn delegate_call_indeterministic_code() {
ExtBuilder::default().existential_deposit(200).build().execute_with(|| {
let _ = <Test as Config>::Currency::set_balance(&ALICE, 1_000_000);
// Put the non deterministic contract on-chain
// Put the non-deterministic contract on-chain
assert_ok!(Contracts::upload_code(
RuntimeOrigin::signed(ALICE),
wasm,
@@ -5293,7 +5293,7 @@ fn delegate_call_indeterministic_code() {
<Error<Test>>::Indeterministic,
);
// The delegate call will work on non deterministic mode
// The delegate call will work on non-deterministic mode
assert_ok!(
<Pallet<Test>>::bare_call(
ALICE,
@@ -5429,7 +5429,7 @@ fn locking_delegate_dependency_works() {
contract.storage_base_deposit() - ED
);
// Removing an unexisting dependency should fail.
// Removing a nonexistent dependency should fail.
assert_err!(
call(&addr_caller, &unlock_delegate_dependency_input).result,
Error::<Test>::DelegateDependencyNotFound
+1 -1
View File
@@ -1425,7 +1425,7 @@ mod tests {
#[test]
fn contract_ecdsa_to_eth_address() {
/// calls `seal_ecdsa_to_eth_address` for the contstant and ensures the result equals the
/// calls `seal_ecdsa_to_eth_address` for the constant and ensures the result equals the
/// expected one.
const CODE_ECDSA_TO_ETH_ADDRESS: &str = r#"
(module
@@ -245,7 +245,7 @@ pub enum RuntimeCosts {
/// Weight of calling `account_reentrance_count`
AccountEntranceCount,
/// Weight of calling `instantiation_nonce`
InstantationNonce,
InstantiationNonce,
/// Weight of calling `lock_delegate_dependency`
LockDelegateDependency,
/// Weight of calling `unlock_delegate_dependency`
@@ -337,7 +337,7 @@ impl<T: Config> Token<T> for RuntimeCosts {
EcdsaToEthAddress => s.ecdsa_to_eth_address,
ReentrantCount => s.reentrance_count,
AccountEntranceCount => s.account_reentrance_count,
InstantationNonce => s.instantiation_nonce,
InstantiationNonce => s.instantiation_nonce,
LockDelegateDependency => s.lock_delegate_dependency,
UnlockDelegateDependency => s.unlock_delegate_dependency,
}
@@ -2298,7 +2298,7 @@ pub mod env {
/// Returns a nonce that is unique per contract instantiation.
/// See [`pallet_contracts_uapi::HostFn::instantiation_nonce`].
fn instantiation_nonce(ctx: _, _memory: _) -> Result<u64, TrapReason> {
ctx.charge_gas(RuntimeCosts::InstantationNonce)?;
ctx.charge_gas(RuntimeCosts::InstantiationNonce)?;
Ok(ctx.ext.nonce())
}
@@ -39,7 +39,7 @@ frame_support::construct_runtime!(
}
);
// Test that a fitlered call can be dispatched.
// Test that a filtered call can be dispatched.
pub struct BaseFilter;
impl Contains<RuntimeCall> for BaseFilter {
fn contains(call: &RuntimeCall) -> bool {
@@ -251,7 +251,7 @@ fn swap_exhaustive_works() {
});
assert_eq!(root_add, root_swap);
// Ensure that we dont compare trivial stuff like `()` from a type error above.
// Ensure that we don't compare trivial stuff like `()` from a type error above.
assert_eq!(root_add.len(), 32);
});
}
+1 -1
View File
@@ -484,7 +484,7 @@ pub mod pallet {
Blacklisted { proposal_hash: T::Hash },
/// An account has voted in a referendum
Voted { voter: T::AccountId, ref_index: ReferendumIndex, vote: AccountVote<BalanceOf<T>> },
/// An account has secconded a proposal
/// An account has seconded a proposal
Seconded { seconder: T::AccountId, prop_index: PropIndex },
/// A proposal got canceled.
ProposalCanceled { prop_index: PropIndex },
@@ -321,40 +321,40 @@ mod test {
}
#[test]
fn unreserve_works_for_depositer() {
let depositer_0 = 10;
let depositer_1 = 11;
fn unreserve_works_for_depositor() {
let depositor_0 = 10;
let depositor_1 = 11;
let deposit = 25;
let depositer_0_initial_reserved = 0;
let depositer_1_initial_reserved = 15;
let depositor_0_initial_reserved = 0;
let depositor_1_initial_reserved = 15;
let initial_balance = 100_000;
new_test_ext().execute_with(|| {
// Set up initial state.
<Test as crate::Config>::Currency::make_free_balance_be(&depositer_0, initial_balance);
<Test as crate::Config>::Currency::make_free_balance_be(&depositer_1, initial_balance);
<Test as crate::Config>::Currency::make_free_balance_be(&depositor_0, initial_balance);
<Test as crate::Config>::Currency::make_free_balance_be(&depositor_1, initial_balance);
assert_ok!(<Test as crate::Config>::Currency::reserve(
&depositer_0,
depositer_0_initial_reserved + deposit
&depositor_0,
depositor_0_initial_reserved + deposit
));
assert_ok!(<Test as crate::Config>::Currency::reserve(
&depositer_1,
depositer_1_initial_reserved + deposit
&depositor_1,
depositor_1_initial_reserved + deposit
));
let depositors =
BoundedVec::<_, <Test as crate::Config>::MaxDeposits>::truncate_from(vec![
depositer_0,
depositer_1,
depositor_0,
depositor_1,
]);
DepositOf::<Test>::insert(0, (depositors, deposit));
// Sanity check: ensure initial reserved balance was set correctly.
assert_eq!(
<Test as crate::Config>::Currency::reserved_balance(&depositer_0),
depositer_0_initial_reserved + deposit
<Test as crate::Config>::Currency::reserved_balance(&depositor_0),
depositor_0_initial_reserved + deposit
);
assert_eq!(
<Test as crate::Config>::Currency::reserved_balance(&depositer_1),
depositer_1_initial_reserved + deposit
<Test as crate::Config>::Currency::reserved_balance(&depositor_1),
depositor_1_initial_reserved + deposit
);
// Run the migration.
@@ -365,12 +365,12 @@ mod test {
// Assert the reserved balance was reduced by the expected amount.
assert_eq!(
<Test as crate::Config>::Currency::reserved_balance(&depositer_0),
depositer_0_initial_reserved
<Test as crate::Config>::Currency::reserved_balance(&depositor_0),
depositor_0_initial_reserved
);
assert_eq!(
<Test as crate::Config>::Currency::reserved_balance(&depositer_1),
depositer_1_initial_reserved
<Test as crate::Config>::Currency::reserved_balance(&depositor_1),
depositor_1_initial_reserved
);
});
}
+1 -1
View File
@@ -62,7 +62,7 @@ frame_support::construct_runtime!(
}
);
// Test that a fitlered call can be dispatched.
// Test that a filtered call can be dispatched.
pub struct BaseFilter;
impl Contains<RuntimeCall> for BaseFilter {
fn contains(call: &RuntimeCall) -> bool {
@@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! The tests for cancelation functionality.
//! The tests for cancellation functionality.
use super::*;
@@ -160,7 +160,7 @@ pub fn target_index_fn_linear<T: MinerConfig>(
}
/// Create a function that can map a voter index ([`SolutionVoterIndexOf`]) to the actual voter
/// account using a linearly indexible snapshot.
/// account using a linearly indexable snapshot.
pub fn voter_at_fn<T: MinerConfig>(
snapshot: &Vec<MinerVoterOf<T>>,
) -> impl Fn(SolutionVoterIndexOf<T>) -> Option<T::AccountId> + '_ {
@@ -172,7 +172,7 @@ pub fn voter_at_fn<T: MinerConfig>(
}
/// Create a function that can map a target index ([`SolutionTargetIndexOf`]) to the actual target
/// account using a linearly indexible snapshot.
/// account using a linearly indexable snapshot.
pub fn target_at_fn<T: MinerConfig>(
snapshot: &Vec<T::AccountId>,
) -> impl Fn(SolutionTargetIndexOf<T>) -> Option<T::AccountId> + '_ {
@@ -1134,7 +1134,7 @@ pub mod pallet {
/// A solution was stored with the given compute.
///
/// The `origin` indicates the origin of the solution. If `origin` is `Some(AccountId)`,
/// the stored solution was submited in the signed phase by a miner with the `AccountId`.
/// the stored solution was submitted in the signed phase by a miner with the `AccountId`.
/// Otherwise, the solution was stored either during the unsigned phase or by
/// `T::ForceOrigin`. The `bool` is `true` when a previous solution was ejected to make
/// room for this one.
@@ -1192,7 +1192,7 @@ pub mod pallet {
BoundNotMet,
/// Submitted solution has too many winners
TooManyWinners,
/// Sumission was prepared for a different round.
/// Submission was prepared for a different round.
PreDispatchDifferentRound,
}
@@ -1445,7 +1445,7 @@ mod tests {
)
.unwrap();
let solution = RawSolution { solution: raw, score, round: MultiPhase::round() };
// 12 is not better than 12. We need score of atleast 13 to be accepted.
// 12 is not better than 12. We need score of at least 13 to be accepted.
assert_eq!(solution.score.minimal_stake, 12);
// submitting this will panic.
assert_noop!(
@@ -1483,7 +1483,7 @@ mod tests {
));
// trial 4: a solution who's minimal stake is 17, i.e. 4 better than the last
// soluton.
// solution.
let result = ElectionResult {
winners: vec![(10, 12)],
assignments: vec![
@@ -208,8 +208,8 @@ fn enters_emergency_phase_after_forcing_before_elect() {
/// active validators. Thus, slashing a percentage of the current validators that is lower than
/// `OffendingValidatorsThreshold` will never force a new era. However, as the slashes progress, if
/// the subsequent elections do not meet the minimum election untrusted score, the election will
/// fail and enter in emenergency mode.
fn continous_slashes_below_offending_threshold() {
/// fail and enter in emergency mode.
fn continuous_slashes_below_offending_threshold() {
let staking_builder = StakingExtBuilder::default().validator_count(10);
let epm_builder = EpmExtBuilder::default().disable_emergency_throttling();
@@ -323,7 +323,7 @@ fn set_validation_intention_after_chilled() {
}
#[test]
/// Active ledger balance may fall below ED if account chills before unbounding.
/// Active ledger balance may fall below ED if account chills before unbonding.
///
/// Unbonding call fails if the remaining ledger's stash balance falls below the existential
/// deposit. However, if the stash is chilled before unbonding, the ledger's active balance may
@@ -350,7 +350,7 @@ fn ledger_consistency_active_balance_below_ed() {
// however, chilling works as expected.
assert_ok!(Staking::chill(RuntimeOrigin::signed(11)));
// now unbonding the full active balance works, since remainer of the active balance is
// now unbonding the full active balance works, since remainder of the active balance is
// not enforced to be below `MinNominatorBond` if the stash has been chilled.
assert_ok!(Staking::unbond(RuntimeOrigin::signed(11), 1000));
@@ -479,7 +479,7 @@ fn automatic_unbonding_pools() {
staking_events(),
[
// auto-withdraw happened as expected to release 2's unbonding funds, but the funds
// were not transfered to 2 and stay in the pool's tranferrable balance instead.
// were not transferred to 2 and stay in the pool's transferrable balance instead.
pallet_staking::Event::Withdrawn { stash: 7939698191839293293, amount: 10 },
pallet_staking::Event::Unbonded { stash: 7939698191839293293, amount: 10 }
]
@@ -167,7 +167,7 @@ parameter_types! {
pub static SignedPhase: BlockNumber = 10;
pub static UnsignedPhase: BlockNumber = 10;
// we expect a minimum of 3 blocks in signed phase and unsigned phases before trying
// enetering in emergency phase after the election failed.
// entering in emergency phase after the election failed.
pub static MinBlocksBeforeEmergency: BlockNumber = 3;
pub static MaxActiveValidators: u32 = 1000;
pub static OffchainRepeat: u32 = 5;
@@ -661,7 +661,7 @@ pub fn roll_to(n: BlockNumber, delay_solution: bool) {
Session::on_initialize(b);
Timestamp::set_timestamp(System::block_number() * BLOCK_TIME + INIT_TIMESTAMP);
// TODO(gpestana): implement a realistic OCW worker insted of simulating it
// TODO(gpestana): implement a realistic OCW worker instead of simulating it
// https://github.com/paritytech/substrate/issues/13589
// if there's no solution queued and the solution should not be delayed, try mining and
// queue a solution.
@@ -62,7 +62,7 @@ use sp_runtime::traits::Zero;
/// Encapsulates the counting of things that can be bounded in an election, such as voters,
/// targets or anything else.
///
/// This struct is defined mostly to prevent callers from mistankingly using `CountBound` instead of
/// This struct is defined mostly to prevent callers from mistakenly using `CountBound` instead of
/// `SizeBound` and vice-versa.
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub struct CountBound(pub u32);
@@ -96,7 +96,7 @@ impl Zero for CountBound {
/// logic and implementation, but it most likely will represent bytes in SCALE encoding in this
/// context.
///
/// This struct is defined mostly to prevent callers from mistankingly using `CountBound` instead of
/// This struct is defined mostly to prevent callers from mistakenly using `CountBound` instead of
/// `SizeBound` and vice-versa.
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub struct SizeBound(pub u32);
@@ -495,7 +495,7 @@ impl<T: Config> Pallet<T> {
// Here we showcase two ways to send an unsigned transaction / unsigned payload (raw)
//
// By default unsigned transactions are disallowed, so we need to whitelist this case
// by writing `UnsignedValidator`. Note that it's EXTREMELY important to carefuly
// by writing `UnsignedValidator`. Note that it's EXTREMELY important to carefully
// implement unsigned validation logic, as any mistakes can lead to opening DoS or spam
// attack vectors. See validation logic docs for more details.
//
@@ -20,7 +20,7 @@
//! An example pallet demonstrating best-practices for writing single-block migrations in the
//! context of upgrading pallet storage.
//!
//! ## Forwarning
//! ## Forewarning
//!
//! Single block migrations **MUST** execute in a single block, therefore when executed on a
//! parachain are only appropriate when guaranteed to not exceed block weight limits. If a
@@ -66,7 +66,7 @@
//!
//! ## Adding a migration module
//!
//! Writing a pallets migrations in a seperate module is strongly recommended.
//! Writing a pallets migrations in a separate module is strongly recommended.
//!
//! Here's how the migration module is defined for this pallet:
//!
+1 -1
View File
@@ -6,7 +6,7 @@ edition.workspace = true
license = "MIT-0"
homepage = "https://substrate.io"
repository.workspace = true
description = "FRAME example splitted pallet"
description = "FRAME example split pallet"
readme = "README.md"
[lints]
+1 -1
View File
@@ -5,7 +5,7 @@ authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
description = "Pallet to demonstrate the usage of Tasks to recongnize and execute service work"
description = "Pallet to demonstrate the usage of Tasks to recognize and execute service work"
[lints]
workspace = true
+1 -1
View File
@@ -110,7 +110,7 @@ fn cannot_register_if_head() {
stashes: bounded_vec![(1, Deposit::get())],
checked: bounded_vec![],
});
// Controller attempts to regsiter
// Controller attempts to register
assert_noop!(
FastUnstake::register_fast_unstake(RuntimeOrigin::signed(1)),
Error::<T>::AlreadyHead
+1 -1
View File
@@ -29,7 +29,7 @@ benchmarks! {
// NOTE: generated with the test below `test_generate_equivocation_report_blob`.
// the output should be deterministic since the keys we use are static.
// with the current benchmark setup it is not possible to generate this
// programatically from the benchmark setup.
// programmatically from the benchmark setup.
const EQUIVOCATION_PROOF_BLOB: [u8; 257] = [
1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 136, 220, 52, 23,
213, 5, 142, 196, 180, 80, 62, 12, 18, 234, 26, 10, 137, 190, 32,
+1 -1
View File
@@ -634,7 +634,7 @@ fn report_equivocation_invalid_equivocation_proof() {
(1, H256::zero(), 10, &equivocation_keyring),
));
// votes targetting different rounds, there is no equivocation.
// votes targeting different rounds, there is no equivocation.
assert_invalid_equivocation_proof(generate_equivocation_proof(
set_id,
(1, H256::random(), 10, &equivocation_keyring),
+2 -2
View File
@@ -671,10 +671,10 @@ mod benchmarks {
let username = bounded_username::<T>(bench_username(), bench_suffix());
Identity::<T>::queue_acceptance(&caller, username.clone());
let expected_exiration =
let expected_expiration =
frame_system::Pallet::<T>::block_number() + T::PendingUsernameExpiration::get();
run_to_block::<T>(expected_exiration + One::one());
run_to_block::<T>(expected_expiration + One::one());
#[extrinsic_call]
_(RawOrigin::Signed(caller.clone()), username);
+1 -1
View File
@@ -161,7 +161,7 @@ pub mod pallet {
/// Structure holding information about an identity.
type IdentityInformation: IdentityInformationProvider;
/// Maxmimum number of registrars allowed in the system. Needed to bound the complexity
/// Maximum number of registrars allowed in the system. Needed to bound the complexity
/// of, e.g., updating judgements.
#[pallet::constant]
type MaxRegistrars: Get<u32>;
+1 -1
View File
@@ -416,7 +416,7 @@ fn should_handle_non_linear_session_progress() {
Session::rotate_session();
// if we don't have valid results for the current session progres then
// if we don't have valid results for the current session progress then
// we'll fallback to `HeartbeatAfter` and only heartbeat on block 5.
MockCurrentSessionProgress::mutate(|p| *p = Some(None));
assert_eq!(ImOnline::send_heartbeats(2).err(), Some(OffchainErr::TooEarly));
@@ -89,7 +89,7 @@ mod tests;
/// is not available (since the block is not finished yet),
/// we use the `parent_hash` here along with parent block number.
pub struct ParentNumberAndHash<T: frame_system::Config> {
_phanthom: sp_std::marker::PhantomData<T>,
_phantom: sp_std::marker::PhantomData<T>,
}
impl<T: frame_system::Config> LeafDataProvider for ParentNumberAndHash<T> {
+1 -1
View File
@@ -1460,7 +1460,7 @@ impl<T: Config> Pallet<T> {
/// Run a closure that errors on re-entrance. Meant to be used by anything that services queues.
pub(crate) fn with_service_mutex<F: FnOnce() -> R, R>(f: F) -> Result<R, ()> {
// Holds the singelton token instance.
// Holds the singleton token instance.
environmental::environmental!(token: Option<()>);
token::using_once(&mut Some(()), || {
+1 -1
View File
@@ -90,7 +90,7 @@ fn queue_priority_retains() {
MessageQueue::enqueue_message(msg("d"), Everywhere(2));
assert_ring(&[Everywhere(1), Everywhere(2), Everywhere(3)]);
// service head is 1, it will process a, leaving service head at 2. it also processes b but
// doees not empty queue 2, so service head will end at 2.
// does not empty queue 2, so service head will end at 2.
assert_eq!(MessageQueue::service_queues(2.into_weight()), 2.into_weight());
assert_eq!(
MessagesProcessed::take(),
@@ -107,7 +107,7 @@ impl SteppedMigrations for MockedMigrations {
cursor: Option<Vec<u8>>,
meter: &mut WeightMeter,
) -> Option<Result<Option<Vec<u8>>, SteppedMigrationError>> {
// This is a hack but should be fine. We dont need it in testing.
// This is a hack but should be fine. We don't need it in testing.
Self::nth_step(n, cursor, meter)
}
+1 -1
View File
@@ -1,5 +1,5 @@
# NIS Module
Provides a non-interactiove variant of staking.
Provides a non-interactive variant of staking.
License: Apache-2.0
+2 -2
View File
@@ -426,7 +426,7 @@ pub mod pallet {
},
/// An automatic funding of the deficit was made.
Funded { deficit: BalanceOf<T> },
/// A receipt was transfered.
/// A receipt was transferred.
Transferred { from: T::AccountId, to: T::AccountId, index: ReceiptIndex },
}
@@ -457,7 +457,7 @@ pub mod pallet {
AlreadyFunded,
/// The thaw throttle has been reached for this period.
Throttled,
/// The operation would result in a receipt worth an insignficant value.
/// The operation would result in a receipt worth an insignificant value.
MakesDust,
/// The receipt is already communal.
AlreadyCommunal,
+1 -1
View File
@@ -414,7 +414,7 @@ fn thaw_respects_transfers() {
assert_eq!(Balances::reserved_balance(&1), 0);
assert_eq!(Balances::reserved_balance(&2), 40);
// Transfering the receipt...
// Transferring the receipt...
assert_noop!(Nis::thaw_private(signed(1), 0, None), Error::<Test>::NotOwner);
// ...and thawing is possible.
@@ -18,7 +18,7 @@
//! # Node authorization pallet
//!
//! This pallet manages a configurable set of nodes for a permissioned network.
//! Each node is dentified by a PeerId (i.e. `Vec<u8>`). It provides two ways to
//! Each node is identified by a PeerId (i.e. `Vec<u8>`). It provides two ways to
//! authorize a node,
//!
//! - a set of well known nodes across different organizations in which the
@@ -102,7 +102,7 @@ pub mod pallet {
#[pallet::getter(fn owners)]
pub type Owners<T: Config> = StorageMap<_, Blake2_128Concat, PeerId, T::AccountId>;
/// The additional adapative connections of each node.
/// The additional adaptive connections of each node.
#[pallet::storage]
#[pallet::getter(fn additional_connection)]
pub type AdditionalConnections<T> =
@@ -161,7 +161,7 @@ pub mod pallet {
NotClaimed,
/// You are not the owner of the node.
NotOwner,
/// No permisson to perform specific operation.
/// No permission to perform specific operation.
PermissionDenied,
}
@@ -377,7 +377,7 @@ pub mod pallet {
/// Add additional connections to a given node.
///
/// - `node`: identifier of the node.
/// - `connections`: additonal nodes from which the connections are allowed.
/// - `connections`: additional nodes from which the connections are allowed.
#[pallet::call_index(7)]
#[pallet::weight(T::WeightInfo::add_connections())]
pub fn add_connections(
@@ -412,7 +412,7 @@ pub mod pallet {
/// Remove additional connections of a given node.
///
/// - `node`: identifier of the node.
/// - `connections`: additonal nodes from which the connections are not allowed anymore.
/// - `connections`: additional nodes from which the connections are not allowed anymore.
#[pallet::call_index(8)]
#[pallet::weight(T::WeightInfo::remove_connections())]
pub fn remove_connections(
+4 -4
View File
@@ -451,7 +451,7 @@ enum AccountType {
/// The permission a pool member can set for other accounts to claim rewards on their behalf.
#[derive(Encode, Decode, MaxEncodedLen, Clone, Copy, Debug, PartialEq, Eq, TypeInfo)]
pub enum ClaimPermission {
/// Only the pool member themself can claim their rewards.
/// Only the pool member themselves can claim their rewards.
Permissioned,
/// Anyone can compound rewards on a pool member's behalf.
PermissionlessCompound,
@@ -2066,7 +2066,7 @@ pub mod pallet {
/// The member will earn rewards pro rata based on the members stake vs the sum of the
/// members in the pools stake. Rewards do not "expire".
///
/// See `claim_payout_other` to caim rewards on bahalf of some `other` pool member.
/// See `claim_payout_other` to claim rewards on behalf of some `other` pool member.
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::claim_payout())]
pub fn claim_payout(origin: OriginFor<T>) -> DispatchResult {
@@ -2797,7 +2797,7 @@ pub mod pallet {
/// Set or remove a pool's commission claim permission.
///
/// Determines who can claim the pool's pending commission. Only the `Root` role of the pool
/// is able to conifigure commission claim permissions.
/// is able to configure commission claim permissions.
#[pallet::call_index(22)]
#[pallet::weight(T::WeightInfo::set_commission_claim_permission())]
pub fn set_commission_claim_permission(
@@ -2836,7 +2836,7 @@ pub mod pallet {
assert!(
T::Staking::bonding_duration() < TotalUnbondingPools::<T>::get(),
"There must be more unbonding pools then the bonding duration /
so a slash can be applied to relevant unboding pools. (We assume /
so a slash can be applied to relevant unbonding pools. (We assume /
the bonding duration > slash deffer duration.",
);
}
@@ -70,7 +70,7 @@ pub mod unversioned {
fn on_runtime_upgrade() -> Weight {
let migrated = BondedPools::<T>::count();
// recalcuate the `TotalValueLocked` to compare with the current on-chain TVL which may
// recalculate the `TotalValueLocked` to compare with the current on-chain TVL which may
// be out of sync.
let tvl: BalanceOf<T> = helpers::calculate_tvl_by_total_stake::<T>();
let onchain_tvl = TotalValueLocked::<T>::get();
+1 -1
View File
@@ -204,7 +204,7 @@ fn reports_if_an_offence_is_dup() {
assert_eq!(Offences::report_offence(vec![], test_offence.clone()), Ok(()));
// creating a new offence for the same authorities on the next slot
// should be considered a new offence and thefore not known
// should be considered a new offence and therefore not known
let test_offence_next_slot = offence(time_slot + 1, vec![0, 1]);
assert!(!<Offences as ReportOffence<_, _, Offence>>::is_known_offence(
&test_offence_next_slot.offenders,
+1 -1
View File
@@ -190,7 +190,7 @@ impl<V: FullCodec> Page<V> {
let values = sp_io::storage::get(&key)
.and_then(|raw| sp_std::vec::Vec::<V>::decode(&mut &raw[..]).ok())?;
if values.is_empty() {
// Dont create empty pages.
// Don't create empty pages.
return None
}
let values = values.into_iter().skip(value_index as usize);
+17 -17
View File
@@ -122,7 +122,7 @@ use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use frame_support::traits::{
dynamic_params::{AggregratedKeyValue, IntoKey, Key, RuntimeParameterStore, TryIntoKey},
dynamic_params::{AggregatedKeyValue, IntoKey, Key, RuntimeParameterStore, TryIntoKey},
EnsureOriginWithArg,
};
@@ -135,10 +135,10 @@ pub use pallet::*;
pub use weights::WeightInfo;
/// The key type of a parameter.
type KeyOf<T> = <<T as Config>::RuntimeParameters as AggregratedKeyValue>::Key;
type KeyOf<T> = <<T as Config>::RuntimeParameters as AggregatedKeyValue>::Key;
/// The value type of a parameter.
type ValueOf<T> = <<T as Config>::RuntimeParameters as AggregratedKeyValue>::Value;
type ValueOf<T> = <<T as Config>::RuntimeParameters as AggregatedKeyValue>::Value;
#[frame_support::pallet]
pub mod pallet {
@@ -154,7 +154,7 @@ pub mod pallet {
///
/// Usually created by [`frame_support::dynamic_params`] or equivalent.
#[pallet::no_default_bounds]
type RuntimeParameters: AggregratedKeyValue;
type RuntimeParameters: AggregatedKeyValue;
/// The origin which may update a parameter.
///
@@ -175,11 +175,11 @@ pub mod pallet {
/// Is also emitted when the value was not changed.
Updated {
/// The key that was updated.
key: <T::RuntimeParameters as AggregratedKeyValue>::Key,
key: <T::RuntimeParameters as AggregatedKeyValue>::Key,
/// The old value before this call.
old_value: Option<<T::RuntimeParameters as AggregratedKeyValue>::Value>,
old_value: Option<<T::RuntimeParameters as AggregatedKeyValue>::Value>,
/// The new value after this call.
new_value: Option<<T::RuntimeParameters as AggregratedKeyValue>::Value>,
new_value: Option<<T::RuntimeParameters as AggregatedKeyValue>::Value>,
},
}
@@ -245,23 +245,23 @@ pub mod pallet {
}
impl<T: Config> RuntimeParameterStore for Pallet<T> {
type AggregratedKeyValue = T::RuntimeParameters;
type AggregatedKeyValue = T::RuntimeParameters;
fn get<KV, K>(key: K) -> Option<K::Value>
where
KV: AggregratedKeyValue,
K: Key + Into<<KV as AggregratedKeyValue>::Key>,
<KV as AggregratedKeyValue>::Key: IntoKey<
<<Self as RuntimeParameterStore>::AggregratedKeyValue as AggregratedKeyValue>::Key,
KV: AggregatedKeyValue,
K: Key + Into<<KV as AggregatedKeyValue>::Key>,
<KV as AggregatedKeyValue>::Key: IntoKey<
<<Self as RuntimeParameterStore>::AggregatedKeyValue as AggregatedKeyValue>::Key,
>,
<<Self as RuntimeParameterStore>::AggregratedKeyValue as AggregratedKeyValue>::Value:
TryIntoKey<<KV as AggregratedKeyValue>::Value>,
<KV as AggregratedKeyValue>::Value: TryInto<K::WrappedValue>,
<<Self as RuntimeParameterStore>::AggregatedKeyValue as AggregatedKeyValue>::Value:
TryIntoKey<<KV as AggregatedKeyValue>::Value>,
<KV as AggregatedKeyValue>::Value: TryInto<K::WrappedValue>,
{
let key: <KV as AggregratedKeyValue>::Key = key.into();
let key: <KV as AggregatedKeyValue>::Key = key.into();
let val = Parameters::<T>::get(key.into_key());
val.and_then(|v| {
let val: <KV as AggregratedKeyValue>::Value = v.try_into_key().ok()?;
let val: <KV as AggregatedKeyValue>::Value = v.try_into_key().ok()?;
let val: K::WrappedValue = val.try_into().ok()?;
let val = val.into();
Some(val)
+1 -1
View File
@@ -25,7 +25,7 @@ use crate::tests::mock::{
RuntimeParametersValue,
};
use codec::Encode;
use frame_support::{assert_noop, assert_ok, traits::dynamic_params::AggregratedKeyValue};
use frame_support::{assert_noop, assert_ok, traits::dynamic_params::AggregatedKeyValue};
use sp_core::Get;
use sp_runtime::DispatchError;
+1 -1
View File
@@ -119,7 +119,7 @@ pub mod pallet {
/// The currency mechanism.
type Currency: ReservableCurrency<Self::AccountId>;
/// A kind of proxy; specified with the proxy and passed in to the `IsProxyable` fitler.
/// A kind of proxy; specified with the proxy and passed in to the `IsProxyable` filter.
/// The instance filter determines whether a given call may be proxied under this type.
///
/// IMPORTANT: `Default` must be provided and MUST BE the the *most permissive* value.
+1 -1
View File
@@ -17,7 +17,7 @@
//! # Root Testing Pallet
//!
//! Pallet that contains extrinsics that can be usefull in testing.
//! Pallet that contains extrinsics that can be useful in testing.
//!
//! NOTE: This pallet should only be used for testing purposes and should not be used in production
//! runtimes!
@@ -250,7 +250,7 @@ fn swap_exhaustive_works() {
});
assert_eq!(root_add, root_swap);
// Ensure that we dont compare trivial stuff like `()` from a type error above.
// Ensure that we don't compare trivial stuff like `()` from a type error above.
assert_eq!(root_add.len(), 32);
});
}
+4 -4
View File
@@ -508,7 +508,7 @@ fn zero_payment_fails() {
}
#[test]
fn unregistered_bankrupcy_fails_gracefully() {
fn unregistered_bankruptcy_fails_gracefully() {
new_test_ext().execute_with(|| {
assert_ok!(Salary::init(RuntimeOrigin::signed(1)));
set_rank(1, 2);
@@ -532,7 +532,7 @@ fn unregistered_bankrupcy_fails_gracefully() {
}
#[test]
fn registered_bankrupcy_fails_gracefully() {
fn registered_bankruptcy_fails_gracefully() {
new_test_ext().execute_with(|| {
assert_ok!(Salary::init(RuntimeOrigin::signed(1)));
set_rank(1, 2);
@@ -561,7 +561,7 @@ fn registered_bankrupcy_fails_gracefully() {
}
#[test]
fn mixed_bankrupcy_fails_gracefully() {
fn mixed_bankruptcy_fails_gracefully() {
new_test_ext().execute_with(|| {
assert_ok!(Salary::init(RuntimeOrigin::signed(1)));
set_rank(1, 2);
@@ -589,7 +589,7 @@ fn mixed_bankrupcy_fails_gracefully() {
}
#[test]
fn other_mixed_bankrupcy_fails_gracefully() {
fn other_mixed_bankruptcy_fails_gracefully() {
new_test_ext().execute_with(|| {
assert_ok!(Salary::init(RuntimeOrigin::signed(1)));
set_rank(1, 2);
@@ -84,7 +84,7 @@ mod benchmarks {
// - load the full ring context.
// - recompute the ring verifier.
// - sorting the epoch tickets in one shot
// (here we account for the very unluky scenario where we haven't done any sort work yet)
// (here we account for the very unlucky scenario where we haven't done any sort work yet)
// - pending epoch change config.
//
// For this bench we assume a redundancy factor of 2 (suggested value to be used in prod).
+4 -4
View File
@@ -234,7 +234,7 @@ pub mod pallet {
/// Epoch X first N-th ticket has key (X mod 2, N)
///
/// Note that the ticket's index doesn't directly correspond to the slot index within the epoch.
/// The assigment is computed dynamically using an *outside-in* strategy.
/// The assignment is computed dynamically using an *outside-in* strategy.
///
/// Be aware that entries within this map are never removed, only overwritten.
/// Last element index should be fetched from the [`TicketsMeta`] value.
@@ -465,7 +465,7 @@ pub mod pallet {
/// Plan an epoch configuration change.
///
/// The epoch configuration change is recorded and will be announced at the begining
/// The epoch configuration change is recorded and will be announced at the beginning
/// of the next epoch together with next epoch authorities information.
/// In other words, the configuration will be enacted one epoch later.
///
@@ -758,11 +758,11 @@ impl<T: Config> Pallet<T> {
let randomness = hashing::blake2_256(buf.as_slice());
RandomnessAccumulator::<T>::put(randomness);
let next_randoness = Self::update_epoch_randomness(1);
let next_randomness = Self::update_epoch_randomness(1);
// Deposit a log as this is the first block in first epoch.
let next_epoch = NextEpochDescriptor {
randomness: next_randoness,
randomness: next_randomness,
authorities: Self::next_authorities().into_inner(),
config: None,
};
+1 -1
View File
@@ -16,7 +16,7 @@ for the origin: namely `frame_system::Config::BaseCallFilter` for all origin
except root which will get no filter. And not the filter contained in origin
use to call `fn schedule`.
If a call is scheduled using proxy or whatever mecanism which adds filter,
If a call is scheduled using proxy or whatever mechanism which adds filter,
then those filter will not be used when dispatching the schedule call.
## Interface
@@ -211,7 +211,7 @@ benchmarks! {
} verify {
}
// `execute_dispatch` when the origin is `Signed`, not counting the dispatable's weight.
// `execute_dispatch` when the origin is `Signed`, not counting the dispatchable's weight.
execute_dispatch_signed {
let mut counter = WeightMeter::new();
let origin = make_origin::<T>(true);
@@ -222,7 +222,7 @@ benchmarks! {
verify {
}
// `execute_dispatch` when the origin is not `Signed`, not counting the dispatable's weight.
// `execute_dispatch` when the origin is not `Signed`, not counting the dispatchable's weight.
execute_dispatch_unsigned {
let mut counter = WeightMeter::new();
let origin = make_origin::<T>(false);
+1 -1
View File
@@ -46,7 +46,7 @@
//! 1. Scheduling a runtime call at a specific block.
#![doc = docify::embed!("src/tests.rs", basic_scheduling_works)]
//!
//! 2. Scheduling a preimage hash of a runtime call at a specifc block
//! 2. Scheduling a preimage hash of a runtime call at a specific block
#![doc = docify::embed!("src/tests.rs", scheduling_with_preimages_works)]
//!
+2 -2
View File
@@ -1119,7 +1119,7 @@ fn reschedule_named_works() {
}
#[test]
fn reschedule_named_perodic_works() {
fn reschedule_named_periodic_works() {
new_test_ext().execute_with(|| {
let call =
RuntimeCall::Logger(LoggerCall::log { i: 42, weight: Weight::from_parts(10, 0) });
@@ -2980,7 +2980,7 @@ fn reschedule_named_last_task_removes_agenda() {
});
}
/// Ensures that an unvailable call sends an event.
/// Ensures that an unavailable call sends an event.
#[test]
fn unavailable_call_is_detected() {
use frame_support::traits::schedule::v3::Named;
+4 -4
View File
@@ -1509,7 +1509,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
// the Founder.
if MemberCount::<T, I>::get() > 2 {
let defender = next_defender
.or_else(|| Self::pick_defendent(rng))
.or_else(|| Self::pick_defendant(rng))
.expect("exited if members empty; qed");
let skeptic =
Self::pick_member_except(rng, &defender).expect("exited if members empty; qed");
@@ -1871,7 +1871,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
///
/// If only the Founder and Head members exist (or the state is inconsistent), then `None`
/// may be returned.
fn pick_defendent(rng: &mut impl RngCore) -> Option<T::AccountId> {
fn pick_defendant(rng: &mut impl RngCore) -> Option<T::AccountId> {
let member_count = MemberCount::<T, I>::get();
if member_count <= 2 {
return None
@@ -1976,7 +1976,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
/// Transfer some `amount` from the main account into the payouts account and reduce the Pot
/// by this amount.
fn reserve_payout(amount: BalanceOf<T, I>) {
// Tramsfer payout from the Pot into the payouts account.
// Transfer payout from the Pot into the payouts account.
Pot::<T, I>::mutate(|pot| pot.saturating_reduce(amount));
// this should never fail since we ensure we can afford the payouts in a previous
@@ -1988,7 +1988,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
/// Transfer some `amount` from the main account into the payouts account and increase the Pot
/// by this amount.
fn unreserve_payout(amount: BalanceOf<T, I>) {
// Tramsfer payout from the Pot into the payouts account.
// Transfer payout from the Pot into the payouts account.
Pot::<T, I>::mutate(|pot| pot.saturating_accrue(amount));
// this should never fail since we ensure we can afford the payouts in a previous
+4 -4
View File
@@ -240,7 +240,7 @@ pub fn assert_internal_consistency<T: Config<I>, I: Instance + 'static>() {
pub fn from_original<T: Config<I>, I: Instance + 'static>(
past_payouts: &mut [(<T as frame_system::Config>::AccountId, BalanceOf<T, I>)],
) -> Result<Weight, &'static str> {
// Migrate Bids from old::Bids (just a trunctation).
// Migrate Bids from old::Bids (just a truncation).
Bids::<T, I>::put(BoundedVec::<_, T::MaxBids>::truncate_from(v0::Bids::<T, I>::take()));
// Initialise round counter.
@@ -287,13 +287,13 @@ pub fn from_original<T: Config<I>, I: Instance + 'static>(
.defensive_ok_or("member_count > 0, we must have at least 1 member")?;
// Swap the founder with the first member in MemberByIndex.
MemberByIndex::<T, I>::swap(0, member_count);
// Update the indicies of the swapped member MemberRecords.
// Update the indices of the swapped member MemberRecords.
Members::<T, I>::mutate(&member, |m| {
if let Some(member) = m {
member.index = 0;
} else {
frame_support::defensive!(
"Member somehow disapeared from storage after it was inserted"
"Member somehow disappeared from storage after it was inserted"
);
}
});
@@ -302,7 +302,7 @@ pub fn from_original<T: Config<I>, I: Instance + 'static>(
member.index = member_count;
} else {
frame_support::defensive!(
"Member somehow disapeared from storage after it was queried"
"Member somehow disappeared from storage after it was queried"
);
}
});
+1 -1
View File
@@ -541,7 +541,7 @@ fn suspended_candidate_rejected_works() {
assert_ok!(Society::vote(Origin::signed(30), x, true));
}
// Voting continues, as no canidate is clearly accepted yet and the founder chooses not to
// Voting continues, as no candidate is clearly accepted yet and the founder chooses not to
// act.
conclude_intake(false, None);
assert_eq!(members(), vec![10, 20, 30]);
+1 -1
View File
@@ -130,7 +130,7 @@ impl<T: Config> StakingLedger<T> {
// if ledger bond is in a bad state, return error to prevent applying operations that may
// further spoil the ledger's state. A bond is in bad state when the bonded controller is
// associted with a different ledger (i.e. a ledger with a different stash).
// associated with a different ledger (i.e. a ledger with a different stash).
//
// See <https://github.com/paritytech/polkadot-sdk/issues/3245> for more details.
ensure!(
+1 -1
View File
@@ -30,7 +30,7 @@ use frame_support::ensure;
#[cfg(feature = "try-runtime")]
use sp_runtime::TryRuntimeError;
/// Used for release versioning upto v12.
/// Used for release versioning up to v12.
///
/// Obsolete from v13. Keeping around to make encoding/decoding of old migration code easier.
#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
+2 -2
View File
@@ -1906,7 +1906,7 @@ impl<T: Config> Pallet<T> {
/// Invariants:
/// * A bonded ledger should always have an assigned `Payee`.
/// * The number of entries in `Payee` and of bonded staking ledgers *must* match.
/// * The stash account in the ledger must match that of the bonded acount.
/// * The stash account in the ledger must match that of the bonded account.
fn check_payees() -> Result<(), TryRuntimeError> {
for (stash, _) in Bonded::<T>::iter() {
ensure!(Payee::<T>::get(&stash).is_some(), "bonded ledger does not have payee set");
@@ -1947,7 +1947,7 @@ impl<T: Config> Pallet<T> {
/// Invariants:
/// * `ledger.controller` is not stored in the storage (but populated at retrieval).
/// * Stake consistency: ledger.total == ledger.active + sum(ledger.unlocking).
/// * The controller keyeing the ledger and the ledger stash matches the state of the `Bonded`
/// * The controller keying the ledger and the ledger stash matches the state of the `Bonded`
/// storage.
fn check_ledgers() -> Result<(), TryRuntimeError> {
Bonded::<T>::iter()
+4 -4
View File
@@ -54,7 +54,7 @@ use crate::{
};
// The speculative number of spans are used as an input of the weight annotation of
// [`Call::unbond`], as the post dipatch weight may depend on the number of slashing span on the
// [`Call::unbond`], as the post dispatch weight may depend on the number of slashing span on the
// account which is not provided as an input. The value set should be conservative but sensible.
pub(crate) const SPECULATIVE_NUM_SPANS: u32 = 32;
@@ -1134,7 +1134,7 @@ pub mod pallet {
/// this call results in a complete removal of all the data related to the stash account.
/// In this case, the `num_slashing_spans` must be larger or equal to the number of
/// slashing spans associated with the stash account in the [`SlashingSpans`] storage type,
/// otherwise the call will fail. The call weight is directly propotional to
/// otherwise the call will fail. The call weight is directly proportional to
/// `num_slashing_spans`.
///
/// ## Complexity
@@ -1376,7 +1376,7 @@ pub mod pallet {
Ok(())
}
/// Increments the ideal number of validators upto maximum of
/// Increments the ideal number of validators up to maximum of
/// `ElectionProviderBase::MaxWinners`.
///
/// The dispatch origin must be Root.
@@ -1401,7 +1401,7 @@ pub mod pallet {
Ok(())
}
/// Scale up the ideal number of validators by a factor upto maximum of
/// Scale up the ideal number of validators by a factor up to maximum of
/// `ElectionProviderBase::MaxWinners`.
///
/// The dispatch origin must be Root.
+5 -5
View File
@@ -270,7 +270,7 @@ fn change_controller_works() {
assert_eq!(ledger.controller(), Some(stash));
// the raw storage ledger's controller is always `None`. however, we can still fetch the
// correct controller with `ledger.controler()`.
// correct controller with `ledger.controller()`.
let raw_ledger = <Ledger<Test>>::get(&stash).unwrap();
assert_eq!(raw_ledger.controller, None);
@@ -1257,7 +1257,7 @@ fn bond_extra_controller_bad_state_works() {
Bonded::<Test>::insert(31, 41);
// we confirm that the ledger is in bad state: 31 has 41 as controller and when fetching
// the ledger associated with the controler 41, its stash is 41 (and not 31).
// the ledger associated with the controller 41, its stash is 41 (and not 31).
assert_eq!(Ledger::<Test>::get(41).unwrap().stash, 41);
// if the ledger is in this bad state, the `bond_extra` should fail.
@@ -1815,7 +1815,7 @@ fn max_staked_rewards_works() {
let total_payout = treasury_payout + validators_payout;
// max stakers payout (without max staked rewards cap applied) is larger than the final
// validator rewards. The final payment and remainder should be adjusted by redestributing
// validator rewards. The final payment and remainder should be adjusted by redistributing
// the era inflation to apply the cap...
assert!(max_stakers_payout > validators_payout);
@@ -4686,7 +4686,7 @@ fn bond_during_era_does_not_populate_legacy_claimed_rewards() {
}
);
// make sure only era upto history depth is stored
// make sure only era up to history depth is stored
let current_era = 99;
mock::start_active_era(current_era);
bond_validator(13, 1000);
@@ -5412,7 +5412,7 @@ mod election_data_provider {
Event::SnapshotVotersSizeExceeded { size: 75 }
);
// however, if the election voter size bounds were largers, the snapshot would
// however, if the election voter size bounds were larger, the snapshot would
// include the electing voters of 70.
let bounds = ElectionBoundsBuilder::default().voters_size(1_000.into()).build();
assert_eq!(
+1 -1
View File
@@ -38,7 +38,7 @@
//! In Substrate blockchains, pallets may contain dispatchable calls that can only be called at
//! the system level of the chain (i.e. dispatchables that require a `Root` origin).
//! Setting a privileged account, called the _sudo key_, allows you to make such calls as an
//! extrinisic.
//! extrinsic.
//!
//! Here's an example of a privileged function in another pallet:
//!
@@ -249,7 +249,7 @@ impl BenchmarkCallDef {
}
}
/// Represents a parsed `#[benchmark]` or `#[instance_banchmark]` item.
/// Represents a parsed `#[benchmark]` or `#[instance_benchmark]` item.
#[derive(Clone)]
struct BenchmarkDef {
params: Vec<ParamDef>,
@@ -466,7 +466,7 @@ pub fn benchmarks(
let mod_vis = module.vis;
let mod_name = module.ident;
// consume #[benchmarks] attribute by exclusing it from mod_attrs
// consume #[benchmarks] attribute by excluding it from mod_attrs
let mod_attrs: Vec<&Attribute> = module
.attrs
.iter()
@@ -24,7 +24,7 @@
//! - Implicitly: `System: frame_system`
//! - Explicitly: `System: frame_system::{Pallet, Call}`
//!
//! The `construct_runtime` transitions from the implicit definition to the explict one.
//! The `construct_runtime` transitions from the implicit definition to the explicit one.
//! From the explicit state, Substrate expands the pallets with additional information
//! that is to be included in the runtime metadata. This expansion makes visible some extra
//! parts of the pallets, mainly the `Error` if defined. The expanded state looks like
@@ -55,7 +55,7 @@
//! +----------+ +------------------+
//! ```
//!
//! When all pallet parts are implcit, then the `construct_runtime!` macro expands to its final
//! When all pallet parts are implicit, then the `construct_runtime!` macro expands to its final
//! state, the `ExplicitExpanded`. Otherwise, all implicit parts are converted to an explicit
//! expanded part allow the `construct_runtime!` to expand any remaining explicit parts to an
//! explicit expanded part.
@@ -202,7 +202,7 @@
//! Similarly to the previous transition, the macro expansion transforms `System:
//! frame_system::{Pallet, Call}` into `System: frame_system expanded::{Error} ::{Pallet, Call}`.
//! The `expanded` section adds extra parts that the Substrate would like to expose for each pallet
//! by default. This is done to expose the approprite types for metadata construction.
//! by default. This is done to expose the appropriate types for metadata construction.
//!
//! This time, instead of calling `tt_default_parts` we are using the `tt_extra_parts` macro.
//! This macro returns the ` :: expanded { Error }` list of additional parts we would like to
@@ -322,7 +322,7 @@ impl Parse for PalletDeclaration {
/// A struct representing a path to a pallet. `PalletPath` is almost identical to the standard
/// Rust path with a few restrictions:
/// - No leading colons allowed
/// - Path segments can only consist of identifers separated by colons
/// - Path segments can only consist of identifiers separated by colons
#[derive(Debug, Clone)]
pub struct PalletPath {
pub inner: Path,
@@ -595,7 +595,7 @@ pub struct Pallet {
pub is_expanded: bool,
/// The name of the pallet, e.g.`System` in `System: frame_system`.
pub name: Ident,
/// Either automatically infered, or defined (e.g. `MyPallet ... = 3,`).
/// Either automatically inferred, or defined (e.g. `MyPallet ... = 3,`).
pub index: u8,
/// The path of the pallet, e.g. `frame_system` in `System: frame_system`.
pub path: PalletPath,
@@ -634,7 +634,7 @@ impl Pallet {
/// +----------+ +----------+ +------------------+
/// ```
enum PalletsConversion {
/// Pallets implicitely declare parts.
/// Pallets implicitly declare parts.
///
/// `System: frame_system`.
Implicit(Vec<PalletDeclaration>),
@@ -648,7 +648,7 @@ enum PalletsConversion {
/// Pallets explicitly declare parts that are fully expanded.
///
/// This is the end state that contains extra parts included by
/// default by Subtrate.
/// default by Substrate.
///
/// `System: frame_system expanded::{Error} ::{Pallet, Call}`
///
@@ -660,7 +660,7 @@ enum PalletsConversion {
///
/// Check if all pallet have explicit declaration of their parts, if so then assign index to each
/// pallet using same rules as rust for fieldless enum. I.e. implicit are assigned number
/// incrementedly from last explicit or 0.
/// incrementally from last explicit or 0.
fn convert_pallets(pallets: Vec<PalletDeclaration>) -> syn::Result<PalletsConversion> {
if pallets.iter().any(|pallet| pallet.pallet_parts.is_none()) {
return Ok(PalletsConversion::Implicit(pallets))
@@ -279,7 +279,7 @@ fn test_runtime_type_with_doc() {
}
#[test]
fn test_disambugation_path() {
fn test_disambiguation_path() {
let foreign_impl: ItemImpl = parse_quote!(impl SomeTrait for SomeType {});
let default_impl_path: Path = parse_quote!(SomeScope::SomeType);
@@ -147,8 +147,8 @@ fn ensure_codec_index(attrs: &Vec<syn::Attribute>, span: Span) -> Result<()> {
/// Used to inject arguments into the inner `#[dynamic_pallet_params(..)]` attribute.
///
/// This allows the outer `#[dynamic_params(..)]` attribute to specify some arguments that dont need
/// to be repeated every time.
/// This allows the outer `#[dynamic_params(..)]` attribute to specify some arguments that don't
/// need to be repeated every time.
struct MacroInjectArgs {
runtime_params: syn::Ident,
params_pallet: syn::Type,
@@ -311,7 +311,7 @@ impl ToTokens for DynamicPalletParamAttr {
)*
}
impl #scrate::traits::dynamic_params::AggregratedKeyValue for Parameters {
impl #scrate::traits::dynamic_params::AggregatedKeyValue for Parameters {
type Key = #key_ident;
type Value = #value_ident;
@@ -497,7 +497,7 @@ impl ToTokens for DynamicParamAggregatedEnum {
#vis enum #params_key_ident {
#(
#(#attributes)*
#param_names(<#param_types as #scrate::traits::dynamic_params::AggregratedKeyValue>::Key),
#param_names(<#param_types as #scrate::traits::dynamic_params::AggregatedKeyValue>::Key),
)*
}
@@ -515,11 +515,11 @@ impl ToTokens for DynamicParamAggregatedEnum {
#vis enum #params_value_ident {
#(
#(#attributes)*
#param_names(<#param_types as #scrate::traits::dynamic_params::AggregratedKeyValue>::Value),
#param_names(<#param_types as #scrate::traits::dynamic_params::AggregatedKeyValue>::Value),
)*
}
impl #scrate::traits::dynamic_params::AggregratedKeyValue for #name {
impl #scrate::traits::dynamic_params::AggregatedKeyValue for #name {
type Key = #params_key_ident;
type Value = #params_value_ident;
@@ -536,13 +536,13 @@ impl ToTokens for DynamicParamAggregatedEnum {
}
#(
impl ::core::convert::From<<#param_types as #scrate::traits::dynamic_params::AggregratedKeyValue>::Key> for #params_key_ident {
fn from(key: <#param_types as #scrate::traits::dynamic_params::AggregratedKeyValue>::Key) -> Self {
impl ::core::convert::From<<#param_types as #scrate::traits::dynamic_params::AggregatedKeyValue>::Key> for #params_key_ident {
fn from(key: <#param_types as #scrate::traits::dynamic_params::AggregatedKeyValue>::Key) -> Self {
#params_key_ident::#param_names(key)
}
}
impl ::core::convert::TryFrom<#params_value_ident> for <#param_types as #scrate::traits::dynamic_params::AggregratedKeyValue>::Value {
impl ::core::convert::TryFrom<#params_value_ident> for <#param_types as #scrate::traits::dynamic_params::AggregatedKeyValue>::Value {
type Error = ();
fn try_from(value: #params_value_ident) -> Result<Self, Self::Error> {
@@ -137,7 +137,7 @@ fn counter_prefix(prefix: &str) -> String {
/// - `Call` - If the pallet has callable functions
/// - `Storage` - If the pallet uses storage
/// - `Event` or `Event<T>` (if the event is generic) - If the pallet emits events
/// - `Origin` or `Origin<T>` (if the origin is generic) - If the pallet has instanciable origins
/// - `Origin` or `Origin<T>` (if the origin is generic) - If the pallet has instantiable origins
/// - `Config` or `Config<T>` (if the config is generic) - If the pallet builds the genesis
/// storage with `GenesisConfig`
/// - `Inherent` - If the pallet provides/can check inherents.
@@ -166,7 +166,7 @@ fn counter_prefix(prefix: &str) -> String {
/// and `Event` are encoded, and to define the ModuleToIndex value.
///
/// if `= $n` is not given, then index is resolved in the same way as fieldless enum in Rust
/// (i.e. incrementedly from previous index):
/// (i.e. incrementally from previous index):
/// ```nocompile
/// pallet1 .. = 2,
/// pallet2 .., // Here pallet2 is given index 3
@@ -460,7 +460,7 @@ pub fn storage_alias(attributes: TokenStream, input: TokenStream) -> TokenStream
}
/// This attribute can be used to derive a full implementation of a trait based on a local partial
/// impl and an external impl containing defaults that can be overriden in the local impl.
/// impl and an external impl containing defaults that can be overridden in the local impl.
///
/// For a full end-to-end example, see [below](#use-case-auto-derive-test-pallet-config-traits).
///
@@ -321,7 +321,7 @@ impl Def {
Ok(())
}
/// Tries to locate a manual tasks impl (an impl impling a trait whose last path segment is
/// Tries to locate a manual tasks impl (an impl implementing a trait whose last path segment is
/// `Task`) in the event that one has not been found already via the attribute macro
pub fn resolve_manual_tasks_impl(
tasks: &mut Option<tasks::TasksDef>,
@@ -18,7 +18,7 @@
//! Provides functions to interact with the dispatch context.
//!
//! A Dispatch context is created by calling [`run_in_context`] and then the given closure will be
//! executed in this dispatch context. Everyting run in this `closure` will have access to the same
//! executed in this dispatch context. Everything run in this `closure` will have access to the same
//! dispatch context. This also applies to nested calls of [`run_in_context`]. The dispatch context
//! can be used to store and retrieve information locally in this context. The dispatch context can
//! be accessed by using [`with_context`]. This function will execute the given closure and give it
@@ -51,7 +51,7 @@
//!
//! run_in_context(|| {
//! with_context::<CustomContext, _>(|v| {
//! // Intitialize the value to the default value.
//! // Initialize the value to the default value.
//! assert_eq!(0, v.or_default().0);
//! v.or_default().0 = 10;
//! });
+16 -16
View File
@@ -31,83 +31,83 @@
//! NOTE: [`frame_support::pallet`] will reexport them inside the module, in order to make them
//! accessible to [`frame_support::construct_runtime`].
/// `Instance1` to be used for instantiable palllets defined with the
/// `Instance1` to be used for instantiable pallets defined with the
/// [`#[pallet]`](`frame_support::pallet`) macro. Instances 2-16 are also available but are hidden
/// from docs.
#[derive(Clone, Copy, PartialEq, Eq, crate::RuntimeDebugNoBound)]
pub struct Instance1;
/// `Instance2` to be used for instantiable palllets defined with the `#[pallet]` macro.
/// `Instance2` to be used for instantiable pallets defined with the `#[pallet]` macro.
#[doc(hidden)]
#[derive(Clone, Copy, PartialEq, Eq, crate::RuntimeDebugNoBound)]
pub struct Instance2;
/// `Instance3` to be used for instantiable palllets defined with the `#[pallet]` macro.
/// `Instance3` to be used for instantiable pallets defined with the `#[pallet]` macro.
#[doc(hidden)]
#[derive(Clone, Copy, PartialEq, Eq, crate::RuntimeDebugNoBound)]
pub struct Instance3;
/// `Instance4` to be used for instantiable palllets defined with the `#[pallet]` macro.
/// `Instance4` to be used for instantiable pallets defined with the `#[pallet]` macro.
#[doc(hidden)]
#[derive(Clone, Copy, PartialEq, Eq, crate::RuntimeDebugNoBound)]
pub struct Instance4;
/// `Instance5` to be used for instantiable palllets defined with the `#[pallet]` macro.
/// `Instance5` to be used for instantiable pallets defined with the `#[pallet]` macro.
#[doc(hidden)]
#[derive(Clone, Copy, PartialEq, Eq, crate::RuntimeDebugNoBound)]
pub struct Instance5;
/// `Instance6` to be used for instantiable palllets defined with the `#[pallet]` macro.
/// `Instance6` to be used for instantiable pallets defined with the `#[pallet]` macro.
#[doc(hidden)]
#[derive(Clone, Copy, PartialEq, Eq, crate::RuntimeDebugNoBound)]
pub struct Instance6;
/// `Instance7` to be used for instantiable palllets defined with the `#[pallet]` macro.
/// `Instance7` to be used for instantiable pallets defined with the `#[pallet]` macro.
#[doc(hidden)]
#[derive(Clone, Copy, PartialEq, Eq, crate::RuntimeDebugNoBound)]
pub struct Instance7;
/// `Instance8` to be used for instantiable palllets defined with the `#[pallet]` macro.
/// `Instance8` to be used for instantiable pallets defined with the `#[pallet]` macro.
#[doc(hidden)]
#[derive(Clone, Copy, PartialEq, Eq, crate::RuntimeDebugNoBound)]
pub struct Instance8;
/// `Instance9` to be used for instantiable palllets defined with the `#[pallet]` macro.
/// `Instance9` to be used for instantiable pallets defined with the `#[pallet]` macro.
#[doc(hidden)]
#[derive(Clone, Copy, PartialEq, Eq, crate::RuntimeDebugNoBound)]
pub struct Instance9;
/// `Instance10` to be used for instantiable palllets defined with the `#[pallet]` macro.
/// `Instance10` to be used for instantiable pallets defined with the `#[pallet]` macro.
#[doc(hidden)]
#[derive(Clone, Copy, PartialEq, Eq, crate::RuntimeDebugNoBound)]
pub struct Instance10;
/// `Instance11` to be used for instantiable palllets defined with the `#[pallet]` macro.
/// `Instance11` to be used for instantiable pallets defined with the `#[pallet]` macro.
#[doc(hidden)]
#[derive(Clone, Copy, PartialEq, Eq, crate::RuntimeDebugNoBound)]
pub struct Instance11;
/// `Instance12` to be used for instantiable palllets defined with the `#[pallet]` macro.
/// `Instance12` to be used for instantiable pallets defined with the `#[pallet]` macro.
#[doc(hidden)]
#[derive(Clone, Copy, PartialEq, Eq, crate::RuntimeDebugNoBound)]
pub struct Instance12;
/// `Instance13` to be used for instantiable palllets defined with the `#[pallet]` macro.
/// `Instance13` to be used for instantiable pallets defined with the `#[pallet]` macro.
#[doc(hidden)]
#[derive(Clone, Copy, PartialEq, Eq, crate::RuntimeDebugNoBound)]
pub struct Instance13;
/// `Instance14` to be used for instantiable palllets defined with the `#[pallet]` macro.
/// `Instance14` to be used for instantiable pallets defined with the `#[pallet]` macro.
#[doc(hidden)]
#[derive(Clone, Copy, PartialEq, Eq, crate::RuntimeDebugNoBound)]
pub struct Instance14;
/// `Instance15` to be used for instantiable palllets defined with the `#[pallet]` macro.
/// `Instance15` to be used for instantiable pallets defined with the `#[pallet]` macro.
#[doc(hidden)]
#[derive(Clone, Copy, PartialEq, Eq, crate::RuntimeDebugNoBound)]
pub struct Instance15;
/// `Instance16` to be used for instantiable palllets defined with the `#[pallet]` macro.
/// `Instance16` to be used for instantiable pallets defined with the `#[pallet]` macro.
#[doc(hidden)]
#[derive(Clone, Copy, PartialEq, Eq, crate::RuntimeDebugNoBound)]
pub struct Instance16;
+6 -6
View File
@@ -145,7 +145,7 @@ impl TypeId for PalletId {
/// # Examples
///
/// There are different ways to declare the `prefix` to use. The `prefix` type can either be
/// declared explicetly by passing it to the macro as an attribute or by letting the macro
/// declared explicitly by passing it to the macro as an attribute or by letting the macro
/// guess on what the `prefix` type is. The `prefix` is always passed as the first generic
/// argument to the type declaration. When using [`#[pallet::storage]`](pallet_macros::storage)
/// this first generic argument is always `_`. Besides declaring the `prefix`, the rest of the
@@ -1110,7 +1110,7 @@ pub mod pallet_macros {
/// Declares a storage as unbounded in potential size.
///
/// When implementating the storage info (when `#[pallet::generate_storage_info]` is
/// When implementing the storage info (when `#[pallet::generate_storage_info]` is
/// specified on the pallet struct placeholder), the size of the storage will be declared
/// as unbounded. This can be useful for storage which can never go into PoV (Proof of
/// Validity).
@@ -2340,7 +2340,7 @@ pub mod pallet_macros {
/// Allows defining conditions for a task to run.
///
/// This attribute is attached to a function inside an `impl` block annoated with
/// This attribute is attached to a function inside an `impl` block annotated with
/// [`pallet::tasks_experimental`](`tasks_experimental`) to define the conditions for a
/// given work item to be valid.
///
@@ -2351,7 +2351,7 @@ pub mod pallet_macros {
/// Allows defining an index for a task.
///
/// This attribute is attached to a function inside an `impl` block annoated with
/// This attribute is attached to a function inside an `impl` block annotated with
/// [`pallet::tasks_experimental`](`tasks_experimental`) to define the index of a given
/// work item.
///
@@ -2361,7 +2361,7 @@ pub mod pallet_macros {
/// Allows defining an iterator over available work items for a task.
///
/// This attribute is attached to a function inside an `impl` block annoated with
/// This attribute is attached to a function inside an `impl` block annotated with
/// [`pallet::tasks_experimental`](`tasks_experimental`).
///
/// It takes an iterator as input that yields a tuple with same types as the function
@@ -2370,7 +2370,7 @@ pub mod pallet_macros {
/// Allows defining the weight of a task.
///
/// This attribute is attached to a function inside an `impl` block annoated with
/// This attribute is attached to a function inside an `impl` block annotated with
/// [`pallet::tasks_experimental`](`tasks_experimental`) define the weight of a given work
/// item.
///
@@ -303,11 +303,11 @@ pub fn take_storage_item<K: Encode + Sized, T: Decode + Sized, H: StorageHasher>
/// Move a storage from a pallet prefix to another pallet prefix.
///
/// Keys used in pallet storages always start with:
/// `concat(twox_128(pallet_name), towx_128(storage_name))`.
/// `concat(twox_128(pallet_name), twox_128(storage_name))`.
///
/// This function will remove all value for which the key start with
/// `concat(twox_128(old_pallet_name), towx_128(storage_name))` and insert them at the key with
/// the start replaced by `concat(twox_128(new_pallet_name), towx_128(storage_name))`.
/// `concat(twox_128(old_pallet_name), twox_128(storage_name))` and insert them at the key with
/// the start replaced by `concat(twox_128(new_pallet_name), twox_128(storage_name))`.
///
/// # Example
///
@@ -339,7 +339,7 @@ pub fn move_storage_from_pallet(
/// Move all storages from a pallet prefix to another pallet prefix.
///
/// Keys used in pallet storages always start with:
/// `concat(twox_128(pallet_name), towx_128(storage_name))`.
/// `concat(twox_128(pallet_name), twox_128(storage_name))`.
///
/// This function will remove all value for which the key start with `twox_128(old_pallet_name)`
/// and insert them at the key with the start replaced by `twox_128(new_pallet_name)`.
+11 -10
View File
@@ -159,7 +159,7 @@ pub trait StorageValue<T: FullCodec> {
///
/// # Warning
///
/// `None` does not mean that `get()` does not return a value. The default value is completly
/// `None` does not mean that `get()` does not return a value. The default value is completely
/// ignored by this function.
fn decode_len() -> Option<usize>
where
@@ -363,7 +363,7 @@ pub trait StorageMap<K: FullEncode, V: FullCodec> {
///
/// # Warning
///
/// `None` does not mean that `get()` does not return a value. The default value is completly
/// `None` does not mean that `get()` does not return a value. The default value is completely
/// ignored by this function.
fn decode_len<KeyArg: EncodeLike<K>>(key: KeyArg) -> Option<usize>
where
@@ -381,7 +381,8 @@ pub trait StorageMap<K: FullEncode, V: FullCodec> {
///
/// # Warning
///
/// - `None` does not mean that `get()` does not return a value. The default value is completly
/// - `None` does not mean that `get()` does not return a value. The default value is
/// completely
/// ignored by this function.
///
/// - The value returned is the non-deduplicated length of the underlying Vector in storage.This
@@ -410,7 +411,7 @@ pub trait StorageMap<K: FullEncode, V: FullCodec> {
pub trait IterableStorageMap<K: FullEncode, V: FullCodec>: StorageMap<K, V> {
/// The type that iterates over all `(key, value)`.
type Iterator: Iterator<Item = (K, V)>;
/// The type that itereates over all `key`s.
/// The type that iterates over all `key`s.
type KeyIterator: Iterator<Item = K>;
/// Enumerate all elements in the map in lexicographical order of the encoded key. If you
@@ -777,7 +778,7 @@ pub trait StorageDoubleMap<K1: FullEncode, K2: FullEncode, V: FullCodec> {
///
/// # Warning
///
/// `None` does not mean that `get()` does not return a value. The default value is completly
/// `None` does not mean that `get()` does not return a value. The default value is completely
/// ignored by this function.
fn decode_len<KArg1, KArg2>(key1: KArg1, key2: KArg2) -> Option<usize>
where
@@ -798,7 +799,7 @@ pub trait StorageDoubleMap<K1: FullEncode, K2: FullEncode, V: FullCodec> {
///
/// # Warning
///
/// `None` does not mean that `get()` does not return a value. The default value is completly
/// `None` does not mean that `get()` does not return a value. The default value is completely
/// ignored by this function.
fn decode_non_dedup_len<KArg1, KArg2>(key1: KArg1, key2: KArg2) -> Option<usize>
where
@@ -980,7 +981,7 @@ pub trait StorageNMap<K: KeyGenerator, V: FullCodec> {
///
/// # Warning
///
/// `None` does not mean that `get()` does not return a value. The default value is completly
/// `None` does not mean that `get()` does not return a value. The default value is completely
/// ignored by this function.
fn decode_len<KArg: EncodeLikeTuple<K::KArg> + TupleToEncodedIter>(key: KArg) -> Option<usize>
where
@@ -1488,8 +1489,8 @@ pub trait StorageDecodeLength: private::Sealed + codec::DecodeLength {
}
}
/// It is expected that the length is at the beginning of the encoded objectand that the length is a
/// `Compact<u32>`.
/// It is expected that the length is at the beginning of the encoded object and that the length is
/// a `Compact<u32>`.
///
/// # Note
/// The length returned by this trait is not deduplicated, i.e. it is the length of the underlying
@@ -1790,7 +1791,7 @@ mod test {
});
}
// This test ensures that the Digest encoding does not change without being noticied.
// This test ensures that the Digest encoding does not change without being noticed.
#[test]
fn digest_storage_append_works_as_expected() {
TestExternalities::default().execute_with(|| {
@@ -217,7 +217,7 @@ const STORAGE_INPUT_BUFFER_CAPACITY: usize = 2 * 1024;
/// Implementation of [`codec::Input`] using [`sp_io::storage::read`].
///
/// Keeps an internal buffer with a size of [`STORAGE_INPUT_BUFFER_CAPACITY`]. All read accesses
/// are tried to be served by this buffer. If the buffer doesn't hold enough bytes to fullfill the
/// are tried to be served by this buffer. If the buffer doesn't hold enough bytes to fulfill the
/// current read access, the buffer is re-filled from the state. A read request that is bigger than
/// the internal buffer is directly forwarded to the state to reduce the number of reads from the
/// state.

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