diff --git a/src/lib_dal_node/block_handler.ml b/src/lib_dal_node/block_handler.ml index e935a5a246669250785cdf8d40bbf3d4ffc0cf31..5774c872ebb4b2a87faeb1a72cf95c53fe150e0b 100644 --- a/src/lib_dal_node/block_handler.ml +++ b/src/lib_dal_node/block_handler.ml @@ -159,18 +159,17 @@ let may_update_topics ctxt proto_parameters ~block_level = (Node_context.get_gs_worker ctxt) committee -let store_skip_list_cells (type block_info) ctxt cctxt dal_constants - (block_info : block_info) block_level - (module Plugin : Dal_plugin.T with type block_info = block_info) = +let store_skip_list_cells ctxt cctxt dal_constants ~attested_level + (module Plugin : Dal_plugin.T) = let open Lwt_result_syntax in let* cells_of_level = let pred_published_level = Int32.sub - block_level + attested_level (Int32.of_int (1 + dal_constants.Types.attestation_lag)) in Plugin.Skip_list.cells_of_level - block_info + ~attested_level cctxt ~dal_constants ~pred_publication_level_dal_constants: @@ -192,7 +191,7 @@ let store_skip_list_cells (type block_info) ctxt cctxt dal_constants cells_of_level in let store = Node_context.get_store ctxt in - Store.Skip_list_cells.insert store ~attested_level:block_level cells_of_level + Store.Skip_list_cells.insert store ~attested_level cells_of_level (* This functions counts, for each slot, the number of shards attested by the bakers. *) let attested_shards_per_slot attestations committee ~number_of_slots is_attested @@ -364,7 +363,10 @@ let process_block_data ctxt cctxt store proto_parameters block_level (module Plugin : Dal_plugin.T) = let open Lwt_result_syntax in let* block_info = - Plugin.block_info cctxt ~block:(`Level block_level) ~metadata:`Never + Plugin.block_info + cctxt + ~block:(`Level block_level) + ~operations_metadata:`Never in let* () = if Node_context.supports_refutations ctxt then @@ -372,9 +374,8 @@ let process_block_data ctxt cctxt store proto_parameters block_level ctxt cctxt proto_parameters - block_info - block_level - (module Plugin : Dal_plugin.T with type block_info = Plugin.block_info) + ~attested_level:block_level + (module Plugin : Dal_plugin.T) else return_unit in let* slot_headers = Plugin.get_published_slot_headers ~block_level cctxt in diff --git a/src/lib_dal_node/block_handler.mli b/src/lib_dal_node/block_handler.mli index ad25fb66fceac6a8df4f8ef1312fdc9aabb8f319..701cfb46eea63e0badd50d9c74aa59b3b41d69d2 100644 --- a/src/lib_dal_node/block_handler.mli +++ b/src/lib_dal_node/block_handler.mli @@ -48,17 +48,16 @@ val new_finalized_head : launch_time:float -> (unit, tztrace) result Lwt.t -(** [store_skip_list_cells ctxt cctxt proto_parameters block_info block_level - plugin] extracts and stores the skip list cells from [block_info] at - [block_level], using the encoding from the corresponding [plugin]. It is - used to support DAL refutation. *) +(** [store_skip_list_cells ctxt cctxt proto_parameters ~attested_level plugin] + extracts and stores the skip list cells from [block_info] at [block_level], + using the encoding from the corresponding [plugin]. It is used to support + DAL refutation. *) val store_skip_list_cells : Node_context.t -> Rpc_context.t -> Tezos_dal_node_services.Types.proto_parameters -> - 'block_info -> - int32 -> - (module Dal_plugin.T with type block_info = 'block_info) -> + attested_level:int32 -> + (module Dal_plugin.T) -> (unit, tztrace) result Lwt.t (** [remove_old_level_stored_data proto_parameters ctxt current_level] diff --git a/src/lib_dal_node/dal_plugin.ml b/src/lib_dal_node/dal_plugin.ml index 5d1f8447c8c775c60fe56fb238d0b5113db84d79..d94db28525748326e6b812b3ec71542266d8a542 100644 --- a/src/lib_dal_node/dal_plugin.ml +++ b/src/lib_dal_node/dal_plugin.ml @@ -47,7 +47,7 @@ module type T = sig val block_info : ?chain:Tezos_shell_services.Block_services.chain -> ?block:Tezos_shell_services.Block_services.block -> - metadata:[`Always | `Never] -> + operations_metadata:[`Always | `Never] -> Tezos_rpc.Context.generic -> block_info tzresult Lwt.t @@ -121,7 +121,7 @@ module type T = sig val cell_hash : cell -> hash val cells_of_level : - block_info -> + attested_level:int32 -> Tezos_rpc.Context.generic -> dal_constants:Tezos_dal_node_services.Types.proto_parameters -> pred_publication_level_dal_constants: diff --git a/src/lib_dal_node/dal_plugin.mli b/src/lib_dal_node/dal_plugin.mli index dcaf9662aa6f10a9593a55235bdff8754e0c3309..ed2d3a4523d5d34ecd03a4fa859cfd5f9f63d898 100644 --- a/src/lib_dal_node/dal_plugin.mli +++ b/src/lib_dal_node/dal_plugin.mli @@ -53,14 +53,15 @@ module type T = sig type tb_slot - (** [block_info ?chain ?block ~metadata ctxt] returns the information of the - [block] in [ctxt] for the given [chain]. Block's metadata are included or - skipped depending on the value of [metadata]. This is a wrapper on top of + (** [block_info ?chain ?block ~operations_metadata ctxt] returns the + information of the [block] in [ctxt] for the given [chain]. Operations' + metadata are included or skipped depending on the value of + [operations_metadata]. This is a wrapper on top of {!Protocol_client_context.Alpha_block_services.info}. *) val block_info : ?chain:Tezos_shell_services.Block_services.chain -> ?block:Tezos_shell_services.Block_services.block -> - metadata:[`Always | `Never] -> + operations_metadata:[`Always | `Never] -> Tezos_rpc.Context.generic -> block_info tzresult Lwt.t @@ -172,7 +173,7 @@ module type T = sig The ordering of the elements in the returned list is not relevant. *) val cells_of_level : - block_info -> + attested_level:int32 -> Tezos_rpc.Context.generic -> dal_constants:Tezos_dal_node_services.Types.proto_parameters -> pred_publication_level_dal_constants: diff --git a/src/lib_dal_node/store_cleanup.ml b/src/lib_dal_node/store_cleanup.ml index a3e3f9b76de52cdb5544b19c38fe6756a24ffee7..2fcd0cc769dfcf3a9a51619c2669cb5dc084f6cb 100644 --- a/src/lib_dal_node/store_cleanup.ml +++ b/src/lib_dal_node/store_cleanup.ml @@ -46,9 +46,6 @@ let clean_up_store_and_catch_up_for_refutation_support ctxt cctxt let*? (module Plugin) = Node_context.get_plugin_for_level ctxt ~level:(Int32.pred level) in - let* block_info = - Plugin.block_info cctxt ~block:(`Level level) ~metadata:`Always - in let*? dal_constants = Node_context.get_proto_parameters ctxt ~level:(`Level level) in @@ -56,9 +53,8 @@ let clean_up_store_and_catch_up_for_refutation_support ctxt cctxt ctxt cctxt dal_constants - block_info - level - (module Plugin : Dal_plugin.T with type block_info = Plugin.block_info) + ~attested_level:level + (module Plugin : Dal_plugin.T) in let store = Node_context.get_store ctxt in let last_processed_level_store = Store.last_processed_level store in diff --git a/src/proto_021_PsQuebec/lib_dal/dal_plugin_registration.ml b/src/proto_021_PsQuebec/lib_dal/dal_plugin_registration.ml index 79de163f2bc99b27ea2dc89c988ce264ae46416e..1722b93976413bd723fb278ff92ca4928868427a 100644 --- a/src/proto_021_PsQuebec/lib_dal/dal_plugin_registration.ml +++ b/src/proto_021_PsQuebec/lib_dal/dal_plugin_registration.ml @@ -96,13 +96,13 @@ module Plugin = struct (* This is supposed to be dead code, but we implement a fallback to be defensive. *) fail [DAL_accusation_not_available] - let block_info ?chain ?block ~metadata ctxt = + let block_info ?chain ?block ~operations_metadata ctxt = let cpctxt = new Protocol_client_context.wrap_rpc_context ctxt in Protocol_client_context.Alpha_block_services.info cpctxt ?chain ?block - ~metadata + ~metadata:operations_metadata () let block_shell_header (block_info : block_info) = block_info.header.shell @@ -275,11 +275,18 @@ module Plugin = struct The ordering of the elements in the returned list is not relevant. *) - let cells_of_level (block_info : block_info) ctxt ~dal_constants + let cells_of_level ~attested_level ctxt ~dal_constants ~pred_publication_level_dal_constants = let open Lwt_result_syntax in - (* 0. Let's call [attested_level] the block's level. *) - let attested_level = block_info.header.shell.level in + (* 0. For Quebec, block_info is still needed to reconstruct the cells + of the skip list. Now that Rio is activated, we don't expect + [cells_of_level] to be actively called. *) + let* block_info = + block_info + ctxt + ~block:(`Level attested_level) + ~operations_metadata:`Never + in let published_level = Int32.sub attested_level diff --git a/src/proto_022_PsRiotum/lib_dal/dal_plugin_registration.ml b/src/proto_022_PsRiotum/lib_dal/dal_plugin_registration.ml index 818d80be104fe9023f0d2b8f93e3ed1b6ddcae8c..5e54ac3c12d0c73ac6b690a5008985d7990fc49c 100644 --- a/src/proto_022_PsRiotum/lib_dal/dal_plugin_registration.ml +++ b/src/proto_022_PsRiotum/lib_dal/dal_plugin_registration.ml @@ -135,13 +135,13 @@ module Plugin = struct let* _op_hash = Shell_services.Injection.operation cctxt ~chain bytes in return_unit - let block_info ?chain ?block ~metadata ctxt = + let block_info ?chain ?block ~operations_metadata ctxt = let cpctxt = new Protocol_client_context.wrap_rpc_context ctxt in Protocol_client_context.Alpha_block_services.info cpctxt ?chain ?block - ~metadata + ~metadata:operations_metadata () let block_shell_header (block_info : block_info) = block_info.header.shell @@ -301,11 +301,10 @@ module Plugin = struct cells of the skip list by calling the appropriate DAL function in the protocol. *) - let cells_of_level (block_info : block_info) ctxt ~dal_constants + let cells_of_level ~attested_level ctxt ~dal_constants ~pred_publication_level_dal_constants:_ = let open Lwt_result_syntax in let cpctxt = new Protocol_client_context.wrap_rpc_context ctxt in - let attested_level = block_info.header.shell.level in let published_level = Int32.sub attested_level diff --git a/src/proto_alpha/lib_dal/dal_plugin_registration.ml b/src/proto_alpha/lib_dal/dal_plugin_registration.ml index f3ad19ecc43b27dbfb052e0dc8e047b8f4ddbfa0..c5c252097b1a412025552d67730d6c47348611cc 100644 --- a/src/proto_alpha/lib_dal/dal_plugin_registration.ml +++ b/src/proto_alpha/lib_dal/dal_plugin_registration.ml @@ -151,13 +151,13 @@ module Plugin = struct let* _op_hash = Shell_services.Injection.operation cctxt ~chain bytes in return_unit - let block_info ?chain ?block ~metadata ctxt = + let block_info ?chain ?block ~operations_metadata ctxt = let cpctxt = new Protocol_client_context.wrap_rpc_context ctxt in Protocol_client_context.Alpha_block_services.info cpctxt ?chain ?block - ~metadata + ~metadata:operations_metadata () let block_shell_header (block_info : block_info) = block_info.header.shell @@ -365,11 +365,10 @@ module Plugin = struct cells of the skip list by calling the appropriate DAL function in the protocol. *) - let cells_of_level (block_info : block_info) ctxt ~dal_constants + let cells_of_level ~attested_level ctxt ~dal_constants ~pred_publication_level_dal_constants:_ = let open Lwt_result_syntax in let cpctxt = new Protocol_client_context.wrap_rpc_context ctxt in - let attested_level = block_info.header.shell.level in let published_level = Int32.sub attested_level