From 383d95e795c34f08f29ca889a9dfcf5bd49e503a Mon Sep 17 00:00:00 2001 From: Valentin Chaboche Date: Thu, 13 Nov 2025 10:49:58 +0100 Subject: [PATCH 1/8] Manifest: don't check dev protocol hashes --- manifest/product_octez.ml | 7 ++++--- src/proto_024_PsD5wVTJ/lib_protocol/dune | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/manifest/product_octez.ml b/manifest/product_octez.ml index e0a515f2e47c..01e9e8833e23 100644 --- a/manifest/product_octez.ml +++ b/manifest/product_octez.ml @@ -6812,9 +6812,10 @@ module Protocol = Protocol S "run"; S "%{bin:octez-protocol-compiler}"; (if - String_set.mem - tezos_protocol.Tezos_protocol.hash - final_protocol_versions + (match number with Dev -> false | _ -> true) + && String_set.mem + tezos_protocol.Tezos_protocol.hash + final_protocol_versions then E else S "-no-hash-check"); (match disable_warnings with diff --git a/src/proto_024_PsD5wVTJ/lib_protocol/dune b/src/proto_024_PsD5wVTJ/lib_protocol/dune index b011c7333947..937573bf4075 100644 --- a/src/proto_024_PsD5wVTJ/lib_protocol/dune +++ b/src/proto_024_PsD5wVTJ/lib_protocol/dune @@ -588,7 +588,7 @@ apply.ml apply.mli main.ml main.mli (:src_dir TEZOS_PROTOCOL)) - (action (run %{bin:octez-protocol-compiler} -warn-error +a .))) + (action (run %{bin:octez-protocol-compiler} -no-hash-check -warn-error +a .))) (library (name tezos_protocol_024_PsD5wVTJ_lifted) -- GitLab From 8a4cf2ed3925f0113252f23ee38f6d53d729ab9a Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Fri, 7 Nov 2025 16:45:22 +0100 Subject: [PATCH 2/8] Proto/abaab: update consensus receipts --- .../lib_client/operation_result.ml | 10 ++-- src/proto_alpha/lib_protocol/alpha_context.ml | 9 +++- .../lib_protocol/alpha_context.mli | 16 +++++- src/proto_alpha/lib_protocol/apply.ml | 45 ++++++++++++++-- src/proto_alpha/lib_protocol/apply_results.ml | 18 +++---- .../lib_protocol/apply_results.mli | 12 ++--- .../lib_protocol/attesting_power_repr.ml | 54 +++++++++++++++---- .../lib_protocol/attesting_power_repr.mli | 19 ++++++- src/proto_alpha/lib_protocol/baking.ml | 8 +-- .../integration/consensus/test_aggregate.ml | 19 ++----- 10 files changed, 152 insertions(+), 58 deletions(-) diff --git a/src/proto_alpha/lib_client/operation_result.ml b/src/proto_alpha/lib_client/operation_result.ml index 0cbe7c6de203..db57254e815e 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -1001,7 +1001,7 @@ let pp_contents_and_result : type kind. "(%a, %a)" Consensus_key.pp delegate - Attesting_power.pp + Attesting_power.pp_result voting_power in fun ppf -> function @@ -1054,7 +1054,7 @@ let pp_contents_and_result : type kind. balance_updates Consensus_key.pp {delegate; consensus_pkh = consensus_key} - Attesting_power.pp + Attesting_power.pp_result consensus_power | ( Attestation {consensus_content = {level; _}; dal_content = _}, Attestation_result @@ -1072,7 +1072,7 @@ let pp_contents_and_result : type kind. balance_updates Consensus_key.pp {delegate; consensus_pkh = consensus_key} - Attesting_power.pp + Attesting_power.pp_result consensus_power | ( Preattestations_aggregate {consensus_content = {level; _}; _}, Preattestations_aggregate_result @@ -1090,7 +1090,7 @@ let pp_contents_and_result : type kind. balance_updates (Format.pp_print_list pp_committee) committee - Attesting_power.pp + Attesting_power.pp_result total_consensus_power | ( Attestations_aggregate {consensus_content = {level; _}; _}, Attestations_aggregate_result @@ -1108,7 +1108,7 @@ let pp_contents_and_result : type kind. balance_updates (Format.pp_print_list pp_committee) committee - Attesting_power.pp + Attesting_power.pp_result total_consensus_power | ( Double_consensus_operation_evidence {slot; op1; op2}, Double_consensus_operation_evidence_result double_signing_result ) -> diff --git a/src/proto_alpha/lib_protocol/alpha_context.ml b/src/proto_alpha/lib_protocol/alpha_context.ml index 08d0c57f0f09..500d6a1915a5 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.ml +++ b/src/proto_alpha/lib_protocol/alpha_context.ml @@ -748,13 +748,18 @@ module Attesting_power = struct include Attesting_power_repr include Consensus_parameters_storage - let get ctxt ~attested_level {slots; stake} = + let get ctxt ~attested_level {slots; baking_power} = let all_bakers_attest_enabled = check_all_bakers_attest_at_level ctxt ~attested_level in - if all_bakers_attest_enabled then stake else Int64.of_int slots + if all_bakers_attest_enabled then baking_power else Int64.of_int slots let get_slots {slots; _} = slots + + let to_result ctxt ~attested_level = + let attested_level = Level_storage.from_raw ctxt attested_level in + to_result + ~abaab_activated:(check_all_bakers_attest_at_level ctxt ~attested_level) end module Consensus = struct diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 1fda7fde7a83..467edf76d8bf 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -2268,13 +2268,21 @@ end module Attesting_power : sig type t + type result + val encoding : t Data_encoding.t + val op_result_encoding : result Data_encoding.t + + val to_result : context -> attested_level:Raw_level.t -> t -> result + val pp : Format.formatter -> t -> unit + val pp_result : Format.formatter -> result -> unit + val zero : t - val make : slots:int -> stake:int64 -> t + val make : slots:int -> baking_power:int64 -> t val add : t -> t -> t @@ -2285,6 +2293,8 @@ module Attesting_power : sig val get_slots : t -> int + val get_slots_from_result : result -> int + val check_all_bakers_attest_at_level : context -> attested_level:Level.t -> bool @@ -2298,6 +2308,10 @@ module Attesting_power : sig (** See {!Consensus_parameters_storage.consensus_committee}. *) val consensus_committee : context -> attested_level:Level.t -> (context * int64) tzresult Lwt.t + + module Internal_for_tests : sig + val get_from_result : result -> int64 + end end (** This module re-exports definitions from {!Delegate_consensus_key}. *) diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index e294e15a865f..e18ffeeab2d5 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -2283,6 +2283,12 @@ let record_preattestation ctxt (mode : mode) (content : consensus_content) : in let mk_preattestation_result ({delegate; consensus_pkh; _} : Consensus_key.pk) consensus_power = + let consensus_power = + Attesting_power.to_result + ctxt + ~attested_level:content.level + consensus_power + in Single_result (Preattestation_result { @@ -2340,6 +2346,12 @@ let record_attestation ctxt (mode : mode) (consensus : consensus_content) let open Lwt_result_syntax in let mk_attestation_result ({delegate; consensus_pkh; _} : Consensus_key.pk) consensus_power = + let consensus_power = + Attesting_power.to_result + ctxt + ~attested_level:consensus.level + consensus_power + in Single_result (Attestation_result { @@ -2382,7 +2394,8 @@ let record_attestation ctxt (mode : mode) (consensus : consensus_content) consensus_key Attesting_power.zero (* Fake power. *) ) -let record_attestations_aggregate ctxt (mode : mode) committee : +let record_attestations_aggregate ctxt (mode : mode) + (content : consensus_aggregate_content) committee : (context * Kind.attestations_aggregate contents_result_list) tzresult Lwt.t = let open Lwt_result_syntax in @@ -2410,11 +2423,22 @@ let record_attestations_aggregate ctxt (mode : mode) committee : let key = ({delegate; consensus_pkh} : Consensus_key.t) in return ( ctxt, - (key, attesting_power) :: consensus_keys, + ( key, + Attesting_power.to_result + ctxt + ~attested_level:content.level + attesting_power ) + :: consensus_keys, Attesting_power.add attesting_power consensus_power )) (ctxt, [], Attesting_power.zero) committee in + let total_consensus_power = + Attesting_power.to_result + ctxt + ~attested_level:content.level + total_consensus_power + in let result = Attestations_aggregate_result { @@ -2468,11 +2492,22 @@ let record_preattestations_aggregate ctxt (mode : mode) let key = ({delegate; consensus_pkh} : Consensus_key.t) in return ( ctxt, - (key, attesting_power) :: consensus_keys, + ( key, + Attesting_power.to_result + ctxt + ~attested_level:content.level + attesting_power ) + :: consensus_keys, Attesting_power.add attesting_power consensus_power )) (ctxt, [], Attesting_power.zero) committee in + let total_consensus_power = + Attesting_power.to_result + ctxt + ~attested_level:content.level + total_consensus_power + in let result = Preattestations_aggregate_result { @@ -2619,13 +2654,13 @@ let apply_contents_list (type kind) ctxt chain_id (mode : mode) Validate_errors.Consensus.(Aggregate_disabled) in record_preattestations_aggregate ctxt mode consensus_content committee - | Single (Attestations_aggregate {committee; _}) -> + | Single (Attestations_aggregate {consensus_content; committee}) -> let*? () = error_unless (Constants.aggregate_attestation ctxt) Validate_errors.Consensus.(Aggregate_disabled) in - record_attestations_aggregate ctxt mode committee + record_attestations_aggregate ctxt mode consensus_content committee | Single (Seed_nonce_revelation {level; nonce}) -> let level = Level.from_raw ctxt level in let* ctxt = Nonce.reveal ctxt level nonce in diff --git a/src/proto_alpha/lib_protocol/apply_results.ml b/src/proto_alpha/lib_protocol/apply_results.ml index 4923aa673ff4..03492b1eecc6 100644 --- a/src/proto_alpha/lib_protocol/apply_results.ml +++ b/src/proto_alpha/lib_protocol/apply_results.ml @@ -894,26 +894,26 @@ type 'kind contents_result = balance_updates : Receipt.balance_updates; delegate : Signature.public_key_hash; consensus_key : Signature.public_key_hash; - consensus_power : Attesting_power.t; + consensus_power : Attesting_power.result; } -> Kind.preattestation contents_result | Attestation_result : { balance_updates : Receipt.balance_updates; delegate : Signature.public_key_hash; consensus_key : Signature.public_key_hash; - consensus_power : Attesting_power.t; + consensus_power : Attesting_power.result; } -> Kind.attestation contents_result | Preattestations_aggregate_result : { balance_updates : Receipt.balance_updates; - committee : (Consensus_key.t * Attesting_power.t) list; - total_consensus_power : Attesting_power.t; + committee : (Consensus_key.t * Attesting_power.result) list; + total_consensus_power : Attesting_power.result; } -> Kind.preattestations_aggregate contents_result | Attestations_aggregate_result : { balance_updates : Receipt.balance_updates; - committee : (Consensus_key.t * Attesting_power.t) list; - total_consensus_power : Attesting_power.t; + committee : (Consensus_key.t * Attesting_power.result) list; + total_consensus_power : Attesting_power.result; } -> Kind.attestations_aggregate contents_result | Seed_nonce_revelation_result : @@ -1041,7 +1041,7 @@ module Encoding = struct obj4 (dft "balance_updates" Receipt.balance_updates_encoding []) (req "delegate" Signature.Public_key_hash.encoding) - (req "consensus_power" Attesting_power.encoding) + (req "consensus_power" Attesting_power.op_result_encoding) (req "consensus_key" Signature.Public_key_hash.encoding) let consensus_aggregate_result_encoding = @@ -1053,8 +1053,8 @@ module Encoding = struct (list (merge_objs Consensus_key.encoding - (obj1 (req "consensus_power" Attesting_power.encoding))))) - (req "total_consensus_power" Attesting_power.encoding) + (obj1 (req "consensus_power" Attesting_power.op_result_encoding))))) + (req "total_consensus_power" Attesting_power.op_result_encoding) type case = | Case : { diff --git a/src/proto_alpha/lib_protocol/apply_results.mli b/src/proto_alpha/lib_protocol/apply_results.mli index 07fe9cdf98e8..2f3783021059 100644 --- a/src/proto_alpha/lib_protocol/apply_results.mli +++ b/src/proto_alpha/lib_protocol/apply_results.mli @@ -69,26 +69,26 @@ and 'kind contents_result = balance_updates : Receipt.balance_updates; delegate : Signature.public_key_hash; consensus_key : Signature.public_key_hash; - consensus_power : Attesting_power.t; + consensus_power : Attesting_power.result; } -> Kind.preattestation contents_result | Attestation_result : { balance_updates : Receipt.balance_updates; delegate : Signature.public_key_hash; consensus_key : Signature.public_key_hash; - consensus_power : Attesting_power.t; + consensus_power : Attesting_power.result; } -> Kind.attestation contents_result | Preattestations_aggregate_result : { balance_updates : Receipt.balance_updates; - committee : (Consensus_key.t * Attesting_power.t) list; - total_consensus_power : Attesting_power.t; + committee : (Consensus_key.t * Attesting_power.result) list; + total_consensus_power : Attesting_power.result; } -> Kind.preattestations_aggregate contents_result | Attestations_aggregate_result : { balance_updates : Receipt.balance_updates; - committee : (Consensus_key.t * Attesting_power.t) list; - total_consensus_power : Attesting_power.t; + committee : (Consensus_key.t * Attesting_power.result) list; + total_consensus_power : Attesting_power.result; } -> Kind.attestations_aggregate contents_result | Seed_nonce_revelation_result : diff --git a/src/proto_alpha/lib_protocol/attesting_power_repr.ml b/src/proto_alpha/lib_protocol/attesting_power_repr.ml index 994c4d867d92..c88c29d80f09 100644 --- a/src/proto_alpha/lib_protocol/attesting_power_repr.ml +++ b/src/proto_alpha/lib_protocol/attesting_power_repr.ml @@ -7,22 +7,54 @@ (** If the consensus is distributed randomly for 7000 slots, the (relative) power is the number of slots of the given delegate, - noted in [slots]. Otherwise, if all bakers attest, then its power is its stake - for the cycle in which the rights were distributed, noted in [stake]. *) -type t = {slots : int; stake : int64} + noted in [slots]. Otherwise, if all bakers attest, then its power is its baking_power + for the cycle in which the rights were distributed, noted in [baking_power]. *) +type t = {slots : int; baking_power : int64} + +type result = {slots : int; baking_power_opt : int64 option} let encoding = let open Data_encoding in conv - (fun {slots; stake} -> (slots, stake)) - (fun (slots, stake) -> {slots; stake}) - (obj2 (req "slots" int31) (req "stake" int64)) + (fun {slots; baking_power} -> (slots, baking_power)) + (fun (slots, baking_power) -> {slots; baking_power}) + (obj2 (req "slots" int31) (req "baking_power" int64)) + +let op_result_encoding = + let open Data_encoding in + conv + (fun {slots; baking_power_opt} -> (slots, baking_power_opt)) + (fun (slots, baking_power_opt) -> {slots; baking_power_opt}) + (obj2 (req "slots" int31) (req "baking_power" (option int64))) + +let to_result ~abaab_activated {slots; baking_power} = + let baking_power_opt = if abaab_activated then Some baking_power else None in + {slots; baking_power_opt} + +let pp ppf {slots; baking_power} = + Format.fprintf ppf "(slots:%d, baking power:%Ld)" slots baking_power + +let pp_result ppf {slots; baking_power_opt} = + match baking_power_opt with + | None -> Format.fprintf ppf "slots:%d" slots + | Some baking_power -> + Format.fprintf ppf "(slots:%d, baking power:%Ld)" slots baking_power + +let zero = {slots = 0; baking_power = 0L} -let pp ppf {slots; stake} = - Format.fprintf ppf "(slots:%d, stake:%Ld)" slots stake +let make ~slots ~baking_power = {slots; baking_power} -let zero = {slots = 0; stake = 0L} +let add (a : t) (b : t) = + { + slots = a.slots + b.slots; + baking_power = Int64.add a.baking_power b.baking_power; + } -let make ~slots ~stake = {slots; stake} +let get_slots_from_result ({slots; _} : result) = slots -let add a b = {slots = a.slots + b.slots; stake = Int64.add a.stake b.stake} +module Internal_for_tests = struct + let get_from_result {slots; baking_power_opt} = + match baking_power_opt with + | None -> Int64.of_int slots + | Some baking_power -> baking_power +end diff --git a/src/proto_alpha/lib_protocol/attesting_power_repr.mli b/src/proto_alpha/lib_protocol/attesting_power_repr.mli index 46b555a75205..696223370dbd 100644 --- a/src/proto_alpha/lib_protocol/attesting_power_repr.mli +++ b/src/proto_alpha/lib_protocol/attesting_power_repr.mli @@ -7,14 +7,29 @@ (** Internal representation of attestation power. *) -type t = {slots : int; stake : int64} +type t = {slots : int; baking_power : int64} + +(* Only for operation receipts. See [apply_results.ml]. *) +type result val encoding : t Data_encoding.t +val op_result_encoding : result Data_encoding.t + +val to_result : abaab_activated:bool -> t -> result + val pp : Format.formatter -> t -> unit +val pp_result : Format.formatter -> result -> unit + val zero : t -val make : slots:int -> stake:int64 -> t +val make : slots:int -> baking_power:int64 -> t val add : t -> t -> t + +val get_slots_from_result : result -> int + +module Internal_for_tests : sig + val get_from_result : result -> int64 +end diff --git a/src/proto_alpha/lib_protocol/baking.ml b/src/proto_alpha/lib_protocol/baking.ml index 7cf362b2595f..8c060118f0e7 100644 --- a/src/proto_alpha/lib_protocol/baking.ml +++ b/src/proto_alpha/lib_protocol/baking.ml @@ -217,7 +217,7 @@ let attesting_rights (ctxt : t) ~attested_level = return (ctxt, map) let incr_slot att_rights = - let one = Attesting_power.make ~slots:1 ~stake:0L in + let one = Attesting_power.make ~slots:1 ~baking_power:0L in Attesting_power.add one att_rights let attesting_rights_by_first_slot ctxt ~attested_level : @@ -306,7 +306,7 @@ let attesting_rights_by_first_slot ctxt ~attested_level : { Consensus_key.consensus_key; attesting_power = - Attesting_power.make ~slots:0 ~stake:weight; + Attesting_power.make ~slots:0 ~baking_power:weight; dal_power = 0; } acc, @@ -321,7 +321,9 @@ let attesting_rights_by_first_slot ctxt ~attested_level : v with attesting_power = Attesting_power.( - add (make ~slots:0 ~stake:weight) v.attesting_power); + add + (make ~slots:0 ~baking_power:weight) + v.attesting_power); } in if all_bakers_attest_enabled then diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_aggregate.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_aggregate.ml index a3c28c706828..0ebbd265f871 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_aggregate.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_aggregate.ml @@ -81,7 +81,7 @@ type 'kind aggregate = - [voting_power] equals the sum of slots owned by [attesters]; - the public key hashes in [result] committee match those of [attesters]. *) let check_aggregate_result (type kind) (kind : kind aggregate) ~attesters - ((block, (_, op_receipts)) : Block.block_with_metadata) = + ((_block, (_, op_receipts)) : Block.block_with_metadata) = let open Lwt_result_syntax in let (result : kind Tezos_protocol_alpha__Protocol.Apply_results.contents_result) = @@ -89,15 +89,6 @@ let check_aggregate_result (type kind) (kind : kind aggregate) ~attesters | Preattestation -> find_preattestations_aggregate_result op_receipts | Attestation -> find_attestations_aggregate_result op_receipts in - let* ctxt = Block.get_alpha_ctxt block in - let block_level = Alpha_context.Level.current ctxt in - let attested_level = - match kind with - | Preattestation -> block_level - | Attestation -> - Alpha_context.Level.pred ctxt block_level - |> WithExceptions.Option.get ~loc:__LOC__ - in match (kind, result) with | ( Preattestation, Preattestations_aggregate_result @@ -129,9 +120,7 @@ let check_aggregate_result (type kind) (kind : kind aggregate) ~attesters attesters in let total_consensus_power = - Alpha_context.Attesting_power.get - ctxt - ~attested_level + Alpha_context.Attesting_power.Internal_for_tests.get_from_result total_consensus_power in if Int64.equal voting_power total_consensus_power then return_unit @@ -158,7 +147,9 @@ let check_aggregate_result (type kind) (kind : kind aggregate) ~attesters let resulting_committee = List.map (fun (a, b) -> - (a, Alpha_context.Attesting_power.get ctxt ~attested_level b)) + ( a, + Alpha_context.Attesting_power.Internal_for_tests.get_from_result b + )) resulting_committee in if -- GitLab From 59106dc44ec6b972b5b54945d9c7f66847218f7e Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Wed, 12 Nov 2025 11:26:20 +0100 Subject: [PATCH 3/8] Proto: update block receipts --- src/proto_alpha/lib_protocol/alpha_context.ml | 3 + .../lib_protocol/alpha_context.mli | 2 + src/proto_alpha/lib_protocol/apply.ml | 56 ++++++++++++++++++- src/proto_alpha/lib_protocol/apply_results.ml | 46 +++++++++++++-- .../lib_protocol/apply_results.mli | 9 +++ 5 files changed, 109 insertions(+), 7 deletions(-) diff --git a/src/proto_alpha/lib_protocol/alpha_context.ml b/src/proto_alpha/lib_protocol/alpha_context.ml index 500d6a1915a5..735d248b9b94 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.ml +++ b/src/proto_alpha/lib_protocol/alpha_context.ml @@ -760,6 +760,9 @@ module Attesting_power = struct let attested_level = Level_storage.from_raw ctxt attested_level in to_result ~abaab_activated:(check_all_bakers_attest_at_level ctxt ~attested_level) + + let all_bakers_attest_activation_level ctxt = + Constants_storage.all_bakers_attest_first_level ctxt end module Consensus = struct diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 467edf76d8bf..e622368dd162 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -2295,6 +2295,8 @@ module Attesting_power : sig val get_slots_from_result : result -> int + val all_bakers_attest_activation_level : context -> Level.t option + val check_all_bakers_attest_at_level : context -> attested_level:Level.t -> bool diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index e18ffeeab2d5..e168e82ef706 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -3242,7 +3242,7 @@ let finalize_application ctxt block_data_contents ~round ~predecessor_hash Nonce.record_hash ctxt {nonce_hash; delegate = block_producer.delegate} in let* ctxt, dal_attestation = Dal_apply.finalisation ctxt in - let* ctxt, reward_bonus = + let* ctxt, reward_bonus, attestation_result = let* required_attestations = are_attestations_required ctxt ~level:current_level.level in @@ -3258,8 +3258,49 @@ let finalize_application ctxt block_data_contents ~round ~predecessor_hash let* ctxt, rewards_bonus = Baking.bonus_baking_reward ctxt ~attested_level ~attesting_power in - return (ctxt, Some rewards_bonus) - else return (ctxt, None) + let* ctxt, consensus_committee = + Attesting_power.consensus_committee ctxt ~attested_level + in + let* ctxt, consensus_threshold = + Attesting_power.consensus_threshold ctxt ~attested_level + in + let consensus_recorded_power = + Attesting_power.get ctxt ~attested_level attesting_power + in + return + ( ctxt, + Some rewards_bonus, + Some + { + consensus_committee; + consensus_threshold; + consensus_recorded_power; + } ) + else return (ctxt, None, None) + in + let* ctxt, preattestation_result = + let lre = Consensus.locked_round_evidence ctxt in + match lre with + | None -> return (ctxt, None) + | Some (_round, preattesting_power) -> + let attested_level = current_level in + let* ctxt, consensus_committee = + Attesting_power.consensus_committee ctxt ~attested_level + in + let* ctxt, consensus_threshold = + Attesting_power.consensus_threshold ctxt ~attested_level + in + let consensus_recorded_power = + Attesting_power.get ctxt ~attested_level preattesting_power + in + return + ( ctxt, + Some + { + consensus_committee; + consensus_threshold; + consensus_recorded_power; + } ) in let*? baking_reward = Delegate.Rewards.baking_reward_fixed_portion ctxt in let* ctxt, baking_receipts = @@ -3284,6 +3325,9 @@ let finalize_application ctxt block_data_contents ~round ~predecessor_hash migration_balance_updates @ baking_receipts @ cycle_end_balance_updates in let+ voting_period_info = Voting_period.get_rpc_current_info ctxt in + let abaab_activation_level = + Attesting_power.all_bakers_attest_activation_level ctxt + in let receipt = Apply_results. { @@ -3298,6 +3342,9 @@ let finalize_application ctxt block_data_contents ~round ~predecessor_hash liquidity_baking_toggle_ema; implicit_operations_results; dal_attestation; + abaab_activation_level; + attestations = attestation_result; + preattestations = preattestation_result; } in (ctxt, receipt) @@ -3417,6 +3464,9 @@ let finalize_block (application_state : application_state) shell_header_opt = liquidity_baking_toggle_ema; implicit_operations_results; dal_attestation = Dal.Attestation.empty; + abaab_activation_level = None; + attestations = None; + preattestations = None; } ) | Application { diff --git a/src/proto_alpha/lib_protocol/apply_results.ml b/src/proto_alpha/lib_protocol/apply_results.ml index 03492b1eecc6..5513562d0fe7 100644 --- a/src/proto_alpha/lib_protocol/apply_results.ml +++ b/src/proto_alpha/lib_protocol/apply_results.ml @@ -2596,6 +2596,26 @@ let operation_data_and_metadata_encoding = (Operation_data {contents; signature}, No_operation_metadata)); ] +type attestations_result = { + consensus_committee : int64; + consensus_threshold : int64; + consensus_recorded_power : int64; +} + +let attestations_result_encoding = + def "block_header.alpha.attestations_result" + @@ conv + (fun {consensus_committee; consensus_threshold; consensus_recorded_power} + -> + (consensus_committee, consensus_threshold, consensus_recorded_power)) + (fun (consensus_committee, consensus_threshold, consensus_recorded_power) + -> + {consensus_committee; consensus_threshold; consensus_recorded_power}) + (obj3 + (req "total_committee_power" int64) + (req "threshold" int64) + (req "recorded_power" int64)) + type block_metadata = { proposer : Consensus_key.t; baker : Consensus_key.t; @@ -2608,6 +2628,9 @@ type block_metadata = { liquidity_baking_toggle_ema : Per_block_votes.Liquidity_baking_toggle_EMA.t; implicit_operations_results : packed_successful_manager_operation_result list; dal_attestation : Dal.Attestation.t; + abaab_activation_level : Level.t option; + attestations : attestations_result option; + preattestations : attestations_result option; } let block_metadata_encoding = @@ -2627,6 +2650,9 @@ let block_metadata_encoding = liquidity_baking_toggle_ema; implicit_operations_results; dal_attestation; + abaab_activation_level; + attestations; + preattestations; } -> ( ( proposer, @@ -2641,7 +2667,10 @@ let block_metadata_encoding = proposer_active_key, baker_active_key, consumed_gas, - dal_attestation ) )) + dal_attestation, + abaab_activation_level, + attestations, + preattestations ) )) (fun ( ( proposer, baker, level_info, @@ -2654,7 +2683,10 @@ let block_metadata_encoding = proposer_active_key, baker_active_key, consumed_gas, - dal_attestation ) ) + dal_attestation, + abaab_activation_level, + attestations, + preattestations ) ) -> { proposer = {delegate = proposer; consensus_pkh = proposer_active_key}; @@ -2668,6 +2700,9 @@ let block_metadata_encoding = liquidity_baking_toggle_ema; implicit_operations_results; dal_attestation; + abaab_activation_level; + attestations; + preattestations; }) (merge_objs (obj8 @@ -2681,11 +2716,14 @@ let block_metadata_encoding = (req "liquidity_baking_toggle_ema" Per_block_votes.Liquidity_baking_toggle_EMA.encoding)) - (obj5 + (obj8 (req "implicit_operations_results" (list successful_manager_operation_result_encoding)) (req "proposer_consensus_key" Signature.Public_key_hash.encoding) (req "baker_consensus_key" Signature.Public_key_hash.encoding) (req "consumed_milligas" Gas.Arith.n_fp_encoding) - (req "dal_attestation" Dal.Attestation.encoding))) + (req "dal_attestation" Dal.Attestation.encoding) + (req "all_bakers_attest_activation_level" (option Level.encoding)) + (req "attestations" (option attestations_result_encoding)) + (req "preattestations" (option attestations_result_encoding)))) diff --git a/src/proto_alpha/lib_protocol/apply_results.mli b/src/proto_alpha/lib_protocol/apply_results.mli index 2f3783021059..638d0ea99bbb 100644 --- a/src/proto_alpha/lib_protocol/apply_results.mli +++ b/src/proto_alpha/lib_protocol/apply_results.mli @@ -327,6 +327,12 @@ val kind_equal_list : 'kind2 contents_result_list -> ('kind, 'kind2) eq option +type attestations_result = { + consensus_committee : int64; + consensus_threshold : int64; + consensus_recorded_power : int64; +} + type block_metadata = { proposer : Consensus_key.t; baker : Consensus_key.t; @@ -339,6 +345,9 @@ type block_metadata = { liquidity_baking_toggle_ema : Per_block_votes.Liquidity_baking_toggle_EMA.t; implicit_operations_results : packed_successful_manager_operation_result list; dal_attestation : Dal.Attestation.t; + abaab_activation_level : Level.t option; + attestations : attestations_result option; + preattestations : attestations_result option; } val block_metadata_encoding : block_metadata Data_encoding.encoding -- GitLab From 659de3824cb169dd9ca36e2ee97f58ca0d0d9f4a Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Wed, 12 Nov 2025 16:07:58 +0100 Subject: [PATCH 4/8] 024_PsD5wVTJ/Proto/abaab: update consensus receipts Porting to proto 024_PsD5wVTJ 4f12a3582edc44a1fbc54d3658de0dfe36de7298 - Proto/abaab: update consensus receipts --- .../lib_client/operation_result.ml | 10 ++-- .../lib_protocol/alpha_context.ml | 9 +++- .../lib_protocol/alpha_context.mli | 16 +++++- src/proto_024_PsD5wVTJ/lib_protocol/apply.ml | 45 ++++++++++++++-- .../lib_protocol/apply_results.ml | 18 +++---- .../lib_protocol/apply_results.mli | 12 ++--- .../lib_protocol/attesting_power_repr.ml | 54 +++++++++++++++---- .../lib_protocol/attesting_power_repr.mli | 19 ++++++- src/proto_024_PsD5wVTJ/lib_protocol/baking.ml | 8 +-- .../integration/consensus/test_aggregate.ml | 19 ++----- 10 files changed, 152 insertions(+), 58 deletions(-) diff --git a/src/proto_024_PsD5wVTJ/lib_client/operation_result.ml b/src/proto_024_PsD5wVTJ/lib_client/operation_result.ml index 0cbe7c6de203..db57254e815e 100644 --- a/src/proto_024_PsD5wVTJ/lib_client/operation_result.ml +++ b/src/proto_024_PsD5wVTJ/lib_client/operation_result.ml @@ -1001,7 +1001,7 @@ let pp_contents_and_result : type kind. "(%a, %a)" Consensus_key.pp delegate - Attesting_power.pp + Attesting_power.pp_result voting_power in fun ppf -> function @@ -1054,7 +1054,7 @@ let pp_contents_and_result : type kind. balance_updates Consensus_key.pp {delegate; consensus_pkh = consensus_key} - Attesting_power.pp + Attesting_power.pp_result consensus_power | ( Attestation {consensus_content = {level; _}; dal_content = _}, Attestation_result @@ -1072,7 +1072,7 @@ let pp_contents_and_result : type kind. balance_updates Consensus_key.pp {delegate; consensus_pkh = consensus_key} - Attesting_power.pp + Attesting_power.pp_result consensus_power | ( Preattestations_aggregate {consensus_content = {level; _}; _}, Preattestations_aggregate_result @@ -1090,7 +1090,7 @@ let pp_contents_and_result : type kind. balance_updates (Format.pp_print_list pp_committee) committee - Attesting_power.pp + Attesting_power.pp_result total_consensus_power | ( Attestations_aggregate {consensus_content = {level; _}; _}, Attestations_aggregate_result @@ -1108,7 +1108,7 @@ let pp_contents_and_result : type kind. balance_updates (Format.pp_print_list pp_committee) committee - Attesting_power.pp + Attesting_power.pp_result total_consensus_power | ( Double_consensus_operation_evidence {slot; op1; op2}, Double_consensus_operation_evidence_result double_signing_result ) -> diff --git a/src/proto_024_PsD5wVTJ/lib_protocol/alpha_context.ml b/src/proto_024_PsD5wVTJ/lib_protocol/alpha_context.ml index 7186a5108ea7..3d8e725f2d33 100644 --- a/src/proto_024_PsD5wVTJ/lib_protocol/alpha_context.ml +++ b/src/proto_024_PsD5wVTJ/lib_protocol/alpha_context.ml @@ -711,13 +711,18 @@ module Attesting_power = struct include Attesting_power_repr include Consensus_parameters_storage - let get ctxt ~attested_level {slots; stake} = + let get ctxt ~attested_level {slots; baking_power} = let all_bakers_attest_enabled = check_all_bakers_attest_at_level ctxt ~attested_level in - if all_bakers_attest_enabled then stake else Int64.of_int slots + if all_bakers_attest_enabled then baking_power else Int64.of_int slots let get_slots {slots; _} = slots + + let to_result ctxt ~attested_level = + let attested_level = Level_storage.from_raw ctxt attested_level in + to_result + ~abaab_activated:(check_all_bakers_attest_at_level ctxt ~attested_level) end module Consensus = struct diff --git a/src/proto_024_PsD5wVTJ/lib_protocol/alpha_context.mli b/src/proto_024_PsD5wVTJ/lib_protocol/alpha_context.mli index 6245a7f2f846..9859f876ac7c 100644 --- a/src/proto_024_PsD5wVTJ/lib_protocol/alpha_context.mli +++ b/src/proto_024_PsD5wVTJ/lib_protocol/alpha_context.mli @@ -2254,13 +2254,21 @@ end module Attesting_power : sig type t + type result + val encoding : t Data_encoding.t + val op_result_encoding : result Data_encoding.t + + val to_result : context -> attested_level:Raw_level.t -> t -> result + val pp : Format.formatter -> t -> unit + val pp_result : Format.formatter -> result -> unit + val zero : t - val make : slots:int -> stake:int64 -> t + val make : slots:int -> baking_power:int64 -> t val add : t -> t -> t @@ -2271,6 +2279,8 @@ module Attesting_power : sig val get_slots : t -> int + val get_slots_from_result : result -> int + val check_all_bakers_attest_at_level : context -> attested_level:Level.t -> bool @@ -2284,6 +2294,10 @@ module Attesting_power : sig (** See {!Consensus_parameters_storage.consensus_committee}. *) val consensus_committee : context -> attested_level:Level.t -> (context * int64) tzresult Lwt.t + + module Internal_for_tests : sig + val get_from_result : result -> int64 + end end (** This module re-exports definitions from {!Delegate_consensus_key}. *) diff --git a/src/proto_024_PsD5wVTJ/lib_protocol/apply.ml b/src/proto_024_PsD5wVTJ/lib_protocol/apply.ml index 6b33dff059af..bcb3c9f446e6 100644 --- a/src/proto_024_PsD5wVTJ/lib_protocol/apply.ml +++ b/src/proto_024_PsD5wVTJ/lib_protocol/apply.ml @@ -2276,6 +2276,12 @@ let record_preattestation ctxt (mode : mode) (content : consensus_content) : in let mk_preattestation_result ({delegate; consensus_pkh; _} : Consensus_key.pk) consensus_power = + let consensus_power = + Attesting_power.to_result + ctxt + ~attested_level:content.level + consensus_power + in Single_result (Preattestation_result { @@ -2333,6 +2339,12 @@ let record_attestation ctxt (mode : mode) (consensus : consensus_content) let open Lwt_result_syntax in let mk_attestation_result ({delegate; consensus_pkh; _} : Consensus_key.pk) consensus_power = + let consensus_power = + Attesting_power.to_result + ctxt + ~attested_level:consensus.level + consensus_power + in Single_result (Attestation_result { @@ -2375,7 +2387,8 @@ let record_attestation ctxt (mode : mode) (consensus : consensus_content) consensus_key Attesting_power.zero (* Fake power. *) ) -let record_attestations_aggregate ctxt (mode : mode) committee : +let record_attestations_aggregate ctxt (mode : mode) + (content : consensus_aggregate_content) committee : (context * Kind.attestations_aggregate contents_result_list) tzresult Lwt.t = let open Lwt_result_syntax in @@ -2403,11 +2416,22 @@ let record_attestations_aggregate ctxt (mode : mode) committee : let key = ({delegate; consensus_pkh} : Consensus_key.t) in return ( ctxt, - (key, attesting_power) :: consensus_keys, + ( key, + Attesting_power.to_result + ctxt + ~attested_level:content.level + attesting_power ) + :: consensus_keys, Attesting_power.add attesting_power consensus_power )) (ctxt, [], Attesting_power.zero) committee in + let total_consensus_power = + Attesting_power.to_result + ctxt + ~attested_level:content.level + total_consensus_power + in let result = Attestations_aggregate_result { @@ -2461,11 +2485,22 @@ let record_preattestations_aggregate ctxt (mode : mode) let key = ({delegate; consensus_pkh} : Consensus_key.t) in return ( ctxt, - (key, attesting_power) :: consensus_keys, + ( key, + Attesting_power.to_result + ctxt + ~attested_level:content.level + attesting_power ) + :: consensus_keys, Attesting_power.add attesting_power consensus_power )) (ctxt, [], Attesting_power.zero) committee in + let total_consensus_power = + Attesting_power.to_result + ctxt + ~attested_level:content.level + total_consensus_power + in let result = Preattestations_aggregate_result { @@ -2612,13 +2647,13 @@ let apply_contents_list (type kind) ctxt chain_id (mode : mode) Validate_errors.Consensus.(Aggregate_disabled) in record_preattestations_aggregate ctxt mode consensus_content committee - | Single (Attestations_aggregate {committee; _}) -> + | Single (Attestations_aggregate {consensus_content; committee}) -> let*? () = error_unless (Constants.aggregate_attestation ctxt) Validate_errors.Consensus.(Aggregate_disabled) in - record_attestations_aggregate ctxt mode committee + record_attestations_aggregate ctxt mode consensus_content committee | Single (Seed_nonce_revelation {level; nonce}) -> let level = Level.from_raw ctxt level in let* ctxt = Nonce.reveal ctxt level nonce in diff --git a/src/proto_024_PsD5wVTJ/lib_protocol/apply_results.ml b/src/proto_024_PsD5wVTJ/lib_protocol/apply_results.ml index 4923aa673ff4..03492b1eecc6 100644 --- a/src/proto_024_PsD5wVTJ/lib_protocol/apply_results.ml +++ b/src/proto_024_PsD5wVTJ/lib_protocol/apply_results.ml @@ -894,26 +894,26 @@ type 'kind contents_result = balance_updates : Receipt.balance_updates; delegate : Signature.public_key_hash; consensus_key : Signature.public_key_hash; - consensus_power : Attesting_power.t; + consensus_power : Attesting_power.result; } -> Kind.preattestation contents_result | Attestation_result : { balance_updates : Receipt.balance_updates; delegate : Signature.public_key_hash; consensus_key : Signature.public_key_hash; - consensus_power : Attesting_power.t; + consensus_power : Attesting_power.result; } -> Kind.attestation contents_result | Preattestations_aggregate_result : { balance_updates : Receipt.balance_updates; - committee : (Consensus_key.t * Attesting_power.t) list; - total_consensus_power : Attesting_power.t; + committee : (Consensus_key.t * Attesting_power.result) list; + total_consensus_power : Attesting_power.result; } -> Kind.preattestations_aggregate contents_result | Attestations_aggregate_result : { balance_updates : Receipt.balance_updates; - committee : (Consensus_key.t * Attesting_power.t) list; - total_consensus_power : Attesting_power.t; + committee : (Consensus_key.t * Attesting_power.result) list; + total_consensus_power : Attesting_power.result; } -> Kind.attestations_aggregate contents_result | Seed_nonce_revelation_result : @@ -1041,7 +1041,7 @@ module Encoding = struct obj4 (dft "balance_updates" Receipt.balance_updates_encoding []) (req "delegate" Signature.Public_key_hash.encoding) - (req "consensus_power" Attesting_power.encoding) + (req "consensus_power" Attesting_power.op_result_encoding) (req "consensus_key" Signature.Public_key_hash.encoding) let consensus_aggregate_result_encoding = @@ -1053,8 +1053,8 @@ module Encoding = struct (list (merge_objs Consensus_key.encoding - (obj1 (req "consensus_power" Attesting_power.encoding))))) - (req "total_consensus_power" Attesting_power.encoding) + (obj1 (req "consensus_power" Attesting_power.op_result_encoding))))) + (req "total_consensus_power" Attesting_power.op_result_encoding) type case = | Case : { diff --git a/src/proto_024_PsD5wVTJ/lib_protocol/apply_results.mli b/src/proto_024_PsD5wVTJ/lib_protocol/apply_results.mli index 07fe9cdf98e8..2f3783021059 100644 --- a/src/proto_024_PsD5wVTJ/lib_protocol/apply_results.mli +++ b/src/proto_024_PsD5wVTJ/lib_protocol/apply_results.mli @@ -69,26 +69,26 @@ and 'kind contents_result = balance_updates : Receipt.balance_updates; delegate : Signature.public_key_hash; consensus_key : Signature.public_key_hash; - consensus_power : Attesting_power.t; + consensus_power : Attesting_power.result; } -> Kind.preattestation contents_result | Attestation_result : { balance_updates : Receipt.balance_updates; delegate : Signature.public_key_hash; consensus_key : Signature.public_key_hash; - consensus_power : Attesting_power.t; + consensus_power : Attesting_power.result; } -> Kind.attestation contents_result | Preattestations_aggregate_result : { balance_updates : Receipt.balance_updates; - committee : (Consensus_key.t * Attesting_power.t) list; - total_consensus_power : Attesting_power.t; + committee : (Consensus_key.t * Attesting_power.result) list; + total_consensus_power : Attesting_power.result; } -> Kind.preattestations_aggregate contents_result | Attestations_aggregate_result : { balance_updates : Receipt.balance_updates; - committee : (Consensus_key.t * Attesting_power.t) list; - total_consensus_power : Attesting_power.t; + committee : (Consensus_key.t * Attesting_power.result) list; + total_consensus_power : Attesting_power.result; } -> Kind.attestations_aggregate contents_result | Seed_nonce_revelation_result : diff --git a/src/proto_024_PsD5wVTJ/lib_protocol/attesting_power_repr.ml b/src/proto_024_PsD5wVTJ/lib_protocol/attesting_power_repr.ml index 994c4d867d92..c88c29d80f09 100644 --- a/src/proto_024_PsD5wVTJ/lib_protocol/attesting_power_repr.ml +++ b/src/proto_024_PsD5wVTJ/lib_protocol/attesting_power_repr.ml @@ -7,22 +7,54 @@ (** If the consensus is distributed randomly for 7000 slots, the (relative) power is the number of slots of the given delegate, - noted in [slots]. Otherwise, if all bakers attest, then its power is its stake - for the cycle in which the rights were distributed, noted in [stake]. *) -type t = {slots : int; stake : int64} + noted in [slots]. Otherwise, if all bakers attest, then its power is its baking_power + for the cycle in which the rights were distributed, noted in [baking_power]. *) +type t = {slots : int; baking_power : int64} + +type result = {slots : int; baking_power_opt : int64 option} let encoding = let open Data_encoding in conv - (fun {slots; stake} -> (slots, stake)) - (fun (slots, stake) -> {slots; stake}) - (obj2 (req "slots" int31) (req "stake" int64)) + (fun {slots; baking_power} -> (slots, baking_power)) + (fun (slots, baking_power) -> {slots; baking_power}) + (obj2 (req "slots" int31) (req "baking_power" int64)) + +let op_result_encoding = + let open Data_encoding in + conv + (fun {slots; baking_power_opt} -> (slots, baking_power_opt)) + (fun (slots, baking_power_opt) -> {slots; baking_power_opt}) + (obj2 (req "slots" int31) (req "baking_power" (option int64))) + +let to_result ~abaab_activated {slots; baking_power} = + let baking_power_opt = if abaab_activated then Some baking_power else None in + {slots; baking_power_opt} + +let pp ppf {slots; baking_power} = + Format.fprintf ppf "(slots:%d, baking power:%Ld)" slots baking_power + +let pp_result ppf {slots; baking_power_opt} = + match baking_power_opt with + | None -> Format.fprintf ppf "slots:%d" slots + | Some baking_power -> + Format.fprintf ppf "(slots:%d, baking power:%Ld)" slots baking_power + +let zero = {slots = 0; baking_power = 0L} -let pp ppf {slots; stake} = - Format.fprintf ppf "(slots:%d, stake:%Ld)" slots stake +let make ~slots ~baking_power = {slots; baking_power} -let zero = {slots = 0; stake = 0L} +let add (a : t) (b : t) = + { + slots = a.slots + b.slots; + baking_power = Int64.add a.baking_power b.baking_power; + } -let make ~slots ~stake = {slots; stake} +let get_slots_from_result ({slots; _} : result) = slots -let add a b = {slots = a.slots + b.slots; stake = Int64.add a.stake b.stake} +module Internal_for_tests = struct + let get_from_result {slots; baking_power_opt} = + match baking_power_opt with + | None -> Int64.of_int slots + | Some baking_power -> baking_power +end diff --git a/src/proto_024_PsD5wVTJ/lib_protocol/attesting_power_repr.mli b/src/proto_024_PsD5wVTJ/lib_protocol/attesting_power_repr.mli index 46b555a75205..696223370dbd 100644 --- a/src/proto_024_PsD5wVTJ/lib_protocol/attesting_power_repr.mli +++ b/src/proto_024_PsD5wVTJ/lib_protocol/attesting_power_repr.mli @@ -7,14 +7,29 @@ (** Internal representation of attestation power. *) -type t = {slots : int; stake : int64} +type t = {slots : int; baking_power : int64} + +(* Only for operation receipts. See [apply_results.ml]. *) +type result val encoding : t Data_encoding.t +val op_result_encoding : result Data_encoding.t + +val to_result : abaab_activated:bool -> t -> result + val pp : Format.formatter -> t -> unit +val pp_result : Format.formatter -> result -> unit + val zero : t -val make : slots:int -> stake:int64 -> t +val make : slots:int -> baking_power:int64 -> t val add : t -> t -> t + +val get_slots_from_result : result -> int + +module Internal_for_tests : sig + val get_from_result : result -> int64 +end diff --git a/src/proto_024_PsD5wVTJ/lib_protocol/baking.ml b/src/proto_024_PsD5wVTJ/lib_protocol/baking.ml index 7cf362b2595f..8c060118f0e7 100644 --- a/src/proto_024_PsD5wVTJ/lib_protocol/baking.ml +++ b/src/proto_024_PsD5wVTJ/lib_protocol/baking.ml @@ -217,7 +217,7 @@ let attesting_rights (ctxt : t) ~attested_level = return (ctxt, map) let incr_slot att_rights = - let one = Attesting_power.make ~slots:1 ~stake:0L in + let one = Attesting_power.make ~slots:1 ~baking_power:0L in Attesting_power.add one att_rights let attesting_rights_by_first_slot ctxt ~attested_level : @@ -306,7 +306,7 @@ let attesting_rights_by_first_slot ctxt ~attested_level : { Consensus_key.consensus_key; attesting_power = - Attesting_power.make ~slots:0 ~stake:weight; + Attesting_power.make ~slots:0 ~baking_power:weight; dal_power = 0; } acc, @@ -321,7 +321,9 @@ let attesting_rights_by_first_slot ctxt ~attested_level : v with attesting_power = Attesting_power.( - add (make ~slots:0 ~stake:weight) v.attesting_power); + add + (make ~slots:0 ~baking_power:weight) + v.attesting_power); } in if all_bakers_attest_enabled then diff --git a/src/proto_024_PsD5wVTJ/lib_protocol/test/integration/consensus/test_aggregate.ml b/src/proto_024_PsD5wVTJ/lib_protocol/test/integration/consensus/test_aggregate.ml index f5a0350e23ad..58b0025236cf 100644 --- a/src/proto_024_PsD5wVTJ/lib_protocol/test/integration/consensus/test_aggregate.ml +++ b/src/proto_024_PsD5wVTJ/lib_protocol/test/integration/consensus/test_aggregate.ml @@ -75,7 +75,7 @@ type 'kind aggregate = | Attestation : Alpha_context.Kind.attestations_aggregate aggregate let check_aggregate_result (type kind) (kind : kind aggregate) ~attesters - ((block, (_, op_receipts)) : Block.block_with_metadata) = + ((_block, (_, op_receipts)) : Block.block_with_metadata) = let open Lwt_result_syntax in let (result : kind @@ -84,15 +84,6 @@ let check_aggregate_result (type kind) (kind : kind aggregate) ~attesters | Preattestation -> find_preattestations_aggregate_result op_receipts | Attestation -> find_attestations_aggregate_result op_receipts in - let* ctxt = Block.get_alpha_ctxt block in - let block_level = Alpha_context.Level.current ctxt in - let attested_level = - match kind with - | Preattestation -> block_level - | Attestation -> - Alpha_context.Level.pred ctxt block_level - |> WithExceptions.Option.get ~loc:__LOC__ - in match (kind, result) with | ( Preattestation, Preattestations_aggregate_result @@ -124,9 +115,7 @@ let check_aggregate_result (type kind) (kind : kind aggregate) ~attesters attesters in let total_consensus_power = - Alpha_context.Attesting_power.get - ctxt - ~attested_level + Alpha_context.Attesting_power.Internal_for_tests.get_from_result total_consensus_power in if Int64.equal voting_power total_consensus_power then return_unit @@ -153,7 +142,9 @@ let check_aggregate_result (type kind) (kind : kind aggregate) ~attesters let resulting_committee = List.map (fun (a, b) -> - (a, Alpha_context.Attesting_power.get ctxt ~attested_level b)) + ( a, + Alpha_context.Attesting_power.Internal_for_tests.get_from_result b + )) resulting_committee in if -- GitLab From f082ef6dcbf0480c7d1b5519486fe8e29d829f04 Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Wed, 12 Nov 2025 16:08:14 +0100 Subject: [PATCH 5/8] 024_PsD5wVTJ/Proto: update block receipts Porting to proto 024_PsD5wVTJ 97369b1aa851455f91a0e354f3e5768fbbd47199 - Proto: update block receipts --- .../lib_protocol/alpha_context.ml | 3 + .../lib_protocol/alpha_context.mli | 2 + src/proto_024_PsD5wVTJ/lib_protocol/apply.ml | 56 ++++++++++++++++++- .../lib_protocol/apply_results.ml | 46 +++++++++++++-- .../lib_protocol/apply_results.mli | 9 +++ 5 files changed, 109 insertions(+), 7 deletions(-) diff --git a/src/proto_024_PsD5wVTJ/lib_protocol/alpha_context.ml b/src/proto_024_PsD5wVTJ/lib_protocol/alpha_context.ml index 3d8e725f2d33..0b76b2c80e97 100644 --- a/src/proto_024_PsD5wVTJ/lib_protocol/alpha_context.ml +++ b/src/proto_024_PsD5wVTJ/lib_protocol/alpha_context.ml @@ -723,6 +723,9 @@ module Attesting_power = struct let attested_level = Level_storage.from_raw ctxt attested_level in to_result ~abaab_activated:(check_all_bakers_attest_at_level ctxt ~attested_level) + + let all_bakers_attest_activation_level ctxt = + Constants_storage.all_bakers_attest_first_level ctxt end module Consensus = struct diff --git a/src/proto_024_PsD5wVTJ/lib_protocol/alpha_context.mli b/src/proto_024_PsD5wVTJ/lib_protocol/alpha_context.mli index 9859f876ac7c..00a493c89b2c 100644 --- a/src/proto_024_PsD5wVTJ/lib_protocol/alpha_context.mli +++ b/src/proto_024_PsD5wVTJ/lib_protocol/alpha_context.mli @@ -2281,6 +2281,8 @@ module Attesting_power : sig val get_slots_from_result : result -> int + val all_bakers_attest_activation_level : context -> Level.t option + val check_all_bakers_attest_at_level : context -> attested_level:Level.t -> bool diff --git a/src/proto_024_PsD5wVTJ/lib_protocol/apply.ml b/src/proto_024_PsD5wVTJ/lib_protocol/apply.ml index bcb3c9f446e6..23e53d1affad 100644 --- a/src/proto_024_PsD5wVTJ/lib_protocol/apply.ml +++ b/src/proto_024_PsD5wVTJ/lib_protocol/apply.ml @@ -3228,7 +3228,7 @@ let finalize_application ctxt block_data_contents ~round ~predecessor_hash Nonce.record_hash ctxt {nonce_hash; delegate = block_producer.delegate} in let* ctxt, dal_attestation = Dal_apply.finalisation ctxt in - let* ctxt, reward_bonus = + let* ctxt, reward_bonus, attestation_result = let* required_attestations = are_attestations_required ctxt ~level:current_level.level in @@ -3244,8 +3244,49 @@ let finalize_application ctxt block_data_contents ~round ~predecessor_hash let* ctxt, rewards_bonus = Baking.bonus_baking_reward ctxt ~attested_level ~attesting_power in - return (ctxt, Some rewards_bonus) - else return (ctxt, None) + let* ctxt, consensus_committee = + Attesting_power.consensus_committee ctxt ~attested_level + in + let* ctxt, consensus_threshold = + Attesting_power.consensus_threshold ctxt ~attested_level + in + let consensus_recorded_power = + Attesting_power.get ctxt ~attested_level attesting_power + in + return + ( ctxt, + Some rewards_bonus, + Some + { + consensus_committee; + consensus_threshold; + consensus_recorded_power; + } ) + else return (ctxt, None, None) + in + let* ctxt, preattestation_result = + let lre = Consensus.locked_round_evidence ctxt in + match lre with + | None -> return (ctxt, None) + | Some (_round, preattesting_power) -> + let attested_level = current_level in + let* ctxt, consensus_committee = + Attesting_power.consensus_committee ctxt ~attested_level + in + let* ctxt, consensus_threshold = + Attesting_power.consensus_threshold ctxt ~attested_level + in + let consensus_recorded_power = + Attesting_power.get ctxt ~attested_level preattesting_power + in + return + ( ctxt, + Some + { + consensus_committee; + consensus_threshold; + consensus_recorded_power; + } ) in let*? baking_reward = Delegate.Rewards.baking_reward_fixed_portion ctxt in let* ctxt, baking_receipts = @@ -3270,6 +3311,9 @@ let finalize_application ctxt block_data_contents ~round ~predecessor_hash migration_balance_updates @ baking_receipts @ cycle_end_balance_updates in let+ voting_period_info = Voting_period.get_rpc_current_info ctxt in + let abaab_activation_level = + Attesting_power.all_bakers_attest_activation_level ctxt + in let receipt = Apply_results. { @@ -3284,6 +3328,9 @@ let finalize_application ctxt block_data_contents ~round ~predecessor_hash liquidity_baking_toggle_ema; implicit_operations_results; dal_attestation; + abaab_activation_level; + attestations = attestation_result; + preattestations = preattestation_result; } in (ctxt, receipt) @@ -3403,6 +3450,9 @@ let finalize_block (application_state : application_state) shell_header_opt = liquidity_baking_toggle_ema; implicit_operations_results; dal_attestation = Dal.Attestation.empty; + abaab_activation_level = None; + attestations = None; + preattestations = None; } ) | Application { diff --git a/src/proto_024_PsD5wVTJ/lib_protocol/apply_results.ml b/src/proto_024_PsD5wVTJ/lib_protocol/apply_results.ml index 03492b1eecc6..5513562d0fe7 100644 --- a/src/proto_024_PsD5wVTJ/lib_protocol/apply_results.ml +++ b/src/proto_024_PsD5wVTJ/lib_protocol/apply_results.ml @@ -2596,6 +2596,26 @@ let operation_data_and_metadata_encoding = (Operation_data {contents; signature}, No_operation_metadata)); ] +type attestations_result = { + consensus_committee : int64; + consensus_threshold : int64; + consensus_recorded_power : int64; +} + +let attestations_result_encoding = + def "block_header.alpha.attestations_result" + @@ conv + (fun {consensus_committee; consensus_threshold; consensus_recorded_power} + -> + (consensus_committee, consensus_threshold, consensus_recorded_power)) + (fun (consensus_committee, consensus_threshold, consensus_recorded_power) + -> + {consensus_committee; consensus_threshold; consensus_recorded_power}) + (obj3 + (req "total_committee_power" int64) + (req "threshold" int64) + (req "recorded_power" int64)) + type block_metadata = { proposer : Consensus_key.t; baker : Consensus_key.t; @@ -2608,6 +2628,9 @@ type block_metadata = { liquidity_baking_toggle_ema : Per_block_votes.Liquidity_baking_toggle_EMA.t; implicit_operations_results : packed_successful_manager_operation_result list; dal_attestation : Dal.Attestation.t; + abaab_activation_level : Level.t option; + attestations : attestations_result option; + preattestations : attestations_result option; } let block_metadata_encoding = @@ -2627,6 +2650,9 @@ let block_metadata_encoding = liquidity_baking_toggle_ema; implicit_operations_results; dal_attestation; + abaab_activation_level; + attestations; + preattestations; } -> ( ( proposer, @@ -2641,7 +2667,10 @@ let block_metadata_encoding = proposer_active_key, baker_active_key, consumed_gas, - dal_attestation ) )) + dal_attestation, + abaab_activation_level, + attestations, + preattestations ) )) (fun ( ( proposer, baker, level_info, @@ -2654,7 +2683,10 @@ let block_metadata_encoding = proposer_active_key, baker_active_key, consumed_gas, - dal_attestation ) ) + dal_attestation, + abaab_activation_level, + attestations, + preattestations ) ) -> { proposer = {delegate = proposer; consensus_pkh = proposer_active_key}; @@ -2668,6 +2700,9 @@ let block_metadata_encoding = liquidity_baking_toggle_ema; implicit_operations_results; dal_attestation; + abaab_activation_level; + attestations; + preattestations; }) (merge_objs (obj8 @@ -2681,11 +2716,14 @@ let block_metadata_encoding = (req "liquidity_baking_toggle_ema" Per_block_votes.Liquidity_baking_toggle_EMA.encoding)) - (obj5 + (obj8 (req "implicit_operations_results" (list successful_manager_operation_result_encoding)) (req "proposer_consensus_key" Signature.Public_key_hash.encoding) (req "baker_consensus_key" Signature.Public_key_hash.encoding) (req "consumed_milligas" Gas.Arith.n_fp_encoding) - (req "dal_attestation" Dal.Attestation.encoding))) + (req "dal_attestation" Dal.Attestation.encoding) + (req "all_bakers_attest_activation_level" (option Level.encoding)) + (req "attestations" (option attestations_result_encoding)) + (req "preattestations" (option attestations_result_encoding)))) diff --git a/src/proto_024_PsD5wVTJ/lib_protocol/apply_results.mli b/src/proto_024_PsD5wVTJ/lib_protocol/apply_results.mli index 2f3783021059..638d0ea99bbb 100644 --- a/src/proto_024_PsD5wVTJ/lib_protocol/apply_results.mli +++ b/src/proto_024_PsD5wVTJ/lib_protocol/apply_results.mli @@ -327,6 +327,12 @@ val kind_equal_list : 'kind2 contents_result_list -> ('kind, 'kind2) eq option +type attestations_result = { + consensus_committee : int64; + consensus_threshold : int64; + consensus_recorded_power : int64; +} + type block_metadata = { proposer : Consensus_key.t; baker : Consensus_key.t; @@ -339,6 +345,9 @@ type block_metadata = { liquidity_baking_toggle_ema : Per_block_votes.Liquidity_baking_toggle_EMA.t; implicit_operations_results : packed_successful_manager_operation_result list; dal_attestation : Dal.Attestation.t; + abaab_activation_level : Level.t option; + attestations : attestations_result option; + preattestations : attestations_result option; } val block_metadata_encoding : block_metadata Data_encoding.encoding -- GitLab From 4b33eb36e828fbef203ac32f15886b6ee0fdd986 Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Fri, 7 Nov 2025 16:45:33 +0100 Subject: [PATCH 6/8] Teztale: update --- teztale/bin_teztale_archiver/PsD5wVTJ_machine.real.ml | 9 ++++++--- teztale/bin_teztale_archiver/alpha_machine.real.ml | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/teztale/bin_teztale_archiver/PsD5wVTJ_machine.real.ml b/teztale/bin_teztale_archiver/PsD5wVTJ_machine.real.ml index 705b13ecc272..5aa694b22b46 100644 --- a/teztale/bin_teztale_archiver/PsD5wVTJ_machine.real.ml +++ b/teztale/bin_teztale_archiver/PsD5wVTJ_machine.real.ml @@ -241,7 +241,8 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind; }; delegate = Tezos_crypto.Signature.Of_V2.public_key_hash ck.delegate; - power = Protocol.Alpha_context.Attesting_power.get_slots power; + power = + Protocol.Alpha_context.Attesting_power.get_slots_from_result power; } :: acc) acc @@ -278,7 +279,8 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct delegate = Tezos_crypto.Signature.Of_V2.public_key_hash delegate; power = - Protocol.Alpha_context.Attesting_power.get_slots + Protocol.Alpha_context.Attesting_power + .get_slots_from_result consensus_power; } :: acc @@ -302,7 +304,8 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct delegate = Tezos_crypto.Signature.Of_V2.public_key_hash delegate; power = - Protocol.Alpha_context.Attesting_power.get_slots + Protocol.Alpha_context.Attesting_power + .get_slots_from_result consensus_power; } :: acc diff --git a/teztale/bin_teztale_archiver/alpha_machine.real.ml b/teztale/bin_teztale_archiver/alpha_machine.real.ml index 47a9ef3ad937..5c655ce7fd7a 100644 --- a/teztale/bin_teztale_archiver/alpha_machine.real.ml +++ b/teztale/bin_teztale_archiver/alpha_machine.real.ml @@ -241,7 +241,8 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind; }; delegate = Tezos_crypto.Signature.Of_V2.public_key_hash ck.delegate; - power = Protocol.Alpha_context.Attesting_power.get_slots power; + power = + Protocol.Alpha_context.Attesting_power.get_slots_from_result power; } :: acc) acc @@ -278,7 +279,8 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct delegate = Tezos_crypto.Signature.Of_V2.public_key_hash delegate; power = - Protocol.Alpha_context.Attesting_power.get_slots + Protocol.Alpha_context.Attesting_power + .get_slots_from_result consensus_power; } :: acc @@ -302,7 +304,8 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct delegate = Tezos_crypto.Signature.Of_V2.public_key_hash delegate; power = - Protocol.Alpha_context.Attesting_power.get_slots + Protocol.Alpha_context.Attesting_power + .get_slots_from_result consensus_power; } :: acc -- GitLab From f3f927e570662ead3b1e2aec473a6a9fbc40fcf5 Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Fri, 7 Nov 2025 16:48:53 +0100 Subject: [PATCH 7/8] Docs: update changelog --- docs/introduction/breaking_changes.rst | 23 ++++++++++++++++++----- docs/protocols/024_t024.rst | 18 +++++++++++++++--- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/docs/introduction/breaking_changes.rst b/docs/introduction/breaking_changes.rst index ee264e692fa7..2c11bc292332 100644 --- a/docs/introduction/breaking_changes.rst +++ b/docs/introduction/breaking_changes.rst @@ -48,7 +48,7 @@ period of withdrawal has decreased from ~14 days in protocol Seoul to Consensus changes ^^^^^^^^^^^^^^^^^ -With the All Bakers Attest feature implemented in protocol T024 comes changes to +With the All Bakers Attest feature implemented in protocol T024 come changes to the consensus. Most of these changes will take effect only when the feature activates, but in some cases, the format of operations or RPCs have been updated to include more information. @@ -56,10 +56,23 @@ more information. In particular, the attestation and preattestation receipts metadata have been updated. The ``consensus_power`` field is now divided in two parts: an integer field ``slots``, which corresponds to the number of slots attributed to the delegate, and represents -its consensus power until "All Bakers Attest" activates, and a string field -``stake`` parsed as an int64, which is the staking power of the delegate, and represents its consensus power -once All Bakers Attest activates. - +its consensus power until "All Bakers Attest" activates, and an optional string field +``baking_power`` parsed as an int64, which is the baking power of the delegate, and represents its consensus power +once "All Bakers Attest" activates. This last field is not in the receipt until +"All Bakers Attest" activates. + +To track the activation status of the "All Bakers Attest" feature, the field +``all_bakers_attest_activation_level`` has been added in the block metadata. +It returns the activation level of the feature if it is set to activate. +The field remains ``null`` otherwise. + +Additionally, fields related to the consensus were added in the block metadata: +``attestations`` and ``preattestations``. They can be ``null`` when the corresponding +consensus operations are not required in the block. Otherwise, they contain three fields: +the ``total_committee_power`` and ``threshold``, as described in +:ref:`the consensus documentation`, and the +``recorded_power``, summing the power of all (pre)attestations +of the block. Breaking changes to RPCs ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/protocols/024_t024.rst b/docs/protocols/024_t024.rst index 813ce48fcdb7..33fc96ba5c53 100644 --- a/docs/protocols/024_t024.rst +++ b/docs/protocols/024_t024.rst @@ -113,6 +113,17 @@ Blocks and block receipts /chains//blocks//context/adaptive_issuance_launch_cycle``. (MR :gl:`!19215`) +- Added fields related to consensus in block metadata: + ``attestations`` and ``preattestations``. They can be ``null`` when the corresponding + consensus operations are not required in the block. Otherwise, they contain three fields: + the ``total_committee_power`` and ``threshold``, as described in + :ref:`the consensus documentation`, and the + ``recorded_power``, summing the power of all (pre)attestations + of the block. (MR :gl:`!19835`) + +- Added ``all_bakers_attest_activation_level`` field in block metadata, + which returns the activation level of the "All Bakers Attest" feature if + the feature is set to activate. The field remains ``null`` otherwise. (MR :gl:`!19835`) Operation receipts ------------------ @@ -124,9 +135,10 @@ Operation receipts - **Breaking change** Updated attestation and preattestation receipts metadata. The ``consensus_power`` field is now divided in two parts: an integer field ``slots``, which corresponds to the number of slots attributed to the delegate, and represents - its consensus power until "All Bakers Attest" activates, and a string field - ``stake`` parsed as an int64, which is the staking power of the delegate, and represents its consensus power - once "All Bakers Attest" activates. (MR :gl:`!18915`) + its consensus power until "All Bakers Attest" activates, and an optional string field + ``baking_power`` parsed as an int64, which is the baking power of the delegate, and represents its consensus power + once "All Bakers Attest" activates. This last field is not in the receipt until + "All Bakers Attest" activates. (MRs :gl:`!18915`, :gl:`!19835`) Errors -- GitLab From 3dcbe43f2e9f791442168180c9807b00a361ac67 Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Thu, 13 Nov 2025 15:01:33 +0100 Subject: [PATCH 8/8] Tezt: reset regressions --- .../expected/baker_test.ml/Alpha- Baker rewards.out | 4 +++- .../expected/baker_test.ml/T024-- Baker rewards.out | 4 +++- ...g DAL L1 integration (Use all available slots).out | 11 +++++++++-- ...g DAL L1 integration (Use all available slots).out | 11 +++++++++-- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/tezt/tests/expected/baker_test.ml/Alpha- Baker rewards.out b/tezt/tests/expected/baker_test.ml/Alpha- Baker rewards.out index 81a19a0574ea..c0492902310d 100644 --- a/tezt/tests/expected/baker_test.ml/Alpha- Baker rewards.out +++ b/tezt/tests/expected/baker_test.ml/Alpha- Baker rewards.out @@ -129,4 +129,6 @@ "paid_storage_size_diff": "1" } ], "proposer_consensus_key": "[PUBLIC_KEY_HASH]", "baker_consensus_key": "[PUBLIC_KEY_HASH]", - "consumed_milligas": "0", "dal_attestation": "0" } + "consumed_milligas": "0", "dal_attestation": "0", + "all_bakers_attest_activation_level": null, "attestations": null, + "preattestations": null } diff --git a/tezt/tests/expected/baker_test.ml/T024-- Baker rewards.out b/tezt/tests/expected/baker_test.ml/T024-- Baker rewards.out index be5173a7d4d3..72f84d7a5c45 100644 --- a/tezt/tests/expected/baker_test.ml/T024-- Baker rewards.out +++ b/tezt/tests/expected/baker_test.ml/T024-- Baker rewards.out @@ -129,4 +129,6 @@ "paid_storage_size_diff": "1" } ], "proposer_consensus_key": "[PUBLIC_KEY_HASH]", "baker_consensus_key": "[PUBLIC_KEY_HASH]", - "consumed_milligas": "0", "dal_attestation": "0" } + "consumed_milligas": "0", "dal_attestation": "0", + "all_bakers_attest_activation_level": null, "attestations": null, + "preattestations": null } diff --git a/tezt/tests/expected/dal.ml/Alpha- Testing DAL L1 integration (Use all available slots).out b/tezt/tests/expected/dal.ml/Alpha- Testing DAL L1 integration (Use all available slots).out index 5f1c8a8fec6c..f10a33f39ef2 100644 --- a/tezt/tests/expected/dal.ml/Alpha- Testing DAL L1 integration (Use all available slots).out +++ b/tezt/tests/expected/dal.ml/Alpha- Testing DAL L1 integration (Use all available slots).out @@ -1,6 +1,6 @@ GET http://[HOST]:[PORT]/chains/main/blocks/head/metadata 200 OK -{"protocol":"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK","next_protocol":"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK","test_chain_status":{"status":"not_running"},"max_operations_ttl":3,"max_operation_data_length":32768,"max_block_header_length":289,"max_operation_list_length":[{"max_size":4194304,"max_op":2048},{"max_size":32768},{"max_size":135168,"max_op":132},{"max_size":524288}],"proposer":"[PUBLIC_KEY_HASH]","baker":"[PUBLIC_KEY_HASH]","level_info":{"level":3,"level_position":2,"cycle":0,"cycle_position":2,"expected_commitment":false},"voting_period_info":{"voting_period":{"index":0,"kind":"proposal","start_position":0},"position":2,"remaining":61},"nonce_hash":null,"deactivated":[],"balance_updates":[{"kind":"accumulator","category":"block fees","change":"-416000","origin":"block"},{"kind":"contract","contract":"[PUBLIC_KEY_HASH]","change":"416000","origin":"block"},{"kind":"minted","category":"baking rewards","change":"-40911","origin":"block"},{"kind":"freezer","category":"deposits","staker":{"baker_own_stake":"[PUBLIC_KEY_HASH]"},"change":"40911","origin":"block"},{"kind":"minted","category":"baking rewards","change":"-259099","origin":"block"},{"kind":"contract","contract":"[PUBLIC_KEY_HASH]","change":"259099","origin":"block"},{"kind":"minted","category":"baking bonuses","change":"-40879","origin":"block"},{"kind":"freezer","category":"deposits","staker":{"baker_own_stake":"[PUBLIC_KEY_HASH]"},"change":"40879","origin":"block"},{"kind":"minted","category":"baking bonuses","change":"-258897","origin":"block"},{"kind":"contract","contract":"[PUBLIC_KEY_HASH]","change":"258897","origin":"block"}],"liquidity_baking_toggle_ema":0,"implicit_operations_results":[{"kind":"transaction","storage":[{"int":"1"},{"int":"166766"},{"int":"100"},{"bytes":"01e927f00ef734dfc85919635e9afc9166c83ef9fc00"},{"bytes":"0115eb0104481a6d7921160bc982c5e0a561cd8a3a00"}],"balance_updates":[{"kind":"minted","category":"subsidy","change":"-83333","origin":"subsidy"},{"kind":"contract","contract":"[CONTRACT_HASH]","change":"83333","origin":"subsidy"}],"consumed_milligas":"207450","storage_size":"4629"}],"proposer_consensus_key":"[PUBLIC_KEY_HASH]","baker_consensus_key":"[PUBLIC_KEY_HASH]","consumed_milligas":"544000000","dal_attestation":"0"} +{"protocol":"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK","next_protocol":"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK","test_chain_status":{"status":"not_running"},"max_operations_ttl":3,"max_operation_data_length":32768,"max_block_header_length":289,"max_operation_list_length":[{"max_size":4194304,"max_op":2048},{"max_size":32768},{"max_size":135168,"max_op":132},{"max_size":524288}],"proposer":"[PUBLIC_KEY_HASH]","baker":"[PUBLIC_KEY_HASH]","level_info":{"level":3,"level_position":2,"cycle":0,"cycle_position":2,"expected_commitment":false},"voting_period_info":{"voting_period":{"index":0,"kind":"proposal","start_position":0},"position":2,"remaining":61},"nonce_hash":null,"deactivated":[],"balance_updates":[{"kind":"accumulator","category":"block fees","change":"-416000","origin":"block"},{"kind":"contract","contract":"[PUBLIC_KEY_HASH]","change":"416000","origin":"block"},{"kind":"minted","category":"baking rewards","change":"-40911","origin":"block"},{"kind":"freezer","category":"deposits","staker":{"baker_own_stake":"[PUBLIC_KEY_HASH]"},"change":"40911","origin":"block"},{"kind":"minted","category":"baking rewards","change":"-259099","origin":"block"},{"kind":"contract","contract":"[PUBLIC_KEY_HASH]","change":"259099","origin":"block"},{"kind":"minted","category":"baking bonuses","change":"-40879","origin":"block"},{"kind":"freezer","category":"deposits","staker":{"baker_own_stake":"[PUBLIC_KEY_HASH]"},"change":"40879","origin":"block"},{"kind":"minted","category":"baking bonuses","change":"-258897","origin":"block"},{"kind":"contract","contract":"[PUBLIC_KEY_HASH]","change":"258897","origin":"block"}],"liquidity_baking_toggle_ema":0,"implicit_operations_results":[{"kind":"transaction","storage":[{"int":"1"},{"int":"166766"},{"int":"100"},{"bytes":"01e927f00ef734dfc85919635e9afc9166c83ef9fc00"},{"bytes":"0115eb0104481a6d7921160bc982c5e0a561cd8a3a00"}],"balance_updates":[{"kind":"minted","category":"subsidy","change":"-83333","origin":"subsidy"},{"kind":"contract","contract":"[CONTRACT_HASH]","change":"83333","origin":"subsidy"}],"consumed_milligas":"207450","storage_size":"4629"}],"proposer_consensus_key":"[PUBLIC_KEY_HASH]","baker_consensus_key":"[PUBLIC_KEY_HASH]","consumed_milligas":"544000000","dal_attestation":"0","all_bakers_attest_activation_level":null,"attestations":{"total_committee_power":"256","threshold":"0","recorded_power":"256"},"preattestations":null} { "protocol": "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK", @@ -157,5 +157,12 @@ GET http://[HOST]:[PORT]/chains/main/blocks/head/metadata "proposer_consensus_key": "[PUBLIC_KEY_HASH]", "baker_consensus_key": "[PUBLIC_KEY_HASH]", "consumed_milligas": "544000000", - "dal_attestation": "0" + "dal_attestation": "0", + "all_bakers_attest_activation_level": null, + "attestations": { + "total_committee_power": "256", + "threshold": "0", + "recorded_power": "256" + }, + "preattestations": null } diff --git a/tezt/tests/expected/dal.ml/T024-- Testing DAL L1 integration (Use all available slots).out b/tezt/tests/expected/dal.ml/T024-- Testing DAL L1 integration (Use all available slots).out index d60f1adf96e0..193e1fe1da51 100644 --- a/tezt/tests/expected/dal.ml/T024-- Testing DAL L1 integration (Use all available slots).out +++ b/tezt/tests/expected/dal.ml/T024-- Testing DAL L1 integration (Use all available slots).out @@ -1,6 +1,6 @@ GET http://[HOST]:[PORT]/chains/main/blocks/head/metadata 200 OK -{"protocol":"PsD5wVTJc9Rg228rXbXbeoeEo8g3fgWH211U7V3qjUed11g5Gqk","next_protocol":"PsD5wVTJc9Rg228rXbXbeoeEo8g3fgWH211U7V3qjUed11g5Gqk","test_chain_status":{"status":"not_running"},"max_operations_ttl":3,"max_operation_data_length":32768,"max_block_header_length":289,"max_operation_list_length":[{"max_size":4194304,"max_op":2048},{"max_size":32768},{"max_size":135168,"max_op":132},{"max_size":524288}],"proposer":"[PUBLIC_KEY_HASH]","baker":"[PUBLIC_KEY_HASH]","level_info":{"level":3,"level_position":2,"cycle":0,"cycle_position":2,"expected_commitment":false},"voting_period_info":{"voting_period":{"index":0,"kind":"proposal","start_position":0},"position":2,"remaining":61},"nonce_hash":null,"deactivated":[],"balance_updates":[{"kind":"accumulator","category":"block fees","change":"-416000","origin":"block"},{"kind":"contract","contract":"[PUBLIC_KEY_HASH]","change":"416000","origin":"block"},{"kind":"minted","category":"baking rewards","change":"-40911","origin":"block"},{"kind":"freezer","category":"deposits","staker":{"baker_own_stake":"[PUBLIC_KEY_HASH]"},"change":"40911","origin":"block"},{"kind":"minted","category":"baking rewards","change":"-259099","origin":"block"},{"kind":"contract","contract":"[PUBLIC_KEY_HASH]","change":"259099","origin":"block"},{"kind":"minted","category":"baking bonuses","change":"-40879","origin":"block"},{"kind":"freezer","category":"deposits","staker":{"baker_own_stake":"[PUBLIC_KEY_HASH]"},"change":"40879","origin":"block"},{"kind":"minted","category":"baking bonuses","change":"-258897","origin":"block"},{"kind":"contract","contract":"[PUBLIC_KEY_HASH]","change":"258897","origin":"block"}],"liquidity_baking_toggle_ema":0,"implicit_operations_results":[{"kind":"transaction","storage":[{"int":"1"},{"int":"166766"},{"int":"100"},{"bytes":"01e927f00ef734dfc85919635e9afc9166c83ef9fc00"},{"bytes":"0115eb0104481a6d7921160bc982c5e0a561cd8a3a00"}],"balance_updates":[{"kind":"minted","category":"subsidy","change":"-83333","origin":"subsidy"},{"kind":"contract","contract":"[CONTRACT_HASH]","change":"83333","origin":"subsidy"}],"consumed_milligas":"207450","storage_size":"4629"}],"proposer_consensus_key":"[PUBLIC_KEY_HASH]","baker_consensus_key":"[PUBLIC_KEY_HASH]","consumed_milligas":"544000000","dal_attestation":"0"} +{"protocol":"PsD5wVTJc9Rg228rXbXbeoeEo8g3fgWH211U7V3qjUed11g5Gqk","next_protocol":"PsD5wVTJc9Rg228rXbXbeoeEo8g3fgWH211U7V3qjUed11g5Gqk","test_chain_status":{"status":"not_running"},"max_operations_ttl":3,"max_operation_data_length":32768,"max_block_header_length":289,"max_operation_list_length":[{"max_size":4194304,"max_op":2048},{"max_size":32768},{"max_size":135168,"max_op":132},{"max_size":524288}],"proposer":"[PUBLIC_KEY_HASH]","baker":"[PUBLIC_KEY_HASH]","level_info":{"level":3,"level_position":2,"cycle":0,"cycle_position":2,"expected_commitment":false},"voting_period_info":{"voting_period":{"index":0,"kind":"proposal","start_position":0},"position":2,"remaining":61},"nonce_hash":null,"deactivated":[],"balance_updates":[{"kind":"accumulator","category":"block fees","change":"-416000","origin":"block"},{"kind":"contract","contract":"[PUBLIC_KEY_HASH]","change":"416000","origin":"block"},{"kind":"minted","category":"baking rewards","change":"-40911","origin":"block"},{"kind":"freezer","category":"deposits","staker":{"baker_own_stake":"[PUBLIC_KEY_HASH]"},"change":"40911","origin":"block"},{"kind":"minted","category":"baking rewards","change":"-259099","origin":"block"},{"kind":"contract","contract":"[PUBLIC_KEY_HASH]","change":"259099","origin":"block"},{"kind":"minted","category":"baking bonuses","change":"-40879","origin":"block"},{"kind":"freezer","category":"deposits","staker":{"baker_own_stake":"[PUBLIC_KEY_HASH]"},"change":"40879","origin":"block"},{"kind":"minted","category":"baking bonuses","change":"-258897","origin":"block"},{"kind":"contract","contract":"[PUBLIC_KEY_HASH]","change":"258897","origin":"block"}],"liquidity_baking_toggle_ema":0,"implicit_operations_results":[{"kind":"transaction","storage":[{"int":"1"},{"int":"166766"},{"int":"100"},{"bytes":"01e927f00ef734dfc85919635e9afc9166c83ef9fc00"},{"bytes":"0115eb0104481a6d7921160bc982c5e0a561cd8a3a00"}],"balance_updates":[{"kind":"minted","category":"subsidy","change":"-83333","origin":"subsidy"},{"kind":"contract","contract":"[CONTRACT_HASH]","change":"83333","origin":"subsidy"}],"consumed_milligas":"207450","storage_size":"4629"}],"proposer_consensus_key":"[PUBLIC_KEY_HASH]","baker_consensus_key":"[PUBLIC_KEY_HASH]","consumed_milligas":"544000000","dal_attestation":"0","all_bakers_attest_activation_level":null,"attestations":{"total_committee_power":"256","threshold":"0","recorded_power":"256"},"preattestations":null} { "protocol": "PsD5wVTJc9Rg228rXbXbeoeEo8g3fgWH211U7V3qjUed11g5Gqk", @@ -157,5 +157,12 @@ GET http://[HOST]:[PORT]/chains/main/blocks/head/metadata "proposer_consensus_key": "[PUBLIC_KEY_HASH]", "baker_consensus_key": "[PUBLIC_KEY_HASH]", "consumed_milligas": "544000000", - "dal_attestation": "0" + "dal_attestation": "0", + "all_bakers_attest_activation_level": null, + "attestations": { + "total_committee_power": "256", + "threshold": "0", + "recorded_power": "256" + }, + "preattestations": null } -- GitLab