Add multiIndexArray builtin (CIP-0156)#7844
Open
Unisay wants to merge 3 commits into
Open
Conversation
Unisay
marked this pull request as ready for review
July 16, 2026 09:10
Unisay
force-pushed
the
yura/issue-1675-multi-index-array
branch
from
July 16, 2026 09:11
32c205d to
eaeb73f
Compare
zliu41
requested changes
Jul 16, 2026
| (runCostingFunTwoArguments . paramScaleValue) | ||
| toBuiltinMeaning _semvar MultiIndexArray = | ||
| let multiIndexArrayDenotation | ||
| :: [Integer] -> SomeConstant uni (Vector a) -> BuiltinResult (Opaque val [a]) |
Member
There was a problem hiding this comment.
- Need an explanation of why it uses Integer while indexArray uses Int
- The argument order is different from indexArray's and I see no good reason for it.
`multiIndexArray :: forall a. list integer -> array a -> list a` returns the array elements at the given indices in order (duplicates preserved), failing the whole call on any out-of-bounds index. Bounds are checked in the Integer domain, so an index exceeding maxBound::Int is out-of-bounds rather than wrapping. Placeholder costing (unimplementedCostingFun) until benchmarked; not exposed to Plinth. Adds the CEK denotation, flat tag, and RewriteRules/plugin exhaustiveness arms, plus regenerated type-synthesis and parser goldens. Issue: IntersectMBO/plutus-private#1675
New batch7 holds builtins that are implemented but not yet approved for release, mapped to futurePV in builtinsIntroducedIn for all three ledger languages. Per Note [Adding new builtins: protocol versions], so multiIndexArray is not available in any released protocol version. The Versions specs (and Data twin) expect it rejected at newestPV. Issue: IntersectMBO/plutus-private#1675
CEK tests covering index order, duplicate indices, polymorphic element type, empty index list, and the out-of-bounds failure modes (index == length, negative, and an index exceeding maxBound::Int). Issue: IntersectMBO/plutus-private#1675
Unisay
force-pushed
the
yura/issue-1675-multi-index-array
branch
from
July 17, 2026 11:29
eaeb73f to
b088b82
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds the
multiIndexArraybuiltin from CIP-0156:forall a. list integer -> array a -> list a, returning the array elements at the given indices in index-list order (duplicates preserved) and failing the whole call on any out-of-bounds index. Bounds are checked in theIntegerdomain, so a negative index or one exceedingmaxBound::Intis out-of-bounds rather than wrapping.Placeholder costing (
unimplementedCostingFun) and gated underfuturePV, so it is not available in any released protocol version.Core language + CEK only; Plinth exposure, costing, conformance, and metatheory are separate follow-ups. Draft — not ready for review.