package tezos-protocol-014-PtKathma

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

This module supports advancing the ledger state by applying operations.

Each operation application takes and returns an Alpha_context.t, representing the old and new state, respectively.

The Main module provides wrappers for the functionality in this module, satisfying the Protocol signature.

type Tezos_protocol_environment_014_PtKathma.Error_monad.error +=
  1. | Internal_operation_replay of Apply_internal_results.packed_internal_contents
  2. | Tx_rollup_feature_disabled
  3. | Tx_rollup_invalid_transaction_ticket_amount
  4. | Sc_rollup_feature_disabled
  5. | Empty_transaction of Alpha_context.Contract.t
type apply_mode =
  1. | Application of {
    1. predecessor_block : Tezos_protocol_environment_014_PtKathma.Block_hash.t;
    2. payload_hash : Block_payload_hash.t;
    3. locked_round : Alpha_context.Round.t option;
    4. predecessor_level : Alpha_context.Level.t;
    5. predecessor_round : Alpha_context.Round.t;
    6. round : Alpha_context.Round.t;
    }
  2. | Full_construction of {
    1. predecessor_block : Tezos_protocol_environment_014_PtKathma.Block_hash.t;
    2. payload_hash : Block_payload_hash.t;
    3. predecessor_level : Alpha_context.Level.t;
    4. predecessor_round : Alpha_context.Round.t;
    5. round : Alpha_context.Round.t;
    }
  3. | Partial_construction of {
    1. predecessor_level : Alpha_context.Level.t;
    2. predecessor_round : Alpha_context.Round.t;
    3. grand_parent_round : Alpha_context.Round.t;
    }

Apply an operation, i.e. update the given context in accordance with the operation's semantic (or return an error if the operation is not applicable).

The Validate_operation.stamp argument enforces that an operation needs to be validated by Validate_operation before it can be applied.

TODO: https://gitlab.com/tezos/tezos/-/issues/2603

Currently, Validate_operation.validate_operation does nothing on non-manager operations. The "validation" of these operations is instead handled by apply_operation, which may thus return an error if the operation is ill-formed. Once validate_operation has been extended to every kind of operation, apply_operation should never return an error.

See apply_manager_operation for additional information on the application of manager operations.

type finalize_application_mode =
  1. | Finalize_full_construction of {
    1. level : Alpha_context.Raw_level.t;
    2. predecessor_round : Alpha_context.Round.t;
    }
  2. | Finalize_application of Alpha_context.Fitness.t

Update the context to reflect the application of a manager operation.

This function first updates the context to:

  • take the fees;
  • increment the account's counter;
  • decrease of the available block gas by operation's gas_limit.

These updates are mandatory. In particular, taking the fees is critically important. That's why apply_manager_operation takes a Validate_operation.stamp argument, so that it may only be called after having validated the operation by calling Validate_operation. Indeed, this module is responsible for ensuring that the operation is solvable, i.e. that fees can be taken, i.e. that the first stage of apply_manager_operation cannot fail. If this stage fails nevertheless, the function returns an error.

The second stage of this function consists in applying all the other effects, in accordance with the semantic of the operation's kind.

An error may happen during this second phase: in that case, the function returns the context obtained at the end of the first stage, and a contents_result_list that contains the error. This means that the operation has no other effects than those described above during the first phase.

Check if endorsements are required for a given level.

val check_minimum_endorsements : endorsing_power:int -> minimum:int -> unit Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult

Check if a block's endorsing power is at least the minim required.

OCaml

Innovation. Community. Security.