0.2.7 Aug 16, 2022
0.2.6 Aug 13, 2022
0.2.1 Aug 13, 2022

#9 in #metering


Used in 71 crates (9 directly)

Apache-2.0

175KB
2K SLoC

This crate is the core of the gas metering system of the Aptos blockchain.

More specifically, it

  • Is home to the gas meter implementation
  • Defines the gas parameters and formulae for instructions
  • Defines the gas parameters for transactions
  • Sets the initial values for all gas parameters, including the instruction, transaction move-stdlib and aptos-framework ones.
  • Defines a bi-directional mapping between the (Rust) gas parameter structs and their corresponding representation on-chain.

The reason why we need two different representations is that they serve different purposes:

  • The Rust structs are used for quick (static) lookups by the gas meter and native functions when calculating gas costs.
  • The on-chain gas schedule needs to be extensible and unordered so we can upgrate it easily in the future.

Dependencies

~67MB
~1.5M SLoC