fuel_gas_price_algorithm::v1

Struct AlgorithmUpdaterV1

source
pub struct AlgorithmUpdaterV1 {
Show 19 fields pub new_scaled_exec_price: u64, pub min_exec_gas_price: u64, pub exec_gas_price_change_percent: u16, pub l2_block_height: u32, pub l2_block_fullness_threshold_percent: ClampedPercentage, pub new_scaled_da_gas_price: u64, pub gas_price_factor: NonZeroU64, pub min_da_gas_price: u64, pub max_da_gas_price_change_percent: u16, pub total_da_rewards_excess: u128, pub da_recorded_block_height: u32, pub latest_known_total_da_cost_excess: u128, pub projected_total_da_cost: u128, pub da_p_component: i64, pub da_d_component: i64, pub last_profit: i128, pub second_to_last_profit: i128, pub latest_da_cost_per_byte: u128, pub unrecorded_blocks: BTreeMap<u32, u64>,
}

Fields§

§new_scaled_exec_price: u64

The gas price (scaled by the gas_price_factor) to cover the execution of the next block

§min_exec_gas_price: u64

The lowest the algorithm allows the exec gas price to go

§exec_gas_price_change_percent: u16

The Percentage the execution gas price will change in a single block, either increase or decrease based on the fullness of the last L2 block. Using u16 because it can go above 100% and possibly over 255%

§l2_block_height: u32

The height of the next L2 block

§l2_block_fullness_threshold_percent: ClampedPercentage

The threshold of gas usage above and below which the gas price will increase or decrease This is a percentage of the total capacity of the L2 block

§new_scaled_da_gas_price: u64

The gas price for the DA portion of the last block. This can be used to calculate the DA portion of the next block The gas price (scaled by the gas_price_factor) to cover the DA commitment of the next block

§gas_price_factor: NonZeroU64

Scale factor for the gas price.

§min_da_gas_price: u64

The lowest the algorithm allows the da gas price to go

§max_da_gas_price_change_percent: u16

The maximum percentage that the DA portion of the gas price can change in a single block Using u16 because it can go above 100% and possibly over 255%

§total_da_rewards_excess: u128

The cumulative reward from the DA portion of the gas price

§da_recorded_block_height: u32

The height of the last L2 block recorded on the DA chain

§latest_known_total_da_cost_excess: u128

The cumulative cost of recording L2 blocks on the DA chain as of the last recorded block

§projected_total_da_cost: u128

The predicted cost of recording L2 blocks on the DA chain as of the last L2 block (This value is added on top of the latest_known_total_da_cost if the L2 height is higher)

§da_p_component: i64

The P component of the PID control for the DA gas price

§da_d_component: i64

The D component of the PID control for the DA gas price

§last_profit: i128

The last profit

§second_to_last_profit: i128

The profit before last

§latest_da_cost_per_byte: u128

The latest known cost per byte for recording blocks on the DA chain

§unrecorded_blocks: BTreeMap<u32, u64>

The unrecorded blocks that are used to calculate the projected cost of recording blocks

Implementations§

source§

impl AlgorithmUpdaterV1

source

pub fn update_da_record_data( &mut self, height_range: Range<u32>, range_cost: u128, ) -> Result<(), Error>

source

pub fn update_l2_block_data( &mut self, height: u32, used: u64, capacity: NonZeroU64, block_bytes: u64, fee_wei: u128, ) -> Result<(), Error>

source

pub fn algorithm(&self) -> AlgorithmV1

Trait Implementations§

source§

impl Clone for AlgorithmUpdaterV1

source§

fn clone(&self) -> AlgorithmUpdaterV1

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for AlgorithmUpdaterV1

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for AlgorithmUpdaterV1

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for AlgorithmUpdaterV1

source§

fn eq(&self, other: &AlgorithmUpdaterV1) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for AlgorithmUpdaterV1

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for AlgorithmUpdaterV1

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,