package tezos-protocol-012-Psithaca

  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_012_Psithaca__Environment.Error_monad.error +=
  1. | Wrong_consensus_operation_branch of Tezos_crypto.Block_hash.t * Tezos_crypto.Block_hash.t
type Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error +=
  1. | Wrong_level_for_consensus_operation of {
    1. expected : Alpha_context.Raw_level.t;
    2. provided : Alpha_context.Raw_level.t;
    }
  2. | Wrong_round_for_consensus_operation of {
    1. expected : Alpha_context.Round.t;
    2. provided : Alpha_context.Round.t;
    }
  3. | Preendorsement_round_too_high of {
    1. block_round : Alpha_context.Round.t;
    2. provided : Alpha_context.Round.t;
    }
type Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error +=
  1. | Internal_operation_replay of Alpha_context.packed_internal_operation
type denunciation_kind =
  1. | Preendorsement
  2. | Endorsement
  3. | Block
type Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error +=
  1. | Invalid_denunciation of denunciation_kind
type Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error +=
  1. | Inconsistent_denunciation of {
    1. kind : denunciation_kind;
    2. delegate1 : Tezos_crypto.Signature.public_key_hash;
    3. delegate2 : Tezos_crypto.Signature.public_key_hash;
    }
type Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error +=
  1. | Too_early_denunciation of {
    1. kind : denunciation_kind;
    2. level : Alpha_context.Raw_level.t;
    3. current : Alpha_context.Raw_level.t;
    }
type Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error +=
  1. | Outdated_denunciation of {
    1. kind : denunciation_kind;
    2. level : Alpha_context.Raw_level.t;
    3. last_cycle : Alpha_context.Cycle.t;
    }
type Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error +=
  1. | Invalid_double_baking_evidence of {
    1. hash1 : Tezos_crypto.Block_hash.t;
    2. level1 : Alpha_context.Raw_level.t;
    3. round1 : Alpha_context.Round.t;
    4. hash2 : Tezos_crypto.Block_hash.t;
    5. level2 : Alpha_context.Raw_level.t;
    6. round2 : Alpha_context.Round.t;
    }
type Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error +=
  1. | Invalid_activation of {
    1. pkh : Tezos_crypto.Ed25519.Public_key_hash.t;
    }
type Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error +=
  1. | Gas_quota_exceeded_init_deserialize
type Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error +=
  1. | Inconsistent_sources
type Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error +=
  1. | Failing_noop_error
type Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error +=
  1. | Empty_transaction of Alpha_context.Contract.t
