Skip to content

Move accurateAsOf field into generic response data model / middleware #1512

@lightwalker-eth

Description

@lightwalker-eth

This field won't apply to all categories of API responses. It specifically applies to the categories of "Explore" APIs and "ENSAwards" APIs that are returning indexed data. It doesn't apply to "Meta" APIs or "Resolution" APIs.

Ideally this field could be moved into the generic "success" response data model and handled at a middleware layer on the related APIs.

We also should rename this field. For details, please review the language that was introduced in comments on this PR: #1484

We should probably rename this field to something more like: minIndexingCursor to help people get the mental model right and also to help account for how the indexed data we return may be from timestamps higher than minIndexingCursor, we are just guaranteeing that it includes data at least up to minIndexingCursor.

For example:

  • We know from our indexing status data model already that for example one chain may be a few seconds ahead of another.
  • Another key issue is how there's multiple asynchronous processes at work here. Both indexing, but also generating an indexing status snapshot, persisting that snapshot to the db, and then loading the snapshot from the db into memory in ENSApi. Therefore the snapshot that ENSApi is using to generate this value may be sometime behind the true indexing status.

All of these ideas should be nicely documented.

We also should note how the guarantee that it includes data at least up to minIndexingCursor may temporarily be violated during a chain reorg. ENSNode automatically recovers from chain reorgs, but during one the minIndexingCursor may theoretically be some seconds ahead of the true state of indexed data.

Metadata

Metadata

Assignees

Labels

ensapiENSApi related

Projects

Status

Todo

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions