From d20da51f757aabef154e4aae355b8ddca380498a Mon Sep 17 00:00:00 2001 From: "iguerNL@Functori" Date: Fri, 25 Oct 2024 11:39:08 +0200 Subject: [PATCH 1/6] DAL/Proto: fix comparison when choosing hash function for cells Migration level should be excluded (otherwise some tezt tests fail) --- src/proto_alpha/lib_protocol/dal_slot_repr.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/proto_alpha/lib_protocol/dal_slot_repr.ml b/src/proto_alpha/lib_protocol/dal_slot_repr.ml index 593b6f3edaf1..5dc970e3f88f 100644 --- a/src/proto_alpha/lib_protocol/dal_slot_repr.ml +++ b/src/proto_alpha/lib_protocol/dal_slot_repr.ml @@ -555,13 +555,13 @@ module History = struct let attested_level = Raw_level_repr.add published_level attestation_lag in - if Raw_level_repr.(attested_level >= migration_level) then - (* If attested_level is at least equal to migration_level, this + if Raw_level_repr.(attested_level > migration_level) then + (* If attested_level is higher than the migration_level, this means that the content has always been hashed using the new encoding. So, we continue doing so. *) to_new_bytes current_slot else - (* if attested_level < migration_level, this means that this + (* if attested_level <= migration_level, this means that this content has already been hashed with the representation of cells' content in the previous protocol. To keep getting the same hash used as a backpointer, we rehash using the same -- GitLab From de7137b14ef03c73a820cd107340cd347b7c30bf Mon Sep 17 00:00:00 2001 From: "iguerNL@Functori" Date: Fri, 25 Oct 2024 17:36:02 +0200 Subject: [PATCH 2/6] DAL/Proto: simplify pp function of skip lists We cannot just call hash function once it's extended to take a `with_migration` parameter (done in next commits) --- src/proto_alpha/lib_protocol/dal_slot_repr.ml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/proto_alpha/lib_protocol/dal_slot_repr.ml b/src/proto_alpha/lib_protocol/dal_slot_repr.ml index 5dc970e3f88f..f74edc474cb2 100644 --- a/src/proto_alpha/lib_protocol/dal_slot_repr.ml +++ b/src/proto_alpha/lib_protocol/dal_slot_repr.ml @@ -704,14 +704,7 @@ module History = struct |> Pointer_hash.hash_bytes let pp_history fmt (history : history) = - let history_hash = hash history in - Format.fprintf - fmt - "@[hash : %a@;%a@]" - Pointer_hash.pp - history_hash - (Skip_list.pp ~pp_content:Content.pp ~pp_ptr:Pointer_hash.pp) - history + Skip_list.pp ~pp_content:Content.pp ~pp_ptr:Pointer_hash.pp fmt history let pp = pp_history -- GitLab From 882d2f4be9b54e4955fc58b9980f34c38ea06f75 Mon Sep 17 00:00:00 2001 From: "iguerNL@Functori" Date: Fri, 25 Oct 2024 17:37:23 +0200 Subject: [PATCH 3/6] DAL/Proto: The internal hash function of cells takes a with_migration param We need this parameter to keep using the old hashing scheme for cells already constructed by the previous protocol --- src/proto_alpha/lib_protocol/dal_slot_repr.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/proto_alpha/lib_protocol/dal_slot_repr.ml b/src/proto_alpha/lib_protocol/dal_slot_repr.ml index f74edc474cb2..683a3dbcbf1b 100644 --- a/src/proto_alpha/lib_protocol/dal_slot_repr.ml +++ b/src/proto_alpha/lib_protocol/dal_slot_repr.ml @@ -696,10 +696,10 @@ module History = struct let equal : t -> t -> bool = equal_history - let hash cell = + let hash ?with_migration cell = let current_slot = Skip_list.content cell in let back_pointers_hashes = Skip_list.back_pointers cell in - Content.to_bytes current_slot + Content.to_bytes ?with_migration current_slot :: List.map Pointer_hash.to_bytes back_pointers_hashes |> Pointer_hash.hash_bytes @@ -1290,6 +1290,8 @@ module History = struct let* proof_repr = deserialize_proof serialized_proof in verify_proof_repr dal_params page_id snapshot proof_repr + let hash = hash ?with_migration:None + module Internal_for_tests = struct type cell_content = Content.t = | Unpublished of Header.id -- GitLab From 352cdfbc422d1c3e4b3b51deb8f88155bd15e277 Mon Sep 17 00:00:00 2001 From: "iguerNL@Functori" Date: Fri, 25 Oct 2024 17:45:49 +0200 Subject: [PATCH 4/6] DAL/Proto: update_skip_list takes a [with_migration] argument This is needed to correctly connect the last cell of the previous protocol with the first cell of the new/current one. In fact, the new protocol hashes the last cells of the previous protocol to put its hash as a backpointer to the first cell of the new protocol. To use the correct (old) hash function in the case, the [with_migration] tells at which level protocolmigration happened --- .../lib_protocol/alpha_context.mli | 2 ++ src/proto_alpha/lib_protocol/dal_slot_repr.ml | 22 +++++++++++++------ .../lib_protocol/dal_slot_repr.mli | 16 +++++++++----- .../lib_protocol/dal_slot_storage.ml | 8 ++++++- 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index d2370934ad69..f8f5c082a67b 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -2928,6 +2928,7 @@ module Dal : sig val update_skip_list_no_cache : t -> + ?with_migration:Raw_level.t * int -> Raw_level.t -> number_of_slots:int -> (Slot.Header.t @@ -2939,6 +2940,7 @@ module Dal : sig val update_skip_list : t -> History_cache.t -> + ?with_migration:Raw_level.t * int -> Raw_level.t -> number_of_slots:int -> (Slot.Header.t diff --git a/src/proto_alpha/lib_protocol/dal_slot_repr.ml b/src/proto_alpha/lib_protocol/dal_slot_repr.ml index 683a3dbcbf1b..5853c8f0dd30 100644 --- a/src/proto_alpha/lib_protocol/dal_slot_repr.ml +++ b/src/proto_alpha/lib_protocol/dal_slot_repr.ml @@ -730,9 +730,9 @@ module History = struct Note that if the given skip list contains the genesis cell, its content is reset with the given content. This ensures the invariant that there are no gaps in the successive cells of the list. *) - let add_cell (t, cache) next_cell_content ~number_of_slots = + let add_cell ?with_migration (t, cache) next_cell_content ~number_of_slots = let open Result_syntax in - let prev_cell_ptr = hash t in + let prev_cell_ptr = hash ?with_migration t in let Header.{published_level; _} = Skip_list.content t |> Content.content_id in @@ -747,7 +747,7 @@ module History = struct next_cell_content ~number_of_slots in - let new_head_hash = hash new_head in + let new_head_hash = hash ?with_migration new_head in let* cache = History_cache.remember new_head_hash new_head cache in return (new_head, cache) @@ -809,8 +809,8 @@ module History = struct insert exactly [number_of_slots] cells in the skip list per level. This will simplify the shape of proofs and help bounding the history cache required for their generation. *) - let update_skip_list (t : t) cache published_level ~number_of_slots - slot_headers_with_statuses = + let update_skip_list (t : t) cache ?with_migration published_level + ~number_of_slots slot_headers_with_statuses = let open Result_syntax in let* () = List.iter_e @@ -827,14 +827,22 @@ module History = struct ~published_level slot_headers_with_statuses in - List.fold_left_e (add_cell ~number_of_slots) (t, cache) slot_headers + List.fold_left_e + (add_cell ?with_migration ~number_of_slots) + (t, cache) + slot_headers let update_skip_list_no_cache = let empty_cache = History_cache.empty ~capacity:0L in - fun t published_level ~number_of_slots slot_headers_with_statuses -> + fun t + ?with_migration + published_level + ~number_of_slots + slot_headers_with_statuses -> let open Result_syntax in let+ cell, (_ : History_cache.t) = update_skip_list + ?with_migration t empty_cache published_level diff --git a/src/proto_alpha/lib_protocol/dal_slot_repr.mli b/src/proto_alpha/lib_protocol/dal_slot_repr.mli index 26fb6ed0acae..6c323e3e04ea 100644 --- a/src/proto_alpha/lib_protocol/dal_slot_repr.mli +++ b/src/proto_alpha/lib_protocol/dal_slot_repr.mli @@ -257,10 +257,10 @@ module History : sig module History_cache : Bounded_history_repr.S with type key = hash and type value = t - (** [update_skip_list hist cache published_level ~number_of_slots - slot_headers_with_statuses] updates the given structure [hist] with the - list of [slot_headers_with_statuses]. The given [cache] is also updated to - add successive values of [cell] to it. + (** [update_skip_list hist cache ?with_migration published_level + ~number_of_slots slot_headers_with_statuses] updates the given structure + [hist] with the list of [slot_headers_with_statuses]. The given [cache] is + also updated to add successive values of [cell] to it. This function checks the following pre-conditions before updating the @@ -272,10 +272,15 @@ module History : sig - [published_level] is the successor the last inserted cell's level. - [slot_headers_with_statuses] is sorted in increasing order w.r.t. slots - indices. *) + indices. + + [with_migration] is used to choose whether to use this protocol's hashing + function or the previous protocol to compute backpointers, based on which + protocol constructed the cell to be hashed the first time. *) val update_skip_list : t -> History_cache.t -> + ?with_migration:Raw_level_repr.t * int -> Raw_level_repr.t -> number_of_slots:int -> (Header.t @@ -288,6 +293,7 @@ module History : sig updated. *) val update_skip_list_no_cache : t -> + ?with_migration:Raw_level_repr.t * int -> Raw_level_repr.t -> number_of_slots:int -> (Header.t diff --git a/src/proto_alpha/lib_protocol/dal_slot_storage.ml b/src/proto_alpha/lib_protocol/dal_slot_storage.ml index ebacce2747c6..781b8090ccab 100644 --- a/src/proto_alpha/lib_protocol/dal_slot_storage.ml +++ b/src/proto_alpha/lib_protocol/dal_slot_storage.ml @@ -65,10 +65,13 @@ let get_slot_headers_history ctxt = | Some slots_history -> slots_history let update_skip_list ctxt ~slot_headers_statuses ~level_attested - ~number_of_slots = + ~number_of_slots ~attestation_lag = let open Lwt_result_syntax in let open Dal_slot_repr.History in let* slots_history = get_slot_headers_history ctxt in + let* proto_migration_level = + Storage.Tenderbake.First_level_of_protocol.get ctxt + in let*? slots_history, cache = (* DAL/FIXME: https://gitlab.com/tezos/tezos/-/issues/7126 @@ -76,7 +79,9 @@ let update_skip_list ctxt ~slot_headers_statuses ~level_attested *) (* We expect to put exactly [number_of_slots] cells in the cache. *) let cache = History_cache.empty ~capacity:(Int64.of_int number_of_slots) in + update_skip_list + ~with_migration:(proto_migration_level, attestation_lag) ~number_of_slots slots_history cache @@ -124,5 +129,6 @@ let finalize_pending_slot_headers ctxt ~number_of_slots = ~slot_headers_statuses ~level_attested ~number_of_slots + ~attestation_lag:dal.attestation_lag in return (ctxt, attestation) -- GitLab From 6ba5ceac8ab71d179a13155f8493142c69c62639 Mon Sep 17 00:00:00 2001 From: "iguerNL@Functori" Date: Fri, 25 Oct 2024 18:21:45 +0200 Subject: [PATCH 5/6] DAL/Proto: handle protocol migration when playing/verifying refutation games --- .../lib_protocol/alpha_context.mli | 2 ++ src/proto_alpha/lib_protocol/dal_slot_repr.ml | 22 ++++++++++++------- .../lib_protocol/dal_slot_repr.mli | 20 ++++++++++++----- .../lib_protocol/sc_rollup_game_repr.ml | 22 +++++++++++-------- .../lib_protocol/sc_rollup_game_repr.mli | 1 + .../lib_protocol/sc_rollup_proof_repr.ml | 16 +++++++++----- .../lib_protocol/sc_rollup_proof_repr.mli | 6 +++++ .../sc_rollup_refutation_storage.ml | 5 +++++ .../refutation_game_helpers.ml | 6 +++++ 9 files changed, 72 insertions(+), 28 deletions(-) diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index f8f5c082a67b..ee5dec25a0bc 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -3897,6 +3897,7 @@ module Sc_rollup : sig val valid : pvm:('state, 'proof, 'output) PVM.implementation -> metadata:Metadata.t -> + ?protocol_activation_level:Raw_level.t -> Inbox.history_proof -> Raw_level.t -> Dal.Slots_history.t -> @@ -4023,6 +4024,7 @@ module Sc_rollup : sig val play : Kind.t -> Dal.parameters -> + protocol_activation_level:Raw_level.t -> dal_activation_level:Raw_level.t option -> dal_attestation_lag:int -> dal_number_of_slots:int -> diff --git a/src/proto_alpha/lib_protocol/dal_slot_repr.ml b/src/proto_alpha/lib_protocol/dal_slot_repr.ml index 5853c8f0dd30..3c4640918a65 100644 --- a/src/proto_alpha/lib_protocol/dal_slot_repr.ml +++ b/src/proto_alpha/lib_protocol/dal_slot_repr.ml @@ -1207,16 +1207,17 @@ module History = struct (* Given a starting cell [snapshot] and a (final) [target], this function checks that the provided [inc_proof] encodes a minimal path from [snapshot] to [target]. *) - let verify_inclusion_proof inc_proof ~src:snapshot ~dest:target = - let assoc = List.map (fun c -> (hash c, c)) inc_proof in + let verify_inclusion_proof ?with_migration inc_proof ~src:snapshot + ~dest:target = + let assoc = List.map (fun c -> (hash ?with_migration c, c)) inc_proof in let path = List.split assoc |> fst in let deref = let open Map.Make (Pointer_hash) in let map = of_seq (List.to_seq assoc) in fun ptr -> find_opt ptr map in - let snapshot_ptr = hash snapshot in - let target_ptr = hash target in + let snapshot_ptr = hash ?with_migration snapshot in + let target_ptr = hash ?with_migration target in error_unless (Skip_list.valid_back_path ~equal_ptr:Pointer_hash.equal @@ -1226,7 +1227,7 @@ module History = struct path) (dal_proof_error "verify_proof_repr: invalid inclusion Dal proof.") - let verify_proof_repr dal_params page_id snapshot proof = + let verify_proof_repr ?with_migration dal_params page_id snapshot proof = let open Result_syntax in let Page.{slot_id = Header.{published_level; index}; page_index = _} = page_id @@ -1272,7 +1273,11 @@ module History = struct (* We check that the given inclusion proof indeed links our L1 snapshot to the target cell. *) let* () = - verify_inclusion_proof inc_proof ~src:snapshot ~dest:target_cell + verify_inclusion_proof + ?with_migration + inc_proof + ~src:snapshot + ~dest:target_cell in match (page_proof_check, cell_content) with | None, (Unpublished _ | Published {is_proto_attested = false; _}) -> @@ -1293,10 +1298,11 @@ module History = struct "verify_proof_repr: the confirmation proof doesn't contain the \ attested slot." - let verify_proof dal_params page_id snapshot serialized_proof = + let verify_proof ?with_migration dal_params page_id snapshot + serialized_proof = let open Result_syntax in let* proof_repr = deserialize_proof serialized_proof in - verify_proof_repr dal_params page_id snapshot proof_repr + verify_proof_repr ?with_migration dal_params page_id snapshot proof_repr let hash = hash ?with_migration:None diff --git a/src/proto_alpha/lib_protocol/dal_slot_repr.mli b/src/proto_alpha/lib_protocol/dal_slot_repr.mli index 6c323e3e04ea..d4b8856cdc03 100644 --- a/src/proto_alpha/lib_protocol/dal_slot_repr.mli +++ b/src/proto_alpha/lib_protocol/dal_slot_repr.mli @@ -274,7 +274,7 @@ module History : sig - [slot_headers_with_statuses] is sorted in increasing order w.r.t. slots indices. - [with_migration] is used to choose whether to use this protocol's hashing + - [with_migration] is used to choose whether to use this protocol's hashing function or the previous protocol to compute backpointers, based on which protocol constructed the cell to be hashed the first time. *) val update_skip_list : @@ -369,18 +369,28 @@ module History : sig t -> (proof * Page.content option) tzresult Lwt.t - (** [verify_proof dal_params page_id snapshot proof] verifies that the given - [proof] is a valid proof to show that either: + (** [verify_proof ?with_migration dal_params page_id snapshot proof] verifies + that the given [proof] is a valid proof to show that either: + - the page identified by [page_id] belongs to a confirmed slot stored in the skip list whose head is [snapshot], or + - there is not confirmed slot in the skip list (whose head is) [snapshot] that could contain the page identified by [page_id]. [dal_parameters] is used when verifying that/if the page is part of the candidate slot (if any). - *) + + [with_migration] is used to choose whether to use this protocol's hashing + function or the previous protocol to compute backpointers, based on which + protocol constructed the cell to be hashed the first time. *) val verify_proof : - parameters -> Page.t -> t -> proof -> Page.content option tzresult + ?with_migration:Raw_level_repr.t * int -> + parameters -> + Page.t -> + t -> + proof -> + Page.content option tzresult type error += Add_element_in_slots_skip_list_violates_ordering 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 ec7054d67ea8..b63ee568dbef 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml @@ -743,9 +743,9 @@ let check_proof_refute_stop_state ~stop_state input input_request proof = (** Returns the validity of the first final move on top of a dissection. *) let validity_final_move ~pvm ~dal_parameters ~dal_activation_level - ~dal_attestation_lag ~dal_number_of_slots ~first_move ~metadata ~proof ~game - ~start_chunk ~stop_chunk ~is_reveal_enabled ~dal_attested_slots_validity_lag - = + ~protocol_activation_level ~dal_attestation_lag ~dal_number_of_slots + ~first_move ~metadata ~proof ~game ~start_chunk ~stop_chunk + ~is_reveal_enabled ~dal_attested_slots_validity_lag = let open Lwt_result_syntax in let*! res = let {inbox_snapshot; inbox_level; dal_snapshot; _} = game in @@ -756,6 +756,7 @@ let validity_final_move ~pvm ~dal_parameters ~dal_activation_level Sc_rollup_proof_repr.valid ~pvm ~metadata + ~protocol_activation_level inbox_snapshot inbox_level dal_snapshot @@ -811,10 +812,11 @@ let validity_final_move ~pvm ~dal_parameters ~dal_activation_level - The proof stop on the state different than the refuted one. - The proof is correctly verified. *) -let validity_first_final_move ~pvm ~dal_parameters ~dal_activation_level - ~dal_attestation_lag ~dal_number_of_slots ~metadata ~proof ~game - ~start_chunk ~stop_chunk = +let validity_first_final_move ~protocol_activation_level ~pvm ~dal_parameters + ~dal_activation_level ~dal_attestation_lag ~dal_number_of_slots ~metadata + ~proof ~game ~start_chunk ~stop_chunk = validity_final_move + ~protocol_activation_level ~pvm ~dal_parameters ~dal_activation_level @@ -899,9 +901,9 @@ let cost_play ~step ~choice = scale10 @@ Gas_limit_repr.atomic_step_cost @@ Michelson_v1_gas_costs.cost_N_IBlake2b overapproximated_hashing_size -let play kind dal_parameters ~dal_activation_level ~dal_attestation_lag - ~dal_number_of_slots ~stakers metadata game ~step ~choice ~is_reveal_enabled - ~dal_attested_slots_validity_lag = +let play kind dal_parameters ~protocol_activation_level ~dal_activation_level + ~dal_attestation_lag ~dal_number_of_slots ~stakers metadata game ~step + ~choice ~is_reveal_enabled ~dal_attested_slots_validity_lag = let open Lwt_result_syntax in let (Packed ((module PVM) as pvm)) = Sc_rollups.Kind.pvm_of kind in let mk_loser loser = @@ -940,6 +942,7 @@ let play kind dal_parameters ~dal_activation_level ~dal_attestation_lag let proof = {proof with pvm_step} in let*! player_result = validity_first_final_move + ~protocol_activation_level ~pvm ~dal_parameters ~dal_activation_level @@ -977,6 +980,7 @@ let play kind dal_parameters ~dal_activation_level ~dal_attestation_lag let proof = {proof with pvm_step} in let*! player_result = validity_second_final_move + ~protocol_activation_level ~pvm ~dal_parameters ~dal_activation_level 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 632a7c44b04b..11ed6e3b9769 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.mli @@ -391,6 +391,7 @@ val status_encoding : status Data_encoding.t val play : Sc_rollups.Kind.t -> Dal_slot_repr.parameters -> + protocol_activation_level:Raw_level_repr.t -> dal_activation_level:Raw_level_repr.t option -> dal_attestation_lag:int -> dal_number_of_slots:int -> 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 562fa70d00ca..1edd697386cc 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.ml @@ -289,9 +289,10 @@ module Dal_helpers = struct ~published_level ~dal_attested_slots_validity_lag - let verify ~metadata ~dal_activation_level ~dal_attestation_lag - ~dal_number_of_slots ~commit_inbox_level dal_parameters page_id - dal_snapshot proof ~dal_attested_slots_validity_lag = + let verify ~protocol_activation_level ~metadata ~dal_activation_level + ~dal_attestation_lag ~dal_number_of_slots ~commit_inbox_level + dal_parameters page_id dal_snapshot proof ~dal_attested_slots_validity_lag + = let open Result_syntax in if page_id_is_valid @@ -306,6 +307,7 @@ module Dal_helpers = struct then let* input = Dal_slot_repr.History.verify_proof + ~with_migration:(protocol_activation_level, dal_attestation_lag) dal_parameters page_id dal_snapshot @@ -345,9 +347,10 @@ end let valid (type state proof output) ~(pvm : (state, proof, output) Sc_rollups.PVM.implementation) ~metadata - snapshot commit_inbox_level dal_snapshot dal_parameters - ~dal_activation_level ~dal_attestation_lag ~dal_number_of_slots - ~is_reveal_enabled ~dal_attested_slots_validity_lag (proof : proof t) = + ?(protocol_activation_level = Raw_level_repr.root) snapshot + commit_inbox_level dal_snapshot dal_parameters ~dal_activation_level + ~dal_attestation_lag ~dal_number_of_slots ~is_reveal_enabled + ~dal_attested_slots_validity_lag (proof : proof t) = let open Lwt_result_syntax in let (module P) = pvm in let origination_level = metadata.Sc_rollup_metadata_repr.origination_level in @@ -375,6 +378,7 @@ let valid (type state proof output) return_some (Sc_rollup_PVM_sig.Reveal (Metadata metadata)) | Some (Reveal_proof (Dal_page_proof {proof; page_id})) -> Dal_helpers.verify + ~protocol_activation_level ~dal_number_of_slots ~metadata ~dal_activation_level 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 968d4d2aebe1..05fed7075f02 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.mli @@ -162,10 +162,16 @@ val stop_of_pvm_step : - The level at which DAL is activated (None if the DAL is not enabled). It also returns the optional input executed during the proof and the input_request for the state at the beginning of the proof. + + [protocol_activation_level] refers to the level at which the current + protocol has been activated. Its default value is [Raw_level_repr.root]. Its + value is typically provided by + {!Storage.Tenderbake.First_level_of_protocol.get}. *) val valid : pvm:('state, 'proof, 'output) Sc_rollups.PVM.implementation -> metadata:Sc_rollup_metadata_repr.t -> + ?protocol_activation_level:Raw_level_repr.t -> Sc_rollup_inbox_repr.history_proof -> Raw_level_repr.t -> Dal_slot_repr.History.t -> 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 ea12778a017a..1ff82c5b6349 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml @@ -461,10 +461,15 @@ let game_move ctxt rollup ~player ~opponent ~step ~choice = | Some game_result -> return (Some game_result, ctxt) | None -> ( let play_cost = Sc_rollup_game_repr.cost_play ~step ~choice in + let* protocol_activation_level = + Storage.Tenderbake.First_level_of_protocol.get ctxt + in let*? ctxt = Raw_context.consume_gas ctxt play_cost in + let* move_result = Sc_rollup_game_repr.play kind + ~protocol_activation_level dal.cryptobox_parameters ~dal_activation_level ~dal_attestation_lag:dal.attestation_lag diff --git a/src/proto_alpha/lib_sc_rollup_node/refutation_game_helpers.ml b/src/proto_alpha/lib_sc_rollup_node/refutation_game_helpers.ml index d7f51e851f0f..3ed84c30fea9 100644 --- a/src/proto_alpha/lib_sc_rollup_node/refutation_game_helpers.ml +++ b/src/proto_alpha/lib_sc_rollup_node/refutation_game_helpers.ml @@ -292,7 +292,13 @@ let generate_proof (node_ctxt : _ Node_context.t) in let unserialized_proof = {proof with pvm_step} in let*! result = + (* ADAL/FIXME: https://gitlab.com/tezos/tezos/-/issues/7579 + + Provide the right [protocol_activation_level] here once the RPC that + reads it from [Storage.Tenderbake.First_level_of_protocol] is + implemented. *) Sc_rollup.Proof.valid + ~protocol_activation_level:Raw_level.root ~metadata snapshot (Raw_level.of_int32_exn game.inbox_level) -- GitLab From f9e0b5f35e822df35d9cffe328b9925ebab91298 Mon Sep 17 00:00:00 2001 From: "iguerNL@Functori" Date: Fri, 25 Oct 2024 19:55:20 +0200 Subject: [PATCH 6/6] DAL/Tezt: re-enable tests about skip list cells chaining --- tezt/tests/dal.ml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tezt/tests/dal.ml b/tezt/tests/dal.ml index 5d3d45b12d98..aaa1f12defbd 100644 --- a/tezt/tests/dal.ml +++ b/tezt/tests/dal.ml @@ -5086,9 +5086,7 @@ module History_rpcs = struct (Dal_node.string_of_skip_list_storage_backend skip_list_storage_backend) in - (* TODO: This test will be re-enabled in MR: - https://gitlab.com/tezos/tezos/-/merge_requests/15448 *) - let tags = ["rpc"; "skip_list"; Tag.memory_3k; Tag.ci_disabled] in + let tags = ["rpc"; "skip_list"; Tag.memory_3k] in let tags = if skip_list_storage_backend = Dal_node.SQLite3 then skip_list_sqlite3_tag :: tags -- GitLab