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

Improve Oracle error handling #767

Open
oleksandrSydorenkoJ opened this issue Apr 19, 2023 · 1 comment
Open

Improve Oracle error handling #767

oleksandrSydorenkoJ opened this issue Apr 19, 2023 · 1 comment
Assignees
Labels
bug Something isn't working epic:oracle

Comments

@oleksandrSydorenkoJ
Copy link

Preconditions:
Active schain medium type
All nodes active and run
Installed oracle-demo

Version:
skalenetwork/schain:3.16.1-beta.2

Steps to reproduce:

  1. Run examples.py in Oracle-demo repo
  2. check response on eth_blockNumber, eth_gasPrice, eth_getBlockByNumber, eth_getBlockByHash and other eth_methods

Expected state:
In Actual release for Oracle all eth_methods except eth_call are not allowed, Skaled should return readable log output if method valid but not supported

Actual state:
Skaled returns an uninformative error to all eth methods except eth_call

Logs:

Request >>>  {'id': 83, 'jsonrpc': '2.0', 'method': 'oracle_submitRequest', 'params': ['{"cid":123123,"uri":"eth://","jsps":["/result"],""encoding":"json","ethApi":"eth_gasPrice","params":[],"time":1681822602000,"pow":1337}']}
Response <<<  {'error': {'code': 24, 'data': None, 'message': 'Invalid oracle spec in submitOracleRequest Oracle check failed: Unparsable Oracle spec:{"cid":123123,"uri":"eth://","jsps":["/result"],""encoding":"json","ethApi":"eth_gasPrice","params":[],"time":1681822602000,"pow":1337}'}, 'id': 83, 'jsonrpc': '2.0'}

Note:
The same topic - the Unparsable Oracle spec error output if skaled couldn't return the result

  1. Send oracle request to web2 with bad latency
    logs from skaled:
[2023-04-18 12:36:03.581] [46:main] [error] 131990:Curl easy perform failed for url: http://httpbin.org/anything with error code:28

logs from Oracle:

Response <<<  {'error': {'code': 24, 'data': None, 'message': 'Invalid oracle spec in submitOracleRequest Oracle check failed: Unparsable Oracle spec:{"cid":123123,"uri":"http://httpbin.org/anything","jsps":["/url","/headers/Content-Length"],"post":"string=string_value","encoding":"json,"time":1681821585000,"pow":2348}'}, 'id': 83, 'jsonrpc': '2.0'}

  1. Valid but unsupported methods:
    Logs from skaled
2023-04-18 12:44:22.921177   http://1.1.1.1:31223 >>> {"id":83,"jsonrpc":"2.0","method":"oracle_submitRequest","params":["{\"cid\":1,\"uri\":\"eth://\",\"jsps\":[\"/result\"],\"\"encoding\":\"json\",\"ethApi\":\"eth_gasPrice\",\"params\":[],\"time\":1681821862000,\"pow\":1900}"]}
2023-04-18 12:44:22.921260   {"cid":1,"uri":"eth://","jsps":["/result"],""encoding":"json","ethApi":"eth_gasPrice","params":[],"time":1681821862000,"pow":1900}
[2023-04-18 12:44:22.921] [config] [error] Invalid oracle spec in submitOracleRequest Oracle check failed: Unparsable Oracle spec:{"cid":1,"uri":"eth://","jsps":["/result"],""encoding":"json","ethApi":"eth_gasPrice","params":[],"time":1681821862000,"pow":1900}
2023-04-18 12:44:22.921425   http://1.1.1.1:31223 <<< {"error":{"code":24,"data":null,"message":"Invalid oracle spec in submitOracleRequest Oracle check failed: Unparsable Oracle spec:{\"cid\":1,\"uri\":\"eth://\",\"jsps\":[\"/result\"],\"\"encoding\":\"json\",\"ethApi\":\"eth_gasPrice\",\"params\":[],\"time\":1681821862000,\"pow\":1900}"},"id":83,"jsonrpc":"2.0"}

logs from Oracle:

Request >>>  {'id': 83, 'jsonrpc': '2.0', 'method': 'oracle_submitRequest', 'params': ['{"cid":1,"uri":"eth://","jsps":["/result"],""encoding":"json","ethApi":"eth_gasPrice","params":[],"time":1681821862000,"pow":1900}']}
Response <<<  {'error': {'code': 24, 'data': None, 'message': 'Invalid oracle spec in submitOracleRequest Oracle check failed: Unparsable Oracle spec:{"cid":1,"uri":"eth://","jsps":["/result"],""encoding":"json","ethApi":"eth_gasPrice","params":[],"time":1681821862000,"pow":1900}'}, 'id': 83, 'jsonrpc': '2.0'}

  1. No space after error message: not allowed in Oracle urishttp
Response <<<  {'error': {'code': 23, 'data': None, 'message': 'Invalid oracle spec in submitOracleRequest Oracle check failed: IP addresses not allowed in Oracle urishttp://146.59.55.165:3009/status/schains'}, 'id': 83, 'jsonrpc': '2.0'}

@oleksandrSydorenkoJ
Copy link
Author

related to #754

@kladkogex kladkogex added this to the 2.2 milestone Apr 20, 2023
@kladkogex kladkogex removed this from the 2.2 milestone Jun 16, 2023
@kladkogex kladkogex added this to the 2.3 milestone Jul 21, 2023
@DmytroNazarenko DmytroNazarenko removed this from the 2.3 milestone Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working epic:oracle
Projects
Status: No status
Development

No branches or pull requests

4 participants