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
impl AlgorithmUpdaterV1
pub fn update_da_record_data( &mut self, height_range: Range<u32>, range_cost: u128, ) -> Result<(), Error>
pub fn update_l2_block_data( &mut self, height: u32, used: u64, capacity: NonZeroU64, block_bytes: u64, fee_wei: u128, ) -> Result<(), Error>
pub fn algorithm(&self) -> AlgorithmV1
Trait Implementations§
source§impl Clone for AlgorithmUpdaterV1
impl Clone for AlgorithmUpdaterV1
source§fn clone(&self) -> AlgorithmUpdaterV1
fn clone(&self) -> AlgorithmUpdaterV1
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AlgorithmUpdaterV1
impl Debug for AlgorithmUpdaterV1
source§impl<'de> Deserialize<'de> for AlgorithmUpdaterV1
impl<'de> Deserialize<'de> for AlgorithmUpdaterV1
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 PartialEq for AlgorithmUpdaterV1
impl PartialEq for AlgorithmUpdaterV1
source§impl Serialize for AlgorithmUpdaterV1
impl Serialize for AlgorithmUpdaterV1
impl StructuralPartialEq for AlgorithmUpdaterV1
Auto Trait Implementations§
impl Freeze for AlgorithmUpdaterV1
impl RefUnwindSafe for AlgorithmUpdaterV1
impl Send for AlgorithmUpdaterV1
impl Sync for AlgorithmUpdaterV1
impl Unpin for AlgorithmUpdaterV1
impl UnwindSafe for AlgorithmUpdaterV1
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)