From 4b5bfe9e406c6495347fc18b668b3f4475a54358 Mon Sep 17 00:00:00 2001 From: "iguerNL@Functori" Date: Thu, 20 Jun 2024 12:48:22 +0200 Subject: [PATCH 1/4] Dal: be able to redefine 'attestation_threshold' when using all nodes --- tezt/tests/dal.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tezt/tests/dal.ml b/tezt/tests/dal.ml index 1d9d52734532..9aac849f3b4f 100644 --- a/tezt/tests/dal.ml +++ b/tezt/tests/dal.ml @@ -436,8 +436,8 @@ let scenario_with_all_nodes ?custom_constants ?node_arguments ?(pvm_name = "arith") ?(dal_enable = true) ?commitment_period ?challenge_window ?minimal_block_delay ?delay_increment_per_round ?activation_timestamp ?bootstrap_profile ?producer_profiles - ?smart_rollup_timeout_period_in_blocks ?(regression = true) ?prover variant - scenario = + ?smart_rollup_timeout_period_in_blocks ?(regression = true) ?prover + ?attestation_threshold variant scenario = let description = "Testing DAL rollup and node with L1" in let tags = if List.mem team tags then tags else team :: tags in let tags = @@ -469,6 +469,7 @@ let scenario_with_all_nodes ?custom_constants ?node_arguments ?activation_timestamp ?smart_rollup_timeout_period_in_blocks ?prover + ?attestation_threshold ~protocol ~dal_enable @@ fun parameters _cryptobox node client -> -- GitLab From 1a2408e41effa94a717bdde4fb7632b9f4b221fd Mon Sep 17 00:00:00 2001 From: "iguerNL@Functori" Date: Thu, 13 Jun 2024 11:07:49 +0200 Subject: [PATCH 2/4] Tezt/Dal: replace an assert false with a Test.fail --- tezt/tests/dal.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tezt/tests/dal.ml b/tezt/tests/dal.ml index 9aac849f3b4f..834a46d76548 100644 --- a/tezt/tests/dal.ml +++ b/tezt/tests/dal.ml @@ -939,8 +939,10 @@ let test_slot_management_logic protocol parameters cryptobox node client let attestation = match metadata.dal_attestation with | None -> - assert false (* Field is part of the encoding when the feature flag is true *) + Test.fail + "Field dal_attestation in block headers is mandatory when DAL is \ + activated" | Some x -> x in Check.( -- GitLab From 09751b2b06b70633e0cd05bc23bdb8f214285d81 Mon Sep 17 00:00:00 2001 From: "iguerNL@Functori" Date: Tue, 11 Jun 2024 06:45:03 +0200 Subject: [PATCH 3/4] Tezt/lib_tezos: bind post_local_batcher_dal_injection in sc_rollup_rpc --- tezt/lib_tezos/sc_rollup_rpc.ml | 13 +++++++++++++ tezt/lib_tezos/sc_rollup_rpc.mli | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/tezt/lib_tezos/sc_rollup_rpc.ml b/tezt/lib_tezos/sc_rollup_rpc.ml index 209c54e8287b..ea0cabc695c6 100644 --- a/tezt/lib_tezos/sc_rollup_rpc.ml +++ b/tezt/lib_tezos/sc_rollup_rpc.ml @@ -243,6 +243,19 @@ let post_local_batcher_injection ?drop_duplicate ~messages () = ~data JSON.(fun json -> as_list json |> List.map as_string) +let post_local_dal_injection ~slot_content ~slot_index = + let data = + `O + [ + ("slot_content", `String slot_content); + ("slot_index", `Float (float_of_int slot_index)); + ] + in + make POST ["local"; "dal"; "injection"] ~data:(Data data) (fun json -> + match JSON.as_object json with + | [] -> () + | _ -> JSON.error json "Not an empty object") + type outbox_proof = {commitment_hash : string; proof : string} let outbox_proof_simple ?(block = "head") ~outbox_level ~message_index () = diff --git a/tezt/lib_tezos/sc_rollup_rpc.mli b/tezt/lib_tezos/sc_rollup_rpc.mli index cd7be0cc5290..f10d34e3431b 100644 --- a/tezt/lib_tezos/sc_rollup_rpc.mli +++ b/tezt/lib_tezos/sc_rollup_rpc.mli @@ -168,6 +168,11 @@ val get_global_block_durable_state_value : val post_local_batcher_injection : ?drop_duplicate:bool -> messages:string list -> unit -> string list RPC_core.t +(** RPC: [POST local/dal/injection] injects the given DAL [slot_content] at + [slot_index] in the rollup node's DAL queue. *) +val post_local_dal_injection : + slot_content:string -> slot_index:int -> unit RPC_core.t + type outbox_proof = {commitment_hash : string; proof : string} (** RPC: [GET global/block//helpers/proofs/outbox//messages] *) -- GitLab From f6bebb8f81b96c0358e2e916711d956b97312ae4 Mon Sep 17 00:00:00 2001 From: "iguerNL@Functori" Date: Mon, 10 Jun 2024 08:38:46 +0200 Subject: [PATCH 4/4] Tezt/Dal: injection of a DAL slot via a smart rollup --- tezt/tests/dal.ml | 64 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/tezt/tests/dal.ml b/tezt/tests/dal.ml index 834a46d76548..98807ec8b656 100644 --- a/tezt/tests/dal.ml +++ b/tezt/tests/dal.ml @@ -7145,6 +7145,57 @@ module Refutations = struct ~msg:(rex "lost the refutation game") end +(** This test injects a DAL slot to (DAL and L1) network(s) via the rollup node + using {!post_local_dal_injection} rollup RPC. It then checks that the slot + is attested, which implies that the commitment is published to L1 and that + the shards of the slot are declared available by the DAL node. *) +let rollup_node_injects_dal_slots _protocol parameters dal_node sc_node + sc_rollup_address node client _pvm_name = + let* () = Sc_rollup_node.run sc_node sc_rollup_address [] in + let dal_node_endpoint = Helpers.endpoint dal_node in + let* () = + Sc_rollup_node.RPC.call sc_node + @@ Sc_rollup_rpc.post_local_dal_injection + ~slot_content:"Hello DAL from a Smart Rollup" + ~slot_index:0 + in + (* We need to bake once to get the commitment injected and once more to have it + included in a block. *) + let* () = + repeat 2 (fun () -> + let* () = bake_for ~dal_node_endpoint client in + let* level = Client.level client in + let* _level = + Sc_rollup_node.wait_for_level ~timeout:10. sc_node level + in + unit) + in + let* () = + repeat parameters.Dal.Parameters.attestation_lag (fun () -> + let* () = bake_for ~dal_node_endpoint client in + let* level = Client.level client in + let* _level = + Sc_rollup_node.wait_for_level ~timeout:10. sc_node level + in + unit) + in + let* metadata = Node.RPC.(call node @@ get_chain_block_metadata ()) in + let expected_dal_attestation = [|true|] in + let obtained_dal_attestation = + match metadata.dal_attestation with + | None -> + (* Field is part of the encoding when the feature flag is true *) + Test.fail + "Field dal_attestation in block headers is mandatory when DAL is \ + activated" + | Some x -> x + in + Check.( + (expected_dal_attestation = obtained_dal_attestation) + (array bool) + ~error_msg:"Expected attestation bitset %L, got %R") ; + unit + let register ~protocols = (* Tests with Layer1 node only *) scenario_with_layer1_node @@ -7463,6 +7514,19 @@ let register ~protocols = ~tags:[Tag.slow] protocols ; + scenario_with_all_nodes + "Rollup injects DAL slots" + ~regression:false + ~pvm_name:"wasm_2_0_0" + ~commitment_period:5 + rollup_node_injects_dal_slots + ~producer_profiles:[0] + (* It it sufficient for a single baker here to receive some shards here to + declare the slot available. Otherwise the test might be flaky as we + bake with a timestamp in the past. *) + ~attestation_threshold:1 + protocols ; + (* Register end-to-end tests *) register_end_to_end_tests ~protocols ; dal_crypto_benchmark () -- GitLab