package tezos-protocol-013-PtJakart

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

Tezos Protocol Implementation - Low level Repr. of Operations

Defines kinds of operations that can be performed on chain:

  • preendorsement
  • endorsement
  • double baking evidence
  • double preendorsing evidence
  • double endorsing evidence
  • seed nonce revelation
  • account activation
  • proposal (see: Voting_repr)
  • ballot (see: Voting_repr)
  • failing noop
  • manager operation (which in turn has several types):
  • revelation
  • transaction
  • origination
  • delegation
  • set deposits limitation
  • tx rollup origination
  • tx rollup batch submission
  • tx rollup commit
  • tx rollup withdraw
  • tx rollup reveal withdrawals
  • smart contract rollup origination

Each of them can be encoded as raw bytes. Operations are distinguished at type level using phantom type parameters. packed_operation type allows for unifying them when required, for instance to put them on a single list.

module Kind : sig ... end
type 'a consensus_operation_type =
  1. | Endorsement : Kind.endorsement consensus_operation_type
  2. | Preendorsement : Kind.preendorsement consensus_operation_type
type consensus_content = {
  1. slot : Slot_repr.t;
  2. level : Raw_level_repr.t;
  3. round : Round_repr.t;
  4. block_payload_hash : Block_payload_hash.t;
}
type transaction = {
  1. amount : Tez_repr.tez;
  2. parameters : Script_repr.lazy_expr;
  3. entrypoint : Entrypoint_repr.t;
  4. destination : Destination_repr.t;
}
type 'kind operation = {
  1. shell : Tezos_protocol_environment_013_PtJakart.Operation.shell_header;
  2. protocol_data : 'kind protocol_data;
}

An operation contains the operation header information in shell and all data related to the operation itself in protocol_data.

and 'kind protocol_data = {
  1. contents : 'kind contents_list;
  2. signature : Tezos_protocol_environment_013_PtJakart.Signature.t option;
}

A protocol_data wraps together a signature for the operation and the contents of the operation itself.

and _ contents_list =
  1. | Single : 'kind contents -> 'kind contents_list
  2. | Cons : 'kind Kind.manager contents * 'rest Kind.manager contents_list -> ('kind * 'rest) Kind.manager contents_list

A contents_list is a list of contents, the GADT guarantees two invariants:

  • the list is not empty, and
  • if the list has several elements then it only contains manager operations.
and _ contents =
  1. | Preendorsement : consensus_content -> Kind.preendorsement contents
  2. | Endorsement : consensus_content -> Kind.endorsement contents
  3. | Seed_nonce_revelation : {
    1. level : Raw_level_repr.t;
    2. nonce : Seed_repr.nonce;
    } -> Kind.seed_nonce_revelation contents
  4. | Double_preendorsement_evidence : {
    1. op1 : Kind.preendorsement operation;
    2. op2 : Kind.preendorsement operation;
    } -> Kind.double_preendorsement_evidence contents
  5. | Double_endorsement_evidence : {
    1. op1 : Kind.endorsement operation;
    2. op2 : Kind.endorsement operation;
    } -> Kind.double_endorsement_evidence contents
  6. | Double_baking_evidence : {
    1. bh1 : Block_header_repr.t;
    2. bh2 : Block_header_repr.t;
    } -> Kind.double_baking_evidence contents
  7. | Activate_account : {
    1. id : Tezos_protocol_environment_013_PtJakart.Ed25519.Public_key_hash.t;
    2. activation_code : Blinded_public_key_hash.activation_code;
    } -> Kind.activate_account contents
  8. | Proposals : {
    1. source : Tezos_protocol_environment_013_PtJakart.Signature.Public_key_hash.t;
    2. period : int32;
    3. proposals : Tezos_protocol_environment_013_PtJakart.Protocol_hash.t list;
    } -> Kind.proposals contents
  9. | Ballot : {
    1. source : Tezos_protocol_environment_013_PtJakart.Signature.Public_key_hash.t;
    2. period : int32;
    3. proposal : Tezos_protocol_environment_013_PtJakart.Protocol_hash.t;
    4. ballot : Vote_repr.ballot;
    } -> Kind.ballot contents
  10. | Failing_noop : string -> Kind.failing_noop contents
  11. | Manager_operation : {
    1. source : Tezos_protocol_environment_013_PtJakart.Signature.Public_key_hash.t;
    2. fee : Tez_repr.tez;
    3. counter : counter;
    4. operation : 'kind manager_operation;
    5. gas_limit : Gas_limit_repr.Arith.integral;
    6. storage_limit : Tezos_protocol_environment_013_PtJakart.Z.t;
    } -> 'kind Kind.manager contents

A value of type contents an operation related to whether consensus, governance or contract management.

