From 86232e701631b5d5e765b3ae2b7f9e5012a9514a Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Tue, 6 May 2025 12:41:07 +0200 Subject: [PATCH 1/3] Proto: update consensus power to int64 --- .../alpha__operation__data_and_metadata.ksy | 6 +++--- .../lib_client/operation_result.ml | 10 +++++----- src/proto_alpha/lib_protocol/apply.ml | 20 +++++++++++++------ src/proto_alpha/lib_protocol/apply_results.ml | 18 ++++++++--------- .../lib_protocol/apply_results.mli | 12 +++++------ 5 files changed, 37 insertions(+), 29 deletions(-) diff --git a/client-libs/kaitai-struct-files/files/alpha__operation__data_and_metadata.ksy b/client-libs/kaitai-struct-files/files/alpha__operation__data_and_metadata.ksy index bba5364b9023..68d86ec6b5f6 100644 --- a/client-libs/kaitai-struct-files/files/alpha__operation__data_and_metadata.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__operation__data_and_metadata.ksy @@ -1632,7 +1632,7 @@ types: type: public_key_hash doc: A Ed25519, Secp256k1, P256, or BLS public key hash - id: consensus_power - type: int31 + type: s8be committee_entries_1: seq: - id: committee_elt @@ -2138,7 +2138,7 @@ types: type: public_key_hash doc: A Ed25519, Secp256k1, P256, or BLS public key hash - id: consensus_power - type: int31 + type: s8be - id: consensus_key type: public_key_hash doc: A Ed25519, Secp256k1, P256, or BLS public key hash @@ -2149,7 +2149,7 @@ types: - id: committee type: committee_2 - id: total_consensus_power - type: int31 + type: s8be metadata_1: seq: - id: punished_delegate diff --git a/src/proto_alpha/lib_client/operation_result.ml b/src/proto_alpha/lib_client/operation_result.ml index 200fb656e5fe..0cd569c5d694 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -982,7 +982,7 @@ let pp_contents_and_result : rewarded_delegate in let pp_committee ppf (delegate, voting_power) = - Format.fprintf ppf "(%a, %d)" Consensus_key.pp delegate voting_power + Format.fprintf ppf "(%a, %Ld)" Consensus_key.pp delegate voting_power in fun ppf -> function | Seed_nonce_revelation {level; nonce}, Seed_nonce_revelation_result bus -> @@ -1027,7 +1027,7 @@ let pp_contents_and_result : Level: %a@,\ Balance updates:%a@,\ Delegate: %a@,\ - Consensus Power: %d@]" + Consensus Power: %Ld@]" Raw_level.pp level pp_balance_updates @@ -1044,7 +1044,7 @@ let pp_contents_and_result : Level: %a@,\ Balance updates:%a@,\ Delegate: %a@,\ - Consensus Power: %d@]" + Consensus Power: %Ld@]" Raw_level.pp level pp_balance_updates @@ -1061,7 +1061,7 @@ let pp_contents_and_result : Level: %a@,\ Balance updates:%a@,\ Delegates: %a@,\ - Consensus Power: %d@]" + Consensus Power: %Ld@]" Raw_level.pp level pp_balance_updates @@ -1078,7 +1078,7 @@ let pp_contents_and_result : Level: %a@,\ Balance updates:%a@,\ Delegates: %a@,\ - Consensus Power: %d@]" + Consensus Power: %Ld@]" Raw_level.pp level pp_balance_updates diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index b8e5d86d6220..a1f33efe48ec 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -2330,6 +2330,7 @@ let record_preattestation ctxt (mode : mode) (content : consensus_content) : ~power content.round in + let power = Int64.of_int power in return (ctxt, mk_preattestation_result consensus_key power) | Partial_construction _ -> (* In mempool mode, preattestations are allowed for various levels @@ -2343,7 +2344,7 @@ let record_preattestation ctxt (mode : mode) (content : consensus_content) : let level = Level.from_raw ctxt content.level in Stake_distribution.slot_owner ctxt level content.slot in - return (ctxt, mk_preattestation_result consensus_key 0 (* Fake power. *)) + return (ctxt, mk_preattestation_result consensus_key 0L (* Fake power. *)) let record_dal_content ctxt slot ~dal_power = function | None -> Result.return ctxt @@ -2378,6 +2379,7 @@ let record_attestation ctxt (mode : mode) (consensus : consensus_content) Consensus.record_attestation ctxt ~initial_slot:consensus.slot ~power in let*? ctxt = record_dal_content ctxt consensus.slot ~dal_power dal in + let power = Int64.of_int power in return (ctxt, mk_attestation_result consensus_key power) | Partial_construction _ -> (* In mempool mode, attestations are allowed for various levels @@ -2391,7 +2393,7 @@ let record_attestation ctxt (mode : mode) (consensus : consensus_content) let level = Level.from_raw ctxt consensus.level in Stake_distribution.slot_owner ctxt level consensus.slot in - return (ctxt, mk_attestation_result consensus_key 0 (* Fake power. *)) + return (ctxt, mk_attestation_result consensus_key 0L (* Fake power. *)) let record_attestations_aggregate ctxt (mode : mode) committee : (context * Kind.attestations_aggregate contents_result_list) tzresult Lwt.t @@ -2412,9 +2414,12 @@ let record_attestations_aggregate ctxt (mode : mode) committee : in let* ctxt = record_dal_content ctxt slot ~dal_power dal in let key = ({delegate; consensus_pkh} : Consensus_key.t) in + let power = Int64.of_int power in return - (ctxt, (key, power) :: consensus_keys, power + consensus_power)) - (ctxt, [], 0) + ( ctxt, + (key, power) :: consensus_keys, + Int64.add power consensus_power )) + (ctxt, [], 0L) committee in let result = @@ -2464,9 +2469,12 @@ let record_preattestations_aggregate ctxt (mode : mode) round in let key = ({delegate; consensus_pkh} : Consensus_key.t) in + let power = Int64.of_int power in return - (ctxt, (key, power) :: consensus_keys, power + consensus_power)) - (ctxt, [], 0) + ( ctxt, + (key, power) :: consensus_keys, + Int64.add power consensus_power )) + (ctxt, [], 0L) committee in let result = diff --git a/src/proto_alpha/lib_protocol/apply_results.ml b/src/proto_alpha/lib_protocol/apply_results.ml index 609d28bdb3c8..b49cb0abfdf5 100644 --- a/src/proto_alpha/lib_protocol/apply_results.ml +++ b/src/proto_alpha/lib_protocol/apply_results.ml @@ -888,26 +888,26 @@ type 'kind contents_result = balance_updates : Receipt.balance_updates; delegate : Signature.public_key_hash; consensus_key : Signature.public_key_hash; - consensus_power : int; + consensus_power : int64; } -> Kind.preattestation contents_result | Attestation_result : { balance_updates : Receipt.balance_updates; delegate : Signature.public_key_hash; consensus_key : Signature.public_key_hash; - consensus_power : int; + consensus_power : int64; } -> Kind.attestation contents_result | Preattestations_aggregate_result : { balance_updates : Receipt.balance_updates; - committee : (Consensus_key.t * int) list; - total_consensus_power : int; + committee : (Consensus_key.t * int64) list; + total_consensus_power : int64; } -> Kind.preattestations_aggregate contents_result | Attestations_aggregate_result : { balance_updates : Receipt.balance_updates; - committee : (Consensus_key.t * int) list; - total_consensus_power : int; + committee : (Consensus_key.t * int64) list; + total_consensus_power : int64; } -> Kind.attestations_aggregate contents_result | Seed_nonce_revelation_result : @@ -1035,7 +1035,7 @@ module Encoding = struct obj4 (dft "balance_updates" Receipt.balance_updates_encoding []) (req "delegate" Signature.Public_key_hash.encoding) - (req "consensus_power" int31) + (req "consensus_power" int64) (req "consensus_key" Signature.Public_key_hash.encoding) let consensus_aggregate_result_encoding = @@ -1047,8 +1047,8 @@ module Encoding = struct (list (merge_objs Consensus_key.encoding - (obj1 (req "consensus_power" int31))))) - (req "total_consensus_power" int31) + (obj1 (req "consensus_power" int64))))) + (req "total_consensus_power" int64) type case = | Case : { diff --git a/src/proto_alpha/lib_protocol/apply_results.mli b/src/proto_alpha/lib_protocol/apply_results.mli index 6fa6fab25c51..5b4a42e0b910 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 : int; + consensus_power : int64; } -> Kind.preattestation contents_result | Attestation_result : { balance_updates : Receipt.balance_updates; delegate : Signature.public_key_hash; consensus_key : Signature.public_key_hash; - consensus_power : int; + consensus_power : int64; } -> Kind.attestation contents_result | Preattestations_aggregate_result : { balance_updates : Receipt.balance_updates; - committee : (Consensus_key.t * int) list; - total_consensus_power : int; + committee : (Consensus_key.t * int64) list; + total_consensus_power : int64; } -> Kind.preattestations_aggregate contents_result | Attestations_aggregate_result : { balance_updates : Receipt.balance_updates; - committee : (Consensus_key.t * int) list; - total_consensus_power : int; + committee : (Consensus_key.t * int64) list; + total_consensus_power : int64; } -> Kind.attestations_aggregate contents_result | Seed_nonce_revelation_result : -- GitLab From 7657932f7be99ea59dfd55f2733db91a8eab3c9b Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Tue, 10 Dec 2024 14:43:42 +0100 Subject: [PATCH 2/3] Teztale: update --- .../Proxford_machine.real.ml | 6 ++-- .../PsBabyM1_machine.real.ml | 4 +-- .../PsCARTHA_machine.real.ml | 4 +-- .../PsDELPH1_machine.real.ml | 4 +-- .../PsFLoren_machine.real.ml | 4 +-- .../PsParisC_machine.real.ml | 6 ++-- .../PsQuebec_machine.real.ml | 6 ++-- .../PsRiotum_machine.real.ml | 6 ++-- .../PsYLVpVv_machine.real.ml | 4 +-- .../PsddFKi3_machine.real.ml | 4 +-- .../Psithaca_machine.real.ml | 6 ++-- .../Pt24m4xi_machine.real.ml | 4 +-- .../PtCJ7pwo_machine.real.ml | 4 +-- .../PtEdo2Zk_machine.real.ml | 4 +-- .../PtGRANAD_machine.real.ml | 4 +-- .../PtHangz2_machine.real.ml | 4 +-- .../PtJakart_machine.real.ml | 6 ++-- .../PtKathma_machine.real.ml | 6 ++-- .../PtLimaPt_machine.real.ml | 6 ++-- .../PtMumbai_machine.real.ml | 6 ++-- .../PtNairob_machine.real.ml | 6 ++-- .../PtParisB_machine.real.ml | 6 ++-- .../PtSeouLo_machine.real.ml | 8 ++--- .../alpha_machine.real.ml | 2 +- teztale/bin_teztale_server/exporter.ml | 2 +- teztale/bin_teztale_server/sql_requests.ml | 4 +-- teztale/bin_teztale_server/sql_requests.mli | 2 +- teztale/bin_teztale_snitch/reporting.ml | 29 ++++++++++--------- teztale/lib_teztale_base/consensus_ops.ml | 8 ++--- teztale/lib_teztale_base/consensus_ops.mli | 4 +-- teztale/lib_teztale_base/data.ml | 8 ++--- 31 files changed, 89 insertions(+), 88 deletions(-) diff --git a/teztale/bin_teztale_archiver/Proxford_machine.real.ml b/teztale/bin_teztale_archiver/Proxford_machine.real.ml index f584cfdfb774..6c6e654c178f 100644 --- a/teztale/bin_teztale_archiver/Proxford_machine.real.ml +++ b/teztale/bin_teztale_archiver/Proxford_machine.real.ml @@ -48,7 +48,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct address = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; first_slot = slot_to_int first_slot; - power = attestation_power; + power = Int64.of_int attestation_power; }) answer.Plugin.RPC.Attestation_rights.delegates_rights) | [] -> return_nil @@ -239,7 +239,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Preattestation; }; delegate = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; - power = consensus_power; + power = Int64.of_int consensus_power; } :: acc | Receipt @@ -259,7 +259,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Attestation; }; delegate = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; - power = consensus_power; + power = Int64.of_int consensus_power; } :: acc | _ -> acc) diff --git a/teztale/bin_teztale_archiver/PsBabyM1_machine.real.ml b/teztale/bin_teztale_archiver/PsBabyM1_machine.real.ml index 9f814b43c0ca..c524da064976 100644 --- a/teztale/bin_teztale_archiver/PsBabyM1_machine.real.ml +++ b/teztale/bin_teztale_archiver/PsBabyM1_machine.real.ml @@ -43,7 +43,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { address = public_key_hash_of_v0 delegate; first_slot = Stdlib.List.hd (List.sort compare slots); - power = List.length slots; + power = Int64.of_int @@ List.length slots; }) rights @@ -191,7 +191,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { op = {hash; round = None; kind = Consensus_ops.Attestation}; delegate = public_key_hash_of_v0 delegate; - power = List.length slots; + power = Int64.of_int @@ List.length slots; } | _ -> None) ops diff --git a/teztale/bin_teztale_archiver/PsCARTHA_machine.real.ml b/teztale/bin_teztale_archiver/PsCARTHA_machine.real.ml index a6a45fd4e6df..8fa39db592f4 100644 --- a/teztale/bin_teztale_archiver/PsCARTHA_machine.real.ml +++ b/teztale/bin_teztale_archiver/PsCARTHA_machine.real.ml @@ -43,7 +43,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { address = public_key_hash_of_v0 delegate; first_slot = Stdlib.List.hd (List.sort compare slots); - power = List.length slots; + power = Int64.of_int @@ List.length slots; }) rights @@ -191,7 +191,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { op = {hash; round = None; kind = Consensus_ops.Attestation}; delegate = public_key_hash_of_v0 delegate; - power = List.length slots; + power = Int64.of_int @@ List.length slots; } | _ -> None) ops diff --git a/teztale/bin_teztale_archiver/PsDELPH1_machine.real.ml b/teztale/bin_teztale_archiver/PsDELPH1_machine.real.ml index 1d68c2ee667d..12e4a2224269 100644 --- a/teztale/bin_teztale_archiver/PsDELPH1_machine.real.ml +++ b/teztale/bin_teztale_archiver/PsDELPH1_machine.real.ml @@ -43,7 +43,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { address = public_key_hash_of_v0 delegate; first_slot = Stdlib.List.hd (List.sort compare slots); - power = List.length slots; + power = Int64.of_int @@ List.length slots; }) rights @@ -191,7 +191,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { op = {hash; round = None; kind = Consensus_ops.Attestation}; delegate = public_key_hash_of_v0 delegate; - power = List.length slots; + power = Int64.of_int @@ List.length slots; } | _ -> None) ops diff --git a/teztale/bin_teztale_archiver/PsFLoren_machine.real.ml b/teztale/bin_teztale_archiver/PsFLoren_machine.real.ml index e9083c8845aa..01cae474db37 100644 --- a/teztale/bin_teztale_archiver/PsFLoren_machine.real.ml +++ b/teztale/bin_teztale_archiver/PsFLoren_machine.real.ml @@ -44,7 +44,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { address = public_key_hash_of_v0 delegate; first_slot = Stdlib.List.hd (List.sort compare slots); - power = List.length slots; + power = Int64.of_int @@ List.length slots; }) rights @@ -206,7 +206,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { op = {hash; round = None; kind = Consensus_ops.Attestation}; delegate = public_key_hash_of_v0 delegate; - power = List.length slots; + power = Int64.of_int @@ List.length slots; } | _ -> None) ops diff --git a/teztale/bin_teztale_archiver/PsParisC_machine.real.ml b/teztale/bin_teztale_archiver/PsParisC_machine.real.ml index f073618a1b7f..d12dc55e67a5 100644 --- a/teztale/bin_teztale_archiver/PsParisC_machine.real.ml +++ b/teztale/bin_teztale_archiver/PsParisC_machine.real.ml @@ -48,7 +48,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct address = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; first_slot = slot_to_int first_slot; - power = attestation_power; + power = Int64.of_int attestation_power; }) answer.Plugin.RPC.Attestation_rights.delegates_rights) | [] -> return_nil @@ -244,7 +244,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Preattestation; }; delegate = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; - power = consensus_power; + power = Int64.of_int consensus_power; } :: acc | Receipt @@ -264,7 +264,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Attestation; }; delegate = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; - power = consensus_power; + power = Int64.of_int consensus_power; } :: acc | _ -> acc) diff --git a/teztale/bin_teztale_archiver/PsQuebec_machine.real.ml b/teztale/bin_teztale_archiver/PsQuebec_machine.real.ml index 16d10a04acd9..6592f0c29264 100644 --- a/teztale/bin_teztale_archiver/PsQuebec_machine.real.ml +++ b/teztale/bin_teztale_archiver/PsQuebec_machine.real.ml @@ -48,7 +48,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct address = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; first_slot = slot_to_int first_slot; - power = attestation_power; + power = Int64.of_int attestation_power; }) answer.Plugin.RPC.Attestation_rights.delegates_rights) | [] -> return_nil @@ -244,7 +244,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Preattestation; }; delegate = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; - power = consensus_power; + power = Int64.of_int consensus_power; } :: acc | Receipt @@ -264,7 +264,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Attestation; }; delegate = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; - power = consensus_power; + power = Int64.of_int consensus_power; } :: acc | _ -> acc) diff --git a/teztale/bin_teztale_archiver/PsRiotum_machine.real.ml b/teztale/bin_teztale_archiver/PsRiotum_machine.real.ml index 02995396121d..19fa414e470a 100644 --- a/teztale/bin_teztale_archiver/PsRiotum_machine.real.ml +++ b/teztale/bin_teztale_archiver/PsRiotum_machine.real.ml @@ -48,7 +48,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct address = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; first_slot = slot_to_int first_slot; - power = attestation_power; + power = Int64.of_int attestation_power; }) answer.Plugin.RPC.Attestation_rights.delegates_rights) | [] -> return_nil @@ -244,7 +244,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Preattestation; }; delegate = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; - power = consensus_power; + power = Int64.of_int consensus_power; } :: acc | Receipt @@ -264,7 +264,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Attestation; }; delegate = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; - power = consensus_power; + power = Int64.of_int consensus_power; } :: acc | _ -> acc) diff --git a/teztale/bin_teztale_archiver/PsYLVpVv_machine.real.ml b/teztale/bin_teztale_archiver/PsYLVpVv_machine.real.ml index 08fe58d022f2..f4517fa0da1a 100644 --- a/teztale/bin_teztale_archiver/PsYLVpVv_machine.real.ml +++ b/teztale/bin_teztale_archiver/PsYLVpVv_machine.real.ml @@ -43,7 +43,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { address = public_key_hash_of_v0 delegate; first_slot = Stdlib.List.hd (List.sort compare slots); - power = List.length slots; + power = Int64.of_int @@ List.length slots; }) rights @@ -191,7 +191,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { op = {hash; round = None; kind = Consensus_ops.Attestation}; delegate = public_key_hash_of_v0 delegate; - power = List.length slots; + power = Int64.of_int @@ List.length slots; } | _ -> None) ops diff --git a/teztale/bin_teztale_archiver/PsddFKi3_machine.real.ml b/teztale/bin_teztale_archiver/PsddFKi3_machine.real.ml index 88c78b1b532e..42ea25096e5f 100644 --- a/teztale/bin_teztale_archiver/PsddFKi3_machine.real.ml +++ b/teztale/bin_teztale_archiver/PsddFKi3_machine.real.ml @@ -43,7 +43,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { address = public_key_hash_of_v0 delegate; first_slot = Stdlib.List.hd (List.sort compare slots); - power = List.length slots; + power = Int64.of_int @@ List.length slots; }) rights @@ -191,7 +191,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { op = {hash; round = None; kind = Consensus_ops.Attestation}; delegate = public_key_hash_of_v0 delegate; - power = List.length slots; + power = Int64.of_int @@ List.length slots; } | _ -> None) ops diff --git a/teztale/bin_teztale_archiver/Psithaca_machine.real.ml b/teztale/bin_teztale_archiver/Psithaca_machine.real.ml index c63bdd6490e6..fce7d33317d8 100644 --- a/teztale/bin_teztale_archiver/Psithaca_machine.real.ml +++ b/teztale/bin_teztale_archiver/Psithaca_machine.real.ml @@ -54,7 +54,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { address = public_key_hash_of_v0 delegate; first_slot = slot_to_int first_slot; - power = endorsing_power; + power = Int64.of_int endorsing_power; }) answer.Plugin.RPC.Endorsing_rights.delegates_rights) | [] -> return_nil @@ -242,7 +242,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Preattestation; }; delegate = public_key_hash_of_v0 delegate; - power = preendorsement_power; + power = Int64.of_int preendorsement_power; } :: acc | Receipt @@ -262,7 +262,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Attestation; }; delegate = public_key_hash_of_v0 delegate; - power = endorsement_power; + power = Int64.of_int endorsement_power; } :: acc | _ -> acc) diff --git a/teztale/bin_teztale_archiver/Pt24m4xi_machine.real.ml b/teztale/bin_teztale_archiver/Pt24m4xi_machine.real.ml index 48555667e471..f8f1a780645a 100644 --- a/teztale/bin_teztale_archiver/Pt24m4xi_machine.real.ml +++ b/teztale/bin_teztale_archiver/Pt24m4xi_machine.real.ml @@ -43,7 +43,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { address = public_key_hash_of_v0 delegate; first_slot = Stdlib.List.hd (List.sort compare slots); - power = List.length slots; + power = Int64.of_int @@ List.length slots; }) rights @@ -191,7 +191,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { op = {hash; round = None; kind = Consensus_ops.Attestation}; delegate = public_key_hash_of_v0 delegate; - power = List.length slots; + power = Int64.of_int @@ List.length slots; } | _ -> None) ops diff --git a/teztale/bin_teztale_archiver/PtCJ7pwo_machine.real.ml b/teztale/bin_teztale_archiver/PtCJ7pwo_machine.real.ml index 39f88ec6e08d..32e950a23ce3 100644 --- a/teztale/bin_teztale_archiver/PtCJ7pwo_machine.real.ml +++ b/teztale/bin_teztale_archiver/PtCJ7pwo_machine.real.ml @@ -43,7 +43,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { address = public_key_hash_of_v0 delegate; first_slot = Stdlib.List.hd (List.sort compare slots); - power = List.length slots; + power = Int64.of_int @@ List.length slots; }) rights @@ -191,7 +191,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { op = {hash; round = None; kind = Consensus_ops.Attestation}; delegate = public_key_hash_of_v0 delegate; - power = List.length slots; + power = Int64.of_int @@ List.length slots; } | _ -> None) ops diff --git a/teztale/bin_teztale_archiver/PtEdo2Zk_machine.real.ml b/teztale/bin_teztale_archiver/PtEdo2Zk_machine.real.ml index 9ac3d670db5c..e0591a805567 100644 --- a/teztale/bin_teztale_archiver/PtEdo2Zk_machine.real.ml +++ b/teztale/bin_teztale_archiver/PtEdo2Zk_machine.real.ml @@ -43,7 +43,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { address = public_key_hash_of_v0 delegate; first_slot = Stdlib.List.hd (List.sort compare slots); - power = List.length slots; + power = Int64.of_int @@ List.length slots; }) rights @@ -191,7 +191,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { op = {hash; round = None; kind = Consensus_ops.Attestation}; delegate = public_key_hash_of_v0 delegate; - power = List.length slots; + power = Int64.of_int @@ List.length slots; } | _ -> None) ops diff --git a/teztale/bin_teztale_archiver/PtGRANAD_machine.real.ml b/teztale/bin_teztale_archiver/PtGRANAD_machine.real.ml index ba206067c682..9c0f0d8fdac4 100644 --- a/teztale/bin_teztale_archiver/PtGRANAD_machine.real.ml +++ b/teztale/bin_teztale_archiver/PtGRANAD_machine.real.ml @@ -44,7 +44,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { address = public_key_hash_of_v0 delegate; first_slot = Stdlib.List.hd (List.sort compare slots); - power = List.length slots; + power = Int64.of_int @@ List.length slots; }) rights @@ -206,7 +206,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { op = {hash; round = None; kind = Consensus_ops.Attestation}; delegate = public_key_hash_of_v0 delegate; - power = List.length slots; + power = Int64.of_int @@ List.length slots; } | _ -> None) ops diff --git a/teztale/bin_teztale_archiver/PtHangz2_machine.real.ml b/teztale/bin_teztale_archiver/PtHangz2_machine.real.ml index d6509dd73ad7..47cd2c5bc90a 100644 --- a/teztale/bin_teztale_archiver/PtHangz2_machine.real.ml +++ b/teztale/bin_teztale_archiver/PtHangz2_machine.real.ml @@ -45,7 +45,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { address = public_key_hash_of_v0 delegate; first_slot = Stdlib.List.hd (List.sort compare slots); - power = List.length slots; + power = Int64.of_int @@ List.length slots; }) rights @@ -207,7 +207,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { op = {hash; round = None; kind = Consensus_ops.Attestation}; delegate = public_key_hash_of_v0 delegate; - power = List.length slots; + power = Int64.of_int @@ List.length slots; } | _ -> None) ops diff --git a/teztale/bin_teztale_archiver/PtJakart_machine.real.ml b/teztale/bin_teztale_archiver/PtJakart_machine.real.ml index 751cefd63e6a..3bddcf4bd722 100644 --- a/teztale/bin_teztale_archiver/PtJakart_machine.real.ml +++ b/teztale/bin_teztale_archiver/PtJakart_machine.real.ml @@ -54,7 +54,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { address = public_key_hash_of_v0 delegate; first_slot = slot_to_int first_slot; - power = endorsing_power; + power = Int64.of_int endorsing_power; }) answer.Plugin.RPC.Endorsing_rights.delegates_rights) | [] -> return_nil @@ -242,7 +242,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Preattestation; }; delegate = public_key_hash_of_v0 delegate; - power = preendorsement_power; + power = Int64.of_int preendorsement_power; } :: acc | Receipt @@ -262,7 +262,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Attestation; }; delegate = public_key_hash_of_v0 delegate; - power = endorsement_power; + power = Int64.of_int endorsement_power; } :: acc | _ -> acc) diff --git a/teztale/bin_teztale_archiver/PtKathma_machine.real.ml b/teztale/bin_teztale_archiver/PtKathma_machine.real.ml index 2da376ff4cc4..3a8769d99c0c 100644 --- a/teztale/bin_teztale_archiver/PtKathma_machine.real.ml +++ b/teztale/bin_teztale_archiver/PtKathma_machine.real.ml @@ -54,7 +54,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { address = public_key_hash_of_v0 delegate; first_slot = slot_to_int first_slot; - power = endorsing_power; + power = Int64.of_int endorsing_power; }) answer.Plugin.RPC.Endorsing_rights.delegates_rights) | [] -> return_nil @@ -242,7 +242,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Preattestation; }; delegate = public_key_hash_of_v0 delegate; - power = preendorsement_power; + power = Int64.of_int preendorsement_power; } :: acc | Receipt @@ -262,7 +262,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Attestation; }; delegate = public_key_hash_of_v0 delegate; - power = endorsement_power; + power = Int64.of_int endorsement_power; } :: acc | _ -> acc) diff --git a/teztale/bin_teztale_archiver/PtLimaPt_machine.real.ml b/teztale/bin_teztale_archiver/PtLimaPt_machine.real.ml index a3186dded940..31ba52514866 100644 --- a/teztale/bin_teztale_archiver/PtLimaPt_machine.real.ml +++ b/teztale/bin_teztale_archiver/PtLimaPt_machine.real.ml @@ -54,7 +54,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct { address = public_key_hash_of_v0 delegate; first_slot = slot_to_int first_slot; - power = endorsing_power; + power = Int64.of_int endorsing_power; }) answer.Plugin.RPC.Endorsing_rights.delegates_rights) | [] -> return_nil @@ -243,7 +243,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Preattestation; }; delegate = public_key_hash_of_v0 delegate; - power = preendorsement_power; + power = Int64.of_int preendorsement_power; } :: acc | Receipt @@ -263,7 +263,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Attestation; }; delegate = public_key_hash_of_v0 delegate; - power = endorsement_power; + power = Int64.of_int endorsement_power; } :: acc | _ -> acc) diff --git a/teztale/bin_teztale_archiver/PtMumbai_machine.real.ml b/teztale/bin_teztale_archiver/PtMumbai_machine.real.ml index 72a2b7814cc3..24b7141c3e92 100644 --- a/teztale/bin_teztale_archiver/PtMumbai_machine.real.ml +++ b/teztale/bin_teztale_archiver/PtMumbai_machine.real.ml @@ -48,7 +48,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct address = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; first_slot = slot_to_int first_slot; - power = endorsing_power; + power = Int64.of_int endorsing_power; }) answer.Plugin.RPC.Endorsing_rights.delegates_rights) | [] -> return_nil @@ -239,7 +239,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Preattestation; }; delegate = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; - power = preendorsement_power; + power = Int64.of_int preendorsement_power; } :: acc | Receipt @@ -259,7 +259,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Attestation; }; delegate = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; - power = endorsement_power; + power = Int64.of_int endorsement_power; } :: acc | _ -> acc) diff --git a/teztale/bin_teztale_archiver/PtNairob_machine.real.ml b/teztale/bin_teztale_archiver/PtNairob_machine.real.ml index 2387abcacc5c..c8f14ef95e7d 100644 --- a/teztale/bin_teztale_archiver/PtNairob_machine.real.ml +++ b/teztale/bin_teztale_archiver/PtNairob_machine.real.ml @@ -48,7 +48,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct address = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; first_slot = slot_to_int first_slot; - power = attestation_power; + power = Int64.of_int attestation_power; }) answer.Plugin.RPC.Attestation_rights.delegates_rights) | [] -> return_nil @@ -239,7 +239,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Preattestation; }; delegate = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; - power = preendorsement_power; + power = Int64.of_int preendorsement_power; } :: acc | Receipt @@ -259,7 +259,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Attestation; }; delegate = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; - power = endorsement_power; + power = Int64.of_int endorsement_power; } :: acc | _ -> acc) diff --git a/teztale/bin_teztale_archiver/PtParisB_machine.real.ml b/teztale/bin_teztale_archiver/PtParisB_machine.real.ml index 3eec043a5f60..75f49c2c3fbf 100644 --- a/teztale/bin_teztale_archiver/PtParisB_machine.real.ml +++ b/teztale/bin_teztale_archiver/PtParisB_machine.real.ml @@ -48,7 +48,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct address = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; first_slot = slot_to_int first_slot; - power = attestation_power; + power = Int64.of_int attestation_power; }) answer.Plugin.RPC.Attestation_rights.delegates_rights) | [] -> return_nil @@ -244,7 +244,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Preattestation; }; delegate = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; - power = consensus_power; + power = Int64.of_int consensus_power; } :: acc | Receipt @@ -264,7 +264,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind = Consensus_ops.Attestation; }; delegate = Tezos_crypto.Signature.Of_V1.public_key_hash delegate; - power = consensus_power; + power = Int64.of_int consensus_power; } :: acc | _ -> acc) diff --git a/teztale/bin_teztale_archiver/PtSeouLo_machine.real.ml b/teztale/bin_teztale_archiver/PtSeouLo_machine.real.ml index 3fbfb9a989d3..9548ea6242de 100644 --- a/teztale/bin_teztale_archiver/PtSeouLo_machine.real.ml +++ b/teztale/bin_teztale_archiver/PtSeouLo_machine.real.ml @@ -48,7 +48,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct address = Tezos_crypto.Signature.Of_V2.public_key_hash delegate; first_slot = slot_to_int first_slot; - power = attestation_power; + power = Int64.of_int attestation_power; }) answer.Plugin.RPC.Attestation_rights.delegates_rights) | [] -> return_nil @@ -240,7 +240,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct kind; }; delegate = Tezos_crypto.Signature.Of_V2.public_key_hash ck.delegate; - power; + power = Int64.of_int power; } :: acc) acc @@ -276,7 +276,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct }; delegate = Tezos_crypto.Signature.Of_V2.public_key_hash delegate; - power = consensus_power; + power = Int64.of_int consensus_power; } :: acc | Receipt @@ -298,7 +298,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct }; delegate = Tezos_crypto.Signature.Of_V2.public_key_hash delegate; - power = consensus_power; + power = Int64.of_int consensus_power; } :: acc | Receipt diff --git a/teztale/bin_teztale_archiver/alpha_machine.real.ml b/teztale/bin_teztale_archiver/alpha_machine.real.ml index 9b328bcd3f78..377f51fd3441 100644 --- a/teztale/bin_teztale_archiver/alpha_machine.real.ml +++ b/teztale/bin_teztale_archiver/alpha_machine.real.ml @@ -48,7 +48,7 @@ module Services : Protocol_machinery.PROTOCOL_SERVICES = struct address = Tezos_crypto.Signature.Of_V2.public_key_hash delegate; first_slot = slot_to_int first_slot; - power = attestation_power; + power = Int64.of_int attestation_power; }) answer.Plugin.RPC.Attestation_rights.delegates_rights) | [] -> return_nil diff --git a/teztale/bin_teztale_server/exporter.ml b/teztale/bin_teztale_server/exporter.ml index 8c2f98905c1c..190d3891de36 100644 --- a/teztale/bin_teztale_server/exporter.ml +++ b/teztale/bin_teztale_server/exporter.ml @@ -216,7 +216,7 @@ let select_ops conf db_pool boundaries = let q_rights = Caqti_request.Infix.( Caqti_type.(t2 int32 int32) - ->* Caqti_type.(t4 int32 Sql_requests.Type.public_key_hash int int)) + ->* Caqti_type.(t4 int32 Sql_requests.Type.public_key_hash int int64)) "SELECT e.level, d.address, e.first_slot, e.endorsing_power FROM \ endorsing_rights e JOIN delegates d ON e.delegate = d.id WHERE e.level \ >= ? AND e.level <= ?" diff --git a/teztale/bin_teztale_server/sql_requests.ml b/teztale/bin_teztale_server/sql_requests.ml index b800728331e4..d96b1581aeb5 100644 --- a/teztale/bin_teztale_server/sql_requests.ml +++ b/teztale/bin_teztale_server/sql_requests.ml @@ -95,7 +95,7 @@ let create_endorsing_rights = \ level INTEGER NOT NULL,\n\ \ delegate $(SMALL_PRIMARY_INCREMENTING_INT_REF) NOT NULL,\n\ \ first_slot INTEGER NOT NULL,\n\ - \ endorsing_power INTEGER NOT NULL,\n\ + \ endorsing_power BIGINT NOT NULL,\n\ \ FOREIGN KEY (delegate) REFERENCES delegates(id),\n\ \ UNIQUE (level, delegate))" @@ -293,7 +293,7 @@ let maybe_insert_delegate = let maybe_insert_attesting_right = Caqti_request.Infix.( - Caqti_type.(t4 int32 int int Type.public_key_hash ->. unit)) + Caqti_type.(t4 int32 int int64 Type.public_key_hash ->. unit)) "INSERT INTO endorsing_rights (level, delegate, first_slot, \ endorsing_power) SELECT ?, delegates.id, ?, ? FROM delegates WHERE \ delegates.address = ? ON CONFLICT DO NOTHING" diff --git a/teztale/bin_teztale_server/sql_requests.mli b/teztale/bin_teztale_server/sql_requests.mli index e9293af51ee3..6b2fd6220700 100644 --- a/teztale/bin_teztale_server/sql_requests.mli +++ b/teztale/bin_teztale_server/sql_requests.mli @@ -53,7 +53,7 @@ val maybe_insert_delegate : (Tezos_crypto.Signature.public_key_hash, unit, [`Zero]) Caqti_request.t val maybe_insert_attesting_right : - ( int32 * int * int * Tezos_crypto.Signature.public_key_hash, + ( int32 * int * int64 * Tezos_crypto.Signature.public_key_hash, unit, [`Zero] ) Caqti_request.t diff --git a/teztale/bin_teztale_snitch/reporting.ml b/teztale/bin_teztale_snitch/reporting.ml index 5c565d9423c8..f4da23711ad1 100644 --- a/teztale/bin_teztale_snitch/reporting.ml +++ b/teztale/bin_teztale_snitch/reporting.ml @@ -17,28 +17,28 @@ open Data *) let reached_at (threshold : float) (reception : Ptime.t Signature.Public_key_hash.Map.t) - (attestingPower : int Signature.Public_key_hash.Map.t) = + (attestingPower : int64 Signature.Public_key_hash.Map.t) = let delegates = Signature.Public_key_hash.Map.bindings reception |> List.sort (fun (_, r1) (_, r2) -> Ptime.compare r1 r2) in - let numberOfSlots = - Signature.Public_key_hash.Map.fold (fun _ -> ( + )) attestingPower 0 + let totalAttestingPower = + Signature.Public_key_hash.Map.fold (fun _ -> Int64.add) attestingPower 0L in let threshold = - Float.to_int (ceil (float_of_int numberOfSlots *. threshold)) + Int64.of_float (ceil (Int64.to_float totalAttestingPower *. threshold)) in let rec loop acc = function | [] -> None | (delegate, reception) :: tl -> let p = Signature.Public_key_hash.Map.find delegate attestingPower - |> Option.value ~default:0 + |> Option.value ~default:0L in - let acc = acc + p in - if acc >= threshold then Some reception else loop acc tl + let acc = Int64.add acc p in + if Compare.Int64.(acc >= threshold) then Some reception else loop acc tl in - loop 0 delegates + loop 0L delegates type 'a partitioned = {preattestation : 'a; attestation : 'a} @@ -164,7 +164,7 @@ let ops_consistency ops = (fun o -> o.kind = Consensus_ops.Attestation && o.block_inclusion <> []) operations - then r + attesting_power + then Int64.add r attesting_power else r in let pa, a = @@ -181,7 +181,7 @@ let ops_consistency ops = | _ -> (pa, a) in (pa, a, r)) - (0, 0, 0) + (0, 0, 0L) ops (** [block_report level block ops distribution attestingPower] @@ -190,7 +190,7 @@ let ops_consistency ops = let block_report (level : int32) (block : Block.t) (ops : Delegate_operations.t list) (distribution : Ptime.t Signature.Public_key_hash.Map.t partitioned) - (attestingPower : int Signature.Public_key_hash.Map.t) : report = + (attestingPower : int64 Signature.Public_key_hash.Map.t) : report = let round = block.round in let open Data in let timestamp = block.timestamp in @@ -232,12 +232,13 @@ let block_report (level : int32) (block : Block.t) in let attestation_rate = match - Signature.Public_key_hash.Map.fold (fun _ -> ( + )) attestingPower 0 + Signature.Public_key_hash.Map.fold (fun _ -> Int64.add) attestingPower 0L with - | 0 -> None + | 0L -> None | total_attestingPower -> Some - (float_of_int attestation_rate0 /. float_of_int total_attestingPower) + (Int64.to_float attestation_rate0 + /. Int64.to_float total_attestingPower) in { level; diff --git a/teztale/lib_teztale_base/consensus_ops.ml b/teztale/lib_teztale_base/consensus_ops.ml index 5f259e4e394e..df06301046fe 100644 --- a/teztale/lib_teztale_base/consensus_ops.ml +++ b/teztale/lib_teztale_base/consensus_ops.ml @@ -8,7 +8,7 @@ type right = { address : Tezos_crypto.Signature.Public_key_hash.t; first_slot : int; - power : int; + power : int64; } let right_encoding = @@ -19,7 +19,7 @@ let right_encoding = (obj3 (req "address" Tezos_crypto.Signature.Public_key_hash.encoding) (req "first_slot" int31) - (req "power" int16)) + (req "power" int64)) type rights = right list @@ -72,7 +72,7 @@ let delegate_ops_encoding = type block_op = { op : operation; delegate : Tezos_crypto.Signature.public_key_hash; - power : int; + power : int64; } let block_op_encoding = @@ -83,4 +83,4 @@ let block_op_encoding = (obj3 (req "operation" operation_encoding) (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) - (req "endorsing_power" int16)) + (req "endorsing_power" int64)) diff --git a/teztale/lib_teztale_base/consensus_ops.mli b/teztale/lib_teztale_base/consensus_ops.mli index 32ef2a3445d7..3b3d071d8b50 100644 --- a/teztale/lib_teztale_base/consensus_ops.mli +++ b/teztale/lib_teztale_base/consensus_ops.mli @@ -8,7 +8,7 @@ type right = { address : Signature.Public_key_hash.t; first_slot : int; - power : int; + power : int64; } type rights = right list @@ -40,7 +40,7 @@ val delegate_ops_encoding : delegate_ops Data_encoding.t type block_op = { op : operation; delegate : Tezos_crypto.Signature.public_key_hash; - power : int; + power : int64; } val block_op_encoding : block_op Data_encoding.encoding diff --git a/teztale/lib_teztale_base/data.ml b/teztale/lib_teztale_base/data.ml index c6cadbc7d270..234bdaf66a00 100644 --- a/teztale/lib_teztale_base/data.ml +++ b/teztale/lib_teztale_base/data.ml @@ -99,7 +99,7 @@ module Delegate_operations = struct type t = { delegate : Tezos_crypto.Signature.public_key_hash; first_slot : int; - attesting_power : int; + attesting_power : int64; operations : operation list; } @@ -110,7 +110,7 @@ module Delegate_operations = struct (fun (delegate, reception_time, errors, block_inclusion) -> match (reception_time, block_inclusion) with | None, [] -> - {delegate; first_slot = 0; attesting_power = 0; operations = []} + {delegate; first_slot = 0; attesting_power = 0L; operations = []} | _, _ -> let mempool_inclusion = match reception_time with @@ -121,7 +121,7 @@ module Delegate_operations = struct { delegate; first_slot = 0; - attesting_power = 0; + attesting_power = 0L; operations = [ { @@ -149,7 +149,7 @@ module Delegate_operations = struct (obj4 (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) (dft "first_slot" int16 0) - (dft "endorsing_power" int16 0) + (dft "endorsing_power" int64 0L) (dft "operations" (list operation_encoding) [])) let encoding = -- GitLab From aeaa25f0ba29783498edd37f0179edbfacbf6f69 Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Tue, 6 May 2025 16:17:31 +0200 Subject: [PATCH 3/3] Proto/tests: update --- .../test/integration/consensus/test_aggregate.ml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 3cf1c161be52..f346ed9c7723 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 @@ -108,10 +108,11 @@ let check_aggregate_result (type kind) (kind : kind aggregate) ~attesters 0 attesters in - if voting_power = total_consensus_power then return_unit + if Int64.(equal (of_int voting_power) total_consensus_power) then + return_unit else Test.fail - "Wrong voting power : expected %d, found %d" + "Wrong voting power : expected %d, found %Ld" voting_power total_consensus_power in @@ -119,7 +120,7 @@ let check_aggregate_result (type kind) (kind : kind aggregate) ~attesters let expected_committee = List.map (fun {Context.delegate; consensus_key = consensus_pkh; slots; _} -> - let power = List.length slots in + let power = List.length slots |> Int64.of_int in ({Alpha_context.Consensus_key.delegate; consensus_pkh}, power)) attesters in @@ -130,7 +131,7 @@ let check_aggregate_result (type kind) (kind : kind aggregate) ~attesters ({delegate = d2; consensus_pkh = c2}, power2) -> Signature.Public_key_hash.equal d1 d2 && Signature.Public_key_hash.equal c1 c2 - && Int.equal power1 power2) + && Int64.equal power1 power2) resulting_committee expected_committee then return_unit @@ -139,7 +140,7 @@ let check_aggregate_result (type kind) (kind : kind aggregate) ~attesters Format.pp_print_list (fun fmt (consensus_key, power) -> Format.fprintf fmt - "%a with power %d" + "%a with power %Ld" Alpha_context.Consensus_key.pp consensus_key power) -- GitLab