[−][src]Module solana_libra_vm::gas_schedule
This module lays out the basic abstract costing schedule for bytecode instructions.
It is important to note that the cost schedule defined in this file does not track hashing operations or other native operations; the cost of each native operation will be returned by the native function itself.
Structs
AbstractMemorySize | A newtype wrapper that represents the (abstract) memory size that the instruciton will take up. |
CONST_SIZE | The size in words for a non-string or address constant on the stack |
CostTable | The cost tables, keyed by the serialized form of the bytecode instruction. We use the serialized form as opposed to the instruction enum itself as the key since this will be the on-chain representation of bytecode instructions in the future. |
DEFAULT_ACCOUNT_SIZE | For V1 all accounts will be 32 words |
GLOBAL_MEMORY_PER_BYTE_COST | The cost per-byte written to global storage. TODO: Fill this in with a proper number once it's determined. |
GLOBAL_MEMORY_PER_BYTE_WRITE_COST | The cost per-byte written to storage. TODO: Fill this in with a proper number once it's determined. |
GasCost | The |
GasPrice | A newtype wrapper around the gas price for each unit of gas consumed. |
GasUnits | A newtype wrapper around the underlying carrier for the gas cost. |
INTRINSIC_GAS_PER_BYTE | The units of gas that should be charged per byte for every transaction. |
InstructionKey | A newtype wrapper around the on-chain representation of an instruction key. This is the serialization of the instruction but disregarding any instruction arguments. |
LARGE_TRANSACTION_CUTOFF | Any transaction over this size will be charged |
MAXIMUM_NUMBER_OF_GAS_UNITS | 1 nanosecond should equal one unit of computational gas. We bound the maximum
computational time of any given transaction at 10 milliseconds. We want this number and
|
MAX_ABSTRACT_MEMORY_SIZE | The maximum size representable by AbstractMemorySize |
MAX_PRICE_PER_GAS_UNIT | The maximum gas unit price that a transaction can be submitted with. |
MIN_PRICE_PER_GAS_UNIT | The minimum gas price that a transaction can be submitted with. |
MIN_TRANSACTION_GAS_UNITS | We charge one unit of gas per-byte for the first 600 bytes |
REFERENCE_SIZE | The size in words for a reference on the stack |
STRUCT_SIZE | The size of a struct in words |
WORD_SIZE | The word size that we charge by |
Traits
GasAlgebra | A trait encoding the operations permitted on the underlying carrier for the gas unit, and how other gas-related units can interact with other units -- operations can only be performed across units with the same underlying carrier (i.e. as long as the underlying data is the same). |
Functions
calculate_intrinsic_gas | Calculate the intrinsic gas for the transaction based upon its size in bytes/words. |
static_cost_instr | Statically cost a bytecode instruction. |
words_in | Computes the number of words rounded up |
Type Definitions
GasCarrier | The underlying carrier for gas-related units and costs. Data with this type should not be
manipulated directly, but instead be manipulated using the newtype wrappers defined around
them and the functions defined in the |