Tezos_raw_protocol_023_PtSeouLo.Operation_reprTezos Protocol Implementation - Low level Repr. of Operations
Defines kinds of operations that can be performed on chain:
Voting_repr)Voting_repr)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 ... endtype 'a consensus_operation_type = | Attestation : Kind.attestation consensus_operation_type| Preattestation : Kind.preattestation consensus_operation_type| Preattestations_aggregate : Kind.preattestations_aggregate
consensus_operation_type| Attestations_aggregate : Kind.attestations_aggregate consensus_operation_typetype consensus_aggregate_content = {level : Raw_level_repr.t;round : Round_repr.t;block_payload_hash : Block_payload_hash.t;}type consensus_content = {slot : Slot_repr.t;level : Raw_level_repr.t;round : Round_repr.t;block_payload_hash : Block_payload_hash.t;}val consensus_content_encoding :
consensus_content Tezos_protocol_environment_023_PtSeouLo.Data_encoding.tval pp_consensus_content :
Tezos_protocol_environment_023_PtSeouLo.Format.formatter ->
consensus_content ->
unitThe DAL content in an attestation operation having some level l refers to a slot published at level l - attestation_lag + 1. Whenever there is a need to disambiguate, one should use "attestation level" for the level inside the operation and "attested level" for the level of the block including the operation. We have:
attestation_level + 1 = attested_levelpublished_level + attestation_lag = attested_leveltype consensus_watermark = | Attestation of Tezos_protocol_environment_023_PtSeouLo.Chain_id.t| Preattestation of Tezos_protocol_environment_023_PtSeouLo.Chain_id.tval to_watermark :
consensus_watermark ->
Tezos_protocol_environment_023_PtSeouLo.Signature.watermarkval of_watermark :
Tezos_protocol_environment_023_PtSeouLo.Signature.watermark ->
consensus_watermark optionval consensus_key_kind_encoding :
consensus_key_kind Tezos_protocol_environment_023_PtSeouLo.Data_encoding.tval pp_consensus_key_kind :
Tezos_protocol_environment_023_PtSeouLo.Format.formatter ->
consensus_key_kind ->
unitval public_key_kind_encoding :
public_key_kind Tezos_protocol_environment_023_PtSeouLo.Data_encoding.tval pp_public_key_kind :
Tezos_protocol_environment_023_PtSeouLo.Format.formatter ->
public_key_kind ->
unitval consensus_to_public_key_kind : consensus_key_kind -> public_key_kindtype raw = Tezos_protocol_environment_023_PtSeouLo.Operation.t = {shell : Tezos_protocol_environment_023_PtSeouLo.Operation.shell_header;proto : bytes;}val raw_encoding : raw Tezos_protocol_environment_023_PtSeouLo.Data_encoding.ttype 'kind operation = {shell : Tezos_protocol_environment_023_PtSeouLo.Operation.shell_header;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 = {contents : 'kind contents_list;signature : Tezos_protocol_environment_023_PtSeouLo.Signature.t option;}A protocol_data wraps together a signature for the operation and the contents of the operation itself.
and _ contents_list = | Single : 'kind contents -> 'kind contents_list| Cons : 'kind Kind.manager contents
* 'rest Kind.manager contents_list -> ('kind * 'rest) Kind.manager
contents_listA contents_list is a list of contents, the GADT guarantees two invariants:
and _ contents = | Preattestation : consensus_content -> Kind.preattestation contents| Attestation : {consensus_content : consensus_content;dal_content : dal_content option;} -> Kind.attestation contents| Preattestations_aggregate : {consensus_content : consensus_aggregate_content;committee : Slot_repr.t list;} -> Kind.preattestations_aggregate contents| Attestations_aggregate : {consensus_content : consensus_aggregate_content;committee : (Slot_repr.t * dal_content option) list;} -> Kind.attestations_aggregate contents| Seed_nonce_revelation : {level : Raw_level_repr.t;nonce : Seed_repr.nonce;} -> Kind.seed_nonce_revelation contents| Vdf_revelation : {solution : Seed_repr.vdf_solution;} -> Kind.vdf_revelation contents| Double_consensus_operation_evidence : {slot : Slot_repr.t;op1 : 'a Kind.consensus operation;op2 : 'b Kind.consensus operation;} -> Kind.double_consensus_operation_evidence contents| Double_baking_evidence : {bh1 : Block_header_repr.t;bh2 : Block_header_repr.t;} -> Kind.double_baking_evidence contents| Dal_entrapment_evidence : {attestation : 'a Kind.consensus operation;consensus_slot : Slot_repr.t;slot_index : Dal_slot_index_repr.t;shard_with_proof : Dal_slot_repr.Shard_with_proof.t;} -> Kind.dal_entrapment_evidence contents| Activate_account : {id : Tezos_protocol_environment_023_PtSeouLo.Ed25519.Public_key_hash.t;activation_code : Blinded_public_key_hash.activation_code;} -> Kind.activate_account contents| Proposals : {source : Tezos_protocol_environment_023_PtSeouLo.Signature.Public_key_hash.t;period : int32;proposals : Tezos_protocol_environment_023_PtSeouLo.Protocol_hash.t list;} -> Kind.proposals contents| Ballot : {source : Tezos_protocol_environment_023_PtSeouLo.Signature.Public_key_hash.t;period : int32;proposal : Tezos_protocol_environment_023_PtSeouLo.Protocol_hash.t;ballot : Vote_repr.ballot;} -> Kind.ballot contents| Drain_delegate : {consensus_key : Tezos_protocol_environment_023_PtSeouLo.Signature.Public_key_hash.t;delegate : Tezos_protocol_environment_023_PtSeouLo.Signature.Public_key_hash.t;destination : Tezos_protocol_environment_023_PtSeouLo.Signature.Public_key_hash.t;} -> Kind.drain_delegate contents| Failing_noop : string -> Kind.failing_noop contents| Manager_operation : {source : Tezos_protocol_environment_023_PtSeouLo.Signature.Public_key_hash.t;fee : Tez_repr.t;counter : Manager_counter_repr.t;operation : 'kind manager_operation;gas_limit : Gas_limit_repr.Arith.integral;storage_limit : Tezos_protocol_environment_023_PtSeouLo.Z.t;} -> 'kind Kind.manager contentsA value of type contents an operation related to whether consensus, governance or contract management.
and _ manager_operation = | Reveal : {public_key : Tezos_protocol_environment_023_PtSeouLo.Signature.Public_key.t;proof : Tezos_protocol_environment_023_PtSeouLo.Bls.t option;} -> Kind.reveal manager_operation| Transaction : {amount : Tez_repr.t;parameters : Script_repr.lazy_expr;entrypoint : Entrypoint_repr.t;destination : Contract_repr.t;} -> Kind.transaction manager_operation| Origination : {delegate : Tezos_protocol_environment_023_PtSeouLo.Signature.Public_key_hash.t
option;script : Script_repr.t;credit : Tez_repr.t;} -> Kind.origination manager_operation| Delegation : Tezos_protocol_environment_023_PtSeouLo.Signature.Public_key_hash.t
option -> Kind.delegation manager_operation| Register_global_constant : {value : Script_repr.lazy_expr;} -> Kind.register_global_constant manager_operation| Set_deposits_limit : Tez_repr.t option -> Kind.set_deposits_limit
manager_operation| Increase_paid_storage : {amount_in_bytes : Tezos_protocol_environment_023_PtSeouLo.Z.t;destination : Contract_hash.t;} -> Kind.increase_paid_storage manager_operation| Update_consensus_key : {public_key : Tezos_protocol_environment_023_PtSeouLo.Signature.Public_key.t;proof : Tezos_protocol_environment_023_PtSeouLo.Bls.t option;kind : consensus_key_kind;} -> Kind.update_consensus_key manager_operationTransfer_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.
| Transfer_ticket : {contents : Script_repr.lazy_expr;Contents of the withdrawn ticket
*)ty : Script_repr.lazy_expr;Type of the withdrawn ticket's contents
*)ticketer : Contract_repr.t;Ticketer of the withdrawn ticket
*)amount : Ticket_amount.t;Quantity of the withdrawn ticket. Must match the amount that was enabled.
*)destination : Contract_repr.t;The smart contract address that should receive the tickets.
*)entrypoint : Entrypoint_repr.t;The entrypoint of the smart contract address that should receive the tickets.
*)} -> Kind.transfer_ticket manager_operation| Dal_publish_commitment : Dal_operations_repr.Publish_commitment.t ->
Kind.dal_publish_commitment
manager_operationSc_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.
| Sc_rollup_originate : {kind : Sc_rollups.Kind.t;boot_sector : string;parameters_ty : Script_repr.lazy_expr;whitelist : Sc_rollup_whitelist_repr.t option;} -> Kind.sc_rollup_originate manager_operation| Sc_rollup_add_messages : {} -> Kind.sc_rollup_add_messages manager_operation| Sc_rollup_cement : {rollup : Sc_rollup_repr.t;} -> Kind.sc_rollup_cement manager_operation| Sc_rollup_publish : {rollup : Sc_rollup_repr.t;commitment : Sc_rollup_commitment_repr.t;} -> Kind.sc_rollup_publish manager_operation| Sc_rollup_refute : {rollup : Sc_rollup_repr.t;opponent : Sc_rollup_repr.Staker.t;refutation : Sc_rollup_game_repr.refutation;} -> Kind.sc_rollup_refute manager_operationSc_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. *
| Sc_rollup_timeout : {rollup : Sc_rollup_repr.t;stakers : Sc_rollup_game_repr.Index.t;} -> Kind.sc_rollup_timeout manager_operation| Sc_rollup_execute_outbox_message : {rollup : Sc_rollup_repr.t;The smart-contract rollup.
*)cemented_commitment : Sc_rollup_commitment_repr.Hash.t;The hash of the last cemented commitment that the proof refers to.
*)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| Sc_rollup_recover_bond : {sc_rollup : Sc_rollup_repr.t;staker : Tezos_protocol_environment_023_PtSeouLo.Signature.Public_key_hash.t;} -> Kind.sc_rollup_recover_bond manager_operation| Zk_rollup_origination : {public_parameters : Tezos_protocol_environment_023_PtSeouLo.Plonk.public_parameters;circuits_info : [ `Public | `Private | `Fee ] Zk_rollup_account_repr.SMap.t;Circuit names, alongside a tag indicating its kind.
*)init_state : Zk_rollup_state_repr.t;nb_ops : int;} -> Kind.zk_rollup_origination manager_operation| Zk_rollup_publish : {zk_rollup : Zk_rollup_repr.t;ops : (Zk_rollup_operation_repr.t * Zk_rollup_ticket_repr.t option) list;} -> Kind.zk_rollup_publish manager_operation| Zk_rollup_update : {zk_rollup : Zk_rollup_repr.t;update : Zk_rollup_update_repr.t;} -> Kind.zk_rollup_update manager_operationA manager_operation describes management and interactions between contracts (whether implicit or smart).
val of_list :
packed_contents list ->
packed_contents_list
Tezos_protocol_environment_023_PtSeouLo.Error_monad.tzresultval to_list : packed_contents_list -> packed_contents listtype packed_operation = {shell : Tezos_protocol_environment_023_PtSeouLo.Operation.shell_header;protocol_data : packed_protocol_data;}val pack : 'kind operation -> packed_operationval manager_kind : 'kind manager_operation -> 'kind Kind.managerval committee_slots :
(Slot_repr.t * dal_content option) list ->
Slot_repr.t listExtracts the slots from a contents.Attestations_aggregate committee.
val contents_encoding :
packed_contents Tezos_protocol_environment_023_PtSeouLo.Data_encoding.tval contents_list_encoding :
packed_contents_list Tezos_protocol_environment_023_PtSeouLo.Data_encoding.tval protocol_data_encoding :
packed_protocol_data Tezos_protocol_environment_023_PtSeouLo.Data_encoding.tval unsigned_operation_encoding :
(Tezos_protocol_environment_023_PtSeouLo.Operation.shell_header
* packed_contents_list)
Tezos_protocol_environment_023_PtSeouLo.Data_encoding.tval bls_mode_unsigned_operation_encoding :
(Tezos_protocol_environment_023_PtSeouLo.Operation.shell_header
* packed_contents_list)
Tezos_protocol_environment_023_PtSeouLo.Data_encoding.tval hash_raw : raw -> Tezos_protocol_environment_023_PtSeouLo.Operation_hash.tval hash :
_ operation ->
Tezos_protocol_environment_023_PtSeouLo.Operation_hash.tval hash_packed :
packed_operation ->
Tezos_protocol_environment_023_PtSeouLo.Operation_hash.tEach operation belongs to a validation pass that is an integer abstracting its priority in a block. Except Failing_noop.
val acceptable_pass : packed_operation -> int optionacceptable_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 -> intcompare_by_passes orders two operations in the reverse order of their acceptable passes.
val compare :
(Tezos_protocol_environment_023_PtSeouLo.Operation_hash.t * packed_operation) ->
(Tezos_protocol_environment_023_PtSeouLo.Operation_hash.t * packed_operation) ->
intcompare (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:
Attestations_aggregate, Preattestations_aggregate, Attestation and Preattestation > Proposals > Ballot > Double_preattestation_evidence > Double_attestation_evidence > Double_baking_evidence > Dal_entrapment_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 smaller being the better (assuming that the more slots an attester has, the smaller is its smallest slot), and then the number of the DAL attested slots, the more the better. When the pair is equal and comparing an Attestation to a Preattestation, the Attestation is better.
Attestations_aggregate are compared to Attestations and Preattestations by the pair of their level and round as well. If the pairs are equal, an Attestation_aggregate is preferred over an Attestation or a Preattestation. For equal pairs, two Attestations_aggregate are compared by their committee in lexicographic order.
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 Dal_entrapment_evidence ops are compared by their level and the number of slots they attest.
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 -> intMeasuring the length of an operation, ignoring its signature. This is useful to define a gas model for the check of the signature.
val bls_mode_unsigned_operation_length : _ operation -> intMeasuring the length of an operation in bls_mode, ignoring its signature.
val check_signature :
(Tezos_protocol_environment_023_PtSeouLo.Operation.shell_header
* packed_contents_list)
Tezos_protocol_environment_023_PtSeouLo.Data_encoding.t ->
Tezos_protocol_environment_023_PtSeouLo.Signature.Public_key.t ->
Tezos_protocol_environment_023_PtSeouLo.Chain_id.t ->
_ operation ->
unit Tezos_protocol_environment_023_PtSeouLo.Error_monad.tzresultCheck the signature of an operation. This function serializes the operation using the provided encoding before calling the Signature.check function with the appropriate watermark.
val serialize_unsigned_operation :
(Tezos_protocol_environment_023_PtSeouLo.Operation.shell_header
* packed_contents_list)
Tezos_protocol_environment_023_PtSeouLo.Data_encoding.t ->
_ operation ->
bytesmodule Encoding : sig ... endmodule Internal_for_benchmarking : sig ... end