Struct near_vm_logic::gas_counter::GasCounter[][src]

pub struct GasCounter { /* fields omitted */ }
Expand description

Gas counter (a part of VMlogic)

Implementations

Very special function to get the gas counter pointer for generated machine code. Please do not use, unless fully understand Rust aliasing and other consequences. Can be used to emit inlined code like pay_wasm_gas(), i.e. mov base, gas_counter_raw_ptr mov rax, [base + 0] ; current burnt gas mov rcx, [base + 16] ; opcode cost imul rcx, block_ops_count ; block cost add rax, rcx ; new burnt gas jo emit_integer_overflow cmp rax, [base + 8] ; unsigned compare with burnt limit mov [base + 0], rax ja emit_gas_exceeded

A helper function to pay a multiple of a cost.

A helper function to pay base cost gas.

A helper function to pay per byte gas fee for batching an action.

Args:
  • per_byte_fee: the fee per byte;
  • num_bytes: the number of bytes;
  • sir: whether the receiver_id is same as the current account ID;
  • action: what kind of action is charged for;

A helper function to pay base cost gas fee for batching an action.

Args:
  • base_fee: base fee for the action;
  • sir: whether the receiver_id is same as the current account ID;
  • action: what kind of action is charged for;

A helper function to pay base cost gas fee for batching an action.

Args:
  • burn_gas: amount of gas to burn;
  • use_gas: amount of gas to reserve;
  • action: what kind of action is charged for;

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.