package tezos-protocol-005-PsBabyM1

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Errors

type Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error +=
  1. | Too_many_internal_operations
type storage_error =
  1. | Incompatible_protocol_version of string
  2. | Missing_key of string list * [ `Get | `Set | `Del | `Copy ]
  3. | Existing_key of string list
  4. | Corrupted_data of string list

An internal storage error that should not happen

type Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error +=
  1. | Storage_error of storage_error
type Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error +=
  1. | Failed_to_parse_parameter of Tezos_protocol_environment_structs.V0.M.MBytes.t
type Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error +=
  1. | Failed_to_decode_parameter of Tezos_protocol_environment_005_PsBabyM1__Environment.Data_encoding.json * string
val storage_error : storage_error -> ('a, Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error list) Stdlib.result Lwt.t

Abstract Context

type t

Abstract view of the context. Includes a handle to the functional key-value database (Context.t) along with some in-memory values (gas, etc.).

type context = t
type root_context = t
val prepare : level:int32 -> predecessor_timestamp:Tezos_base.Time.Protocol.t -> timestamp:Tezos_base.Time.Protocol.t -> fitness:Tezos_protocol_environment_structs.V0.M.MBytes.t list -> Environment_context.Context.t -> (context, Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error list) Stdlib.result Lwt.t

Retrieves the state of the database and gives its abstract view. It also returns wether this is the first block validated with this version of the protocol.

type previous_protocol =
  1. | Genesis of Parameters_repr.t
  2. | Athens_004
val prepare_first_block : level:int32 -> timestamp:Tezos_base.Time.Protocol.t -> fitness:Tezos_protocol_environment_structs.V0.M.MBytes.t list -> Environment_context.Context.t -> (previous_protocol * context, Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error list) Stdlib.result Lwt.t

Returns the state of the database resulting of operations on its abstract view

val current_level : context -> Level_repr.t
val predecessor_timestamp : context -> Tezos_base.Time.Protocol.t
val current_timestamp : context -> Tezos_base.Time.Protocol.t
val current_fitness : context -> int64
val set_current_fitness : context -> int64 -> t
val first_level : context -> Raw_level_repr.t
val add_fees : context -> Tez_repr.t -> (context, Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error list) Stdlib.result Lwt.t

Increment the current block fee stash that will be credited to baker's frozen_fees account at finalize_application

val add_rewards : context -> Tez_repr.t -> (context, Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error list) Stdlib.result Lwt.t

Increment the current block reward stash that will be credited to baker's frozen_fees account at finalize_application

val add_deposit : context -> Tezos_crypto.Signature.public_key_hash -> Tez_repr.t -> (context, Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error list) Stdlib.result Lwt.t

Increment the current block deposit stash for a specific delegate. All the delegates' frozen_deposit accounts are credited at finalize_application

val get_fees : context -> Tez_repr.t
val get_rewards : context -> Tez_repr.t
val get_deposits : context -> Tez_repr.t Tezos_protocol_environment_005_PsBabyM1__Environment.Signature.Public_key_hash.Map.t
type Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error +=
  1. | Gas_limit_too_high
val check_gas_limit : t -> Z.t -> (unit, Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error list) Stdlib.result
val set_gas_limit : t -> Z.t -> t
val set_gas_unlimited : t -> t
val gas_level : t -> Gas_limit_repr.t
val gas_consumed : since:t -> until:t -> Z.t
val block_gas_level : t -> Z.t
val init_storage_space_to_pay : t -> t
val update_storage_space_to_pay : t -> Z.t -> t
val update_allocated_contracts_count : t -> t
val clear_storage_space_to_pay : t -> t * Z.t * int
type Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error +=
  1. | Undefined_operation_nonce
val init_origination_nonce : t -> Tezos_crypto.Operation_hash.t -> t
val origination_nonce : t -> (Contract_repr.origination_nonce, Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error list) Stdlib.result
val increment_origination_nonce : t -> (t * Contract_repr.origination_nonce, Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error list) Stdlib.result
val unset_origination_nonce : t -> t

Generic accessors

type key = string list
module type T = sig ... end

All context manipulation functions. This signature is included as-is for direct context accesses, and used in Storage_functors to provide restricted views to the context.

include T with type t := t and type context := context
val mem : context -> key -> bool Lwt.t

Tells if the key is already defined as a value.

val dir_mem : context -> key -> bool Lwt.t

Tells if the key is already defined as a directory.

val get : context -> key -> (value, Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error list) Stdlib.result Lwt.t

Retrieve the value from the storage bucket ; returns a Storage_errorMissing_key if the key is not set.

val get_option : context -> key -> value option Lwt.t

Retrieves the value from the storage bucket ; returns None if the data is not initialized.

val init : context -> key -> value -> (context, Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error list) Stdlib.result Lwt.t

Allocates the storage bucket and initializes it ; returns a Storage_errorExisting_key if the bucket exists.

val set : context -> key -> value -> (context, Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error list) Stdlib.result Lwt.t

Updates the content of the bucket ; returns a Storage_error Missing_key if the value does not exists.

val init_set : context -> key -> value -> context Lwt.t

Allocates the data and initializes it with a value ; just updates it if the bucket exists.

val set_option : context -> key -> value option -> context Lwt.t

When the value is Some v, allocates the data and initializes it with v ; just updates it if the bucket exists. When the valus is None, delete the storage bucket when the value ; does nothing if the bucket does not exists.

val delete : context -> key -> (context, Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error list) Stdlib.result Lwt.t

Delete the storage bucket ; returns a Storage_error Missing_key if the bucket does not exists.

val remove : context -> key -> context Lwt.t

Removes the storage bucket and its contents ; does nothing if the bucket does not exists.

val remove_rec : context -> key -> context Lwt.t

Recursively removes all the storage buckets and contents ; does nothing if no bucket exists.

val copy : context -> from:key -> to_:key -> (context, Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error list) Stdlib.result Lwt.t
val fold : context -> key -> init:'a -> f:([ `Key of key | `Dir of key ] -> 'a -> 'a Lwt.t) -> 'a Lwt.t

Iterator on all the items of a given directory.

val keys : context -> key -> key list Lwt.t

Recursively list all subkeys of a given key.

val fold_keys : context -> key -> init:'a -> f:(key -> 'a -> 'a Lwt.t) -> 'a Lwt.t

Recursive iterator on all the subkeys of a given key.

val project : context -> root_context

Internally used in Storage_functors to escape from a view.

val absolute_key : context -> key -> key

Internally used in Storage_functors to retrieve a full key from partial key relative a view.

val consume_gas : context -> Gas_limit_repr.cost -> (context, Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error list) Stdlib.result

Internally used in Storage_functors to consume gas from within a view.

val check_enough_gas : context -> Gas_limit_repr.cost -> (unit, Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error list) Stdlib.result

Check if consume_gas will fail

val description : context Storage_description.t
val reset_internal_nonce : context -> context

Initialize the local nonce used for preventing a script to duplicate an internal operation to replay it.

val fresh_internal_nonce : context -> (context * int, Tezos_protocol_environment_005_PsBabyM1__Environment.Error_monad.error list) Stdlib.result

Increments the internal operation nonce.

val record_internal_nonce : context -> int -> context

Mark an internal operation nonce as taken.

val internal_nonce_already_recorded : context -> int -> bool

Check is the internal operation nonce has been taken.

val allowed_endorsements : context -> (Tezos_crypto.Signature.public_key * int list * bool) Tezos_protocol_environment_005_PsBabyM1__Environment.Signature.Public_key_hash.Map.t

Returns a map where to each endorser's pkh is associated the list of its endorsing slots (in decreasing order) for a given level.

val included_endorsements : context -> int

Keep track of the number of endorsements that are included in a block

val init_endorsements : context -> (Tezos_crypto.Signature.public_key * int list * bool) Tezos_protocol_environment_005_PsBabyM1__Environment.Signature.Public_key_hash.Map.t -> context

Initializes the map of allowed endorsements, this function must only be called once.

Marks an endorsment in the map as used.

val fresh_temporary_big_map : context -> context * Z.t

Provide a fresh identifier for a temporary big map (negative index).

val reset_temporary_big_map : context -> context

Reset the temporary big_map identifier generator to -1.

val temporary_big_maps : context -> ('a -> Z.t -> 'a Lwt.t) -> 'a -> 'a Lwt.t

Iterate over all created temporary big maps since the last reset_temporary_big_map.

OCaml

Innovation. Community. Security.