casper-ecosystem / casper-js-sdk

TypeScript Casper Client SDK
Apache License 2.0
71 stars 60 forks source link

Deserialisation Error for info_get_deploy on Key CL Types #353

Closed meywood closed 8 months ago

meywood commented 1 year ago

info_get_deploy does not correctly deserialise ByteArray and Key CL Type info_get_deploy does not correctly deserialise ByteArray and Key CL Type when deserialising a deploy via info_get_deploy.

To Reproduce

Identify if any Prequisites: Use the following JSON as a response to the info_get_deploy RPC call: info_get_deploy.json.txt

Expected behavior CL type key can be deserialised

Exception

Error: Tried to unwrap Error: Left over bytes
    at ErrImpl.unwrap (/Users/imills/casper/cspr-typescript-sdk-standard-tests/node_modules/src/result.ts:123:15)
    at Function.fromJSON (webpack://casper-js-sdk/./src/lib/CLValue/Abstract.ts:70:67)
    at from (webpack://casper-js-sdk/./src/lib/RuntimeArgs.ts:49:34)
    at Function.from (<anonymous>)
    at Object.l [as deserializer] (webpack://casper-js-sdk/./src/lib/RuntimeArgs.ts:48:11)
    at /Users/imills/casper/cspr-typescript-sdk-standard-tests/node_modules/typedjson/src/deserializer.ts:301:50
    at Map.forEach (<anonymous>)
    at convertAsObject (/Users/imills/casper/cspr-typescript-sdk-standard-tests/node_modules/typedjson/src/deserializer.ts:294:36)
    at Deserializer.convertSingleValue (/Users/imills/casper/cspr-typescript-sdk-standard-tests/node_modules/typedjson/src/deserializer.ts:132:20)
    at TypedJSON.parse (/Users/imills/casper/cspr-typescript-sdk-standard-tests/node_modules/typedjson/src/parser.ts:411:40)

TypeError: Cannot read properties of undefined (reading 'toBytes')
    at toBytes (webpack://casper-js-sdk/./src/lib/DeployUtil.ts:690:37)
    at e.toBytes (webpack://casper-js-sdk/./src/lib/DeployUtil.ts:757:29)
    at serializeBody (webpack://casper-js-sdk/./src/lib/DeployUtil.ts:1285:54)
    at validateDeploy (webpack://casper-js-sdk/./src/lib/DeployUtil.ts:1570:26)
    at Object.deployFromJson (webpack://casper-js-sdk/./src/lib/DeployUtil.ts:1502:17)
    at webpack://casper-js-sdk/./src/lib/CasperClient.ts:277:28
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Additional context Add any other context about the problem here.

Defect Type

meywood commented 9 months ago

Sorry for the very late reply I didn't see a notification on GitHub for this was tested using V2.15.2