From 44e8c940b009525a4fde13f34413ed4f069d95a4 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Wed, 16 Oct 2024 10:27:41 +0200 Subject: [PATCH 1/4] alpha : add allow_tz4_delegate_enable feature flag --- .../lib_parameters/default_parameters.ml | 3 +++ src/proto_alpha/lib_protocol/alpha_context.mli | 3 +++ .../lib_protocol/constants_parametric_repr.ml | 17 +++++++++++------ .../lib_protocol/constants_parametric_repr.mli | 1 + .../lib_protocol/constants_storage.ml | 3 +++ .../lib_protocol/constants_storage.mli | 2 ++ src/proto_alpha/lib_protocol/raw_context.ml | 3 +++ 7 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/proto_alpha/lib_parameters/default_parameters.ml b/src/proto_alpha/lib_parameters/default_parameters.ml index c0d95249f6ca..6b7303f75bc0 100644 --- a/src/proto_alpha/lib_parameters/default_parameters.ml +++ b/src/proto_alpha/lib_parameters/default_parameters.ml @@ -315,6 +315,9 @@ let constants_mainnet : Constants.Parametric.t = direct_ticket_spending_enable = false; (* attestation aggregation feature flag *) aggregate_attestation = false; + (* TODO: https://gitlab.com/tezos/tezos/-/issues/7553 + Enable once we built performance confidance *) + allow_tz4_delegate_enable = false; } let constants_sandbox = diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index d0ab59bc6560..8532ba0fc656 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -946,6 +946,7 @@ module Constants : sig adaptive_issuance : adaptive_issuance; direct_ticket_spending_enable : bool; aggregate_attestation : bool; + allow_tz4_delegate_enable : bool; } val encoding : t Data_encoding.t @@ -1080,6 +1081,8 @@ module Constants : sig val aggregate_attestation : context -> bool + val allow_tz4_delegate_enable : context -> bool + (** All constants: fixed and parametric *) type t = private {fixed : fixed; parametric : Parametric.t} diff --git a/src/proto_alpha/lib_protocol/constants_parametric_repr.ml b/src/proto_alpha/lib_protocol/constants_parametric_repr.ml index cf93b2e10acc..bb53dba47822 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_repr.ml +++ b/src/proto_alpha/lib_protocol/constants_parametric_repr.ml @@ -249,6 +249,7 @@ type t = { adaptive_issuance : adaptive_issuance; direct_ticket_spending_enable : bool; aggregate_attestation : bool; + allow_tz4_delegate_enable : bool; } let sc_rollup_encoding = @@ -584,8 +585,9 @@ let encoding = ( c.dal, ( (c.sc_rollup, c.zk_rollup), ( c.adaptive_issuance, - (c.direct_ticket_spending_enable, c.aggregate_attestation) - ) ) ) ) ) ) ) )) + ( c.direct_ticket_spending_enable, + c.aggregate_attestation, + c.allow_tz4_delegate_enable ) ) ) ) ) ) ) ) )) (fun ( ( ( consensus_rights_delay, blocks_preservation_cycles, delegate_parameters_activation_delay ), @@ -627,8 +629,9 @@ let encoding = ( dal, ( (sc_rollup, zk_rollup), ( adaptive_issuance, - (direct_ticket_spending_enable, aggregate_attestation) - ) ) ) ) ) ) ) ) -> + ( direct_ticket_spending_enable, + aggregate_attestation, + allow_tz4_delegate_enable ) ) ) ) ) ) ) ) ) -> { consensus_rights_delay; blocks_preservation_cycles; @@ -674,6 +677,7 @@ let encoding = adaptive_issuance; direct_ticket_spending_enable; aggregate_attestation; + allow_tz4_delegate_enable; }) (merge_objs (merge_objs @@ -739,9 +743,10 @@ let encoding = (merge_objs sc_rollup_encoding zk_rollup_encoding) (merge_objs adaptive_issuance_encoding - (obj2 + (obj3 (req "direct_ticket_spending_enable" bool) - (req "aggregate_attestation" bool)))))))))) + (req "aggregate_attestation" bool) + (req "allow_tz4_delegate_enable" bool)))))))))) let update_sc_rollup_parameter ratio_i32 c = (* Constants remain small enough to fit in [int32] after update (as a diff --git a/src/proto_alpha/lib_protocol/constants_parametric_repr.mli b/src/proto_alpha/lib_protocol/constants_parametric_repr.mli index cab78c5fabe7..26df37126113 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_repr.mli +++ b/src/proto_alpha/lib_protocol/constants_parametric_repr.mli @@ -226,6 +226,7 @@ type t = { direct_ticket_spending_enable : bool; (* attestation aggregation feature flag *) aggregate_attestation : bool; + allow_tz4_delegate_enable : bool; } val encoding : t Data_encoding.encoding diff --git a/src/proto_alpha/lib_protocol/constants_storage.ml b/src/proto_alpha/lib_protocol/constants_storage.ml index d49cfa410cf8..06cbada9c216 100644 --- a/src/proto_alpha/lib_protocol/constants_storage.ml +++ b/src/proto_alpha/lib_protocol/constants_storage.ml @@ -297,3 +297,6 @@ let direct_ticket_spending_enable c = (Raw_context.constants c).direct_ticket_spending_enable let aggregate_attestation c = (Raw_context.constants c).aggregate_attestation + +let allow_tz4_delegate_enable c = + (Raw_context.constants c).allow_tz4_delegate_enable diff --git a/src/proto_alpha/lib_protocol/constants_storage.mli b/src/proto_alpha/lib_protocol/constants_storage.mli index 6a78706e45c9..02d0a21ad23d 100644 --- a/src/proto_alpha/lib_protocol/constants_storage.mli +++ b/src/proto_alpha/lib_protocol/constants_storage.mli @@ -160,6 +160,8 @@ val adaptive_issuance_ns_enable : Raw_context.t -> bool val direct_ticket_spending_enable : Raw_context.t -> bool +val allow_tz4_delegate_enable : Raw_context.t -> bool + (** The following accessors are not actual parameters, but constants that derive from the protocol parameter. *) diff --git a/src/proto_alpha/lib_protocol/raw_context.ml b/src/proto_alpha/lib_protocol/raw_context.ml index 6867e2e3db6e..fa494e315d3e 100644 --- a/src/proto_alpha/lib_protocol/raw_context.ml +++ b/src/proto_alpha/lib_protocol/raw_context.ml @@ -1218,6 +1218,7 @@ let prepare_first_block ~level ~timestamp chain_id ctxt = adaptive_issuance = _; direct_ticket_spending_enable; aggregate_attestation; + allow_tz4_delegate_enable; } : Previous.t) = c @@ -1268,6 +1269,7 @@ let prepare_first_block ~level ~timestamp chain_id ctxt = adaptive_issuance; direct_ticket_spending_enable; aggregate_attestation; + allow_tz4_delegate_enable; } in let*! ctxt = add_constants ctxt constants in @@ -1555,6 +1557,7 @@ let prepare_first_block ~level ~timestamp chain_id ctxt = adaptive_issuance; direct_ticket_spending_enable; aggregate_attestation = false; + allow_tz4_delegate_enable = false; } in let new_constants : Constants_parametric_repr.t option = -- GitLab From ce6bfc07e36554dd1d8ff3df738b539aa85dcc10 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Wed, 16 Oct 2024 11:27:28 +0200 Subject: [PATCH 2/4] alpha: constants rpc regression test handles allow_tz4_delegate_enable field --- ...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 ++- .../protocol_migration.ml/Alpha- weeklynet regression test.out | 3 ++- 4 files changed, 8 insertions(+), 4 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 9a8273871b33..ebc54815e596 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 @@ -76,7 +76,8 @@ "radius_dz": { "numerator": "1", "denominator": "50" } }, "adaptive_issuance_activation_vote_enable": true, "adaptive_issuance_force_activation": false, "ns_enable": true, - "direct_ticket_spending_enable": false, "aggregate_attestation": false } + "direct_ticket_spending_enable": false, "aggregate_attestation": false, + "allow_tz4_delegate_enable": false } ./octez-client rpc get /chains/main/blocks/head/helpers/baking_rights [ { "level": 2, "delegate": "[PUBLIC_KEY_HASH]", 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 1ce569aa4c66..fb9c9bc2b7de 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 @@ -76,7 +76,8 @@ "radius_dz": { "numerator": "1", "denominator": "50" } }, "adaptive_issuance_activation_vote_enable": true, "adaptive_issuance_force_activation": false, "ns_enable": true, - "direct_ticket_spending_enable": false, "aggregate_attestation": false } + "direct_ticket_spending_enable": false, "aggregate_attestation": false, + "allow_tz4_delegate_enable": false } ./octez-client --mode light rpc get /chains/main/blocks/head/helpers/baking_rights [ { "level": 2, "delegate": "[PUBLIC_KEY_HASH]", 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 aa96c2afdcb9..4a6d17febbae 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 @@ -76,7 +76,8 @@ "radius_dz": { "numerator": "1", "denominator": "50" } }, "adaptive_issuance_activation_vote_enable": true, "adaptive_issuance_force_activation": false, "ns_enable": true, - "direct_ticket_spending_enable": false, "aggregate_attestation": false } + "direct_ticket_spending_enable": false, "aggregate_attestation": false, + "allow_tz4_delegate_enable": false } ./octez-client --mode proxy rpc get /chains/main/blocks/head/helpers/baking_rights [ { "level": 2, "delegate": "[PUBLIC_KEY_HASH]", diff --git a/tezt/tests/expected/protocol_migration.ml/Alpha- weeklynet regression test.out b/tezt/tests/expected/protocol_migration.ml/Alpha- weeklynet regression test.out index ce070e8797fd..0069a7a84585 100644 --- a/tezt/tests/expected/protocol_migration.ml/Alpha- weeklynet regression test.out +++ b/tezt/tests/expected/protocol_migration.ml/Alpha- weeklynet regression test.out @@ -66,4 +66,5 @@ "radius_dz": { "numerator": "1", "denominator": "50" } }, "adaptive_issuance_activation_vote_enable": true, "adaptive_issuance_force_activation": false, "ns_enable": true, - "direct_ticket_spending_enable": false, "aggregate_attestation": false } + "direct_ticket_spending_enable": false, "aggregate_attestation": false, + "allow_tz4_delegate_enable": false } -- GitLab From d50400ce1109d4a870d58b86d1612870090aadaf Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Wed, 16 Oct 2024 11:30:29 +0200 Subject: [PATCH 3/4] alpha: make katai-struct-files-update --- client-libs/kaitai-struct-files/files/alpha__constants.ksy | 3 +++ .../kaitai-struct-files/files/alpha__constants__parametric.ksy | 3 +++ client-libs/kaitai-struct-files/files/alpha__parameters.ksy | 3 +++ 3 files changed, 9 insertions(+) diff --git a/client-libs/kaitai-struct-files/files/alpha__constants.ksy b/client-libs/kaitai-struct-files/files/alpha__constants.ksy index 8ff21f23ccb1..a475e152eae0 100644 --- a/client-libs/kaitai-struct-files/files/alpha__constants.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__constants.ksy @@ -364,3 +364,6 @@ seq: - id: aggregate_attestation type: u1 enum: bool +- id: allow_tz4_delegate_enable + type: u1 + enum: bool diff --git a/client-libs/kaitai-struct-files/files/alpha__constants__parametric.ksy b/client-libs/kaitai-struct-files/files/alpha__constants__parametric.ksy index 6c194a832780..32d9086fb7d5 100644 --- a/client-libs/kaitai-struct-files/files/alpha__constants__parametric.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__constants__parametric.ksy @@ -336,3 +336,6 @@ seq: - id: aggregate_attestation type: u1 enum: bool +- id: allow_tz4_delegate_enable + type: u1 + enum: bool diff --git a/client-libs/kaitai-struct-files/files/alpha__parameters.ksy b/client-libs/kaitai-struct-files/files/alpha__parameters.ksy index a9334bdff8b8..acaef10b1397 100644 --- a/client-libs/kaitai-struct-files/files/alpha__parameters.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__parameters.ksy @@ -614,3 +614,6 @@ seq: - id: aggregate_attestation type: u1 enum: bool +- id: allow_tz4_delegate_enable + type: u1 + enum: bool -- GitLab From 8495370e3b85f2dbaebcd5ba28f99966fa2c6be3 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Wed, 16 Oct 2024 11:56:30 +0200 Subject: [PATCH 4/4] changes: add entry for new allow-tz4-delegate-enable feature flag --- docs/protocols/alpha.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/protocols/alpha.rst b/docs/protocols/alpha.rst index 27171c4946ca..46d731327184 100644 --- a/docs/protocols/alpha.rst +++ b/docs/protocols/alpha.rst @@ -69,6 +69,9 @@ Minor Changes - Added a feature flag to enable the aggregation of block attestation lists into a single aggregate operation. (MR :gl:!15283) +- Added a feature flag which would allow tz4 (BLS) addresses as delegate and or + as consensus keys. (MR :gl:`!15311`) + Internal -------- -- GitLab