Expand description

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

  • A newtype wrapper that represents the (abstract) memory size that the instruction will take up.
  • 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.
  • The GasCost tracks:
  • A newtype wrapper around the gas price for each unit of gas consumed.
  • Units of gas as seen by clients of the Move VM.
  • Units of gas used within the Move VM, scaled for fine-grained accounting.

Constants

Traits

  • 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).

Type Definitions

  • 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 GasAlgebra trait.