-
Notifications
You must be signed in to change notification settings - Fork 16
fix(ensindexer): use lazy-loaded config #749
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
Conversation
This change prevents premature exectuion of plugin-specific config factories. Before this change, we could not run ENSIndexer for any `ENS_DEPLOYMENT_CHAIN` except for `mainnet`. With this change, the ENSIndexer will attempt loading plugin-specific configuration for active plugins only. It means all required datasources configuration will be also available during config validation phase so no validation errors should occur anymore.
🦋 Changeset detectedLatest commit: 1f9d3e7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…ther ENS Deployment Chains than `mainnet`.
|
perhaps we can restructure to something more like this: export default {
get config () {
// ...
return createConfig()
}
activate: activateHandlers({ ... });
}so we're exporting a single plugin-shaped object from each plugin file the solution i had in my l2 primary name branch was similar to the previous behavior where we merged the configs export const getENSDeployment = (ensDeploymentChain: keyof typeof ENSDeployments) =>
({
...ENSDeployments.mainnet,
...ENSDeployments[ensDeploymentChain],
}) as ENSDeploymentGlobalType;but i think i prefer your deferred execution approach rather than the hacky merged deployment thing |
Consolidate all plugin members into a default export to make importing plugins more straightforward.
| import basenamesPlugin from "@/plugins/basenames/basenames.plugin"; | ||
| import lineaNamesPlugin from "@/plugins/lineanames/lineanames.plugin"; | ||
| import subgraphPlugin from "@/plugins/subgraph/subgraph.plugin"; | ||
| import threednsPlugin from "@/plugins/threedns/threedns.plugin"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A single object describes the public API of a plugin now. Importing default into named const.
This change prevents premature execution of plugin-specific config factories.
Before this change, running ENSIndexer service with
ENS_DEPLOYMENT_CHAINenv var set to other valid value thanmainnetwould cause application runtime error. The problem was caused due to all plugin config files being unconditionally executed fromponder.config.tsfile. For example, thebasenamesplugin would not find a required datasource loaded whenENS_DEPLOYMENT_CHAINwas set to eithersepolia,holesky, orens-test-env.The fix was to make the plugin config object construction logic lazy-evaluated and only called during plugin activation phase (by when all required datasources must be available).