and _ manager_operation =
  1. | Reveal : Tezos_protocol_environment_013_PtJakart.Signature.Public_key.t -> Kind.reveal manager_operation
  2. | Transaction : transaction -> Kind.transaction manager_operation
  3. | Origination : origination -> Kind.origination manager_operation
  4. | Delegation : Tezos_protocol_environment_013_PtJakart.Signature.Public_key_hash.t option -> Kind.delegation manager_operation
  5. | Register_global_constant : {
    1. value : Script_repr.lazy_expr;
    } -> Kind.register_global_constant manager_operation
  6. | Set_deposits_limit : Tez_repr.t option -> Kind.set_deposits_limit manager_operation
  7. | Tx_rollup_origination : Kind.tx_rollup_origination manager_operation
  8. | Tx_rollup_submit_batch : {
    1. tx_rollup : Tx_rollup_repr.t;
    2. content : string;
    3. burn_limit : Tez_repr.t option;
    } -> Kind.tx_rollup_submit_batch manager_operation
  9. | Tx_rollup_commit : {
    1. tx_rollup : Tx_rollup_repr.t;
    2. commitment : Tx_rollup_commitment_repr.Full.t;
    } -> Kind.tx_rollup_commit manager_operation
  10. | Tx_rollup_return_bond : {
    1. tx_rollup : Tx_rollup_repr.t;
    } -> Kind.tx_rollup_return_bond manager_operation
  11. | Tx_rollup_finalize_commitment : {
    1. tx_rollup : Tx_rollup_repr.t;
    } -> Kind.tx_rollup_finalize_commitment manager_operation
  12. | Tx_rollup_remove_commitment : {
    1. tx_rollup : Tx_rollup_repr.t;
    } -> Kind.tx_rollup_remove_commitment manager_operation
  13. | Tx_rollup_rejection : {
    1. tx_rollup : Tx_rollup_repr.t;
    2. level : Tx_rollup_level_repr.t;
    3. message : Tx_rollup_message_repr.t;
    4. message_position : int;
    5. message_path : Tx_rollup_inbox_repr.Merkle.path;
    6. message_result_hash : Tx_rollup_message_result_hash_repr.t;
    7. message_result_path : Tx_rollup_commitment_repr.Merkle.path;
    8. previous_message_result : Tx_rollup_message_result_repr.t;
    9. previous_message_result_path : Tx_rollup_commitment_repr.Merkle.path;
    10. proof : Tx_rollup_l2_proof.t;
    } -> Kind.tx_rollup_rejection manager_operation
  14. | Tx_rollup_dispatch_tickets : {
    1. tx_rollup : Tx_rollup_repr.t;
      (*

      The rollup from where the tickets are retrieved

      *)
    2. level : Tx_rollup_level_repr.t;
      (*

      The level at which the withdrawal was enabled

      *)
    3. context_hash : Tezos_protocol_environment_013_PtJakart.Context_hash.t;
      (*

      The hash of the l2 context resulting from the execution of the inbox from where this withdrawal was enabled.

      *)
    4. message_index : int;
      (*

      Index of the message in the inbox at level where this withdrawal was enabled.

      *)
    5. message_result_path : Tx_rollup_commitment_repr.Merkle.path;
    6. tickets_info : Tx_rollup_reveal_repr.t list;
    } -> Kind.tx_rollup_dispatch_tickets manager_operation
    (*

    Transfer_ticket allows an implicit account (the "claimer") to receive amount tickets, pulled out of tx_rollup, to the entrypoint of the smart contract destination.

    The ticket must have been addressed to the claimer, who must be the source of this operation. It must have been pulled out at level and from the message at message_index. The ticket is composed of ticketer; ty; contents.

    *)
  15. | Transfer_ticket : {
    1. contents : Script_repr.lazy_expr;
      (*

      Contents of the withdrawn ticket

      *)
    2. ty : Script_repr.lazy_expr;
      (*

      Type of the withdrawn ticket's contents

      *)
    3. ticketer : Contract_repr.t;
      (*

      Ticketer of the withdrawn ticket

      *)
    4. amount : Tezos_protocol_environment_013_PtJakart.Z.t;
      (*

      Quantity of the withdrawn ticket. Must match the amount that was enabled.

      *)
    5. destination : Contract_repr.t;
      (*

      The smart contract address that should receive the tickets.

      *)
    6. entrypoint : Entrypoint_repr.t;
      (*

      The entrypoint of the smart contract address that should receive the tickets.

      *)
    } -> Kind.transfer_ticket manager_operation
  16. | Sc_rollup_originate : {
    1. kind : Sc_rollup_repr.Kind.t;
    2. boot_sector : string;
    } -> Kind.sc_rollup_originate manager_operation
  17. | Sc_rollup_add_messages : {
    1. rollup : Sc_rollup_repr.t;
    2. messages : string list;
    } -> Kind.sc_rollup_add_messages manager_operation
  18. | Sc_rollup_cement : {
    1. rollup : Sc_rollup_repr.t;
    2. commitment : Sc_rollup_repr.Commitment_hash.t;
    } -> Kind.sc_rollup_cement manager_operation
  19. | Sc_rollup_publish : {
    1. rollup : Sc_rollup_repr.t;
    2. commitment : Sc_rollup_repr.Commitment.t;
    } -> Kind.sc_rollup_publish manager_operation

A manager_operation describes management and interactions between contracts (whether implicit or smart).

Counters are used as anti-replay protection mechanism in manager operations: each manager account stores a counter and each manager operation declares a value for the counter. When a manager operation is applied, the value of the counter of its manager is checked and incremented.

type packed_manager_operation =
  1. | Manager : 'kind manager_operation -> packed_manager_operation
type packed_contents =
  1. | Contents : 'kind contents -> packed_contents
type packed_contents_list =
  1. | Contents_list : 'kind contents_list -> packed_contents_list
type packed_protocol_data =
  1. | Operation_data : 'kind protocol_data -> packed_protocol_data
val pack : 'kind operation -> packed_operation
val manager_kind : 'kind manager_operation -> 'kind Kind.manager
val raw : _ operation -> raw
val acceptable_passes : packed_operation -> int list
type ('a, 'b) eq =
  1. | Eq : ('a, 'a) eq
val equal : 'a operation -> 'b operation -> ('a, 'b) eq option
module Encoding : sig ... end
OCaml

Innovation. Community. Security.