Skip to content

Commit 561a743

Browse files
committed
fix: flaky smoke test
1 parent 9c76606 commit 561a743

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/modules/oracles/common/consensus.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ def __init__(self, w3: W3, **kwargs):
8080
raise NotImplementedError(f'{var} attribute should be set.')
8181

8282
def check_contract_configs(self):
83-
root = self.w3.cc.get_block_root('head').root
84-
block_details = self.w3.cc.get_block_details(root)
85-
bs = build_blockstamp(block_details)
83+
bs = self._get_latest_blockstamp()
8684

8785
config = self.get_chain_config(bs)
8886
cc_config = self.w3.cc.get_config_spec()

tests/main/test_main_cycle_smoke.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
import logging.handlers
33
import multiprocessing
44
from concurrent.futures import ProcessPoolExecutor
5+
from typing import cast
56

67
import pytest
78

89
from src import variables
910
from src.main import main
11+
from src.modules.common.daemon_module import DaemonModule
12+
from src.modules.oracles.common.consensus import ConsensusModule
1013
from src.types import OracleModuleName
1114

1215

@@ -22,6 +25,9 @@ def run_main_with_logging(self, module_name, log_queue):
2225
variables.DAEMON = False
2326
variables.CYCLE_SLEEP_IN_SECONDS = 0
2427

28+
# Use last finalized instead of head slot for avoiding calls with non-existent block at the moment of cycle
29+
ConsensusModule._get_latest_blockstamp = lambda self: cast(DaemonModule, self)._receive_last_finalized_slot()
30+
2531
if module_name is OracleModuleName.CSM:
2632
variables.PERFORMANCE_COLLECTOR_URI = ["http://localhost:9020"]
2733

0 commit comments

Comments
 (0)