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

Validation on duplicate module ids in visualization #608

Closed
kanej opened this issue Oct 30, 2023 · 0 comments · Fixed by #622
Closed

Validation on duplicate module ids in visualization #608

kanej opened this issue Oct 30, 2023 · 0 comments · Fixed by #622
Assignees
Labels
status:ready This issue is ready to be worked on

Comments

@kanej
Copy link
Member

kanej commented Oct 30, 2023

@maguroid reported an issue where visualization failed when running against this module:

https://github.com/maguroid/hardhat-ignition-demo/blob/factory-pattern/ignition/modules/Vault.ts

It appears to reduce down to:

import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
import VaultFactory from "./VaultFactory";

import hre from "hardhat";

const hex3 = hre.ethers.toBeHex(3, 20);

const VaultFactory = buildModule("Vault", (m) => {
  const vaultFactory = m.contract("VaultFactory");

  return {
    vaultFactory,
  };
});

const UniswapV3Swapper = buildModule("UniswapV3Swapper2", (m) => {
  const uniswapV3Swapper = m.contract("UniswapV3Swapper", [hex3]);

  return {
    uniswapV3Swapper,
  };
});

// * NOTES: deployment with factory currently not working as expected.
// *        deployed address not stored in json file, and visualization throws error
export default buildModule("Vault", (m) => {
  const { vaultFactory } = m.useModule(VaultFactory);
  const { uniswapV3Swapper } = m.useModule(UniswapV3Swapper);

  return {
    vaultFactory,
    uniswapV3Swapper,
  };
});

I suspect this is the reuse of the module id. Where the top level module has id Vault but so does one of its submodules.

We should add buildModule validation to cover this case.

@kanej kanej changed the title Validation on duplice module ids in visualization Validation on duplicate module ids in visualization Oct 30, 2023
@kanej kanej added status:ready This issue is ready to be worked on and removed status:triaging labels Oct 31, 2023
@kanej kanej added this to the v0.12.0 Release milestone Oct 31, 2023
@zoeyTM zoeyTM self-assigned this Oct 31, 2023
@kanej kanej mentioned this issue Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready This issue is ready to be worked on
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants