Giter VIP home page Giter VIP logo

pokt-lint's Issues

Add Simulate Relay message to "404 page not found"

When simulate relays is not on, we should have something in the response that is more descriptive. "404 page not found" should follow up with: "Check that Simulate Relays is enabled"

Call

curl -X POST -H "Content-Type: application/json" -d '{"node_url": "https://node-001.testnet2.dopenodes.com:443", "chain_ids": ["0001","0040"]}' https://2eqrf8goof.execute-api.us-east-1.amazonaws.com/test/relay-test

Response:

{"0001":{"chain_id":"0001","chain_name":"POKT","success":true,"status_code":404,"message":"OK","duration_ms":36.672,"relay_request":{"data":"{}","method":"POST","path":"/v1/query/height","headers":null},"relay_response":{"status_code":404,"data":{"body":"404 page not found"}}},"0040":{"chain_id":"0040","chain_name":"HMY 0","success":true,"status_code":404,"message":"OK","duration_ms":36.288,"relay_request":{"data":"{\"jsonrpc\":\"2.0\",\"method\":\"hmy_blockNumber\",\"params\":[],\"id\":64}","method":"POST","path":"/","headers":null},"relay_response":{"status_code":404,"data":{"body":"404 page not found"}}}}da@chains01-04:~$

Improve JSON parsing errors in request validation

If I send a request to the relay-test endpoint with incorrect parameters, eg excluding the node_id param, the response is not very useful:

{
    "errorMessage": "relaying.HandleRequest: relaying.NewNodeChecker: init: Node: strconv.ParseUint: parsing \"\": invalid syntax",
    "errorType": "errorString"
}

Relay Test response indicates success even if the simulate relay request failed

eg: this is the response for a relay test that should have failed. "success" should be false, but it is true

 "0025": {
        "chain_id": "0025",
        "chain_name": "ETH Rinkeby",
        "success": true,
        "status_code": 400,
        "message": "OK",
        "duration_ms": 46.652,
        "relay_request": {
            "data": "{\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":64}",
            "method": "POST",
            "path": "/",
            "headers": null
        },
        "relay_response": {
            "status_code": 400,
            "data": {
                "code": 400,
                "message": "ERROR:\nCodespace: pocketcore\nCode: 46\nMessage: \"the blockchain requested is not hosted\"\n"
            }
        }
    },
    ```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.