Skip to content

test(plutus): speed up PlutusV3 builtins tests - #3741

Merged
mkoura merged 3 commits into
masterfrom
plutusv3_builtins_speedup
Oct 6, 2026
Merged

mkoura merged 3 commits into
masterfrom
plutusv3_builtins_speedup

Conversation

@mkoura

@mkoura mkoura commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

test_plutusv3_builtins_new_cost was the longest test in the Leios testrun (220 min). It was also picked up only 86 min into the run, so it finished an hour after all other tests, with 19 of 20 workers idle. The builtins tests ran one script at a time, and each script waited for its own funding tx and its own mint tx.

Schedule new_cost first

Mark test_plutusv3_builtins_new_cost with order(5), so it starts in the first wave of long tests instead of near the end.

Fund the token issuer in batches

  • Fund the issuer for up to 30 scripts in a single tx, instead of one funding tx per script. The tests with the old cost model, where mints fail already at build time, spent nearly all their time on funding.
  • Fund the payment address once per test, for all chunks.
  • Cache the addresses per variant, so tests running in parallel on the same cluster instance don't share them.
  • Check the outputs of the funding tx instead of the issuer address balance.

Confirm mints per chunk

  • Submit the mint txs without waiting for them to appear on chain, and confirm all mints of a chunk together. That is one wait per chunk instead of one per script.
  • Expected failures are still caught at build or submit time, in the script's own subtest.
  • Each submitted mint is checked in its own _minted subtest.
  • Txs that didn't make it to the chain are resubmitted, but only after a round where none got confirmed, as not all of them fit into one block. Only such rounds count against the attempts limit.
  • Tx file names include the script index, so scripts with the same file stem don't overwrite each other's pending txs.

Results (Leios testrun, 20 workers, 9 cluster instances)

before after
Testrun wall time 317 min 245 min
new_cost picked up / finished 86 / 317 min 0 / 54 min
new_cost 220 min 48 min
old[batch5] 33 min 2.2 min
old[batch6] 101 min 4.4 min

The run is now evenly packed: all workers are busy until the end, and there is no single-test tail.

mkoura added 3 commits October 6, 2026 13:52
`test_plutusv3_builtins_new_cost` is the longest test (220 min in CI).
It was picked up only 86 min into the run, finishing an hour after all
other tests. Mark it with `order(5)` so it starts in the first wave.
Fund the token issuer for up to 30 scripts in a single transaction,
instead of one funding transaction per script. This saves one tx and
one wait for a block per script. Tests with old cost model, where
mints fail already at build time, spent nearly all their time on
funding (33 and 101 min in CI).

Fund the payment address once per test, for all chunks, and cache the
addresses per variant, so tests running in parallel on the same
cluster instance don't share them. Check the outputs of the funding tx
instead of the issuer address balance.
Submit the minting transactions without waiting for them to appear on
chain, and confirm all minting transactions of a chunk together. This
replaces a wait for blocks per script with a single wait per chunk.

Transactions that didn't make it to the chain are resubmitted, but
only after a round where none got confirmed, as not all of them fit
into one block. Only such rounds count against the attempts limit.

Each submitted mint is checked in its own `_minted` subtest. Tx file
names now include the script index, so scripts with the same file
stem (e.g. V1 and V2 `anyone-can-mint`) don't overwrite each other's
pending transactions.
@mkoura
mkoura requested a review from saratomaz as a code owner October 6, 2026 11:57
@mkoura
mkoura requested a balanced review from Copilot and removed request for saratomaz October 6, 2026 11:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The batching and confirmation logic is consistent with existing test infrastructure and no blocking issues were found.

Review effort: Balanced
Findings: None

What changed in this PR

Optimizes PlutusV3 builtin tests to reduce Leios test-run duration.

Changes:

  • Batches issuer funding and mint confirmation.
  • Uses variant-specific cached addresses and unique transaction names.
  • Schedules the longest test earlier.
File Description
cardano_node_tests/​tests/​tests_plutus_v3/​test_mint_build.py Adds batched funding, asynchronous mint confirmation, and early scheduling.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@mkoura
mkoura merged commit 3d5bd71 into master Oct 6, 2026
4 checks passed
@mkoura
mkoura deleted the plutusv3_builtins_speedup branch October 6, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants