Skip to content

Conversation

@kwxm
Copy link

@kwxm kwxm commented Nov 20, 2025

This adds some end-to-end tests for the Plutus Core dropList function which is due to appear at PV11. The testing machinery doesn't yet know about PV11, so all of these tests fail with messages like

Script evaluation error: Failed to deserialise a script: CBOR deserialisation failed at the offset 598 for the following reason: BadEncoding (0x0000004200418e56,S {currPtr = 0x0000004200418c21, usedBits = 4}) "Builtin function DropList is not available in language PlutusV3 at and protocol version 10".

Another current PR contains some code to skip these tests, but I haven't attempted to copy that because I'm not sure what it's doing. I'd also prefer to merge this PR before the other one because it tries to keep all of the new scripts in one place (see next paragraph).

The test scripts are generated from the code added in mkoura/plutus-scripts-e2e#13 and are stored in the directory cardano_node_tests/tests/data/plutus/v3/batch6/, where the tests for all of the new PV11 functions will be added. It would be sensible to organise the exisitng tests into similar directories so that it's easier to keep track of them, but that would take some time which we don't have at the moment.

Note also that all of these tests are for PlutusV3 and the Plutus language version 1.1.0. At PV11 all of the builtins will become available in PlutusV1 and PlutusV2 as well, and it will also be possible to use all of them with Plutus 1.0.0 (prior to PV11 the possible combinations were very restricted, but we're now able to relax this). We should really test all of the functions in all possilbe combinations of Plutus versions, but this will require some thought and perhaps substantial alterations to the testing code.

@kwxm kwxm requested a review from Unisay November 20, 2025 07:03
@Unisay Unisay self-assigned this Nov 20, 2025
Unisay added a commit that referenced this pull request Nov 20, 2025
Move array builtin scripts to v3/batch6/ subdirectory to align with
Kenneth's organizational structure for all PV11 builtins.

This makes it easier to:
- Locate all Batch 6 (PV11) builtins in one place
- Distinguish from earlier batch builtins
- Integrate with other PV11 features (dropList, etc.)

Related: PR #3228 (dropList tests)
Unisay added a commit that referenced this pull request Nov 20, 2025
Expand array builtin tests to cover all Plutus version combinations at PV11:
- Plutus versions: V1, V2, V3
- Language versions: 1.0.0, 1.1.0
- Functions: indexArray, lengthOfArray, listToArray
- Total: 18 test cases (3 × 3 × 2)

## Implementation

**Programmatic Script Generation (plutus_common.py):**
- Replace hardcoded definitions with loop-based generation
- 18 script combinations defined in ~40 lines vs 180+ if hardcoded
- Easy to extend: just add to ARRAY_FUNCTIONS list
- Clear test IDs: INDEXARRAY_V3_1_1_0, etc.

**Directory Structure:**
- Organized by version and language: v1/batch6/1.0.0/, v1/batch6/1.1.0/, etc.
- Scripts renamed with version suffix for clarity
- README.md in each directory documenting missing scripts

**Test Matrix:**
- Single test method expands to 18 test instances via parametrization
- Backward compatible: existing V3/1.1.0 names preserved
- Clear documentation of what's tested and what's missing

## Current Status

**Existing:** 3 of 18 scripts (V3/1.1.0 only)
**Missing:** 15 scripts need generation in plutus-scripts-e2e

Missing scripts will cause test failures until generated. READMEs document
exact files needed and generation instructions.

## Benefits

- Complete coverage when all scripts generated (~3-5 hours effort)
- Same pattern applies to other batch6 builtins (dropList, etc.)
- Maintainable: programmatic approach scales easily
- Clear test names show exactly which combination failed

Related: Kenneth's PR #3228 (dropList, establishes batch6 directory pattern)
@kwxm
Copy link
Author

kwxm commented Nov 20, 2025

I think I need to reformat the code ...
OK, that looks better.

Copy link

@Unisay Unisay left a comment

Choose a reason for hiding this comment

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

👍🏼

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.

3 participants