From a3619e8e48bba78e09df99190b584a2cd2e8dfaf Mon Sep 17 00:00:00 2001 From: Martin Kourim Date: Fri, 6 Nov 2026 10:02:55 +0100 Subject: [PATCH] fix: keep negative script spends in the future Refresh validity bounds after funding for the all2 and any2 scenarios, with a one-hour margin adjusted for slot length. This prevents funding delays under load from making the negative transactions valid before submission. Guard version-dependent error text with the existing helper while keeping the expected exception requirement strict. Validation: make lint and all 12 affected E2E variants passed on an isolated local_fast cluster without sustained load. --- cardano_node_tests/tests/test_scripts.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cardano_node_tests/tests/test_scripts.py b/cardano_node_tests/tests/test_scripts.py index def503e46..0491a7e8e 100644 --- a/cardano_node_tests/tests/test_scripts.py +++ b/cardano_node_tests/tests/test_scripts.py @@ -3107,6 +3107,14 @@ def test_invalid( # noqa: C901 # Try to send funds from script address out_utxos = cluster.g_query.get_utxo(tx_raw_output=tx_output) script_utxos = clusterlib.filter_utxos(utxos=out_utxos, address=script_address) + if scenario in ("all2", "any2"): + # Funding can take minutes under load. Keep the spend an hour in the future; + # a later Tx lower bound still satisfies the script's original "after" slot. + invalid_before = max(invalid_before, cluster.g_query.get_slot_no()) + int( + 3_600 / cluster.slot_length + ) + invalid_hereafter = invalid_before + 100 + with pytest.raises((clusterlib.CLIError, submit_api.SubmitApiError)) as excinfo: multisig_tx( cluster_obj=cluster, @@ -3123,7 +3131,8 @@ def test_invalid( # noqa: C901 build_method=build_method, ) exc_value = str(excinfo.value) - assert expected_err in exc_value, exc_value + with common.allow_unstable_error_messages(): + assert expected_err in exc_value, exc_value dbsync_utils.check_tx(cluster_obj=cluster, tx_raw_output=tx_output)