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

Normalize labelhash for ENSRainbow Heal request #347

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

Conversation

djstrong
Copy link
Contributor

@djstrong djstrong commented Mar 6, 2025

@djstrong djstrong added the ensrainbow ENSRainbow related label Mar 6, 2025
@djstrong djstrong self-assigned this Mar 6, 2025
@djstrong djstrong requested a review from a team as a code owner March 6, 2025 17:18
@djstrong djstrong linked an issue Mar 6, 2025 that may be closed by this pull request
Copy link

vercel bot commented Mar 6, 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 Mar 10, 2025 2:01pm
ensadmin-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 10, 2025 2:01pm
ensnode.io ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 10, 2025 2:01pm
ensrainbow.io ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 10, 2025 2:01pm

).rejects.toThrow("Invalid labelhash length 65 characters (expected 66)");
labelByHash("0x0ca5d0b4ef1129e04bfe7d35ac9def2f4f91daeb202cbe6e613f1dd17b2da0"),
).rejects.toThrow(
'Error healing labelhash: "0x0ca5d0b4ef1129e04bfe7d35ac9def2f4f91daeb202cbe6e613f1dd17b2da0". Error (400): Invalid labelhash length: expected 32 bytes (64 hex chars), got 31 bytes: 0x0ca5d0b4ef1129e04bfe7d35ac9def2f4f91daeb202cbe6e613f1dd17b2da0.',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should we make these errors non redundant?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry I don't understand the question. Please share more details.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

E.g. labelhash is written twice in this error. I think it should be just:
Error (400): Invalid labelhash length: expected 32 bytes (64 hex chars), got 31 bytes: 0x0ca5d0b4ef1129e04bfe7d35ac9def2f4f91daeb202cbe6e613f1dd17b2da0.

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.

@djstrong Thanks for updates 👍 Reviewed and shared feedback


export namespace EnsRainbow {
export type ApiClientOptions = EnsRainbowApiClientOptions;

export interface ApiClient {
count(): Promise<CountResponse>;

heal(labelhash: Labelhash): Promise<HealResponse>;
heal(labelhash: Labelhash | string): Promise<HealResponse>;
Copy link
Member

Choose a reason for hiding this comment

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

Please define a type for EncodedLabelhash

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 have created it for parseEncodedLabelhash but string needs to stay here because we accept unnormalized labelhashes.

).rejects.toThrow("Invalid labelhash length 65 characters (expected 66)");
labelByHash("0x0ca5d0b4ef1129e04bfe7d35ac9def2f4f91daeb202cbe6e613f1dd17b2da0"),
).rejects.toThrow(
'Error healing labelhash: "0x0ca5d0b4ef1129e04bfe7d35ac9def2f4f91daeb202cbe6e613f1dd17b2da0". Error (400): Invalid labelhash length: expected 32 bytes (64 hex chars), got 31 bytes: 0x0ca5d0b4ef1129e04bfe7d35ac9def2f4f91daeb202cbe6e613f1dd17b2da0.',
Copy link
Member

Choose a reason for hiding this comment

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

Sorry I don't understand the question. Please share more details.


export namespace EnsRainbow {
export type ApiClientOptions = EnsRainbowApiClientOptions;

export interface ApiClient {
count(): Promise<CountResponse>;

heal(labelhash: Labelhash): Promise<HealResponse>;
heal(labelhash: Labelhash | EncodedLabelhash | string): Promise<HealResponse>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or this should be just labelhash: string?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ensrainbow ENSRainbow related
Projects
Status: Ready for Review
Development

Successfully merging this pull request may close these issues.

Normalize labelhash for ENSRainbow Heal request
2 participants