E2E tests for array builtins (CIP-0138, Batch 6, PV 11) #3227
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.
Context
indexArray,lengthOfArray, andlistToArraybuiltins introduced in Plutus Core Batch 6Approach
Implemented E2E tests following the established pattern from Batch 5 builtins (bitwise, RIPEMD-160). Key design decisions:
Test Organization:
TestPlutusBatch6V3Builtinsclass (array builtins are Batch 6 per Plutus Core spec)"Array builtins require PV11+ (currently not supported in cardano-node-tests)"Script Source:
yura/add-array-builtin-scriptsbranch)Why Minting Policies:
Array builtins are pure computational functions that don't require transaction context, datum management, or UTxO state. Minting policies provide:
Changes
Test Scripts (Binary)
succeedingIndexArrayPolicyScriptV3.plutus(299 bytes) - TestsindexArray arr 2 == 3for[1,2,3,4,5]succeedingLengthOfArrayPolicyScriptV3.plutus(286 bytes) - TestslengthOfArray arr == 3for[10,20,30]succeedingListToArrayPolicyScriptV3.plutus(360 bytes) - Tests conversion + boundary access for[100,200,300,400]Script Definitions (plutus_common.py:467-493)
PlutusScriptDatadefinitions with PV11 requirement documented(0, 0)placeholders (will be updated after PV11 testing)SUCCEEDING_MINTING_ARRAY_SCRIPTS_V3tuple for parametrized testingTest Class (test_mint_build.py:190-317)
TestPlutusBatch6V3Builtins- New test class with comprehensive docstring explaining PV11 blockerskip_bootstrapfixture checks for PV11+ (currently skips all tests)test_array_builtins- Parametrized test covering all 3 array scripts@pytest.mark.smokefor quick validation once PV11 availableHow to Test
Current Status: Tests will skip until PV11 support added. To verify test infrastructure:
After PV11 Support Available:
Ensure cluster is running PV11+ with updated PlutusV3 cost model:
Run array builtin tests:
pytest -k "array_builtins" cardano_node_tests/tests/tests_plutus_v3/test_mint_build.py -vExtract execution costs from test output:
per_timeandper_spacevalues in test logsindexArray: O(1) constant time/memorylengthOfArray: O(1) constant time/memorylistToArray: O(n) linear time/memoryRun full smoke test suite:
pytest -m "smoke" cardano_node_tests/tests/tests_plutus_v3/test_mint_build.pyExpected Results:
Performance Expectations (CIP-0138)
indexArraylengthOfArraylistToArrayDependencies
Author's Checklist
Added execution cost measurements(blocked until PV11)Verified tests pass on PV11 cluster(blocked until PV11)Post-PV11 Follow-up
Once PV11 support is available:
Closes #3227