package tezos-protocol-environment

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

The maximum size of a block header in bytes.

val max_operation_data_length : int

The maximum size of an operation in bytes.

val validation_passes : Updater.quota list

The number of validation passes (length of the list) and the operation's quota for each pass.

type block_header_data

The version specific type of blocks.

val block_header_data_encoding : block_header_data Data_encoding.t

Encoding for version specific part of block headers.

type block_header = {
  1. shell : Block_header.shell_header;
  2. protocol_data : block_header_data;
}

A fully parsed block header.

type block_header_metadata

Version-specific side information computed by the protocol during the validation of a block. Should not include information about the evaluation of operations which is handled separately by operation_metadata. To be used as an execution trace by tools (client, indexer). Not necessary for validation.

val block_header_metadata_encoding : block_header_metadata Data_encoding.t

Encoding for version-specific block metadata.

type operation_data

The version specific type of operations.

type operation_receipt

Version-specific side information computed by the protocol during the validation of each operation, to be used conjointly with block_header_metadata.

type operation = {
  1. shell : Operation.shell_header;
  2. protocol_data : operation_data;
}

A fully parsed operation.

val operation_data_encoding : operation_data Data_encoding.t

Encoding for version-specific operation data.

val operation_receipt_encoding : operation_receipt Data_encoding.t

Encoding for version-specific operation receipts.

val operation_data_and_receipt_encoding : (operation_data * operation_receipt) Data_encoding.t

Encoding that mixes an operation data and its receipt.

val acceptable_passes : operation -> int list

The Validation passes in which an operation can appear. For instance [0] if it only belongs to the first pass. An answer of [] means that the operation is ill-formed and cannot be included at all.

val compare_operations : operation -> operation -> int

Basic ordering of operations. compare_operations op1 op2 means that op1 should appear before op2 in a block.

type validation_state

A functional state that is transmitted through the steps of a block validation sequence. It must retain the current state of the store (that can be extracted from the outside using current_context, and whose final value is produced by finalize_block). It can also contain the information that must be remembered during the validation, which must be immutable (as validator or baker implementations are allowed to pause, replay or backtrack during the validation process).

Access the context at a given validation step.

val begin_partial_application : chain_id:Chain_id.t -> ancestor_context:Context.t -> predecessor_timestamp:Time.t -> predecessor_fitness:Fitness.t -> block_header -> validation_state Error_monad.tzresult Lwt.t

Checks that a block is well formed in a given context. This function should run quickly, as its main use is to reject bad blocks from the chain as early as possible. The input context is the one resulting of an ancestor block of same protocol version. This ancestor of the current head is guaranteed to be more recent than `last_allowed_fork_level`.

The resulting `validation_state` will be used for multi-pass validation.

val begin_application : chain_id:Chain_id.t -> predecessor_context:Context.t -> predecessor_timestamp:Time.t -> predecessor_fitness:Fitness.t -> block_header -> validation_state Error_monad.tzresult Lwt.t

The first step in a block validation sequence. Initializes a validation context for validating a block. Takes as argument the Block_header.t to initialize the context for this block. The function precheck_block may not have been called before begin_application, so all the check performed by the former must be repeated in the latter.

val begin_construction : chain_id:Chain_id.t -> predecessor_context:Context.t -> predecessor_timestamp:Time.t -> predecessor_level:Int32.t -> predecessor_fitness:Fitness.t -> predecessor:Block_hash.t -> timestamp:Time.t -> ?protocol_data:block_header_data -> unit -> validation_state Error_monad.tzresult Lwt.t

Initializes a validation context for constructing a new block (as opposed to validating an existing block). When the protocol_data argument is specified, it should contains a 'prototype' of a the protocol specific part of a block header, and the function should produce the exact same effect on the context than would produce the validation of a block containing an "equivalent" (but complete) header. For instance, if the block header usually includes a signature, the header provided to begin_construction should includes a faked signature.

Called after begin_application (or begin_construction) and before finalize_block, with each operation in the block.

The last step in a block validation sequence. It produces the context that will be used as input for the validation of its successor block candidates.

The list of remote procedures exported by this implementation

Initialize the context (or upgrade the context after a protocol amendment). This function receives the context resulting of the application of a block that triggered the amendment. It also receives the header of the block that triggered the amendment.