Skip to content

Expose multiIndexArray to Plinth (CIP-0156)#7845

Merged
Unisay merged 8 commits into
masterfrom
yura/issue-2265-multi-index-array-plinth
Jul 24, 2026
Merged

Expose multiIndexArray to Plinth (CIP-0156)#7845
Unisay merged 8 commits into
masterfrom
yura/issue-2265-multi-index-array-plinth

Conversation

@Unisay

@Unisay Unisay commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Exposes the multiIndexArray builtin (CIP-0156) to Plinth: adds the PlutusTx.Builtins.multiIndexArray Haskell implementation and the plugin mapping that replaces the no-op arm left by #7844. It mirrors indexArray: indices out of range fail, in index-list order with duplicates preserved.

Closes https://github.com/IntersectMBO/plutus-private/issues/2265

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Execution Budget Golden Diff

fdbe32b (master) vs c4a772e

output

This comment will get updated when changes are made.

@Unisay
Unisay requested a review from Copilot July 15, 2026 12:35
@Unisay Unisay self-assigned this Jul 15, 2026

This comment was marked as outdated.

@Unisay
Unisay force-pushed the yura/issue-1675-multi-index-array branch from 32c205d to eaeb73f Compare July 16, 2026 09:11
@Unisay
Unisay force-pushed the yura/issue-2265-multi-index-array-plinth branch 2 times, most recently from ee70ddb to 8d116ee Compare July 16, 2026 13:21
@Unisay
Unisay force-pushed the yura/issue-1675-multi-index-array branch from eaeb73f to b088b82 Compare July 17, 2026 11:29
@Unisay
Unisay force-pushed the yura/issue-2265-multi-index-array-plinth branch from 8d116ee to 4bca134 Compare July 17, 2026 11:42
@Unisay
Unisay marked this pull request as ready for review July 21, 2026 15:20
@Unisay
Unisay force-pushed the yura/issue-2265-multi-index-array-plinth branch from 4bca134 to c10c219 Compare July 22, 2026 12:32
@Unisay
Unisay force-pushed the yura/issue-1675-multi-index-array branch from 255dd07 to f1b60c0 Compare July 22, 2026 12:33
@Unisay
Unisay force-pushed the yura/issue-2265-multi-index-array-plinth branch from c10c219 to 4a74f77 Compare July 22, 2026 12:34
@Unisay
Unisay requested a review from a team July 22, 2026 12:44
Base automatically changed from yura/issue-1675-multi-index-array to master July 23, 2026 10:18
@Unisay
Unisay force-pushed the yura/issue-2265-multi-index-array-plinth branch from 4a74f77 to d5510ec Compare July 23, 2026 11:49
Unisay added 7 commits July 24, 2026 10:20
Adds the PlutusTx.Builtins.multiIndexArray wrapper (mirroring
indexArray: out-of-range indices fail, results in index-list order with
duplicates preserved) and maps it to the MultiIndexArray builtin in the
plugin, replacing the no-op arm. Golden tests cover the compiled PIR,
UPLC, and CEK evaluation under GHC 9.6 and 9.12.

Issue: IntersectMBO/plutus-private#2265
…y wrapper

The Haskell simulation now matches the builtin: an index exceeding
maxBound::Int is out-of-bounds instead of wrapping on conversion, and
any out-of-bounds index fails the whole call regardless of how much of
the result list is demanded.

Issue: IntersectMBO/plutus-private#2265
Pins the Haskell definition to the builtin semantics: index-list order
with duplicates, eager Integer-domain bounds checking (an index
exceeding maxBound::Int fails rather than wrapping), and whole-call
failure regardless of how much of the result is demanded.

Issue: IntersectMBO/plutus-private#2265
Builds the index list as a lifted list constant via toBuiltin instead of
an mkCons chain, matching the liftCodeDef idiom used for the other
array-test inputs.

Issue: IntersectMBO/plutus-private#2265
@Unisay
Unisay force-pushed the yura/issue-2265-multi-index-array-plinth branch from d5510ec to 269b917 Compare July 24, 2026 08:43
@Unisay
Unisay requested a review from zliu41 July 24, 2026 12:10
Comment thread plutus-tx/test/Array/Spec.hs Outdated
import Test.Tasty.HUnit (Assertion, assertBool, testCase, (@?=))
import Prelude

-- The wrapper must fail exactly where the on-chain builtin fails: any index outside

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think "wrapper" is standard terminology. It took me a few seconds to realize what it means.

@Unisay Unisay Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Gotcha. How would you call those "opaque" Plinth functions?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"Haskell implementation of the builtin"?

@Unisay
Unisay enabled auto-merge (squash) July 24, 2026 17:31
@Unisay
Unisay merged commit 39051a9 into master Jul 24, 2026
9 checks passed
@Unisay
Unisay deleted the yura/issue-2265-multi-index-array-plinth branch July 24, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants