-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add config validation for empty network and forking url #4096
Add config validation for empty network and forking url #4096
Conversation
🦋 Changeset detectedLatest commit: e5b9101 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
packages/hardhat-core/src/internal/core/config/config-validation.ts
Outdated
Show resolved
Hide resolved
Thank you @kshyun28, this looks good! I just left a minor comment. |
Uhm, thinking about this a bit more, I'm afraid this change will break some existing projects that use an empty string as a placeholder, like this template. This is not your fault, my initial description in the issue was a mistake 😞 Instead of that, I think we should validate the URL here:
(This is used both by normal networks and by the forking feature.) This means adding a new general error here and throwing it there when I'm sorry for asking you to discard what you did so far, but I think doing this when the URL is actually used is the right thing to do here. |
Hello @fvictorio, I understand that if this implementation of the fix would break some existing projects, better not go with this approach. And no worries, it's not really discarding since the issue is moving and allows us to see potential issues. I'll try to reimplement the fixes in the Thanks for the guidance! |
e9b4050
to
e5b9101
Compare
Considering the discussions in the related issue, this PR adds empty string validation such as:
""
" "
for the following configs:
To improve the error message, instead of using the default
invalid
error message, I also added anempty
error message. This can be up for debate since we can just useinvalid
error message which makes the code simpler.This closes #2730
Screenshot of sample config error
