Skip to content

Commit

Permalink
Manage Prysm >= 4.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
nalepae committed Sep 27, 2023
1 parent 39fb55c commit 2bbc454
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 41 deletions.
40 changes: 21 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,33 +61,35 @@ Command line options
--------------------

```
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ * --beacon-url TEXT URL of beacon node [required] │
│ --execution-url TEXT URL of execution node │
│ --pubkeys-file-path FILE File containing the list of public keys to watch │
│ --web3signer-url TEXT URL to web3signer managing keys to watch │
│ --fee-recipient TEXT Fee recipient address - --execution-url must be set │
│ --slack-channel TEXT Slack channel to send alerts - SLACK_TOKEN env var must be set │
│ --beacon-type [lighthouse|nimbus|prysm|old-teku|other] Use this option if connected to a Teku < 23.6.0, Prysm, Lighthouse or Nimbus │
│ beacon node. See https://github.com/ConsenSys/teku/issues/7204 for Teku < │
│ 23.6.0, https://github.com/prysmaticlabs/prysm/issues/11581 for Prysm, │
│ https://github.com/sigp/lighthouse/issues/4243 for Lighthouse, │
│ https://github.com/status-im/nimbus-eth2/issues/5019 and │
│ https://github.com/status-im/nimbus-eth2/issues/5138 for Nimbus. │
│ --relay-url TEXT URL of allow listed relay │
│ --liveness-file PATH Liveness file │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ * --beacon-url TEXT URL of beacon node [required] │
│ --execution-url TEXT URL of execution node │
│ --pubkeys-file-path FILE File containing the list of public keys to watch │
│ --web3signer-url TEXT URL to web3signer managing keys to watch │
│ --fee-recipient TEXT Fee recipient address - --execution-url must be set │
│ --slack-channel TEXT Slack channel to send alerts - SLACK_TOKEN env var must be set │
│ --beacon-type [lighthouse|nimbus|old-prysm|old-teku|other] Use this option if connected to a Teku < 23.6.0, Prysm < 4.0.8, Lighthouse or │
│ Nimbus beacon node. See https://github.com/ConsenSys/teku/issues/7204 for Teku < │
│ 23.6.0, https://github.com/prysmaticlabs/prysm/issues/11581 for Prysm < 4.0.8, │
│ https://github.com/sigp/lighthouse/issues/4243 for Lighthouse, │
│ https://github.com/status-im/nimbus-eth2/issues/5019 and │
│ https://github.com/status-im/nimbus-eth2/issues/5138 for Nimbus. │
│ [default: BeaconType.OTHER] │
│ --relay-url TEXT URL of allow listed relay │
│ --liveness-file PATH Liveness file │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
```

Beacon nodes compatibility
--------------------------
Beacon type | Compatibility
-----------------|----------------------------------------------------------------------------------------------------------
Prysm | Partial with `--beacon-type=prysm` - Rewards computation disabled. See https://github.com/prysmaticlabs/prysm/issues/11581 for more details.
Lighthouse | Full with `--beacon-type=lighthouse`. See https://github.com/sigp/lighthouse/issues/4243 for more details.
Prysm `>= 4.0.8` | Full.
Prysm `< 4.0.8 ` | Partial with `--beacon-type=old-prysm` - Rewards computation disabled. See https://github.com/prysmaticlabs/prysm/issues/11581 for more details.
Teku `>= 23.6.0` | Full. You need to activate the [beacon-liveness-tracking-enabled](https://docs.teku.consensys.net/reference/cli#options) flag on your beacon node.
Teku `< 23.6.0 ` | Full with `--beacon-type=old-teku`. See https://github.com/ConsenSys/teku/pull/7212 for more details. You need to activate the [beacon-liveness-tracking-enabled](https://docs.teku.consensys.net/reference/cli#options) flag on your beacon node.
Lighthouse | Full with `--beacon-type=lighthouse`. See https://github.com/sigp/lighthouse/issues/4243 for more details.
Nimbus | Partial with `--beacon-type=nimbus` - Missed attestations detection and rewards computation disabled. See https://github.com/status-im/nimbus-eth2/issues/5019 and https://github.com/status-im/nimbus-eth2/issues/5138 for more details.
Lodestar | Not (yet) tested.

Expand Down
9 changes: 5 additions & 4 deletions eth_validator_watcher/beacon.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,14 @@ def get_rewards(
# https://github.com/status-im/nimbus-eth2/issues/5138,
# we just assume there is no rewards at all

if beacon_type in {BeaconType.NIMBUS, BeaconType.PRYSM}:
if beacon_type in {BeaconType.NIMBUS, BeaconType.OLD_PRYSM}:
if self.__first_rewards_call:
self.__first_rewards_call = False
print(
(
"⚠️ You are using Prysm or Nimbus. Rewards will be ignored. "
"See https://github.com/prysmaticlabs/prysm/issues/11581 "
"⚠️ You are using Prysm < 4.0.8 or Nimbus. Rewards will be "
"ignored. See "
"https://github.com/prysmaticlabs/prysm/issues/11581 "
"(Prysm) & https://github.com/status-im/nimbus-eth2/issues/5138 "
"(Nimbus) for more information."
)
Expand Down Expand Up @@ -261,7 +262,7 @@ def get_validators_liveness(

beacon_type_to_function = {
BeaconType.LIGHTHOUSE: self.__get_validators_liveness_lighthouse,
BeaconType.PRYSM: self.__get_validators_liveness_beacon_api,
BeaconType.OLD_PRYSM: self.__get_validators_liveness_beacon_api,
BeaconType.OLD_TEKU: self.__get_validators_liveness_old_teku,
BeaconType.OTHER: self.__get_validators_liveness_beacon_api,
}
Expand Down
8 changes: 4 additions & 4 deletions eth_validator_watcher/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ def handler(
BeaconType.OTHER,
case_sensitive=False,
help=(
"Use this option if connected to a Teku < 23.6.0, Prysm, Lighthouse or "
"Nimbus beacon node. "
"Use this option if connected to a Teku < 23.6.0, Prysm < 4.0.8, "
"Lighthouse or Nimbus beacon node. "
"See https://github.com/ConsenSys/teku/issues/7204 for Teku < 23.6.0, "
"https://github.com/prysmaticlabs/prysm/issues/11581 for Prysm, "
"https://github.com/prysmaticlabs/prysm/issues/11581 for Prysm < 4.0.8, "
"https://github.com/sigp/lighthouse/issues/4243 for Lighthouse, "
"https://github.com/status-im/nimbus-eth2/issues/5019 and "
"https://github.com/status-im/nimbus-eth2/issues/5138 for Nimbus."
),
show_default=False,
show_default=True,
),
relay_url: List[str] = Option(
[], help="URL of allow listed relay", show_default=False
Expand Down
2 changes: 1 addition & 1 deletion eth_validator_watcher/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class CoinbaseTrade(BaseModel):
class BeaconType(str, Enum):
LIGHTHOUSE = "lighthouse"
NIMBUS = "nimbus"
PRYSM = "prysm"
OLD_PRYSM = "old-prysm"
OLD_TEKU = "old-teku"
OTHER = "other"

Expand Down
2 changes: 1 addition & 1 deletion tests/beacon/test_get_rewards.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_get_rewards_not_supported() -> None:

expected = Rewards(data=Rewards.Data(ideal_rewards=[], total_rewards=[]))

actual = beacon.get_rewards(BeaconType.PRYSM, 42, {8499, 8500})
actual = beacon.get_rewards(BeaconType.OLD_PRYSM, 42, {8499, 8500})
assert expected == actual

actual = beacon.get_rewards(BeaconType.NIMBUS, 42, {8499, 8500})
Expand Down
12 changes: 6 additions & 6 deletions tests/rewards/test_process_rewards_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

from eth_validator_watcher.models import BeaconType, Rewards, Validators
from eth_validator_watcher.rewards import (
net_ideal_sources_count,
net_ideal_targets_count,
net_ideal_heads_count,
net_actual_heads_count,
net_actual_neg_sources_count,
net_actual_pos_sources_count,
net_actual_neg_targets_count,
net_actual_pos_sources_count,
net_actual_pos_targets_count,
net_actual_heads_count,
net_ideal_heads_count,
net_ideal_sources_count,
net_ideal_targets_count,
net_suboptimal_heads_rate_gauge,
net_suboptimal_sources_rate_gauge,
net_suboptimal_targets_rate_gauge,
net_suboptimal_heads_rate_gauge,
process_rewards,
)
from eth_validator_watcher.utils import LimitedDict
Expand Down
12 changes: 6 additions & 6 deletions tests/rewards/test_process_rewards_our.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

from eth_validator_watcher.models import BeaconType, Rewards, Validators
from eth_validator_watcher.rewards import (
our_ideal_sources_count,
our_ideal_targets_count,
our_ideal_heads_count,
our_actual_heads_count,
our_actual_neg_sources_count,
our_actual_pos_sources_count,
our_actual_neg_targets_count,
our_actual_pos_sources_count,
our_actual_pos_targets_count,
our_actual_heads_count,
our_ideal_heads_count,
our_ideal_sources_count,
our_ideal_targets_count,
our_suboptimal_heads_rate_gauge,
our_suboptimal_sources_rate_gauge,
our_suboptimal_targets_rate_gauge,
our_suboptimal_heads_rate_gauge,
process_rewards,
)
from eth_validator_watcher.utils import LimitedDict
Expand Down

0 comments on commit 2bbc454

Please sign in to comment.