pub enum PricingMode {
PaymentLimited {
payment_amount: u64,
gas_price_tolerance: u8,
standard_payment: bool,
},
Fixed {
additional_computation_factor: u8,
gas_price_tolerance: u8,
},
Prepaid {
receipt: Digest,
},
}Expand description
The pricing mode of a Transaction.
Variants§
PaymentLimited
The original payment model, where the creator of the transaction specifies how much they will pay, at what gas price.
Fields
Fixed
The cost of the transaction is determined by the cost table, per the transaction category.
Fields
additional_computation_factor: u8User-specified additional computation factor (minimum 0). If “0” is provided, no additional logic is applied to the computation limit. Each value above “0” tells the node that it needs to treat the transaction as if it uses more gas than it’s serialized size indicates. Each “1” will increase the “wasm lane” size bucket for this transaction by 1. So if the size of the transaction indicates bucket “0” and “additional_computation_factor = 2”, the transaction will be treated as a “2”.
Prepaid
The payment for this transaction was previously paid, as proven by the receipt hash (this is for future use, not currently implemented).
Implementations§
Source§impl PricingMode
impl PricingMode
Sourcepub fn random(rng: &mut TestRng) -> Self
Available on crate feature testing only.
pub fn random(rng: &mut TestRng) -> Self
testing only.Returns a random `PricingMode.
Sourcepub fn is_standard_payment(&self) -> bool
pub fn is_standard_payment(&self) -> bool
Returns standard payment flag, if it is a PaymentLimited variant.
Sourcepub fn gas_limit(
&self,
chainspec: &Chainspec,
lane_id: u8,
) -> Result<Gas, PricingModeError>
Available on crate feature std only.
pub fn gas_limit( &self, chainspec: &Chainspec, lane_id: u8, ) -> Result<Gas, PricingModeError>
std only.Returns the gas limit.
Sourcepub fn gas_cost(
&self,
chainspec: &Chainspec,
lane_id: u8,
gas_price: u8,
) -> Result<Motes, PricingModeError>
Available on crate feature std only.
pub fn gas_cost( &self, chainspec: &Chainspec, lane_id: u8, gas_price: u8, ) -> Result<Motes, PricingModeError>
std only.Returns gas cost.
Sourcepub fn additional_computation_factor(&self) -> u8
pub fn additional_computation_factor(&self) -> u8
Returns gas cost.
Trait Implementations§
Source§impl Clone for PricingMode
impl Clone for PricingMode
Source§fn clone(&self) -> PricingMode
fn clone(&self) -> PricingMode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl DataSize for PricingMode
impl DataSize for PricingMode
Source§const IS_DYNAMIC: bool = true
const IS_DYNAMIC: bool = true
true, the type has a heap size that can vary at runtime, depending on the actual value.Source§const STATIC_HEAP_SIZE: usize = 0usize
const STATIC_HEAP_SIZE: usize = 0usize
IS_DYNAMIC is false, this is
the total amount of heap memory occupied by the value. Otherwise this is a lower bound.Source§fn estimate_heap_size(&self) -> usize
fn estimate_heap_size(&self) -> usize
Source§impl Debug for PricingMode
impl Debug for PricingMode
Source§impl Default for PricingMode
Available on crate feature testing only.
impl Default for PricingMode
testing only.Source§impl<'de> Deserialize<'de> for PricingMode
impl<'de> Deserialize<'de> for PricingMode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for PricingMode
impl Display for PricingMode
Source§impl FromBytes for PricingMode
impl FromBytes for PricingMode
Source§impl Hash for PricingMode
impl Hash for PricingMode
Source§impl JsonSchema for PricingMode
impl JsonSchema for PricingMode
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreSource§impl Ord for PricingMode
impl Ord for PricingMode
Source§fn cmp(&self, other: &PricingMode) -> Ordering
fn cmp(&self, other: &PricingMode) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for PricingMode
impl PartialEq for PricingMode
Source§impl PartialOrd for PricingMode
impl PartialOrd for PricingMode
Source§impl Serialize for PricingMode
impl Serialize for PricingMode
Source§impl ToBytes for PricingMode
impl ToBytes for PricingMode
Source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Vec<u8> which would be returned from a successful call to
to_bytes() or into_bytes(). The data is not actually serialized, so this call is
relatively cheap.impl Eq for PricingMode
impl StructuralPartialEq for PricingMode
Auto Trait Implementations§
impl Freeze for PricingMode
impl RefUnwindSafe for PricingMode
impl Send for PricingMode
impl Sync for PricingMode
impl Unpin for PricingMode
impl UnwindSafe for PricingMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more