From 8291e332efb6ea80aa86a9e4fb22656acd0f219e Mon Sep 17 00:00:00 2001 From: Eugen Zalinescu Date: Fri, 29 Sep 2023 20:44:11 +0200 Subject: [PATCH 1/5] DAL/Node: fix level computation in publish_slot_header --- src/bin_dal_node/slot_manager.ml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bin_dal_node/slot_manager.ml b/src/bin_dal_node/slot_manager.ml index cb570c8d4c3f..40843a68c8c1 100644 --- a/src/bin_dal_node/slot_manager.ml +++ b/src/bin_dal_node/slot_manager.ml @@ -197,9 +197,10 @@ let publish_slot_data ~level_committee (node_store : Store.node_store) gs_worker | Some shard_proofs -> let attestation_level = Int32.( - add - published_level - (of_int proto_parameters.Dal_plugin.attestation_lag)) + pred + @@ add + published_level + (of_int proto_parameters.Dal_plugin.attestation_lag)) in let* committee = level_committee ~level:attestation_level in let attester_of_shard = shards_to_attesters committee in -- GitLab From c64142df90d01c823e9ea140d91765c0e5550ccb Mon Sep 17 00:00:00 2001 From: Eugen Zalinescu Date: Thu, 5 Oct 2023 17:08:27 +0200 Subject: [PATCH 2/5] Tezt/DAL: fix one_committee_per_epoch test --- tezt/tests/dal.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tezt/tests/dal.ml b/tezt/tests/dal.ml index fb3b853b8d56..ff42fcf302d8 100644 --- a/tezt/tests/dal.ml +++ b/tezt/tests/dal.ml @@ -488,9 +488,9 @@ let test_one_committee_per_epoch _protocol parameters _cryptobox node _client ~error_msg: "Unexpected different DAL committees at first level: %L, versus \ current level: %R" ; - unit) + iter (offset + 1)) else if offset = blocks_per_epoch then ( - Check.((first_committee = committee) Dal.Committee.typ) + Check.((first_committee <> committee) Dal.Committee.typ) ~error_msg: "Unexpected equal DAL committees at first levels in subsequent \ epochs: %L and %R" ; -- GitLab From 22ca59eeaf0a7030d1d76efc5c5fd7c5d776937c Mon Sep 17 00:00:00 2001 From: Eugen Zalinescu Date: Thu, 5 Oct 2023 17:09:47 +0200 Subject: [PATCH 3/5] Tezt/DAL: fix committee level computation --- tezt/tests/dal.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tezt/tests/dal.ml b/tezt/tests/dal.ml index ff42fcf302d8..586ba4006244 100644 --- a/tezt/tests/dal.ml +++ b/tezt/tests/dal.ml @@ -3226,7 +3226,8 @@ let generic_gs_messages_exchange protocol parameters _cryptobox node client - the messages (shards) that will be notified to dal_node2 on its topic. *) let* publish_level = next_level node in let attested_level = publish_level + parameters.attestation_lag in - let* committee = Dal.Committee.at_level node ~level:attested_level in + let attestation_level = attested_level - 1 in + let* committee = Dal.Committee.at_level node ~level:attestation_level in let waiter_publish_list = waiters_publish_shards @@ -3422,7 +3423,8 @@ let _test_gs_prune_ihave_and_iwant protocol parameters _cryptobox node client let* publish_level = next_level node in let attested_level = publish_level + parameters.attestation_lag in - let* committee = Dal.Committee.at_level node ~level:attested_level in + let attestation_level = attested_level - 1 in + let* committee = Dal.Committee.at_level node ~level:attestation_level in let Dal.Committee.{attester; first_shard_index; power} = match -- GitLab From 5cf7df372a19d4fbe3f159798592ff883e364aee Mon Sep 17 00:00:00 2001 From: Eugen Zalinescu Date: Tue, 10 Oct 2023 13:14:38 +0200 Subject: [PATCH 4/5] ALpha: remove reference to renaming issue #4672 --- .../lib_protocol/dal_attestation_repr.mli | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/proto_alpha/lib_protocol/dal_attestation_repr.mli b/src/proto_alpha/lib_protocol/dal_attestation_repr.mli index 77c8c12a0df9..fb1eb2ac0d78 100644 --- a/src/proto_alpha/lib_protocol/dal_attestation_repr.mli +++ b/src/proto_alpha/lib_protocol/dal_attestation_repr.mli @@ -53,15 +53,11 @@ type operation = { at which the operation is valid in the mempool. It is the predecessor at the level of the block that contains it. It should be equal to the attested slot's published level plus the DAL attestation lag minus - one. *) - (* TODO: https://gitlab.com/tezos/tezos/-/issues/4672 - consider renaming to [attestation_level]. - Maybe not a great idea, but we could try this: - - attestation level: this level ^, the one inside the op; - - attested level: its successor, the level of the block - - That is, we have: - [attestation_level + 1 = attested_level] - [published_level + attestation_lag = attested_level] *) + one. Whenever there is a need to disambiguate, one should use + "attestation level" for the level inside the operation and "attested + level" for the level of the block. We have: + - [attestation_level + 1 = attested_level] + - [published_level + attestation_lag = attested_level] *) slot : Slot_repr.t; (** Similar to {!Operation_repr.consensus_content.slot}. It is the attester's first consensus slot at [level]. *) -- GitLab From 4883e5eeb184d6fdf73aa64828dd46828f28ff6e Mon Sep 17 00:00:00 2001 From: Eugen Zalinescu Date: Thu, 5 Oct 2023 17:18:54 +0200 Subject: [PATCH 5/5] Alpha/DAL: set blocks_per_epoch to 1 --- .../lib_parameters/default_parameters.ml | 6 +++--- src/proto_alpha/lib_protocol/raw_context.ml | 2 +- ...t) RPC regression tests- misc_protocol.out | 2 +- ...t) RPC regression tests- misc_protocol.out | 2 +- ...y) RPC regression tests- misc_protocol.out | 2 +- ...r) RPC regression tests- misc_protocol.out | 2 +- ...c) RPC regression tests- misc_protocol.out | 2 +- tezt/tests/mockup.ml | 21 ++++++++++++++++++- 8 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/proto_alpha/lib_parameters/default_parameters.ml b/src/proto_alpha/lib_parameters/default_parameters.ml index 182f08df9c57..f8a10e25855a 100644 --- a/src/proto_alpha/lib_parameters/default_parameters.ml +++ b/src/proto_alpha/lib_parameters/default_parameters.ml @@ -92,7 +92,7 @@ let default_dal = number_of_slots = 256; attestation_lag = 4; attestation_threshold = 50; - blocks_per_epoch = 32l; + blocks_per_epoch = 1l; cryptobox_parameters = default_cryptobox_parameters; } @@ -303,7 +303,7 @@ let constants_sandbox = { constants_mainnet.dal with number_of_slots = 16; - blocks_per_epoch = 2l; + blocks_per_epoch = 1l; cryptobox_parameters = derive_cryptobox_parameters ~redundancy_factor:8 @@ -337,7 +337,7 @@ let constants_test = { constants_mainnet.dal with number_of_slots = 8; - blocks_per_epoch = 2l; + blocks_per_epoch = 1l; cryptobox_parameters = derive_cryptobox_parameters ~redundancy_factor:4 diff --git a/src/proto_alpha/lib_protocol/raw_context.ml b/src/proto_alpha/lib_protocol/raw_context.ml index 015a048e1624..9568de2cac61 100644 --- a/src/proto_alpha/lib_protocol/raw_context.ml +++ b/src/proto_alpha/lib_protocol/raw_context.ml @@ -986,7 +986,7 @@ let prepare_first_block ~level ~timestamp _chain_id ctxt = number_of_slots = c.dal.number_of_slots; attestation_lag = 4; attestation_threshold = c.dal.attestation_threshold; - blocks_per_epoch = c.dal.blocks_per_epoch; + blocks_per_epoch = 1l; cryptobox_parameters; } in diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out index 55f3d228cc9a..0409c2248c55 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out @@ -36,7 +36,7 @@ "cache_sampler_state_cycles": 8, "dal_parametric": { "feature_enable": false, "number_of_slots": 16, "attestation_lag": 4, - "attestation_threshold": 50, "blocks_per_epoch": 2, + "attestation_threshold": 50, "blocks_per_epoch": 1, "redundancy_factor": 8, "page_size": 128, "slot_size": 32768, "number_of_shards": 64 }, "smart_rollup_enable": true, "smart_rollup_arith_pvm_enable": false, diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out index 241eebd7e420..fad82d7bd406 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out @@ -36,7 +36,7 @@ "cache_sampler_state_cycles": 8, "dal_parametric": { "feature_enable": false, "number_of_slots": 16, "attestation_lag": 4, - "attestation_threshold": 50, "blocks_per_epoch": 2, + "attestation_threshold": 50, "blocks_per_epoch": 1, "redundancy_factor": 8, "page_size": 128, "slot_size": 32768, "number_of_shards": 64 }, "smart_rollup_enable": true, "smart_rollup_arith_pvm_enable": false, diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out index c6970e2d6483..70c5c737dbdb 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out @@ -36,7 +36,7 @@ "cache_sampler_state_cycles": 8, "dal_parametric": { "feature_enable": false, "number_of_slots": 16, "attestation_lag": 4, - "attestation_threshold": 50, "blocks_per_epoch": 2, + "attestation_threshold": 50, "blocks_per_epoch": 1, "redundancy_factor": 8, "page_size": 128, "slot_size": 32768, "number_of_shards": 64 }, "smart_rollup_enable": true, "smart_rollup_arith_pvm_enable": false, diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out index 917976d71120..06a07f845f1c 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out @@ -36,7 +36,7 @@ "cache_sampler_state_cycles": 8, "dal_parametric": { "feature_enable": false, "number_of_slots": 16, "attestation_lag": 4, - "attestation_threshold": 50, "blocks_per_epoch": 2, + "attestation_threshold": 50, "blocks_per_epoch": 1, "redundancy_factor": 8, "page_size": 128, "slot_size": 32768, "number_of_shards": 64 }, "smart_rollup_enable": true, "smart_rollup_arith_pvm_enable": false, diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out index 917976d71120..06a07f845f1c 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out @@ -36,7 +36,7 @@ "cache_sampler_state_cycles": 8, "dal_parametric": { "feature_enable": false, "number_of_slots": 16, "attestation_lag": 4, - "attestation_threshold": 50, "blocks_per_epoch": 2, + "attestation_threshold": 50, "blocks_per_epoch": 1, "redundancy_factor": 8, "page_size": 128, "slot_size": 32768, "number_of_shards": 64 }, "smart_rollup_enable": true, "smart_rollup_arith_pvm_enable": false, diff --git a/tezt/tests/mockup.ml b/tezt/tests/mockup.ml index abd17246e0a4..bc68834fc404 100644 --- a/tezt/tests/mockup.ml +++ b/tezt/tests/mockup.ml @@ -1162,6 +1162,25 @@ let test_create_mockup_config_show_init_roundtrip protocols = ("consensus_threshold", `Float 0.0); ] in + (* To fulfill the requirement that [blocks_per_epoch] divides + [blocks_per_cycle], we set [blocks_per_cycle] to 1, for simplicity (even + if the default value is also 1). *) + let updated_dal_parametric = + let dal_parametric_constants_succ = + JSON.(parametric_constants_succ |-> "dal_parametric") + in + let constant_blocks_per_epoch = + JSON.annotate ~origin:"constant_blocks_per_epoch" + @@ `O [("blocks_per_epoch", `Float 1.0)] + in + let updated_dal = + JSON.merge_objects + dal_parametric_constants_succ + constant_blocks_per_epoch + in + JSON.annotate ~origin:"updated_dal_parametric" + @@ `O [("dal_parametric", JSON.unannotate updated_dal)] + in (* These are the mockup specific protocol parameters as per [src/proto_alpha/lib_client/mockup.ml] *) let mockup_constants : JSON.t = JSON.annotate ~origin:"mockup_constants" @@ -1175,7 +1194,7 @@ let test_create_mockup_config_show_init_roundtrip protocols = JSON.( merge_objects (merge_objects - parametric_constants_succ + (merge_objects parametric_constants_succ updated_dal_parametric) constant_parametric_constants) mockup_constants) in -- GitLab