From 340cd7ba0b9dbe2622a84223a6d7cf8f5a74d1cc Mon Sep 17 00:00:00 2001 From: findolor Date: Tue, 3 Sep 2024 12:06:12 +0300 Subject: [PATCH 1/8] feat: include watchlist field to app config --- crates/settings/src/config.rs | 13 +++++++++++++ crates/settings/src/config_source.rs | 16 +++++++++++++++- crates/settings/src/merge.rs | 28 ++++++++++++++++++++++++++++ crates/settings/src/scenario.rs | 1 + 4 files changed, 57 insertions(+), 1 deletion(-) diff --git a/crates/settings/src/config.rs b/crates/settings/src/config.rs index a473a0f28..bf0c07f8a 100644 --- a/crates/settings/src/config.rs +++ b/crates/settings/src/config.rs @@ -34,6 +34,8 @@ pub struct Config { pub deployments: HashMap>, pub sentry: Option, pub raindex_version: Option, + #[typeshare(typescript(type = "string[]"))] + pub watchlist: Option>, } pub type Subgraph = Url; @@ -182,6 +184,7 @@ impl TryFrom for Config { charts, deployments, sentry: item.sentry, + watchlist: item.watchlist, }; Ok(config) @@ -273,6 +276,9 @@ mod tests { let charts = HashMap::new(); let deployments = HashMap::new(); let sentry = Some(true); + let watchlist = Some(vec![ + "0x1234567890123456789012345678901234567890".to_string() + ]); let config_string = ConfigSource { raindex_version: Some("0x123".to_string()), @@ -288,6 +294,7 @@ mod tests { charts, deployments, sentry, + watchlist, }; let config_result = Config::try_from(config_string); @@ -346,5 +353,11 @@ mod tests { // Verify raindex_version assert_eq!(config.raindex_version, Some("0x123".to_string())); + + // Verify watchlist + assert!(config.watchlist.is_some()); + let watchlist = config.watchlist.unwrap(); + assert_eq!(watchlist.len(), 1); + assert_eq!(watchlist[0], "0x1234567890123456789012345678901234567890"); } } diff --git a/crates/settings/src/config_source.rs b/crates/settings/src/config_source.rs index 0ce48662f..d2f1c00d8 100644 --- a/crates/settings/src/config_source.rs +++ b/crates/settings/src/config_source.rs @@ -36,6 +36,8 @@ pub struct ConfigSource { pub metaboards: HashMap, pub sentry: Option, pub raindex_version: Option, + #[serde(default)] + pub watchlist: Option>, } #[typeshare] @@ -178,6 +180,9 @@ pub enum ConfigSourceError { impl ConfigSource { pub async fn try_from_string(val: String) -> Result { let mut conf: ConfigSource = serde_yaml::from_str(&val)?; + + println!("Parsed watchlist: {:?}", conf.watchlist); + if !conf.using_networks_from.is_empty() { for (_key, item) in conf.using_networks_from.iter() { let remote_networks = @@ -348,7 +353,11 @@ deployments: scenario: mainScenario order: buyETH -sentry: true"#, +sentry: true + +watchlist: + - address-one + - address-two"#, mocked_chain_id_server.url("/json") ); @@ -453,6 +462,11 @@ sentry: true"#, assert_eq!(order.orderbook, expected_order.orderbook); assert_eq!(config.raindex_version, Some("123".to_string())); + + assert_eq!( + config.watchlist, + Some(vec!["address-one".to_string(), "address-two".to_string()]) + ); } #[tokio::test] diff --git a/crates/settings/src/merge.rs b/crates/settings/src/merge.rs index 06de126bd..df5f5f970 100644 --- a/crates/settings/src/merge.rs +++ b/crates/settings/src/merge.rs @@ -147,6 +147,17 @@ impl ConfigSource { (Some(_), Some(_)) => Err(MergeError::DeploymentCollision("sentry".into())), }?; + // Watchlist + self.watchlist = match (self.watchlist.take(), other.watchlist) { + (Some(mut a), Some(b)) => { + a.extend(b); + Some(a) + } + (Some(a), None) => Some(a), + (None, Some(b)) => Some(b), + (None, None) => None, + }; + Ok(()) } } @@ -251,6 +262,17 @@ impl Config { (Some(_), Some(_)) => Err(MergeError::DeploymentCollision("sentry".into())), }?; + // Watchlist + self.watchlist = match (self.watchlist.take(), other.watchlist) { + (Some(mut a), Some(b)) => { + a.extend(b); + Some(a) + } + (Some(a), None) => Some(a), + (None, Some(b)) => Some(b), + (None, None) => None, + }; + Ok(()) } } @@ -277,6 +299,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, + watchlist: None, }; let other = ConfigSource { @@ -293,6 +316,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, + watchlist: None, }; assert_eq!(config.merge(other), Ok(())); @@ -314,6 +338,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, + watchlist: None, }; let mut other = ConfigSource { @@ -330,6 +355,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, + watchlist: None, }; // Add a collision to cause an unsuccessful merge @@ -365,6 +391,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, + watchlist: None, }; let mut other = ConfigSource { @@ -381,6 +408,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, + watchlist: None, }; other.metaboards.insert( diff --git a/crates/settings/src/scenario.rs b/crates/settings/src/scenario.rs index 052c4627e..c9876304f 100644 --- a/crates/settings/src/scenario.rs +++ b/crates/settings/src/scenario.rs @@ -213,6 +213,7 @@ mod tests { charts: HashMap::new(), // Assuming no charts for simplification deployments: HashMap::new(), sentry: None, + watchlist: None, }; // Perform the conversion From 790f675f83ae72f2446868d71b3ec5be1290dcc6 Mon Sep 17 00:00:00 2001 From: findolor Date: Tue, 3 Sep 2024 12:06:33 +0300 Subject: [PATCH 2/8] feat: derive watchlist from settings --- tauri-app/src/lib/stores/settings.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tauri-app/src/lib/stores/settings.ts b/tauri-app/src/lib/stores/settings.ts index f802b3f8d..5d9b8ace8 100644 --- a/tauri-app/src/lib/stores/settings.ts +++ b/tauri-app/src/lib/stores/settings.ts @@ -103,6 +103,9 @@ export const hasRequiredSettings = derived( $activeNetworkRef !== undefined && $activeOrderbookRef !== undefined, ); +// watchlist +export const watchlist = derived(settings, ($settings) => $settings?.watchlist ?? []); + // When networks / orderbooks settings updated, reset active network / orderbook settings.subscribe(async () => { const $settings = await settings.load(); From 9a390a18a1665ef95d57d6cdad1f3bedee15f335 Mon Sep 17 00:00:00 2001 From: findolor Date: Wed, 4 Sep 2024 16:12:35 +0300 Subject: [PATCH 3/8] fix: skip watchlist serialization if it's none --- crates/settings/src/config_source.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/settings/src/config_source.rs b/crates/settings/src/config_source.rs index e6946de16..e6755e635 100644 --- a/crates/settings/src/config_source.rs +++ b/crates/settings/src/config_source.rs @@ -38,7 +38,7 @@ pub struct ConfigSource { pub sentry: Option, #[serde(skip_serializing_if = "Option::is_none")] pub raindex_version: Option, - #[serde(default)] + #[serde(skip_serializing_if = "Option::is_none")] pub watchlist: Option>, } @@ -203,9 +203,6 @@ pub enum ConfigSourceError { impl ConfigSource { pub async fn try_from_string(val: String) -> Result { let mut conf: ConfigSource = serde_yaml::from_str(&val)?; - - println!("Parsed watchlist: {:?}", conf.watchlist); - if !conf.using_networks_from.is_empty() { for (_key, item) in conf.using_networks_from.iter() { let remote_networks = From 0c70091f8b903f5f4710bac282443194afdd3112 Mon Sep 17 00:00:00 2001 From: findolor Date: Thu, 5 Sep 2024 16:10:09 +0300 Subject: [PATCH 4/8] feat: convert the watchlist vector to a hashmap --- crates/settings/src/config.rs | 25 +++++++++------- crates/settings/src/config_source.rs | 14 ++++----- crates/settings/src/merge.rs | 43 ++++++++++++++-------------- crates/settings/src/scenario.rs | 2 +- 4 files changed, 43 insertions(+), 41 deletions(-) diff --git a/crates/settings/src/config.rs b/crates/settings/src/config.rs index bf0c07f8a..81e36c45f 100644 --- a/crates/settings/src/config.rs +++ b/crates/settings/src/config.rs @@ -34,8 +34,8 @@ pub struct Config { pub deployments: HashMap>, pub sentry: Option, pub raindex_version: Option, - #[typeshare(typescript(type = "string[]"))] - pub watchlist: Option>, + #[typeshare(typescript(type = "Record"))] + pub watchlist: HashMap>, } pub type Subgraph = Url; @@ -171,6 +171,12 @@ impl TryFrom for Config { }) .collect::>, ParseConfigSourceError>>()?; + let watchlist = item + .watchlist + .into_iter() + .map(|(name, address)| Ok((name, Arc::new(address)))) + .collect::>, ParseConfigSourceError>>()?; + let config = Config { raindex_version: item.raindex_version, networks, @@ -184,7 +190,7 @@ impl TryFrom for Config { charts, deployments, sentry: item.sentry, - watchlist: item.watchlist, + watchlist, }; Ok(config) @@ -276,9 +282,7 @@ mod tests { let charts = HashMap::new(); let deployments = HashMap::new(); let sentry = Some(true); - let watchlist = Some(vec![ - "0x1234567890123456789012345678901234567890".to_string() - ]); + let watchlist = HashMap::from([("name-one".to_string(), "address-one".to_string())]); let config_string = ConfigSource { raindex_version: Some("0x123".to_string()), @@ -355,9 +359,10 @@ mod tests { assert_eq!(config.raindex_version, Some("0x123".to_string())); // Verify watchlist - assert!(config.watchlist.is_some()); - let watchlist = config.watchlist.unwrap(); - assert_eq!(watchlist.len(), 1); - assert_eq!(watchlist[0], "0x1234567890123456789012345678901234567890"); + assert!(!config.watchlist.is_empty()); + assert_eq!(config.watchlist.len(), 1); + let (name, address) = config.watchlist.iter().next().unwrap(); + assert_eq!(name, "name-one"); + assert_eq!(address.as_str(), "address-one"); } } diff --git a/crates/settings/src/config_source.rs b/crates/settings/src/config_source.rs index e6755e635..bc95263cc 100644 --- a/crates/settings/src/config_source.rs +++ b/crates/settings/src/config_source.rs @@ -38,8 +38,8 @@ pub struct ConfigSource { pub sentry: Option, #[serde(skip_serializing_if = "Option::is_none")] pub raindex_version: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub watchlist: Option>, + #[serde(skip_serializing_if = "HashMap::is_empty")] + pub watchlist: HashMap, } #[typeshare] @@ -376,8 +376,8 @@ deployments: sentry: true watchlist: - - address-one - - address-two"#, + name-one: address-one + name-two: address-two"#, mocked_chain_id_server.url("/json") ); @@ -483,10 +483,8 @@ watchlist: assert_eq!(config.raindex_version, Some("123".to_string())); - assert_eq!( - config.watchlist, - Some(vec!["address-one".to_string(), "address-two".to_string()]) - ); + assert_eq!(config.watchlist.get("name-one").unwrap(), "address-one"); + assert_eq!(config.watchlist.get("name-two").unwrap(), "address-two"); } #[tokio::test] diff --git a/crates/settings/src/merge.rs b/crates/settings/src/merge.rs index df5f5f970..fef697723 100644 --- a/crates/settings/src/merge.rs +++ b/crates/settings/src/merge.rs @@ -36,6 +36,9 @@ pub enum MergeError { #[error("There is already a remote networks definition called {0}")] RemoteNetworksCollision(String), + + #[error("There is already a watchlist called {0}")] + WatchlistCollision(String), } impl ConfigSource { @@ -148,15 +151,13 @@ impl ConfigSource { }?; // Watchlist - self.watchlist = match (self.watchlist.take(), other.watchlist) { - (Some(mut a), Some(b)) => { - a.extend(b); - Some(a) + let watchlist = &mut self.watchlist; + for (key, value) in other.watchlist { + if watchlist.contains_key(&key) { + return Err(MergeError::WatchlistCollision(key)); } - (Some(a), None) => Some(a), - (None, Some(b)) => Some(b), - (None, None) => None, - }; + watchlist.insert(key, value); + } Ok(()) } @@ -263,15 +264,13 @@ impl Config { }?; // Watchlist - self.watchlist = match (self.watchlist.take(), other.watchlist) { - (Some(mut a), Some(b)) => { - a.extend(b); - Some(a) + let watchlist = &mut self.watchlist; + for (key, value) in other.watchlist { + if watchlist.contains_key(&key) { + return Err(MergeError::WatchlistCollision(key)); } - (Some(a), None) => Some(a), - (None, Some(b)) => Some(b), - (None, None) => None, - }; + watchlist.insert(key, value); + } Ok(()) } @@ -299,7 +298,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, - watchlist: None, + watchlist: HashMap::new(), }; let other = ConfigSource { @@ -316,7 +315,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, - watchlist: None, + watchlist: HashMap::new(), }; assert_eq!(config.merge(other), Ok(())); @@ -338,7 +337,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, - watchlist: None, + watchlist: HashMap::new(), }; let mut other = ConfigSource { @@ -355,7 +354,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, - watchlist: None, + watchlist: HashMap::new(), }; // Add a collision to cause an unsuccessful merge @@ -391,7 +390,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, - watchlist: None, + watchlist: HashMap::new(), }; let mut other = ConfigSource { @@ -408,7 +407,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, - watchlist: None, + watchlist: HashMap::new(), }; other.metaboards.insert( diff --git a/crates/settings/src/scenario.rs b/crates/settings/src/scenario.rs index c9876304f..6c6c84eef 100644 --- a/crates/settings/src/scenario.rs +++ b/crates/settings/src/scenario.rs @@ -213,7 +213,7 @@ mod tests { charts: HashMap::new(), // Assuming no charts for simplification deployments: HashMap::new(), sentry: None, - watchlist: None, + watchlist: HashMap::new(), // Assuming no watchlist for simplification }; // Perform the conversion From 2d6a7882f924e99a812550a6be604c9efe306f24 Mon Sep 17 00:00:00 2001 From: findolor Date: Thu, 5 Sep 2024 16:56:36 +0300 Subject: [PATCH 5/8] test: update tests --- tauri-app/src/lib/mocks/settings.ts | 4 ++++ tauri-app/src/tests/pickConfig.test.ts | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/tauri-app/src/lib/mocks/settings.ts b/tauri-app/src/lib/mocks/settings.ts index 5007872fe..beab1514c 100644 --- a/tauri-app/src/lib/mocks/settings.ts +++ b/tauri-app/src/lib/mocks/settings.ts @@ -31,6 +31,10 @@ const mockConfigSource: ConfigSource = { metaboards: { metaboard1: 'https://example.com/metaboard1', }, + watchlist: { + name_one: 'address_one', + name_two: 'address_two', + }, }; export const mockSettingsStore = writable(mockConfigSource); diff --git a/tauri-app/src/tests/pickConfig.test.ts b/tauri-app/src/tests/pickConfig.test.ts index d423a1390..9185fafa3 100644 --- a/tauri-app/src/tests/pickConfig.test.ts +++ b/tauri-app/src/tests/pickConfig.test.ts @@ -151,6 +151,10 @@ export const config: Config = { }, }, }, + watchlist: { + name_one: 'address_one', + name_two: 'address_two', + }, }; export const configSource: ConfigSource = { @@ -214,6 +218,10 @@ export const configSource: ConfigSource = { order: 'sell', }, }, + watchlist: { + name_one: 'address_one', + name_two: 'address_two', + }, }; test('pick deployments', () => { From 22999026fee498f82fd051a1048abe37e1a01499 Mon Sep 17 00:00:00 2001 From: findolor Date: Fri, 6 Sep 2024 08:23:28 +0300 Subject: [PATCH 6/8] test: add missing watchlist field to tests --- crates/cli/src/commands/order/add.rs | 4 ++++ crates/cli/src/commands/order/calldata.rs | 4 ++++ crates/cli/src/commands/order/listorderfrontmatterkeys.rs | 4 ++++ crates/cli/src/commands/order/orderbook_address.rs | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/crates/cli/src/commands/order/add.rs b/crates/cli/src/commands/order/add.rs index bb0865c30..4799b10e8 100644 --- a/crates/cli/src/commands/order/add.rs +++ b/crates/cli/src/commands/order/add.rs @@ -170,6 +170,10 @@ deployments: some-deployment: scenario: some-scenario order: some-order + +watchlist: + name-one: address-one + name-two: address-two --- #calculate-io _ _: 0 0; diff --git a/crates/cli/src/commands/order/calldata.rs b/crates/cli/src/commands/order/calldata.rs index 7cf3ff5ab..32e5dd097 100644 --- a/crates/cli/src/commands/order/calldata.rs +++ b/crates/cli/src/commands/order/calldata.rs @@ -176,6 +176,10 @@ deployments: some-deployment: scenario: some-scenario order: some-order + +watchlist: + name-one: address-one + name-two: address-two --- #calculate-io _ _: 0 0; diff --git a/crates/cli/src/commands/order/listorderfrontmatterkeys.rs b/crates/cli/src/commands/order/listorderfrontmatterkeys.rs index 250f0adcc..0b99cf42c 100644 --- a/crates/cli/src/commands/order/listorderfrontmatterkeys.rs +++ b/crates/cli/src/commands/order/listorderfrontmatterkeys.rs @@ -183,6 +183,10 @@ deployments: some-different-deployment: scenario: some-scenario.some-different-scenario order: some-order + +watchlist: + name-one: address-one + name-two: address-two --- #calculate-io _ _: 0 0; diff --git a/crates/cli/src/commands/order/orderbook_address.rs b/crates/cli/src/commands/order/orderbook_address.rs index 5ef93352c..e40beb40a 100644 --- a/crates/cli/src/commands/order/orderbook_address.rs +++ b/crates/cli/src/commands/order/orderbook_address.rs @@ -164,6 +164,10 @@ deployments: some-deployment: scenario: some-scenario order: some-order + +watchlist: + name-one: address-one + name-two: address-two --- #calculate-io _ _: 0 0; From 1ffefd2eedb4b31bb57c26aaa2532ba99cf55cde Mon Sep 17 00:00:00 2001 From: findolor Date: Fri, 6 Sep 2024 09:13:22 +0300 Subject: [PATCH 7/8] refactor: make watchlist an optional value --- crates/settings/src/config.rs | 24 +++++++++------ crates/settings/src/config_source.rs | 9 +++--- crates/settings/src/merge.rs | 46 ++++++++++++++++++---------- crates/settings/src/scenario.rs | 2 +- 4 files changed, 50 insertions(+), 31 deletions(-) diff --git a/crates/settings/src/config.rs b/crates/settings/src/config.rs index 81e36c45f..bbe724303 100644 --- a/crates/settings/src/config.rs +++ b/crates/settings/src/config.rs @@ -35,7 +35,7 @@ pub struct Config { pub sentry: Option, pub raindex_version: Option, #[typeshare(typescript(type = "Record"))] - pub watchlist: HashMap>, + pub watchlist: Option>>, } pub type Subgraph = Url; @@ -171,11 +171,11 @@ impl TryFrom for Config { }) .collect::>, ParseConfigSourceError>>()?; - let watchlist = item - .watchlist - .into_iter() - .map(|(name, address)| Ok((name, Arc::new(address)))) - .collect::>, ParseConfigSourceError>>()?; + let watchlist = item.watchlist.map(|wl| { + wl.into_iter() + .map(|(name, address)| (name, Arc::new(address))) + .collect::>>() + }); let config = Config { raindex_version: item.raindex_version, @@ -282,7 +282,10 @@ mod tests { let charts = HashMap::new(); let deployments = HashMap::new(); let sentry = Some(true); - let watchlist = HashMap::from([("name-one".to_string(), "address-one".to_string())]); + let watchlist = Some(HashMap::from([( + "name-one".to_string(), + "address-one".to_string(), + )])); let config_string = ConfigSource { raindex_version: Some("0x123".to_string()), @@ -359,9 +362,10 @@ mod tests { assert_eq!(config.raindex_version, Some("0x123".to_string())); // Verify watchlist - assert!(!config.watchlist.is_empty()); - assert_eq!(config.watchlist.len(), 1); - let (name, address) = config.watchlist.iter().next().unwrap(); + assert!(config.watchlist.is_some()); + let watchlist = config.watchlist.as_ref().unwrap(); + assert_eq!(watchlist.len(), 1); + let (name, address) = watchlist.iter().next().unwrap(); assert_eq!(name, "name-one"); assert_eq!(address.as_str(), "address-one"); } diff --git a/crates/settings/src/config_source.rs b/crates/settings/src/config_source.rs index bc95263cc..95e143d40 100644 --- a/crates/settings/src/config_source.rs +++ b/crates/settings/src/config_source.rs @@ -38,8 +38,8 @@ pub struct ConfigSource { pub sentry: Option, #[serde(skip_serializing_if = "Option::is_none")] pub raindex_version: Option, - #[serde(skip_serializing_if = "HashMap::is_empty")] - pub watchlist: HashMap, + #[serde(skip_serializing_if = "Option::is_none")] + pub watchlist: Option>, } #[typeshare] @@ -483,8 +483,9 @@ watchlist: assert_eq!(config.raindex_version, Some("123".to_string())); - assert_eq!(config.watchlist.get("name-one").unwrap(), "address-one"); - assert_eq!(config.watchlist.get("name-two").unwrap(), "address-two"); + let watchlist = config.watchlist.unwrap(); + assert_eq!(watchlist.get("name-one").unwrap(), "address-one"); + assert_eq!(watchlist.get("name-two").unwrap(), "address-two"); } #[tokio::test] diff --git a/crates/settings/src/merge.rs b/crates/settings/src/merge.rs index fef697723..feb2f67b0 100644 --- a/crates/settings/src/merge.rs +++ b/crates/settings/src/merge.rs @@ -151,12 +151,19 @@ impl ConfigSource { }?; // Watchlist - let watchlist = &mut self.watchlist; - for (key, value) in other.watchlist { - if watchlist.contains_key(&key) { - return Err(MergeError::WatchlistCollision(key)); + match (&mut self.watchlist, other.watchlist) { + (Some(watchlist), Some(other_watchlist)) => { + for (key, value) in other_watchlist { + if watchlist.contains_key(&key) { + return Err(MergeError::WatchlistCollision(key)); + } + watchlist.insert(key, value); + } } - watchlist.insert(key, value); + (None, Some(other_watchlist)) => { + self.watchlist = Some(other_watchlist); + } + _ => {} } Ok(()) @@ -264,12 +271,19 @@ impl Config { }?; // Watchlist - let watchlist = &mut self.watchlist; - for (key, value) in other.watchlist { - if watchlist.contains_key(&key) { - return Err(MergeError::WatchlistCollision(key)); + match (&mut self.watchlist, other.watchlist) { + (Some(watchlist), Some(other_watchlist)) => { + for (key, value) in other_watchlist { + if watchlist.contains_key(&key) { + return Err(MergeError::WatchlistCollision(key)); + } + watchlist.insert(key, value); + } + } + (None, Some(other_watchlist)) => { + self.watchlist = Some(other_watchlist); } - watchlist.insert(key, value); + _ => {} } Ok(()) @@ -298,7 +312,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, - watchlist: HashMap::new(), + watchlist: None, }; let other = ConfigSource { @@ -315,7 +329,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, - watchlist: HashMap::new(), + watchlist: None, }; assert_eq!(config.merge(other), Ok(())); @@ -337,7 +351,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, - watchlist: HashMap::new(), + watchlist: None, }; let mut other = ConfigSource { @@ -354,7 +368,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, - watchlist: HashMap::new(), + watchlist: None, }; // Add a collision to cause an unsuccessful merge @@ -390,7 +404,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, - watchlist: HashMap::new(), + watchlist: None, }; let mut other = ConfigSource { @@ -407,7 +421,7 @@ mod tests { networks: HashMap::new(), deployments: HashMap::new(), sentry: None, - watchlist: HashMap::new(), + watchlist: None, }; other.metaboards.insert( diff --git a/crates/settings/src/scenario.rs b/crates/settings/src/scenario.rs index 6c6c84eef..6d457d6df 100644 --- a/crates/settings/src/scenario.rs +++ b/crates/settings/src/scenario.rs @@ -213,7 +213,7 @@ mod tests { charts: HashMap::new(), // Assuming no charts for simplification deployments: HashMap::new(), sentry: None, - watchlist: HashMap::new(), // Assuming no watchlist for simplification + watchlist: None, // Assuming no watchlist for simplification }; // Perform the conversion From 5c6a3d671b8c932c2107f40c121e5a12d45ad7d0 Mon Sep 17 00:00:00 2001 From: findolor Date: Fri, 6 Sep 2024 09:13:32 +0300 Subject: [PATCH 8/8] fix: remove added watchlist fields --- crates/cli/src/commands/order/add.rs | 4 ---- crates/cli/src/commands/order/calldata.rs | 4 ---- crates/cli/src/commands/order/listorderfrontmatterkeys.rs | 4 ---- crates/cli/src/commands/order/orderbook_address.rs | 4 ---- 4 files changed, 16 deletions(-) diff --git a/crates/cli/src/commands/order/add.rs b/crates/cli/src/commands/order/add.rs index 4799b10e8..bb0865c30 100644 --- a/crates/cli/src/commands/order/add.rs +++ b/crates/cli/src/commands/order/add.rs @@ -170,10 +170,6 @@ deployments: some-deployment: scenario: some-scenario order: some-order - -watchlist: - name-one: address-one - name-two: address-two --- #calculate-io _ _: 0 0; diff --git a/crates/cli/src/commands/order/calldata.rs b/crates/cli/src/commands/order/calldata.rs index 32e5dd097..7cf3ff5ab 100644 --- a/crates/cli/src/commands/order/calldata.rs +++ b/crates/cli/src/commands/order/calldata.rs @@ -176,10 +176,6 @@ deployments: some-deployment: scenario: some-scenario order: some-order - -watchlist: - name-one: address-one - name-two: address-two --- #calculate-io _ _: 0 0; diff --git a/crates/cli/src/commands/order/listorderfrontmatterkeys.rs b/crates/cli/src/commands/order/listorderfrontmatterkeys.rs index 0b99cf42c..250f0adcc 100644 --- a/crates/cli/src/commands/order/listorderfrontmatterkeys.rs +++ b/crates/cli/src/commands/order/listorderfrontmatterkeys.rs @@ -183,10 +183,6 @@ deployments: some-different-deployment: scenario: some-scenario.some-different-scenario order: some-order - -watchlist: - name-one: address-one - name-two: address-two --- #calculate-io _ _: 0 0; diff --git a/crates/cli/src/commands/order/orderbook_address.rs b/crates/cli/src/commands/order/orderbook_address.rs index e40beb40a..5ef93352c 100644 --- a/crates/cli/src/commands/order/orderbook_address.rs +++ b/crates/cli/src/commands/order/orderbook_address.rs @@ -164,10 +164,6 @@ deployments: some-deployment: scenario: some-scenario order: some-order - -watchlist: - name-one: address-one - name-two: address-two --- #calculate-io _ _: 0 0;