Skip to content

Conversation

@Goader
Copy link
Contributor

@Goader Goader commented Jan 7, 2026

Registrar Actions: Add accurateAsOf Timestamp

closes: #1424


Reviewer Focus (Read This First)

What reviewers should focus on
  • New helper function get-accurate-as-of-timestamp.ts - follows referrer leaderboard pattern, I think I will extend it further later, when making it stateless for the client, so that it can acommodate both referrer leaderboard and registrar actions
  • Handler not duplicating checks for undefined and Error, which should be already done in middleware

Problem & Motivation

Why this exists

What Changed (Concrete)

What actually changed
  1. Added accurateAsOf: UnixTimestamp to RegistrarActionsResponseOk type
  2. Updated serialization to include the field
  3. Updated Zod schema to validate accurateAsOf
  4. Created getAccurateAsOfTimestamp() helper - uses getLatestIndexedBlockRef() for the chain
  5. Handler calls helper function, middleware handles validation
  6. Updated test fixtures

Design & Planning

How this approach was chosen

Followed exact same pattern as referrer leaderboard cache - uses getLatestIndexedBlockRef() for the subregistry chain instead of omnichain cursor.

  • Planning artifacts: None needed, straightforward implementation matching existing pattern
  • Followed referrer leaderboard implementation exactly
  • Reviewed / approved by: N/A

Self-Review

What you caught yourself
  • Initially used omnichain cursor instead of chain-specific getLatestIndexedBlockRef()
  • Had redundant validation checks in handler that middleware already handles
  • Bugs caught: Wrong timestamp source (omnichain cursor vs chain-specific block ref)
  • Logic simplified: Removed duplicate validation, extracted helper function
  • Naming / terminology improved: None
  • Dead or unnecessary code removed: Duplicate indexing status checks

Cross-Codebase Alignment

Related code you checked
  • Verified referrer leaderboard implementation for pattern consistency
  • Response type changes are non-breaking (additive only)
  • Search terms used: accurateAsOf, getLatestIndexedBlockRef, ReferrerLeaderboard, indexingStatusCache
  • Reviewed but unchanged: deserialization
  • Deferred alignment: referrer cache does not use the helper function yet

Downstream & Consumer Impact

Who this affects and how

UI can now display "accurate as of" timestamps on registrar actions page and live feed.

  • Public APIs affected: Registrar Actions API (non-breaking, additive change)
  • Docs updated: Very minor update of the client's method docs
  • Naming decisions: Used accurateAsOf to match existing leaderboard APIs

Testing Evidence

How this was validated
  • Normal CI testing
  • Manually tested with running ENSApi instance, tested with curl multiple scenarios, including when ENS Indexer is available or not, and the indexing status cache was populated or not
  • Testing performed: Automated test scripts + manual validation
  • Known gaps: None
  • What reviewers have to reason about manually: Indexing status verification, which is done in the middleware

Scope Reductions

What you intentionally didn't do

Did not move the logic from referrer leaderboard cache to the helper function yet. I intend and think it will be best to do it when I deal with stateful logic.

  • Follow-ups: None
  • Why they were deferred: N/A

Risk Analysis

How this could go wrong

Low risk - additive change only, middleware handles edge cases gracefully via SWR cache.

  • Risk areas: Helper function must use correct chain ID
  • Mitigations or rollback options: Follows proven referrer leaderboard pattern, revertible through previous ENSApi version
  • Named owner if this causes problems: @Goader

Pre-Review Checklist (Blocking)

  • I reviewed every line of this diff and understand it end-to-end
  • I'm prepared to defend this PR line-by-line in review
  • I'm comfortable being the on-call owner for this change
  • Relevant changesets are included (or explicitly not required)

@Goader Goader self-assigned this Jan 7, 2026
@Goader Goader requested a review from a team as a code owner January 7, 2026 00:56
@changeset-bot
Copy link

changeset-bot bot commented Jan 7, 2026

🦋 Changeset detected

Latest commit: d6c42b1

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

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

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

@vercel
Copy link

vercel bot commented Jan 7, 2026

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

Project Deployment Review Updated (UTC)
admin.ensnode.io Ready Ready Preview, Comment Jan 10, 2026 2:30am
ensnode.io Ready Ready Preview, Comment Jan 10, 2026 2:30am
ensrainbow.io Ready Ready Preview, Comment Jan 10, 2026 2:30am

Copy link
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

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

@Goader Thanks for update. Shared a quick comment 👍

responseCode: z.literal(RegistrarActionsResponseCodes.Ok),
registrarActions: z.array(makeNamedRegistrarActionSchema(valueLabel)),
pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`),
Copy link
Member

Choose a reason for hiding this comment

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

@Goader I note how we are using z.strictObject here. As I understand, this will result in a breaking change.

For example, if we don't carefully coordinate this update with a new release of the ENSAwards site, the ENSAwards site will break.

Could you please suggest:

  1. What we should do to ensure we coordinate change management effectively so that we won't break the ENSAwards site for more than a few minutes at most?
    1. Please note how @Y3drk will likely soon start making use of special "snapshot" releases of NPM packages published from the ENSNode repo which are auto-generated from the main branch. Therefore, if we merge this PR as it is now, the ENSAwards client, once building from a "snapshot" release of packages in the ENSNode repo would immediately break, since the ENSApi server it is sending queries to would be out of sync and wouldn't offer this additional field yet.
  2. How we can refine the zod validations so that they will be more generous to future changes. Ex: introducing an additional field should not cause errors and should just be ignored by older client versions.

One quick idea is to:

  1. Make this field optional (so that snapshot releases can immediately be used on ENSAwards, even after this PR is merged)
  2. Change z.strictObject to be more generous to future changes so this is less tricky later.
  3. Create a follow-up issue for after the next release to change this field from optional to required.

Please let me know what you think 👍

Copy link
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

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

@Goader Nice update. Thanks! Just 1 more key suggestion.

* @returns The Unix timestamp of when the data was accurate as of
* @throws Error if the latest indexed block ref for the chain is null
*/
export function getAccurateAsOfTimestamp(
Copy link
Member

Choose a reason for hiding this comment

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

The registrar actions API can be used to return data from different chains and is not constrained only to the chainId for the Ethnames subregistry.

Therefore, suggested actions are:

  1. Remove this utility function.
  2. Update the logic in apps/ensapi/src/handlers/registrar-actions-api.ts so that instead of calling getAccurateAsOfTimestamp to get the value for the accurateAsOf timestamp it uses c.var.indexingStatus.snapshot.slowestChainIndexingCursor
  3. Update the comments for the new accurateAsOf field added in packages/ensnode-sdk/src/api/registrar-actions/response.ts so that it cites the following idea: "Represents the slowestChainIndexingCursor from the latest omnichain indexing status snapshot captured by ENSApi. The state returned in the response is guaranteed to be accurate as of this timestamp but may be from a timestamp higher than this value."

Copy link
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

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

@Goader Thanks for your updates! Looks good 👍

@lightwalker-eth lightwalker-eth merged commit cf1b218 into main Jan 10, 2026
13 checks passed
@lightwalker-eth lightwalker-eth deleted the feat/registrar-actions-accurateasof branch January 10, 2026 11:12
@github-actions github-actions bot mentioned this pull request Jan 9, 2026
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.

Referrer Details: Return accurateAsOf Timestamp

3 participants