Skip to content

Registrar Actions: Inconsistent Order#1742

Draft
Goader wants to merge 1 commit intomainfrom
fix/registrar-actions-inconsistent-order
Draft

Registrar Actions: Inconsistent Order#1742
Goader wants to merge 1 commit intomainfrom
fix/registrar-actions-inconsistent-order

Conversation

@Goader
Copy link
Contributor

@Goader Goader commented Mar 9, 2026

Inconsistent Order of Registrar Actions

closes: #1704

Summary

  • Changed the SQL query to order by Registrar Actions ID, not timestamp

Why

  • Registrar Actions order returned from ENSApi is inconsistent, causing undeterministic behavior on the frontend
  • Sorting by id just like we did with rev-share-limit leaderboard building (not that eventType is not processed contrary to leaderboard building)
  • See: Inconsistent order of Registrar Actions #1704

Testing

  • Automatic, CI testing
  • Manual validation (using older version of ENSIndexer and ENSRainbow, but as far as I understand this shouldn't affect the outcome)

Notes for Reviewer (Optional)

  • Whether id is sufficient for the deterministic ordering

Pre-Review Checklist (Blocking)

  • This PR does not introduce significant changes and is low-risk to review quickly.
  • Relevant changesets are included (or are not required)

@Goader Goader self-assigned this Mar 9, 2026
Copilot AI review requested due to automatic review settings March 9, 2026 15:09
@vercel
Copy link
Contributor

vercel bot commented Mar 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
admin.ensnode.io Ready Ready Preview, Comment Mar 9, 2026 3:09pm
ensnode.io Ready Ready Preview, Comment Mar 9, 2026 3:09pm
ensrainbow.io Ready Ready Preview, Comment Mar 9, 2026 3:09pm

@changeset-bot
Copy link

changeset-bot bot commented Mar 9, 2026

🦋 Changeset detected

Latest commit: c133aa4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
Name Type
ensapi Patch
ensindexer Patch
ensadmin Patch
ensrainbow Patch
fallback-ensapi Patch
@ensnode/datasources Patch
@ensnode/ensrainbow-sdk Patch
@ensnode/ensnode-schema Patch
@ensnode/ensnode-react Patch
@ensnode/ensnode-sdk Patch
@ensnode/ponder-sdk Patch
@ensnode/ponder-subgraph Patch
@ensnode/shared-configs Patch
@docs/ensnode Patch
@docs/ensrainbow Patch
@docs/mintlify Patch
@namehash/ens-referrals Patch
@namehash/namehash-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 9, 2026

📝 Walkthrough

Walkthrough

A patch changelog entry is added to document a fix for non-deterministic ordering of registrar actions. The registrar actions query is updated to sort by id (a Ponder checkpoint) instead of timestamp, ensuring deterministic ordering across actions within the same block.

Changes

Cohort / File(s) Summary
Changelog Entry
.changeset/tall-icons-return.md
Added patch changelog documenting the fix to registrar actions ordering.
Registrar Actions Query
apps/ensapi/src/lib/registrar-actions/find-registrar-actions.ts
Updated buildOrderByClause for LatestRegistrarActions to sort by registrarActions.id instead of registrarActions.timestamp for deterministic ordering within blocks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A hop through time, we've learned to see,
That order counts for consistency!
No timestamps here, just IDs so clear,
Deterministic actions, loud and near!
Ponder checkpoints lead the way,
Through blocks we bound, hooray, hooray!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Registrar Actions: Inconsistent Order' is vague and generic, failing to convey the specific fix being applied to the codebase. Clarify the title to describe the specific fix, such as 'Fix non-deterministic ordering of registrar actions by sorting on id' for better clarity.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed The PR description includes all required sections from the template with substantive content addressing the issue, including summary, rationale, testing approach, and reviewer notes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/registrar-actions-inconsistent-order

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to make the ENSApi “registrar actions” list ordering deterministic when multiple actions share the same block timestamp, improving pagination stability and repeatability of results.

Changes:

  • Update “latest registrar actions” ordering to sort by registrar_actions.id (Ponder checkpoint) instead of timestamp.
  • Add a Changesets entry to release the fix as an ensapi patch.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
apps/ensapi/src/lib/registrar-actions/find-registrar-actions.ts Changes the ORDER BY used for “latest” registrar actions to use id for deterministic ordering.
.changeset/tall-icons-return.md Declares a patch release for ensapi describing the ordering fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 31 to +35
case RegistrarActionsOrders.LatestRegistrarActions:
return desc(schema.registrarActions.timestamp);
// id is a Ponder checkpoint (blockTimestamp → chainId → blockNumber → transactionIndex →
// eventType → eventIndex); fixed-length decimal strings compare lexicographically =
// numerically, so DESC gives "latest first" with full determinism across same-block actions.
return desc(schema.registrarActions.id);
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RegistrarActionsOrders.LatestRegistrarActions is defined in the SDK as orderBy[timestamp]=desc, but this handler now orders solely by registrarActions.id. Even if the Ponder checkpoint ID currently prefixes blockTimestamp, this couples ordering correctness to an internal ID encoding and makes the order param/name misleading. Consider ordering by timestamp DESC with id DESC as a deterministic tie-breaker (or update the order enum/name to reflect id).

Copilot uses AI. Check for mistakes.
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.

Inconsistent order of Registrar Actions

2 participants