val begin_partial_construction : Alpha_context.t -> predecessor_level:Alpha_context.Level.t -> escape_vote:bool -> (Alpha_context.t * Apply_results.packed_successful_manager_operation_result list * Alpha_context.Liquidity_baking.escape_ema, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result Lwt.t
type 'a full_construction = {
  1. ctxt : Alpha_context.t;
  2. protocol_data : 'a;
  3. payload_producer : Tezos_crypto.Signature.public_key_hash;
  4. block_producer : Tezos_crypto.Signature.public_key_hash;
  5. round : Alpha_context.Round.t;
  6. implicit_operations_results : Apply_results.packed_successful_manager_operation_result list;
  7. liquidity_baking_escape_ema : Alpha_context.Liquidity_baking.escape_ema;
}
val begin_full_construction : Alpha_context.t -> predecessor_timestamp:Tezos_base.Time.Protocol.t -> predecessor_level:Alpha_context.Level.t -> predecessor_round:Alpha_context.Round.t -> round:Alpha_context.Round.t -> Alpha_context.Block_header.contents -> (Alpha_context.Block_header.contents full_construction, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result Lwt.t
val begin_application : Alpha_context.t -> Tezos_crypto.Chain_id.t -> Alpha_context.Block_header.t -> Alpha_context.Fitness.t -> predecessor_timestamp:Tezos_base.Time.Protocol.t -> predecessor_level:Alpha_context.Level.t -> predecessor_round:Alpha_context.Round.t -> (Alpha_context.t * Tezos_crypto.Signature.public_key * Tezos_crypto.Signature.public_key_hash * Apply_results.packed_successful_manager_operation_result list * Alpha_context.Liquidity_baking.escape_ema, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result Lwt.t
type apply_mode =
  1. | Application of {
    1. predecessor_block : Tezos_crypto.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_crypto.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;
    }
val apply_operation : Alpha_context.t -> Tezos_crypto.Chain_id.t -> apply_mode -> Script_ir_translator.unparsing_mode -> payload_producer:Alpha_context.public_key_hash -> Tezos_crypto.Operation_hash.t -> 'a Alpha_context.operation -> (Alpha_context.t * 'a Apply_results.operation_metadata, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result Lwt.t
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
val finalize_application : Alpha_context.t -> finalize_application_mode -> Alpha_context.Block_header.contents -> payload_producer:Alpha_context.public_key_hash -> block_producer:Alpha_context.public_key_hash -> Alpha_context.Liquidity_baking.escape_ema -> Apply_results.packed_successful_manager_operation_result list -> round:Alpha_context.Round.t -> predecessor:Tezos_crypto.Block_hash.t -> migration_balance_updates:Alpha_context.Receipt.balance_updates -> (Alpha_context.t * Alpha_context.Fitness.t * Apply_results.block_metadata, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result Lwt.t
val apply_contents_list : Alpha_context.t -> Tezos_crypto.Chain_id.t -> apply_mode -> Script_ir_translator.unparsing_mode -> payload_producer:Alpha_context.public_key_hash -> 'kind Alpha_context.operation -> 'kind Alpha_context.contents_list -> (Alpha_context.t * 'kind Apply_results.contents_result_list, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result Lwt.t
val precheck_manager_contents_list : Alpha_context.t -> 'kind Alpha_context.Kind.manager Alpha_context.contents_list -> mempool_mode:bool -> (Alpha_context.context * 'kind Alpha_context.Kind.manager Apply_results.prechecked_contents_list, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result Lwt.t

precheck_manager_contents_list validation_state contents_list Returns an updated context, and a list of prechecked contents containing balance updates for fees related to each manager operation in contents_list

If mempool_mode, the function checks whether the total gas limit of this batch of operation is below the gas_limit of a block and fails with a permanent error when above. Otherwise, the gas limit of the batch is removed from the one of the block (when possible) before moving on.

val value_of_key : Alpha_context.t -> Environment_context.Context.cache_key -> (Environment_context.Context.cache_value, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result Lwt.t

value_of_key ctxt k builds a value identified by key k so that it can be put into the cache.

val cache_layout : int list

cache_layout describes how the caches needed by the protocol. The length of the list defines the number of caches while each element of this list corresponds to the size limit of each cache.

val are_endorsements_required : Alpha_context.t -> level:Alpha_context.Raw_level.t -> (bool, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result Lwt.t

Check if endorsements are required for a given level.

val check_minimum_endorsements : endorsing_power:int -> minimum:int -> (unit, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result Lwt.t

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

val check_manager_signature : Alpha_context.t -> Tezos_crypto.Chain_id.t -> 'a Alpha_context.Kind.manager Alpha_context.contents_list -> 'b Alpha_context.operation -> (unit, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result Lwt.t

check_manager_signature validation_state op raw_operation The function starts by retrieving the public key hash pkh of the manager operation. In case the operation is batched, the function also checks that the sources are all the same. Once the pkh is retrieved, the function looks for its associated public key. For that, the manager operation is inspected to check if it contains a public key revelation. If not, the public key is searched in the context.

  • returns

    Error Invalid_signature if the signature check fails

  • returns

    Error Unrevealed_manager_key if the manager has not yet been revealed

  • returns

    Error Failure "get_manager_key" if the key is not found in the context

  • returns

    Error Inconsistent_sources if the operations in a batch are not from the same manager

OCaml

Innovation. Community. Security.