10
10
from web3 .types import BlockIdentifier , Wei
11
11
12
12
from src .constants import (
13
- FAR_FUTURE_EPOCH ,
14
13
MIN_DEPOSIT_AMOUNT ,
15
14
TOTAL_BASIS_POINTS ,
16
15
)
@@ -79,18 +78,20 @@ def get_vaults_total_values(
79
78
80
79
A validator is included in the TV calculation if EITHER of the following conditions is true:
81
80
82
- 1. Already passed activation eligibility: validator.activation_eligibility_epoch != FAR_FUTURE_EPOCH
83
- 2. If not yet passed activation eligibility, the validator then is checked over the lazy oracle stages:
81
+ 1. It has already passed activation eligibility: validator.activation_eligibility_epoch != FAR_FUTURE_EPOCH
82
+ - add full balance + pending deposits are added to TV, as the validator is for sure will be activated
83
+ 2. If not-yet-eligible, then validator is checked over the registered PDG validator stages:
84
84
- PREDEPOSITED: add 1 ETH to TV, as only the predeposit is counted and not the validator balance
85
- - ACTIVATED: add full balance + pending deposits to TV, as the validator is for sure will be activated
86
-
87
- # NB: In the PDG validator proving flow, a validator initially receives 1 ETH on the consensus layer as a
88
- # predeposit. After the proof is submitted, an additional 31 ETH immediately appears on the consensus layer
89
- # as a pending deposit. If we ignore these pending deposits, vault's TV would appear to drop by 32 ETH
90
- # until the pending deposit is finalized and the validator is activated. To avoid this misleading drop,
91
- # the calculation of a validator's total balance must include all pending deposits, but only for those
92
- # validators that passed PDG flow. All side-deposited validators will appear in the TV as soon as the
93
- # validator becomes eligible for activation.
85
+ - ACTIVATED: count as `already passed activation`, thus add full balance + pending deposits to TV
86
+ - all other stages are skipped as not related to the non-eligible for activation validators
87
+
88
+ NB: In the PDG validator proving flow, a validator initially receives 1 ETH on the consensus layer as a
89
+ predeposit. After the proof is submitted, an additional 31 ETH immediately appears on the consensus layer
90
+ as a pending deposit. If we ignore these pending deposits, vault's TV would appear to drop by 32 ETH
91
+ until the pending deposit is finalized and the validator is activated. To avoid this misleading drop,
92
+ the calculation of a validator's total balance must include all pending deposits, but only for those
93
+ validators that passed PDG flow. All side-deposited validators will appear in the TV as soon as the
94
+ validator becomes eligible for activation.
94
95
"""
95
96
validators_by_vault = self ._get_validators_by_vault (validators , vaults )
96
97
total_pending_amount_by_pubkey = self ._get_total_pending_amount_by_pubkey (pending_deposits )
@@ -105,12 +106,12 @@ def get_vaults_total_values(
105
106
validator_pending_amount = total_pending_amount_by_pubkey .get (validator_pubkey , Gwei (0 ))
106
107
total_validator_balance = gwei_to_wei (Gwei (validator .balance + validator_pending_amount ))
107
108
108
- # NB: Include validator balance and all pending deposits in TV when validator is eligible for activation
109
- # or has already passed activation: activation_eligibility_epoch stays unchanged != FAR_FUTURE_EPOCH
110
- if validator .validator . activation_eligibility_epoch != FAR_FUTURE_EPOCH :
109
+ # Include validator balance and all pending deposits in TV when validator is eligible for activation or
110
+ # has already passed activation
111
+ if not has_far_future_activation_eligibility_epoch ( validator .validator ) :
111
112
vault_total += int (total_validator_balance )
112
113
113
- # For not-yet-eligible validators, use lazy oracle stages:
114
+ # For not-yet-eligible validators, use PDG stages:
114
115
# - PREDEPOSITED: add 1 ETH (guaranteed)
115
116
# - ACTIVATED: add full balance + pending deposits
116
117
# All other stages are skipped as not related to the non-eligible for activation validators
@@ -136,7 +137,7 @@ def _get_non_activated_validator_stages(
136
137
block_identifier : BlockIdentifier = 'latest' ,
137
138
) -> dict [str , ValidatorStage ]:
138
139
"""
139
- Get validator stages for non-activated validators for connected vaults from the lazy oracle.
140
+ Get PDG validator stages for non-activated validators for connected vaults from the lazy oracle.
140
141
"""
141
142
142
143
vault_wcs = {v .withdrawal_credentials for v in vaults .values ()}
0 commit comments