package tezos-protocol-018-Proxford

  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:

  • preattestation
  • attestation
  • double baking evidence
  • double preattestation evidence
  • double attestation 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
  • smart rollup origination
  • smart rollup add messages
  • smart rollup publish
  • smart rollup cement
  • smart rollup refute
  • smart rollup timeout
  • smart rollup execute outbox message
  • smart rollup recover bond
  • zk rollup origination
  • zk rollup publish
  • zk rollup update

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. | Attestation : Kind.attestation consensus_operation_type
  2. | Preattestation : Kind.preattestation 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 'kind operation = {
  1. shell : Tezos_protocol_environment_018_Proxford.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_018_Proxford.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. | Preattestation : consensus_content -> Kind.preattestation contents
  2. | Attestation : consensus_content -> Kind.attestation contents
  3. | Dal_attestation : Dal_attestation_repr.operation -> Kind.dal_attestation contents
  4. | Seed_nonce_revelation : {
    1. level : Raw_level_repr.t;
    2. nonce : Seed_repr.nonce;
    } -> Kind.seed_nonce_revelation contents
  5. | Vdf_revelation : {
    1. solution : Seed_repr.vdf_solution;
    } -> Kind.vdf_revelation contents
  6. | Double_preattestation_evidence : {
    1. op1 : Kind.preattestation operation;
    2. op2 : Kind.preattestation operation;
    } -> Kind.double_preattestation_evidence contents
  7. | Double_attestation_evidence : {
    1. op1 : Kind.attestation operation;
    2. op2 : Kind.attestation operation;
    } -> Kind.double_attestation_evidence contents
  8. | Double_baking_evidence : {
    1. bh1 : Block_header_repr.t;
    2. bh2 : Block_header_repr.t;
    } -> Kind.double_baking_evidence contents
  9. | Activate_account : {
    1. id : Tezos_protocol_environment_018_Proxford.Ed25519.Public_key_hash.t;
    2. activation_code : Blinded_public_key_hash.activation_code;
    } -> Kind.activate_account contents
  10. | Proposals : {
    1. source : Tezos_protocol_environment_018_Proxford.Signature.Public_key_hash.t;
    2. period : int32;
    3. proposals : Tezos_protocol_environment_018_Proxford.Protocol_hash.t list;
    } -> Kind.proposals contents
  11. | Ballot : {
    1. source : Tezos_protocol_environment_018_Proxford.Signature.Public_key_hash.t;
    2. period : int32;
    3. proposal : Tezos_protocol_environment_018_Proxford.Protocol_hash.t;
    4. ballot : Vote_repr.ballot;
    } -> Kind.ballot contents
  12. | Drain_delegate : {
    1. consensus_key : Tezos_protocol_environment_018_Proxford.Signature.Public_key_hash.t;
    2. delegate : Tezos_protocol_environment_018_Proxford.Signature.Public_key_hash.t;
    3. destination : Tezos_protocol_environment_018_Proxford.Signature.Public_key_hash.t;
    } -> Kind.drain_delegate contents
  13. | Failing_noop : string -> Kind.failing_noop contents
  14. | Manager_operation : {
    1. source : Tezos_protocol_environment_018_Proxford.Signature.Public_key_hash.t;
    2. fee : Tez_repr.tez;
    3. counter : Manager_counter_repr.t;
    4. operation : 'kind manager_operation;
    5. gas_limit : Gas_limit_repr.Arith.integral;
    6. storage_limit : Tezos_protocol_environment_018_Proxford.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_018_Proxford.Signature.Public_key.t -> Kind.reveal manager_operation
  2. | Transaction : {
    1. amount : Tez_repr.tez;
    2. parameters : Script_repr.lazy_expr;
    3. entrypoint : Entrypoint_repr.t;
    4. destination : Contract_repr.t;
    } -> Kind.transaction manager_operation
  3. | Origination : {
    1. delegate : Tezos_protocol_environment_018_Proxford.Signature.Public_key_hash.t option;
    2. script : Script_repr.t;
    3. credit : Tez_repr.tez;
    } -> Kind.origination manager_operation
  4. | Delegation : Tezos_protocol_environment_018_Proxford.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. | Increase_paid_storage : {
    1. amount_in_bytes : Tezos_protocol_environment_018_Proxford.Z.t;
    2. destination : Contract_hash.t;
    } -> Kind.increase_paid_storage manager_operation
  8. | Update_consensus_key : Tezos_protocol_environment_018_Proxford.Signature.Public_key.t -> Kind.update_consensus_key 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.

    *)
  9. | 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 : Ticket_amount.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
  10. | Dal_publish_slot_header : Dal_operations_repr.Publish_slot_header.t -> Kind.dal_publish_slot_header manager_operation
    (*

    Sc_rollup_originate allows an implicit account to originate a new smart contract rollup (initialized with a given boot sector). The parameters_ty field allows to provide the expected interface of the rollup being originated (i.e. its entrypoints with their associated signatures) as a Michelson type.

    *)
  11. | Sc_rollup_originate : {
    1. kind : Sc_rollups.Kind.t;
    2. boot_sector : string;
    3. parameters_ty : Script_repr.lazy_expr;
    4. whitelist : Sc_rollup_whitelist_repr.t option;
    } -> Kind.sc_rollup_originate manager_operation
  12. | Sc_rollup_add_messages : {
    1. messages : string list;
    } -> Kind.sc_rollup_add_messages manager_operation
  13. | Sc_rollup_cement : {
    1. rollup : Sc_rollup_repr.t;
    } -> Kind.sc_rollup_cement manager_operation
  14. | Sc_rollup_publish : {
    1. rollup : Sc_rollup_repr.t;
    2. commitment : Sc_rollup_commitment_repr.t;
    } -> Kind.sc_rollup_publish manager_operation
  15. | Sc_rollup_refute : {
    1. rollup : Sc_rollup_repr.t;
    2. opponent : Sc_rollup_repr.Staker.t;
    3. refutation : Sc_rollup_game_repr.refutation;
    } -> Kind.sc_rollup_refute manager_operation
    (*

    Sc_rollup_refute { rollup; opponent; refutation } makes a move in a refutation game between the source of the operation and the opponent under the given rollup. Both players must be stakers on commitments in conflict. When refutation = None, the game is initialized. Next, when refutation = Some move, move is the next play for the current player. See Sc_rollup_game_repr for details. *

    *)
  16. | Sc_rollup_timeout : {
    1. rollup : Sc_rollup_repr.t;
    2. stakers : Sc_rollup_game_repr.Index.t;
    } -> Kind.sc_rollup_timeout manager_operation
  17. | Sc_rollup_execute_outbox_message : {
    1. rollup : Sc_rollup_repr.t;
      (*

      The smart-contract rollup.

      *)
    2. cemented_commitment : Sc_rollup_commitment_repr.Hash.t;
      (*

      The hash of the last cemented commitment that the proof refers to.

      *)
    3. output_proof : string;
      (*

      A message along with a proof that it is included in the outbox at a given outbox level and message index.

      *)
    } -> Kind.sc_rollup_execute_outbox_message manager_operation
  18. | Sc_rollup_recover_bond : {
    1. sc_rollup : Sc_rollup_repr.t;
    2. staker : Tezos_protocol_environment_018_Proxford.Signature.Public_key_hash.t;
    } -> Kind.sc_rollup_recover_bond manager_operation
  19. | Zk_rollup_origination : {
    1. public_parameters : Tezos_protocol_environment_018_Proxford.Plonk.public_parameters;
    2. circuits_info : [ `Public | `Private | `Fee ] Zk_rollup_account_repr.SMap.t;
      (*

      Circuit names, alongside a tag indicating its kind.

      *)
    3. init_state : Zk_rollup_state_repr.t;
    4. nb_ops : int;
    } -> Kind.zk_rollup_origination manager_operation
  20. | Zk_rollup_publish : {
    1. zk_rollup : Zk_rollup_repr.t;
    2. ops : (Zk_rollup_operation_repr.t * Zk_rollup_ticket_repr.t option) list;
    } -> Kind.zk_rollup_publish manager_operation
  21. | Zk_rollup_update : {
    1. zk_rollup : Zk_rollup_repr.t;
    2. update : Zk_rollup_update_repr.t;
    } -> Kind.zk_rollup_update manager_operation

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

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

Operation encoding that accepts legacy attestation name : `endorsement` (and preendorsement, double_<op>_evidence) in JSON

https://gitlab.com/tezos/tezos/-/issues/5529

This encoding is temporary and should be removed when the endorsements kinds in JSON will not be accepted any more by the protocol.

val contents_encoding_with_legacy_attestation_name : packed_contents Tezos_protocol_environment_018_Proxford.Data_encoding.t
val contents_list_encoding_with_legacy_attestation_name : packed_contents_list Tezos_protocol_environment_018_Proxford.Data_encoding.t
val protocol_data_encoding_with_legacy_attestation_name : packed_protocol_data Tezos_protocol_environment_018_Proxford.Data_encoding.t
val raw : _ operation -> raw

Each operation belongs to a validation pass that is an integer abstracting its priority in a block. Except Failing_noop.

val consensus_pass : int

The validation pass of consensus operations.

val voting_pass : int

The validation pass of voting operations.

val anonymous_pass : int

The validation pass of anonymous operations.

val manager_pass : int

The validation pass of anonymous operations.

val acceptable_pass : packed_operation -> int option

acceptable_pass op returns either the validation_pass of op when defines and None when op is Failing_noop.

val compare_by_passes : packed_operation -> packed_operation -> int

compare_by_passes orders two operations in the reverse order of their acceptable passes.

compare (oph1,op1) (oph2,op2) defines a total ordering relation on operations.

The following requirements must be satisfied: oph1 is the Operation.hash op1, oph2 is Operation.hash op2, and that op1 and op2 are valid in the same context.

compare (oph1,op1) (oph2,op2) = 0 happens only if Operation_hash.compare oph1 oph2 = 0, meaning when op1 and op2 are structurally identical.

Two valid operations of different validation_pass are compared according to acceptable_passes: the one with the smaller pass being the greater.

Two valid operations of the same validation_pass are compared according to a weight, computed thanks to their static information.

The global order is as follows:

Attestation and Preattestation > Dal_attestation > Proposals > Ballot > Double_preattestation_evidence > Double_attestation_evidence > Double_baking_evidence > Vdf_revelation > Seed_nonce_revelation > Activate_account > Drain_delegate > Manager_operation.

Attestation and Preattestation are compared by the pair of their level and round such as the farther to the current state level and round is greater; e.g. the greater pair in lexicographic order being the better. When equal and both operations being of the same kind, we compare their slot: the The smaller being the better, assuming that the more slots an attester has, the smaller is its smallest slot. When the pair is equal and comparing an Attestation to a Preattestation, the Attestation is better.

Two Dal_attestation ops are compared in the lexicographic order of the tuple of their level, their slot, their number of slots attested as available, and their attesters' hash.

Two voting operations are compared in the lexicographic order of the pair of their period and source. A Proposals is better than a Ballot.

Two denunciations of the same kind are compared such as the farther to the current state the better. For Double_baking_evidence in the case of equality, they are compared by the hashes of their first denounced block_header.

Two Vdf_revelation ops are compared by their solution.

Two Seed_nonce_relevation ops are compared by their level.

Two Activate_account ops are compared by their id.

Two Drain_delegate ops are compared by their delegate.

Two Manager_operations are compared in the lexicographic order of the pair of their fee/gas_limit ratios and source.

val unsigned_operation_length : _ operation -> int

Measuring the length of an operation, ignoring its signature. This is useful to define a gas model for the check of the signature.

Check the signature of an operation. This function serializes the operation before calling the Signature.check function with the appropriate watermark.

type ('a, 'b) eq =
  1. | Eq : ('a, 'a) eq
val equal : 'a operation -> 'b operation -> ('a, 'b) eq option
module Encoding : sig ... end
module Internal_for_benchmarking : sig ... end
OCaml

Innovation. Community. Security.