Skip to content
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

Feat/get registry from uris #592

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

mshojaei-txfusion
Copy link
Collaborator

@mshojaei-txfusion mshojaei-txfusion commented Feb 14, 2025

Description

This PR introduces and refactors registry utility functions:

  1. Adds a unified getRegistry utility that:
    • Creates a MergedRegistry containing appropriate registry instances (Github/FileSystem) based on URIs
    • Handles proxy support for canonical Github repositories
    • Properly manages logging for all registry instances
    • Filters out empty URIs and trims whitespace
  2. Introduces PROXY_DEPLOYED_URL constant for standardized proxy endpoint

Backward compatibility

Yes

Related issues

hyperlane-xyz/hyperlane-monorepo#5403

Testing

The changes have been extensively tested through unit tests covering:

  • Registry creation scenarios
  • Proxy support with canonical repository
  • URL validation and error handling
  • Different registry type combinations (Github/FileSystem)
  • Empty URI handling and validation
  • Logger propagation to all registry instances
  • Proper MergedRegistry instantiation for all cases

All functionality maintains compatibility with existing use cases while providing a more streamlined API.

Copy link

changeset-bot bot commented Feb 14, 2025

🦋 Changeset detected

Latest commit: cda809b

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

This PR includes changesets to release 1 package
Name Type
@hyperlane-xyz/registry 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

.filter((uri) => !!uri)
.map((uri, index) => {
const childLogger = registryLogger?.child({ uri, index });
if (isHttpsUrl(uri)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Fyi we are working on a HTTP registry #464, we we probably need a different way of identifying that it is supposed to be a github registry. I personally was in favor of using protocol prefix for that, but i got overruled

const githubUrl = 'https://github.com/hyperlane-xyz/hyperlane-registry';

describe('getRegistry', () => {
it('creates MergedRegistry with FileSystemRegistry for local path', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional Nit: For all these tests, i wonder if its nice to just have a mapping of [urls] => [expectedRegistry] and then just run deep equal or something like that?

'@hyperlane-xyz/registry': minor
---

Add getRegistry and getMergedRegistry functions
Copy link
Contributor

Choose a reason for hiding this comment

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

No longer have getMergedRegistry in here yeah?

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