From f308797bb88f0b10b358e145ae1975b31058735d Mon Sep 17 00:00:00 2001 From: "iguerNL@Functori" Date: Fri, 15 Nov 2024 10:07:30 +0100 Subject: [PATCH 1/2] Proto/DAL/Sc_rollups: A better interface for Request_adal_page When requesting a page in the `Adjustable DAL` context, it's better for kernels do not depend on the total number of shards because if that values evolve on L1 during a protocol upgrade, and the kernel didn't expect the modification (didn't upgrade or is not aware of the modification), its internal logic might be broken. Exposing a ratio `attestation_threshold_ppm` (attestation threshold parts per million) allows being more generic. --- .../lib_protocol/alpha_context.mli | 3 +- .../lib_protocol/sc_rollup_PVM_sig.ml | 39 +++++++------------ 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index c376cddfe128..c76478dfd98c 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -3268,8 +3268,7 @@ module Sc_rollup : sig | Request_dal_page of Dal.Page.t | Request_adal_page of { page_id : Dal.Page.t; - min_attested_shards : int; - expected_total_shards : int; + attestation_threshold_percent : int; restricted_commitments_publishers : Contract.t list option; } | Reveal_dal_parameters diff --git a/src/proto_alpha/lib_protocol/sc_rollup_PVM_sig.ml b/src/proto_alpha/lib_protocol/sc_rollup_PVM_sig.ml index 2321f852d392..0b79d9f674b3 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_PVM_sig.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_PVM_sig.ml @@ -221,9 +221,8 @@ type reveal = | Request_adal_page of { page_id : Dal_slot_repr.Page.t; (* The id of the DAL page we want to import. *) - min_attested_shards : int; - (* The expected minimal number of attested shards of the slot. *) - expected_total_shards : int; (* The total number of shards of the slot. *) + attestation_threshold_percent : int; + (* The required attestation ratio expressed as percentage . *) restricted_commitments_publishers : Contract_repr.t list option; (* If none, no filtering by commitments publishers is made. *) } @@ -273,11 +272,10 @@ let reveal_encoding = case ~title:"Request_adaptive_dal_page" (Tag 4) - (obj5 + (obj4 (kind "request_adaptive_dal_page") (req "page_id" Dal_slot_repr.Page.encoding) - (req "min_attested_shards" Data_encoding.uint16) - (req "expected_total_shards" Data_encoding.uint16) + (req "attestation_threshold_percent" Data_encoding.uint8) (dft "restricted_commitments_publishers" (option (list ~max_length:10 Contract_repr.encoding)) @@ -286,27 +284,23 @@ let reveal_encoding = | Request_adal_page { page_id; - min_attested_shards; - expected_total_shards; + attestation_threshold_percent; restricted_commitments_publishers; } -> Some ( (), page_id, - min_attested_shards, - expected_total_shards, + attestation_threshold_percent, restricted_commitments_publishers ) | _ -> None) (fun ( (), page_id, - min_attested_shards, - expected_total_shards, + attestation_threshold_percent, restricted_commitments_publishers ) -> Request_adal_page { page_id; - min_attested_shards; - expected_total_shards; + attestation_threshold_percent; restricted_commitments_publishers; }) in @@ -407,18 +401,15 @@ let pp_reveal fmt = function | Request_adal_page { page_id; - min_attested_shards; - expected_total_shards; + attestation_threshold_percent; restricted_commitments_publishers; } -> Format.fprintf fmt - "ADAL:{page:%a; min_attested_shards:%d; expected_total_shards:%d; \ - publishers:%a}" + "ADAL:{page:%a; attestation_threshold_percent:%d; publishers:%a}" Dal_slot_repr.Page.pp page_id - min_attested_shards - expected_total_shards + attestation_threshold_percent (Format.pp_print_option ~none:(fun fmt () -> Format.fprintf fmt "Any") (Format.pp_print_list @@ -455,14 +446,14 @@ let reveal_equal p1 p2 = | ( Request_adal_page { page_id; - min_attested_shards; - expected_total_shards; + attestation_threshold_percent; restricted_commitments_publishers; }, Request_adal_page b ) -> Dal_slot_repr.Page.equal page_id b.page_id - && Compare.Int.equal min_attested_shards b.min_attested_shards - && Compare.Int.equal expected_total_shards b.expected_total_shards + && Compare.Int.equal + attestation_threshold_percent + b.attestation_threshold_percent && Option.equal (List.equal Contract_repr.equal) restricted_commitments_publishers -- GitLab From 00cca2ea179b20cf91c53f7d2e61d58651bd0e7a Mon Sep 17 00:00:00 2001 From: "iguerNL@Functori" Date: Sun, 17 Nov 2024 13:50:35 +0100 Subject: [PATCH 2/2] Fix kaitai file --- .../files/alpha__smart_rollup__reveal.ksy | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/client-libs/kaitai-struct-files/files/alpha__smart_rollup__reveal.ksy b/client-libs/kaitai-struct-files/files/alpha__smart_rollup__reveal.ksy index 7e96ef15559e..c6e49ebe212b 100644 --- a/client-libs/kaitai-struct-files/files/alpha__smart_rollup__reveal.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__smart_rollup__reveal.ksy @@ -59,10 +59,8 @@ types: seq: - id: page_id type: page_id - - id: min_attested_shards - type: u2be - - id: expected_total_shards - type: u2be + - id: attestation_threshold_percent + type: u1 - id: restricted_commitments_publishers type: restricted_commitments_publishers restricted_commitments_publishers: -- GitLab