Page MenuHomePhabricator

[explorer] Fix pagination for larger page counts
ClosedPublic

Authored by Fabien on Sep 6 2023, 13:43.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Commits
rABC2aed083be4fc: [explorer] Fix pagination for larger page counts
Summary

The current pagination algorithm uses a ranking method for slot width that depends on the number of digits, but is limited to 9 digits (in fact 5 as 10000 is supported which is a bug).

This diff makes it generic so it works with any page number, which in turn fixes the pagination for the testnet explorer blocks page (>15000 pages).

It involves a log10 computation instead of the branching selection. Because of javascript I have no idea if this performs better or worse than the previous version but it's a single computation per page so the impact is negligible anyway.

Test Plan

Run the explorer and check the pagination is correct. A testnet explorer can be used to see page numbers above 10000.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
explorer_pagination_100k_tier
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 24960
Build 49508: Build Diff
Build 49507: arc lint + arc unit

Event Timeline

Fabien requested review of this revision.Sep 6 2023, 13:43
bytesofman added a subscriber: bytesofman.

pretty tricky to compare without unit tests but imo the function is not important enough to warrant this. clear improvement over previous bug.

do we have a testnet chronik instance up?

This revision is now accepted and ready to land.Sep 6 2023, 22:22