Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API finalized block num is not really finalized #57

Open
2 tasks done
botnumberseven opened this issue Apr 27, 2023 · 3 comments
Open
2 tasks done

API finalized block num is not really finalized #57

botnumberseven opened this issue Apr 27, 2023 · 3 comments
Assignees
Labels
wontfix This will not be worked on

Comments

@botnumberseven
Copy link

Confirmation

  • My issue isn't already found on the issue tracker.
  • I have read the Subscan API documentation (if it seemed to be an API bug).

Affected Network(s)

OriginTrail Parachain

Steps to reproduce

I'm using metadata API to get the value of the latest finalized block (finalized_blockNum):
curl -X POST 'https://origintrail.api.subscan.io/api/scan/metadata'
--header 'Content-Type: application/json'
--header 'X-API-Key: YOUR_API'

Then i pull TXs data for that block using transactions API:
curl -X POST 'https://origintrail.api.subscan.io/api/scan/evm/transactions'
--header 'Content-Type: application/json'
--header 'X-API-Key: YOUR_API'
--data-raw '{
"block_num": 2265183
}'

And transactions API returns incorrect data. Consider the example below.
Metadata returned 2265183 as finalized_blockNum
Within a second or two I called transactions API for this block and got back a success with no transactions data.
Then I waited ~30sec made the same call and now I got back a response with transactions data.

image

Expected output

If metadata API tells me X is the finalized block, I expect transactions API to be able to return transactions data for that block.

Actual output

Transactions API returns Null, instead of txs data for the last (or maybe not only last) finalized block.
Looks like transactions API lags behind metadata API.

Additional factoids or references

No response

@botnumberseven botnumberseven added the kind/bug Something isn't working label Apr 27, 2023
@freehere107
Copy link
Contributor

@botnumberseven In fact, this is true. The transactions API will lag behind the finalized_blockNum field on the finalized block num. Subscan will lag behind by about 3 blocks because it needs checks and synchronization.

@freehere107 freehere107 added wontfix This will not be worked on and removed kind/bug Something isn't working labels Apr 28, 2023
@botnumberseven
Copy link
Author

Appreciate quick response @freehere107

I have no issues with the lag itself.
But this specifics in a behaviour matters a lot. E.g. For a while I've been pulling transactions data based on finalized_blockNum, but read empty data. And I had no simple way to notice that I pull incorrect data.

In my case i added a delay for 10 blocks. But you might want to consider some non-success response thru transactions API in case user tries to pull data for finalized-but-not-available-thru-transactions-API block.
Or at least put a note in documentation for transactions API, so user knows what to expect.

@freehere107
Copy link
Contributor

Thanks for your suggestion, I will add this reminder to the documentation in a few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants