New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StringStream is wrongly assuming that array items cannot be empty #348
Comments
Can I have a fleshed out test case for this? I don't think On a side note, do you prefer that we return |
@ThomasLobker Still waiting for an example so I can debug it. My gut feeling is that the issue lies with the deserializer rather than the StringStream itself. |
Sorry for the delay. I will make up some time next week to make a test scenario. |
@ThomasLobker Any progress on the test scenario? |
Make the following contract in Python: from boa.interop.Neo.Runtime import Log, Serialize, Deserialize
def Main(operation, arguments):
if operation == 'serialize':
return Serialize(arguments) Run the contract and serialize some stuff: (notice the
This will be the output:
Now make a const Neon = require('@cityofzion/neon-js');
serialized = '8002000568656c6c6f800400149ec6163233c8e731992adc111a3708b0fde27f2c00283263376665326664623030383337316131316463326139393331653763383333333231366336396500fd0001356163353662366130303532376163343661353135323761633436613030633330393733363537323639363136633639376136353837363432313030366135316333363831353465363536663265353237353665373436393664363532653533363537323639363136633639376136353631366337353636363136613030633330623634363537333635373236393631366336393761363538373634326530303661353163336330353138373634323530303661353163333030633336383137346536353666326535323735366537343639366436353265343436353733363537323639363136633639376136353631366337353636363130303663373536360000'
deserialized = Neon.sc.StackItem.deserialize(serialized).value;
console.log(deserialized); And after executing I get the following message:
When I repeat all these steps and I replace the
|
@hal0x2328 @snowypowers I tested originally with version |
I dug into this and found the reason why. When you place the zero at the end, the serialized output actually serialized it as a null, the OpCodes produced are
Essentially, the If the null case is the correct way, we can amend |
As far as I know, there is no distinction between null, none, false or 0 in the smart contract. I think that initially I had this issue when tried to include things like a |
yeah the main issue I have is serializing then deserializing a StackItem of |
v4.4.0 is released and includes this fix. Please verify it on your side. |
When trying to deserialized a serialized array with an empty item,
neon-js
is throwing an error:I believe this should not happen, it should not be illegal to have empty items in a serialized array.
For example:
This will throw an error:
Proposed fix:
The text was updated successfully, but these errors were encountered: