-
Notifications
You must be signed in to change notification settings - Fork 44
Description
Description
Currently, the monitor validation logic in src/models/config/monitor_config.rs detects Solana networks by checking if any network slug starts with "solana_":
// Check if this is a Solana monitor based on network slugs
let is_solana_monitor = self.networks.iter().any(|slug| slug.starts_with("solana_"));
This heuristic-based approach is fragile and has several potential issues.
Problems
-
Convention dependency: Assumes all Solana networks follow the
solana_*naming pattern. Custom network names (e.g.,"my-solana-rpc") would fail detection. -
Mixed network types: If a monitor tracks multiple networks of different types, this logic assumes they're all the same type (Solana or non-Solana).
-
False positives/negatives: A network named
"solana_like_evm"would be incorrectly treated as Solana.
Proposed Solution
Consider one of the following approaches:
-
Look up actual
BlockChainTypefrom network configuration: Instead of relying on string matching, query the network configuration to get the actual blockchain type. This would require access to network configs during validation. -
Move signature validation to repository level: Shift the signature check to
validate_monitor_referenceswhere network configurations are already available, allowing proper type-based validation.
Trade-offs to Consider
- Adding network config lookup to the
validatemethod increases coupling and complexity - Moving validation to repository level changes the validation architecture
- The current approach works for standard configurations but may break with custom network names
Related Code
src/models/config/monitor_config.rs- lines 175-204 (signature validation logic)- Repository-level validation in
validate_monitor_references