package tezos-protocol-012-Psithaca

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error +=
  1. | Expression_too_deep
type Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error +=
  1. | Expression_already_registered
type Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error +=
  1. | Badly_formed_constant_expression

A constant is the prim of the literal characters "constant". A constant must have a single argument, being a string with a well formed hash of a Micheline expression (i.e generated by Script_expr_hash.to_b58check).

type Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error +=
  1. | Nonexistent_global
val get : t -> Script_expr_hash.t -> (t * Script.expr, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result Lwt.t

get context hash retrieves the Micheline value with the given hash.

Fails with Nonexistent_global if no value is found at the given hash.

Fails with Storage_error Corrupted_data if the deserialisation fails.

Consumes Gas_repr.read_bytes_cost <size of the value>.

val register : t -> Script.expr -> (t * Script_expr_hash.t * Z.t, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result Lwt.t

register context value Register a constant in the global table of constants, returning the hash and storage bytes consumed.

Does not type-check the Micheline code being registered, allow potentially ill-typed Michelson values (see note at top of module in global_constants_storage.mli).

The constant is stored unexpanded, but it is temporarily expanded at registration time only to check the expanded version respects the following limits.

Fails with Expression_too_deep if, after fully, expanding all constants, the expression would contain too many nested levels, that is more than Constants_repr.max_allowed_global_constant_depth.

Fails with Badly_formed_constant_expression if constants are not well-formed (see declaration of Badly_formed_constant_expression) or with Nonexistent_global if a referenced constant does not exist in the table.

Consumes serialization cost. Consumes Gas_repr.write_bytes_cost <size> where size is the number of bytes in the binary serialization provided by Script.expr_encoding.

val expand : t -> Script.expr -> (t * Script.expr, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result Lwt.t

expand context expr Replaces every constant in the given Michelson expression with its value stored in the global table.

The expansion is applied recursively so that the returned expression contains no constant.

Fails with Badly_formed_constant_expression if constants are not well-formed (see declaration of Badly_formed_constant_expression) or with Nonexistent_global if a referenced constant does not exist in the table.

module Internal_for_tests : sig ... end
OCaml

Innovation. Community. Security.