Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

getPreps returns error with high end ranking #147

Closed
robcxyz opened this issue Sep 19, 2020 · 3 comments
Closed

getPreps returns error with high end ranking #147

robcxyz opened this issue Sep 19, 2020 · 3 comments

Comments

@robcxyz
Copy link

robcxyz commented Sep 19, 2020

Per title, when calling the getPreps rpc method with a high end ranking, it returns an error.

from pprint import pprint
import requests

url = "https://ctz.solidwallet.io/api/v3"

payload_working = {
    "jsonrpc": "2.0",
    "id": 1234,
    "method": "icx_call",
    "params": {
        "to": "cx0000000000000000000000000000000000000000",
        "dataType": "call",
        "data": {
            "method": "getPReps",
            "params": {
                "startRanking" : "0x1",
                "endRanking": "0xa"
            }
        }
    }
}

response = requests.post(url, json=payload_working).json()
pprint(response)

payload_broken = {
    "jsonrpc": "2.0",
    "id": 1234,
    "method": "icx_call",
    "params": {
        "to": "cx0000000000000000000000000000000000000000",
        "dataType": "call",
        "data": {
            "method": "getPReps",
            "params": {
                "startRanking" : "0x1",
                "endRanking": "0xaa" # Large 
            }
        }
    }
}

response = requests.post(url, json=payload_broken).json()
pprint(response)

Which returns:

{'error': {'code': -32001,
           'message': "'NoneType' object has no attribute 'to_dict'"},
 'id': 1234,
 'jsonrpc': '2.0'}
@goldworm-icon
Copy link
Member

goldworm-icon commented Sep 21, 2020

We confirmed that this error happens when endRanking is larger than the number of PRep candidates.
This bug will be fixed at the next version and we expect to release it until November.
Thanks for your feedback.

@cow-hs
Copy link
Contributor

cow-hs commented Sep 22, 2020

@robcxyz It is ICON Service issue.
it is my PR icon-project/icon-service#521.
Please check then close this issue.

@robcxyz
Copy link
Author

robcxyz commented Oct 5, 2020

Thanks!

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

No branches or pull requests

3 participants