mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 23:07:57 +00:00
Rework Transaction Priority calculation (#9834)
* Add transaction validity docs. * Re-work priority calculation. * Fix tests. * Update frame/transaction-payment/src/lib.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * cargo +nightly fmt --all * Fix an obvious mistake :) * Re-work again. * Fix test. * cargo +nightly fmt --all * Make VirtualTip dependent on the transaction size. * cargo +nightly fmt --all * Update frame/transaction-payment/src/lib.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * Fix compilation. * Update bin/node/runtime/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -287,30 +287,6 @@ impl<'a> OneOrMany<DispatchClass> for &'a [DispatchClass] {
|
||||
}
|
||||
}
|
||||
|
||||
/// Primitives related to priority management of Frame.
|
||||
pub mod priority {
|
||||
/// The starting point of all Operational transactions. 3/4 of u64::MAX.
|
||||
pub const LIMIT: u64 = 13_835_058_055_282_163_711_u64;
|
||||
|
||||
/// Wrapper for priority of different dispatch classes.
|
||||
///
|
||||
/// This only makes sure that any value created for the operational dispatch class is
|
||||
/// incremented by [`LIMIT`].
|
||||
pub enum FrameTransactionPriority {
|
||||
Normal(u64),
|
||||
Operational(u64),
|
||||
}
|
||||
|
||||
impl From<FrameTransactionPriority> for u64 {
|
||||
fn from(priority: FrameTransactionPriority) -> Self {
|
||||
match priority {
|
||||
FrameTransactionPriority::Normal(inner) => inner,
|
||||
FrameTransactionPriority::Operational(inner) => inner.saturating_add(LIMIT),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A bundle of static information collected from the `#[weight = $x]` attributes.
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Default, RuntimeDebug, Encode, Decode, TypeInfo)]
|
||||
pub struct DispatchInfo {
|
||||
|
||||
Reference in New Issue
Block a user