Fix typos in pallet-contracts (#13629)

* Fix typos in pallet-contracts
This commit is contained in:
PG Herveou
2023-03-17 16:31:51 +01:00
committed by GitHub
parent 5378c64c39
commit f5773795e9
14 changed files with 37 additions and 37 deletions
+2 -2
View File
@@ -594,7 +594,7 @@ impl<BlockHash: Hash, Key: Hash, D: MetaDb> StateDb<BlockHash, Key, D> {
} }
/// Prevents pruning of specified block and its descendants. /// Prevents pruning of specified block and its descendants.
/// `hint` used for futher checking if the given block exists /// `hint` used for further checking if the given block exists
pub fn pin<F>(&self, hash: &BlockHash, number: u64, hint: F) -> Result<(), PinError> pub fn pin<F>(&self, hash: &BlockHash, number: u64, hint: F) -> Result<(), PinError>
where where
F: Fn() -> bool, F: Fn() -> bool,
@@ -665,7 +665,7 @@ pub enum IsPruned {
Pruned, Pruned,
/// Definitely not pruned /// Definitely not pruned
NotPruned, NotPruned,
/// May or may not pruned, need futher checking /// May or may not pruned, need further checking
MaybePruned, MaybePruned,
} }
+1 -1
View File
@@ -64,7 +64,7 @@ When setting up the `Schedule` for your runtime make sure to set `InstructionWei
to a non zero value. The default is `0` and prevents the upload of any non deterministic code. to a non zero value. The default is `0` and prevents the upload of any non deterministic code.
An indeterministic code can be deployed on-chain by passing `Determinism::AllowIndeterministic` An indeterministic code can be deployed on-chain by passing `Determinism::AllowIndeterministic`
to `upload_code`. A determinstic contract can then delegate call into it if and only if it to `upload_code`. A deterministic contract can then delegate call into it if and only if it
is ran by using `bare_call` and passing `Determinism::AllowIndeterministic` to it. **Never use is ran by using `bare_call` and passing `Determinism::AllowIndeterministic` to it. **Never use
this argument when the contract is called from an on-chain transaction.** this argument when the contract is called from an on-chain transaction.**
@@ -131,7 +131,7 @@ pub struct InstantiateReturnValue<AccountId> {
pub account_id: AccountId, pub account_id: AccountId,
} }
/// The result of succesfully uploading a contract. /// The result of successfully uploading a contract.
#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)] #[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)]
pub struct CodeUploadReturnValue<CodeHash, Balance> { pub struct CodeUploadReturnValue<CodeHash, Balance> {
/// The key under which the new code is stored. /// The key under which the new code is stored.
@@ -239,7 +239,7 @@ where
} }
} }
/// If the amount of deposit (this type) is constrained by a `limit` this calcuates how /// If the amount of deposit (this type) is constrained by a `limit` this calculates how
/// much balance (if any) is still available from this limit. /// much balance (if any) is still available from this limit.
/// ///
/// # Note /// # Note
@@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//! Procedural macroses used in the contracts module. //! Procedural macros used in the contracts module.
//! //!
//! Most likely you should use the [`#[define_env]`][`macro@define_env`] attribute macro which hides //! Most likely you should use the [`#[define_env]`][`macro@define_env`] attribute macro which hides
//! boilerplate of defining external environment for a wasm module. //! boilerplate of defining external environment for a wasm module.
@@ -527,7 +527,7 @@ fn expand_docs(def: &EnvDef) -> TokenStream2 {
} }
} }
/// Expands environment definiton. /// Expands environment definition.
/// Should generate source code for: /// Should generate source code for:
/// - implementations of the host functions to be added to the wasm runtime environment (see /// - implementations of the host functions to be added to the wasm runtime environment (see
/// `expand_impls()`). /// `expand_impls()`).
@@ -778,7 +778,7 @@ fn expand_functions(def: &EnvDef, expand_blocks: bool, host_state: TokenStream2)
#[proc_macro_attribute] #[proc_macro_attribute]
pub fn define_env(attr: TokenStream, item: TokenStream) -> TokenStream { pub fn define_env(attr: TokenStream, item: TokenStream) -> TokenStream {
if !attr.is_empty() && !(attr.to_string() == "doc".to_string()) { if !attr.is_empty() && !(attr.to_string() == "doc".to_string()) {
let msg = r#"Invalid `define_env` attribute macro: expected either no attributes or a single `doc` attibute: let msg = r#"Invalid `define_env` attribute macro: expected either no attributes or a single `doc` attribute:
- `#[define_env]` - `#[define_env]`
- `#[define_env(doc)]`"#; - `#[define_env(doc)]`"#;
let span = TokenStream2::from(attr).span(); let span = TokenStream2::from(attr).span();
+1 -1
View File
@@ -32,7 +32,7 @@ use sp_runtime::traits::{Hash, TrailingZeroInput};
pub trait AddressGenerator<T: Config> { pub trait AddressGenerator<T: Config> {
/// The address of a contract based on the given instantiate parameters. /// The address of a contract based on the given instantiate parameters.
/// ///
/// Changing the formular for an already deployed chain is fine as long as no collisons /// Changing the formular for an already deployed chain is fine as long as no collisions
/// with the old formular. Changes only affect existing contracts. /// with the old formular. Changes only affect existing contracts.
fn contract_address( fn contract_address(
deploying_address: &T::AccountId, deploying_address: &T::AccountId,
@@ -39,7 +39,7 @@ use wasm_instrument::{
}, },
}; };
/// The location where to put the genrated code. /// The location where to put the generated code.
pub enum Location { pub enum Location {
/// Generate all code into the `call` exported function. /// Generate all code into the `call` exported function.
Call, Call,
@@ -355,7 +355,7 @@ benchmarks! {
}: _(origin, callee, value, Weight::MAX, None, data) }: _(origin, callee, value, Weight::MAX, None, data)
verify { verify {
let deposit = T::Currency::free_balance(&deposit_account); let deposit = T::Currency::free_balance(&deposit_account);
// value and value transfered via call should be removed from the caller // value and value transferred via call should be removed from the caller
assert_eq!( assert_eq!(
T::Currency::free_balance(&instance.caller), T::Currency::free_balance(&instance.caller),
caller_funding::<T>() - instance.value - value - deposit - Pallet::<T>::min_balance(), caller_funding::<T>() - instance.value - value - deposit - Pallet::<T>::min_balance(),
@@ -2224,7 +2224,7 @@ benchmarks! {
// the same amount of time. We follow that `t.load` and `drop` both have the weight // the same amount of time. We follow that `t.load` and `drop` both have the weight
// of this benchmark / 2. We need to make this assumption because there is no way // of this benchmark / 2. We need to make this assumption because there is no way
// to measure them on their own using a valid wasm module. We need their individual // to measure them on their own using a valid wasm module. We need their individual
// values to derive the weight of individual instructions (by substraction) from // values to derive the weight of individual instructions (by subtraction) from
// benchmarks that include those for parameter pushing and return type dropping. // benchmarks that include those for parameter pushing and return type dropping.
// We call the weight of `t.load` and `drop`: `w_param`. // We call the weight of `t.load` and `drop`: `w_param`.
// The weight that would result from the respective benchmark we call: `w_bench`. // The weight that would result from the respective benchmark we call: `w_bench`.
@@ -3003,9 +3003,9 @@ benchmarks! {
sbox.invoke(); sbox.invoke();
} }
// This is no benchmark. It merely exist to have an easy way to pretty print the curently // This is no benchmark. It merely exist to have an easy way to pretty print the currently
// configured `Schedule` during benchmark development. // configured `Schedule` during benchmark development.
// It can be outputed using the following command: // It can be outputted using the following command:
// cargo run --manifest-path=bin/node/cli/Cargo.toml \ // cargo run --manifest-path=bin/node/cli/Cargo.toml \
// --features runtime-benchmarks -- benchmark pallet --extra --dev --execution=native \ // --features runtime-benchmarks -- benchmark pallet --extra --dev --execution=native \
// -p pallet_contracts -e print_schedule --no-median-slopes --no-min-squares // -p pallet_contracts -e print_schedule --no-median-slopes --no-min-squares
@@ -138,7 +138,7 @@ pub trait ChainExtension<C: Config> {
/// ///
/// # Note /// # Note
/// ///
/// Currently, we support tuples of up to ten registred chain extensions. If more chain extensions /// Currently, we support tuples of up to ten registered chain extensions. If more chain extensions
/// are needed consider opening an issue. /// are needed consider opening an issue.
pub trait RegisteredChainExtension<C: Config>: ChainExtension<C> { pub trait RegisteredChainExtension<C: Config>: ChainExtension<C> {
/// The extensions globally unique identifier. /// The extensions globally unique identifier.
+5 -5
View File
@@ -84,14 +84,14 @@ where
pub enum ErrorOrigin { pub enum ErrorOrigin {
/// Caller error origin. /// Caller error origin.
/// ///
/// The error happened in the current exeuction context rather than in the one /// The error happened in the current execution context rather than in the one
/// of the contract that is called into. /// of the contract that is called into.
Caller, Caller,
/// The error happened during execution of the called contract. /// The error happened during execution of the called contract.
Callee, Callee,
} }
/// Error returned by contract exection. /// Error returned by contract execution.
#[cfg_attr(test, derive(Debug, PartialEq))] #[cfg_attr(test, derive(Debug, PartialEq))]
pub struct ExecError { pub struct ExecError {
/// The reason why the execution failed. /// The reason why the execution failed.
@@ -2455,7 +2455,7 @@ mod tests {
#[test] #[test]
fn in_memory_changes_not_discarded() { fn in_memory_changes_not_discarded() {
// Call stack: BOB -> CHARLIE (trap) -> BOB' (success) // Call stack: BOB -> CHARLIE (trap) -> BOB' (success)
// This tests verfies some edge case of the contract info cache: // This tests verifies some edge case of the contract info cache:
// We change some value in our contract info before calling into a contract // We change some value in our contract info before calling into a contract
// that calls into ourself. This triggers a case where BOBs contract info // that calls into ourself. This triggers a case where BOBs contract info
// is written to storage and invalidated by the successful execution of BOB'. // is written to storage and invalidated by the successful execution of BOB'.
@@ -3405,7 +3405,7 @@ mod tests {
let code_hash = MockLoader::insert(Call, move |ctx, _| { let code_hash = MockLoader::insert(Call, move |ctx, _| {
// It is set to one when this contract was instantiated by `place_contract` // It is set to one when this contract was instantiated by `place_contract`
assert_eq!(ctx.ext.nonce(), 1); assert_eq!(ctx.ext.nonce(), 1);
// Should not change without any instantation in-between // Should not change without any instantiation in-between
assert_eq!(ctx.ext.nonce(), 1); assert_eq!(ctx.ext.nonce(), 1);
// Should not change with a failed instantiation // Should not change with a failed instantiation
assert_err!( assert_err!(
@@ -3416,7 +3416,7 @@ mod tests {
} }
); );
assert_eq!(ctx.ext.nonce(), 1); assert_eq!(ctx.ext.nonce(), 1);
// Successful instantation increments // Successful instantiation increments
ctx.ext.instantiate(Weight::zero(), success_code, 0, vec![], &[]).unwrap(); ctx.ext.instantiate(Weight::zero(), success_code, 0, vec![], &[]).unwrap();
assert_eq!(ctx.ext.nonce(), 2); assert_eq!(ctx.ext.nonce(), 2);
exec_success() exec_success()
+3 -3
View File
@@ -403,7 +403,7 @@ pub mod pallet {
T::MaxCodeLen::get(), T::MaxCodeLen::get(),
); );
// Debug buffer should at least be large enough to accomodate a simple error message // Debug buffer should at least be large enough to accommodate a simple error message
const MIN_DEBUG_BUF_SIZE: u32 = 256; const MIN_DEBUG_BUF_SIZE: u32 = 256;
assert!( assert!(
T::MaxDebugBufferLen::get() > MIN_DEBUG_BUF_SIZE, T::MaxDebugBufferLen::get() > MIN_DEBUG_BUF_SIZE,
@@ -891,7 +891,7 @@ pub mod pallet {
/// The contract's code was found to be invalid during validation or instrumentation. /// The contract's code was found to be invalid during validation or instrumentation.
/// ///
/// The most likely cause of this is that an API was used which is not supported by the /// The most likely cause of this is that an API was used which is not supported by the
/// node. This hapens if an older node is used with a new version of ink!. Try updating /// node. This happens if an older node is used with a new version of ink!. Try updating
/// your node to the newest available version. /// your node to the newest available version.
/// ///
/// A more detailed error can be found on the node console if debug messages are enabled /// A more detailed error can be found on the node console if debug messages are enabled
@@ -987,7 +987,7 @@ struct InternalOutput<T: Config, O> {
result: Result<O, ExecError>, result: Result<O, ExecError>,
} }
/// Helper trait to wrap contract execution entry points into a signle function /// Helper trait to wrap contract execution entry points into a single function
/// [`Invokable::run_guarded`]. /// [`Invokable::run_guarded`].
trait Invokable<T: Config> { trait Invokable<T: Config> {
/// What is returned as a result of a successful invocation. /// What is returned as a result of a successful invocation.
@@ -513,7 +513,7 @@ impl<T: Config> Ext<T> for ReservingExt {
// we make sure to leave at least the ed in the free balance. // we make sure to leave at least the ed in the free balance.
// //
// The sender always has enough balance because we track it in the `ContractInfo` and // The sender always has enough balance because we track it in the `ContractInfo` and
// never send more back than we have. Noone has access to the deposit account. Hence no // never send more back than we have. No one has access to the deposit account. Hence no
// other interaction with this account takes place. // other interaction with this account takes place.
Deposit::Refund(amount) => { Deposit::Refund(amount) => {
if terminated { if terminated {
+2 -2
View File
@@ -186,7 +186,7 @@ impl<T: Config> PrefabWasmModule<T> {
code_cache::try_remove::<T>(origin, code_hash) code_cache::try_remove::<T>(origin, code_hash)
} }
/// Returns whether there is a deposit to be payed for this module. /// Returns whether there is a deposit to be paid for this module.
/// ///
/// Returns `0` if the module is already in storage and hence no deposit will /// Returns `0` if the module is already in storage and hence no deposit will
/// be charged when storing it. /// be charged when storing it.
@@ -689,7 +689,7 @@ mod tests {
executable.execute(ext.borrow_mut(), entry_point, input_data) executable.execute(ext.borrow_mut(), entry_point, input_data)
} }
/// Execute the suppplied code. /// Execute the supplied code.
fn execute<E: BorrowMut<MockExt>>(wat: &str, input_data: Vec<u8>, ext: E) -> ExecResult { fn execute<E: BorrowMut<MockExt>>(wat: &str, input_data: Vec<u8>, ext: E) -> ExecResult {
execute_internal(wat, input_data, ext, &ExportedFunction::Call, true, false) execute_internal(wat, input_data, ext, &ExportedFunction::Call, true, false)
} }
@@ -50,7 +50,7 @@ pub enum TryInstantiate {
Instantiate, Instantiate,
/// Skip the instantiation during preparation. /// Skip the instantiation during preparation.
/// ///
/// This makes sense when the preparation takes place as part of an instantation. Then /// This makes sense when the preparation takes place as part of an instantiation. Then
/// this instantiation would fail the whole transaction and an extra check is not /// this instantiation would fail the whole transaction and an extra check is not
/// necessary. /// necessary.
Skip, Skip,
@@ -376,7 +376,7 @@ fn get_memory_limits<T: Config>(
}, },
} }
} else { } else {
// If none memory imported then just crate an empty placeholder. // If none memory imported then just create an empty placeholder.
// Any access to it will lead to out of bounds trap. // Any access to it will lead to out of bounds trap.
Ok((0, 0)) Ok((0, 0))
} }
@@ -412,7 +412,7 @@ where
extended_const: false, extended_const: false,
component_model: false, component_model: false,
// This is not our only defense: We check for float types later in the preparation // This is not our only defense: We check for float types later in the preparation
// process. Additionally, all instructions explictily need to have weights assigned // process. Additionally, all instructions explicitly need to have weights assigned
// or the deployment will fail. We have none assigned for float instructions. // or the deployment will fail. We have none assigned for float instructions.
deterministic_only: matches!(determinism, Determinism::Deterministic), deterministic_only: matches!(determinism, Determinism::Deterministic),
mutable_global: false, mutable_global: false,
@@ -1336,7 +1336,7 @@ pub mod env {
/// ///
/// # Parameters /// # Parameters
/// ///
/// - `flags`: See `crate::wasm::runtime::CallFlags` for a documenation of the supported flags. /// - `flags`: See `crate::wasm::runtime::CallFlags` for a documentation of the supported flags.
/// - `callee_ptr`: a pointer to the address of the callee contract. Should be decodable as an /// - `callee_ptr`: a pointer to the address of the callee contract. Should be decodable as an
/// `T::AccountId`. Traps otherwise. /// `T::AccountId`. Traps otherwise.
/// - `gas`: how much gas to devote to the execution. /// - `gas`: how much gas to devote to the execution.
@@ -2038,7 +2038,7 @@ pub mod env {
/// # Note /// # Note
/// ///
/// The state rent functionality was removed. This is stub only exists for /// The state rent functionality was removed. This is stub only exists for
/// backwards compatiblity /// backwards compatibility
#[prefixed_alias] #[prefixed_alias]
#[deprecated] #[deprecated]
fn restore_to( fn restore_to(
@@ -2062,7 +2062,7 @@ pub mod env {
/// # Note /// # Note
/// ///
/// The state rent functionality was removed. This is stub only exists for /// The state rent functionality was removed. This is stub only exists for
/// backwards compatiblity /// backwards compatibility
#[version(1)] #[version(1)]
#[prefixed_alias] #[prefixed_alias]
#[deprecated] #[deprecated]
@@ -2084,7 +2084,7 @@ pub mod env {
/// # Note /// # Note
/// ///
/// The state rent functionality was removed. This is stub only exists for /// The state rent functionality was removed. This is stub only exists for
/// backwards compatiblity. /// backwards compatibility.
#[prefixed_alias] #[prefixed_alias]
#[deprecated] #[deprecated]
fn set_rent_allowance( fn set_rent_allowance(
@@ -2102,7 +2102,7 @@ pub mod env {
/// # Note /// # Note
/// ///
/// The state rent functionality was removed. This is stub only exists for /// The state rent functionality was removed. This is stub only exists for
/// backwards compatiblity. /// backwards compatibility.
#[version(1)] #[version(1)]
#[prefixed_alias] #[prefixed_alias]
#[deprecated] #[deprecated]
@@ -2116,7 +2116,7 @@ pub mod env {
/// # Note /// # Note
/// ///
/// The state rent functionality was removed. This is stub only exists for /// The state rent functionality was removed. This is stub only exists for
/// backwards compatiblity. /// backwards compatibility.
#[prefixed_alias] #[prefixed_alias]
#[deprecated] #[deprecated]
fn rent_allowance(ctx: _, memory: _, out_ptr: u32, out_len_ptr: u32) -> Result<(), TrapReason> { fn rent_allowance(ctx: _, memory: _, out_ptr: u32, out_len_ptr: u32) -> Result<(), TrapReason> {
@@ -2409,7 +2409,7 @@ pub mod env {
/// ///
/// # Return Value /// # Return Value
/// ///
/// Returns `ReturnCode::Success` when the dispatchable was succesfully executed and /// Returns `ReturnCode::Success` when the dispatchable was successfully executed and
/// returned `Ok`. When the dispatchable was exeuted but returned an error /// returned `Ok`. When the dispatchable was exeuted but returned an error
/// `ReturnCode::CallRuntimeFailed` is returned. The full error is not /// `ReturnCode::CallRuntimeFailed` is returned. The full error is not
/// provided because it is not guaranteed to be stable. /// provided because it is not guaranteed to be stable.
@@ -2603,7 +2603,7 @@ pub mod env {
/// Returns a nonce that is unique per contract instantiation. /// Returns a nonce that is unique per contract instantiation.
/// ///
/// The nonce is incremented for each succesful contract instantiation. This is a /// The nonce is incremented for each successful contract instantiation. This is a
/// sensible default salt for contract instantiations. /// sensible default salt for contract instantiations.
#[unstable] #[unstable]
fn instantiation_nonce(ctx: _, _memory: _) -> Result<u64, TrapReason> { fn instantiation_nonce(ctx: _, _memory: _) -> Result<u64, TrapReason> {