Skip to content

Commit

Permalink
Revert "Less get_oracles calls"
Browse files Browse the repository at this point in the history
This reverts commit a9fde1e.
  • Loading branch information
evgeny-stakewise committed Oct 31, 2023
1 parent a9fde1e commit 6176707
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 4 additions & 6 deletions src/commands/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import src
from src.common.clients import consensus_client, execution_client
from src.common.execution import check_hot_wallet_balance, get_oracles
from src.common.execution import check_hot_wallet_balance
from src.common.metrics import metrics, metrics_server
from src.common.startup_check import startup_checks
from src.common.utils import get_build_version, log_verbose
Expand Down Expand Up @@ -245,7 +245,7 @@ def start(
log_verbose(e)


async def main() -> None: # pylint: disable=too-many-statements
async def main() -> None:
setup_logging()
setup_sentry()
log_start()
Expand Down Expand Up @@ -315,13 +315,10 @@ async def main() -> None: # pylint: disable=too-many-statements
remote_signer_config=remote_signer_config,
deposit_data=deposit_data,
)
oracles = await get_oracles()

await register_validators(
keystores=keystores,
remote_signer_config=remote_signer_config,
deposit_data=deposit_data,
oracles=oracles,
)

# submit harvest vault transaction
Expand All @@ -330,7 +327,8 @@ async def main() -> None: # pylint: disable=too-many-statements

# process outdated exit signatures
await update_exit_signatures_periodically(
keystores=keystores, remote_signer_config=remote_signer_config, oracles=oracles
keystores=keystores,
remote_signer_config=remote_signer_config,
)
# check balance
await check_hot_wallet_balance()
Expand Down
5 changes: 4 additions & 1 deletion src/exits/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from web3.types import HexStr

from src.common.contracts import keeper_contract
from src.common.execution import get_oracles
from src.common.metrics import metrics
from src.common.typings import Oracles
from src.common.utils import get_current_timestamp, is_block_finalized, log_verbose
Expand All @@ -28,8 +29,10 @@


async def update_exit_signatures_periodically(
keystores: Keystores, remote_signer_config: RemoteSignerConfiguration | None, oracles: Oracles
keystores: Keystores,
remote_signer_config: RemoteSignerConfiguration | None,
) -> None:
oracles = await get_oracles()
update_block = await _fetch_last_update_block()
if update_block and not await is_block_finalized(update_block):
logger.info('Signatures update block %d has not finalized yet', update_block)
Expand Down
5 changes: 3 additions & 2 deletions src/validators/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from src.common.clients import ipfs_fetch_client
from src.common.contracts import validators_registry_contract
from src.common.exceptions import NotEnoughOracleApprovalsError
from src.common.execution import check_gas_price
from src.common.execution import check_gas_price, get_oracles
from src.common.metrics import metrics
from src.common.typings import Oracles
from src.common.utils import MGNO_RATE, WAD, get_current_timestamp
Expand Down Expand Up @@ -46,7 +46,6 @@ async def register_validators(
keystores: Keystores,
remote_signer_config: RemoteSignerConfiguration | None,
deposit_data: DepositData,
oracles: Oracles,
) -> None:
"""Registers vault validators."""
vault_balance, update_state_call = await get_withdrawable_assets()
Expand All @@ -56,6 +55,8 @@ async def register_validators(

metrics.stakeable_assets.set(int(vault_balance))

# get latest oracles
oracles = await get_oracles()
logger.debug('Fetched latest oracles: %s', oracles)

approval_max_validators = oracles.validators_approval_batch_limit
Expand Down

0 comments on commit 6176707

Please sign in to comment.