Closed nielstron closed 1 year ago
I narrowed it down to this minimal example:
(program 1.0.0 (con list<integer> []))
Note this is the aiken syntax and concerns types that are possible but poorly documented by IOHK.
The corresponding JS
import { ByteArray as HeliosByteArray, Int as HeliosInt, deserializeUplcBytes, hexToBytes, bytesToHex, CborData, textToBytes } from "@hyperionbt/helios"
const script = deserializeUplcBytes(
CborData.decodeBytes(
hexToBytes(
"460100004bd601"
)
)
)
console.log(script)
and error
error - Error: unhandled container type
at UplcDeserializer.readTypedValue (file:///home/niels/git/wrappe.de/node_modules/@hyperionbt/helios/helios.js:11843:12)
at UplcDeserializer.readConstant (file:///home/niels/git/wrappe.de/node_modules/@hyperionbt/helios/helios.js:11800:32)
at UplcDeserializer.readTerm (file:///home/niels/git/wrappe.de/node_modules/@hyperionbt/helios/helios.js:11641:17)
at deserializeUplcBytes (file:///home/niels/git/wrappe.de/node_modules/@hyperionbt/helios/helios.js:11912:20)
at eval (webpack-internal:///./src/config/contract.ts:16:103)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
page: '/'
I guess the issue is precisely that "recursive types not handled yet" https://github.com/Hyperion-BT/helios/blob/3ac854f97dc7424917d9385e646ec1119299273c/helios.js#L11843
Yes, it was only implemented up to point that it was needed for Helios itself. But for these decompilation cases, I guess it would be enough to have a "generic" container type
Thanks for creating an issue for this (might take a while to resolve though, I don't have much time currently)
I am willing to work on this but need some guidance on it. Is there any reference/documentation on how the constant types are flattened/unflattened?
The spec can be found here: https://github.com/input-output-hk/plutus/blob/master/doc/plutus-core-spec/plutus-core-specification.pdf
You would have to start making changes here: https://github.com/Hyperion-BT/helios/blob/3ac854f97dc7424917d9385e646ec1119299273c/src/uplc-program.js#L767-L782
Maybe making the UplcList/UplcMap/UplcPair classes generic is the best way to go.
I am trying to run the following code
And get this error:
I have tried more minimalistic programs, for them the deserialization works fine, so I am wondering if I am maybe using some weird uplc code that can not be deserialized by helios
The cbor is the result of compiling the eopsin sample gift contract with this uplc code