jam-types 0.1.29

JAM protocol datatypes for interoperation between node internals, services and authorizers
Documentation
//! Host-call gas cost constants specified in the GP.

use crate::UnsignedGas;

/// Gas charged for an unknown or context-unavailable host-call.
pub const UNKNOWN: UnsignedGas = 1000;

// Constant-only host-calls.
/// `gas` cost.
pub const GAS: UnsignedGas = 48;
/// `info` cost.
pub const INFO: UnsignedGas = 703;
/// `export` cost.
pub const EXPORT: UnsignedGas = 3521;
/// `expunge` cost.
pub const EXPUNGE: UnsignedGas = 335;
/// `assign` cost.
pub const ASSIGN: UnsignedGas = 1818;
/// `checkpoint` cost.
pub const CHECKPOINT: UnsignedGas = 103;
/// `new` cost.
pub const NEW: UnsignedGas = 3855;
/// `upgrade` cost.
pub const UPGRADE: UnsignedGas = 1028;
/// `eject` cost.
pub const EJECT: UnsignedGas = 458;
/// `query` cost.
pub const QUERY: UnsignedGas = 643;
/// `solicit` cost.
pub const SOLICIT: UnsignedGas = 2193;
/// `forget` cost.
pub const FORGET: UnsignedGas = 3250;
/// `yield` cost.
pub const YIELD: UnsignedGas = 98;

/// `transfer` base cost; the transferred gas `t` is charged in `transfer`.
pub const TRANSFER: UnsignedGas = 575;

/// `invoke` base cost; the lent inner gas is charged in `invoke`.
pub const INVOKE: UnsignedGas = 968;

/// `grow_heap` base cost.
pub const GROW_HEAP_BASE: UnsignedGas = 275;
/// `grow_heap` per-page cost; charged in `grow_heap`.
pub const GROW_HEAP_LINEAR: UnsignedGas = 121;

/// `read` base cost.
pub const READ_BASE: UnsignedGas = 2407;
/// `read` per key KiB cost.
pub const READ_KEY_LINEAR: UnsignedGas = 1736;
/// `read` per value KiB cost.
pub const READ_VAL_LINEAR: UnsignedGas = 248;

/// `write` base cost.
pub const WRITE_CONST: UnsignedGas = 2442;
/// `write` per key KiB cost.
pub const WRITE_KEY_LINEAR: UnsignedGas = 3358;
/// `write` per value KiB cost.
pub const WRITE_VAL_LINEAR: UnsignedGas = 216;

/// `lookup` base cost.
pub const LOOKUP_BASE: UnsignedGas = 600;
/// `lookup` per KiB cost.
pub const LOOKUP_LINEAR: UnsignedGas = 248;

/// `historical_lookup` base cost.
pub const HIST_LOOKUP_BASE: UnsignedGas = 1125;
/// `historical_lookup` per KiB cost.
pub const HIST_LOOKUP_LINEAR: UnsignedGas = 264;

/// `machine` base cost.
pub const MACHINE_BASE: UnsignedGas = 1862;
/// `machine` program per KiB cost.
pub const MACHINE_LINEAR: UnsignedGas = 112;

/// `peek` base cost.
pub const PEEK_BASE: UnsignedGas = 377;
/// `peek` per KiB cost.
pub const PEEK_LINEAR: UnsignedGas = 336;

/// `poke` base cost.
pub const POKE_BASE: UnsignedGas = 297;
/// `poke` per KiB cost.
pub const POKE_LINEAR: UnsignedGas = 224;

/// `bless` base cost.
pub const BLESS_BASE: UnsignedGas = 422;
/// `bless` per item cost
pub const BLESS_LINEAR: UnsignedGas = 20;

/// `designate` base cost.
pub const DESIGNATE_BASE: UnsignedGas = 1100;
/// `designate` per item cost.
pub const DESIGNATE_LINEAR: UnsignedGas = 302;

/// `provide` base cost.
pub const PROVIDE_BASE: UnsignedGas = 3980;
/// `provide` per KiB cost.
pub const PROVIDE_LINEAR: UnsignedGas = 2264;

/// `pages` alloc base cost.
pub const PAGES_ALLOC_BASE: UnsignedGas = 275;
/// `pages` alloc per page cost.
pub const PAGES_ALLOC_LINEAR: UnsignedGas = 121;
/// `pages` free base cost.
pub const PAGES_FREE_BASE: UnsignedGas = 212;
/// `pages` free per page cost.
pub const PAGES_FREE_LINEAR: UnsignedGas = 118;
/// `pages` setmode base cost.
pub const PAGES_SETMODE_BASE: UnsignedGas = 130;
/// `pages` setmode per page cost.
pub const PAGES_SETMODE_LINEAR: UnsignedGas = 29;
/// `pages` invalid-r gas cost.
pub const PAGES_INVALID: UnsignedGas = 80;

/// `fetch` base costs keyed by [`FetchKind`](crate::FetchKind).
pub const FETCH_BASE: [UnsignedGas; 16] =
	[390, 103, 80, 85, 85, 171, 171, 85, 84, 88, 111, 317, 250, 95, 287, 355];
/// `fetch` per KiB costs keyed by [`FetchKind`](crate::FetchKind).
pub const FETCH_LINEAR: [UnsignedGas; 16] =
	[0, 0, 96, 96, 96, 0, 0, 96, 0, 0, 0, 0, 0, 96, 400, 344];
/// `fetch` unknown item cost.
pub const FETCH_UNKNOWN: UnsignedGas = 80;