-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: account cl pending deposits validators #571
base: feat/oracle-v5
Are you sure you want to change the base?
feat: account cl pending deposits validators #571
Conversation
a79c847
to
6d2f2ff
Compare
src/modules/accounting/accounting.py
Outdated
@@ -217,7 +217,8 @@ def _get_consensus_lido_state(self, blockstamp: ReferenceBlockStamp) -> tuple[Va | |||
lido_validators = self.w3.lido_validators.get_lido_validators(blockstamp) | |||
|
|||
count = len(lido_validators) | |||
total_balance = Gwei(sum(int(validator.balance) for validator in lido_validators)) | |||
pending_deposits_sum = self.w3.lido_validators.calculate_pending_deposits_sum(lido_validators) | |||
total_balance = Gwei(sum(int(validator.balance) for validator in lido_validators) + pending_deposits_sum) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls, split this into 2 lines
active_balance = ...
total_balance = active_balance + pending_deposits_sum
add logs for pending and active balance totals
# NOTE: Using 32 ETH as a default validator pending balance is OK for the current protocol implementation. | ||
# It must be changed in case of validators consolidation feature implementation. | ||
return sum( | ||
MIN_ACTIVATION_BALANCE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe replace MIN_ACTIVATION_BALANCE
with smth lido specific?
eg LIDO_DEPOSIT_AMOUNT
947ebec
to
32ee2a1
Compare
@@ -1,3 +1,5 @@ | |||
from src.types import Gwei |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imported twice.
validators = [ValidatorFactory.build_pending_deposit_vals() for _ in range(5)] | ||
validators.extend(ValidatorFactory.batch(30)) | ||
lido_keys = LidoKeyFactory.generate_for_validators(validators[:15]) | ||
lido_keys.extend(LidoKeyFactory.batch(10)) | ||
|
||
web3.lido_validators._kapi_sanity_check = Mock() | ||
|
||
web3.cc.get_validators = Mock(return_value=validators) | ||
web3.kac.get_used_lido_keys = Mock(return_value=lido_keys) | ||
|
||
lido_validators = web3.lido_validators.get_lido_validators(blockstamp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not to build lido_validators
directly?
No description provided.