From cf88b4aa0b8d236677506d56452b0710892950bb Mon Sep 17 00:00:00 2001 From: Evgeniy Zdanovich Date: Mon, 24 Feb 2025 18:18:31 +0100 Subject: [PATCH] Repurpose prover_checkpoint_runner test to include sequencer restart logic. --- .../{ => prover}/prover_checkpoint_runner.py | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) rename functional-tests/tests/{ => prover}/prover_checkpoint_runner.py (67%) diff --git a/functional-tests/tests/prover_checkpoint_runner.py b/functional-tests/tests/prover/prover_checkpoint_runner.py similarity index 67% rename from functional-tests/tests/prover_checkpoint_runner.py rename to functional-tests/tests/prover/prover_checkpoint_runner.py index 35e7faef0..7f9817f54 100644 --- a/functional-tests/tests/prover_checkpoint_runner.py +++ b/functional-tests/tests/prover/prover_checkpoint_runner.py @@ -1,3 +1,5 @@ +import time + import flexitest from envs import testenv @@ -17,20 +19,18 @@ @flexitest.register class ProverCheckpointRunnerTest(testenv.StrataTester): + """This tests the prover's checkpoint runner with an unreliable sequencer service.""" + def __init__(self, ctx: flexitest.InitContext): # Increase the proof timeout so that the checkpoint index increments only # after the prover client submits the corresponding checkpoint proof rollup_settings = RollupParamsSettings.new_default() rollup_settings.proof_timeout = PROVER_CHECKPOINT_SETTINGS["PROVER_TIMEOUT_SECONDS"] - # Enable checkpoint proving on the prover client - prover_settings = ProverClientSettings.new_default() - prover_settings.enable_checkpoint_proving = "true" - ctx.set_env( BasicEnvConfig( pre_generate_blocks=101, - prover_client_settings=prover_settings, + prover_client_settings=ProverClientSettings.new_with_proving(), rollup_settings=rollup_settings, ) ) @@ -56,3 +56,20 @@ def main(self, ctx: flexitest.RunContext): ), timeout=PROVER_CHECKPOINT_SETTINGS["PROVER_TIMEOUT_SECONDS"], ) + + sequencer.stop() + # Wait some time to make sure checkpoint runner indeed polls + # on the checkpoint with the stopped (unreliable) sequencer. + time.sleep(10) + sequencer.start() + sequencer_rpc = sequencer.create_rpc() + + # Wait until another portion of consecutive proofs are generated and verified + # after the restart of the sequencer. + wait_until( + lambda: ( + sequencer_rpc.strata_getLatestCheckpointIndex() + == PROVER_CHECKPOINT_SETTINGS["CONSECUTIVE_PROOFS_REQUIRED"] * 2 + ), + timeout=PROVER_CHECKPOINT_SETTINGS["PROVER_TIMEOUT_SECONDS"], + )