From 0df7cc2612203dd6b6d47aeed3625989be95598c Mon Sep 17 00:00:00 2001 From: Hocuri Date: Tue, 5 May 2026 23:10:36 +0200 Subject: [PATCH] test: Adapt test_stats_key_creation_timestamp() --- src/stats/stats_tests.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/stats/stats_tests.rs b/src/stats/stats_tests.rs index 3a385b604..b4b089a5f 100644 --- a/src/stats/stats_tests.rs +++ b/src/stats/stats_tests.rs @@ -486,6 +486,15 @@ async fn test_stats_key_creation_timestamp() -> Result<()> { // Alice uses a pregenerated key. It was created at this timestamp: const ALICE_KEY_CREATION_TIME: u128 = 1582855645; + // The key creation time's resolution is reduced in order to prevent deanonymization: + const CENSORED_KEY_CREATION_TIME: u128 = 1584576000; + assert!(CENSORED_KEY_CREATION_TIME.is_multiple_of(KEY_CREATE_TIMESTAMP_RESOLUTION as u128)); + assert!(CENSORED_KEY_CREATION_TIME > ALICE_KEY_CREATION_TIME); + assert!( + CENSORED_KEY_CREATION_TIME - ALICE_KEY_CREATION_TIME + < KEY_CREATE_TIMESTAMP_RESOLUTION as u128 + ); + let alice = &TestContext::new_alice().await; alice.set_config_bool(Config::StatsSending, true).await?; @@ -495,7 +504,7 @@ async fn test_stats_key_creation_timestamp() -> Result<()> { assert_eq!( key_create_timestamps, &vec![Value::Number( - Number::from_u128(ALICE_KEY_CREATION_TIME).unwrap() + Number::from_u128(CENSORED_KEY_CREATION_TIME).unwrap() )] );