Skip to content
This repository was archived by the owner on Apr 28, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions doc/DESIGN_AND_FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 7 additions & 3 deletions src/utils/config_parsers/internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)