Skip to content

Commit

Permalink
Review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeny-stakewise committed Nov 23, 2023
1 parent 1fe179c commit b3c8cce
Showing 3 changed files with 9 additions and 18 deletions.
21 changes: 7 additions & 14 deletions src/common/execution.py
Original file line number Diff line number Diff line change
@@ -83,23 +83,16 @@ async def update_oracles_cache() -> None:
rewards_threshold = Web3.to_int(multicall_response[0][1])
validators_threshold = Web3.to_int(multicall_response[1][1])

if _oracles_cache:
_oracles_cache.config = config
_oracles_cache.validators_threshold = validators_threshold
_oracles_cache.rewards_threshold = rewards_threshold
_oracles_cache.checkpoint_block = to_block
else:
_oracles_cache = OraclesCache(
config=config,
validators_threshold=validators_threshold,
rewards_threshold=rewards_threshold,
checkpoint_block=to_block,
)
_oracles_cache = OraclesCache(
config=config,
validators_threshold=validators_threshold,
rewards_threshold=rewards_threshold,
checkpoint_block=to_block,
)


async def get_oracles() -> Oracles:
if not _oracles_cache:
await update_oracles_cache()
await update_oracles_cache()

oracles_cache = cast(OraclesCache, _oracles_cache)

3 changes: 1 addition & 2 deletions src/exits/tasks.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@

from src.common.contracts import keeper_contract
from src.common.exceptions import NotEnoughOracleApprovalsError
from src.common.execution import get_oracles, update_oracles_cache
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
@@ -34,7 +34,6 @@ async def update_exit_signatures(
keystores: Keystores,
remote_signer_config: RemoteSignerConfiguration | None,
) -> None:
await update_oracles_cache()
oracles = await get_oracles()
update_block = await _fetch_last_update_block()
if update_block and not await is_block_finalized(update_block):
3 changes: 1 addition & 2 deletions src/validators/tasks.py
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
from src.common.clients import ipfs_fetch_client
from src.common.contracts import v2_pool_escrow_contract, validators_registry_contract
from src.common.exceptions import NotEnoughOracleApprovalsError
from src.common.execution import check_gas_price, get_oracles, update_oracles_cache
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
@@ -72,7 +72,6 @@ async def register_validators(
return

# get latest oracles
await update_oracles_cache()
oracles = await get_oracles()

validators_count = min(oracles.validators_approval_batch_limit, validators_count)

0 comments on commit b3c8cce

Please sign in to comment.