-
Notifications
You must be signed in to change notification settings - Fork 144
Conversation
Codecov Report
@@ Coverage Diff @@
## master #132 +/- ##
=======================================
Coverage 61.36% 61.36%
=======================================
Files 16 16
Lines 1421 1421
=======================================
Hits 872 872
Misses 549 549
Continue to review full report at Codecov.
|
Will this change break old contracts? |
As far as I can tell not.
What will behave differently in some cases is neo-vm/src/neo-vm/Types/Boolean.cs Line 32 in a3f9444
so e.g. a |
It needs to be tested. |
Ok, we don't trust the existing tests due to lack of coverage. I can understand that. Do you have a suggestion on how you would like to see it tested? I can sync the whole chain from scratch with this change and do contract storage comparisons, but that might not suit your needs therefore I'm asking for directions/input/ideas.. |
I think it's okay if it doesn't break old contracts. |
We have currently created this procedure here, it compares two neo-cli versions and checks storage differences: https://github.com/NeoResearch/neo-tests/tree/master/clients-assert-testnet |
We are currently thinking about how to integrate this here, we are afraid this is to much costly for a UT. |
thanks for the tip @vncoelho . What is the benefit of using your docker setup vs manually compiling a client with this fix , syncing using the offline chain files and comparing the storage with the normal client? |
I mean, in that script we already start a plugin that export all storage differences (in NEO 3.0 we gonna have MPT and this will not be necessary). However, nowadays, that sounds necessary. |
We could also manually export storage and check this against https://github.com/NeoResearch/neo-storage-audit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could break old contracts. Good for neo 3, not for neo 2
Perhaps we do this @ixje . What are the scenarios generated from neo-boa and neon compiler, involving Boolean state? Can you try some and we think about them? |
Anyway, it makes more sense to focus on Neo 3, so we don't break anything by chance, and develop things faster. |
Do you have an example or is this a guess? NEO 3.0 should be backwards compatible, no? So we have to figure out the effect anyway. |
We will need to redeploy many contracts on Neo 3 due to global assets abolished... so bavkwards compatibility can be flexible in this case. |
@ixje can you make the same as this but for master (neo 3.x) and close this pull request? |
@shargon fixed. Changed destination to |
@erikzhang are you agree with merge it? in the future we can check if is valid for neo2, but i think that is not needed in neo2, and should be only for neo3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question: push0 will push an empty array, right? PUSHF was supposed to be "push false" and it was equals to Push0.
with this change, an empty byte array is true or false? I hope this is false 😂
Anyway, it makes sense... one better conversion is Byte Array to BigInt to bool. This is even better, because is byte array 0x0000 false?
using bigint logic, 0x, or 0x00, or 0x0000, or 0x00000000... are all zero, and zero is false. Otherwise it is true. This corresponds to the majority of existing languages.
In neo-project/neo-vm#132 the internal representation of FALSE was changed. This PR fixes documentation.
Closes #129
a Boolean StackItem in either
false
ortrue
state should always return at least 1 byte forGetByteArray()
. This is the default behaviour in C#'s build in BitConverter as well as many other languages. It is misleading for it to return an empty array as that will lead to a length/size of 0, whereas the item still takes up memory space.