subscan-explorer / subscan-issue-tracker

The issue tracker for Subscan.io.
3 stars 5 forks source link

/api/scan/staking/nominators returns incorrect "rank_nominator" value #38

Closed BeneRichi closed 1 year ago

BeneRichi commented 1 year ago

Confirmation

Affected Network(s)

Reef

Steps to reproduce

  1. This is my API endpoint to my backend: /api/statistics/reef-nominators/{ADDRESS}. Next, I call a function in my backend with a parameter called "address," which stands for the wallet address of an individual nominator to search for.

  2. With this link, you pass this nominator address to my backend function, and my backend function makes the API request to your nominators endpoint: /api/scan/staking/nominators. https://reefaq.com/api/statistics/reef-nominators/5Ca2UZe7GSBLm6BhV6hZLNt8E9V3LMEB6M8BCrwo2sDEfJfM

My paramenters for this example are looking like that: ->post('https://reef.api.subscan.io/api/scan/staking/nominators', [ "address" => '5Ca2UZe7GSBLm6BhV6hZLNt8E9V3LMEB6M8BCrwo2sDEfJfM', "order_field" => 'rank_nominator', "order" => 'asc', "row" => 50, "page" => 3, ])‡

Expected output

Bildschirmfoto 2022-10-24 um 19 00 53

Expected output: "rank_nominator": 42,

As you can see in the attached screenshot, this particular nominator (highlighted in yellow) has the rank "170" ("rank_nominator": 170). On the left side of the screenshot, you can see the console.reefscan.com of this particular validator nominated by this nominator. If you count all the nominations before this individual nominator, you get the rank of 42.

So I was expecting the issue to be 42 and not 170. Because the nominations are sorted by the number of nominations for any validator. The highest nominations are at the top.

Actual output

Actual output: "rank_nominator": 170,

Additional factoids or references

I would also like to know how I can retrieve more than 100 entries in the array "list"? When i write for example "row" : 1000, i will get null as response. But how would I know the exact page where that a specific nominator is listed? I would expect an array of ALL nominators without any pagination.

https://reefaq.com/api/statistics/reef-nominators/5Ca2UZe7GSBLm6BhV6hZLNt8E9V3LMEB6M8BCrwo2sDEfJfM

freehere107 commented 1 year ago

@BeneRichi Thanks for your feedback. The definition of Nominator rank is the position of the Nominator in the validator, not the rank according to the bond amount E.g staking.erasStakers(era:878,accountId:1REAJ1k691g5Eqqg9gL7vvZCBG7FCCZ8zgQkZWd4va5ESih)

get The current first Nominator is 12R2Xsw9PJwncYpTFhQQX1MRJTcsxWZKE3GATwGgCuHhRqkS

But if you sort by bond amount rank 1 is 12R2Xsw9PJwncYpTFhQQX1MRJTcsxWZKE3GATwGgCuHhRqkS

In addition, the current maximum number of subscan pages per page is 100, which is limited