From 76e51e6dc24c5f297939ef6a91a5f01ce25deb5f Mon Sep 17 00:00:00 2001 From: Eugen Zalinescu Date: Tue, 16 Jan 2024 10:14:53 +0100 Subject: [PATCH 1/4] Alpha/DAL: add activation flag for incentives --- src/lib_dal_node/dal_plugin.ml | 1 + src/lib_dal_node/dal_plugin.mli | 1 + src/proto_017_PtNairob/lib_dal/dal_plugin_registration.ml | 1 + src/proto_018_Proxford/lib_dal/dal_plugin_registration.ml | 1 + src/proto_alpha/lib_dal/dal_plugin_registration.ml | 2 ++ src/proto_alpha/lib_parameters/default_parameters.ml | 1 + src/proto_alpha/lib_protocol/alpha_context.mli | 1 + src/proto_alpha/lib_protocol/constants_parametric_repr.ml | 8 +++++++- .../lib_protocol/constants_parametric_repr.mli | 1 + src/proto_alpha/lib_protocol/raw_context.ml | 1 + 10 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/lib_dal_node/dal_plugin.ml b/src/lib_dal_node/dal_plugin.ml index 70bec7eefdb1..1ab059ffb79c 100644 --- a/src/lib_dal_node/dal_plugin.ml +++ b/src/lib_dal_node/dal_plugin.ml @@ -35,6 +35,7 @@ type slot_header = { type proto_parameters = { feature_enable : bool; + incentives_enable : bool; number_of_slots : int; attestation_lag : int; attestation_threshold : int; diff --git a/src/lib_dal_node/dal_plugin.mli b/src/lib_dal_node/dal_plugin.mli index c5546ffe97e1..6d829a1855ff 100644 --- a/src/lib_dal_node/dal_plugin.mli +++ b/src/lib_dal_node/dal_plugin.mli @@ -44,6 +44,7 @@ type slot_header = { type proto_parameters = { feature_enable : bool; + incentives_enable : bool; number_of_slots : int; attestation_lag : int; attestation_threshold : int; diff --git a/src/proto_017_PtNairob/lib_dal/dal_plugin_registration.ml b/src/proto_017_PtNairob/lib_dal/dal_plugin_registration.ml index 438fbba5658c..21dea0d9d84e 100644 --- a/src/proto_017_PtNairob/lib_dal/dal_plugin_registration.ml +++ b/src/proto_017_PtNairob/lib_dal/dal_plugin_registration.ml @@ -51,6 +51,7 @@ module Plugin = struct return { Dal_plugin.feature_enable; + incentives_enable = false; number_of_slots; attestation_lag; attestation_threshold; diff --git a/src/proto_018_Proxford/lib_dal/dal_plugin_registration.ml b/src/proto_018_Proxford/lib_dal/dal_plugin_registration.ml index 12e8c8687245..37dbff2cf5c7 100644 --- a/src/proto_018_Proxford/lib_dal/dal_plugin_registration.ml +++ b/src/proto_018_Proxford/lib_dal/dal_plugin_registration.ml @@ -51,6 +51,7 @@ module Plugin = struct return { Dal_plugin.feature_enable; + incentives_enable = false; number_of_slots; attestation_lag; attestation_threshold; diff --git a/src/proto_alpha/lib_dal/dal_plugin_registration.ml b/src/proto_alpha/lib_dal/dal_plugin_registration.ml index 12e8c8687245..c49299b0b457 100644 --- a/src/proto_alpha/lib_dal/dal_plugin_registration.ml +++ b/src/proto_alpha/lib_dal/dal_plugin_registration.ml @@ -40,6 +40,7 @@ module Plugin = struct let* parametric = parametric_constants chain block ctxt in let { Constants.Parametric.feature_enable; + incentives_enable; number_of_slots; attestation_lag; attestation_threshold; @@ -51,6 +52,7 @@ module Plugin = struct return { Dal_plugin.feature_enable; + incentives_enable; number_of_slots; attestation_lag; attestation_threshold; diff --git a/src/proto_alpha/lib_parameters/default_parameters.ml b/src/proto_alpha/lib_parameters/default_parameters.ml index 8391e4d69b5e..9c9ef545f9cb 100644 --- a/src/proto_alpha/lib_parameters/default_parameters.ml +++ b/src/proto_alpha/lib_parameters/default_parameters.ml @@ -140,6 +140,7 @@ let default_dal = Constants.Parametric. { feature_enable = false; + incentives_enable = false; number_of_slots = 256; attestation_lag = 4; attestation_threshold = 50; diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 4d4672b7d252..9345ee7cc1b3 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -810,6 +810,7 @@ module Constants : sig module Parametric : sig type dal = { feature_enable : bool; + incentives_enable : bool; number_of_slots : int; attestation_lag : int; attestation_threshold : int; diff --git a/src/proto_alpha/lib_protocol/constants_parametric_repr.ml b/src/proto_alpha/lib_protocol/constants_parametric_repr.ml index 87b83b6a73d5..c6e5a5ab9345 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_repr.ml +++ b/src/proto_alpha/lib_protocol/constants_parametric_repr.ml @@ -27,6 +27,7 @@ type dal = { feature_enable : bool; + incentives_enable : bool; number_of_slots : int; attestation_lag : int; attestation_threshold : int; @@ -39,6 +40,7 @@ let dal_encoding = conv (fun { feature_enable; + incentives_enable; number_of_slots; attestation_lag; attestation_threshold; @@ -46,12 +48,14 @@ let dal_encoding = blocks_per_epoch; } -> ( ( feature_enable, + incentives_enable, number_of_slots, attestation_lag, attestation_threshold, blocks_per_epoch ), cryptobox_parameters )) (fun ( ( feature_enable, + incentives_enable, number_of_slots, attestation_lag, attestation_threshold, @@ -59,6 +63,7 @@ let dal_encoding = cryptobox_parameters ) -> { feature_enable; + incentives_enable; number_of_slots; attestation_lag; attestation_threshold; @@ -66,8 +71,9 @@ let dal_encoding = cryptobox_parameters; }) (merge_objs - (obj5 + (obj6 (req "feature_enable" bool) + (req "incentives_enable" bool) (req "number_of_slots" int16) (req "attestation_lag" int16) (req "attestation_threshold" int16) diff --git a/src/proto_alpha/lib_protocol/constants_parametric_repr.mli b/src/proto_alpha/lib_protocol/constants_parametric_repr.mli index bddbfa855d83..4533c37e2fe3 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_repr.mli +++ b/src/proto_alpha/lib_protocol/constants_parametric_repr.mli @@ -27,6 +27,7 @@ type dal = { feature_enable : bool; + incentives_enable : bool; number_of_slots : int; attestation_lag : int; attestation_threshold : int; diff --git a/src/proto_alpha/lib_protocol/raw_context.ml b/src/proto_alpha/lib_protocol/raw_context.ml index fc3395c759a1..58fd927a9289 100644 --- a/src/proto_alpha/lib_protocol/raw_context.ml +++ b/src/proto_alpha/lib_protocol/raw_context.ml @@ -1038,6 +1038,7 @@ let prepare_first_block ~level ~timestamp _chain_id ctxt = Constants_parametric_repr. { feature_enable = c.dal.feature_enable; + incentives_enable = false; number_of_slots = c.dal.number_of_slots; attestation_lag = c.dal.attestation_lag; attestation_threshold = c.dal.attestation_threshold; -- GitLab From 50dcede2e4c1fc960fd4178c8bcd24e32f286f8f Mon Sep 17 00:00:00 2001 From: Eugen Zalinescu Date: Tue, 16 Jan 2024 10:15:25 +0100 Subject: [PATCH 2/4] Tezt/DAL: add activation flag for incentives --- tezt/lib_tezos/dal_common.ml | 6 ++++++ tezt/lib_tezos/dal_common.mli | 1 + 2 files changed, 7 insertions(+) diff --git a/tezt/lib_tezos/dal_common.ml b/tezt/lib_tezos/dal_common.ml index 082b53818230..9dbe9ee46886 100644 --- a/tezt/lib_tezos/dal_common.ml +++ b/tezt/lib_tezos/dal_common.ml @@ -29,6 +29,7 @@ module Cryptobox = Tezos_crypto_dal.Cryptobox module Parameters = struct type t = { feature_enabled : bool; + incentives_enabled : bool; cryptobox : Cryptobox.parameters; number_of_slots : int; attestation_lag : int; @@ -53,8 +54,13 @@ module Parameters = struct in let blocks_per_epoch = JSON.(json |-> "blocks_per_epoch" |> as_int) in let feature_enabled = JSON.(json |-> "feature_enable" |> as_bool) in + let incentives_enabled = + JSON.(json |-> "incentives_enable" |> as_bool_opt) + |> Option.value ~default:false + in { feature_enabled; + incentives_enabled; cryptobox = Cryptobox.Verifier. {number_of_shards; redundancy_factor; slot_size; page_size}; diff --git a/tezt/lib_tezos/dal_common.mli b/tezt/lib_tezos/dal_common.mli index e5e5016171f2..165a48b85265 100644 --- a/tezt/lib_tezos/dal_common.mli +++ b/tezt/lib_tezos/dal_common.mli @@ -29,6 +29,7 @@ module Cryptobox = Tezos_crypto_dal.Cryptobox module Parameters : sig type t = { feature_enabled : bool; + incentives_enabled : bool; cryptobox : Cryptobox.parameters; number_of_slots : int; attestation_lag : int; -- GitLab From f14544d861406ce2f2c66fcde517839a2dc04cb9 Mon Sep 17 00:00:00 2001 From: Eugen Zalinescu Date: Thu, 18 Jan 2024 15:28:11 +0100 Subject: [PATCH 3/4] Kaitai: update struct files --- contrib/kaitai-struct-files/files/alpha__constants.ksy | 3 +++ .../kaitai-struct-files/files/alpha__constants__parametric.ksy | 3 +++ contrib/kaitai-struct-files/files/alpha__parameters.ksy | 3 +++ 3 files changed, 9 insertions(+) diff --git a/contrib/kaitai-struct-files/files/alpha__constants.ksy b/contrib/kaitai-struct-files/files/alpha__constants.ksy index 2c9b1e99d619..75cfeb9ea02b 100644 --- a/contrib/kaitai-struct-files/files/alpha__constants.ksy +++ b/contrib/kaitai-struct-files/files/alpha__constants.ksy @@ -32,6 +32,9 @@ types: - id: feature_enable type: u1 enum: bool + - id: incentives_enable + type: u1 + enum: bool - id: number_of_slots type: s2 - id: attestation_lag diff --git a/contrib/kaitai-struct-files/files/alpha__constants__parametric.ksy b/contrib/kaitai-struct-files/files/alpha__constants__parametric.ksy index abe90ad71d20..7a9cdc7f284f 100644 --- a/contrib/kaitai-struct-files/files/alpha__constants__parametric.ksy +++ b/contrib/kaitai-struct-files/files/alpha__constants__parametric.ksy @@ -32,6 +32,9 @@ types: - id: feature_enable type: u1 enum: bool + - id: incentives_enable + type: u1 + enum: bool - id: number_of_slots type: s2 - id: attestation_lag diff --git a/contrib/kaitai-struct-files/files/alpha__parameters.ksy b/contrib/kaitai-struct-files/files/alpha__parameters.ksy index bdc59b805a74..0bc137163152 100644 --- a/contrib/kaitai-struct-files/files/alpha__parameters.ksy +++ b/contrib/kaitai-struct-files/files/alpha__parameters.ksy @@ -166,6 +166,9 @@ types: - id: feature_enable type: u1 enum: bool + - id: incentives_enable + type: u1 + enum: bool - id: number_of_slots type: s2 - id: attestation_lag -- GitLab From 907302293f286518822565b3ad1b5a02dce5de7f Mon Sep 17 00:00:00 2001 From: Eugen Zalinescu Date: Thu, 18 Jan 2024 17:06:07 +0100 Subject: [PATCH 4/4] Tezt: reset regressions for misc_protocol tests --- ...lpha- (mode client) RPC regression tests- misc_protocol.out | 3 ++- ...Alpha- (mode light) RPC regression tests- misc_protocol.out | 3 ++- ...Alpha- (mode proxy) RPC regression tests- misc_protocol.out | 3 ++- ...xy_server_data_dir) RPC regression tests- misc_protocol.out | 3 ++- ...e proxy_server_rpc) RPC regression tests- misc_protocol.out | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) 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 a20f0c53dcd6..d55ecea3bf29 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 @@ -37,7 +37,8 @@ "cache_script_size": 100000000, "cache_stake_distribution_cycles": 8, "cache_sampler_state_cycles": 8, "dal_parametric": - { "feature_enable": false, "number_of_slots": 16, "attestation_lag": 4, + { "feature_enable": false, "incentives_enable": false, + "number_of_slots": 16, "attestation_lag": 4, "attestation_threshold": 50, "blocks_per_epoch": 1, "redundancy_factor": 8, "page_size": 128, "slot_size": 32768, "number_of_shards": 64 }, "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 0951e336ff0d..08e4088fc650 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 @@ -37,7 +37,8 @@ "cache_script_size": 100000000, "cache_stake_distribution_cycles": 8, "cache_sampler_state_cycles": 8, "dal_parametric": - { "feature_enable": false, "number_of_slots": 16, "attestation_lag": 4, + { "feature_enable": false, "incentives_enable": false, + "number_of_slots": 16, "attestation_lag": 4, "attestation_threshold": 50, "blocks_per_epoch": 1, "redundancy_factor": 8, "page_size": 128, "slot_size": 32768, "number_of_shards": 64 }, "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 793d37798206..2d256be68aa0 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 @@ -37,7 +37,8 @@ "cache_script_size": 100000000, "cache_stake_distribution_cycles": 8, "cache_sampler_state_cycles": 8, "dal_parametric": - { "feature_enable": false, "number_of_slots": 16, "attestation_lag": 4, + { "feature_enable": false, "incentives_enable": false, + "number_of_slots": 16, "attestation_lag": 4, "attestation_threshold": 50, "blocks_per_epoch": 1, "redundancy_factor": 8, "page_size": 128, "slot_size": 32768, "number_of_shards": 64 }, "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 4c760b0af97f..da9e47d1ee68 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 @@ -37,7 +37,8 @@ "cache_script_size": 100000000, "cache_stake_distribution_cycles": 8, "cache_sampler_state_cycles": 8, "dal_parametric": - { "feature_enable": false, "number_of_slots": 16, "attestation_lag": 4, + { "feature_enable": false, "incentives_enable": false, + "number_of_slots": 16, "attestation_lag": 4, "attestation_threshold": 50, "blocks_per_epoch": 1, "redundancy_factor": 8, "page_size": 128, "slot_size": 32768, "number_of_shards": 64 }, "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 4c760b0af97f..da9e47d1ee68 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 @@ -37,7 +37,8 @@ "cache_script_size": 100000000, "cache_stake_distribution_cycles": 8, "cache_sampler_state_cycles": 8, "dal_parametric": - { "feature_enable": false, "number_of_slots": 16, "attestation_lag": 4, + { "feature_enable": false, "incentives_enable": false, + "number_of_slots": 16, "attestation_lag": 4, "attestation_threshold": 50, "blocks_per_epoch": 1, "redundancy_factor": 8, "page_size": 128, "slot_size": 32768, "number_of_shards": 64 }, "smart_rollup_arith_pvm_enable": false, -- GitLab