IntersectMBO / plutus

The Plutus language implementation and tools
Apache License 2.0
1.57k stars 480 forks source link

`ImpossibleDeserialisationFailure` triggered #5689

Closed sourabhxyz closed 10 months ago

sourabhxyz commented 11 months ago

Summary

I am using loadFromFile for the attached UPLC program and seeing the following error:

Failed to deserialise our own program! This is a bug, please report it. Caused by: T
ooMuchSpace (0x0000000109d5abea,S {currPtr = 0x0000000109d56443, usedBits = 7})

UPLC program was generated using -fplugin-opt PlutusTx.Plugin:dump-uplc flag.

Please find attached the contract.txt file. contract.txt

Steps to reproduce the behavior

Already provided.

Actual Result

Already provided.

Expected Result

Should have correctly deserialised the serialised CompiledCode.

Describe the approach you would take to fix this

No response

System info

OS: MacOS Version: Sonoma 14.1.2 Plutus library version: 1.6.0.0

kwxm commented 11 months ago

That file does indeed appear to be corrupt. It contains a tag saying that a constant is coming up: the constant should be preceded by some type information, but that's missing. Your file has presumably been generated from Haskell using the PlutusTx compiler, and it's very difficult to work out what's going on without seeing the Haskell code. Could you show us the Haskell, or perhaps try to construct some smaller example that gives the same behaviour?

sourabhxyz commented 11 months ago

Thanks for your reply @kwxm! I was able to obtain deserialised UPLC from the shared contract.txt file using the code mentioned here. However, when I tried to apply my argument, as mentioned here, I got a different script hash than what I had obtained if I had applied the argument to my initial CompiledCode (i.e., without serialising it and then deserialising it elsewhere).

zliu41 commented 10 months ago

Since the deserialization is working, we can continue the discussion of the script hash issue in #5331.