Skip to content

Conversation

@kwxm
Copy link
Collaborator

@kwxm kwxm commented Nov 20, 2025

This adds some scripts for end-to-end tests for the dropList builtin due to be released at PV11. They're contained in a separate Batch6 directory..

Copy link
Collaborator

@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.

The content looks good to me,
but I'd like to propose/request a few improvements on top:

  • Please consider merging my proposed naming convention change to this PR. My other PR with the array builtins already uses that naming convention. It also addresses your previous version ambiguity concern.
  • I noticed the formatting is inconsistent. Please run treefmt command available in the nix shell which applies fourmolu to all codebase. It will align code formatting of this PR with the rest of the code. It should have made it into a pre-commit hook, really.

Copy link
Collaborator Author

@kwxm kwxm left a comment

Choose a reason for hiding this comment

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

Please consider merging my #15 to this PR.

OK, but I've added a comment or two that you might want to address.

@kwxm
Copy link
Collaborator Author

kwxm commented Nov 24, 2025

Please run treefmt command available in the nix shell which applies fourmolu to all codebase.

OK, I've done that.

Align dropList with array builtin naming convention:
- Old: V_1_1 → New: V3_110
- Old: V_1_0 → New: V3_100

Uses compacted Plutus Core version digits for clarity:
- Underscore: separates Plutus version from Core version
- No separator: within Core version digits (110, 100)

Changes:
- Rename modules: V_X_Y.hs → V3_{XY0}.hs
- Update identifiers: ...V3 → ..._V3_110
- Update script outputs: ...V3.plutus → ..._V3_110.plutus
- Qualified imports: Batch6_V3_110
- Add CLAUDE.md with naming convention documentation

Generated scripts (6 total):
- succeedingDropListPolicyScript_V3_110.plutus
- expensiveDropListPolicyScript_V3_110_{1-5}.plutus

Benefits:
- Less verbose: V3_110 vs V_1_1 (clearer separation)
- Consistent with array builtins convention (PR #12)
- Clear hierarchy: version concepts (separated) vs digits (compact)

Convention documented in CLAUDE.md for project-wide consistency.

Related: PR #12 (array builtins), issue #14
Move dropList to subdirectory structure for consistency with batch6
organization pattern, following Kenneth's feedback.

Directory structure:
  Batch6/
  └── DropList/
      ├── Common.hs (was DropList.hs)
      ├── V3_100.hs
      └── V3_110.hs

Changes:
- DropList.hs → DropList/Common.hs
- V3_100.hs → DropList/V3_100.hs
- V3_110.hs → DropList/V3_110.hs
- Update module paths: Batch6.DropList.V3_110
- Update imports: DropList_V3_110
- Update cabal exposed-modules

This structure enables clean organization of all batch6 builtins
(arrays, dropList, etc.) with each builtin in its own subdirectory.

Generated scripts (6 total):
- succeedingDropListPolicyScript_V3_110.plutus
- expensiveDropListPolicyScript_V3_110_{1-5}.plutus

Related: Kenneth's feedback on PR #15, PR #12 (arrays)
Update examples to reflect reorganization:
- PlutusScripts.Batch6.Array.V3_110
- PlutusScripts.Batch6.DropList.V3_110

Matches PR #12 documentation updates.
Remove version suffix from identifiers to avoid repetition:
- Old: DropList_V3_110.succeedingDropListPolicyCompiled_V3_110
- New: DropList_V3_110.succeedingDropListPolicy

Changes:
- Remove version suffix from all exported identifiers
- Version info already clear from qualified import

Example usage:
  DropList_V3_110.succeedingDropListPolicy
  DropList_V3_110.expensiveDropListScriptGroup

Benefits: cleaner code, no excessive repetition, version still clear.
Matches array builtin pattern from PR #12.
Apply same pattern as array builtins (PR #12) to reduce boilerplate.

New pattern:
- Added Helpers/Envelopes with VersionedScript types
- Created PlutusScripts/Batch6/DropList overarching module
- Exports allDropListScripts and allDropListScriptGroups lists
- Main.hs: mapM_ writeVersionedScript/writeVersionedScriptGroup

Benefits:
- Main.hs scales: 2 lines for dropList (not 7 lines)
- No version repetition: DropList_V3_110.succeedingDropListPolicy
- Type-safe version tracking with proper PlutusCore type
- Matches array builtin pattern for consistency

Example:
  Old:
    writeEnvelopeV3 "succeedingDropListPolicyScript_V3_110"
      DropList_V3_110.succeedingDropListPolicy
    writeScriptGroup DropList_V3_110.expensiveDropListScriptGroup

  New:
    mapM_ writeVersionedScript DropList.allDropListScripts
    mapM_ writeVersionedScriptGroup DropList.allDropListScriptGroups

Generated scripts (6 total):
- succeedingDropListPolicyScript_V3_110.plutus
- expensiveDropListPolicyScript_V3_110_{1-5}.plutus

Related: PR #12 (array pattern), Kenneth's feedback
@Unisay
Copy link
Collaborator

Unisay commented Nov 24, 2025

OK, but I've added a comment or two that you might want to address.

Done:

  1. Batch6 subdir
  2. Main.hs is cleaner as specific modules export lists of compiled scripts with their corresponding versions as opposed to individual bindings.

@kwxm
Copy link
Collaborator Author

kwxm commented Nov 25, 2025

I'm going to merge this myself so we can move on.

@kwxm kwxm merged commit aebb33a into master Nov 25, 2025
@kwxm kwxm deleted the kwxm/e2e/batch6/dropList branch November 25, 2025 07:00
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