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

How to make user defined network config url property optional #3221

Closed
Nathan-SL opened this issue Sep 28, 2022 · 6 comments
Closed

How to make user defined network config url property optional #3221

Nathan-SL opened this issue Sep 28, 2022 · 6 comments
Assignees

Comments

@Nathan-SL
Copy link

We're building a hardhat plugin. How should the plugin be written so that custom networks can omit the url property? Currently, user-defined network configs don't allow omitting the url property and for some special cases, it seems reasonable to have a way to support it as an optional property. Here's the error we get from the validator.

Error HH8: There's one or more errors in your config file:

  * Invalid value undefined for HardhatConfig.networks.networkName.url - Expected a value of type string.
  
    To learn more about Hardhat's configuration, please go to https://hardhat.org/config/

For a config file like below.

const config: HardhatUserConfig = {
    solidity: "0.6.12",
    starknet: {
        dockerizedVersion: "0.9.1",
        network: 'networkName',
    },
    networks: {
        networkName: {
            // url: "http://127.0.0.1:5050",
        }
    }
};
@Nathan-SL Nathan-SL changed the title How to make user defined network configs url property optional How to make user defined network config url property optional Sep 28, 2022
@github-actions
Copy link
Contributor

This issue is also being tracked on Linear.

We use Linear to manage our development process, but we keep the conversations on Github.

LINEAR-ID: 0c6d7400-3e62-4ca4-b055-f80075961d3d

@fvictorio
Copy link
Member

I don't think this is doable right now. Maybe we could move that validation after the config is resolved, and that way you could put some dummy urls with extendConfig. But I would like to understand the problem better:

and for some special cases, it seems reasonable to have a way to support it as an optional property

Can you expand on this?

@Nathan-SL
Copy link
Author

Nathan-SL commented Oct 3, 2022

Yes, If validation happens after config is resolved, providing an empty string inside extendConfig will help us.

Can you expand on this?

On our custom network, integrated-devnet, we intend to enable users to run their programs (by spawning as child processes in different random free ports).

@fvictorio
Copy link
Member

That's very interesting.

@alcuadrado what do you think about moving the url validation after resolution?

@Nathan-SL
Copy link
Author

Any updates?

@fvictorio
Copy link
Member

Hi @Nathan-SL, sorry for not responding before. We decided to go on with that approach. I opened #3323 to track that effort, so I'm going to close this one in favor of that.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants