Skip to content

feat(ponder-metadata): make package generic again #551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tk-o
Copy link
Contributor

@tk-o tk-o commented Apr 10, 2025

This PR abstracts fetching ENSRainbow version away from the ponder-metadata package and moves it into the ENSIndexer application layer.

Preview

ENSRainbow info included in ENSNode response ENSRainbow info not included in ENSNode response
image image

Resolves:

Copy link

changeset-bot bot commented Apr 10, 2025

🦋 Changeset detected

Latest commit: 8277b77

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

This PR includes changesets to release 4 packages
Name Type
@ensnode/ponder-metadata Minor
ensindexer Minor
ensadmin Minor
ensrainbow Minor

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

Copy link

vercel bot commented Apr 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
admin.ensnode.io ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 10, 2025 4:48pm
ensnode.io ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 10, 2025 4:48pm
ensrainbow.io ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 10, 2025 4:48pm

Comment on lines +18 to +20
deps: PonderMetadata.MetadataMiddlewareResponse["deps"] & {
ensRainbow: EnsRainbow.VersionInfo;
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We declare application-level type to specify a generic type coming from the ponder-metadata package.

Comment on lines +94 to +96
if (typeof response.deps.ensRainbow === "undefined") {
throw new Error(`ENSRainbow version not found in the response.`);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Including response validation to detect if ENSRainbow version info is available. If it's not, ENSAdmin would refuse to connect.

Copy link
Member

Choose a reason for hiding this comment

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

@tk-o This isn't a full validation of the data model. I expected we would completely verify each field and value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Logged with #571

Abstract ENSRainbow version away from the package into the app layer.
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.

@tk-o Thanks for updates. Reviewed and shared feedback 👍

"ensadmin": minor
---

Generalize `ponder-metadata` package and let ENSAdmin to ensure ENSRainbow version info is available.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Generalize `ponder-metadata` package and let ENSAdmin to ensure ENSRainbow version info is available.
Generalize `ponder-metadata` package. Add rules to ENSAdmin to ensure ENSRainbow version info is available.

Comment on lines +94 to +96
if (typeof response.deps.ensRainbow === "undefined") {
throw new Error(`ENSRainbow version not found in the response.`);
}
Copy link
Member

Choose a reason for hiding this comment

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

@tk-o This isn't a full validation of the data model. I expected we would completely verify each field and value.

try {
const versionResponse = await client.version();

return {
Copy link
Member

Choose a reason for hiding this comment

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

Flagging how several lines below this we can potentially return junk values if an error is thrown. This doesn't seem right. If we can't query the ENSRainbow version for some reason then it seems we should handle that in a smarter way that helps to build up our state invariants.

State invariants are CRITICAL for us. We need to focus on them much more.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've started working on list of invariants. More details here:

@@ -23,6 +22,9 @@ interface PonderMetadataModule {
version: string;
};

/** Application dependencies info */
DepsInfo: Record<string, unknown>;
Copy link
Member

Choose a reason for hiding this comment

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

Really don't like type definitions like this that use unknown.

I assume a type definition like this is very temporary until we split our /metadata endpoint into separate APIs for /indexing-status and /config?

/config should not be generalized for any Ponder app. It should be 100% specific to ENSIndexer.

Likewise, the ponder-metadata package maybe should be renamed such that it is only for supporting the /indexing-status API.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we assume ponder-metadata only deals with indexing status, then we can delegate the config type definition to ENSIndexer app, so ponder-metadata knows nothing about it and only passes-through the data (& its application-defined type).

Copy link
Contributor Author

@tk-o tk-o left a comment

Choose a reason for hiding this comment

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

Thanks for feedback, @lightwalker-eth 🤝 I'll park this PR until #571 is done.

Comment on lines +94 to +96
if (typeof response.deps.ensRainbow === "undefined") {
throw new Error(`ENSRainbow version not found in the response.`);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Logged with #571

try {
const versionResponse = await client.version();

return {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've started working on list of invariants. More details here:

@@ -23,6 +22,9 @@ interface PonderMetadataModule {
version: string;
};

/** Application dependencies info */
DepsInfo: Record<string, unknown>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we assume ponder-metadata only deals with indexing status, then we can delegate the config type definition to ENSIndexer app, so ponder-metadata knows nothing about it and only passes-through the data (& its application-defined type).

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.

2 participants