From 6726dbf11edee1358ad0d8c57d08c21e49a16c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Fri, 13 Sep 2024 12:40:43 +0200 Subject: [PATCH 1/4] Etherlink/Tezt: allow specifying dal slots at test registration This commits adds a dal_slot optional argument to register_test_for_kernels and passes it untouched to register_test. --- etherlink/tezt/lib/setup.ml | 5 +++-- etherlink/tezt/lib/setup.mli | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/etherlink/tezt/lib/setup.ml b/etherlink/tezt/lib/setup.ml index f5b7fe715573..4e34ee83c362 100644 --- a/etherlink/tezt/lib/setup.ml +++ b/etherlink/tezt/lib/setup.ml @@ -432,8 +432,8 @@ let register_test_for_kernels ~__FILE__ ?block_storage_sqlite3 ?minimum_base_fee_per_gas ?preimages_dir ?maximum_allowed_ticks ?maximum_gas_per_transaction ?max_blueprint_lookahead_in_seconds ?enable_fa_bridge ?history_mode ?commitment_period ?challenge_window - ?additional_uses ~threshold_encryption ~enable_dal ~title ~tags body - protocols = + ?additional_uses ~threshold_encryption ~enable_dal ?dal_slots ~title ~tags + body protocols = List.iter (fun kernel -> register_test @@ -467,6 +467,7 @@ let register_test_for_kernels ~__FILE__ ?block_storage_sqlite3 ~threshold_encryption ?history_mode ~enable_dal + ?dal_slots ~title ~tags body diff --git a/etherlink/tezt/lib/setup.mli b/etherlink/tezt/lib/setup.mli index db39f09dd6ba..20c4a440e2ed 100644 --- a/etherlink/tezt/lib/setup.mli +++ b/etherlink/tezt/lib/setup.mli @@ -124,6 +124,7 @@ val register_test_for_kernels : ?additional_uses:Tezt_wrapper.Uses.t list -> threshold_encryption:bool -> enable_dal:bool -> + ?dal_slots:int list option -> title:string -> tags:string list -> (sequencer_setup -> Protocol.t -> unit Lwt.t) -> -- GitLab From e041734d4360f3f1247ca6687dc730c0fb2682a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Fri, 13 Sep 2024 12:43:08 +0200 Subject: [PATCH 2/4] Etherlink+DAL/Tezt: be explicit about dal slots in the first test --- etherlink/tezt/tests/dal_sequencer.ml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/etherlink/tezt/tests/dal_sequencer.ml b/etherlink/tezt/tests/dal_sequencer.ml index dbf2d3495d97..630d74f479be 100644 --- a/etherlink/tezt/tests/dal_sequencer.ml +++ b/etherlink/tezt/tests/dal_sequencer.ml @@ -41,11 +41,13 @@ let count_blueprint_sent_on_inbox sequencer counter = (* This test is similar to {Evm_sequencer.test_publish_blueprints} but it also checks that all 5 blueprints sent from the sequencer were published on the DAL (and none on the inbox). *) -let test_publish_blueprints_on_dal = +let test_publish_blueprints_on_dal ~dal_slot = register_test ~time_between_blocks:Nothing ~tags:["evm"; "sequencer"; "data"] - ~title:"Sequencer publishes the blueprints to the DAL" + ~title: + (sf "Sequencer publishes the blueprints on DAL slot index %d" dal_slot) + ~dal_slots:(Some [dal_slot]) (* We want this test in the CI so we put no extra tags when DAL is active to avoid having the [ci_disabled] or [slow] tag. *) @@ @@ -181,5 +183,5 @@ let test_chunked_blueprints_on_dal = let protocols = Protocol.all let () = - test_publish_blueprints_on_dal protocols ; + test_publish_blueprints_on_dal protocols ~dal_slot:4 ; test_chunked_blueprints_on_dal protocols -- GitLab From 5df4353cb77a6099d616c0d906457acc82c1625c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Wed, 11 Sep 2024 16:16:47 +0200 Subject: [PATCH 3/4] Etherlink+DAL: fix a bug preventing the use of slot index 0 The encode_u8 function which was used to encode slot indices, returned a byte sequence of length 1 containing the byte \000. This is not compatible with the RLP library used in the kernel which expects the number 0 to be encoded by the empty byte sequence. The Rlp.encode_int function behaves as expected so we simply use it instead. --- etherlink/bin_node/lib_dev/encodings/helpers.ml | 5 ----- etherlink/bin_node/lib_dev/sequencer_signal.ml | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/etherlink/bin_node/lib_dev/encodings/helpers.ml b/etherlink/bin_node/lib_dev/encodings/helpers.ml index 93886ddec141..acf8d24593a7 100644 --- a/etherlink/bin_node/lib_dev/encodings/helpers.ml +++ b/etherlink/bin_node/lib_dev/encodings/helpers.ml @@ -12,11 +12,6 @@ let keccak256 (Hex s) = let bytes = Hex.to_bytes_exn (`Hex s) in Tezos_crypto.Hacl.Hash.Keccak_256.digest bytes -let encode_u8 i = - let bytes = Bytes.make 1 '\000' in - Bytes.set_uint8 bytes 0 i ; - bytes - let encode_i32_le i = let bytes = Bytes.make 4 '\000' in Bytes.set_int32_le bytes 0 i ; diff --git a/etherlink/bin_node/lib_dev/sequencer_signal.ml b/etherlink/bin_node/lib_dev/sequencer_signal.ml index 0a7a233807e6..5490a5833b9a 100644 --- a/etherlink/bin_node/lib_dev/sequencer_signal.ml +++ b/etherlink/bin_node/lib_dev/sequencer_signal.ml @@ -52,7 +52,7 @@ let create ~cctxt ~sequencer_key ~smart_rollup_address ~slot_ids = List (compact_levels_slots ~slot_ids |> List.map (fun (published_level, slots) -> - let slots = List.map (fun idx -> Value (encode_u8 idx)) slots in + let slots = List.map (fun idx -> Value (encode_int idx)) slots in List [Value (encode_i32_le published_level); List slots])) in let rlp_unsigned_signal = encoded_levels_to_slots |> encode in -- GitLab From 42ccd22c194c851b3d0399e79f7f1672acf87a89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Fri, 13 Sep 2024 12:44:13 +0200 Subject: [PATCH 4/4] Etherlink+DAL/Tezt: also run the test for slot index 0 Because it is a particular case in the RLP encoding used to send signals to the rollup. --- etherlink/tezt/tests/dal_sequencer.ml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etherlink/tezt/tests/dal_sequencer.ml b/etherlink/tezt/tests/dal_sequencer.ml index 630d74f479be..5e69c40d6032 100644 --- a/etherlink/tezt/tests/dal_sequencer.ml +++ b/etherlink/tezt/tests/dal_sequencer.ml @@ -184,4 +184,7 @@ let protocols = Protocol.all let () = test_publish_blueprints_on_dal protocols ~dal_slot:4 ; + (* Also run the test for slot index 0 because it is a particular + case in the RLP encoding used to send signals to the rollup. *) + test_publish_blueprints_on_dal protocols ~dal_slot:0 ; test_chunked_blueprints_on_dal protocols -- GitLab