Skip to content

Fix hardcoded solana_ prefix in monitor config validation #409

@shahnami

Description

@shahnami

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

  1. Convention dependency: Assumes all Solana networks follow the solana_* naming pattern. Custom network names (e.g., "my-solana-rpc") would fail detection.

  2. 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).

  3. False positives/negatives: A network named "solana_like_evm" would be incorrectly treated as Solana.

Proposed Solution

Consider one of the following approaches:

  1. Look up actual BlockChainType from 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.

  2. Move signature validation to repository level: Shift the signature check to validate_monitor_references where network configurations are already available, allowing proper type-based validation.

Trade-offs to Consider

  • Adding network config lookup to the validate method 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-lowLow-priority or non-urgent tasksT-taskGeneral tasks or chores (e.g., refactoring, cleanup)cla: allowlistdiscussionRequires community or team input.good-first-issueBeginner-friendly, low-complexity issues to help new contributors

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions