Skip to content

Commit 938b49d

Browse files
danceratopzSpencer Taylor-Brown
andcommitted
fix(consume): restore missing exponential retry logic for initial forkchoice update
Restore the exponential backoff retry logic from PR #1815 that was missing from the initial forkchoice update section. This ensures proper handling of clients that may return SYNCING status initially. Co-authored-by: Spencer Taylor-Brown <[email protected]>
1 parent 1c14cb8 commit 938b49d

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

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

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,22 @@ def test_blockchain_via_engine(
7676
# Skip the initial FCU update for enginex simulator
7777
with timing_data.time("Initial forkchoice update"):
7878
logger.info("Sending initial forkchoice update to genesis block...")
79-
forkchoice_response = engine_rpc.forkchoice_updated(
80-
forkchoice_state=ForkchoiceState(
81-
head_block_hash=genesis_header.block_hash,
82-
),
83-
payload_attributes=None,
84-
version=fixture.payloads[0].forkchoice_updated_version,
85-
)
86-
status = forkchoice_response.payload_status.status
87-
logger.info(f"Initial forkchoice update response: {status}")
79+
delay = 0.5
80+
for attempt in range(3):
81+
forkchoice_response = engine_rpc.forkchoice_updated(
82+
forkchoice_state=ForkchoiceState(
83+
head_block_hash=genesis_header.block_hash,
84+
),
85+
payload_attributes=None,
86+
version=fixture.payloads[0].forkchoice_updated_version,
87+
)
88+
status = forkchoice_response.payload_status.status
89+
logger.info(f"Initial forkchoice update response attempt {attempt + 1}: {status}")
90+
if status != PayloadStatusEnum.SYNCING:
91+
break
92+
if attempt < 2:
93+
time.sleep(delay)
94+
delay *= 2
8895
if forkchoice_response.payload_status.status != PayloadStatusEnum.VALID:
8996
raise LoggedError(
9097
f"unexpected status on forkchoice updated to genesis: {forkchoice_response}"

0 commit comments

Comments
 (0)