package tezos-protocol-alpha
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=7062cd57addd452852598a2214ade393130efa087b99068d53713bdf912b3680
sha512=08e4091144a03ce3c107fb91a66501bd8b65ca3278917c455a2eaac6df3e108ade63f6ab8340a4bb152d60f404326e464d0ec95d26cafe8e82f870465d24a5fc
doc/tezos-protocol-alpha.raw/Tezos_raw_protocol_alpha/Gas_limit_repr/index.html
Module Tezos_raw_protocol_alpha.Gas_limit_repr
Source
Internal representation of the gas limit available to the node baking a new block. It should be proportional to the time and energy required to perform a computation.
This protects the bakers from performing exceedingly costly computations while baking and also allows them to select cheaper-to-compute operations to include in their blocks, as their reward for baking a block is not directly related to the resources consumed by the machine performing the operation.
It can be Unaccounted
(unlimited) or Limited
to some fixed-point value (see Fixed_point_repr
for the details). The value is represented with 3 decimal places of precision.
All computations on gas are performed in saturation arithmetic (see Saturation_repr
) bounded between 0
and 2 ^ 62 - 1
module Arith :
Fixed_point_repr.Full
with type 'a t = private Saturation_repr.may_saturate Saturation_repr.t
Represents a gas cost of an operation. The gas model is constructed such that the cost of each operation is roughly proportional to the time required to perform the operation. If the gas cost of an operation exceeds the available limit, such an operation is rejected. This is especially meant to protect bakers against DoS attacks.
Print the gas cost as gas unit
Subtracts the cost from the current limit. Returns None
if the limit would fall below 0
.
Convert an amount of milligas expressed as a value of type int
to Arith.fp
.
atomic_step_cost x
corresponds to x
milliunit of gas.
step_cost x
corresponds to x
units of gas.
Cost of allocating qwords of storage.
alloc_cost n
estimates the cost of allocating n
qwords of storage.
Cost of allocating bytes in the storage.
alloc_bytes_cost b
estimates the cost of allocating b
bytes of storage.
Cost of allocating bytes in the storage.
alloc_mbytes_cost b
estimates the cost of allocating b
bytes of storage and the cost of a header to describe these bytes.
Cost of reading the storage.
read_bytes_const n
estimates the cost of reading n
bytes of storage.
Cost of writing to storage.
write_bytes_const n
estimates the cost of writing n
bytes to the storage.
Multiply a cost by a factor. Both arguments are saturated arithmetic values, so no negative numbers are involved.
Ill-formed gas_limit
: see check_gas_limit
.
val check_gas_limit :
hard_gas_limit_per_operation:Arith.integral ->
gas_limit:'a Arith.t ->
unit Tezos_protocol_environment_alpha.Error_monad.tzresult
Check that gas_limit
is well-formed, i.e. it is at most the given hard_gas_limit_per_operation
, and it is nonnegative.