diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 51451b6..1251f72 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -5,6 +5,7 @@ ### Improvements * (alerts) Added a threshold for change in voting power to reduce alert spam in the case of tiny changes. The default is **1** and this can be customised by modifying the `change_in_voting_power_threshold` field in the `internal_config.ini`. * (errors) Improved handling of IncompleteRead errors that were showing up on the alert channels. +* (alerts/peers) Safe and danger boundary can now be `-1` and `-2` respectively, which causes peer alerts to be disabled since `peers > safe > danger` for any number of peers (`>= 0`). ## 1.1.2 diff --git a/doc/DESIGN_AND_FEATURES.md b/doc/DESIGN_AND_FEATURES.md index 796668c..2d54778 100644 --- a/doc/DESIGN_AND_FEATURES.md +++ b/doc/DESIGN_AND_FEATURES.md @@ -197,12 +197,16 @@ Voting power change alerts are mostly info alerts; voting power increase is alwa ### Number of Peers Alerts for changes in the number of peers range from info to major. + #### For Validator Nodes - Any decrease to `N` peers inside a configurable danger boundary `D1` is a major alert (i.e. `N <= D1`). - Any decrease to `N` peers inside a configurable safe boundary `S1` is a minor alert (i.e. `D1 < N <= s1`). - Any decrease to `N` peers outside a configurable safe boundary `S1` raises no alerts (i.e. `N > S1`). - Any increase to `N` peers inside a configurable safe/danger boundary `S1`/`D1` raises an info alert (i.e. `N <= S1/D1`) - Any increase to `N` peers outside a configurable safe boundary `S1` raises no alerts (i.e. `N > S1`). + +In general, `S1 > D1 >= -2` is enforced, where the `-2` lower bound allows the configuration `S1=-1, D1=-2` to be valid. This `-1,-2` configuration essentially disables peer change alerts since in any case `N > S1 > D1` + #### For Non-Validator Nodes - Any decrease to `N` peers inside a configurable danger boundary `D2` raises a minor alert (i.e. `N <= D2`). Otherwise, any other decreases raises no alert. - Any increase to `N` peers inside a configurable danger boundary `D2` raises an info alert (i.e. `N <= D2`). Otherwise, any other increase raises no alert. diff --git a/src/utils/config_parsers/internal.py b/src/utils/config_parsers/internal.py index 5cd2264..53fbdbe 100644 --- a/src/utils/config_parsers/internal.py +++ b/src/utils/config_parsers/internal.py @@ -127,15 +127,19 @@ def __init__(self, config_file_path: str) -> None: self.github_releases_template = section['github_releases_template'] # Safe boundary must be greater than danger boundary at all times for - # correct execution + # correct execution. The >= -2 allows the following config to be valid: + # - safe = -1, danger = -2 + # This disables peer alerts since in any case the following will be true: + # - peers > safe > danger def _peer_safe_and_danger_boundaries_are_valid(self) -> bool: return self.validator_peer_safe_boundary > \ - self.validator_peer_danger_boundary > 0 + self.validator_peer_danger_boundary >= -2 def _check_if_peer_safe_and_danger_boundaries_are_valid(self): while not self._peer_safe_and_danger_boundaries_are_valid(): print("validator_peer_safe_boundary must be STRICTLY GREATER than " - "validator_peer_danger_boundary for correct execution. " + "validator_peer_danger_boundary, which in turn must be " + "greater or equal to -2 for correct execution (S > D >= -2)." "\nPlease do the necessary modifications in the " "config/internal_config.ini file and restart the alerter.") sys.exit(-1)