Skip to content
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

A question of ContractParameter.FromJson(ByteString) #293

Closed
ProDog opened this issue Jul 17, 2020 · 6 comments · Fixed by #302
Closed

A question of ContractParameter.FromJson(ByteString) #293

ProDog opened this issue Jul 17, 2020 · 6 comments · Fixed by #302
Labels
question Further information is requested

Comments

@ProDog
Copy link
Contributor

ProDog commented Jul 17, 2020

Now we get ByteString type of result's stack when invoke contract, it's StackItemType.
In RpcClient, we convert stack use:

invokeScriptResult.Stack = ((JArray)json["stack"]).Select(p => ContractParameter.FromJson(p)).ToArray();

but in ContractParameter.FromJson(JObject json) is no ByteString type, it's should be ContractParameterType:
https://github.com/neo-project/neo/blob/b47157669cabc9c4f0f4ff56cf4fe2a82905bcfe/src/neo/SmartContract/ContractParameter.cs#L58

Can we support StackItemType convert to ContractParameterType or StackItem.FromJson(JObject json) etc ?

@ProDog ProDog added the question Further information is requested label Jul 17, 2020
@shargon
Copy link
Member

shargon commented Jul 20, 2020

Could you make a unit test for reproduce the issue? I don't understand very well the problem

@devhawk
Copy link
Contributor

devhawk commented Jul 23, 2020

@shargon #300

@ProDog
Copy link
Contributor Author

ProDog commented Jul 23, 2020

@shargon I have updated unit test for this issue, please have a look at it #301 .

@Qiao-Jin
Copy link
Contributor

This issue is caused by reading json of StackItem as ContractParameter, and I doubt whether this is correct ... And it seems that StackItemType & ContractParameterType are not accordance in more than one types:

ContractParameterType.ByteArray
ContractParameterType.String
ContractParameterType.Hash160
ContractParameterType.Hash256
ContractParameterType.PublicKey
ContractParameterType.Signature
ContractParameterType.Void

&

StackItemType.Pointer
StackItemType.ByteString
StackItemType.Buffer
StackItemType.Struct

@Tommo-L
Copy link
Contributor

Tommo-L commented Jul 27, 2020

Both RpcServer and RpcClient use StackItemType?

@ProDog
Copy link
Contributor Author

ProDog commented Jul 27, 2020

Only RpcClient need to deal with the invokescript's result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants