package tezos-protocol-015-PtLimaPt

  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 application_state, 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_015_PtLimaPt.Error_monad.error +=
  1. | Internal_operation_replay of Apply_internal_results.packed_internal_operation
  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 mode =
  1. | Application of {
    1. block_header : Alpha_context.Block_header.t;
    2. fitness : Alpha_context.Fitness.t;
    3. payload_producer : Alpha_context.Consensus_key.t;
    4. block_producer : Alpha_context.Consensus_key.t;
    5. predecessor_level : Alpha_context.Level.t;
    6. predecessor_round : Alpha_context.Round.t;
    }
  2. | Full_construction of {
    1. predecessor : Tezos_protocol_environment_015_PtLimaPt.Block_hash.t;
    2. payload_producer : Alpha_context.Consensus_key.t;
    3. block_producer : Alpha_context.Consensus_key.t;
    4. block_data_contents : Alpha_context.Block_header.contents;
    5. round : Alpha_context.Round.t;
    6. predecessor_level : Alpha_context.Level.t;
    7. predecessor_round : Alpha_context.Round.t;
    }
  3. | Partial_construction of {
    1. predecessor_level : Alpha_context.Raw_level.t;
    2. predecessor_fitness : Alpha_context.Fitness.raw;
    }
    (*

    This mode is mainly intended to be used by a mempool.

    *)
type application_state = {
  1. ctxt : Alpha_context.context;
  2. chain_id : Tezos_protocol_environment_015_PtLimaPt.Chain_id.t;
  3. mode : mode;
  4. op_count : int;
  5. migration_balance_updates : Alpha_context.Receipt.balance_updates;
  6. liquidity_baking_toggle_ema : Alpha_context.Liquidity_baking.Toggle_EMA.t;
  7. implicit_operations_results : Apply_results.packed_successful_manager_operation_result list;
}

Initialize an application_state for the partial construction of a block. This is similar to construction but less information is required as this will not yield a final valid block.

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).

For non-manager operations, the application of a validated operation should always fully succeed.

For manager operations, the application has two stages. The first stage consists in updating 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. The Validate module is responsible for ensuring that the operation is solvable, i.e. that fees can be taken, i.e. that the first stage of manager operation application cannot fail. If this stage fails nevertheless, the function returns an error.

The second stage of this function (still in the case of a manager operation) 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 metadata that contain the error. This means that the operation has no other effects than those described above during the first phase.

OCaml

Innovation. Community. Security.