0

Has anyone encountered such an issue?

Validator works fine and cborHex is generated when "writeSerialisedScript" run in cabal's repl. But when building with cabal build app, the following error is thrown:

GHC Core to PLC plugin: E042:Error: Unsupported feature: Type constructor: GHC.Prim.Addr#
Context: Compiling type: GHC.Prim.Addr#
Context: Compiling data constructor type: Data.ByteString.Internal.PS
Context: Compiling type: Data.ByteString.Internal.ByteString
Context: Compiling data constructor type: Model.TypeD.TypeD
Context: Compiling type: Model.TypeD.TypeD
Context: Compiling type: Model.TypeD.TypeD
                         -> Model.TypeDAction.TypeDAction
                         -> Plutus.V2.Ledger.Contexts.ScriptContext
                         -> GHC.Types.Bool
Context: Compiling type: Model.ColonySettings.ColonySettings
                         -> Model.TypeD.TypeD
                         -> Model.TypeDAction.TypeDAction
                         -> Plutus.V2.Ledger.Contexts.ScriptContext
                         -> GHC.Types.Bool
Context: Compiling definition of: Validators.TypeD.mkColonyValidator
Context: Compiling expr: Validators.TypeD.mkColonyValidator
Context: Compiling expr at "ship-shift-0.1.0.0-inplace:Validators.TypeD:(171,8)-(171,50)"

Running cabal configure -f defer-plugin-errors before building seems to work, but I get the following linker warning:

/nix/store/jfkmqz20q8fsaqizcml86adxqyzlwllx-binutils-2.38/bin/ld: warning: type and size of dynamic symbol cardanozmapizm1zi35zi4zm8209ae821a2638d4c1d3e2b96141de65263d756436220f129fed7d2f300d13d8_CardanoziApiziSerialiseTextEnvelope_zdfIsStringTextEnvelopeDescr_closure are not defined

I've tried troubleshooting by commenting out lines to find the culprit to no avail.

Definition of Model.TypeD.TypeD is as follows:


type TypeA = (TypeB, Value)

data TypeB = A
            | B
            | C
            | D
            | E
            deriving (Show, Generic, Prelude.Eq, ToJSON, FromJSON)

PlutusTx.makeLift ''TypeB
PlutusTx.makeIsDataIndexed ''TypeB [('A, 0), ('B, 1), ('C, 2), ('D, 3), ('E, 4)]

data TypeC = TypeC
    { y :: !Rational
    , z :: !Address
    } deriving (Prelude.Show, Generic, Prelude.Eq, ToJSON, FromJSON)

PlutusTx.makeLift ''TypeC
PlutusTx.unstableMakeIsData ''TypeC

data TypeD = TypeD
    { 
      a  :: !BuiltinByteString
    , b  :: ![PaymentPubKeyHash]
    , c  :: !Integer
    , d  :: ![TypeB]
    , e  :: ![TypeA]
    , f  :: !(Maybe TypeC)
    } deriving (Prelude.Show, Generic, Prelude.Eq, ToJSON, FromJSON)
    
PlutusTx.makeLift ''TypeD
PlutusTx.unstableMakeIsData ''TypeD

1 Answer 1

0

I have had similar issues. I don't understand the Core to PLC plugin enough to explain why this happens, but I am fairly sure this is related to using types on-chain that have a strict field of type BuiltinByteString.

So removing the ! in front of field a in TypeD should avoid running into this error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.