graph-network-subgraph icon indicating copy to clipboard operation
graph-network-subgraph copied to clipboard

Query Fees Collected - does not match estimation

Open davaymne opened this issue 4 years ago • 9 comments

Hi,

What

The total amount of queryFeesCollected for closed long term allocation does not match estimation (manual calculation):

Investigation:

Closed Allocation (open: 65, close: 91, duration: 27) as per query below collected 0.05 GRT, which is dramatically low in comparison with allocations before and after.

totalAllocations__closedAtEpoch totalAllocations__createdAtEpoch totalAllocations__id totalAllocations__queryFeesCollected totalAllocations__status
108 91 0x097922fdc28907b5dd60d0c710865cd80ed56318 86.5619865 Closed
91 65 0xd3409eb7abf379a12835cb66898771a83c8b4473 0.05047515 Closed
65 58 0x978b11c0953599ad52b889d03867fc5112976d95 17.9900028 Closed
58 45 0x26b957c2a141acf5768e21efe0d9afff8d587a4e 259.0472907 Closed
58 49 0x5feacb47af67dee57ee10bedaef5ad93627b1d97 9.7461144 Closed
58 46 0xc66d80f65188311ec1dccd23c77da91354803a50 141.8263506 Closed

Query:

{
  indexer (id:"0x720a98087160bfdb282f695abe6f9ac966b03d43") {
    id
    totalAllocations{
      id
      status
      createdAtEpoch
      closedAtEpoch
      indexingRewards
      poi
      queryFeesCollected
      queryFeeRebates
    }
  }}

As per summary from server logs for mentioned period, the total amount of queries received and fees collected, should be:

QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 102511, 20210217
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 189511, 20210219
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 180074, 20210220
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 173312, 20210221
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 148499, 20210222
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 166510, 20210223
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 172330, 20210224
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 161198, 20210225
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 152411, 20210226
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 140392, 20210227
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 138167, 20210228
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 134491, 20210301
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 113156, 20210302
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 129508, 20210303
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 122893, 20210304
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 25581, 20210305
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 190944, 20210306
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 151229, 20210307
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 117728, 20210308
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 54805, 20210309
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 126816, 20210310
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 169748, 20210311
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 161799, 20210312
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 166621, 20210313
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 163947, 20210314
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 74610, 20210315
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 7516, 20210316
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 106211, 20210317
QmRhYzT8HEZ9LziQhP6JfNfd4co9A7muUYQhPMJsMUojSF, 138919, 20210318
Query Price Total
3881437 0.00005 194.07185

Could you, please, help to figure out this issue.

Regards,

davaymne avatar Apr 04 '21 03:04 davaymne

@davaymne Hey, I am well versed in the Subgraph part, but not the logs you have shared as I don't deal much with graph-node.

Are the logs you shared query counts? The first row queries? The second row, something else? And then are you just taking those queries and multiplying by 0.00005 GRT price?

davekay100 avatar Apr 09 '21 17:04 davekay100

Logs structure: , , . So, I sum all queries that graph-node processed over the period (~29 days) - allocation 0xd3409eb7abf379a12835cb66898771a83c8b4473 duration and multiplied by query price, so 3881437 x 0.00005 = 194.07185

davaymne avatar Apr 11 '21 01:04 davaymne

The low amount of query fees collected for allocation 0xd3409eb7abf379a12835cb66898771a83c8b4473 is ok in the subgraph, it happened on this transaction https://etherscan.io/tx/0x72171a4bd966234a25015ca29a382fb4a869c4300508ad9f6742365faee73e7b

The discrepancy between the expected query fees, from the actual query responses and the amount collected could be in the gateway. Probably there were some missing collect transactions? or the amount was less than it should

abarmat avatar Apr 12 '21 19:04 abarmat

It seems to be a huge difference, as 0.05 is much less than 194 (estimated). I seems like 1K queries were counted instead of ~3.9M.

Is there any way to troubleshoot on gateway side? I still have all these query logs in case you need it.

Regards,

davaymne avatar Apr 13 '21 01:04 davaymne

Yes , please share the query logs with us, maybe in a gist or a paste bin.

We will debug the gateway on our side. However, it may take some time, we have a lot going on at the moment. We will keep you up to date

davekay100 avatar Apr 13 '21 12:04 davekay100

Hm.. there are 16Gb query logs in jsonl format - for those days. What would be the best way to share?

davaymne avatar Apr 13 '21 13:04 davaymne

dm me on discord and we can figure it out

davekay100 avatar Apr 13 '21 21:04 davekay100

Is this still an issue? @davekaj @davaymne If yes, I could add it as a task and continue investigation, if not I'll close the issue

juanmardefago avatar Jul 28 '21 15:07 juanmardefago

its still open if it exists. i remember i got the files, talked to engineering about it, but couldnt get their time to look at it, and then i forgot about it.

davekay100 avatar Jul 28 '21 16:07 davekay100