diff --git a/src/proto_alpha/bin_sc_rollup_node/dal_pages_request.ml b/src/proto_alpha/bin_sc_rollup_node/dal_pages_request.ml index 6c1a61fa6b84bea44825189ff7c78c4ee5d49308..804e9e4dcf021d1b4e5d3b9fc92297214a3dfc28 100644 --- a/src/proto_alpha/bin_sc_rollup_node/dal_pages_request.ml +++ b/src/proto_alpha/bin_sc_rollup_node/dal_pages_request.ml @@ -59,11 +59,11 @@ let () = (function Dal_invalid_page_for_slot page_id -> Some page_id | _ -> None) (fun page_id -> Dal_invalid_page_for_slot page_id) -let store_entry_from_published_level ~dal_endorsement_lag ~published_level store +let store_entry_from_published_level ~dal_attestation_lag ~published_level store = State.hash_of_level store @@ Int32.( - add (of_int dal_endorsement_lag) (Raw_level.to_int32 published_level)) + add (of_int dal_attestation_lag) (Raw_level.to_int32 published_level)) let check_confirmation_status_and_download ({Node_context.store; dal_cctxt; _} as node_ctxt) ~confirmed_in_block_hash @@ -103,11 +103,11 @@ let check_confirmation_status_and_download in return_none -let slot_pages ~dal_endorsement_lag ({Node_context.store; _} as node_ctxt) +let slot_pages ~dal_attestation_lag ({Node_context.store; _} as node_ctxt) Dal.Slot.Header.{published_level; index} = let open Lwt_result_syntax in let*! confirmed_in_block_hash = - store_entry_from_published_level ~dal_endorsement_lag ~published_level store + store_entry_from_published_level ~dal_attestation_lag ~published_level store in let*! processed = Store.Dal_processed_slots.find @@ -137,13 +137,13 @@ let slot_pages ~dal_endorsement_lag ({Node_context.store; _} as node_ctxt) pages |> List.map snd |> Option.some |> return -let page_content ~dal_endorsement_lag ({Node_context.store; _} as node_ctxt) +let page_content ~dal_attestation_lag ({Node_context.store; _} as node_ctxt) page_id = let open Lwt_result_syntax in let Dal.Page.{slot_id; page_index} = page_id in let Dal.Slot.Header.{published_level; index} = slot_id in let*! confirmed_in_block_hash = - store_entry_from_published_level ~dal_endorsement_lag ~published_level store + store_entry_from_published_level ~dal_attestation_lag ~published_level store in let*! processed = Store.Dal_processed_slots.find diff --git a/src/proto_alpha/bin_sc_rollup_node/dal_pages_request.mli b/src/proto_alpha/bin_sc_rollup_node/dal_pages_request.mli index 3c9fa1f20ffe69d0f1501584fafd9c8b1d2dc082..3ca07280600bdb44142c8a918a777d4a324a18e4 100644 --- a/src/proto_alpha/bin_sc_rollup_node/dal_pages_request.mli +++ b/src/proto_alpha/bin_sc_rollup_node/dal_pages_request.mli @@ -51,10 +51,10 @@ type error += Dal_slot_not_found_in_store of Dal.Slot.Header.id - the size of the list, in case it is not empty, is equal to the expected number of pages in a slot. - [dal_endorsement_lag] is used to retrieve the correct entry in [store]. + [dal_attestation_lag] is used to retrieve the correct entry in [store]. *) val slot_pages : - dal_endorsement_lag:int -> + dal_attestation_lag:int -> Node_context.t -> Dal.slot_id -> Dal.Page.content list option tzresult Lwt.t @@ -67,10 +67,10 @@ val slot_pages : otherwise, some content is only returned for confirmed pages (slots) for which the content has already been downloaded and saved to the store. - [dal_endorsement_lag] is used to retrieve the correct entry in [store]. + [dal_attestation_lag] is used to retrieve the correct entry in [store]. *) val page_content : - dal_endorsement_lag:int -> + dal_attestation_lag:int -> Node_context.t -> Dal.Page.t -> Dal.Page.content option tzresult Lwt.t diff --git a/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.ml b/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.ml index a0dd9cd5a42ec20592a8c945cecec7707815cb95..1279f4e636e9a2a3155766d65a3cfcab1541368e 100644 --- a/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.ml +++ b/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.ml @@ -62,7 +62,7 @@ let ancestor_hash ~number_of_levels {Node_context.genesis_info; l1_ctxt; _} head (* Values of type `confirmations_info` are used to catalog the status of slots published in a given block hash. These values record whether - the slot has been confirmed after the endorsement_lag has passed. *) + the slot has been confirmed after the attestation_lag has passed. *) type confirmations_info = { (* The hash of the block in which the slots have been published. *) published_block_hash : Tezos_crypto.Block_hash.t; @@ -87,7 +87,7 @@ let slots_info node_ctxt (Layer1.{hash; _} as head) = *) let open Lwt_result_syntax in let lag = - node_ctxt.Node_context.protocol_constants.parametric.dal.endorsement_lag + node_ctxt.Node_context.protocol_constants.parametric.dal.attestation_lag in (* we are downloading endorsemented for slots at level [level], so we need to download the data at level [level - lag]. @@ -109,13 +109,13 @@ let slots_info node_ctxt (Layer1.{hash; _} as head) = ~none:(TzTrace.make @@ Cannot_read_block_metadata hash) metadata in - (* `metadata.protocol_data.dal_slot_availability` is `None` if we are behind + (* `metadata.protocol_data.dal_attestation` is `None` if we are behind the `Dal feature flag`: in this case we return an empty slot endorsement. *) let confirmed_slots = Option.value - ~default:Dal.Endorsement.empty - metadata.protocol_data.dal_slot_availability + ~default:Dal.Attestation.empty + metadata.protocol_data.dal_attestation in let*! published_slots_indexes = Store.Dal_slots_headers.list_secondary_keys @@ -124,7 +124,7 @@ let slots_info node_ctxt (Layer1.{hash; _} as head) = in let confirmed_slots_indexes_list = List.filter - (Dal.Endorsement.is_available confirmed_slots) + (Dal.Attestation.is_attested confirmed_slots) published_slots_indexes in let*? confirmed_slots_indexes = @@ -296,13 +296,13 @@ module Confirmed_slots_history = struct (** Depending on the rollup's origination level and on the DAL's endorsement lag, the rollup node should start processing confirmed slots and update its slots_history and slots_history's cache entries in the store after - [origination_level + endorsement_lag] blocks. This function checks if + [origination_level + attestation_lag] blocks. This function checks if that level is reached or not. *) let should_process_dal_slots node_ctxt block_level = let open Node_context in let lag = Int32.of_int - node_ctxt.Node_context.protocol_constants.parametric.dal.endorsement_lag + node_ctxt.Node_context.protocol_constants.parametric.dal.attestation_lag in let block_level = Raw_level.to_int32 block_level in let genesis_level = Raw_level.to_int32 node_ctxt.genesis_info.level in diff --git a/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.mli b/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.mli index fd89a0a7d338dad89ef7fa045221857e863ed97f..549a32c23abdbda9512195a79388fa5705c55c74 100644 --- a/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.mli +++ b/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.mli @@ -58,7 +58,7 @@ val save_confirmed_slot : (** [process_head node_ctxt head] performs the following operations: {ul - {li it reads the endorsements for headers published endorsement_lag + {li it reads the endorsements for headers published attestation_lag levels preceding [head] from the block metadata, determines which ones the rollup node will download, and stores the results in [Store.Dal_confirmed_slots].} diff --git a/src/proto_alpha/bin_sc_rollup_node/fueled_pvm.ml b/src/proto_alpha/bin_sc_rollup_node/fueled_pvm.ml index ef11d4374e9980addecf94316e2a83446be80ed3..bff648e3aeec8571e397be4bf50e6e9b5b7bffde 100644 --- a/src/proto_alpha/bin_sc_rollup_node/fueled_pvm.ml +++ b/src/proto_alpha/bin_sc_rollup_node/fueled_pvm.ml @@ -36,7 +36,7 @@ module type S = sig val eval_block_inbox : metadata:Sc_rollup.Metadata.t -> - dal_endorsement_lag:int -> + dal_attestation_lag:int -> fuel:fuel -> Node_context.t -> Tezos_crypto.Block_hash.t -> @@ -65,7 +65,7 @@ module Make some [message_index] at a given [level] and this is the [start_tick] of this message processing. If some [failing_ticks] are planned by the loser mode, they will be made. *) - let eval_until_input ~metadata ~dal_endorsement_lag data_dir store level + let eval_until_input ~metadata ~dal_attestation_lag data_dir store level message_index ~fuel start_tick failing_ticks state = let open Lwt_result_syntax in let eval_tick fuel tick failing_ticks state = @@ -122,7 +122,7 @@ module Make go fuel (Int64.succ current_tick) failing_ticks next_state) | Needs_reveal (Request_dal_page page_id) -> ( let* content_opt = - Dal_pages_request.page_content ~dal_endorsement_lag store page_id + Dal_pages_request.page_content ~dal_attestation_lag store page_id in let*! next_state = PVM.set_input (Reveal (Dal_page content_opt)) state @@ -147,13 +147,13 @@ module Make step that requires an input. This function is controlled by some [fuel] and may introduce intended failures at some given [failing_ticks]. *) - let feed_input ~metadata ~dal_endorsement_lag data_dir store level + let feed_input ~metadata ~dal_attestation_lag data_dir store level message_index ~fuel ~failing_ticks state input = let open Lwt_result_syntax in let* state, fuel, tick, failing_ticks = eval_until_input ~metadata - ~dal_endorsement_lag + ~dal_attestation_lag data_dir store level @@ -184,7 +184,7 @@ module Make let* state, _fuel, tick, _failing_ticks = eval_until_input ~metadata - ~dal_endorsement_lag + ~dal_attestation_lag data_dir store level @@ -196,7 +196,7 @@ module Make in return (state, tick) - let eval_block_inbox ~metadata ~dal_endorsement_lag ~fuel + let eval_block_inbox ~metadata ~dal_attestation_lag ~fuel (Node_context.{data_dir; store; loser_mode; _} as node_context) hash (state : state) : (state * Z.t * Raw_level.t * fuel, tztrace) result Lwt.t = @@ -237,7 +237,7 @@ module Make let* state, executed_ticks = feed_input ~metadata - ~dal_endorsement_lag + ~dal_attestation_lag data_dir node_context level diff --git a/src/proto_alpha/bin_sc_rollup_node/interpreter.ml b/src/proto_alpha/bin_sc_rollup_node/interpreter.ml index cfc4187c10eac60a67041dd832d4ed27f86edd7f..0b649f31de41cf8b88aa19c529a2fcb08b15bcaa 100644 --- a/src/proto_alpha/bin_sc_rollup_node/interpreter.ml +++ b/src/proto_alpha/bin_sc_rollup_node/interpreter.ml @@ -98,13 +98,13 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct (* Retrieve the previous PVM state from store. *) let* ctxt, predecessor_state = state_of_head node_ctxt ctxt predecessor in let metadata = metadata node_ctxt in - let dal_endorsement_lag = - node_ctxt.protocol_constants.parametric.dal.endorsement_lag + let dal_attestation_lag = + node_ctxt.protocol_constants.parametric.dal.attestation_lag in let* state, num_messages, inbox_level, _fuel = Free_pvm.eval_block_inbox ~metadata - ~dal_endorsement_lag + ~dal_attestation_lag ~fuel:(Fuel.Free.of_ticks 0L) node_ctxt hash @@ -198,13 +198,13 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct Layer1.{hash = predecessor_hash; level = pred_level} in let metadata = metadata node_ctxt in - let dal_endorsement_lag = - node_ctxt.protocol_constants.parametric.dal.endorsement_lag + let dal_attestation_lag = + node_ctxt.protocol_constants.parametric.dal.attestation_lag in let* state, _counter, _level, _fuel = Accounted_pvm.eval_block_inbox ~metadata - ~dal_endorsement_lag + ~dal_attestation_lag ~fuel:(Fuel.Accounted.of_ticks tick_distance) node_ctxt hash diff --git a/src/proto_alpha/bin_sc_rollup_node/refutation_game.ml b/src/proto_alpha/bin_sc_rollup_node/refutation_game.ml index 0cbce2f8efad5487308c06199fea9e7b4eef4cf5..418aace231780c4fc01b370452ef2865dfe3cff6 100644 --- a/src/proto_alpha/bin_sc_rollup_node/refutation_game.ml +++ b/src/proto_alpha/bin_sc_rollup_node/refutation_game.ml @@ -119,7 +119,7 @@ module Make (Interpreter : Interpreter.S) : be unconfirmed on L1, this function returns [None]. If the data of the slot are not saved to the store, the function returns a failure in the error monad. *) - let page_info_from_pvm_state node_ctxt ~dal_endorsement_lag + let page_info_from_pvm_state node_ctxt ~dal_attestation_lag (dal_params : Dal.parameters) start_state = let open Lwt_result_syntax in let*! input_request = PVM.is_input_state start_state in @@ -127,7 +127,7 @@ module Make (Interpreter : Interpreter.S) : | Sc_rollup.(Needs_reveal (Request_dal_page page_id)) -> ( let Dal.Page.{slot_id; page_index} = page_id in let* pages = - Dal_pages_request.slot_pages ~dal_endorsement_lag node_ctxt slot_id + Dal_pages_request.slot_pages ~dal_attestation_lag node_ctxt slot_id in match pages with | None -> return_none (* The slot is not confirmed. *) @@ -199,11 +199,11 @@ module Make (Interpreter : Interpreter.S) : in let dal_l1_parameters = parametric_constants.dal in let dal_parameters = dal_l1_parameters.cryptobox_parameters in - let dal_endorsement_lag = dal_l1_parameters.endorsement_lag in + let dal_attestation_lag = dal_l1_parameters.attestation_lag in let* page_info = page_info_from_pvm_state - ~dal_endorsement_lag + ~dal_attestation_lag node_ctxt dal_parameters start_state @@ -235,7 +235,7 @@ module Make (Interpreter : Interpreter.S) : let history_cache = dal_slots_history_cache - let dal_endorsement_lag = dal_endorsement_lag + let dal_attestation_lag = dal_attestation_lag let dal_parameters = dal_parameters @@ -257,7 +257,7 @@ module Make (Interpreter : Interpreter.S) : game.inbox_level dal_slots_history dal_parameters - ~dal_endorsement_lag + ~dal_attestation_lag ~pvm_name:game.pvm_name proof >|= Environment.wrap_tzresult diff --git a/src/proto_alpha/lib_client/operation_result.ml b/src/proto_alpha/lib_client/operation_result.ml index fc9e131388b6972a0eb74f51520ec0d06c905c01..926c321eed5bfdd6918da9c85e14d8c22b428459 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -1078,10 +1078,10 @@ let pp_contents_and_result : Consensus_key.pp {delegate; consensus_pkh = consensus_key} endorsement_power - | Dal_slot_availability _, Dal_slot_availability_result {delegate} -> + | Dal_attestation _, Dal_attestation_result {delegate} -> Format.fprintf ppf - "@[Slot availability:@,Delegate: %a@]" + "@[Slot attestation:@,Delegate: %a@]" Tezos_crypto.Signature.Public_key_hash.pp delegate | ( Double_endorsement_evidence {op1; op2}, diff --git a/src/proto_alpha/lib_parameters/default_parameters.ml b/src/proto_alpha/lib_parameters/default_parameters.ml index 066824e5c7a882d37af9b7f0843fcc270b990c31..8c14b14150893555752c9c9466695fa8a71a96df 100644 --- a/src/proto_alpha/lib_parameters/default_parameters.ml +++ b/src/proto_alpha/lib_parameters/default_parameters.ml @@ -71,7 +71,7 @@ let default_dal = { feature_enable = false; number_of_slots = 256; - endorsement_lag = 1; + attestation_lag = 1; availability_threshold = 50; cryptobox_parameters = default_cryptobox_parameters; } diff --git a/src/proto_alpha/lib_plugin/RPC.ml b/src/proto_alpha/lib_plugin/RPC.ml index fcc3fe4a93188f930290e0ba467dd22b3078d055..f2a3fa113c1ae5bf09b89e61fcf32f3c6f963f4f 100644 --- a/src/proto_alpha/lib_plugin/RPC.ml +++ b/src/proto_alpha/lib_plugin/RPC.ml @@ -849,7 +849,7 @@ module Scripts = struct (match packed_operation.protocol_data with | Operation_data {contents = Single (Preendorsement _); _} | Operation_data {contents = Single (Endorsement _); _} - | Operation_data {contents = Single (Dal_slot_availability _); _} -> + | Operation_data {contents = Single (Dal_attestation _); _} -> error Run_operation_does_not_support_consensus_operations | _ -> ok ()) >>?= fun () -> diff --git a/src/proto_alpha/lib_plugin/mempool.ml b/src/proto_alpha/lib_plugin/mempool.ml index 066dbc16f8faa1061dbfcdd7fa281632cf3edd23..9108f9bc357bc941a605813fe99e11f5ab1429d3 100644 --- a/src/proto_alpha/lib_plugin/mempool.ml +++ b/src/proto_alpha/lib_plugin/mempool.ml @@ -845,7 +845,7 @@ let pre_filter config ~(filter_state : state) ?validation_state_before Lwt.return (`Branch_refused [Environment.wrap_tzerror Consensus_operation_in_far_future]) - | Single (Dal_slot_availability _) + | Single (Dal_attestation _) | Single (Seed_nonce_revelation _) | Single (Double_preendorsement_evidence _) | Single (Double_endorsement_evidence _) @@ -1390,7 +1390,7 @@ let post_filter config ~(filter_state : state) ~validation_state_before:_ match contents with | Single_result (Preendorsement_result _) | Single_result (Endorsement_result _) - | Single_result (Dal_slot_availability_result _) + | Single_result (Dal_attestation_result _) | Single_result (Seed_nonce_revelation_result _) | Single_result (Double_preendorsement_evidence_result _) | Single_result (Double_endorsement_evidence_result _) diff --git a/src/proto_alpha/lib_protocol/TEZOS_PROTOCOL b/src/proto_alpha/lib_protocol/TEZOS_PROTOCOL index e1655bc866ca4a7479177a6a12d508bfea505263..18692907477c7144c702f6e63d4d4efa85aa11ef 100644 --- a/src/proto_alpha/lib_protocol/TEZOS_PROTOCOL +++ b/src/proto_alpha/lib_protocol/TEZOS_PROTOCOL @@ -50,7 +50,7 @@ "Entrypoint_repr", "Dal_slot_repr", - "Dal_endorsement_repr", + "Dal_attestation_repr", "Sc_rollup_repr", "Sc_rollup_metadata_repr", diff --git a/src/proto_alpha/lib_protocol/alpha_context.ml b/src/proto_alpha/lib_protocol/alpha_context.ml index 597aa79726c2aa041e1ed99e95a949b6b18346fd..7ec9e5fee31b6c51fd1e869fce81388b8a2f05ee 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.ml +++ b/src/proto_alpha/lib_protocol/alpha_context.ml @@ -105,8 +105,8 @@ module Dal = struct include Dal_slot_repr.Index end - module Endorsement = struct - include Dal_endorsement_repr + module Attestation = struct + include Dal_attestation_repr include Raw_context.Dal end diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index dea775fb86882cddcee70b84e46e7eebf804393f..16601ad6e24027f07197419347f120abbdcf7914 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -781,7 +781,7 @@ module Constants : sig type dal = { feature_enable : bool; number_of_slots : int; - endorsement_lag : int; + attestation_lag : int; availability_threshold : int; cryptobox_parameters : Dal.parameters; } @@ -2912,14 +2912,14 @@ module Dal : sig val equal : t -> t -> bool end - (** This module re-exports definitions from {!Dal_endorsement_repr} and + (** This module re-exports definitions from {!Dal_attestation_repr} and {!Raw_context.Dal}. *) - module Endorsement : sig + module Attestation : sig type t type operation = { - endorser : public_key_hash; - slot_availability : t; + attestor : public_key_hash; + attestation : t; level : Raw_level.t; } @@ -2931,14 +2931,14 @@ module Dal : sig val empty : t - val is_available : t -> Slot_index.t -> bool + val is_attested : t -> Slot_index.t -> bool val occupied_size_in_bits : t -> int val expected_size_in_bits : max_index:Slot_index.t -> int - val shards_of_endorser : - context -> endorser:public_key_hash -> shard_index list option + val shards_of_attestor : + context -> attestor:public_key_hash -> shard_index list option val record_available_shards : context -> t -> int list -> context @@ -3023,7 +3023,7 @@ module Dal : sig val finalize_current_slot_headers : context -> context Lwt.t val finalize_pending_slot_headers : - context -> (context * Endorsement.t) tzresult Lwt.t + context -> (context * Attestation.t) tzresult Lwt.t end module Slots_history : sig @@ -3060,11 +3060,11 @@ end module Dal_errors : sig (* DAL/FIXME: https://gitlab.com/tezos/tezos/-/issues/3168 do not expose these errors and return them in functions - from Dal_slot_repr or Dal_endorsement_repr. *) + from Dal_slot_repr or Dal_attestation_repr. *) type error += | Dal_feature_disabled | Dal_slot_index_above_hard_limit - | Dal_endorsement_unexpected_size of {expected : int; got : int} + | Dal_attestation_unexpected_size of {expected : int; got : int} | Dal_publish_slot_header_future_level of { provided : Raw_level.t; expected : Raw_level.t; @@ -3078,10 +3078,10 @@ module Dal_errors : sig maximum : Dal.Slot_index.t; } | Dal_publish_slot_header_candidate_with_low_fees of {proposed_fees : Tez.t} - | Dal_endorsement_size_limit_exceeded of {maximum_size : int; got : int} + | Dal_attestation_size_limit_exceeded of {maximum_size : int; got : int} | Dal_publish_slot_header_duplicate of {slot_header : Dal.Slot.Header.t} - | Dal_data_availibility_endorser_not_in_committee of { - endorser : Signature.Public_key_hash.t; + | Dal_data_availibility_attestor_not_in_committee of { + attestor : Signature.Public_key_hash.t; level : Level.t; } | Dal_operation_for_old_level of { @@ -3818,7 +3818,7 @@ module Sc_rollup : sig val dal_parameters : Dal.parameters - val dal_endorsement_lag : int + val dal_attestation_lag : int end end @@ -3830,7 +3830,7 @@ module Sc_rollup : sig Raw_level.t -> Dal.Slots_history.t -> Dal.parameters -> - dal_endorsement_lag:int -> + dal_attestation_lag:int -> pvm_name:string -> t -> (input option * input_request) tzresult Lwt.t @@ -3937,7 +3937,7 @@ module Sc_rollup : sig val play : Dal.parameters -> - dal_endorsement_lag:int -> + dal_attestation_lag:int -> stakers:Index.t -> Metadata.t -> t -> @@ -4312,7 +4312,7 @@ module Kind : sig type endorsement = endorsement_consensus_kind consensus - type dal_slot_availability = Dal_slot_availability_kind + type dal_attestation = Dal_attestation_kind type seed_nonce_revelation = Seed_nonce_revelation_kind @@ -4479,9 +4479,7 @@ and _ contents_list = and _ contents = | Preendorsement : consensus_content -> Kind.preendorsement contents | Endorsement : consensus_content -> Kind.endorsement contents - | Dal_slot_availability : - Dal.Endorsement.operation - -> Kind.dal_slot_availability contents + | Dal_attestation : Dal.Attestation.operation -> Kind.dal_attestation contents | Seed_nonce_revelation : { level : Raw_level.t; nonce : Nonce.t; @@ -4724,7 +4722,7 @@ module Operation : sig type consensus_watermark = | Endorsement of Chain_id.t | Preendorsement of Chain_id.t - | Dal_slot_availability of Chain_id.t + | Dal_attestation of Chain_id.t val to_watermark : consensus_watermark -> Signature.watermark @@ -4795,7 +4793,7 @@ module Operation : sig val endorsement_case : Kind.endorsement case - val dal_slot_availability_case : Kind.dal_slot_availability case + val dal_attestation_case : Kind.dal_attestation case val seed_nonce_revelation_case : Kind.seed_nonce_revelation case diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index 5c289f7780533cbbfd93583876ab5aa19b054171..e5885cd71380cacdee6a2d206ebcc9e1c9a57df4 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -2001,7 +2001,7 @@ let record_operation (type kind) ctxt hash (operation : kind operation) : match operation.protocol_data.contents with | Single (Preendorsement _) -> ctxt | Single (Endorsement _) -> ctxt - | Single (Dal_slot_availability _) -> ctxt + | Single (Dal_attestation _) -> ctxt | Single ( Failing_noop _ | Proposals _ | Ballot _ | Seed_nonce_revelation _ | Vdf_revelation _ | Double_endorsement_evidence _ @@ -2186,7 +2186,7 @@ let apply_contents_list (type kind) ctxt chain_id (mode : mode) record_preendorsement ctxt mode consensus_content |> Lwt.return | Single (Endorsement consensus_content) -> record_endorsement ctxt mode consensus_content - | Single (Dal_slot_availability op) -> + | Single (Dal_attestation op) -> (* DAL/FIXME https://gitlab.com/tezos/tezos/-/issues/3115 This is a temporary operation. We do no check for the @@ -2197,11 +2197,9 @@ let apply_contents_list (type kind) ctxt chain_id (mode : mode) endorsement encoding. However, once the DAL will be ready, this operation should be merged with an endorsement or at least refined. *) - Dal_apply.apply_data_availability ctxt op >>?= fun ctxt -> + Dal_apply.apply_attestation ctxt op >>?= fun ctxt -> return - ( ctxt, - Single_result (Dal_slot_availability_result {delegate = op.endorser}) - ) + (ctxt, Single_result (Dal_attestation_result {delegate = op.attestor})) | Single (Seed_nonce_revelation {level; nonce}) -> let level = Level.from_raw ctxt level in Nonce.reveal ctxt level nonce >>=? fun ctxt -> @@ -2709,7 +2707,7 @@ let finalize_application ctxt block_data_contents ~round ~predecessor_hash may_start_new_cycle ctxt in let* ctxt = Amendment.may_start_new_voting_period ctxt in - let* ctxt, dal_slot_availability = Dal_apply.finalisation ctxt in + let* ctxt, dal_attestation = Dal_apply.finalisation ctxt in let* _inbox, _diff, ctxt = Sc_rollup.Inbox.add_end_of_level ctxt in let balance_updates = migration_balance_updates @ baking_receipts @ cycle_end_balance_updates @@ -2733,7 +2731,7 @@ let finalize_application ctxt block_data_contents ~round ~predecessor_hash balance_updates; liquidity_baking_toggle_ema; implicit_operations_results; - dal_slot_availability; + dal_attestation; } in (ctxt, receipt) @@ -2856,7 +2854,7 @@ let finalize_block (application_state : application_state) shell_header_opt = balance_updates = migration_balance_updates; liquidity_baking_toggle_ema; implicit_operations_results; - dal_slot_availability = None; + dal_attestation = None; } ) | Application { diff --git a/src/proto_alpha/lib_protocol/apply_results.ml b/src/proto_alpha/lib_protocol/apply_results.ml index a4ca54357bd6c72f858e79c670468ab5140be987..a8d57c5329e78d50ff6e71a57385d4aa13011c19 100644 --- a/src/proto_alpha/lib_protocol/apply_results.ml +++ b/src/proto_alpha/lib_protocol/apply_results.ml @@ -1078,10 +1078,10 @@ type 'kind contents_result = endorsement_power : int; } -> Kind.endorsement contents_result - | Dal_slot_availability_result : { + | Dal_attestation_result : { delegate : Signature.Public_key_hash.t; } - -> Kind.dal_slot_availability contents_result + -> Kind.dal_attestation contents_result | Seed_nonce_revelation_result : Receipt.balance_updates -> Kind.seed_nonce_revelation contents_result @@ -1312,22 +1312,22 @@ module Encoding = struct {balance_updates; delegate; consensus_key; endorsement_power}); } - let dal_slot_availability_case = + let dal_attestation_case = Case { - op_case = Operation.Encoding.dal_slot_availability_case; + op_case = Operation.Encoding.dal_attestation_case; encoding = obj1 (req "delegate" Signature.Public_key_hash.encoding); select = (function - | Contents_result (Dal_slot_availability_result _ as op) -> Some op + | Contents_result (Dal_attestation_result _ as op) -> Some op | _ -> None); mselect = (function - | Contents_and_result ((Dal_slot_availability _ as op), res) -> + | Contents_and_result ((Dal_attestation _ as op), res) -> Some (op, res) | _ -> None); - proj = (function Dal_slot_availability_result {delegate} -> delegate); - inj = (fun delegate -> Dal_slot_availability_result {delegate}); + proj = (function Dal_attestation_result {delegate} -> delegate); + inj = (fun delegate -> Dal_attestation_result {delegate}); } let seed_nonce_revelation_case = @@ -1561,7 +1561,7 @@ module Encoding = struct {op with operation_result = Failed (kind, errs)})) | Contents_result (Preendorsement_result _) -> None | Contents_result (Endorsement_result _) -> None - | Contents_result (Dal_slot_availability_result _) -> None + | Contents_result (Dal_attestation_result _) -> None | Contents_result Ballot_result -> None | Contents_result (Seed_nonce_revelation_result _) -> None | Contents_result (Vdf_revelation_result _) -> None @@ -1935,7 +1935,7 @@ let contents_result_encoding = make vdf_revelation_case; make endorsement_case; make preendorsement_case; - make dal_slot_availability_case; + make dal_attestation_case; make double_preendorsement_evidence_case; make double_endorsement_evidence_case; make double_baking_evidence_case; @@ -2002,7 +2002,7 @@ let contents_and_result_encoding = make vdf_revelation_case; make endorsement_case; make preendorsement_case; - make dal_slot_availability_case; + make dal_attestation_case; make double_preendorsement_evidence_case; make double_endorsement_evidence_case; make double_baking_evidence_case; @@ -2149,8 +2149,8 @@ let kind_equal : | Endorsement _, _ -> None | Preendorsement _, Preendorsement_result _ -> Some Eq | Preendorsement _, _ -> None - | Dal_slot_availability _, Dal_slot_availability_result _ -> Some Eq - | Dal_slot_availability _, _ -> None + | Dal_attestation _, Dal_attestation_result _ -> Some Eq + | Dal_attestation _, _ -> None | Seed_nonce_revelation _, Seed_nonce_revelation_result _ -> Some Eq | Seed_nonce_revelation _, _ -> None | Vdf_revelation _, Vdf_revelation_result _ -> Some Eq @@ -3053,7 +3053,7 @@ type block_metadata = { balance_updates : Receipt.balance_updates; liquidity_baking_toggle_ema : Liquidity_baking.Toggle_EMA.t; implicit_operations_results : packed_successful_manager_operation_result list; - dal_slot_availability : Dal.Endorsement.t option; + dal_attestation : Dal.Attestation.t option; } let block_metadata_encoding = @@ -3072,7 +3072,7 @@ let block_metadata_encoding = balance_updates; liquidity_baking_toggle_ema; implicit_operations_results; - dal_slot_availability; + dal_attestation; } -> ( ( proposer, baker, @@ -3083,10 +3083,8 @@ let block_metadata_encoding = balance_updates, liquidity_baking_toggle_ema, implicit_operations_results ), - ( proposer_active_key, - baker_active_key, - consumed_gas, - dal_slot_availability ) )) + (proposer_active_key, baker_active_key, consumed_gas, dal_attestation) + )) (fun ( ( proposer, baker, level_info, @@ -3099,7 +3097,7 @@ let block_metadata_encoding = ( proposer_active_key, baker_active_key, consumed_gas, - dal_slot_availability ) ) -> + dal_attestation ) ) -> { proposer = {delegate = proposer; consensus_pkh = proposer_active_key}; baker = {delegate = baker; consensus_pkh = baker_active_key}; @@ -3111,7 +3109,7 @@ let block_metadata_encoding = balance_updates; liquidity_baking_toggle_ema; implicit_operations_results; - dal_slot_availability; + dal_attestation; }) (merge_objs (obj9 @@ -3136,4 +3134,4 @@ let block_metadata_encoding = This varopt is here while the DAL is behind a feature flag. This should be replaced by a required field once the feature flag will be activated. *) - (varopt "dal_slot_availability" Dal.Endorsement.encoding))) + (varopt "dal_attestation" Dal.Attestation.encoding))) diff --git a/src/proto_alpha/lib_protocol/apply_results.mli b/src/proto_alpha/lib_protocol/apply_results.mli index 26cb1cf5ce07fe4c99f1857e9a07e935b936fcae..dacb11d7976de53ea6b4e51935a1cc75f88f5ee6 100644 --- a/src/proto_alpha/lib_protocol/apply_results.mli +++ b/src/proto_alpha/lib_protocol/apply_results.mli @@ -72,10 +72,10 @@ and 'kind contents_result = endorsement_power : int; } -> Kind.endorsement contents_result - | Dal_slot_availability_result : { + | Dal_attestation_result : { delegate : Signature.Public_key_hash.t; } - -> Kind.dal_slot_availability contents_result + -> Kind.dal_attestation contents_result | Seed_nonce_revelation_result : Receipt.balance_updates -> Kind.seed_nonce_revelation contents_result @@ -361,7 +361,7 @@ type block_metadata = { balance_updates : Receipt.balance_updates; liquidity_baking_toggle_ema : Liquidity_baking.Toggle_EMA.t; implicit_operations_results : packed_successful_manager_operation_result list; - dal_slot_availability : Dal.Endorsement.t option; + dal_attestation : Dal.Attestation.t option; } val block_metadata_encoding : block_metadata Data_encoding.encoding diff --git a/src/proto_alpha/lib_protocol/constants_parametric_repr.ml b/src/proto_alpha/lib_protocol/constants_parametric_repr.ml index 4d560408d38e1e40fab5b37a8909674da680a9fc..0d0ce0c708bc90bcb53b8826f6cf3fff27d8d732 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_repr.ml +++ b/src/proto_alpha/lib_protocol/constants_parametric_repr.ml @@ -28,7 +28,7 @@ type dal = { feature_enable : bool; number_of_slots : int; - endorsement_lag : int; + attestation_lag : int; availability_threshold : int; cryptobox_parameters : Dal.parameters; } @@ -39,24 +39,24 @@ let dal_encoding = (fun { feature_enable; number_of_slots; - endorsement_lag; + attestation_lag; availability_threshold; cryptobox_parameters; } -> ( ( feature_enable, number_of_slots, - endorsement_lag, + attestation_lag, availability_threshold ), cryptobox_parameters )) (fun ( ( feature_enable, number_of_slots, - endorsement_lag, + attestation_lag, availability_threshold ), cryptobox_parameters ) -> { feature_enable; number_of_slots; - endorsement_lag; + attestation_lag; availability_threshold; cryptobox_parameters; }) @@ -64,7 +64,7 @@ let dal_encoding = (obj4 (req "feature_enable" bool) (req "number_of_slots" int16) - (req "endorsement_lag" int16) + (req "attestation_lag" int16) (req "availability_threshold" int16)) Dal.parameters_encoding) diff --git a/src/proto_alpha/lib_protocol/constants_parametric_repr.mli b/src/proto_alpha/lib_protocol/constants_parametric_repr.mli index acdaf51831a93755d8bee2f9902a640ad035ce6b..56a9c3be7575d894fd617616f5a45e67fc493c22 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_repr.mli +++ b/src/proto_alpha/lib_protocol/constants_parametric_repr.mli @@ -28,7 +28,7 @@ type dal = { feature_enable : bool; number_of_slots : int; - endorsement_lag : int; + attestation_lag : int; availability_threshold : int; cryptobox_parameters : Dal.parameters; } diff --git a/src/proto_alpha/lib_protocol/dal_apply.ml b/src/proto_alpha/lib_protocol/dal_apply.ml index 58b00ce50425f1ca5dfb48ce0fc949b206160d43..06b09bfc1f82771c359675d224214c201adfcafa 100644 --- a/src/proto_alpha/lib_protocol/dal_apply.ml +++ b/src/proto_alpha/lib_protocol/dal_apply.ml @@ -44,21 +44,21 @@ let slot_of_int_e n = | None -> tzfail Dal_errors.Dal_slot_index_above_hard_limit | Some slot_index -> return slot_index -let validate_data_availability ctxt op = +let validate_attestation ctxt op = assert_dal_feature_enabled ctxt >>? fun () -> let open Result_syntax in (* FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/4163 - check the signature of the endorser as well *) - let Dal.Endorsement.{endorser = _; slot_availability; level = given} = op in + check the signature of the attestor as well *) + let Dal.Attestation.{attestor = _; attestation; level = given} = op in let* max_index = slot_of_int_e @@ ((Constants.parametric ctxt).dal.number_of_slots - 1) in - let maximum_size = Dal.Endorsement.expected_size_in_bits ~max_index in - let size = Dal.Endorsement.occupied_size_in_bits slot_availability in + let maximum_size = Dal.Attestation.expected_size_in_bits ~max_index in + let size = Dal.Attestation.occupied_size_in_bits attestation in let* () = error_unless Compare.Int.(size <= maximum_size) - (Dal_endorsement_size_limit_exceeded {maximum_size; got = size}) + (Dal_attestation_size_limit_exceeded {maximum_size; got = size}) in let current = Level.(current ctxt).level in let delta_levels = Raw_level.diff current given in @@ -71,15 +71,15 @@ let validate_data_availability ctxt op = Compare.Int32.(delta_levels < 0l) (Dal_operation_for_future_level {current; given}) -let apply_data_availability ctxt op = +let apply_attestation ctxt op = assert_dal_feature_enabled ctxt >>? fun () -> - let Dal.Endorsement.{endorser; slot_availability; level = _} = op in - match Dal.Endorsement.shards_of_endorser ctxt ~endorser with + let Dal.Attestation.{attestor; attestation; level = _} = op in + match Dal.Attestation.shards_of_attestor ctxt ~attestor with | None -> let level = Level.current ctxt in - error (Dal_data_availibility_endorser_not_in_committee {endorser; level}) + error (Dal_data_availibility_attestor_not_in_committee {attestor; level}) | Some shards -> - Ok (Dal.Endorsement.record_available_shards ctxt slot_availability shards) + Ok (Dal.Attestation.record_available_shards ctxt attestation shards) let validate_publish_slot_header ctxt Dal.Slot.Header.{id = {index; published_level}; _} = @@ -136,7 +136,7 @@ let finalisation ctxt = level where the game started. *) Dal.Slot.finalize_pending_slot_headers ctxt - >|=? fun (ctxt, slot_availability) -> (ctxt, Some slot_availability)) + >|=? fun (ctxt, attestation) -> (ctxt, Some attestation)) let initialisation ctxt ~level = let open Lwt_result_syntax in @@ -149,10 +149,10 @@ let initialisation ctxt ~level = >|=? fun (ctxt, consensus_pk1) -> (ctxt, consensus_pk1.delegate) in (* This committee is cached because it is the one we will use - for the validation of the DAL endorsements. *) + for the validation of the DAL attestations. *) let* committee = - Alpha_context.Dal.Endorsement.compute_committee + Alpha_context.Dal.Attestation.compute_committee ctxt pkh_from_tenderbake_slot in - return (Alpha_context.Dal.Endorsement.init_committee ctxt committee)) + return (Alpha_context.Dal.Attestation.init_committee ctxt committee)) diff --git a/src/proto_alpha/lib_protocol/dal_apply.mli b/src/proto_alpha/lib_protocol/dal_apply.mli index 241ab959df6a515672b7d197b08a52aaeccb04d0..1d3f19e2d734f4da803ea2820f6cea6fb8dcb017 100644 --- a/src/proto_alpha/lib_protocol/dal_apply.mli +++ b/src/proto_alpha/lib_protocol/dal_apply.mli @@ -28,16 +28,15 @@ open Alpha_context -(** [validate_data_availability ctxt op] ensures that - [op.slot_availability] is valid and cannot prevent an operation containing - [op.slot_availability] to be refused on top of [ctxt]. If an [Error _] is - returned, the [op.slot_availability] is not valid. *) -val validate_data_availability : t -> Dal.Endorsement.operation -> unit tzresult +(** [validate_attestation ctxt op] ensures that [op.attestation] is + valid and cannot prevent an operation containing [op.attestation] + to be refused on top of [ctxt]. If an [Error _] is returned, the + [op.attestation] is not valid. *) +val validate_attestation : t -> Dal.Attestation.operation -> unit tzresult -(** [apply_data_availability ctxt op] applies - [op.slot_availability] into the [ctxt] assuming [op.endorser] issued those - endorsements. *) -val apply_data_availability : t -> Dal.Endorsement.operation -> t tzresult +(** [apply_attestation ctxt op] applies [op.attestation] into the + [ctxt] assuming [op.attestor] issued those attestations. *) +val apply_attestation : t -> Dal.Attestation.operation -> t tzresult (** [validate_publish_slot_header ctxt slot] ensures that [slot_header] is valid and cannot prevent an operation containing [slot_header] to be @@ -51,12 +50,12 @@ val validate_publish_slot_header : t -> Dal.Slot.Header.t -> unit tzresult val apply_publish_slot_header : t -> Dal.Slot.Header.t -> t tzresult (** [finalisation ctxt] should be executed at block finalisation - time. A set of slots available at level [ctxt.current_level - lag] - is returned encapsulated into the endorsement data-structure. + time. A set of slots attested at level [ctxt.current_level - lag] + is returned encapsulated into the attestation data-structure. [lag] is a parametric constant specific to the data-availability layer. *) -val finalisation : t -> (t * Dal.Endorsement.t option) tzresult Lwt.t +val finalisation : t -> (t * Dal.Attestation.t option) tzresult Lwt.t (** [initialize ctxt ~level] should be executed at block initialisation time. It allows to cache the committee for [level] diff --git a/src/proto_alpha/lib_protocol/dal_endorsement_repr.ml b/src/proto_alpha/lib_protocol/dal_attestation_repr.ml similarity index 90% rename from src/proto_alpha/lib_protocol/dal_endorsement_repr.ml rename to src/proto_alpha/lib_protocol/dal_attestation_repr.ml index 7291c37eeba45af2a3eab9315790dd83d9fe0ddd..a3b68922fadaf9bc6f5bd7fe1d8e75c011d2f517 100644 --- a/src/proto_alpha/lib_protocol/dal_endorsement_repr.ml +++ b/src/proto_alpha/lib_protocol/dal_attestation_repr.ml @@ -26,29 +26,29 @@ (* DAL/FIXME https://gitlab.com/tezos/tezos/-/issues/3103 This may be a bit heavy in practice. We could also assume that in - practice, this bitfield will contain many bits to one. Hence, we + practice, many bits in this bitfield will be set to one. Hence, we could consider a better encoding which is smaller in the optimistic case. For example: - 1. When all the slots are endorsed, the encoding can be represented + 1. When all the slots are attested, the encoding can be represented in one bit. 2. Otherwise, we can pack slots by [8]. Have a header of [slots/8] which is [1] if all the slots in this set are [1], [0] otherwise. For all pack with a bit set to [0], we give the explicit representation. Hence, if there are [256] slots, and [2] are not - endorsed, this representation will be of size [32] bits + [16] bits + attested, this representation will be of size [32] bits + [16] bits = [48] bits which is better than [256] bits. *) type t = Bitset.t -type available_slots = t +type attested_slots = t type operation = { - endorser : Signature.Public_key_hash.t; + attestor : Signature.Public_key_hash.t; (* FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/4165 - Compute this from the endorsed slots in [slot_availability] below, + Compute the endorser from the attested slots in [slot_attestation] below, or provide a field `min_endorser_slot : int / int32` *) - slot_availability : t; + attestation : t; level : Raw_level_repr.t; } @@ -56,7 +56,7 @@ let encoding = Bitset.encoding let empty = Bitset.empty -let is_available t index = +let is_attested t index = let open Dal_slot_repr.Index in match Bitset.mem t (to_int index) with | Ok b -> b @@ -79,7 +79,7 @@ let commit t index = let occupied_size_in_bits = Bitset.occupied_size_in_bits let expected_size_in_bits ~max_index = - (* We compute an encoding of the data-availability endorsements + (* We compute an encoding of the data-availability attestations which is a (tight) upper bound of what we expect. *) let open Bitset in let open Dal_slot_repr.Index in @@ -107,7 +107,7 @@ module Accountability = struct let l = List.init ~when_negative_length: - "Dal_endorsement_repr.Accountability.init: length cannot be negative" + "Dal_attestation_repr.Accountability.init: length cannot be negative" length (fun _ -> Bitset.empty) in diff --git a/src/proto_alpha/lib_protocol/dal_endorsement_repr.mli b/src/proto_alpha/lib_protocol/dal_attestation_repr.mli similarity index 73% rename from src/proto_alpha/lib_protocol/dal_endorsement_repr.mli rename to src/proto_alpha/lib_protocol/dal_attestation_repr.mli index 597f55768fad13ba9fa540b20050fe84ad0085bb..7d1ebed02e720c505b04c5ebfc2ed8a6c66419a1 100644 --- a/src/proto_alpha/lib_protocol/dal_endorsement_repr.mli +++ b/src/proto_alpha/lib_protocol/dal_attestation_repr.mli @@ -23,18 +23,20 @@ (* *) (*****************************************************************************) -(** Slot endorsement representation for the data-availability layer. +(** Slot attestation representation for the data-availability layer. {1 Overview} For the data-availability layer, the layer 1 provides a list of - slots at every level (see {!dal_slot_repr}). Slots are not posted - directly onto L1 blocks. Stakeholders (via endorsements) can commit - on the availability of the data. + slots at every level (see {!Dal_slot_repr}). Slots are not posted + directly onto L1 blocks. Stakeholders, called attestors in this + context, can commit on the availability of the data (via + endorsements or attestation operations, see + https://gitlab.com/tezos/tezos/-/issues/3115). - The slot is uniformly split into shards. Each endorser commits for - every slot at every level on the availability of all shards they - are assigned to. + The slot is uniformly split into shards. Each attestor commits, + for every slot, on the availability of all shards they are assigned + to. This module encapsulates the representation of this commitment that aims to be provided with endorsement operations. To avoid @@ -42,39 +44,39 @@ type t -type available_slots = t +type attested_slots = t -(** The shape of Dal endorsement operations injected by delegates. *) +(** The shape of Dal attestation operations injected by delegates. *) type operation = { - endorser : Signature.Public_key_hash.t; - (** The endorser who attests the availability of the slots. *) - slot_availability : t; + attestor : Signature.Public_key_hash.t; + (** The account who attests the availability of the slots. *) + attestation : t; (** The bitset of slots that are attested to be available. *) level : Raw_level_repr.t; (** The level at which the operation is valid. It should be equal to the - attested slot's published level plus the DAL endorsement lag. *) + attested slot's published level plus the DAL attestation lag. *) } val encoding : t Data_encoding.t -(** [empty] returns an empty [slot_endorsement] which commits that +(** [empty] returns an empty [slot_attestation] which commits that every slot are unavailable. *) val empty : t -(** [is_available slot_endorsement ~index] returns [true] if the - [slot_endorsement] commits that the slot at [index] is +(** [is_attested slot_attestation ~index] returns [true] if the + [slot_attestation] commits that the slot at [index] is available. *) -val is_available : t -> Dal_slot_repr.Index.t -> bool +val is_attested : t -> Dal_slot_repr.Index.t -> bool -(** [commit slot_endorsement index] commits into [slot_endorsement] +(** [commit slot_attestation index] commits into [slot_attestation] that the [index] is available. *) val commit : t -> Dal_slot_repr.Index.t -> t -(** [occupied_size_in_bits slot_endorsement] returns the size in bits of an endorsement. *) +(** [occupied_size_in_bits slot_attestation] returns the size in bits of an attestation. *) val occupied_size_in_bits : t -> int (** [expected_size_in_bits ~max_index] returns the expected size (in - bits) of an endorsement considering the maximum index for a slot is + bits) of an attestation considering the maximum index for a slot is [max_index]. *) val expected_size_in_bits : max_index:Dal_slot_repr.Index.t -> int @@ -84,13 +86,13 @@ type shard_index = int module Shard_map : Map.S with type key = shard_index (** This module is used to record the various data-availability - endorsements. + attestations. - For each endorser, a list of shards is associated. For each slots - declared available (see {!type:t}) we record that those shards were - available. + For each attestor, a list of shards is associated. For each + attested slot (see {!type:t}) we record that those shards were + deemed available. - This information will be used at the end of block finalisation to + This information will be used at the end of block finalisation to have the protocol declaring whether the slot is available. *) module Accountability : sig (** The data-structure used to record the shards-slots availability. *) @@ -101,7 +103,7 @@ module Accountability : sig Consider using the [Bounded] module. In particular, change the semantics of [is_slot_available] accordingly. *) - (** [init ~length] initialises a new accountability data-structures + (** [init ~length] initialises a new accountability data-structure with at most [length] slots and where for every slot, no shard is available. *) val init : length:int -> t @@ -111,7 +113,7 @@ module Accountability : sig are available. It is the responsibility of the caller to ensure the shard indices are positive numbers. A negative shard index is ignored. *) - val record_shards_availability : t -> available_slots -> shard_index list -> t + val record_shards_availability : t -> attested_slots -> shard_index list -> t (** [is_slot_available t ~threshold ~number_of_shards slot] returns [true] if the number of shards recorded in [t] for the [slot] is diff --git a/src/proto_alpha/lib_protocol/dal_errors_repr.ml b/src/proto_alpha/lib_protocol/dal_errors_repr.ml index 5d82b2aea0be6fdb29f2cd42435d78cb9c103640..db489a19924e4ade68c146bad9d21bc0cad0c0cd 100644 --- a/src/proto_alpha/lib_protocol/dal_errors_repr.ml +++ b/src/proto_alpha/lib_protocol/dal_errors_repr.ml @@ -26,7 +26,7 @@ type error += | Dal_feature_disabled | Dal_slot_index_above_hard_limit - | Dal_endorsement_unexpected_size of {expected : int; got : int} + | Dal_attestation_unexpected_size of {expected : int; got : int} | Dal_publish_slot_header_future_level of { provided : Raw_level_repr.t; expected : Raw_level_repr.t; @@ -42,10 +42,10 @@ type error += | Dal_publish_slot_header_candidate_with_low_fees of { proposed_fees : Tez_repr.t; } - | Dal_endorsement_size_limit_exceeded of {maximum_size : int; got : int} + | Dal_attestation_size_limit_exceeded of {maximum_size : int; got : int} | Dal_publish_slot_header_duplicate of {slot_header : Dal_slot_repr.Header.t} - | Dal_data_availibility_endorser_not_in_committee of { - endorser : Signature.Public_key_hash.t; + | Dal_data_availibility_attestor_not_in_committee of { + attestor : Signature.Public_key_hash.t; level : Level_repr.t; } | Dal_operation_for_old_level of { @@ -73,20 +73,20 @@ let () = (fun () -> Dal_feature_disabled) ; let description = - "The endorsement for data availability has a different size" + "The attestation for data availability has a different size" in register_error_kind `Permanent - ~id:"dal_endorsement_unexpected_size" - ~title:"DAL endorsement unexpected size" + ~id:"dal_attestation_unexpected_size" + ~title:"DAL attestation unexpected size" ~description ~pp:(fun ppf (expected, got) -> Format.fprintf ppf "%s: Expected %d. Got %d." description expected got) (obj2 (req "expected_size" int31) (req "got" int31)) (function - | Dal_endorsement_unexpected_size {expected; got} -> Some (expected, got) + | Dal_attestation_unexpected_size {expected; got} -> Some (expected, got) | _ -> None) - (fun (expected, got) -> Dal_endorsement_unexpected_size {expected; got}) ; + (fun (expected, got) -> Dal_attestation_unexpected_size {expected; got}) ; let description = "Slot index above hard limit" in register_error_kind `Permanent @@ -197,11 +197,11 @@ let () = | _ -> None) (fun proposed_fees -> Dal_publish_slot_header_candidate_with_low_fees {proposed_fees}) ; - let description = "The endorsement for data availability is a too big" in + let description = "The attestation for data availability is a too big" in register_error_kind `Permanent - ~id:"dal_endorsement_size_limit_exceeded" - ~title:"DAL endorsement exceeded the limit" + ~id:"dal_attestation_size_limit_exceeded" + ~title:"DAL attestation exceeded the limit" ~description ~pp:(fun ppf (maximum_size, got) -> Format.fprintf @@ -212,11 +212,11 @@ let () = got) (obj2 (req "maximum_size" int31) (req "got" int31)) (function - | Dal_endorsement_size_limit_exceeded {maximum_size; got} -> + | Dal_attestation_size_limit_exceeded {maximum_size; got} -> Some (maximum_size, got) | _ -> None) (fun (maximum_size, got) -> - Dal_endorsement_size_limit_exceeded {maximum_size; got}) ; + Dal_attestation_size_limit_exceeded {maximum_size; got}) ; (* DAL/FIXME https://gitlab.com/tezos/tezos/-/issues/3114 Better error message. *) let description = "A slot header for this slot was already proposed" in @@ -275,24 +275,24 @@ let () = (fun (current, given) -> Dal_operation_for_future_level {current; given}) ; register_error_kind `Permanent - ~id:"Dal_data_availibility_endorser_not_in_committee" - ~title:"The endorser is not part of the DAL committee for this level" - ~description:"The endorser is not part of the DAL committee for this level" - ~pp:(fun ppf (endorser, level) -> + ~id:"Dal_data_availibility_attestor_not_in_committee" + ~title:"The attestor is not part of the DAL committee for this level" + ~description:"The attestor is not part of the DAL committee for this level" + ~pp:(fun ppf (attestor, level) -> Format.fprintf ppf - "The endorser %a is not part of the DAL committee for the level %a" + "The attestor %a is not part of the DAL committee for the level %a" Signature.Public_key_hash.pp - endorser + attestor Level_repr.pp level) Data_encoding.( obj2 - (req "endorser" Signature.Public_key_hash.encoding) + (req "attestor" Signature.Public_key_hash.encoding) (req "level" Level_repr.encoding)) (function - | Dal_data_availibility_endorser_not_in_committee {endorser; level} -> - Some (endorser, level) + | Dal_data_availibility_attestor_not_in_committee {attestor; level} -> + Some (attestor, level) | _ -> None) - (fun (endorser, level) -> - Dal_data_availibility_endorser_not_in_committee {endorser; level}) + (fun (attestor, level) -> + Dal_data_availibility_attestor_not_in_committee {attestor; level}) diff --git a/src/proto_alpha/lib_protocol/dal_services.ml b/src/proto_alpha/lib_protocol/dal_services.ml index a914b4e8027f5671e814a88bb90dedc393eb3a6c..660f6783ec7ff63f6c971e8b014d948ee1c28d81 100644 --- a/src/proto_alpha/lib_protocol/dal_services.ml +++ b/src/proto_alpha/lib_protocol/dal_services.ml @@ -34,7 +34,7 @@ let assert_dal_feature_enabled ctxt = let shards ctxt ~level = let open Lwt_result_syntax in - let open Dal.Endorsement in + let open Dal.Attestation in assert_dal_feature_enabled ctxt >>?= fun () -> let level = Level.from_raw ctxt level in let pkh_from_tenderbake_slot slot = @@ -44,6 +44,6 @@ let shards ctxt ~level = (* We do not cache this committee. This function being used by RPCs to know the DAL committee at some particular level. *) let* committee = - Dal.Endorsement.compute_committee ctxt pkh_from_tenderbake_slot + Dal.Attestation.compute_committee ctxt pkh_from_tenderbake_slot in Signature.Public_key_hash.Map.bindings committee.pkh_to_shards |> return diff --git a/src/proto_alpha/lib_protocol/dal_slot_repr.mli b/src/proto_alpha/lib_protocol/dal_slot_repr.mli index 4827e39a7fd41ba9507ac908f5ccfd1019b111db..47e64bfc5d90ca02bd13191f4e9bc4ca85612b0f 100644 --- a/src/proto_alpha/lib_protocol/dal_slot_repr.mli +++ b/src/proto_alpha/lib_protocol/dal_slot_repr.mli @@ -47,7 +47,7 @@ val parameters_encoding : parameters Data_encoding.t The purpose of the data-availability layer is to increase the bandwidth of the layer 1 thanks to the distribution of "slots". A slot is never posted directly onto the layer 1 blocks but on the - data-availability layer. The producer of a slot sill has to post a + data-availability layer. The producer of a slot still has to post a slot header onto the layer 1. A slot header is an abstract datatype certifying that the corresponding slot has some maximum size (provided by the layer 1). In other words, the whole data contained diff --git a/src/proto_alpha/lib_protocol/dal_slot_storage.ml b/src/proto_alpha/lib_protocol/dal_slot_storage.ml index fc01ef7c5c7815961c39e86008ac3da21b79600c..d271b3cf228e36388bc3a9a4f574d08b63ee8091 100644 --- a/src/proto_alpha/lib_protocol/dal_slot_storage.ml +++ b/src/proto_alpha/lib_protocol/dal_slot_storage.ml @@ -37,13 +37,13 @@ let compute_available_slot_headers ctxt seen_slot_headers = let fold_available_slots (rev_slot_headers, available_slot_headers) slot = if Raw_context.Dal.is_slot_index_available ctxt slot.Header.id.index then ( slot :: rev_slot_headers, - Dal_endorsement_repr.commit available_slot_headers slot.Header.id.index + Dal_attestation_repr.commit available_slot_headers slot.Header.id.index ) else (rev_slot_headers, available_slot_headers) in List.fold_left fold_available_slots - ([], Dal_endorsement_repr.empty) + ([], Dal_attestation_repr.empty) seen_slot_headers let get_slot_headers_history ctxt = @@ -63,16 +63,16 @@ let update_skip_list ctxt ~confirmed_slot_headers = let finalize_pending_slot_headers ctxt = let {Level_repr.level = raw_level; _} = Raw_context.current_level ctxt in let Constants_parametric_repr.{dal; _} = Raw_context.constants ctxt in - match Raw_level_repr.(sub raw_level dal.endorsement_lag) with - | None -> return (ctxt, Dal_endorsement_repr.empty) - | Some level_endorsed -> ( - Storage.Dal.Slot.Headers.find ctxt level_endorsed >>=? function - | None -> return (ctxt, Dal_endorsement_repr.empty) + match Raw_level_repr.(sub raw_level dal.attestation_lag) with + | None -> return (ctxt, Dal_attestation_repr.empty) + | Some level_attested -> ( + Storage.Dal.Slot.Headers.find ctxt level_attested >>=? function + | None -> return (ctxt, Dal_attestation_repr.empty) | Some seen_slots -> let rev_confirmed_slot_headers, available_slot_headers = compute_available_slot_headers ctxt seen_slots in let confirmed_slot_headers = List.rev rev_confirmed_slot_headers in update_skip_list ctxt ~confirmed_slot_headers >>=? fun ctxt -> - Storage.Dal.Slot.Headers.remove ctxt level_endorsed >>= fun ctxt -> + Storage.Dal.Slot.Headers.remove ctxt level_attested >>= fun ctxt -> return (ctxt, available_slot_headers)) diff --git a/src/proto_alpha/lib_protocol/dal_slot_storage.mli b/src/proto_alpha/lib_protocol/dal_slot_storage.mli index 7009bd9fa23a8a6cb70ae875ae14cb135cb5e506..ad4ac8317e938154e45de9a6ae0739b0e3cf5e9e 100644 --- a/src/proto_alpha/lib_protocol/dal_slot_storage.mli +++ b/src/proto_alpha/lib_protocol/dal_slot_storage.mli @@ -64,7 +64,7 @@ val finalize_current_slot_headers : Raw_context.t -> Raw_context.t Lwt.t returned. All the pending slots at [current_level - lag] level are removed from the context. *) val finalize_pending_slot_headers : - Raw_context.t -> (Raw_context.t * Dal_endorsement_repr.t) tzresult Lwt.t + Raw_context.t -> (Raw_context.t * Dal_attestation_repr.t) tzresult Lwt.t (** [get_slot_headers_history ctxt] returns the current value of slots_history stored in [ctxt], or Slots_history.genesis if no value is stored yet. *) diff --git a/src/proto_alpha/lib_protocol/dune b/src/proto_alpha/lib_protocol/dune index 3d544f34579cc6cc1bc19ccb06d5cd17d2dae5b0..20abfb9615601593796a1b3e834ed374275798a6 100644 --- a/src/proto_alpha/lib_protocol/dune +++ b/src/proto_alpha/lib_protocol/dune @@ -77,7 +77,7 @@ Indexable Entrypoint_repr Dal_slot_repr - Dal_endorsement_repr + Dal_attestation_repr Sc_rollup_repr Sc_rollup_metadata_repr Sc_rollup_tick_repr @@ -349,7 +349,7 @@ indexable.ml indexable.mli entrypoint_repr.ml entrypoint_repr.mli dal_slot_repr.ml dal_slot_repr.mli - dal_endorsement_repr.ml dal_endorsement_repr.mli + dal_attestation_repr.ml dal_attestation_repr.mli sc_rollup_repr.ml sc_rollup_repr.mli sc_rollup_metadata_repr.ml sc_rollup_metadata_repr.mli sc_rollup_tick_repr.ml sc_rollup_tick_repr.mli @@ -605,7 +605,7 @@ indexable.ml indexable.mli entrypoint_repr.ml entrypoint_repr.mli dal_slot_repr.ml dal_slot_repr.mli - dal_endorsement_repr.ml dal_endorsement_repr.mli + dal_attestation_repr.ml dal_attestation_repr.mli sc_rollup_repr.ml sc_rollup_repr.mli sc_rollup_metadata_repr.ml sc_rollup_metadata_repr.mli sc_rollup_tick_repr.ml sc_rollup_tick_repr.mli @@ -866,7 +866,7 @@ indexable.ml indexable.mli entrypoint_repr.ml entrypoint_repr.mli dal_slot_repr.ml dal_slot_repr.mli - dal_endorsement_repr.ml dal_endorsement_repr.mli + dal_attestation_repr.ml dal_attestation_repr.mli sc_rollup_repr.ml sc_rollup_repr.mli sc_rollup_metadata_repr.ml sc_rollup_metadata_repr.mli sc_rollup_tick_repr.ml sc_rollup_tick_repr.mli diff --git a/src/proto_alpha/lib_protocol/operation_repr.ml b/src/proto_alpha/lib_protocol/operation_repr.ml index 645760819cd09c98aa1a2738c3e6a9bac9eca073..dd9c7b34b21a5e2c09f6d12cd9275c721aa6e5db 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.ml +++ b/src/proto_alpha/lib_protocol/operation_repr.ml @@ -39,7 +39,7 @@ module Kind = struct type endorsement = endorsement_consensus_kind consensus - type dal_slot_availability = Dal_slot_availability_kind + type dal_attestation = Dal_attestation_kind type seed_nonce_revelation = Seed_nonce_revelation_kind @@ -216,12 +216,12 @@ let pp_consensus_content ppf content = type consensus_watermark = | Endorsement of Chain_id.t | Preendorsement of Chain_id.t - | Dal_slot_availability of Chain_id.t + | Dal_attestation of Chain_id.t let bytes_of_consensus_watermark = function | Preendorsement chain_id -> Bytes.cat (Bytes.of_string "\x12") (Chain_id.to_bytes chain_id) - | Dal_slot_availability chain_id + | Dal_attestation chain_id (* We reuse the watermark of an endorsement. This is because this operation is temporary and aims to be merged with an endorsement later on. Moreover, there is a leak of abstraction with the shell @@ -245,7 +245,7 @@ let of_watermark = function (Chain_id.of_bytes_opt (Bytes.sub b 1 (Bytes.length b - 1))) | '\x14' -> Option.map - (fun chain_id -> Dal_slot_availability chain_id) + (fun chain_id -> Dal_attestation chain_id) (Chain_id.of_bytes_opt (Bytes.sub b 1 (Bytes.length b - 1))) | _ -> None else None @@ -274,9 +274,9 @@ and _ contents_list = and _ contents = | Preendorsement : consensus_content -> Kind.preendorsement contents | Endorsement : consensus_content -> Kind.endorsement contents - | Dal_slot_availability : - Dal_endorsement_repr.operation - -> Kind.dal_slot_availability contents + | Dal_attestation : + Dal_attestation_repr.operation + -> Kind.dal_attestation contents | Seed_nonce_revelation : { level : Raw_level_repr.t; nonce : Seed_repr.nonce; @@ -1397,29 +1397,27 @@ module Encoding = struct @@ union [make endorsement_case])) (varopt "signature" Signature.encoding))) - let dal_slot_availability_encoding = + let dal_attestation_encoding = obj3 - (req "endorser" Signature.Public_key_hash.encoding) - (req "endorsement" Dal_endorsement_repr.encoding) + (req "attestor" Signature.Public_key_hash.encoding) + (req "attestation" Dal_attestation_repr.encoding) (req "level" Raw_level_repr.encoding) - let dal_slot_availability_case = + let dal_attestation_case = Case { tag = 22; - name = "dal_slot_availability"; - encoding = dal_slot_availability_encoding; + name = "dal_attestation"; + encoding = dal_attestation_encoding; select = - (function - | Contents (Dal_slot_availability _ as op) -> Some op | _ -> None); + (function Contents (Dal_attestation _ as op) -> Some op | _ -> None); proj = - (fun (Dal_slot_availability - Dal_endorsement_repr.{endorser; slot_availability; level}) -> - (endorser, slot_availability, level)); + (fun (Dal_attestation + Dal_attestation_repr.{attestor; attestation; level}) -> + (attestor, attestation, level)); inj = - (fun (endorser, slot_availability, level) -> - Dal_slot_availability - Dal_endorsement_repr.{endorser; slot_availability; level}); + (fun (attestor, attestation, level) -> + Dal_attestation Dal_attestation_repr.{attestor; attestation; level}); } let seed_nonce_revelation_case = @@ -1777,7 +1775,7 @@ module Encoding = struct [ make endorsement_case; make preendorsement_case; - make dal_slot_availability_case; + make dal_attestation_case; make seed_nonce_revelation_case; make vdf_revelation_case; make double_endorsement_evidence_case; @@ -1889,7 +1887,7 @@ let acceptable_pass (op : packed_operation) = | Single (Failing_noop _) -> None | Single (Preendorsement _) -> Some consensus_pass | Single (Endorsement _) -> Some consensus_pass - | Single (Dal_slot_availability _) -> Some consensus_pass + | Single (Dal_attestation _) -> Some consensus_pass | Single (Proposals _) -> Some voting_pass | Single (Ballot _) -> Some voting_pass | Single (Seed_nonce_revelation _) -> Some anonymous_pass @@ -1979,9 +1977,9 @@ let check_signature (type kind) key chain_id ~watermark:(to_watermark (Endorsement chain_id)) (Contents_list contents) signature - | Single (Dal_slot_availability _) as contents -> + | Single (Dal_attestation _) as contents -> check - ~watermark:(to_watermark (Dal_slot_availability chain_id)) + ~watermark:(to_watermark (Dal_attestation chain_id)) (Contents_list contents) signature | Single @@ -2089,8 +2087,8 @@ let equal_contents_kind : type a b. a contents -> b contents -> (a, b) eq option | Preendorsement _, _ -> None | Endorsement _, Endorsement _ -> Some Eq | Endorsement _, _ -> None - | Dal_slot_availability _, Dal_slot_availability _ -> Some Eq - | Dal_slot_availability _, _ -> None + | Dal_attestation _, Dal_attestation _ -> Some Eq + | Dal_attestation _, _ -> None | Seed_nonce_revelation _, Seed_nonce_revelation _ -> Some Eq | Seed_nonce_revelation _, _ -> None | Vdf_revelation _, Vdf_revelation _ -> Some Eq @@ -2259,9 +2257,9 @@ let consensus_infos_and_hash_from_block_header (bh : Block_header_repr.t) = The [weight] of an {!Endorsement} or {!Preendorsement} depends on its {!endorsement_infos}. - The [weight] of a {!Dal_slot_availability} depends on the pair of - the size of its bitset, {!Dal_endorsement_repr.t}, and the - signature of its endorser {! Signature.Public_key_hash.t}. + The [weight] of a {!Dal_attestation} depends on the pair of + the size of its bitset, {!Dal_attestation_repr.t}, and the + signature of its attestor {! Signature.Public_key_hash.t}. The [weight] of a voting operation depends on the pair of its [period] and [source]. @@ -2291,8 +2289,8 @@ let consensus_infos_and_hash_from_block_header (bh : Block_header_repr.t) = type _ weight = | Weight_endorsement : endorsement_infos -> consensus_pass_type weight | Weight_preendorsement : endorsement_infos -> consensus_pass_type weight - | Weight_dal_slot_availability : - (* endorser * num_attestations * level *) + | Weight_dal_attestation : + (* attestor * num_attestations * level *) (Signature.Public_key_hash.t * int * int32) -> consensus_pass_type weight | Weight_proposals : @@ -2393,14 +2391,13 @@ let weight_of : packed_operation -> operation_weight = ( Consensus, Weight_endorsement (endorsement_infos_from_consensus_content consensus_content) ) - | Single - (Dal_slot_availability - Dal_endorsement_repr.{endorser; slot_availability; level}) -> + | Single (Dal_attestation Dal_attestation_repr.{attestor; attestation; level}) + -> W ( Consensus, - Weight_dal_slot_availability - ( endorser, - Dal_endorsement_repr.occupied_size_in_bits slot_availability, + Weight_dal_attestation + ( attestor, + Dal_attestation_repr.occupied_size_in_bits attestation, Raw_level_repr.to_int32 level ) ) | Single (Proposals {period; source; _}) -> W (Voting, Weight_proposals (period, source)) @@ -2528,19 +2525,19 @@ let compare_baking_infos infos1 infos2 = (infos1.round, infos1.bh_hash) (infos2.round, infos2.bh_hash) -(** Two valid {!Dal_slot_availability} are compared in the - lexicographic order of their pairs of bitsets size and endorser +(** Two valid {!Dal_attestation} are compared in the + lexicographic order of their pairs of bitsets size and attestor hash. *) -let compare_dal_slot_availability (endorser1, endorsements1, level1) - (endorser2, endorsements2, level2) = +let compare_dal_attestation (attestor1, endorsements1, level1) + (attestor2, endorsements2, level2) = compare_pair_in_lexico_order ~cmp_fst: (compare_pair_in_lexico_order ~cmp_fst:Compare.Int32.compare ~cmp_snd:Compare.Int.compare) ~cmp_snd:Signature.Public_key_hash.compare - ((level1, endorsements1), endorser1) - ((level2, endorsements2), endorser2) + ((level1, endorsements1), attestor1) + ((level2, endorsements2), attestor2) (** {4 Comparison of valid operations of the same validation pass} *) @@ -2550,9 +2547,9 @@ let compare_dal_slot_availability (endorser1, endorsements1, level1) comparison on {!endorsement_infos} for {!Endorsement} and {!Preendorsement}: see {!endorsement_infos} for more details. - {!Dal_slot_availability} is smaller than the other kinds of - consensus operations. Two valid {!Dal_slot_availability} are - compared by {!compare_dal_slot_availability}. *) + {!Dal_attestation} is smaller than the other kinds of + consensus operations. Two valid {!Dal_attestation} are + compared by {!compare_dal_attestation}. *) let compare_consensus_weight w1 w2 = match (w1, w2) with | Weight_endorsement infos1, Weight_endorsement infos2 -> @@ -2563,16 +2560,14 @@ let compare_consensus_weight w1 w2 = compare_endorsement_infos ~prioritized_position:Fstpos infos1 infos2 | Weight_preendorsement infos1, Weight_endorsement infos2 -> compare_endorsement_infos ~prioritized_position:Sndpos infos1 infos2 - | ( Weight_dal_slot_availability (endorser1, size1, lvl1), - Weight_dal_slot_availability (endorser2, size2, lvl2) ) -> - compare_dal_slot_availability - (endorser1, size1, lvl1) - (endorser2, size2, lvl2) - | ( Weight_dal_slot_availability _, - (Weight_endorsement _ | Weight_preendorsement _) ) -> + | ( Weight_dal_attestation (attestor1, size1, lvl1), + Weight_dal_attestation (attestor2, size2, lvl2) ) -> + compare_dal_attestation (attestor1, size1, lvl1) (attestor2, size2, lvl2) + | Weight_dal_attestation _, (Weight_endorsement _ | Weight_preendorsement _) + -> -1 - | ( (Weight_endorsement _ | Weight_preendorsement _), - Weight_dal_slot_availability _ ) -> + | (Weight_endorsement _ | Weight_preendorsement _), Weight_dal_attestation _ + -> 1 (** {5 Comparison of valid voting operations} *) diff --git a/src/proto_alpha/lib_protocol/operation_repr.mli b/src/proto_alpha/lib_protocol/operation_repr.mli index c5f904322ec97908667e45a91c36d02baf158b45..d2b6720e8a9a64316ede6411e2005806f2c681da 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.mli +++ b/src/proto_alpha/lib_protocol/operation_repr.mli @@ -71,7 +71,7 @@ module Kind : sig type endorsement = endorsement_consensus_kind consensus - type dal_slot_availability = Dal_slot_availability_kind + type dal_attestation = Dal_attestation_kind type seed_nonce_revelation = Seed_nonce_revelation_kind @@ -221,7 +221,7 @@ val pp_consensus_content : Format.formatter -> consensus_content -> unit type consensus_watermark = | Endorsement of Chain_id.t | Preendorsement of Chain_id.t - | Dal_slot_availability of Chain_id.t + | Dal_attestation of Chain_id.t val to_watermark : consensus_watermark -> Signature.watermark @@ -268,9 +268,9 @@ and _ contents = (* DAL/FIXME https://gitlab.com/tezos/tezos/-/issues/3115 Temporary operation to avoid modifying endorsement encoding. *) - | Dal_slot_availability : - Dal_endorsement_repr.operation - -> Kind.dal_slot_availability contents + | Dal_attestation : + Dal_attestation_repr.operation + -> Kind.dal_attestation contents (* Seed_nonce_revelation: Nonces are created by bakers and are combined to create pseudo-random seeds. Bakers are urged to reveal their nonces after a given number of cycles to keep their block rewards @@ -667,7 +667,7 @@ val compare_by_passes : packed_operation -> packed_operation -> int The global order is as follows: - {!Endorsement} and {!Preendorsement} > {!Dal_slot_availability} > + {!Endorsement} and {!Preendorsement} > {!Dal_attestation} > {!Proposals} > {!Ballot} > {!Double_preendorsement_evidence} > {!Double_endorsement_evidence} > {!Double_baking_evidence} > {!Vdf_revelation} > {!Seed_nonce_revelation} > {!Activate_account} @@ -683,7 +683,7 @@ val compare_by_passes : packed_operation -> packed_operation -> int and comparing an {!Endorsement] to a {!Preendorsement}, the {!Endorsement} is better. - Two {!Dal_slot_availability} ops are compared in the lexicographic + Two {!Dal_attestation} ops are compared in the lexicographic order of the pair of their number of endorsed slots as available and their endorsers. @@ -738,7 +738,7 @@ module Encoding : sig val endorsement_case : Kind.endorsement case - val dal_slot_availability_case : Kind.dal_slot_availability case + val dal_attestation_case : Kind.dal_attestation case val seed_nonce_revelation_case : Kind.seed_nonce_revelation case diff --git a/src/proto_alpha/lib_protocol/raw_context.ml b/src/proto_alpha/lib_protocol/raw_context.ml index d26a3dc7197198a0c4ddc2bd12fd4973ba477919..cd5cd74d5a9694c84dde84e90d739d673b890a3a 100644 --- a/src/proto_alpha/lib_protocol/raw_context.ml +++ b/src/proto_alpha/lib_protocol/raw_context.ml @@ -225,14 +225,14 @@ end type dal_committee = { pkh_to_shards : - (Dal_endorsement_repr.shard_index * int) Signature.Public_key_hash.Map.t; - shard_to_pkh : Signature.Public_key_hash.t Dal_endorsement_repr.Shard_map.t; + (Dal_attestation_repr.shard_index * int) Signature.Public_key_hash.Map.t; + shard_to_pkh : Signature.Public_key_hash.t Dal_attestation_repr.Shard_map.t; } let empty_dal_committee = { pkh_to_shards = Signature.Public_key_hash.Map.empty; - shard_to_pkh = Dal_endorsement_repr.Shard_map.empty; + shard_to_pkh = Dal_attestation_repr.Shard_map.empty; } type back = { @@ -273,7 +273,7 @@ type back = { - We need to provide an incentive to avoid byzantines to post dummy slot headers. *) - dal_endorsement_slot_accountability : Dal_endorsement_repr.Accountability.t; + dal_attestation_slot_accountability : Dal_attestation_repr.Accountability.t; dal_committee : dal_committee; } @@ -829,8 +829,8 @@ let prepare ~level ~predecessor_timestamp ~timestamp ctxt = dal_slot_fee_market = Dal_slot_repr.Slot_market.init ~length:constants.Constants_parametric_repr.dal.number_of_slots; - dal_endorsement_slot_accountability = - Dal_endorsement_repr.Accountability.init + dal_attestation_slot_accountability = + Dal_attestation_repr.Accountability.init ~length:constants.Constants_parametric_repr.dal.number_of_slots; dal_committee = empty_dal_committee; }; @@ -935,7 +935,7 @@ let prepare_first_block ~level ~timestamp ctxt = { feature_enable = c.dal.feature_enable; number_of_slots = c.dal.number_of_slots; - endorsement_lag = c.dal.endorsement_lag; + attestation_lag = c.dal.endorsement_lag; availability_threshold = c.dal.availability_threshold; cryptobox_parameters; } @@ -1510,13 +1510,13 @@ module Dal = struct Dal_register_invalid_slot_header {length; slot_header}) let record_available_shards ctxt slots shards = - let dal_endorsement_slot_accountability = - Dal_endorsement_repr.Accountability.record_shards_availability - ctxt.back.dal_endorsement_slot_accountability + let dal_attestation_slot_accountability = + Dal_attestation_repr.Accountability.record_shards_availability + ctxt.back.dal_attestation_slot_accountability slots shards in - {ctxt with back = {ctxt.back with dal_endorsement_slot_accountability}} + {ctxt with back = {ctxt.back with dal_attestation_slot_accountability}} let register_slot_header ctxt slot_header = match @@ -1543,15 +1543,15 @@ module Dal = struct ctxt.back.constants.Constants_parametric_repr.dal.cryptobox_parameters .number_of_shards in - Dal_endorsement_repr.Accountability.is_slot_available - ctxt.back.dal_endorsement_slot_accountability + Dal_attestation_repr.Accountability.is_slot_available + ctxt.back.dal_attestation_slot_accountability ~threshold ~number_of_shards type committee = dal_committee = { pkh_to_shards : - (Dal_endorsement_repr.shard_index * int) Signature.Public_key_hash.Map.t; - shard_to_pkh : Signature.Public_key_hash.t Dal_endorsement_repr.Shard_map.t; + (Dal_attestation_repr.shard_index * int) Signature.Public_key_hash.Map.t; + shard_to_pkh : Signature.Public_key_hash.t Dal_attestation_repr.Shard_map.t; } (* DAL/FIXME https://gitlab.com/tezos/tezos/-/issues/3110 @@ -1568,7 +1568,7 @@ module Dal = struct Tenderbake committee. Consequently, either we decide to have a new consensus operation which does not count for Tenderbake, and/or we take into account for the model of DAL that at every - level, a percentage of DAL endorsements cannot be received. *) + level, a percentage of DAL attestations cannot be received. *) let compute_committee ctxt pkh_from_tenderbake_slot = let Constants_parametric_repr. { @@ -1596,7 +1596,7 @@ module Dal = struct shard_to_pkh = List.fold_left (fun shard_to_pkh slot -> - Dal_endorsement_repr.Shard_map.add slot pkh shard_to_pkh) + Dal_attestation_repr.Shard_map.add slot pkh shard_to_pkh) committee.shard_to_pkh Misc.(slot_index --> (slot_index + (power - 1))); } @@ -1638,7 +1638,7 @@ module Dal = struct let init_committee ctxt committee = {ctxt with back = {ctxt.back with dal_committee = committee}} - let shards_of_endorser ctxt ~endorser:pkh = + let shards_of_attestor ctxt ~attestor:pkh = let rec make acc (initial_shard_index, power) = if Compare.Int.(power <= 0) then List.rev acc else make (initial_shard_index :: acc) (initial_shard_index + 1, power - 1) diff --git a/src/proto_alpha/lib_protocol/raw_context.mli b/src/proto_alpha/lib_protocol/raw_context.mli index b0f1bd110c078786190644f6b5b24c8c4ce1168d..40e392c4414c3df90d2a973656a2c29f6a3e7083 100644 --- a/src/proto_alpha/lib_protocol/raw_context.mli +++ b/src/proto_alpha/lib_protocol/raw_context.mli @@ -398,7 +398,7 @@ module Dal : sig assumes that a shard belongs to the interval [0; number_of_shards - 1]. Otherwise, for each shard outside this interval, it is a no-op. *) - val record_available_shards : t -> Dal_endorsement_repr.t -> int list -> t + val record_available_shards : t -> Dal_attestation_repr.t -> int list -> t (** [register_slot_header ctxt slot_header] returns a new context where the new candidate [slot] have been taken into @@ -418,11 +418,11 @@ module Dal : sig [0;number_of_slots - 1], returns [false]. *) val is_slot_index_available : t -> Dal_slot_repr.Index.t -> bool - (** [shards_of_endorser ctxt ~endorser] returns the shard assignment - of the DAL committee of the current level for [endorser]. This + (** [shards_of_attestor ctxt ~attestor] returns the shard assignment + of the DAL committee of the current level for [attestor]. This function never returns an empty list. *) - val shards_of_endorser : - t -> endorser:Signature.Public_key_hash.t -> int list option + val shards_of_attestor : + t -> attestor:Signature.Public_key_hash.t -> int list option (** The DAL committee is a subset of the Tenderbake committee. A shard from [0;number_of_shards] is associated to a public key @@ -444,12 +444,12 @@ module Dal : sig \exists (start,n), find pkh_to_shards pkh = Some (start,n) /\ start <= shard <= start + n -1 - - Given an endorser, all its shards assignement are contiguous + - Given an attestor, all its shards assignement are contiguous *) type committee = { pkh_to_shards : - (Dal_endorsement_repr.shard_index * int) Signature.Public_key_hash.Map.t; - shard_to_pkh : Signature.Public_key_hash.t Dal_endorsement_repr.Shard_map.t; + (Dal_attestation_repr.shard_index * int) Signature.Public_key_hash.Map.t; + shard_to_pkh : Signature.Public_key_hash.t Dal_attestation_repr.Shard_map.t; } (** [compute_committee ctxt pkh_from_tenderbake_slot] computes the diff --git a/src/proto_alpha/lib_protocol/sc_rollup_arith.ml b/src/proto_alpha/lib_protocol/sc_rollup_arith.ml index 1498820cd30ac5e5ad6521e6990658764fad1a6c..2713ac99e2ca5ec5730de56eefa229e443e43a66 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_arith.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_arith.ml @@ -1199,7 +1199,7 @@ module Make (Context : P) : is merged. *) (* The parameters below are those of mainnet in protocol constants, divided by 16. *) - let endorsement_lag = 1l in + let attestation_lag = 1l in let page_size = 4096 / 64 in let slot_size = (1 lsl 20) / 64 in let number_of_slots = 256 / 64 in @@ -1235,7 +1235,7 @@ module Make (Context : P) : More generally, the whole condition below will be reworked. *) if Compare.Int32.( - delta > 1l && delta <= Int32.mul 2l endorsement_lag) + delta > 1l && delta <= Int32.mul 2l attestation_lag) then let* index = mk_slot_index slot in let* page_index = mk_page_index page in diff --git a/src/proto_alpha/lib_protocol/sc_rollup_arith.mli b/src/proto_alpha/lib_protocol/sc_rollup_arith.mli index 6105e6dc0b01b0a966d26181289c02cb19cfa1ee..4b8ba4520ab763dc4ae846ba645cbc203c63f723 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_arith.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_arith.mli @@ -55,7 +55,7 @@ - an input [dal:::] is interpreted as a directive to request the DAL page whose index is belonging to slot index confirmed - at level (i.e published at level LVL - endorsement_lag) ; + at level (i.e published at level LVL - attestation_lag) ; If a message is not syntactically correct or does not evaluate correctly, the machine stops its evaluation and waits for the next diff --git a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml index eb1ed60db3aa95bb8a163e9845a7cbb9f944eed2..8c8b4016c31706b1068dd3d6248a52cd62011357 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml @@ -989,7 +989,7 @@ let check_proof_refute_stop_state ~stop_state input input_request proof = check_proof_stop_state ~stop_state input input_request proof false (** Returns the validity of the first final move on top of a dissection. *) -let validity_final_move dal_parameters ~dal_endorsement_lag ~first_move +let validity_final_move dal_parameters ~dal_attestation_lag ~first_move ~metadata ~proof ~game ~start_chunk ~stop_chunk = let open Lwt_result_syntax in let*! res = @@ -997,14 +997,14 @@ let validity_final_move dal_parameters ~dal_endorsement_lag ~first_move let*! valid = (* FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/3997 This function is not resilient to dal parameters changes - (cryptobox parameters or dal_endorsement_lag for instance). *) + (cryptobox parameters or dal_attestation_lag for instance). *) Sc_rollup_proof_repr.valid ~metadata inbox_snapshot inbox_level dal_snapshot dal_parameters - ~dal_endorsement_lag + ~dal_attestation_lag ~pvm_name proof in @@ -1047,11 +1047,11 @@ let validity_final_move dal_parameters ~dal_endorsement_lag ~first_move - The proof stop on the state different than the refuted one. - The proof is correctly verified. *) -let validity_first_final_move dal_parameters ~dal_endorsement_lag ~metadata +let validity_first_final_move dal_parameters ~dal_attestation_lag ~metadata ~proof ~game ~start_chunk ~stop_chunk = validity_final_move dal_parameters - ~dal_endorsement_lag + ~dal_attestation_lag ~first_move:true ~metadata ~proof @@ -1066,11 +1066,11 @@ let validity_first_final_move dal_parameters ~dal_endorsement_lag ~metadata - The proof stop on the state validates the refuted one. - The proof is correctly verified. *) -let validity_second_final_move dal_parameters ~dal_endorsement_lag ~metadata +let validity_second_final_move dal_parameters ~dal_attestation_lag ~metadata ~agreed_start_chunk ~refuted_stop_chunk ~game ~proof = validity_final_move dal_parameters - ~dal_endorsement_lag + ~dal_attestation_lag ~first_move:false ~metadata ~proof @@ -1085,7 +1085,7 @@ let loser_of_results ~alice_result ~bob_result = | false, true -> Some Alice | true, false -> Some Bob -let play dal_parameters ~dal_endorsement_lag ~stakers metadata game refutation = +let play dal_parameters ~dal_attestation_lag ~stakers metadata game refutation = let open Lwt_result_syntax in let mk_loser loser = let loser = Index.staker stakers loser in @@ -1125,7 +1125,7 @@ let play dal_parameters ~dal_endorsement_lag ~stakers metadata game refutation = let*! player_result = validity_first_final_move dal_parameters - ~dal_endorsement_lag + ~dal_attestation_lag ~proof ~metadata ~game @@ -1154,7 +1154,7 @@ let play dal_parameters ~dal_endorsement_lag ~stakers metadata game refutation = let*! player_result = validity_second_final_move dal_parameters - ~dal_endorsement_lag + ~dal_attestation_lag ~metadata ~agreed_start_chunk ~refuted_stop_chunk diff --git a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.mli b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.mli index 8207b6ae1544fa1a62622b10ae854cb1e12e0be3..5e376ea11f0fb11d3c4c3da4a8c8ba243702c878 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.mli @@ -417,7 +417,7 @@ val loser_of_results : alice_result:bool -> bob_result:bool -> player option player and returns a [Ongoing] status. Otherwise, it returns a [Ended ] status. - The provided DAL parameters and [dal_endorsement_lag] are used in case the + The provided DAL parameters and [dal_attestation_lag] are used in case the game needs to check that a page's content is part of a slot (using the slot's commitment). *) @@ -426,7 +426,7 @@ val play : Providing DAL parameters here is not resilient to their change during protocol upgrade. *) Dal_slot_repr.parameters -> - dal_endorsement_lag:int -> + dal_attestation_lag:int -> stakers:Index.t -> Sc_rollup_metadata_repr.t -> t -> diff --git a/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.ml b/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.ml index 4ea5aeb0a6005b9606991d337cd581064b95ddb5..f0b1ad0f61ca28bcc0c442b16dd9aa4d2db1c07a 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.ml @@ -204,33 +204,33 @@ module Dal_proofs = struct is in the following boundaries: - page_published_level > origination_level: this means that the slot of the page was published after the rollup origination ; - - page_published_level + dal_endorsement_lag < commit_level: this + - page_published_level + dal_attestation_lag < commit_level: this means that the slot of the page has been confirmed before the [commit_level]. According to the definition in {!Sc_rollup_commitment_repr}, [commit_level] (aka inbox_level in that module) is the level (excluded) up to which the PVM consumed all messages and DAL/DAC inputs before producing the related commitment. *) - let page_level_is_valid ~dal_endorsement_lag ~origination_level ~commit_level + let page_level_is_valid ~dal_attestation_lag ~origination_level ~commit_level page_id = - (* [dal_endorsement_lag] is supposed to be positive. *) + (* [dal_attestation_lag] is supposed to be positive. *) let page_published_level = Dal_slot_repr.(page_id.Page.slot_id.Header.published_level) in let open Raw_level_repr in let not_too_old = page_published_level > origination_level in let not_too_recent = - add page_published_level dal_endorsement_lag < commit_level + add page_published_level dal_attestation_lag < commit_level in not_too_old && not_too_recent - let verify ~metadata ~dal_endorsement_lag ~commit_level dal_parameters page_id + let verify ~metadata ~dal_attestation_lag ~commit_level dal_parameters page_id dal_snapshot proof = let open Result_syntax in if page_level_is_valid ~origination_level:metadata.Sc_rollup_metadata_repr.origination_level - ~dal_endorsement_lag + ~dal_attestation_lag ~commit_level page_id then @@ -244,13 +244,13 @@ module Dal_proofs = struct return_some (Sc_rollup_PVM_sig.Reveal (Dal_page input)) else return_none - let produce ~metadata ~dal_endorsement_lag ~commit_level dal_parameters + let produce ~metadata ~dal_attestation_lag ~commit_level dal_parameters page_id ~page_info confirmed_slots_history history_cache = let open Result_syntax in if page_level_is_valid ~origination_level:metadata.Sc_rollup_metadata_repr.origination_level - ~dal_endorsement_lag + ~dal_attestation_lag ~commit_level page_id then @@ -269,7 +269,7 @@ module Dal_proofs = struct end let valid ~metadata snapshot commit_level dal_snapshot dal_parameters - ~dal_endorsement_lag ~pvm_name proof = + ~dal_attestation_lag ~pvm_name proof = let open Lwt_result_syntax in let (module P) = Sc_rollups.wrapped_proof_module proof.pvm_step in let* () = check (String.equal P.name pvm_name) "Incorrect PVM kind" in @@ -299,7 +299,7 @@ let valid ~metadata snapshot commit_level dal_snapshot dal_parameters Dal_proofs.verify ~metadata dal_parameters - ~dal_endorsement_lag + ~dal_attestation_lag ~commit_level page_id dal_snapshot @@ -375,7 +375,7 @@ module type PVM_with_context_and_state = sig val dal_parameters : Dal_slot_repr.parameters - val dal_endorsement_lag : int + val dal_attestation_lag : int end end @@ -439,7 +439,7 @@ let produce ~metadata pvm_and_state commit_level = Dal_proofs.produce ~metadata dal_parameters - ~dal_endorsement_lag + ~dal_attestation_lag ~commit_level page_id ~page_info diff --git a/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.mli b/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.mli index f8ec62e6b800f8547ebd40e7899cb7563690fdb2..db3b111d423aab300cc37f1134e94210b1306f7c 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.mli @@ -125,7 +125,7 @@ val stop : t -> State_hash.t output from the [input] proof is too recent to be allowed into the PVM proof ; - - DAL parameters and [dal_endorsement_lag], to be able to check the page + - DAL parameters and [dal_attestation_lag], to be able to check the page content membership to a slot if needed ; - the [pvm_name], used to check that the proof given has the right @@ -140,7 +140,7 @@ val valid : Raw_level_repr.t -> Dal_slot_repr.History.t -> Dal_slot_repr.parameters -> - dal_endorsement_lag:int -> + dal_attestation_lag:int -> pvm_name:string -> t -> (Sc_rollup_PVM_sig.input option * Sc_rollup_PVM_sig.input_request) tzresult @@ -169,7 +169,7 @@ module type PVM_with_context_and_state = sig (* FIXME/DAL: https://gitlab.com/tezos/tezos/-/issues/3997 This interface might not be resilient to dal parameters changes - (cryptobox parameters or dal_endorsement_lag for instance). *) + (cryptobox parameters or dal_attestation_lag for instance). *) module Dal_with_history : sig (** The reference/snapshot cell of the DAL skip list that stores confirmed slots. *) @@ -198,7 +198,7 @@ module type PVM_with_context_and_state = sig (** The lag between the time an endorsement is published on L1 (its published_level) and the level it should be confirmed. *) - val dal_endorsement_lag : int + val dal_attestation_lag : int end end diff --git a/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml b/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml index 1fdf65db49c655c93989135a552077c2045db8ee..8d67af2bafa4f1d547257f50ef724972f618d5db 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml @@ -298,7 +298,7 @@ let game_move ctxt rollup ~player ~opponent refutation = let* move_result = Sc_rollup_game_repr.play dal.cryptobox_parameters - ~dal_endorsement_lag:dal.endorsement_lag + ~dal_attestation_lag:dal.attestation_lag ~stakers metadata game diff --git a/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml b/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml index 9861e63e77ec5441b0e94dd884ef4f0d95c3be05..8a8a0cfb024af6179c13d4ef87f245f0fa771620 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml @@ -47,7 +47,7 @@ let manager_pass = `PManager let all_passes = [`PConsensus; `PAnonymous; `PVote; `PManager] -let consensus_kinds = [`KPreendorsement; `KEndorsement; `KDal_slot] +let consensus_kinds = [`KPreendorsement; `KEndorsement; `KDal_attestation] let anonymous_kinds = [ @@ -104,7 +104,7 @@ let pp_kind fmt k = (match k with | `KPreendorsement -> "KPreendorsement" | `KEndorsement -> "KEndorsement" - | `KDal_slot -> "KDal_slot" + | `KDal_attestation -> "KDal_attestation" | `KSeed_nonce_revelation -> "KSeed_nonce_revelation" | `KVdf_revelation -> "KVdf_revelation" | `KDouble_endorsement -> "KDouble_endorsement" @@ -398,16 +398,12 @@ let generate_endorsement = let+ cc = generate_consensus_content in Endorsement cc -let generate_dal_slot = +let generate_dal_attestation = let open QCheck2.Gen in - let+ endorser = random_pkh in - Dal_slot_availability - Dal.Endorsement. - { - endorser; - slot_availability = Dal.Endorsement.empty; - level = Raw_level.root; - } + let+ attestor = random_pkh in + Dal_attestation + Dal.Attestation. + {attestor; attestation = Dal.Attestation.empty; level = Raw_level.root} let generate_vdf_revelation = let open QCheck2.Gen in @@ -836,7 +832,7 @@ let generate_operation = match kind with | `KPreendorsement -> generate_operation generate_preendorsement | `KEndorsement -> generate_operation generate_endorsement - | `KDal_slot -> generate_operation generate_dal_slot + | `KDal_attestation -> generate_operation generate_dal_attestation | `KSeed_nonce_revelation -> generate_operation generate_seed_nonce_revelation | `KVdf_revelation -> generate_operation generate_vdf_revelation diff --git a/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.ml b/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.ml index 28a5266a11ae94283d6efa53c8672a2168423622..42cd40c354ce994b658ba7f6972bf48e93ca66b3 100644 --- a/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.ml +++ b/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.ml @@ -660,7 +660,7 @@ let dal_slot_availibility ctxt delegate = >|=? fun (ctxt, consensus_pk1) -> (ctxt, consensus_pk1.delegate) in let* committee = - Alpha_context.Dal.Endorsement.compute_committee + Alpha_context.Dal.Attestation.compute_committee ctxt pkh_from_tenderbake_slot in @@ -671,13 +671,12 @@ let dal_slot_availibility ctxt delegate = with | None -> return_none | Some _interval -> - (* The content of the endorsement does not matter for covalidity. *) - let slot_availability = Dal.Endorsement.empty in + (* The content of the attestation does not matter for covalidity. *) + let attestation = Dal.Attestation.empty in let level = Raw_level.succ level.Level.level in - return_some - (Dal_slot_availability {endorser = delegate; slot_availability; level}) + return_some (Dal_attestation {attestor = delegate; attestation; level}) -let dal_slot_availability_descriptor = +let dal_attestation_descriptor = let open Lwt_result_syntax in { parameters = @@ -860,7 +859,7 @@ let manager_descriptor max_batch_size nb_accounts = type op_kind = | KEndorsement | KPreendorsement - | KDalslotavail + | KDalattestation | KBallotExp | KBallotProm | KProposals @@ -877,7 +876,7 @@ let op_kind_of_packed_operation op = match contents with | Single (Preendorsement _) -> KPreendorsement | Single (Endorsement _) -> KEndorsement - | Single (Dal_slot_availability _) -> KDalslotavail + | Single (Dal_attestation _) -> KDalattestation | Single (Seed_nonce_revelation _) -> KNonce | Single (Vdf_revelation _) -> KVdf | Single (Double_endorsement_evidence _) -> KDbl_consensus @@ -898,7 +897,7 @@ let pp_op_kind fmt kind = | KManager -> "manager" | KEndorsement -> "endorsement" | KPreendorsement -> "preendorsement" - | KDalslotavail -> "dal_slot" + | KDalattestation -> "dal_attestation" | KBallotExp -> "ballot" | KBallotProm -> "ballot" | KProposals -> "proposals" @@ -913,7 +912,7 @@ let descriptor_of ~nb_bootstrap ~max_batch_size = function | KManager -> manager_descriptor max_batch_size nb_bootstrap | KEndorsement -> endorsement_descriptor | KPreendorsement -> preendorsement_descriptor - | KDalslotavail -> dal_slot_availability_descriptor + | KDalattestation -> dal_attestation_descriptor | KBallotExp -> ballot_exploration_descriptor | KBallotProm -> ballot_promotion_descriptor | KProposals -> proposal_descriptor @@ -940,7 +939,7 @@ let non_exclusive_kinds = KManager; KEndorsement; KPreendorsement; - KDalslotavail; + KDalattestation; KActivate; KDbl_consensus; KDbl_baking; diff --git a/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.mli b/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.mli index 1b9add80bfa633d4a52f066a9dd8f43e0fe5367c..b0870b34a5be46be93588cd5bc0138a8a0d59ac4 100644 --- a/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.mli +++ b/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.mli @@ -122,7 +122,7 @@ type descriptor = { type op_kind = | KEndorsement | KPreendorsement - | KDalslotavail + | KDalattestation | KBallotExp | KBallotProm | KProposals diff --git a/src/proto_alpha/lib_protocol/test/integration/validate/test_sanity.ml b/src/proto_alpha/lib_protocol/test/integration/validate/test_sanity.ml index b06dfa1f454fab43fffbebf0629053d29c3c645b..b2924d8686372357606ca1f774b2068913707acf 100644 --- a/src/proto_alpha/lib_protocol/test/integration/validate/test_sanity.ml +++ b/src/proto_alpha/lib_protocol/test/integration/validate/test_sanity.ml @@ -136,8 +136,8 @@ let covalidation_sanity () = | Single (Preendorsement _), _ -> assert false | Single (Endorsement _), KEndorsement -> return_unit | Single (Endorsement _), _ -> assert false - | Single (Dal_slot_availability _), KDalslotavail -> return_unit - | Single (Dal_slot_availability _), _ -> assert false + | Single (Dal_attestation _), KDalattestation -> return_unit + | Single (Dal_attestation _), _ -> assert false | Single (Seed_nonce_revelation _), KNonce -> return_unit | Single (Seed_nonce_revelation _), _ -> assert false | Single (Vdf_revelation _), KVdf -> return_unit diff --git a/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml b/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml index 5935ad1e771f5e9dadd3eadb986f494bc1bfa702..acf07ed750b90805a79f2612c94bd050ee5ff211 100644 --- a/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml +++ b/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml @@ -1274,8 +1274,8 @@ let build_proof ~player_client start_tick (game : Game.t) = let dal_parameters = Default_parameters.constants_test.dal.cryptobox_parameters - let dal_endorsement_lag = - Default_parameters.constants_test.dal.endorsement_lag + let dal_attestation_lag = + Default_parameters.constants_test.dal.attestation_lag end end in let*! proof = Sc_rollup.Proof.produce ~metadata (module P) game.inbox_level in diff --git a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_game.ml b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_game.ml index f61effa1d31fddea18e9a3548bfffd5a5e97ffad..46377572eecaa69eabc27425b620783510dda769 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_game.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_game.ml @@ -316,7 +316,7 @@ let test_invalid_serialized_inbox_proof () = Raw_level.root dal_snapshot dal_parameters.cryptobox_parameters - ~dal_endorsement_lag:dal_parameters.endorsement_lag + ~dal_attestation_lag:dal_parameters.attestation_lag ~pvm_name:"arith" proof in diff --git a/src/proto_alpha/lib_protocol/validate.ml b/src/proto_alpha/lib_protocol/validate.ml index 05c2ca5b3681a5152c7b91bca11f3f8e758a11ad..128c4979492bafcb74a8b752f98eda5c55c1f7fd 100644 --- a/src/proto_alpha/lib_protocol/validate.ml +++ b/src/proto_alpha/lib_protocol/validate.ml @@ -129,7 +129,7 @@ type consensus_state = { preendorsements_seen : Operation_hash.t Slot.Map.t; endorsements_seen : Operation_hash.t Slot.Map.t; grandparent_endorsements_seen : Operation_hash.t Slot.Map.t; - dal_slot_availability_seen : Operation_hash.t Signature.Public_key_hash.Map.t; + dal_attestation_seen : Operation_hash.t Signature.Public_key_hash.Map.t; } let slot_map_encoding element_encoding = @@ -148,24 +148,24 @@ let consensus_state_encoding = preendorsements_seen; endorsements_seen; grandparent_endorsements_seen; - dal_slot_availability_seen; + dal_attestation_seen; } -> ( predecessor_level, preendorsements_seen, endorsements_seen, grandparent_endorsements_seen, - dal_slot_availability_seen )) + dal_attestation_seen )) (fun ( predecessor_level, preendorsements_seen, endorsements_seen, grandparent_endorsements_seen, - dal_slot_availability_seen ) -> + dal_attestation_seen ) -> { predecessor_level; preendorsements_seen; endorsements_seen; grandparent_endorsements_seen; - dal_slot_availability_seen; + dal_attestation_seen; }) (obj5 (req "predecessor_level" Raw_level.encoding) @@ -177,7 +177,7 @@ let consensus_state_encoding = "grandparent_endorsements_seen" (slot_map_encoding Operation_hash.encoding)) (req - "dal_slot_availability_seen" + "dal_attestation_seen" (Signature.Public_key_hash.Map.encoding Operation_hash.encoding))) let init_consensus_state ~predecessor_level = @@ -186,7 +186,7 @@ let init_consensus_state ~predecessor_level = preendorsements_seen = Slot.Map.empty; endorsements_seen = Slot.Map.empty; grandparent_endorsements_seen = Slot.Map.empty; - dal_slot_availability_seen = Signature.Public_key_hash.Map.empty; + dal_attestation_seen = Signature.Public_key_hash.Map.empty; } type voting_state = { @@ -509,7 +509,7 @@ let init_block_state vi = let get_initial_ctxt {info; _} = info.ctxt (** Validation of consensus operations (validation pass [0]): - preendorsement, endorsement, and dal_slot_availability. *) + preendorsement, endorsement, and dal_attestation. *) module Consensus = struct let expected_endorsement_features ~predecessor_level ~predecessor_round branch payload_hash = @@ -1047,8 +1047,7 @@ module Consensus = struct remove_normal_endorsement vs consensus_content else remove_grandparent_endorsement vs consensus_content - let check_dal_slot_availability vi - (operation : Kind.dal_slot_availability operation) = + let check_dal_attestation vi (operation : Kind.dal_attestation operation) = (* DAL/FIXME https://gitlab.com/tezos/tezos/-/issues/3115 This is a temporary operation. Some checks are missing for the moment. In particular, the signature is not @@ -1059,44 +1058,36 @@ module Consensus = struct operation should be merged with an endorsement or at least refined. *) let open Lwt_result_syntax in - let (Single (Dal_slot_availability op)) = - operation.protocol_data.contents - in + let (Single (Dal_attestation op)) = operation.protocol_data.contents in let*? () = (* Note that this function checks the dal feature flag. *) - Dal_apply.validate_data_availability vi.ctxt op + Dal_apply.validate_attestation vi.ctxt op in return_unit - let check_dal_slot_availability_conflict vs oph - (operation : Kind.dal_slot_availability operation) = - let (Single - (Dal_slot_availability {endorser; slot_availability = _; level = _})) - = + let check_dal_attestation_conflict vs oph + (operation : Kind.dal_attestation operation) = + let (Single (Dal_attestation {attestor; attestation = _; level = _})) = operation.protocol_data.contents in match Signature.Public_key_hash.Map.find_opt - endorser - vs.consensus_state.dal_slot_availability_seen + attestor + vs.consensus_state.dal_attestation_seen with | None -> ok_unit | Some existing -> Error (Operation_conflict {existing; new_operation = oph}) - let wrap_dal_slot_availability_conflict = function + let wrap_dal_attestation_conflict = function | Ok () -> ok_unit | Error conflict -> error Validate_errors.Consensus.( - Conflicting_consensus_operation - {kind = Dal_slot_availability; conflict}) + Conflicting_consensus_operation {kind = Dal_attestation; conflict}) - let add_dal_slot_availability vs oph - (operation : Kind.dal_slot_availability operation) = - let (Single - (Dal_slot_availability {endorser; slot_availability = _; level = _})) - = + let add_dal_attestation vs oph (operation : Kind.dal_attestation operation) = + let (Single (Dal_attestation {attestor; attestation = _; level = _})) = operation.protocol_data.contents in { @@ -1104,30 +1095,24 @@ module Consensus = struct consensus_state = { vs.consensus_state with - dal_slot_availability_seen = + dal_attestation_seen = Signature.Public_key_hash.Map.add - endorser + attestor oph - vs.consensus_state.dal_slot_availability_seen; + vs.consensus_state.dal_attestation_seen; }; } - let remove_dal_slot_availability vs - (operation : Kind.dal_slot_availability operation) = - let (Single - (Dal_slot_availability {endorser; slot_availability = _; level = _})) - = + let remove_dal_attestation vs (operation : Kind.dal_attestation operation) = + let (Single (Dal_attestation {attestor; attestation = _; level = _})) = operation.protocol_data.contents in - let dal_slot_availability_seen = + let dal_attestation_seen = Signature.Public_key_hash.Map.remove - endorser - vs.consensus_state.dal_slot_availability_seen + attestor + vs.consensus_state.dal_attestation_seen in - { - vs with - consensus_state = {vs.consensus_state with dal_slot_availability_seen}; - } + {vs with consensus_state = {vs.consensus_state with dal_attestation_seen}} let check_construction_preendorsement_round_consistency vi block_state kind (consensus_content : consensus_content) = @@ -2809,8 +2794,7 @@ let check_operation ?(check_signature = true) info (type kind) Consensus.check_endorsement info ~check_signature operation in return_unit - | Single (Dal_slot_availability _) -> - Consensus.check_dal_slot_availability info operation + | Single (Dal_attestation _) -> Consensus.check_dal_attestation info operation | Single (Proposals _) -> Voting.check_proposals info ~check_signature operation | Single (Ballot _) -> Voting.check_ballot info ~check_signature operation @@ -2866,8 +2850,8 @@ let check_operation_conflict (type kind) operation_conflict_state oph operation_conflict_state oph operation - | Single (Dal_slot_availability _) -> - Consensus.check_dal_slot_availability_conflict + | Single (Dal_attestation _) -> + Consensus.check_dal_attestation_conflict operation_conflict_state oph operation @@ -2938,8 +2922,8 @@ let add_valid_operation operation_conflict_state oph (type kind) oph operation endorsement_kind - | Single (Dal_slot_availability _) -> - Consensus.add_dal_slot_availability operation_conflict_state oph operation + | Single (Dal_attestation _) -> + Consensus.add_dal_attestation operation_conflict_state oph operation | Single (Proposals _) -> Voting.add_proposals operation_conflict_state oph operation | Single (Ballot _) -> @@ -2983,8 +2967,8 @@ let remove_operation operation_conflict_state (type kind) Consensus.remove_preendorsement operation_conflict_state operation | Single (Endorsement _) -> Consensus.remove_endorsement operation_conflict_state operation - | Single (Dal_slot_availability _) -> - Consensus.remove_dal_slot_availability operation_conflict_state operation + | Single (Dal_attestation _) -> + Consensus.remove_dal_attestation operation_conflict_state operation | Single (Proposals _) -> Voting.remove_proposals operation_conflict_state operation | Single (Ballot _) -> Voting.remove_ballot operation_conflict_state operation @@ -3081,15 +3065,15 @@ let validate_operation ?(check_signature = true) block_state oph operation - | Single (Dal_slot_availability _) -> + | Single (Dal_attestation _) -> let open Consensus in - let* () = check_dal_slot_availability info operation in + let* () = check_dal_attestation info operation in let*? () = - check_dal_slot_availability_conflict operation_state oph operation - |> wrap_dal_slot_availability_conflict + check_dal_attestation_conflict operation_state oph operation + |> wrap_dal_attestation_conflict in let operation_state = - add_dal_slot_availability operation_state oph operation + add_dal_attestation operation_state oph operation in return {info; operation_state; block_state} | Single (Proposals _) -> diff --git a/src/proto_alpha/lib_protocol/validate_errors.ml b/src/proto_alpha/lib_protocol/validate_errors.ml index c1f639499412515b7770e70653f46404ede83e08..efea3cb7c2fad3eae565c58bcfa9fa7bc0046db9 100644 --- a/src/proto_alpha/lib_protocol/validate_errors.ml +++ b/src/proto_alpha/lib_protocol/validate_errors.ml @@ -73,7 +73,7 @@ module Consensus = struct | Preendorsement | Endorsement | Grandparent_endorsement - | Dal_slot_availability + | Dal_attestation let consensus_operation_kind_encoding = Data_encoding.string_enum @@ -81,14 +81,14 @@ module Consensus = struct ("Preendorsement", Preendorsement); ("Endorsement", Endorsement); ("Grandparent_endorsement", Grandparent_endorsement); - ("Dal_slot_availability", Dal_slot_availability); + ("Dal_attestation", Dal_attestation); ] let consensus_operation_kind_pp fmt = function | Preendorsement -> Format.fprintf fmt "Preendorsement" | Endorsement -> Format.fprintf fmt "Endorsement" | Grandparent_endorsement -> Format.fprintf fmt "Grandparent endorsement" - | Dal_slot_availability -> Format.fprintf fmt "Dal_slot_availability" + | Dal_attestation -> Format.fprintf fmt "Dal_attestation" (** Errors for preendorsements and endorsements. *) type error += diff --git a/src/proto_alpha/lib_protocol/validate_errors.mli b/src/proto_alpha/lib_protocol/validate_errors.mli index ece107219d11b2fac662538d97d57ccbb12baedc..4fac7b0195dcafbdf734a4f164b6b1a40f4964eb 100644 --- a/src/proto_alpha/lib_protocol/validate_errors.mli +++ b/src/proto_alpha/lib_protocol/validate_errors.mli @@ -38,7 +38,7 @@ module Consensus : sig | Preendorsement | Endorsement | Grandparent_endorsement - | Dal_slot_availability + | Dal_attestation (** Errors for preendorsements and endorsements. *) type error += diff --git a/tezt/lib_tezos/RPC.ml b/tezt/lib_tezos/RPC.ml index ea4ea0857fd843a549a97fe9f95946bf8a558836..2c2c1020b3b257ae7f1e805c4c2952afe6795840 100644 --- a/tezt/lib_tezos/RPC.ml +++ b/tezt/lib_tezos/RPC.ml @@ -231,20 +231,20 @@ type block_metadata = { next_protocol : string; proposer : string; max_operations_ttl : int; - dal_slot_availability : bool Array.t option; + dal_attestation : bool Array.t option; } let get_chain_block_metadata ?(chain = "main") ?(block = "head") () = make GET ["chains"; chain; "blocks"; block; "metadata"] @@ fun json -> - let dal_slot_availability = - match JSON.(json |-> "dal_slot_availability" |> as_string_opt) with + let dal_attestation = + match JSON.(json |-> "dal_attestation" |> as_string_opt) with | None -> None | Some slots -> - let slot_availability = Z.of_string slots in - let length = Z.numbits slot_availability in + let attestation = Z.of_string slots in + let length = Z.numbits attestation in let array = Array.make length false in List.iter - (fun i -> if Z.testbit slot_availability i then array.(i) <- true) + (fun i -> if Z.testbit attestation i then array.(i) <- true) (range 0 (length - 1)) ; Some array in @@ -256,7 +256,7 @@ let get_chain_block_metadata ?(chain = "main") ?(block = "head") () = | Some proposer -> proposer in let max_operations_ttl = JSON.(json |-> "max_operations_ttl" |> as_int) in - {dal_slot_availability; protocol; next_protocol; proposer; max_operations_ttl} + {dal_attestation; protocol; next_protocol; proposer; max_operations_ttl} let get_chain_block_hash ?(chain = "main") ?(block = "head") () = make GET ["chains"; chain; "blocks"; block; "hash"] JSON.as_string diff --git a/tezt/lib_tezos/RPC.mli b/tezt/lib_tezos/RPC.mli index 4b08ca1dbf30d071aeefba50a3b6cfa39f0cf0f3..cf194851ac92f911b895315dcd52993824419e6d 100644 --- a/tezt/lib_tezos/RPC.mli +++ b/tezt/lib_tezos/RPC.mli @@ -261,7 +261,7 @@ type block_metadata = { next_protocol : string; proposer : string; max_operations_ttl : int; - dal_slot_availability : bool Array.t option; + dal_attestation : bool Array.t option; (** This field is [None] if and only if the [DAL] feature flag is disabled. *) } diff --git a/tezt/lib_tezos/operation_core.ml b/tezt/lib_tezos/operation_core.ml index 2ab37fe4622dc7a245d8c1381ec79f0670400751..a64fb716b886d7bcbd80c0bc45f1f9f2bfd2e7ca 100644 --- a/tezt/lib_tezos/operation_core.ml +++ b/tezt/lib_tezos/operation_core.ml @@ -172,25 +172,24 @@ let make_run_operation_input ?chain_id t client = ]) module Consensus = struct - type t = Slot_availability of {endorsement : bool array; level : int} + type t = Dal_attestation of {attestation : bool array; level : int} - let slot_availability ~endorsement ~level = - Slot_availability {endorsement; level} + let dal_attestation ~attestation ~level = Dal_attestation {attestation; level} let json signer = function - | Slot_availability {endorsement; level} -> - let string_of_bool_vector endorsement = + | Dal_attestation {attestation; level} -> + let string_of_bool_vector attestation = let aux (acc, n) b = let bit = if b then 1 else 0 in (acc lor (bit lsl n), n + 1) in - Array.fold_left aux (0, 0) endorsement |> fst |> string_of_int + Array.fold_left aux (0, 0) attestation |> fst |> string_of_int in `O [ - ("kind", Ezjsonm.string "dal_slot_availability"); - ("endorser", Ezjsonm.string signer.Account.public_key_hash); - ("endorsement", Ezjsonm.string (string_of_bool_vector endorsement)); + ("kind", Ezjsonm.string "dal_attestation"); + ("attestor", Ezjsonm.string signer.Account.public_key_hash); + ("attestation", Ezjsonm.string (string_of_bool_vector attestation)); ("level", Ezjsonm.int level); ] diff --git a/tezt/lib_tezos/operation_core.mli b/tezt/lib_tezos/operation_core.mli index 5da321250d6695c9110e2a0ccb0afbbacf2bb589..c3e86d8b6d5657e4a173ad3ac1ddd4c11da86173 100644 --- a/tezt/lib_tezos/operation_core.mli +++ b/tezt/lib_tezos/operation_core.mli @@ -156,12 +156,11 @@ module Consensus : sig (** A representation of a consensus operation. *) type t - (** [slot_availability ~endorsement ~level] crafts a data-availability - consensus to endorse at [level] slot headers published at level - [level - endorsement_lag]. - For each slot, the value of the booleans indicates whether the data is - available. *) - val slot_availability : endorsement:bool array -> level:int -> t + (** [dal_attestation ~attestation ~level] crafts a slot attestation + operation to attest at [level] slot headers published at level + [level - attestation_lag]. For each slot, the value of the + booleans indicates whether the data is deemed available. *) + val dal_attestation : attestation:bool array -> level:int -> t (** [operation] constructs an operation from a consensus operation. the [client] is used to fetch the branch and the diff --git a/tezt/lib_tezos/rollup.ml b/tezt/lib_tezos/rollup.ml index 3436f723dcce172baa4970974054498e105ed8b0..5fa4f8563e7ffb37e9902a0a7f6b7e0a9d711465 100644 --- a/tezt/lib_tezos/rollup.ml +++ b/tezt/lib_tezos/rollup.ml @@ -505,7 +505,7 @@ module Dal = struct type t = { cryptobox : Cryptobox.parameters; number_of_slots : int; - endorsement_lag : int; + attestation_lag : int; } let parameter_file protocol = @@ -522,14 +522,14 @@ module Dal = struct let slot_size = JSON.(json |-> "slot_size" |> as_int) in let page_size = JSON.(json |-> "page_size" |> as_int) in let number_of_slots = JSON.(json |-> "number_of_slots" |> as_int) in - let endorsement_lag = JSON.(json |-> "endorsement_lag" |> as_int) in + let attestation_lag = JSON.(json |-> "attestation_lag" |> as_int) in return { cryptobox = Cryptobox.Verifier. {number_of_shards; redundancy_factor; slot_size; page_size}; number_of_slots; - endorsement_lag; + attestation_lag; } end diff --git a/tezt/lib_tezos/rollup.mli b/tezt/lib_tezos/rollup.mli index c566fda45568dd84bf221b884bc8eb6a153a1cd2..8b4348148ca9b78eb5ff9dbfdd82a5b8a1226bd1 100644 --- a/tezt/lib_tezos/rollup.mli +++ b/tezt/lib_tezos/rollup.mli @@ -221,7 +221,7 @@ module Dal : sig type t = { cryptobox : Cryptobox.parameters; number_of_slots : int; - endorsement_lag : int; + attestation_lag : int; } val parameter_file : Protocol.t -> string Lwt.t diff --git a/tezt/tests/dal.ml b/tezt/tests/dal.ml index 7b42087014adfc1c099c653de04304cced13cb12..ab38a5c29ee4a7360b43bf59767b55db1169a014 100644 --- a/tezt/tests/dal.ml +++ b/tezt/tests/dal.ml @@ -56,12 +56,12 @@ let regression_test ~__FILE__ ?(tags = []) title f = let dal_enable_param dal_enable = make_bool_parameter ["dal_parametric"; "feature_enable"] dal_enable -let setup ?(endorsement_lag = 1) ?commitment_period ?challenge_window +let setup ?(attestation_lag = 1) ?commitment_period ?challenge_window ?dal_enable f ~protocol = let parameters = make_int_parameter - ["dal_parametric"; "endorsement_lag"] - (Some endorsement_lag) + ["dal_parametric"; "attestation_lag"] + (Some attestation_lag) @ make_int_parameter ["sc_rollup_commitment_period_in_blocks"] commitment_period @@ -271,9 +271,7 @@ let test_feature_flag _protocol _sc_rollup_node _sc_rollup_address node client = inject ~force:true ~signer:Constant.bootstrap1 - (slot_availability - ~level - ~endorsement:(Array.make number_of_slots false)) + (dal_attestation ~level ~attestation:(Array.make number_of_slots false)) client) in let* (`OpHash oph2) = @@ -291,8 +289,8 @@ let test_feature_flag _protocol _sc_rollup_node _sc_rollup_address node client = ~error_msg:"Expected mempool: %R. Got: %L. (Order does not matter)") ; let* () = Client.bake_for_and_wait client in let* block_metadata = RPC.(call node @@ get_chain_block_metadata ()) in - if block_metadata.dal_slot_availability <> None then - Test.fail "Did not expect to find \"dal_slot_availibility\"" ; + if block_metadata.dal_attestation <> None then + Test.fail "Did not expect to find \"dal_attestation\"" ; let* bytes = RPC_legacy.raw_bytes client in if not JSON.(bytes |-> "dal" |> is_null) then Test.fail "Unexpected entry dal in the context when DAL is disabled" ; @@ -326,10 +324,10 @@ let publish_slot_header ~source ?(fee = 1200) ~index ~commitment node client = ] client) -let slot_availability ?level ?(force = false) ~signer ~nb_slots availability +let dal_attestation ?level ?(force = false) ~signer ~nb_slots availability client = - let endorsement = Array.make nb_slots false in - List.iter (fun i -> endorsement.(i) <- true) availability ; + let attestation = Array.make nb_slots false in + List.iter (fun i -> attestation.(i) <- true) availability ; let* level = match level with | Some level -> return level @@ -338,7 +336,7 @@ let slot_availability ?level ?(force = false) ~signer ~nb_slots availability return @@ (level + 1) in Operation.Consensus.( - inject ~force ~signer (slot_availability ~level ~endorsement) client) + inject ~force ~signer (dal_attestation ~level ~attestation) client) type status = Applied | Failed of {error_id : string} @@ -511,31 +509,29 @@ let test_slot_management_logic = check_manager_operation_status operations_result Applied oph2 ; let nb_slots = parameters.number_of_slots in let* _ = - slot_availability ~nb_slots ~signer:Constant.bootstrap1 [1; 0] client + dal_attestation ~nb_slots ~signer:Constant.bootstrap1 [1; 0] client in let* _ = - slot_availability ~nb_slots ~signer:Constant.bootstrap2 [1; 0] client + dal_attestation ~nb_slots ~signer:Constant.bootstrap2 [1; 0] client in - let* _ = slot_availability ~nb_slots ~signer:Constant.bootstrap3 [1] client in - let* _ = slot_availability ~nb_slots ~signer:Constant.bootstrap4 [1] client in - let* _ = slot_availability ~nb_slots ~signer:Constant.bootstrap5 [1] client in + let* _ = dal_attestation ~nb_slots ~signer:Constant.bootstrap3 [1] client in + let* _ = dal_attestation ~nb_slots ~signer:Constant.bootstrap4 [1] client in + let* _ = dal_attestation ~nb_slots ~signer:Constant.bootstrap5 [1] client in let* () = Client.bake_for_and_wait client in let* metadata = RPC.call node (RPC.get_chain_block_metadata ()) in - let dal_slot_availability = - match metadata.dal_slot_availability with + let attestation = + match metadata.dal_attestation with | None -> assert false (* Field is part of the encoding when the feature flag is true *) | Some x -> x in Check.( - (dal_slot_availability.(0) = false) + (attestation.(0) = false) bool - ~error_msg:"Expected slot 0 to be unavailable") ; + ~error_msg:"Expected slot 0 to be un-attested") ; Check.( - (dal_slot_availability.(1) = true) - bool - ~error_msg:"Expected slot 1 to be available") ; + (attestation.(1) = true) bool ~error_msg:"Expected slot 1 to be attested") ; check_dal_raw_context node (** This test tests various situations related to DAL slots attestation. It's @@ -548,14 +544,14 @@ let test_slots_attestation_operation_behavior = ~tags:["dal"] ~supports:Protocol.(From_protocol (Protocol.number Alpha)) @@ fun protocol -> - setup ~endorsement_lag:5 ~dal_enable:true ~protocol + setup ~attestation_lag:5 ~dal_enable:true ~protocol @@ fun parameters cryptobox node client _bootstrap -> (* Some helpers *) let nb_slots = parameters.number_of_slots in - let lag = parameters.endorsement_lag in + let lag = parameters.attestation_lag in assert (lag > 1) ; let attest ~level = - slot_availability + dal_attestation ~force:true ~nb_slots ~level @@ -573,14 +569,14 @@ let test_slots_attestation_operation_behavior = in let check_slots_availability ~__LOC__ ~attested = let* metadata = RPC.call node (RPC.get_chain_block_metadata ()) in - let dal_slot_availability = + let dal_attestation = (* Field is part of the encoding when the feature flag is true *) - Option.get metadata.dal_slot_availability + Option.get metadata.dal_attestation in List.iter (fun i -> Check.( - (Array.get dal_slot_availability i = true) + (Array.get dal_attestation i = true) bool ~error_msg: (Format.sprintf @@ -652,7 +648,7 @@ let test_slots_attestation_operation_behavior = Lwt_list.map_s (fun signer -> let* (`OpHash h) = - slot_availability ~force:true ~nb_slots ~level ~signer [10] client + dal_attestation ~force:true ~nb_slots ~level ~signer [10] client in return h) [bootstrap1; bootstrap2; bootstrap3; bootstrap4; bootstrap5] @@ -904,7 +900,7 @@ let rollup_node_stores_dal_slots ?expand_test _protocol dal_node sc_rollup_node 3. (Rollup node is implicitely subscribed to all slots) 4. Publish the three slot headers for slots 0, 1, 2 5. Check that the rollup node fetched the slot headers from L1 - 6. After lag levels, endorse only slots 1 and 2 + 6. After lag levels, attest only slots 1 and 2 7. Check that no slots are downloaded by the rollup node if the PVM does not request them 8. Send external messages to trigger the request of dal pages for @@ -986,23 +982,23 @@ let rollup_node_stores_dal_slots ?expand_test _protocol dal_node sc_rollup_node Check.(commitments = expected_commitments) (Check.list Check.string) ~error_msg:"Unexpected list of slot headers (current = %L, expected = %R)" ; - (* 6. endorse only slots 1 and 2. *) + (* 6. attest only slots 1 and 2. *) let* parameters = Rollup.Dal.Parameters.from_client client in let nb_slots = parameters.number_of_slots in let* _op_hash = - slot_availability ~nb_slots ~signer:Constant.bootstrap1 [2; 1] client + dal_attestation ~nb_slots ~signer:Constant.bootstrap1 [2; 1] client in let* _op_hash = - slot_availability ~nb_slots ~signer:Constant.bootstrap2 [2; 1] client + dal_attestation ~nb_slots ~signer:Constant.bootstrap2 [2; 1] client in let* _op_hash = - slot_availability ~nb_slots ~signer:Constant.bootstrap3 [2; 1] client + dal_attestation ~nb_slots ~signer:Constant.bootstrap3 [2; 1] client in let* _op_hash = - slot_availability ~nb_slots ~signer:Constant.bootstrap4 [2; 1] client + dal_attestation ~nb_slots ~signer:Constant.bootstrap4 [2; 1] client in let* _op_hash = - slot_availability ~nb_slots ~signer:Constant.bootstrap5 [2; 1] client + dal_attestation ~nb_slots ~signer:Constant.bootstrap5 [2; 1] client in let* () = Client.bake_for_and_wait client in let* slot_confirmed_level = @@ -1011,7 +1007,7 @@ let rollup_node_stores_dal_slots ?expand_test _protocol dal_node sc_rollup_node Check.(slot_confirmed_level = slots_published_level + 1) Check.int ~error_msg: - "Current level has moved past slot endorsement level (current = %L, \ + "Current level has moved past slot attestation level (current = %L, \ expected = %R)" ; (* 7. Check that no slots have been downloaded *) let* downloaded_confirmed_slots = @@ -1041,9 +1037,9 @@ let rollup_node_stores_dal_slots ?expand_test _protocol dal_node sc_rollup_node Check.(level = slot_confirmed_level + 1) Check.int ~error_msg: - "Current level has moved past slot endorsement level (current = %L, \ + "Current level has moved past slot attestation level (current = %L, \ expected = %R)" ; - (* 9. Wait for the rollup node to download the endorsed slots. *) + (* 9. Wait for the rollup node to download the attested slots. *) let confirmed_level_as_string = Int.to_string slot_confirmed_level in let* downloaded_confirmed_slots = Sc_rollup_client.dal_downloaded_confirmed_slot_pages diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out index cd6ea32ebb6b580200f8f0e332ca83e701f7b972..5c405ab7162d024f1dda8afc3a4eba280e77f1ed 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out @@ -44,7 +44,7 @@ "tx_rollup_rejection_max_proof_size": 30000, "tx_rollup_sunset_level": 3473409, "dal_parametric": - { "feature_enable": false, "number_of_slots": 16, "endorsement_lag": 1, + { "feature_enable": false, "number_of_slots": 16, "attestation_lag": 1, "availability_threshold": 50, "redundancy_factor": 8, "page_size": 128, "slot_size": 32768, "number_of_shards": 64 }, "sc_rollup_enable": false, "sc_rollup_origination_size": 6314, diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out index bf363859666e08ede30d9c29eaae821b75247099..e2f97d1511fdf80393c1f7af9039a486735f1ba9 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out @@ -44,7 +44,7 @@ "tx_rollup_rejection_max_proof_size": 30000, "tx_rollup_sunset_level": 3473409, "dal_parametric": - { "feature_enable": false, "number_of_slots": 16, "endorsement_lag": 1, + { "feature_enable": false, "number_of_slots": 16, "attestation_lag": 1, "availability_threshold": 50, "redundancy_factor": 8, "page_size": 128, "slot_size": 32768, "number_of_shards": 64 }, "sc_rollup_enable": false, "sc_rollup_origination_size": 6314, diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out index ba23879102de2fbf160a91cdec5abd871b159cf9..1ad768b275598e7b94d92042a1328bb60a87d9fa 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out @@ -44,7 +44,7 @@ "tx_rollup_rejection_max_proof_size": 30000, "tx_rollup_sunset_level": 3473409, "dal_parametric": - { "feature_enable": false, "number_of_slots": 16, "endorsement_lag": 1, + { "feature_enable": false, "number_of_slots": 16, "attestation_lag": 1, "availability_threshold": 50, "redundancy_factor": 8, "page_size": 128, "slot_size": 32768, "number_of_shards": 64 }, "sc_rollup_enable": false, "sc_rollup_origination_size": 6314, diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out index 847199877864af5a94af617001305b4c1224dc0a..7b44810ed634e55e93c836b3703a343f27bb4dc0 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out @@ -44,7 +44,7 @@ "tx_rollup_rejection_max_proof_size": 30000, "tx_rollup_sunset_level": 3473409, "dal_parametric": - { "feature_enable": false, "number_of_slots": 16, "endorsement_lag": 1, + { "feature_enable": false, "number_of_slots": 16, "attestation_lag": 1, "availability_threshold": 50, "redundancy_factor": 8, "page_size": 128, "slot_size": 32768, "number_of_shards": 64 }, "sc_rollup_enable": false, "sc_rollup_origination_size": 6314, diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out index 847199877864af5a94af617001305b4c1224dc0a..7b44810ed634e55e93c836b3703a343f27bb4dc0 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out @@ -44,7 +44,7 @@ "tx_rollup_rejection_max_proof_size": 30000, "tx_rollup_sunset_level": 3473409, "dal_parametric": - { "feature_enable": false, "number_of_slots": 16, "endorsement_lag": 1, + { "feature_enable": false, "number_of_slots": 16, "attestation_lag": 1, "availability_threshold": 50, "redundancy_factor": 8, "page_size": 128, "slot_size": 32768, "number_of_shards": 64 }, "sc_rollup_enable": false, "sc_rollup_origination_size": 6314,