stratisproject / StratisBitcoinFullNode

Bitcoin full node in C#
https://stratisplatform.com
MIT License
787 stars 315 forks source link

Byte array return values in smart contracts do not get serialized #4099

Open drmathias opened 4 years ago

drmathias commented 4 years ago

Byte array return values in smart contracts are not being serialized into the receipt.

public class ExampleContract : SmartContract
{
    ...
    public byte[] CallMe() => new byte[] { 3, 2, 1 };
}

This is what the receipt of a call to the method looks like.

{
    "transactionHash": "910a3bea51f0fab7556452df11e86f937d811f03e76d81db644e2face14fcddc",
    "blockHash": "b06c03ecb1da9f1348e01bd4145b43d242e1178ee239efbac2c281a0c41afbd2",
    "postState": "20aa982de5fea75eda5888817d26e9a58cc4813d0e501ee4772d0fd150935e9d",
    "gasUsed": 10221,
    "from": "CUtNvY1Jxpn4V4RD1tgphsUKpQdo4q5i54",
    "to": "CKYmR2MpUm5opnkKZpPyrTKrV8xCgtk3Dq",
    "newContractAddress": null,
    "success": true,
    "returnValue": "System.Byte[]",
    "bloom": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "error": null,
    "logs": []
}

I'd expect the return value to show the byte array value serialized as a hex string.

rowandh commented 4 years ago

Thanks @drmathias, there's a related issue with structs being fixed at the moment so I'd imagine this could be done as part of that.