Compile BuiltinData transparently in the plugin#7863
Open
Unisay wants to merge 7 commits into
Open
Conversation
Unisay
force-pushed
the
yura/builtin-data-transparent
branch
from
July 23, 2026 14:44
e0f8648 to
e9f6c8f
Compare
Unisay
force-pushed
the
yura/builtin-data-transparent
branch
from
July 24, 2026 09:42
e9f6c8f to
3bc4fee
Compare
Unisay
marked this pull request as ready for review
July 24, 2026 09:43
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.
Alternative to #7719 for fixing #7716 — the two PRs are mutually exclusive; whichever lands, the other closes.
The plugin treats
BuiltinDataas representationally transparent:PlutusCore.Data.Datacompiles to the builtindatatype (same asBuiltinData), theBuiltinDataconstructor compiles to the identity, and a single-alternative case on it binds both the case binder and the field to the scrutinee. GHC unwrapping the wrapper — the worker/wrapper unboxing that exposedDatain join point types and crashed the plugin withUnsupported feature: Type constructor: GHC.Prim.Addr#— then becomes harmless instead of fatal. Details in Note [Transparent BuiltinData] inPlutusTx.Compiler.Expr.The problematic Core shape, from the unfolding of the
useTwiceDataregression test (condensed) — the source mentions onlyBuiltinData, yet the join point's type signature exposesData:Unlike the second-constructor approach,
BuiltinDataitself is untouched and costs don't move: no budget golden changes under either GHC version. Large-script UPLC goldens (cardano-constitution, Ed25519) shift shape through different CSE choices at identical budget and CBOR size.Stage violations that previously died at the
Cannot construct a value of type: BuiltinDatacheck now surface as a missing-unfolding error; the last commits port #7719's improved diagnostics to that path (see theStageViolation/builtinDatagoldens).