package tezos-protocol-015-PtLimaPt
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=7062cd57addd452852598a2214ade393130efa087b99068d53713bdf912b3680
sha512=08e4091144a03ce3c107fb91a66501bd8b65ca3278917c455a2eaac6df3e108ade63f6ab8340a4bb152d60f404326e464d0ec95d26cafe8e82f870465d24a5fc
doc/tezos-protocol-015-PtLimaPt.raw/Tezos_raw_protocol_015_PtLimaPt/Local_gas_counter/index.html
Module Tezos_raw_protocol_015_PtLimaPt.Local_gas_counter
Source
This module exposes an API for local gas counting. It provides a set of functions for updating a gas counter without applying it on an an Alpha_context.context
.
A local_gas_counter
is a wrapped int
.
A type for describing a context that is not up to date with respect to gas consumption.
val local_gas_counter_and_outdated_context :
Alpha_context.context ->
local_gas_counter * outdated_context
local_gas_counter_and_outdated_context ctxt
returns the gas counter value corresponding to the remaining gas in the given context ctxt
along with an outdated_context
value.
val use_gas_counter_in_context :
outdated_context ->
local_gas_counter ->
(Alpha_context.context ->
('a * Alpha_context.context)
Tezos_protocol_environment_015_PtLimaPt.Error_monad.tzresult
Tezos_protocol_environment_015_PtLimaPt.Lwt.t) ->
('a * outdated_context * local_gas_counter)
Tezos_protocol_environment_015_PtLimaPt.Error_monad.tzresult
Tezos_protocol_environment_015_PtLimaPt.Lwt.t
use_gas_counter_in_context outdated_ctxt gas_counter f
first applies the gas_counter
on the outdated context outdated_ctxt
, then invokes f
on the resulting context, and returns a new outdated_context
and a local_gas_counter
value.
consume_opt amt cost
attempts to consume an amt
of gas and returns the new remaining value wrapped in Some
. If the resulting gas is negative None
is returned.
val consume :
local_gas_counter ->
Alpha_context.Gas.cost ->
local_gas_counter
Tezos_protocol_environment_015_PtLimaPt.Error_monad.tzresult
consume amt cost
attempts to consume an amt
of gas and returns the new remaining value as a result. If the resulting gas is negative, an error Gas.Operation_quota_exceeded
is instead returned.