package tezos-shell

  1. Overview
  2. Docs

A variant of Make above that is parameterized by CHAIN_STORE, for mocking purposes.

Parameters

Signature

type protocol_operation = Proto.operation

Similar to the same type in the protocol, see Tezos_protocol_environment.PROTOCOL.operation

type operation_receipt = Proto.operation_receipt

Similar to the same type in the protocol, see Tezos_protocol_environment.PROTOCOL

type validation_state = Proto.validation_state

Similar to the same type in the protocol, see Tezos_protocol_environment.PROTOCOL

type chain_store = Chain_store.chain_store

The type implemented by Tezos_store.Store.chain_store in production, and mocked in tests

type t

The type used internally by this module. Created by create and then passed back and possibly updated by apply_operation.

parse hash op reads a usual Operation.t and lifts it to the type protocol_operation used by this module. This function is in the tzresult monad, because it can return the following errors:

  • Validation_errors.Oversized_operation if the size of the operation data within op is too large (to protect against DoS attacks), and
  • Validation_errors.Parse_error if serialized data cannot be parsed.
val increment_successful_precheck : protocol_operation operation -> protocol_operation operation

increment_successful_precheck op increments the field count_successful_prechecks of the given operation op. It is supposed to be called after each successful precheck of a given operation op, and nowhere else. Overflow is unlikely to occur in practice, as the counter grows very slowly and the number of prechecks is bounded.

val create : chain_store -> ?protocol_data:Bytes.t -> predecessor:Tezos_store.Store.Block.t -> live_operations:Tezos_crypto.Operation_hash.Set.t -> timestamp:Tezos_base.Time.Protocol.t -> unit -> (t, Tezos_error_monad.TzCore.error list) result Lwt.t

Creates a new prevalidation context w.r.t. the protocol associate to the predecessor block . When ?protocol_data is passed to this function, it will be used to create the new block

type result =
  1. | Applied of t * operation_receipt
  2. | Branch_delayed of Tezos_error_monad.TzCore.error list
  3. | Branch_refused of Tezos_error_monad.TzCore.error list
  4. | Refused of Tezos_error_monad.TzCore.error list
  5. | Outdated of Tezos_error_monad.TzCore.error list

Values returned by create. They are obtained from the result of the protocol apply_operation function and the classification of errors.

val apply_operation : t -> protocol_operation operation -> result Lwt.t

apply_operation t op calls the protocol apply_operation function and handles possible errors, hereby yielding a classification

val validation_state : t -> validation_state

validation_state t returns the subset of t corresponding to the type validation_state of the protocol.

val pp_result : Format.formatter -> result -> unit
module Internal_for_tests : sig ... end