Skip to content

Commit fdad459

Browse files
authored
chore(consume): increase fcu retries to 30 (at 1 second each) (#2168)
* erigon requested increase of retries * do not wait after failure in last attempt
1 parent 562fde1 commit fdad459

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/pytest_plugins/consume/simulators/simulator_logic/test_via_engine.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
logger = get_logger(__name__)
2020

21+
MAX_RETRIES = 30
22+
DELAY_BETWEEN_RETRIES_IN_SEC = 1
23+
2124

2225
class LoggedError(Exception):
2326
"""Exception that uses the logger to log the failure."""
@@ -44,8 +47,7 @@ def test_blockchain_via_engine(
4447
# Send a initial forkchoice update
4548
with timing_data.time("Initial forkchoice update"):
4649
logger.info("Sending initial forkchoice update to genesis block...")
47-
delay = 0.5
48-
for attempt in range(3):
50+
for attempt in range(1, MAX_RETRIES + 1):
4951
forkchoice_response = engine_rpc.forkchoice_updated(
5052
forkchoice_state=ForkchoiceState(
5153
head_block_hash=fixture.genesis.block_hash,
@@ -54,16 +56,16 @@ def test_blockchain_via_engine(
5456
version=fixture.payloads[0].forkchoice_updated_version,
5557
)
5658
status = forkchoice_response.payload_status.status
57-
logger.info(f"Initial forkchoice update response attempt {attempt + 1}: {status}")
59+
logger.info(f"Initial forkchoice update response attempt {attempt}: {status}")
5860
if status != PayloadStatusEnum.SYNCING:
5961
break
60-
if attempt < 2:
61-
time.sleep(delay)
62-
delay *= 2
62+
63+
if attempt < MAX_RETRIES:
64+
time.sleep(DELAY_BETWEEN_RETRIES_IN_SEC)
6365

6466
if forkchoice_response.payload_status.status != PayloadStatusEnum.VALID:
6567
logger.error(
66-
f"Client failed to initialize properly after 3 attempts, "
68+
f"Client failed to initialize properly after {MAX_RETRIES} attempts, "
6769
f"final status: {forkchoice_response.payload_status.status}"
6870
)
6971
raise LoggedError(

0 commit comments

Comments
 (0)