penumbra-zone / web

Apache License 2.0
10 stars 7 forks source link

Transactions table should populate recent transactions first #1363

Open turbocrime opened 3 days ago

turbocrime commented 3 days ago

On the minifront transactions table, transaction info is streamed to the page.

They populate in essentially random order: they stream in lexical order of their key, which is a base64 encoding of their transaction hash.

Ideally, the most recent transactions known would populate first, and earlier transactions would load as the user scrolls down the page.

turbocrime commented 3 days ago

I experimented with this issue today. Unfortunately it looks like this is impossible given current idb schema constraints

  1. we should add an index of transactions by height. this is doable.
  2. we should query by this index. this is doable.

But, the index is also a string which sorts in lexical order, because the height in database is a jsonified bigint.

The situation is improved but still clearly incorrect.

https://github.com/penumbra-zone/web/assets/134443988/e9960065-07b5-4b07-9981-65d6f5b37770

turbocrime commented 3 days ago

if idb schema used real types instead of stringifying everything, many operations like this would be more sane and just work as expected.

turbocrime commented 3 days ago

if the string key bounds are interpreted lexically instead of numerically, it may not even be possible to achieve numeric ranges with idb key bounds. this could create problems long term.