I'm having a newtype VerificationKey = HydraVerificationKey (VerKeyDSIGN Ed25519DSIGN)
and I would love to be able to use that type directly in our plutus scripts. While I can implement PlutusTx.ToData
et al for it and satisfy ghc, I get runtime errors like
Benchmark tx-cost: RUNNING...
tx-cost: Error: Unsupported feature: Kind: GHC.Types.Nat
Context: Compiling definition of: Hydra.Contract.HeadTokens.validateTokensMinting
Context: Compiling definition of: Hydra.Contract.HeadTokens.validate
Context: Compiling expr at "hydra-plutus-0.5.0-inplace:Hydra.Contract.HeadTokens:(120,8)-(120,101)"
Likely because the VerKeyDSIGN
(from Cardano.Crypto.Class
) is implemented using some reflection on key size using Nat, as it's defined:
newtype VerKeyDSIGN Ed25519DSIGN = VerKeyEd25519DSIGN (PinnedSizedBytes (SizeVerKeyDSIGN Ed25519DSIGN))
newtype PinnedSizedBytes (n :: Nat) = PSB ByteArray
But we would not want to be using HydraVerificationKey
nor the underlying VerKeyEd25519DSIGN
data constructors, but only functions
dealing with the newtype VerificationKey
. Is this even possible?
Right now we are converting our off-chain keys to another, simpler type newtype Party = UnsafeParty {vkey :: BuiltinByteString}
, but thought we could avoid that conversion.