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.

👍🏼

kwxm and others added 2 commits December 10, 2025 11:23
Refactored Plutus V3 builtins minting tests to combine batch5 and batch6
into a single test class. Added support for protocol version and cost
model checks, and improved test scenario handling. Updated cost model
logic and removed duplicated code for batch6.

Test following scenarios:
- wrong protocol version
- correct protocol version with old cost model
- correct protocol version with updated cost model
@mkoura mkoura force-pushed the kwxm/e2e/batch6/dropList branch from 3f759d2 to d9e07cb Compare December 10, 2025 10:26
@mkoura
Copy link
Collaborator

mkoura commented Dec 10, 2025

@Unisay @kwxm @zliu41 I have refactored the code to run batch5 and batch6 tests together, in order to be able to test following scenarios:

  • wrong protocol version
  • correct protocol version with old cost model
  • correct protocol version with updated cost model

with just single cost model update.

Protocol version 11 is now available for testing. You can follow instructions in https://github.com/IntersectMBO/cardano-node-tests?tab=readme-ov-file#-persistent-local-testnet-for-repeated-testing, and in step 4. run the command as PROTOCOL_VERSION=11 ./dev_workdir/conway_fast/start-cluster. Or use PROTOCOL_VERSION=11 when running the tests using regression.sh.

@kwxm
Copy link
Author

kwxm commented Dec 10, 2025

@Unisay @kwxm @zliu41 I have refactored the code to run batch5 and batch6 tests together, in order to be able to test following scenarios:

@mkoura Thanks Martin: I was just about to contact you about this! I'lll update my branch with your changes and see how I get on.

@zliu41
Copy link
Member

zliu41 commented Dec 11, 2025

@mkoura Nice. So we first run the tests locally, and then merge the PR once the tests pass? Is that the right workflow?

@mkoura
Copy link
Collaborator

mkoura commented Dec 11, 2025

@zliu41 We can merge the tests once we can run also the "passing" variant. The only missing thing preventing us from doing that is the correct cost model.

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.

5 participants