Implement ChainRegistry for dynamic chain contract verification#800
Draft
mirshko wants to merge 4 commits intotempoxyz:mainfrom
Draft
Implement ChainRegistry for dynamic chain contract verification#800mirshko wants to merge 4 commits intotempoxyz:mainfrom
mirshko wants to merge 4 commits intotempoxyz:mainfrom
Conversation
4e1718d to
2b03e46
Compare
Replace non-standard _extra field with traceSupportedRPCs (required by Sourcify spec). Make title optional per spec.
…egistry auth token Add secrets_store_secrets binding for CHAINS_CONFIG_AUTH_TOKEN_SECRET with env var CHAINS_CONFIG_AUTH_TOKEN as fallback. Token is resolved at startup via resolveAuthToken() which checks type: SecretsStoreSecret (.get()) > string > undefined.
2b03e46 to
a85e4a3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a dynamic chain registry to the contract-verification service, allowing it to fetch chain configurations from an external URL at runtime -- expanding which chains can be verified beyond the hardcoded Tempo chains.
What changed
ChainRegistryclass (src/lib/chain-registry.ts) -- fetches chain configs from an optional external URL (CHAINS_CONFIG_URL), validates with Zod against a chainlist.org-compatible schema, and merges with static Tempo chains. Static chains always take precedence and cannot be overridden.chainRegistry()Hono middleware -- initializes the registry per-request and sets it on context asc.get('chainRegistry'). All route files access chains through this instead of module-level imports.hiddenchain support -- chains markedhidden: truein the external config are fully functional for verification and lookup, but excluded fromGET /chainsand filtered fromGET /v2/contract/all-chains/:addressresponses to prevent leaking chain IDs./chainsresponse -- addedtraceSupportedRPCs(required by Sourcify spec), removed non-standard_extrafield, madetitleoptional.SourcifyChaintype is now derived from a Zod schema.CHAINS_CONFIG_AUTH_TOKEN_SECRET(Secrets Store binding, preferred) withCHAINS_CONFIG_AUTH_TOKEN(env var) as fallback. Token resolved at startup viaresolveAuthToken().ChainRegistrycovering: static-only, fetch+merge, hidden filtering, static precedence, auth header, fetch failure fallback, invalid schema rejection, websocket-only filtering, and Sourcify-compliant output shape.New env vars
CHAINS_CONFIG_URLCHAINS_CONFIG_AUTH_TOKEN_SECRETCHAINS_CONFIG_AUTH_TOKENWhen no
CHAINS_CONFIG_URLis set, the service behaves exactly as before -- only static Tempo chains.