Be extremely concise. Sacrifice grammar for concision. Terse responses preferred. No fluff.
This file provides guidance to AI coding assistants when working with code in this repository.
Hyperlane Registry is a TypeScript library that provides configs, artifacts, and schemas for the Hyperlane interchain communication protocol. It serves as a central source of truth for chain metadata, deployment addresses, and warp route configurations used by Hyperlane tooling (Explorer, CLI).
- Make the plan extremely concise. Sacrifice grammar for the sake of concision.
- At the end of each plan, give me a list of unresolved questions to answer, if any.
# Build (runs build.ts script then TypeScript compilation)
pnpm run build
# Lint (checks src/, chains/, and deployments/ directories)
pnpm run lint
pnpm run lint:fix
# Format YAML and other files
pnpm run prettier
# Run unit tests (requires build first)
pnpm run test:unit
# Run a single test file
pnpm run build && mocha --require dotenv/config --config .mocharc.json './test/unit/<filename>.test.ts' --exit
# RPC health checks
pnpm run test:rpc-health-mainnet
pnpm run test:rpc-health-testnet-
chains/: One directory per chain containing:
metadata.yaml- Chain metadata (chainId, RPC URLs, block explorers, native token)addresses.yaml- Deployed contract addresses (mailbox, ISM factories, hooks)logo.svg- Chain logo
-
deployments/warp_routes/: Warp route token configurations organized by token symbol
{chains}-config.yaml- Warp core config for token routes{chains}-deploy.yaml- Deployment config
The library exports multiple registry implementations:
IRegistry- Interface defining all registry operationsBaseRegistry- Abstract base with caching and common logicGithubRegistry- Fetches from GitHub raw URLsFileSystemRegistry(src/fs/) - Local filesystem operationsHttpClientRegistry- Generic HTTP client implementationMergedRegistry- Combines multiple registriesPartialRegistry- Partial implementation wrapper
- Copies
src/totmp/directory - Parses all chain YAML files into JSON and TypeScript exports
- Generates combined
chains/metadata.yamlandchains/addresses.yamlfiles - Parses warp route configs and generates TypeScript exports
- Updates JSON schemas from Zod definitions
- TypeScript compiles from
tmp/todist/
The package exports chain metadata, addresses, and warp route configs in multiple formats:
- Individual chain imports:
@hyperlane-xyz/registry/chains/{chainName} - Combined maps:
chainMetadata,chainAddresses,warpRouteConfigs - Registry classes for programmatic access
- YAML files must have keys sorted alphabetically (enforced by ESLint)
- Warp route IDs follow format:
{SYMBOL}/{label}where label is typically chain names joined by- - The
src/fs/module contains Node.js-specific code and is isolated to prevent bundling issues - No Node.js imports allowed in main
src/files (exceptsrc/fs/) - Pre-commit hooks run prettier and eslint on staged files
@hyperlane-xyz/sdk- Hyperlane SDK types (ChainMetadata, WarpCoreConfig)@hyperlane-xyz/utils- Utility functions and ESLint plugin for YAML sortingzod- Schema validationyaml- YAML parsing/serialization
We handle ONLY the most important cases. Don't add functionality unless it's small or absolutely necessary.
- Expected issues (external systems, user input): Use explicit error handling, try/catch at boundaries
- Unexpected issues (invalid state, broken invariants): Fail loudly with
throworconsole.error - NEVER add silent fallbacks for unexpected issues - they mask bugs
| Change Location | Backwards-Compat? | Rationale |
|---|---|---|
| Local/uncommitted | No | Iteration speed; no external impact |
| In main unreleased | Preferred | Minimize friction for other developers |
| Released | Required | Prevent breaking downstream integrations |
For code review guidelines, see REVIEW.md.
Use inline comments for specific feedback on code changes. Use the GitHub API to post reviews:
gh api repos/{owner}/{repo}/pulls/{pr}/reviews --input - << 'EOF'
{
"event": "COMMENT",
"body": "Overall summary (optional)",
"comments": [
{"path": "file.ts", "line": 42, "body": "Specific issue here"},
{"path": "file.ts", "start_line": 10, "line": 15, "body": "Multi-line comment"}
]
}
EOF| Feedback Type | Where |
|---|---|
| Specific code issue | Inline comment on that line |
| Repeated pattern | Inline on first, mention others in body |
| Architecture concern | Summary body |
Limitation: Can only comment on lines in the diff (changed lines). Comments on unchanged code fail.
- Run tests incrementally -
pnpm run build && mochafor specific test files - Check existing patterns - Search codebase for similar implementations
- YAML keys alphabetical - ESLint enforces sorted keys in YAML files
- Registry is source of truth - Chain metadata, addresses, warp routes all here
- Keep changes minimal - Only modify what's necessary; avoid scope creep
- No Node.js in main src/ - Only
src/fs/can import Node.js modules - Warp ID format - Must be
{SYMBOL}/{label}, e.g.,USDC/ethereum-arbitrum - Address provenance - When adding/changing addresses, note the source (PR, tx hash)
- Deterministic ordering - Sort arrays/maps before processing for consistent output
- Changesets - Include changeset files for version-bumped changes
Always search the codebase before assuming. Don't hallucinate file paths, function names, or patterns.
grepor search before claiming "X doesn't exist"- Read the actual file before suggesting changes to it
- Check
git logor blame before assuming why code exists - Verify imports exist in
package.jsonbefore using them
If output seems wrong, check:
- Did I read the actual file? Or did I assume its contents?
- Did I search for existing patterns? The codebase likely has examples
- Am I using stale context? Re-read files that may have changed
- Did I verify the error message? Run the command and read actual output