style: Migrate to stable-only rustfmt configuration
- Remove nightly-only features from .rustfmt.toml and vendor/ss58-registry/rustfmt.toml - Removed features: imports_granularity, wrap_comments, comment_width, reorder_impl_items, spaces_around_ranges, binop_separator, match_arm_blocks, trailing_semicolon, trailing_comma - Format all 898 affected files with stable rustfmt - Ensures long-term reliability without nightly toolchain dependency
This commit is contained in:
@@ -352,8 +352,9 @@ where
|
||||
_result: &DispatchResult,
|
||||
) -> Result<Weight, TransactionValidityError> {
|
||||
let (tip, who, initial_payment, extension_weight) = match pre {
|
||||
Pre::Charge { tip, who, initial_payment, weight } =>
|
||||
(tip, who, initial_payment, weight),
|
||||
Pre::Charge { tip, who, initial_payment, weight } => {
|
||||
(tip, who, initial_payment, weight)
|
||||
},
|
||||
Pre::NoCharge { refund } => {
|
||||
// No-op: Refund everything
|
||||
return Ok(refund);
|
||||
|
||||
+22
-20
@@ -184,15 +184,16 @@ where
|
||||
if asset_id == A::get() {
|
||||
// The `asset_id` is the target asset, we do not need to swap.
|
||||
match F::can_withdraw(asset_id.clone(), who, fee) {
|
||||
WithdrawConsequence::BalanceLow |
|
||||
WithdrawConsequence::UnknownAsset |
|
||||
WithdrawConsequence::Underflow |
|
||||
WithdrawConsequence::Overflow |
|
||||
WithdrawConsequence::Frozen =>
|
||||
return Err(TransactionValidityError::from(InvalidTransaction::Payment)),
|
||||
WithdrawConsequence::Success |
|
||||
WithdrawConsequence::ReducedToZero(_) |
|
||||
WithdrawConsequence::WouldDie => return Ok(()),
|
||||
WithdrawConsequence::BalanceLow
|
||||
| WithdrawConsequence::UnknownAsset
|
||||
| WithdrawConsequence::Underflow
|
||||
| WithdrawConsequence::Overflow
|
||||
| WithdrawConsequence::Frozen => {
|
||||
return Err(TransactionValidityError::from(InvalidTransaction::Payment))
|
||||
},
|
||||
WithdrawConsequence::Success
|
||||
| WithdrawConsequence::ReducedToZero(_)
|
||||
| WithdrawConsequence::WouldDie => return Ok(()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,15 +203,16 @@ where
|
||||
|
||||
// Ensure we can withdraw enough `asset_id` for the swap.
|
||||
match F::can_withdraw(asset_id.clone(), who, asset_fee) {
|
||||
WithdrawConsequence::BalanceLow |
|
||||
WithdrawConsequence::UnknownAsset |
|
||||
WithdrawConsequence::Underflow |
|
||||
WithdrawConsequence::Overflow |
|
||||
WithdrawConsequence::Frozen =>
|
||||
return Err(TransactionValidityError::from(InvalidTransaction::Payment)),
|
||||
WithdrawConsequence::Success |
|
||||
WithdrawConsequence::ReducedToZero(_) |
|
||||
WithdrawConsequence::WouldDie => {},
|
||||
WithdrawConsequence::BalanceLow
|
||||
| WithdrawConsequence::UnknownAsset
|
||||
| WithdrawConsequence::Underflow
|
||||
| WithdrawConsequence::Overflow
|
||||
| WithdrawConsequence::Frozen => {
|
||||
return Err(TransactionValidityError::from(InvalidTransaction::Payment))
|
||||
},
|
||||
WithdrawConsequence::Success
|
||||
| WithdrawConsequence::ReducedToZero(_)
|
||||
| WithdrawConsequence::WouldDie => {},
|
||||
};
|
||||
|
||||
Ok(())
|
||||
@@ -227,8 +229,8 @@ where
|
||||
) -> Result<BalanceOf<T>, TransactionValidityError> {
|
||||
let (fee_paid, initial_asset_consumed) = already_withdrawn;
|
||||
let refund_amount = fee_paid.peek().saturating_sub(corrected_fee);
|
||||
let (fee_in_asset, adjusted_paid) = if refund_amount.is_zero() ||
|
||||
F::total_balance(asset_id.clone(), who).is_zero()
|
||||
let (fee_in_asset, adjusted_paid) = if refund_amount.is_zero()
|
||||
|| F::total_balance(asset_id.clone(), who).is_zero()
|
||||
{
|
||||
// Nothing to refund or the account was removed be the dispatched function.
|
||||
(initial_asset_consumed, fee_paid)
|
||||
|
||||
@@ -377,8 +377,9 @@ where
|
||||
result: &DispatchResult,
|
||||
) -> Result<Weight, TransactionValidityError> {
|
||||
let (tip, who, initial_payment, asset_id, extension_weight) = match pre {
|
||||
Pre::Charge { tip, who, initial_payment, asset_id, weight } =>
|
||||
(tip, who, initial_payment, asset_id, weight),
|
||||
Pre::Charge { tip, who, initial_payment, asset_id, weight } => {
|
||||
(tip, who, initial_payment, asset_id, weight)
|
||||
},
|
||||
Pre::NoCharge { refund } => {
|
||||
// No-op: Refund everything
|
||||
return Ok(refund);
|
||||
|
||||
@@ -333,8 +333,9 @@ fn asset_transaction_payment_with_tip_and_refund() {
|
||||
let len = 10;
|
||||
// we convert the from weight to fee based on the ratio between asset min balance and
|
||||
// existential deposit
|
||||
let fee_with_tip = (base_weight + weight + ext_weight.ref_time() + len as u64 + tip) *
|
||||
min_balance / ExistentialDeposit::get();
|
||||
let fee_with_tip = (base_weight + weight + ext_weight.ref_time() + len as u64 + tip)
|
||||
* min_balance
|
||||
/ ExistentialDeposit::get();
|
||||
let mut info = info_from_weight(Weight::from_parts(weight, 0));
|
||||
info.extension_weight = ext_weight;
|
||||
let (pre, _) =
|
||||
@@ -360,10 +361,10 @@ fn asset_transaction_payment_with_tip_and_refund() {
|
||||
len,
|
||||
&Ok(()),
|
||||
));
|
||||
let final_fee = fee_with_tip -
|
||||
(weight - final_weight + ext_weight.ref_time() -
|
||||
MockWeights::charge_asset_tx_payment_asset().ref_time()) *
|
||||
min_balance / ExistentialDeposit::get();
|
||||
let final_fee = fee_with_tip
|
||||
- (weight - final_weight + ext_weight.ref_time()
|
||||
- MockWeights::charge_asset_tx_payment_asset().ref_time())
|
||||
* min_balance / ExistentialDeposit::get();
|
||||
assert_eq!(Assets::balance(asset_id, caller), balance - (final_fee));
|
||||
assert_eq!(Assets::balance(asset_id, BLOCK_AUTHOR), final_fee);
|
||||
|
||||
|
||||
@@ -254,8 +254,8 @@ where
|
||||
let diff = Multiplier::saturating_from_rational(diff_abs, max_limiting_dimension.max(1));
|
||||
let diff_squared = diff.saturating_mul(diff);
|
||||
|
||||
let v_squared_2 = adjustment_variable.saturating_mul(adjustment_variable) /
|
||||
Multiplier::saturating_from_integer(2);
|
||||
let v_squared_2 = adjustment_variable.saturating_mul(adjustment_variable)
|
||||
/ Multiplier::saturating_from_integer(2);
|
||||
|
||||
let first_term = adjustment_variable.saturating_mul(diff);
|
||||
let second_term = v_squared_2.saturating_mul(diff_squared);
|
||||
@@ -475,15 +475,15 @@ pub mod pezpallet {
|
||||
// at most be maximum block weight. Make sure that this can fit in a multiplier without
|
||||
// loss.
|
||||
assert!(
|
||||
<Multiplier as pezsp_runtime::traits::Bounded>::max_value() >=
|
||||
Multiplier::checked_from_integer::<u128>(
|
||||
<Multiplier as pezsp_runtime::traits::Bounded>::max_value()
|
||||
>= Multiplier::checked_from_integer::<u128>(
|
||||
T::BlockWeights::get().max_block.ref_time().try_into().unwrap()
|
||||
)
|
||||
.unwrap(),
|
||||
);
|
||||
|
||||
let target = T::FeeMultiplierUpdate::target() *
|
||||
T::BlockWeights::get().get(DispatchClass::Normal).max_total.expect(
|
||||
let target = T::FeeMultiplierUpdate::target()
|
||||
* T::BlockWeights::get().get(DispatchClass::Normal).max_total.expect(
|
||||
"Setting `max_total` for `Normal` dispatch class is not compatible with \
|
||||
`transaction-payment` pezpallet.",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user