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

Random port on integrated devnet #202

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

Nathan-SL
Copy link
Contributor

@Nathan-SL Nathan-SL commented Aug 29, 2022

Usage related changes

Development related changes

  • NA

Checklist:

  • Formatted the code
  • No linter errors + tried to avoid introducing linter warnings
  • Performed a self-review of the code
  • Rebased to the last commit of the target branch (or merged it into my branch)
  • Documented the changes
  • Updated the test directory (with a test case consisting of network.json, hardhat.config.ts, check.sh)
  • Linked issues which this PR resolves
  • Created a PR to the plugin branch of starknet-hardhat-example:
    • < EXAMPLE_REPO_PR_URL >
    • Modified test.sh to use my example repo branch
    • Restored test.sh to to use the original branch (after the example repo PR has been merged)
  • All tests are passing (for external contributors who don't have access to the CI/CD pipeline)

@Nathan-SL Nathan-SL requested a review from FabijanC September 22, 2022 10:46
Copy link
Collaborator

@FabijanC FabijanC left a comment

Choose a reason for hiding this comment

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

Should we update any of the tests for this?

@@ -18,6 +18,7 @@ export class DockerDevnet extends DockerServer {
}

protected async getContainerArgs(): Promise<string[]> {
return this.devnetArgs || [];
const containerArgs = this.devnetArgs || [];
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens if the user provided --port in args in hardhat config?

hre.config.networks.integratedDevnet.url = networkUrl;
const { hostname, port } = new URL(hre.config.starknet.networkUrl);
const isPortFree = await isFreePort(parseInt(port));
if (!isPortFree) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this check? Couldn't it surprise the user if we just silently change the specified port. If the port is occupied, integrated-devnet spawner will inform the user about that, right?

My understanding was that we should find a free port only if the user didn't provide a URL? Now I'm actually thinking, is it even possible for the user to omit the URL? Can the type extensions file be modified to allow that?

@FabijanC FabijanC changed the base branch from release-0.7.0 to master September 28, 2022 09:25
@FabijanC FabijanC changed the base branch from master to release-0.7.0 September 28, 2022 09:25
@FabijanC FabijanC changed the base branch from release-0.7.0 to master September 28, 2022 09:25
@FabijanC
Copy link
Collaborator

As already discussed, this doesn't have to be a part of release-0.7.0 if we keep URL as a config option.

Currently waiting for response from hardhat: NomicFoundation/hardhat#3221

@Nathan-SL
Copy link
Contributor Author

New issue to followup on hardhat that could resolve this. NomicFoundation/hardhat#3323

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.

Use random free port for integrated-devnet
2 participants