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

unclaimedGas execution result difference #3589

Closed
ixje opened this issue Sep 18, 2024 · 4 comments · Fixed by #3594
Closed

unclaimedGas execution result difference #3589

ixje opened this issue Sep 18, 2024 · 4 comments · Fixed by #3594
Labels
bug Something isn't working I4 No visible changes S4 Routine U2 Seriously planned
Milestone

Comments

@ixje
Copy link
Contributor

ixje commented Sep 18, 2024

Neo-go's execution results differ from C#

Current Behavior

{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "state": "FAULT",
        "gasconsumed": "231485",
        "script": "wh8MDGN1cnJlbnRJbmRleAwUvvIEMUA2KnfBUJnH5kwS9wC2ZdpBYn1bUgwU5THqcjqLpY5TkquLOLfxy/LIGN4SwB8MDHVuY2xhaW1lZEdhcwwU9WPqQLwoPU0OBcSOowWz8qBzQO9BYn1bUg==",
        "stack": [
            {
                "type": "Integer",
                "value": "4258708"
            },
            {
                "type": "ByteString",
                "value": "5THqcjqLpY5TkquLOLfxy/LIGN4="
            }
        ],
        "exception": "at instruction 120 (SYSCALL): can't calculate bonus of height unequal (BlockHeight + 1)",
        "notifications": []
    }
}

Expected Behavior

from C#

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "wh8MDGN1cnJlbnRJbmRleAwUvvIEMUA2KnfBUJnH5kwS9wC2ZdpBYn1bUgwU5THqcjqLpY5TkquLOLfxy/LIGN4SwB8MDHVuY2xhaW1lZEdhcwwU9WPqQLwoPU0OBcSOowWz8qBzQO9BYn1bUg==",
        "state": "HALT",
        "gasconsumed": "694455",
        "exception": null,
        "notifications": [],
        "stack": [
            {
                "type": "Integer",
                "value": "0"
            }
        ]
    }
}

Steps to Reproduce

curl --location 'https://rpc10.n3.nspcc.ru:10331' \
--header 'Content-Type: text/plain' \
--data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "invokescript",
  "params": ["wh8MDGN1cnJlbnRJbmRleAwUvvIEMUA2KnfBUJnH5kwS9wC2ZdpBYn1bUgwU5THqcjqLpY5TkquLOLfxy/LIGN4SwB8MDHVuY2xhaW1lZEdhcwwU9WPqQLwoPU0OBcSOowWz8qBzQO9BYn1bUg=="]
}'
@ixje ixje added bug Something isn't working U2 Seriously planned labels Sep 18, 2024
@roman-khimov
Copy link
Member

Not sure why C# allows to calculate it via RPC.

@roman-khimov roman-khimov added S4 Routine I4 No visible changes labels Sep 18, 2024
@roman-khimov roman-khimov added this to the v0.106.4 milestone Sep 18, 2024
@ixje
Copy link
Contributor Author

ixje commented Sep 18, 2024

It's useful information for a wallet. People still like the idea of "claim gas!"

@roman-khimov
Copy link
Member

Yeah, I know, but the limitation is from neo-project/neo#2841 and it's the same for both nodes.

@roman-khimov
Copy link
Member

It needs to be executed on-chain to prove correct/incorrect behavior.

AliceInHunterland added a commit that referenced this issue Sep 30, 2024
Fix difference with C#:
```
(base) ekaterinapavlova@MacBook-Air-4 neo-go % curl -X POST
http://seed1t5.neo.org:20332 -H 'Content-Type: application/json' -d '{
  "jsonrpc": "2.0",
  "method": "getapplicationlog",
  "params":
  ["61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3f"],
  "id": 1
}' | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time
  Current
                                 Dload  Upload   Total   Spent    Left
                                 Speed
100   429    0   269  100   160    582    346 --:--:-- --:--:-- --:--:--
   930
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "exception" : null,
            "gasconsumed" : "198754",
            "notifications" : [],
            "stack" : [
               {
                  "type" : "Integer",
                  "value" : "0"
               }
            ],
            "trigger" : "Application",
            "vmstate" : "HALT"
         }
      ],
      "txid" :
      "0x61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3
      f"
   }
}
```
(base) ekaterinapavlova@MacBook-Air-4 neo-go % curl -X POST  https://rpc
.t5.n3.nspcc.ru:20331 -H 'Content-Type: application/json' -d '{
  "jsonrpc": "2.0",
  "method": "getapplicationlog",
  "params":
  ["61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3f"],
  "id": 1
}' | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time
  Current
                                 Dload  Upload   Total   Spent    Left
                                 Speed
100   583  100   423  100   160   1424    538 --:--:-- --:--:-- --:--:--
  1969
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "exception" : "at instruction 120 (SYSCALL): can't calculate
             bonus of height unequal (BlockHeight + 1)",
            "gasconsumed" : "198754",
            "notifications" : [],
            "stack" : [
               {
                  "type" : "Integer",
                  "value" : "4704605"
               },
               {
                  "type" : "ByteString",
                  "value" : "KfYYlDe/fxqqqm1yr7o5XLnQ7uk="
               }
            ],
            "trigger" : "Application",
            "vmstate" : "FAULT"
         }
      ],
      "txid" :
      "0x61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3
      f"
   }
}

```
```
(base) ekaterinapavlova@MacBook-Air-4 neo-go % ./bin/neo-go contract
invokefunction -r https://rpc.t5.n3.nspcc.ru:20331 -w ./testnet_wallet
.json 1e6f88377a6c6bc4f683a5fc61eed5645ec5f123 unclaimedGas
e9eed0b95c39baaf726daaaa1a7fbf379418f629 4704605
Enter account NWtk9HYWsf1njtSzA3XNgwZXRtriACcJ9G password >
Warning: FAULT VM state returned from the RPC node: at instruction 120
(SYSCALL): can't calculate bonus of height unequal (BlockHeight + 1).
Use --force flag to send the transaction anyway.
```

Close #3589

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
AliceInHunterland added a commit that referenced this issue Oct 1, 2024
Fix difference with C#:
```
(base) ekaterinapavlova@MacBook-Air-4 neo-go % curl -X POST
http://seed1t5.neo.org:20332 -H 'Content-Type: application/json' -d '{
  "jsonrpc": "2.0",
  "method": "getapplicationlog",
  "params":
  ["61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3f"],
  "id": 1
}' | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time
  Current
                                 Dload  Upload   Total   Spent    Left
                                 Speed
100   429    0   269  100   160    582    346 --:--:-- --:--:-- --:--:--
   930
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "exception" : null,
            "gasconsumed" : "198754",
            "notifications" : [],
            "stack" : [
               {
                  "type" : "Integer",
                  "value" : "0"
               }
            ],
            "trigger" : "Application",
            "vmstate" : "HALT"
         }
      ],
      "txid" :
      "0x61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3
      f"
   }
}
```
(base) ekaterinapavlova@MacBook-Air-4 neo-go % curl -X POST  https://rpc
.t5.n3.nspcc.ru:20331 -H 'Content-Type: application/json' -d '{
  "jsonrpc": "2.0",
  "method": "getapplicationlog",
  "params":
  ["61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3f"],
  "id": 1
}' | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time
  Current
                                 Dload  Upload   Total   Spent    Left
                                 Speed
100   583  100   423  100   160   1424    538 --:--:-- --:--:-- --:--:--
  1969
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "exception" : "at instruction 120 (SYSCALL): can't calculate
             bonus of height unequal (BlockHeight + 1)",
            "gasconsumed" : "198754",
            "notifications" : [],
            "stack" : [
               {
                  "type" : "Integer",
                  "value" : "4704605"
               },
               {
                  "type" : "ByteString",
                  "value" : "KfYYlDe/fxqqqm1yr7o5XLnQ7uk="
               }
            ],
            "trigger" : "Application",
            "vmstate" : "FAULT"
         }
      ],
      "txid" :
      "0x61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3
      f"
   }
}

```
```
(base) ekaterinapavlova@MacBook-Air-4 neo-go % ./bin/neo-go contract
invokefunction -r https://rpc.t5.n3.nspcc.ru:20331 -w ./testnet_wallet
.json 1e6f88377a6c6bc4f683a5fc61eed5645ec5f123 unclaimedGas
e9eed0b95c39baaf726daaaa1a7fbf379418f629 4704605
Enter account NWtk9HYWsf1njtSzA3XNgwZXRtriACcJ9G password >
Warning: FAULT VM state returned from the RPC node: at instruction 120
(SYSCALL): can't calculate bonus of height unequal (BlockHeight + 1).
Use --force flag to send the transaction anyway.
```

Close #3589

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
AliceInHunterland added a commit that referenced this issue Oct 3, 2024
Fix difference with C#:
```
(base) ekaterinapavlova@MacBook-Air-4 neo-go % curl -X POST
http://seed1t5.neo.org:20332 -H 'Content-Type: application/json' -d '{
  "jsonrpc": "2.0",
  "method": "getapplicationlog",
  "params":
  ["61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3f"],
  "id": 1
}' | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time
  Current
                                 Dload  Upload   Total   Spent    Left
                                 Speed
100   429    0   269  100   160    582    346 --:--:-- --:--:-- --:--:--
   930
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "exception" : null,
            "gasconsumed" : "198754",
            "notifications" : [],
            "stack" : [
               {
                  "type" : "Integer",
                  "value" : "0"
               }
            ],
            "trigger" : "Application",
            "vmstate" : "HALT"
         }
      ],
      "txid" :
      "0x61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3
      f"
   }
}
```
(base) ekaterinapavlova@MacBook-Air-4 neo-go % curl -X POST  https://rpc
.t5.n3.nspcc.ru:20331 -H 'Content-Type: application/json' -d '{
  "jsonrpc": "2.0",
  "method": "getapplicationlog",
  "params":
  ["61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3f"],
  "id": 1
}' | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time
  Current
                                 Dload  Upload   Total   Spent    Left
                                 Speed
