SimplyStaking / panic

PANIC Monitoring and Alerting For Blockchains
Apache License 2.0
82 stars 31 forks source link

Installer: Governance addresses for Substrate are not uniquely created #348

Closed dillu24 closed 1 year ago

dillu24 commented 1 year ago

Summary of bug

In the legacy installer we are asking the node operator to enter multiple governance adresses per node. For the MonitorsManager to work as intended, the governance_addresses field supplied in the configs must have a unique value across all nodes. Therefore, the installer must combine the different governance addresses into a single list and add this list to each node sub-config. As it is, the legacy installer is not doing this and therefore we did not include this in the new installer. Therefore, we must do this fix on the new installer so that the alerter is never broken.

Steps to reproduce

  1. Go on the substrate installer journey for the legacy installer
  2. Create 2 node configurations with different governance addresses
  3. Save the configurations
  4. Go on the NetworkMonitorsManager logs
  5. You could see a related error

Requirements

To fix this it is suggested that the governance addresses are added under the monitor_network field and then uniquely copied across every sub config. It is important that we don't ask for governance addresses if no nodes are added.

Acceptance criteria

Given: I add nodes When: Asked for network monitoring and I click yes
Then: I am asked if there are governance addresses that I want to monitor And: Looking at the database Then: monitor_network and governance_addresses is unique across all nodes

Given: I add no nodes Then: I am not asked to enter monitor_network and governance_addresses and by default they are set to false and empty string respectively.

Given: I add nodes and set monitor_network to True Then: I have the possibility to not enter any governance addresses

Given: I add nodes and set monitor_network to False Then: I cannot enter governance addresses