diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/daemon.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/daemon.ml index 4ed068c1ed3cd2dcff49d11b4a9ae96a19bd83be..66e6d02f743206208f9522fa5efa76964a5c68db 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/daemon.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/daemon.ml @@ -78,6 +78,7 @@ module Make (PVM : Pvm.S) = struct in tzfail (Sc_rollup_node_errors.Lost_game (loser, reason, slashed_amount)) | Dal_publish_slot_header slot_header, Dal_publish_slot_header_result _ -> + assert (Node_context.dal_enabled node_ctxt) ; let {Dal.Slot.Header.header = {id = {index; _}; _}; _} = slot_header in let*! () = Store.Dal_slots_headers.add @@ -192,7 +193,10 @@ module Make (PVM : Pvm.S) = struct let open Lwt_result_syntax in let*! () = Daemon_event.head_processing hash level ~finalized:false in let* ctxt = Inbox.process_head node_ctxt head in - let* () = Dal_slots_tracker.process_head node_ctxt head in + let* () = + when_ (Node_context.dal_enabled node_ctxt) @@ fun () -> + Dal_slots_tracker.process_head node_ctxt head + in let*! () = State.set_block_level_and_hash node_ctxt.store head in let* () = process_l1_block_operations ~finalized:false node_ctxt head in (* Avoid storing and publishing commitments if the head is not final. *) diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/node_context.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/node_context.ml index 8d97a3d27ebaca124a00271e3c0cb654c55b8088..3b977dd7c24dc74ab8a779ea3dbf5ce08fdb2c81 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/node_context.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/node_context.ml @@ -113,6 +113,9 @@ let metadata node_ctxt = let origination_level = node_ctxt.genesis_info.Sc_rollup.Commitment.level in Sc_rollup.Metadata.{address; origination_level} +let dal_enabled node_ctxt = + node_ctxt.protocol_constants.parametric.dal.feature_enable + let readonly (node_ctxt : _ t) = { node_ctxt with diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/node_context.mli b/src/proto_016_PtMumbai/bin_sc_rollup_node/node_context.mli index 13dfca4d3c1ddd1a528c4d00c8ba34baa0210bb0..08cf5d4e09ed8368c6c6a6ef03192a1c96e4babb 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/node_context.mli +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/node_context.mli @@ -112,6 +112,9 @@ val checkout_context : stored in [node_ctxt]. *) val metadata : _ t -> Sc_rollup.Metadata.t +(** Returns [true] if the DAL is enabled for the current protocol. *) +val dal_enabled : _ t -> bool + (** [readonly node_ctxt] returns a read only version of the node context [node_ctxt]. *) val readonly : _ t -> ro diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/refutation_game.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/refutation_game.ml index 8e1e87dfd3a99dba6a23ff75e70e6d7b5fdc749d..b3288fe5442804893aeeeef7dfbb33484e77ac68 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/refutation_game.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/refutation_game.ml @@ -179,10 +179,14 @@ module Make (Interpreter : Interpreter.S) : let snapshot_ctxt_index = Context.index snapshot_ctxt in let snapshot = Sc_rollup.Inbox.take_snapshot snapshot_inbox in let* dal_slots_history = - Dal_slots_tracker.slots_history_of_hash node_ctxt snapshot_head + if Node_context.dal_enabled node_ctxt then + Dal_slots_tracker.slots_history_of_hash node_ctxt snapshot_head + else return Dal.Slots_history.genesis in let* dal_slots_history_cache = - Dal_slots_tracker.slots_history_cache_of_hash node_ctxt snapshot_head + if Node_context.dal_enabled node_ctxt then + Dal_slots_tracker.slots_history_cache_of_hash node_ctxt snapshot_head + else return (Dal.Slots_history.History_cache.empty ~capacity:0L) in (* We fetch the value of protocol constants at block snapshot_hash where the game started. *) diff --git a/src/proto_alpha/bin_sc_rollup_node/daemon.ml b/src/proto_alpha/bin_sc_rollup_node/daemon.ml index 42fb42f03144c2c470efd1806bc78f2e9b126854..e6ea1aca6944863bfdfb562f57bfb47afef62c19 100644 --- a/src/proto_alpha/bin_sc_rollup_node/daemon.ml +++ b/src/proto_alpha/bin_sc_rollup_node/daemon.ml @@ -79,6 +79,7 @@ module Make (PVM : Pvm.S) = struct tzfail (Sc_rollup_node_errors.Lost_game (loser, reason, slashed_amount)) | Dal_publish_slot_header _, Dal_publish_slot_header_result {slot_header; _} -> + assert (Node_context.dal_enabled node_ctxt) ; let*! () = Store.Dal_slots_headers.add node_ctxt.store @@ -192,7 +193,10 @@ module Make (PVM : Pvm.S) = struct let open Lwt_result_syntax in let*! () = Daemon_event.head_processing hash level ~finalized:false in let* ctxt = Inbox.process_head node_ctxt head in - let* () = Dal_slots_tracker.process_head node_ctxt head in + let* () = + when_ (Node_context.dal_enabled node_ctxt) @@ fun () -> + Dal_slots_tracker.process_head node_ctxt head + in let*! () = State.set_block_level_and_hash node_ctxt.store head in let* () = process_l1_block_operations ~finalized:false node_ctxt head in (* Avoid storing and publishing commitments if the head is not final. *) diff --git a/src/proto_alpha/bin_sc_rollup_node/node_context.ml b/src/proto_alpha/bin_sc_rollup_node/node_context.ml index 8d97a3d27ebaca124a00271e3c0cb654c55b8088..3b977dd7c24dc74ab8a779ea3dbf5ce08fdb2c81 100644 --- a/src/proto_alpha/bin_sc_rollup_node/node_context.ml +++ b/src/proto_alpha/bin_sc_rollup_node/node_context.ml @@ -113,6 +113,9 @@ let metadata node_ctxt = let origination_level = node_ctxt.genesis_info.Sc_rollup.Commitment.level in Sc_rollup.Metadata.{address; origination_level} +let dal_enabled node_ctxt = + node_ctxt.protocol_constants.parametric.dal.feature_enable + let readonly (node_ctxt : _ t) = { node_ctxt with diff --git a/src/proto_alpha/bin_sc_rollup_node/node_context.mli b/src/proto_alpha/bin_sc_rollup_node/node_context.mli index 13dfca4d3c1ddd1a528c4d00c8ba34baa0210bb0..08cf5d4e09ed8368c6c6a6ef03192a1c96e4babb 100644 --- a/src/proto_alpha/bin_sc_rollup_node/node_context.mli +++ b/src/proto_alpha/bin_sc_rollup_node/node_context.mli @@ -112,6 +112,9 @@ val checkout_context : stored in [node_ctxt]. *) val metadata : _ t -> Sc_rollup.Metadata.t +(** Returns [true] if the DAL is enabled for the current protocol. *) +val dal_enabled : _ t -> bool + (** [readonly node_ctxt] returns a read only version of the node context [node_ctxt]. *) val readonly : _ t -> ro 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 16a596ad89f9ea09e2ab9b9bfebe8507118a2f22..39811449f42282b59c4a21743683617e9cc7adcf 100644 --- a/src/proto_alpha/bin_sc_rollup_node/refutation_game.ml +++ b/src/proto_alpha/bin_sc_rollup_node/refutation_game.ml @@ -179,10 +179,14 @@ module Make (Interpreter : Interpreter.S) : let snapshot_ctxt_index = Context.index snapshot_ctxt in let snapshot = Sc_rollup.Inbox.take_snapshot snapshot_inbox in let* dal_slots_history = - Dal_slots_tracker.slots_history_of_hash node_ctxt snapshot_head + if Node_context.dal_enabled node_ctxt then + Dal_slots_tracker.slots_history_of_hash node_ctxt snapshot_head + else return Dal.Slots_history.genesis in let* dal_slots_history_cache = - Dal_slots_tracker.slots_history_cache_of_hash node_ctxt snapshot_head + if Node_context.dal_enabled node_ctxt then + Dal_slots_tracker.slots_history_cache_of_hash node_ctxt snapshot_head + else return (Dal.Slots_history.History_cache.empty ~capacity:0L) in (* We fetch the value of protocol constants at block snapshot_hash where the game started. *)