From d61103f06dd989b5326770b658890605e77acbbe Mon Sep 17 00:00:00 2001 From: Marcel Moura <5615598+marcelstanley@users.noreply.github.com> Date: Mon, 26 Aug 2024 15:04:37 -0300 Subject: [PATCH] fix(experimental): log duplicate addresses This fixes an issue where the redis set was being manipulated during the update process. --- CHANGELOG.md | 2 +- offchain/authority-claimer/src/listener.rs | 29 ---------------------- offchain/rollups-events/src/broker/mod.rs | 9 +++---- 3 files changed, 5 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a343c93..16c10656 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [1.5.1] 2024-08-16 +## [1.5.1] 2024-08-26 ### Added diff --git a/offchain/authority-claimer/src/listener.rs b/offchain/authority-claimer/src/listener.rs index 4ea45482..9ab334d0 100644 --- a/offchain/authority-claimer/src/listener.rs +++ b/offchain/authority-claimer/src/listener.rs @@ -531,35 +531,6 @@ mod tests { assert_listen(&mut listener, &dapps, &vec![0]).await; } - #[tokio::test] - async fn multidapp_listen_with_duplicate_dapps() { - let docker = Cli::default(); - let (fixture, mut listener, dapps) = - setup_multidapp_listener(&docker, false).await.unwrap(); - fixture.dapps_set(vec![]).await; - - // Initializes with 0 addresses in the set. - assert_eq!(0, fixture.dapps_members().await.len()); - - // We add a lowercase and an uppercase version of the same address. - let dapp: Address = [10; 20].into(); - fixture.dapps_add(dapp.to_string().to_lowercase()).await; - fixture.dapps_add(dapp.to_string().to_uppercase()).await; - - // We now have 2 addresses in the set. - assert_eq!(2, fixture.dapps_members().await.len()); - - // We then produce some claims and listen for them. - let mut epochs = vec![0; dapps.len()]; - let indexes = vec![2, 2, 0]; - multidapp_produce_claims(&fixture, &mut epochs, &dapps, &indexes).await; - let indexes = vec![2, 2]; - assert_listen(&mut listener, &dapps, &indexes).await; - - // Now we have 1 address because one of the duplicates got deleted. - assert_eq!(1, fixture.dapps_members().await.len()); - } - #[tokio::test] async fn multidapp_listen_with_changing_dapps() { let docker = Cli::default(); diff --git a/offchain/rollups-events/src/broker/mod.rs b/offchain/rollups-events/src/broker/mod.rs index 56e18ab5..1883f46f 100644 --- a/offchain/rollups-events/src/broker/mod.rs +++ b/offchain/rollups-events/src/broker/mod.rs @@ -380,11 +380,10 @@ impl Broker { match dapp_address { Ok(dapp_address) => { if dapp_addresses.contains(&dapp_address) { - let _: () = self - .connection - .clone() - .srem(DAPPS_KEY, value) - .await?; + tracing::info!( + "Ignored duplicate DApp address {:?}", + value, + ) } else { dapp_addresses.push(dapp_address); }