100   583  100   423  100   160   1424    538 --:--:-- --:--:-- --:--:--
  1969
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "exception" : "at instruction 120 (SYSCALL): can't calculate
             bonus of height unequal (BlockHeight + 1)",
            "gasconsumed" : "198754",
            "notifications" : [],
            "stack" : [
               {
                  "type" : "Integer",
                  "value" : "4704605"
               },
               {
                  "type" : "ByteString",
                  "value" : "KfYYlDe/fxqqqm1yr7o5XLnQ7uk="
               }
            ],
            "trigger" : "Application",
            "vmstate" : "FAULT"
         }
      ],
      "txid" :
      "0x61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3
      f"
   }
}

```
```
(base) ekaterinapavlova@MacBook-Air-4 neo-go % ./bin/neo-go contract
invokefunction -r https://rpc.t5.n3.nspcc.ru:20331 -w ./testnet_wallet
.json 1e6f88377a6c6bc4f683a5fc61eed5645ec5f123 unclaimedGas
e9eed0b95c39baaf726daaaa1a7fbf379418f629 4704605
Enter account NWtk9HYWsf1njtSzA3XNgwZXRtriACcJ9G password >
Warning: FAULT VM state returned from the RPC node: at instruction 120
(SYSCALL): can't calculate bonus of height unequal (BlockHeight + 1).
Use --force flag to send the transaction anyway.
```

Close #3589

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
AliceInHunterland added a commit that referenced this issue Oct 4, 2024
Fix difference with C#:
```
(base) ekaterinapavlova@MacBook-Air-4 neo-go % curl -X POST
http://seed1t5.neo.org:20332 -H 'Content-Type: application/json' -d '{
  "jsonrpc": "2.0",
  "method": "getapplicationlog",
  "params":
  ["61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3f"],
  "id": 1
}' | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time
  Current
                                 Dload  Upload   Total   Spent    Left
                                 Speed
100   429    0   269  100   160    582    346 --:--:-- --:--:-- --:--:--
   930
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "exception" : null,
            "gasconsumed" : "198754",
            "notifications" : [],
            "stack" : [
               {
                  "type" : "Integer",
                  "value" : "0"
               }
            ],
            "trigger" : "Application",
            "vmstate" : "HALT"
         }
      ],
      "txid" :
      "0x61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3
      f"
   }
}
```
(base) ekaterinapavlova@MacBook-Air-4 neo-go % curl -X POST  https://rpc
.t5.n3.nspcc.ru:20331 -H 'Content-Type: application/json' -d '{
  "jsonrpc": "2.0",
  "method": "getapplicationlog",
  "params":
  ["61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3f"],
  "id": 1
}' | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time
  Current
                                 Dload  Upload   Total   Spent    Left
                                 Speed
100   583  100   423  100   160   1424    538 --:--:-- --:--:-- --:--:--
  1969
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "exception" : "at instruction 120 (SYSCALL): can't calculate
             bonus of height unequal (BlockHeight + 1)",
            "gasconsumed" : "198754",
            "notifications" : [],
            "stack" : [
               {
                  "type" : "Integer",
                  "value" : "4704605"
               },
               {
                  "type" : "ByteString",
                  "value" : "KfYYlDe/fxqqqm1yr7o5XLnQ7uk="
               }
            ],
            "trigger" : "Application",
            "vmstate" : "FAULT"
         }
      ],
      "txid" :
      "0x61681ce24dffea5481e9a50b10159b43b7ebfc21967b0b06fee7ff69c7123e3
      f"
   }
}

```
```
(base) ekaterinapavlova@MacBook-Air-4 neo-go % ./bin/neo-go contract
invokefunction -r https://rpc.t5.n3.nspcc.ru:20331 -w ./testnet_wallet
.json 1e6f88377a6c6bc4f683a5fc61eed5645ec5f123 unclaimedGas
e9eed0b95c39baaf726daaaa1a7fbf379418f629 4704605
Enter account NWtk9HYWsf1njtSzA3XNgwZXRtriACcJ9G password >
Warning: FAULT VM state returned from the RPC node: at instruction 120
(SYSCALL): can't calculate bonus of height unequal (BlockHeight + 1).
Use --force flag to send the transaction anyway.
```

Close #3589

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working I4 No visible changes S4 Routine U2 Seriously planned
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants