-
Notifications
You must be signed in to change notification settings - Fork 102
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
Add byte.AsString and Map UTs #303
Conversation
tests/Neo.SmartContract.Framework.UnitTests/TestClasses/Contract_Iterator.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Erik Zhang <[email protected]>
Waiting for #302 |
Wait #317 . |
tests/Neo.SmartContract.Framework.UnitTests/TestClasses/Contract_Enumerator.cs
Outdated
Show resolved
Hide resolved
…otnet into support-byte-asstring
…eo-devpack-dotnet into support-byte-asstring
Have fixed. |
if (method.paramtypes[pos].type.FullName == "System.Byte[]") | ||
{ | ||
Insert1(VM.OpCode.CONVERT, "", to, new byte[] { (byte)VM.Types.StackItemType.Buffer }); | ||
} |
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.
Why should we do conversion when loading argument?
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.
Because a byte[] should be converted to Buffer
.
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.
Sure. But you shouldn't convert it when loading. I think the conversion should be done when the data is pushed onto the stack.
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.
Yes, here is the opcode LDARG
, arg will be pushed onto stack.
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.
The conversion should be done when the first time that the data is pushed onto the stack. LDARG
loads the data from the slot, and the data from the slot is from stack before.
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.
Otherwise, you have to convert it everytime when load from slot.
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.
The args appears to be pushed on the stack before Loadscript
? The compiler cannot convert it.
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.
Then don't convert it. The argument should be string
.
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.
Or we can check the type of agrs in INITSLOT
. Now in NeoVM we only check the count, not the type.
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.
Or we can check the type of agrs in INITSLOT.
I think it's good, it may not be efficient for compiler to check the parameter type after INITSLOT
.
Close #297 .