Skip to content

fix: add epoch_no DESC sort to getLatestEpochInfo and getLatestEpochParameters#191

Open
skisel-bt wants to merge 1 commit into
cardano-community:mainfrom
skisel-bt:fix/latest-epoch-sort-order
Open

fix: add epoch_no DESC sort to getLatestEpochInfo and getLatestEpochParameters#191
skisel-bt wants to merge 1 commit into
cardano-community:mainfrom
skisel-bt:fix/latest-epoch-sort-order

Conversation

@skisel-bt

Copy link
Copy Markdown

Summary

Fixes #190

getLatestEpochInfo() and getLatestEpochParameters() both fetch with Limit.of(1) but without explicit ordering. The Koios API does not guarantee result order, so behind a load balancer a stale node's entry can appear at [0], returning outdated epoch data.

Adding Order.by("epoch_no", SortType.DESC) ensures the first result is always the most recent epoch.

Verified with curl — ?limit=1&order=epoch_no.desc consistently returns the correct latest epoch whereas ?limit=1 alone returns stale results intermittently.

Test plan

  • getLatestEpochParameters() returns correct PlutusV3 cost model entries consistently
  • getLatestEpochInfo() returns the latest epoch consistently
  • Existing tests pass

🤖 Generated with Claude Code

…arameters

Without explicit ordering, the Koios API may return a stale node's entry
at position [0], causing these methods to return outdated epoch data.

Fixes cardano-community#190

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getLatestEpochParameters() may return stale epoch params due to missing sort order

1 participant