From a169c99366d54d7e17076f00dfbd671e97e92190 Mon Sep 17 00:00:00 2001 From: Sosthene Date: Tue, 2 Sep 2025 13:20:41 +0200 Subject: [PATCH] [bug] fix broken validation_tokens deduplication --- src/commit.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/commit.rs b/src/commit.rs index 6d28ece..29cfc01 100644 --- a/src/commit.rs +++ b/src/commit.rs @@ -306,8 +306,13 @@ fn process_validation( .validation_tokens .extend(commit_msg.validation_tokens.iter()); - state_to_update.validation_tokens.sort_unstable(); - state_to_update.validation_tokens.dedup(); + // Sort by public key to group validations by signer + state_to_update.validation_tokens.sort_unstable_by_key(|proof| proof.get_key()); + + // Remove duplicates where same key validates same message + state_to_update.validation_tokens.dedup_by(|a, b| { + a.get_key() == b.get_key() && a.get_message() == b.get_message() + }); } let state_to_validate = updated_process.get_state_for_id(&new_state_id)?;