chore: fix typos and sort trait impls (#11989)

This commit is contained in:
yjh
2022-08-08 17:49:00 +08:00
committed by GitHub
parent 266fa8516a
commit e945ae6365
4 changed files with 16 additions and 16 deletions
@@ -215,7 +215,7 @@ impl<T: Config> Token<T> for CodeToken {
use self::CodeToken::*;
// In case of `Load` we already covered the general costs of
// calling the storage but still need to account for the actual size of the
// contract code. This is why we substract `T::*::(0)`. We need to do this at this
// contract code. This is why we subtract `T::*::(0)`. We need to do this at this
// point because when charging the general weight for calling the contract we not know the
// size of the contract.
match *self {
@@ -223,8 +223,8 @@ impl<T: Config> Token<T> for CodeToken {
Load(len) => {
let computation = T::WeightInfo::call_with_code_per_byte(len)
.saturating_sub(T::WeightInfo::call_with_code_per_byte(0));
let bandwith = T::ContractAccessWeight::get().saturating_mul(len.into());
computation.max(bandwith)
let bandwidth = T::ContractAccessWeight::get().saturating_mul(len.into());
computation.max(bandwidth)
},
}
}
@@ -31,8 +31,8 @@ pub trait ConvertibleToWasm: Sized {
fn from_typed_value(_: Value) -> Option<Self>;
}
impl ConvertibleToWasm for i32 {
type NativeType = i32;
const VALUE_TYPE: ValueType = ValueType::I32;
type NativeType = i32;
fn to_typed_value(self) -> Value {
Value::I32(self)
}
@@ -41,8 +41,8 @@ impl ConvertibleToWasm for i32 {
}
}
impl ConvertibleToWasm for u32 {
type NativeType = u32;
const VALUE_TYPE: ValueType = ValueType::I32;
type NativeType = u32;
fn to_typed_value(self) -> Value {
Value::I32(self as i32)
}
@@ -54,8 +54,8 @@ impl ConvertibleToWasm for u32 {
}
}
impl ConvertibleToWasm for u64 {
type NativeType = u64;
const VALUE_TYPE: ValueType = ValueType::I64;
type NativeType = u64;
fn to_typed_value(self) -> Value {
Value::I64(self as i64)
}
@@ -540,7 +540,7 @@ mod tests {
[seal0] nop(_ctx, _unused: u64) => { unreachable!(); },
// new version of nop with other data type for argumebt
// new version of nop with other data type for argument
[seal1] nop(_ctx, _unused: i32) => { unreachable!(); },
);
}
@@ -1209,7 +1209,7 @@ define_env!(Env, <E: Ext>,
//
// # Parameters
//
// - flags: See [`CallFlags`] for a documenation of the supported flags.
// - flags: See [`CallFlags`] for a documentation of the supported flags.
// - callee_ptr: a pointer to the address of the callee contract.
// Should be decodable as an `T::AccountId`. Traps otherwise.
// - gas: how much gas to devote to the execution.
@@ -1753,7 +1753,7 @@ define_env!(Env, <E: Ext>,
// # Note
//
// The state rent functionality was removed. This is stub only exists for
// backwards compatiblity
// backwards compatibility
[seal0] seal_restore_to(
ctx,
_dest_ptr: u32,
@@ -1774,7 +1774,7 @@ define_env!(Env, <E: Ext>,
// # Note
//
// The state rent functionality was removed. This is stub only exists for
// backwards compatiblity
// backwards compatibility
[seal1] seal_restore_to(
ctx,
_dest_ptr: u32,
@@ -1857,7 +1857,7 @@ define_env!(Env, <E: Ext>,
// # Note
//
// The state rent functionality was removed. This is stub only exists for
// backwards compatiblity.
// backwards compatibility.
[seal0] seal_set_rent_allowance(ctx, _value_ptr: u32, _value_len: u32) => {
ctx.charge_gas(RuntimeCosts::DebugMessage)?;
Ok(())
@@ -1868,7 +1868,7 @@ define_env!(Env, <E: Ext>,
// # Note
//
// The state rent functionality was removed. This is stub only exists for
// backwards compatiblity.
// backwards compatibility.
[seal1] seal_set_rent_allowance(ctx, _value_ptr: u32) => {
ctx.charge_gas(RuntimeCosts::DebugMessage)?;
Ok(())
@@ -1879,7 +1879,7 @@ define_env!(Env, <E: Ext>,
// # Note
//
// The state rent functionality was removed. This is stub only exists for
// backwards compatiblity.
// backwards compatibility.
[seal0] seal_rent_allowance(ctx, out_ptr: u32, out_len_ptr: u32) => {
ctx.charge_gas(RuntimeCosts::Balance)?;
let rent_allowance = <BalanceOf<E::T>>::max_value().encode();
@@ -2085,15 +2085,15 @@ define_env!(Env, <E: Ext>,
//
// # Return Value
//
// Returns `ReturnCode::Success` when the dispatchable was succesfully executed and
// returned `Ok`. When the dispatchable was exeuted but returned an error
// Returns `ReturnCode::Success` when the dispatchable was successfully executed and
// returned `Ok`. When the dispatchable was executed but returned an error
// `ReturnCode::CallRuntimeReturnedError` is returned. The full error is not
// provided because it is not guaranteed to be stable.
//
// # Comparison with `ChainExtension`
//
// Just as a chain extension this API allows the runtime to extend the functionality
// of contracts. While making use of this function is generelly easier it cannot be
// of contracts. While making use of this function is generally easier it cannot be
// used in call cases. Consider writing a chain extension if you need to do perform
// one of the following tasks:
//