package tezos-protocol-010-PtGRANAD

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t = private
  1. | Unaccounted
  2. | Limited of {
    1. remaining : Arith.fp;
    }
val encoding : t Data_encoding.t
val pp : Stdlib.Format.formatter -> t -> unit
val cost_encoding : cost Data_encoding.t
val pp_cost : Stdlib.Format.formatter -> cost -> unit
type Tezos_protocol_environment_010_PtGRANAD__Environment.Error_monad.error +=
  1. | Block_quota_exceeded
type Tezos_protocol_environment_010_PtGRANAD__Environment.Error_monad.error +=
  1. | Operation_quota_exceeded
type Tezos_protocol_environment_010_PtGRANAD__Environment.Error_monad.error +=
  1. | Gas_limit_too_high
val free : cost
val atomic_step_cost : 'a Saturation_repr.t -> cost
val step_cost : 'a Saturation_repr.t -> cost
val alloc_cost : 'a Saturation_repr.t -> cost
val alloc_bytes_cost : int -> cost
val alloc_mbytes_cost : int -> cost
val read_bytes_cost : int -> cost
val write_bytes_cost : int -> cost
val (*@) : 'a Saturation_repr.t -> cost -> cost
val (+@) : cost -> cost -> cost
val check_limit_is_valid : context -> 'a Arith.t -> (unit, Tezos_protocol_environment_010_PtGRANAD__Environment.Error_monad.error Tezos_protocol_environment_010_PtGRANAD__Environment.Error_monad.trace) Stdlib.result

Checks that the given gas limit does not exceed the hard gas limit per operation

val consume_limit_in_block : context -> 'a Arith.t -> (context, Tezos_protocol_environment_010_PtGRANAD__Environment.Error_monad.error Tezos_protocol_environment_010_PtGRANAD__Environment.Error_monad.trace) Stdlib.result

Consumes gas equal to the given operation gas limit in the current block gas level of the context. May fail if not enough gas remains in the block

val set_limit : context -> 'a Arith.t -> context

Sets a limit to the consumable operation gas

val set_unlimited : context -> context

Allows unlimited gas consumption

val consume : context -> cost -> (context, Tezos_protocol_environment_010_PtGRANAD__Environment.Error_monad.error Tezos_protocol_environment_010_PtGRANAD__Environment.Error_monad.trace) Stdlib.result

Consumes operation gas. May fail if not enough gas remains for the operation

val remaining_operation_gas : context -> Arith.fp

Returns the current gas counter.

val update_remaining_operation_gas : context -> Arith.fp -> context

Update gas counter in the context.

val gas_exhausted_error : context -> ('a, Tezos_protocol_environment_010_PtGRANAD__Environment.Error_monad.error Tezos_protocol_environment_010_PtGRANAD__Environment.Error_monad.trace) Stdlib.result

Triggers an error in case of gas exhaustion.

val level : context -> t

Returns operation gas level

val consumed : since:context -> until:context -> Arith.fp

Returns the operation gas level difference between two contexts. Returns Arith.zero if any of the contexts are set to unlimited gas

val block_level : context -> Arith.fp

Returns block gas level

val cost_of_repr : Gas_limit_repr.cost -> cost
OCaml

Innovation. Community. Security.