mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 07:37:57 +00:00
Enable fixed point u128 (#6214)
* Add fixed u128. * remove move * Change sat_from_integer impl. * checked_pow is always positive * Revert. * rename fixed file * Rename to FixedI * rename fixed file * Add newline. * Use Multiplier in impls. * Renames negate() to saturating_negate(). * Uncomment test. * Add Signed to macro. * Add some tests for Saturating trait.
This commit is contained in:
@@ -26,7 +26,7 @@ use frame_support::{
|
||||
};
|
||||
use sp_core::{NeverNativeValue, traits::Externalities, storage::well_known_keys};
|
||||
use sp_runtime::{
|
||||
ApplyExtrinsicResult, Fixed128, FixedPointNumber,
|
||||
ApplyExtrinsicResult, FixedI128, FixedPointNumber,
|
||||
traits::Hash as HashT,
|
||||
transaction_validity::InvalidTransaction,
|
||||
};
|
||||
@@ -53,7 +53,7 @@ use self::common::{*, sign};
|
||||
pub const BLOATY_CODE: &[u8] = node_runtime::WASM_BINARY_BLOATY;
|
||||
|
||||
/// Default transfer fee
|
||||
fn transfer_fee<E: Encode>(extrinsic: &E, fee_multiplier: Fixed128) -> Balance {
|
||||
fn transfer_fee<E: Encode>(extrinsic: &E, fee_multiplier: FixedI128) -> Balance {
|
||||
let length_fee = TransactionByteFee::get() * (extrinsic.encode().len() as Balance);
|
||||
|
||||
let base_weight = ExtrinsicBaseWeight::get();
|
||||
|
||||
@@ -22,7 +22,7 @@ use frame_support::{
|
||||
weights::{GetDispatchInfo, constants::ExtrinsicBaseWeight, IdentityFee, WeightToFeePolynomial},
|
||||
};
|
||||
use sp_core::NeverNativeValue;
|
||||
use sp_runtime::{FixedPointNumber, Fixed128, Perbill};
|
||||
use sp_runtime::{FixedPointNumber, FixedI128, Perbill};
|
||||
use node_runtime::{
|
||||
CheckedExtrinsic, Call, Runtime, Balances, TransactionPayment,
|
||||
TransactionByteFee,
|
||||
@@ -39,7 +39,7 @@ fn fee_multiplier_increases_and_decreases_on_big_weight() {
|
||||
let mut t = new_test_ext(COMPACT_CODE, false);
|
||||
|
||||
// initial fee multiplier must be zero
|
||||
let mut prev_multiplier = Fixed128::from_inner(0);
|
||||
let mut prev_multiplier = FixedI128::from_inner(0);
|
||||
|
||||
t.execute_with(|| {
|
||||
assert_eq!(TransactionPayment::next_fee_multiplier(), prev_multiplier);
|
||||
|
||||
Reference in New Issue
Block a user