Skip to content

Refactor protocol version handling and update bitwise script gating#3451

Merged
mkoura merged 3 commits into
masterfrom
move_pv11_failing_bitwise_scripts
May 6, 2026
Merged

Refactor protocol version handling and update bitwise script gating#3451
mkoura merged 3 commits into
masterfrom
move_pv11_failing_bitwise_scripts

Conversation

@mkoura
Copy link
Copy Markdown
Collaborator

@mkoura mkoura commented May 6, 2026

This pull request introduces several important updates to the test infrastructure and Plutus script handling, primarily focusing on protocol versioning, environment variable usage, and the conditional inclusion of Plutus scripts based on node and protocol versions. The changes improve clarity and flexibility in test configuration and ensure correct test coverage for different Cardano node versions.

Protocol version and era handling:

  • Refactored the VERSIONS utility to use a PROTOCOL_VERSION environment variable for protocol selection, defaulting to the latest cluster era if not set. This also introduces cluster_era (protocol version number) and cluster_era_name (era name), clarifying their distinction and usage throughout the codebase. (cardano_node_tests/utils/versions.py) [1] [2]
  • Updated cluster environment construction to use VERSIONS.cluster_era_name and VERSIONS.command_era_name instead of configuration values, ensuring consistency with the new protocol versioning logic. (cardano_node_tests/utils/cluster_nodes.py)

Plutus script test selection improvements:

  • Modified the lists of succeeding and failing Plutus V3 bitwise scripts to conditionally include rotate/shift scripts based on protocol and node version, reflecting their changed behavior in PV11+. (cardano_node_tests/tests/plutus_common.py) [1] [2] [3]
  • Refactored batch6 script lists to conditionally include extra scripts for node >= 10.7.0, improving maintainability and correctness. (cardano_node_tests/tests/plutus_common.py) [1] [2] [3]

Test runner and documentation updates:

  • Updated the test runner to export PROTOCOL_VERSION=11 before running smoke tests in upgrade scenarios, ensuring the correct protocol is tested post-upgrade. (runner/node_upgrade_pytest.sh)
  • Clarified the CLUSTER_ERA environment variable description in the documentation to indicate it refers to the testnet cluster era. (README.md)

Test logic correction:

  • Fixed a test skip condition to ensure tests only run when the transaction era is at least the default cluster era, not just equal. (cardano_node_tests/tests/test_cli.py)

@mkoura mkoura requested a review from saratomaz as a code owner May 6, 2026 19:58
@mkoura mkoura requested a review from Copilot May 6, 2026 19:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors how protocol versions are selected for tests by introducing PROTOCOL_VERSION as the primary selector, then updates cluster environment metadata and Plutus script/test gating to reflect protocol/node-version dependent behavior (notably PV11+ bitwise builtins and batch6 script availability).

Changes:

  • Refactor VERSIONS to derive cluster_era / cluster_era_name from PROTOCOL_VERSION, and align transaction-era selection with that logic.
  • Update cluster environment construction to use VERSIONS.*_era_name values, and adjust CLI test skipping logic for “latest TX era” to allow newer protocol versions.
  • Adjust Plutus V3 bitwise + batch6 script inclusion lists based on protocol version and node version; ensure upgrade smoke tests run under PROTOCOL_VERSION=11.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
runner/node_upgrade_pytest.sh Exports PROTOCOL_VERSION=11 before step3 smoke tests to ensure correct post-upgrade protocol selection.
README.md Clarifies CLUSTER_ERA meaning in the environment variables table.
cardano_node_tests/utils/versions.py Refactors version/era derivation to be driven by PROTOCOL_VERSION, adding clearer separation between protocol version and era name.
cardano_node_tests/utils/cluster_nodes.py Uses VERSIONS era names when building ClusterEnv.
cardano_node_tests/tests/test_cli.py Fixes skip condition to allow TX eras newer than the default cluster era.
cardano_node_tests/tests/plutus_common.py Gates Plutus V3 bitwise rotate/shift scripts and batch6 script lists based on protocol/node versions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cardano_node_tests/utils/cluster_nodes.py Outdated
mkoura added 3 commits May 6, 2026 22:13
`cluster_era` now holds the protocol version (set via the
`PROTOCOL_VERSION` env var, default `DEFAULT_CLUSTER_ERA`) and
`cluster_era_name` is the era that maps to it. `CLUSTER_ERA` env is
used only to select the testnet startup scripts.

`MAP` membership is validated to fail fast on unsupported protocol
versions. `cluster_nodes.get_cluster_env` reads the era/command-era
through `VERSIONS` so callers see the resolved values.

Adjust `test_cli.TestQueryUTxO` skip to use `<` against the default
cluster era so it doesn't skip on protocol-version bumps within the
same era.
Move `succeedingRotateByteStringPolicyScriptV3` and
`succeedingShiftByteStringPolicyScriptV3` between succeeding and
failing buckets based on the active protocol version: they succeed
pre-PV11 and fail under PV11+ on node >= 11.0.0.

While here, gate the batch6 extras (BLS multi-scalar mul, value-map
ops, casing on constants) on node >= 10.7.0 inline with the parent
tuple definitions instead of mutating module-level tuples behind
`# type: ignore[assignment]`.
Export `PROTOCOL_VERSION=11` after the step3 hardfork pytest so the
smoke-test run that follows sees the upgraded protocol version when
selecting succeeding/failing bitwise scripts.
@mkoura mkoura force-pushed the move_pv11_failing_bitwise_scripts branch from d19b551 to 2a37e38 Compare May 6, 2026 20:14
@mkoura mkoura requested a review from Copilot May 6, 2026 20:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread cardano_node_tests/utils/versions.py
Comment thread cardano_node_tests/utils/versions.py
@mkoura mkoura merged commit 80634b0 into master May 6, 2026
7 checks passed
@mkoura mkoura deleted the move_pv11_failing_bitwise_scripts branch May 6, 2026 20:33
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