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

[testing] changing default local test-validator address from localhost to 127.0.0.1 #2725

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

ochaloup
Copy link
Contributor

I'm inspired with the change of the solana labs example here solana-labs/example-helloworld#375
From the newer nodejs servers the localhost is resolved to ipv6 ::1 and when I use the AnchorProvider.env() then the ANCHOR_PROVIDER_URL by anchor test is setup to http://localhost:8899.
But the test validator is running on ipv4 as far as I can see.

When I want to use a new instance of Connection that's created with the provider.connection.rpcEndpoint then I'm getting errors like Error: failed to get recent blockhash: TypeError: fetch failed.

Would that be reasonable to change the default local connection url to test validator from localhost to 127.0.0.1?

Copy link

vercel bot commented Dec 11, 2023

@ochaloup is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Collaborator

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

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

I think this is a reasonable change given Node 17 no longer prioritizes IPv4 adresses and made localhost resolution host specific in nodejs/node#39987

Could you add a CHANGELOG entry before we merge?

@ochaloup
Copy link
Contributor Author

@acheroncrypto I changed the changelog. Please, take a look if the text makes sense.

Copy link
Collaborator

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

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

Thanks for updating! Small clarification for the following statement:

NodeJS 17 IP resolution changes for IPv6

My understanding is, this is not entirely correct because they didn't change the resolution to IPv6, they just stopped manually overriding to always prioritize IPv4 so it now depends on how your machine is configured to resolve localhost. If they did override to IPv6, our CI which is on Node v18 would not work with localhost. In any case, this is a small detail so we can merge as is.

@acheroncrypto acheroncrypto merged commit 61244a8 into coral-xyz:master Dec 11, 2023
47 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants