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

[ENG-180 | ENG-182] Unsupported ENS networks #2709

Merged
merged 4 commits into from
Feb 4, 2025

Conversation

Da-Colon
Copy link
Contributor

@Da-Colon Da-Colon commented Feb 4, 2025

sorry @DarksightKellar

Closes ENG-180
Closes ENG-182

@adamgall Called out about the fallback to mainnet, but I pushed back only thinking about the argument chainId and protecting against unintentionally setting it to call an unsupported network.

Screenshots

localhost_3000_home_dao=matic%3A0x9Ad33122747aFE4d9AB2b51e048985549c64603a page=1 size=10(Desktop)

Copy link

linear bot commented Feb 4, 2025

Copy link

Deploying decent-interface with  Cloudflare Pages  Cloudflare Pages

Latest commit: f884b6c
Status: ✅  Deploy successful!
Preview URL: https://a6250261.decent-interface.pages.dev
Branch Preview URL: https://eng-180-182-ens-error-unsupp.decent-interface.pages.dev

View logs

@Da-Colon Da-Colon mentioned this pull request Feb 4, 2025
Copy link
Contributor

@mudrila mudrila left a comment

Choose a reason for hiding this comment

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

Looks good overall - though I'm wondering whether it's a best way to organize errors handling and whether returning null / empty string might be better idea

let effectiveChainId: number;
if (props?.chainId !== undefined) {
if (!supportedEnsNetworks.includes(props.chainId)) {
throw new Error(`ENS is not supported for chain ${props.chainId}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

This error throwing inside hook's body makes me little nervous - should we just return "nothing" instead? Or the idea is that components / hooks that are using useNetworkEnsAddress are covering underlying usage with some sort of safety gates?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The error thrown is to alert us. if we use this getENSName inproper case. say we have feature thats pulling info from a third party with a chain id and a address. instead of just defaulting to mainnet silently. this will alert us a problem as it could be unintentional.

That make sense?

let effectiveChainId: number;
if (args.chainId !== undefined) {
if (!supportedEnsNetworks.includes(args.chainId)) {
throw new Error(`ENS is not supported for chain ${args.chainId}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question here


if (props?.chainId !== undefined) {
if (!supportedEnsNetworks.includes(props.chainId)) {
throw new Error(`ENS is not supported for chain ${props.chainId}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

And here

@DarksightKellar
Copy link
Contributor

Need this work. Merging as we have approvals

@DarksightKellar DarksightKellar merged commit d96ba72 into develop Feb 4, 2025
4 checks passed
@DarksightKellar DarksightKellar deleted the eng-180-182-ens-error-unsupported-networks branch February 4, 2025 18:55
@Da-Colon Da-Colon mentioned this pull request Feb 4, 2025
Copy link

sentry-io bot commented Feb 17, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ Error: ENS is not supported for chain 137 //proposals/new View Issue

Did you find this useful? React with a 👍 or 👎

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.

3 participants