Refactor protocol version handling and update bitwise script gating#3451
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
VERSIONSto derivecluster_era/cluster_era_namefromPROTOCOL_VERSION, and align transaction-era selection with that logic. - Update cluster environment construction to use
VERSIONS.*_era_namevalues, 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.
`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.
d19b551 to
2a37e38
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
VERSIONSutility to use aPROTOCOL_VERSIONenvironment variable for protocol selection, defaulting to the latest cluster era if not set. This also introducescluster_era(protocol version number) andcluster_era_name(era name), clarifying their distinction and usage throughout the codebase. (cardano_node_tests/utils/versions.py) [1] [2]VERSIONS.cluster_era_nameandVERSIONS.command_era_nameinstead of configuration values, ensuring consistency with the new protocol versioning logic. (cardano_node_tests/utils/cluster_nodes.py)Plutus script test selection improvements:
cardano_node_tests/tests/plutus_common.py) [1] [2] [3]cardano_node_tests/tests/plutus_common.py) [1] [2] [3]Test runner and documentation updates:
PROTOCOL_VERSION=11before running smoke tests in upgrade scenarios, ensuring the correct protocol is tested post-upgrade. (runner/node_upgrade_pytest.sh)CLUSTER_ERAenvironment variable description in the documentation to indicate it refers to the testnet cluster era. (README.md)Test logic correction:
cardano_node_tests/tests/test_cli.py)