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

Invokefunction return stackitem isn't in the same type as applicationlogs #254

Closed
superboyiii opened this issue Jun 1, 2020 · 1 comment · Fixed by #264
Closed

Invokefunction return stackitem isn't in the same type as applicationlogs #254

superboyiii opened this issue Jun 1, 2020 · 1 comment · Fixed by #264
Assignees

Comments

@superboyiii
Copy link
Member

superboyiii commented Jun 1, 2020

The return type of ByteArray has been changed to ByteString in VM stackitem in neo-project/neo-vm#309, so invokefunction response should also sync to this type. Now it's still ByteArray.

{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [
    "0x9bde8f209c88dd0e7ca3bf0af0f476cdd8207789",
    "getValidators",
    []
  ],
  "id": 3
}
{
    "jsonrpc": "2.0",
    "id": 3,
    "result": {
        "script": "10c00c0d67657456616c696461746f72730c14897720d8cd76f4f00abfa37c0edd889c208fde9b41627d5b52",
        "state": "HALT",
        "gas_consumed": "101007390",
        "stack": [
            {
                "type": "Array",
                "value": [
                    {
                        "type": "ByteArray",
                        "value": "AwCbdUDhDyVi5f2PrJ6uwlFmpYsm5BI0j/WoaSe/rCKi"
                    },
                    {
                        "type": "ByteArray",
                        "value": "AwIF6c766lod/FgK8gyNWqJGi7AUjxpeRgX8YiyA5gS6"
                    },
                    {
                        "type": "ByteArray",
                        "value": "AhS68M7qOmbxfn4eg56iX9i+1s2C5rtuaCUBiQZfRP8B"
                    },
                    {
                        "type": "ByteArray",
                        "value": "A0CNzUFjlvZHg6xYfqHhWTxX2f6ogMimoZIOkqJZR3gG"
                    },
                    {
                        "type": "ByteArray",
                        "value": "AqeDS+mzLimB0VfLW706y0LP0R6lw7ECJNekTpjFkQ8b"
                    },
                    {
                        "type": "ByteArray",
                        "value": "AroscPWZbzV6QxmHBYWfriz+oT4RcpYoAHcrPViKnUq9"
                    },
                    {
                        "type": "ByteArray",
                        "value": "Atyq9Coy9wuoau11lObr/sbBkLioKyLDYza5LA/caya4"
                    }
                ]
            }
        ]
    }
}

It should like getapplicationlogs:

{
  "jsonrpc": "2.0",
  "method": "getapplicationlog",
  "params": ["0x65ff5cd413783e599a66a110e52ae5fda941dcabf4d7ab183a08555d86bdd111"],
  "id": 1
} 
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "txid": "0x65ff5cd413783e599a66a110e52ae5fda941dcabf4d7ab183a08555d86bdd111",
        "trigger": "Application",
        "vmstate": "HALT",
        "gas_consumed": "9007810",
        "stack": [],
        "notifications": [
            {
                "contract": "0x8c23f196d8a1bfd103a9dcb1f9ccf0c611377d3b",
                "state": {
                    "type": "Array",
                    "value": [
                        {
                            "type": "ByteString",
                            "value": "VHJhbnNmZXI="
                        },
                        {
                            "type": "Any"
                        },
                        {
                            "type": "ByteString",
                            "value": "VKbLJ5+87cZhYq1K1dHZICuSdD4="
                        },
                        {
                            "type": "Integer",
                            "value": "359184000000"
                        }
                    ]
                }
            },
            {
                "contract": "0x9bde8f209c88dd0e7ca3bf0af0f476cdd8207789",
                "state": {
                    "type": "Array",
                    "value": [
                        {
                            "type": "ByteString",
                            "value": "VHJhbnNmZXI="
                        },
                        {
                            "type": "ByteString",
                            "value": "VKbLJ5+87cZhYq1K1dHZICuSdD4="
                        },
                        {
                            "type": "ByteString",
                            "value": "VKbLJ5+87cZhYq1K1dHZICuSdD4="
                        },
                        {
                            "type": "Integer",
                            "value": "14000000"
                        }
                    ]
                }
            }
        ]
    }
}
@joeqian10
Copy link
Contributor

joeqian10 commented Jun 5, 2020

In PR #245, the GetInvokeResult method directly converts a StackItem to json, so there will no longer be ByteArray type in the response.

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

Successfully merging a pull request may close this issue.

2 participants