From a26751ae832dbe03c48d2d1ad1818ecca33a478f Mon Sep 17 00:00:00 2001 From: Adam Allombert-Goget Date: Fri, 16 May 2025 14:11:33 +0200 Subject: [PATCH 1/3] accuser: remove denunciation for operations with different slots --- .../lib_delegate/client_baking_denunciation.ml | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/proto_alpha/lib_delegate/client_baking_denunciation.ml b/src/proto_alpha/lib_delegate/client_baking_denunciation.ml index 407afd6d8e55..de5aa94bffff 100644 --- a/src/proto_alpha/lib_delegate/client_baking_denunciation.ml +++ b/src/proto_alpha/lib_delegate/client_baking_denunciation.ml @@ -157,13 +157,6 @@ let get_payload_hash (type kind) | Attestation, Single (Attestation {consensus_content; _}) -> consensus_content.block_payload_hash -let get_slot (type kind) (op_kind : kind denunciable_consensus_operation) - (op : kind Operation.t) = - match (op_kind, op.protocol_data.contents) with - | Preattestation, Single (Preattestation consensus_content) - | Attestation, Single (Attestation {consensus_content; _}) -> - consensus_content.slot - let double_consensus_op_evidence (type kind) : kind denunciable_consensus_operation -> #Protocol_client_context.full -> @@ -241,11 +234,6 @@ let events_of_kind (type kind) (op_kind : kind denunciable_consensus_operation) double_preattestation_denounced, preattestation_conflict_ignored ) -let should_different_slots_be_denunced (type kind) state = - (* consensus operations with different slots are not denunced under - aggregate_attestation feature flag *) - not state.constants.parametric.aggregate_attestation - let process_consensus_op (type kind) state cctxt (op_kind : kind denunciable_consensus_operation) (new_op : kind Operation.t) chain_id level round slot = @@ -298,15 +286,12 @@ let process_consensus_op (type kind) state cctxt in let existing_payload_hash = get_payload_hash op_kind existing_op in let new_payload_hash = get_payload_hash op_kind new_op in - let existing_slot = get_slot op_kind existing_op in if Block_payload_hash.(existing_payload_hash <> new_payload_hash) - || Slot.(existing_slot <> slot) - && should_different_slots_be_denunced state || Block_hash.(existing_op.shell.branch <> new_op.shell.branch) then ( (* Same level, round, and delegate, and: - different payload hash OR different slot OR different branch *) + different payload hash different branch *) let op1, op2 = if Operation_hash.(new_op_hash < existing_op_hash) then (new_op, existing_op) -- GitLab From 63259325c3794ff36868a58033f57b0f139717f1 Mon Sep 17 00:00:00 2001 From: Adam Allombert-Goget Date: Fri, 16 May 2025 14:29:09 +0200 Subject: [PATCH 2/3] tezt/double_consensus: remove tests for deprecated feature --- tezt/tests/double_consensus.ml | 69 ---------------------------------- 1 file changed, 69 deletions(-) diff --git a/tezt/tests/double_consensus.ml b/tezt/tests/double_consensus.ml index 7b1efc9f365f..f44562e0c0f6 100644 --- a/tezt/tests/double_consensus.ml +++ b/tezt/tests/double_consensus.ml @@ -111,57 +111,6 @@ let double_attestation_init in return ((client, accuser), (branch, level, round, slots, block_payload_hash)) -let double_consensus_wrong_slot - (consensus_for, mk_consensus, consensus_waiter, consensus_name) protocol = - let* (client, accuser), (branch, level, round, slots, block_payload_hash) = - double_attestation_init consensus_for consensus_name protocol () - in - (* Under [aggregate_attestation] feature flag, consensus operations with - non-minimal slots are not propagated by mempools and no longer denunced. *) - let* aggregate_attestation = - let* constants = - Client.RPC.call_via_endpoint client - @@ RPC.get_chain_block_context_constants () - in - return JSON.(constants |-> "aggregate_attestation" |> as_bool_opt) - in - if aggregate_attestation = Some true then unit - else ( - Log.info "Inject an invalid %s and wait for denounciation" consensus_name ; - let op = - mk_consensus ~slot:(List.nth slots 1) ~level ~round ~block_payload_hash - in - let waiter = consensus_waiter accuser in - let* _ = - Operation.Consensus.inject - ~protocol - ~branch - ~signer:Constant.bootstrap1 - op - client - in - let* () = waiter in - Log.info - "Inject another invalid %s and wait for already_denounced event" - consensus_name ; - let op = - mk_consensus ~slot:(List.nth slots 2) ~level ~round ~block_payload_hash - in - let* oph = get_double_consensus_denounciation_hash consensus_name client in - let waiter_already_denounced = - double_consensus_already_denounced_waiter accuser oph - in - let* _ = - Operation.Consensus.inject - ~protocol - ~branch - ~signer:Constant.bootstrap1 - op - client - in - let* () = waiter_already_denounced in - unit) - let attest_utils = ( Client.attest_for, (fun ~slot ~level ~round ~block_payload_hash -> @@ -175,22 +124,6 @@ let preattest_utils = double_preattestation_waiter, "preattestation" ) -let double_attestation_wrong_slot = - Protocol.register_test - ~__FILE__ - ~title:"double attestation using wrong slot" - ~tags:[Tag.layer1; "double"; "attestation"; "accuser"; "slot"; "node"] - ~uses:(fun protocol -> [Protocol.accuser protocol]) - @@ fun protocol -> double_consensus_wrong_slot attest_utils protocol - -let double_preattestation_wrong_slot = - Protocol.register_test - ~__FILE__ - ~title:"double preattestation using wrong slot" - ~tags:[Tag.layer1; "double"; "preattestation"; "accuser"; "slot"; "node"] - ~uses:(fun protocol -> [Protocol.accuser protocol]) - @@ fun protocol -> double_consensus_wrong_slot preattest_utils protocol - let double_consensus_wrong_block_payload_hash (consensus_for, mk_consensus, consensus_waiter, consensus_name) protocol = let* (client, accuser), (branch, level, round, slots, _block_payload_hash) = @@ -476,8 +409,6 @@ let operation_too_far_in_future = unit let register ~protocols = - double_attestation_wrong_slot protocols ; - double_preattestation_wrong_slot protocols ; double_attestation_wrong_block_payload_hash protocols ; double_preattestation_wrong_block_payload_hash protocols ; double_attestation_wrong_branch protocols ; -- GitLab From a93297a2b4ac287039599977c487e34f603ef63b Mon Sep 17 00:00:00 2001 From: Adam Allombert-Goget Date: Mon, 19 May 2025 13:07:26 +0200 Subject: [PATCH 3/3] changelog: add entry for accuser changes --- CHANGES.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index aad1a3fdc074..516d14480e4c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -136,6 +136,8 @@ the README from ``src/bin_agnostic_baker``. Accuser ------- +- Consensus operations with different slots are no longer denunced, as this no + longer considered a punishable misbehaviour (MR :gl:`!18049`). Agnostic Accuser ---------------- -- GitLab