Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typo #2844

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/collator-selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ pub mod pallet {
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
/// Invulnurable was updated.
/// Invulnerable was updated.
NewInvulnerables { new_invulnerables: Vec<T::AccountId> },
/// Desired candidates was updated.
NewDesiredCandidates { new_desired_candidates: u32 },
Expand Down
12 changes: 6 additions & 6 deletions modules/evm-accounts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,13 @@ impl<T: Config> Pallet<T> {

fn evm_account_domain_separator() -> [u8; 32] {
let domain_hash = keccak256!("EIP712Domain(string name,string version,uint256 chainId,bytes32 salt)");
let mut domain_seperator_msg = domain_hash.to_vec();
domain_seperator_msg.extend_from_slice(keccak256!("Acala EVM claim")); // name
domain_seperator_msg.extend_from_slice(keccak256!("1")); // version
domain_seperator_msg.extend_from_slice(&to_bytes(T::ChainId::get())); // chain id
domain_seperator_msg
let mut domain_separator_msg = domain_hash.to_vec();
domain_separator_msg.extend_from_slice(keccak256!("Acala EVM claim")); // name
domain_separator_msg.extend_from_slice(keccak256!("1")); // version
domain_separator_msg.extend_from_slice(&to_bytes(T::ChainId::get())); // chain id
domain_separator_msg
.extend_from_slice(frame_system::Pallet::<T>::block_hash(BlockNumberFor::<T>::zero()).as_ref()); // genesis block hash
keccak_256(domain_seperator_msg.as_slice())
keccak_256(domain_separator_msg.as_slice())
}

fn do_claim_default_evm_address(who: T::AccountId) -> Result<EvmAddress, DispatchError> {
Expand Down
6 changes: 3 additions & 3 deletions modules/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,14 +719,14 @@ pub mod module {
ensure_root(origin)?;

let _from_account = T::AddressMapping::get_account_id(&from);
let _payed: NegativeImbalanceOf<T>;
let _paid: NegativeImbalanceOf<T>;
#[cfg(not(feature = "with-ethereum-compatibility"))]
{
// unreserve the transaction fee for gas_limit
let weight = T::GasToWeight::convert(gas_limit);
let (_, imbalance) = T::ChargeTransactionPayment::unreserve_and_charge_fee(&_from_account, weight)
.map_err(|_| Error::<T>::ChargeFeeFailed)?;
_payed = imbalance;
_paid = imbalance;
}

match T::Runner::call(
Expand Down Expand Up @@ -786,7 +786,7 @@ pub mod module {
let res = T::ChargeTransactionPayment::refund_fee(
&_from_account,
T::GasToWeight::convert(refund_gas),
_payed,
_paid,
);
debug_assert!(res.is_ok());
}
Expand Down
10 changes: 5 additions & 5 deletions modules/evm/src/runner/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1625,7 +1625,7 @@ impl<'inner, 'config, 'precompiles, S: StackState<'config>, P: PrecompileSet> Pr
self.executor.state.refund_external_cost(ref_time, proof_size);
}

/// Retreive the remaining gas.
/// Retrieve the remaining gas.
fn remaining_gas(&self) -> u64 {
self.executor.state.metadata().gasometer.gas()
}
Expand All @@ -1635,17 +1635,17 @@ impl<'inner, 'config, 'precompiles, S: StackState<'config>, P: PrecompileSet> Pr
Handler::log(self.executor, address, topics, data)
}

/// Retreive the code address (what is the address of the precompile being called).
/// Retrieve the code address (what is the address of the precompile being called).
fn code_address(&self) -> H160 {
self.code_address
}

/// Retreive the input data the precompile is called with.
/// Retrieve the input data the precompile is called with.
fn input(&self) -> &[u8] {
self.input
}

/// Retreive the context in which the precompile is executed.
/// Retrieve the context in which the precompile is executed.
fn context(&self) -> &Context {
self.context
}
Expand All @@ -1655,7 +1655,7 @@ impl<'inner, 'config, 'precompiles, S: StackState<'config>, P: PrecompileSet> Pr
self.is_static
}

/// Retreive the gas limit of this call.
/// Retrieve the gas limit of this call.
fn gas_limit(&self) -> Option<u64> {
self.gas_limit
}
Expand Down
2 changes: 1 addition & 1 deletion modules/honzon/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ fn transfer_debit_works() {
HonzonModule::transfer_debit(RuntimeOrigin::signed(BOB), BTC, DOT, 1000),
ArithmeticError::Underflow
);
// Won't work when transfering more debit than is present
// Won't work when transferring more debit than is present
assert_noop!(
HonzonModule::transfer_debit(RuntimeOrigin::signed(ALICE), BTC, DOT, 10_000),
ArithmeticError::Underflow
Expand Down
2 changes: 1 addition & 1 deletion modules/prices/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//! The data from Oracle cannot be used in business, prices module will do some
//! process and feed prices for Acala. Process include:
//! - specify a fixed price for stable currency
//! - feed price in USD or related price bewteen two currencies
//! - feed price in USD or related price between two currencies
//! - lock/unlock the price data get from oracle

#![cfg_attr(not(feature = "std"), no_std)]
Expand Down
2 changes: 1 addition & 1 deletion modules/support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub trait TransactionPayment<AccountId, Balance, NegativeImbalance> {
who: &AccountId,
weight: Weight,
) -> Result<(Balance, NegativeImbalance), TransactionValidityError>;
fn refund_fee(who: &AccountId, weight: Weight, payed: NegativeImbalance) -> Result<(), TransactionValidityError>;
fn refund_fee(who: &AccountId, weight: Weight, paid: NegativeImbalance) -> Result<(), TransactionValidityError>;
fn charge_fee(
who: &AccountId,
len: u32,
Expand Down
4 changes: 2 additions & 2 deletions modules/support/src/mocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl<AccountId, Balance: Default + Copy, NegativeImbalance: Imbalance<Balance>>
fn refund_fee(
_who: &AccountId,
_weight: Weight,
_payed: NegativeImbalance,
_paid: NegativeImbalance,
) -> Result<(), TransactionValidityError> {
Ok(())
}
Expand Down Expand Up @@ -188,7 +188,7 @@ impl<
fn refund_fee(
_who: &AccountId,
_weight: Weight,
_payed: NegativeImbalance,
_paid: NegativeImbalance,
) -> Result<(), TransactionValidityError> {
Ok(())
}
Expand Down
24 changes: 12 additions & 12 deletions modules/transaction-payment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,10 @@ pub mod module {
/// transaction fee paid, the second is the tip paid, if any.
type OnTransactionPayment: OnUnbalanced<NegativeImbalanceOf<Self>>;

/// A fee mulitplier for `Operational` extrinsics to compute "virtual tip" to boost their
/// A fee multiplier for `Operational` extrinsics to compute "virtual tip" to boost their
/// `priority`
///
/// This value is multipled by the `final_fee` to obtain a "virtual tip" that is later
/// This value is multiplied by the `final_fee` to obtain a "virtual tip" that is later
/// added to a tip component in regular `priority` calculations.
/// It means that a `Normal` transaction can front-run a similarly-sized `Operational`
/// extrinsic (with no tip), by including a tip value greater than the virtual tip.
Expand Down Expand Up @@ -371,19 +371,19 @@ pub mod module {
/// Weight information for the extrinsics in this module.
type WeightInfo: WeightInfo;

/// PalletId used to derivate sub account.
/// PalletId used to derivative sub account.
#[pallet::constant]
type PalletId: Get<PalletId>;

/// Treasury account used to transfer balance to sub account of `PalletId`.
#[pallet::constant]
type TreasuryAccount: Get<Self::AccountId>;

/// Custom fee surplus if not payed with native asset.
/// Custom fee surplus if not paid with native asset.
#[pallet::constant]
type CustomFeeSurplus: Get<Percent>;

/// Alternative fee surplus if not payed with native asset.
/// Alternative fee surplus if not paid with native asset.
#[pallet::constant]
type AlternativeFeeSurplus: Get<Percent>;

Expand Down Expand Up @@ -1462,7 +1462,7 @@ where
len: usize,
_result: &DispatchResult,
) -> Result<(), TransactionValidityError> {
if let Some((tip, who, Some(payed), fee, surplus)) = pre {
if let Some((tip, who, Some(paid), fee, surplus)) = pre {
let actual_fee = Pallet::<T>::compute_actual_fee(len as u32, info, post_info, tip);
let refund_fee = fee.saturating_sub(actual_fee);
let mut refund = refund_fee;
Expand All @@ -1489,7 +1489,7 @@ where

let actual_payment = match <T as Config>::Currency::deposit_into_existing(&who, refund) {
Ok(refund_imbalance) => {
// The refund cannot be larger than the up front payed max weight.
// The refund cannot be larger than the up front paid max weight.
// `PostDispatchInfo::calc_unspent` guards against such a case.
match payed.offset(refund_imbalance) {
SameOrOther::Same(actual_payment) => actual_payment,
Expand All @@ -1499,7 +1499,7 @@ where
}
// We do not recreate the account using the refund. The up front payment
// is gone in that case.
Err(_) => payed,
Err(_) => paid,
};
let (tip, fee) = actual_payment.split(actual_tip);

Expand Down Expand Up @@ -1570,14 +1570,14 @@ where
fn refund_fee(
who: &T::AccountId,
refund_weight: Weight,
payed: NegativeImbalanceOf<T>,
paid: NegativeImbalanceOf<T>,
) -> Result<(), TransactionValidityError> {
log::debug!(target: "transaction-payment", "refund_fee: who: {:?}, refund_weight: {:?}, payed: {:?}", who, refund_weight, payed.peek());
log::debug!(target: "transaction-payment", "refund_fee: who: {:?}, refund_weight: {:?}, paid: {:?}", who, refund_weight, payed.peek());

let refund = Pallet::<T>::weight_to_fee(refund_weight);
let actual_payment = match <T as Config>::Currency::deposit_into_existing(who, refund) {
Ok(refund_imbalance) => {
// The refund cannot be larger than the up front payed max weight.
// The refund cannot be larger than the up front paid max weight.
match payed.offset(refund_imbalance) {
SameOrOther::Same(actual_payment) => actual_payment,
SameOrOther::None => Default::default(),
Expand All @@ -1586,7 +1586,7 @@ where
}
// We do not recreate the account using the refund. The up front payment
// is gone in that case.
Err(_) => payed,
Err(_) => paid,
};

// distribute fee
Expand Down
4 changes: 2 additions & 2 deletions modules/xcm-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ pub mod module {
fn withdraw_unbonded_from_sub_account(sub_account_index: u16, amount: Balance) -> DispatchResult {
let (xcm_dest_weight, xcm_fee) = Self::xcm_dest_weight_and_fee(XcmInterfaceOperation::HomaWithdrawUnbonded);

// TODO: config xcm_dest_weight and fee for withdraw_unbonded and transfer seperately.
// Temperarily use double fee.
// TODO: config xcm_dest_weight and fee for withdraw_unbonded and transfer separately.
// Temporarily use double fee.
let xcm_message = T::RelayChainCallBuilder::finalize_multiple_calls_into_xcm_message(
vec![
(
Expand Down
18 changes: 9 additions & 9 deletions primitives/src/unchecked_extrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ where
target: "evm", "tx msg: {:?}", msg
);

let msg_hash = msg.hash(); // TODO: consider rewirte this to use `keccak_256` for hashing because it could be faster
let msg_hash = msg.hash(); // TODO: consider rewrite this to use `keccak_256` for hashing because it could be faster

let signer = recover_signer(&sig, msg_hash.as_fixed_bytes()).ok_or(InvalidTransaction::BadProof)?;

Expand Down Expand Up @@ -176,7 +176,7 @@ where
target: "evm", "tx msg: {:?}", msg
);

let msg_hash = msg.hash(); // TODO: consider rewirte this to use `keccak_256` for hashing because it could be faster
let msg_hash = msg.hash(); // TODO: consider rewrite this to use `keccak_256` for hashing because it could be faster

let signer = recover_signer(&sig, msg_hash.as_fixed_bytes()).ok_or(InvalidTransaction::BadProof)?;

Expand Down Expand Up @@ -224,7 +224,7 @@ where
target: "evm", "tx msg: {:?}", msg
);

let msg_hash = msg.hash(); // TODO: consider rewirte this to use `keccak_256` for hashing because it could be faster
let msg_hash = msg.hash(); // TODO: consider rewrite this to use `keccak_256` for hashing because it could be faster

let signer = recover_signer(&sig, msg_hash.as_fixed_bytes()).ok_or(InvalidTransaction::BadProof)?;

Expand Down Expand Up @@ -318,12 +318,12 @@ fn verify_eip712_signature(eth_msg: EthereumTransactionMessage, sig: [u8; 65]) -
let access_list_type_hash = keccak256!("AccessList(address address,uint256[] storageKeys)");
let tx_type_hash = keccak256!("Transaction(string action,address to,uint256 nonce,uint256 tip,bytes data,uint256 value,uint256 gasLimit,uint256 storageLimit,AccessList[] accessList,uint256 validUntil)AccessList(address address,uint256[] storageKeys)");

let mut domain_seperator_msg = domain_hash.to_vec();
domain_seperator_msg.extend_from_slice(keccak256!("Acala EVM")); // name
domain_seperator_msg.extend_from_slice(keccak256!("1")); // version
domain_seperator_msg.extend_from_slice(&to_bytes(eth_msg.chain_id)); // chain id
domain_seperator_msg.extend_from_slice(eth_msg.genesis.as_bytes()); // salt
let domain_separator = keccak_256(domain_seperator_msg.as_slice());
let mut domain_separator_msg = domain_hash.to_vec();
domain_separator_msg.extend_from_slice(keccak256!("Acala EVM")); // name
domain_separator_msg.extend_from_slice(keccak256!("1")); // version
domain_separator_msg.extend_from_slice(&to_bytes(eth_msg.chain_id)); // chain id
domain_separator_msg.extend_from_slice(eth_msg.genesis.as_bytes()); // salt
let domain_separator = keccak_256(domain_separator_msg.as_slice());

let mut tx_msg = tx_type_hash.to_vec();
match eth_msg.action {
Expand Down
6 changes: 3 additions & 3 deletions runtime/integration-tests/src/honzon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ fn test_cdp_engine_module() {
});
}

// Honzon's surplus can be transfered and DebitExchangeRate updates accordingly
// Honzon's surplus can be transferred and DebitExchangeRate updates accordingly
#[test]
fn cdp_treasury_handles_honzon_surplus_correctly() {
ExtBuilder::default()
Expand Down Expand Up @@ -612,10 +612,10 @@ fn cdp_treasury_handles_honzon_surplus_correctly() {
assert_eq!(CdpTreasury::get_debit_pool(), 0);
run_to_block(2);

// Empty treasury recieves stablecoins into surplus pool from loan
// Empty treasury receives stablecoins into surplus pool from loan
assert_eq!(CdpTreasury::get_surplus_pool(), 270716741782);
assert_eq!(CdpTreasury::get_debit_pool(), 0);
// Honzon generated cdp treasury surplus can be transfered
// Honzon generated cdp treasury surplus can be transferred
assert_eq!(Currencies::free_balance(USD_CURRENCY, &AccountId::from(BOB)), 0);
assert_eq!(
CdpEngine::debit_exchange_rate(RELAY_CHAIN_CURRENCY),
Expand Down
2 changes: 1 addition & 1 deletion runtime/integration-tests/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ fn proxy_permissions_correct() {
gov_call.clone()
));
let hash = BlakeTwo256::hash_of(&(BlakeTwo256::hash(b"bob is awesome"), AccountId::from(BOB)));
// last event was sucessful tip call
// last event was successful tip call
assert_eq!(
System::events()
.into_iter()
Expand Down
8 changes: 4 additions & 4 deletions runtime/integration-tests/src/treasury.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ fn treasury_handles_dust_correctly() {
let liquid_ed = ExistentialDeposits::get(&LIQUID_CURRENCY);
let usd_ed = ExistentialDeposits::get(&USD_CURRENCY);

// Test empty treasury recieves dust tokens of relay
// Test empty treasury receives dust tokens of relay
assert_eq!(
Currencies::free_balance(RELAY_CHAIN_CURRENCY, &TreasuryAccount::get()),
0
Expand All @@ -136,7 +136,7 @@ fn treasury_handles_dust_correctly() {
relay_ed + 1
);

// ALICE account is reaped and treasury recieves dust tokens
// ALICE account is reaped and treasury receives dust tokens
assert_eq!(
Currencies::free_balance(RELAY_CHAIN_CURRENCY, &AccountId::from(ALICE)),
0
Expand Down Expand Up @@ -201,7 +201,7 @@ fn treasury_handles_dust_correctly() {
relay_ed - 1
);

// Test empty treasury recieves dust tokens of Liquid Currency
// Test empty treasury receives dust tokens of Liquid Currency
assert_eq!(Currencies::free_balance(LIQUID_CURRENCY, &TreasuryAccount::get()), 0);
assert_ok!(Currencies::transfer(
RuntimeOrigin::signed(AccountId::from(ALICE)),
Expand All @@ -219,7 +219,7 @@ fn treasury_handles_dust_correctly() {
liquid_ed - 1
);

// Test empty treasury recieves dust tokens of USD Currency using Tokens pallet
// Test empty treasury receives dust tokens of USD Currency using Tokens pallet
assert_eq!(Tokens::free_balance(USD_CURRENCY, &TreasuryAccount::get()), 0);
assert_ok!(Tokens::transfer(
RuntimeOrigin::signed(AccountId::from(ALICE)),
Expand Down
2 changes: 1 addition & 1 deletion runtime/integration-tests/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use frame_support::weights::constants::*;
#[test]
fn sanity_check_weight_per_time_constants_are_as_expected() {
// These values comes from Substrate, we want to make sure that if it
// ever changes we don't accidently break Polkadot
// ever changes we don't accidentally break Polkadot
assert_eq!(WEIGHT_REF_TIME_PER_SECOND, 1_000_000_000_000);
assert_eq!(WEIGHT_REF_TIME_PER_MILLIS, WEIGHT_REF_TIME_PER_SECOND / 1000);
assert_eq!(WEIGHT_REF_TIME_PER_MICROS, WEIGHT_REF_TIME_PER_MILLIS / 1000);
Expand Down
4 changes: 2 additions & 2 deletions runtime/mandala/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ impl orml_authority::AsOriginId<RuntimeOrigin, OriginCaller> for AuthoritysOrigi
}
}

/// Compares privilages
/// Compares privileges
fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option<Ordering> {
if left == right {
return Some(Ordering::Equal);
}

match (left, right) {
// Root always has privilage
// Root always has privilege
(OriginCaller::system(frame_system::RawOrigin::Root), _) => Some(Ordering::Greater),

// Checks which one has more yes votes.
Expand Down
4 changes: 2 additions & 2 deletions runtime/mandala/src/benchmarking/nutsfinance_stable_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ runtime_benchmarks! {
let mint_fee = 10000000u128;
let swap_fee = 20000000u128;
let redeem_fee = 50000000u128;
let intial_a = 10000u128;
let initial_a = 10000u128;
let fee_recipient: AccountId = account("fee", 0, SEED);
let yield_recipient: AccountId = account("yield", 1, SEED);
register_stable_asset()?;
}: _(RawOrigin::Root, pool_asset, assets, precisions, mint_fee, swap_fee, redeem_fee, intial_a, fee_recipient, yield_recipient, 1_000_000_000_000u128)
}: _(RawOrigin::Root, pool_asset, assets, precisions, mint_fee, swap_fee, redeem_fee, initial_a, fee_recipient, yield_recipient, 1_000_000_000_000u128)

modify_a {
let assets = vec![LIQUID, STAKING];
Expand Down
Loading