Skip to content
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

Open
wants to merge 7 commits into
base: feat/oracle-v5
Choose a base branch
from

Conversation

vgorkavenko
Copy link
Contributor

No description provided.

@vgorkavenko vgorkavenko added the V5 label Dec 4, 2024
@vgorkavenko vgorkavenko force-pushed the feat/account-cl-pending-deposits-validators branch 2 times, most recently from a79c847 to 6d2f2ff Compare December 5, 2024 12:56
@vgorkavenko vgorkavenko marked this pull request as ready for review December 5, 2024 14:54
@vgorkavenko vgorkavenko changed the base branch from develop to feat/oracle-v5 December 12, 2024 09:52
src/constants.py Outdated Show resolved Hide resolved
src/web3py/extensions/lido_validators.py Outdated Show resolved Hide resolved
@@ -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)
Copy link
Member

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
Copy link
Member

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

@vgorkavenko vgorkavenko requested a review from F4ever January 7, 2025 14:51
@vgorkavenko vgorkavenko force-pushed the feat/account-cl-pending-deposits-validators branch from 947ebec to 32ee2a1 Compare January 7, 2025 16:11
@@ -1,3 +1,5 @@
from src.types import Gwei
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imported twice.

Comment on lines +44 to +54
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)
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants