Struct GasConsumer

Source
pub struct GasConsumer<'l> { /* private fields */ }
Expand description

Gas tracking context.

Implementations§

Source§

impl<'l> GasConsumer<'l>

Source

pub const BUILD_CELL_GAS: u64 = 500u64

Source

pub const NEW_CELL_GAS: u64 = 100u64

Source

pub const OLD_CELL_GAS: u64 = 25u64

Source

pub const FREE_STACK_DEPTH: usize = 32usize

Source

pub const FREE_SIGNATURE_CHECKS: usize = 10usize

Source

pub const CHEAP_GET_BALANCE_CALLS: usize = 5usize

Source

pub const CHEAP_GET_BALANCE_GAS_THRESHOLD: u64 = 200u64

Source

pub const FREE_NESTED_CONT_JUMP: usize = 8usize

Source

pub const STACK_VALUE_GAS_PRICE: u64 = 1u64

Source

pub const TUPLE_ENTRY_GAS_PRICE: u64 = 1u64

Source

pub const HASH_EXT_ENTRY_GAS_PRICE: u64 = 1u64

Source

pub const CHK_SGN_GAS_PRICE: u64 = 4_000u64

Source

pub const IMPLICIT_JMPREF_GAS_PRICE: u64 = 10u64

Source

pub const IMPLICIT_RET_GAS_PRICE: u64 = 5u64

Source

pub const EXCEPTION_GAS_PRICE: u64 = 50u64

Source

pub const RUNVM_GAS_PRICE: u64 = 40u64

Source

pub fn new(params: GasParams) -> Self

Source

pub fn with_libraries( params: GasParams, libraries: &'l dyn LibraryProvider, ) -> Self

Source

pub fn limited(&'l self, remaining: u64) -> LimitedGasConsumer<'l>

Source

pub fn derive( &mut self, params: GasConsumerDeriveParams, ) -> VmResult<ParentGasConsumer<'l>>

Source

pub fn restore(&mut self, parent: ParentGasConsumer<'l>) -> RestoredGasConsumer

Source

pub fn libraries(&self) -> &'l dyn LibraryProvider

Source

pub fn credit(&self) -> u64

Source

pub fn consumed(&self) -> u64

Source

pub fn free_gas_consumed(&self) -> u64

Source

pub fn remaining(&self) -> i64

Source

pub fn base(&self) -> u64

Source

pub fn limit(&self) -> u64

Source

pub fn set_limit(&self, limit: u64)

Source

pub fn price(&self) -> u64

Source

pub fn try_get_extra_balance_consumer( &'l self, ) -> Option<LimitedGasConsumer<'l>>

Source

pub fn try_consume_exception_gas(&self) -> Result<(), Error>

Source

pub fn try_consume_implicit_jmpref_gas(&self) -> Result<(), Error>

Source

pub fn try_consume_implicit_ret_gas(&self) -> Result<(), Error>

Source

pub fn try_consume_check_signature_gas(&self) -> Result<(), Error>

Source

pub fn try_consume_stack_gas( &self, stack: Option<&SafeRc<Stack>>, ) -> Result<(), Error>

Source

pub fn try_consume_tuple_gas(&self, tuple_len: u64) -> Result<(), Error>

Source

pub fn try_consume_stack_depth_gas(&self, depth: usize) -> Result<(), Error>

Source

pub fn try_consume(&self, amount: u64) -> Result<(), Error>

Source

pub fn consume_free_gas(&self, amount: u64)

Source

pub fn missing_library(&self) -> Option<HashBytes>

Source

pub fn set_missing_library(&self, hash: &HashBytes)

Source

pub fn load_cell_as_slice( &self, cell: Cell, mode: LoadMode, ) -> Result<OwnedCellSlice, Error>

Trait Implementations§

Source§

impl CellContext for GasConsumer<'_>

Source§

fn finalize_cell(&self, cell: CellParts<'_>) -> Result<Cell, Error>

Builds a new cell from cell parts.
Source§

fn load_cell(&self, cell: Cell, mode: LoadMode) -> Result<Cell, Error>

Resolve an owned cell.
Source§

fn load_dyn_cell<'s: 'a, 'a>( &'s self, cell: &'a DynCell, mode: LoadMode, ) -> Result<&'a DynCell, Error>

Resolve a cell reference.

Auto Trait Implementations§

§

impl<'l> !Freeze for GasConsumer<'l>

§

impl<'l> !RefUnwindSafe for GasConsumer<'l>

§

impl<'l> !Send for GasConsumer<'l>

§

impl<'l> !Sync for GasConsumer<'l>

§

impl<'l> Unpin for GasConsumer<'l>

§

impl<'l> !UnwindSafe for GasConsumer<'l>

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> 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> SafeDelete for T
where T: 'static,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> EquivalentRepr<T> for T