EspressoSystems / hotshot-query-service

Generic query service for HotShot applications
https://espressosystems.github.io/hotshot-query-service/
GNU General Public License v3.0
5 stars 1 forks source link

Explorer API Transaction indexing is reversed #721

Closed Ayiga closed 2 weeks ago

Ayiga commented 4 weeks ago

When navigating transactions using the block explorer, the order in which we visit / link transactions is reversed.

We identify an individual transaction via its block height and its transaction offset. This transaction offset is always meant to be in ascending order, such that the 0 offset is the first transaction within the block.

This gets a little weird when it comes to retrieving the list of "Latest Transactions" as we want that list to be descending overall, but still return the appropriate offset number correctly.

Where this gets odd is in retrieving the Transaction Detail for a given (height, offset) pair. Instead of returning the transaction that corresponds to the given (height, offset) we instead end up returning the transaction that corresponds to (height, N - offset) where N is the total number of transactions within the block at height.

Example: https://explorer.decaf.testnet.espresso.network/block/315286

This block has two transactions within it. If we look at its transaction page: https://explorer.decaf.testnet.espresso.network/transactions?block=315286

We can see both of these transactions. We can even see that they list links to these pages:

But notice that the hashes of each of the clicked links doesn't match the initially listed hash.

TX~v_HZvxLYwnnqkSqr56edsFVuXdnXs5nJM3JkS1TAwg1N indicates that it links to https://explorer.decaf.testnet.espresso.network/transaction/315286-1, but that page shows TX~Nev36VRr3zOQ-BFRZICxG-aLzDQoe1nlS24G4PxWBA8R instead.

This is also true for the other.

Ayiga commented 2 weeks ago

This has been resolved with #723.