skalenetwork / skale-consensus

Running the very core of SKL network, SKALE BFT consensus is universal, modern, modular, high-performance, asynchronous, provably-secure, agent-based Proof-of-Stake blockchain consensus engine in C++ 17. Includes provably secure embedded Oracle. Used by SKALE elastic blockchains. Easy and flexible enough to implement your own blockchain or smart contract platform. BLS signatures and Binary Asynchronous Consensus are main building blocks.
https://docs.skale.network/technology/consensus-spec
GNU Affero General Public License v3.0
78 stars 32 forks source link

Oracle requests to http endpoind without domain name failed with ORACLE_INVALID_JSON_REQUEST 10 error #755

Closed oleksandrSydorenkoJ closed 1 year ago

oleksandrSydorenkoJ commented 1 year ago

Preconditions: 2 Active schains medium type oracle-demo

Versions: skalenetwork/schain:3.16.1-beta.0

Steps to reproduce

  1. Send oracle request to http endpoint without a domain name (IP:port)
    
            '"cid":123123,"uri":"http://1.1.1.1:10259","jsps":["/result"],"encoding":"json","ethApi":"eth_call","params":[{"from":"0x0000000000000000000000000000000000000000","to":"0x5fd3e5767b76ef934cac25e8ec947fb9e233c3bf","data":"0x49ce468d","gas":"0xfffff"},"latest"]',

2. check the result
3. Send Oracle request to HTTP endpoint with a domain name 
        '"cid":123123,"uri":"http://node-adv.skaletest.com:10259","jsps":["/result"],"encoding":"json","ethApi":"eth_call","params":[{"from":"0x0000000000000000000000000000000000000000","to":"0x5fd3e5767b76ef934cac25e8ec947fb9e233c3bf","data":"0x49ce468d","gas":"0xfffff"},"latest"]',
4. Compare responses

**Expected state:**
Oracle should be able to send requests to direct IP and domain name through HTTP 

**Actual state:**
Oracle requests to http endpoint without domain name failed with ORACLE_INVALID_JSON_REQUEST 10 error 

**Logs**
To direct IP 

========== Calculating PoW number ========== PoW number: 7301 ========== Sending request to Oracle ========== Request >>> {'id': 83, 'jsonrpc': '2.0', 'method': 'oracle_submitRequest', 'params': ['{"cid":123123,"uri":"http://1.1.1.1:10259","jsps":["/result"],"encoding":"json","ethApi":"eth_call","params":[{"from":"0x0000000000000000000000000000000000000000","to":"0x5fd3e5767b76ef934cac25e8ec947fb9e233c3bf","data":"0x49ce468d","gas":"0xfffff"},"latest"],"time":1681216360000,"pow":7301}']} Response <<< {'error': {'code': 10, 'data': None, 'message': 'Oracle request failed with status 10'}, 'id': 83, 'jsonrpc': '2.0'} Send oracle request failed

To domain name 

========== Calculating PoW number ========== PoW number: 2046 ========== Sending request to Oracle ========== Request >>> {'id': 83, 'jsonrpc': '2.0', 'method': 'oracle_submitRequest', 'params': ['{"cid":123123,"uri":"https://node-adv.skaletest.com:10264","jsps":["/result"],"encoding":"json","ethApi":"eth_call","params":[{"from":"0x0000000000000000000000000000000000000000","to":"0x5fd3e5767b76ef934cac25e8ec947fb9e233c3bf","data":"0x49ce468d","gas":"0xfffff"},"latest"],"time":1681216360000,"pow":2046}']} Response <<< {'id': 83, 'jsonrpc': '2.0', 'result': '00045f74551808a971f2f87ba8a52e3a8f7aa77b5b42e40b9da000b2bb1b04c8'} ========== Getting result from Oracle ========== Request >>> {'id': 83, 'jsonrpc': '2.0', 'method': 'oracle_checkResult', 'params': ['00045f74551808a971f2f87ba8a52e3a8f7aa77b5b42e40b9da000b2bb1b04c8']}

kladkogex commented 1 year ago

fixed as part of internal-support#41

oleksandrSydorenkoJ commented 1 year ago

Verified on Regression network skalenetwork/schain:3.16.1-beta.2 moral-optimal-tan-skale Oracle returns ORACLE_IP_ADDRESS_IN_URI 23 exception

https://skaleqa.testrail.io/index.php?/tests/view/13424