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

migrate ignition-core to Hardhat 3 #6195

Open
wants to merge 37 commits into
base: v-next
Choose a base branch
from
Open

Conversation

kanej
Copy link
Member

@kanej kanej commented Jan 27, 2025

Migrate @nomicfoundation/ignition-core to Hardhat 3.

We move all of Ignition's packages under ./packages to a ./tmp-ignition folder, taking Ignition out of the build. We then bring ignition-core under v-next, make it support ESM and wire it into the Hardhat 3 setup more generally.

Resolves #6207.

Approach

  1. Move the ignition-core files under ./v-next
  2. Update the code to match updated prettier and eslint rules
  3. Re-enable API extractor checks as part of linting
  4. Switch to ESM for the package
    1. Change any code patterns that are implied by this (e.g. switching to dynamic imports)
    2. Update or swap dependencies to work with ESM
  5. Update unit tests (pnpm run test) until all are passing (retaining mocha for the moment)
  6. Update Integration tests (pnpm run test:integrations) until all are passing (retaining mocha for the moment)

TODO

  • Move ignition-core to v-next folder with working build (but not tests)
  • Update prettier and apply formatting
  • Update to typescript 5.5
  • Update the API extractor
  • Use defineProperty for inspect pattern while support isolated declarations
  • Update eslint packages and rules, apply fixes
    • Some rules are disabled
  • Fix up mocha unit tests
  • Disable integration tests (we will revisit in a follow up PR)
  • Switch to ESM
    • Update __dirname usage
    • Replace fs in utils with hardhat-utils
    • Replace dynamic requires with dynamic imports
    • Replace cbor with cbor2
  • Rename package to v-next convention

Follow up tasks

  • Port Ignition Errors to Hardhat 3
  • Re-enable integration tests (deal with Hardhat project fixtures)
  • Update codebase so no eslint rules are disabled
  • Port lodash calls to hardhat-utils
  • Port address related calls to hardhat-utils
  • Port ethers calls to hardhat-utils
  • Update imports of ./src/index.js to be more specific (we should avoid relying on
    index.js files)
  • Re-enable npm scripts comparison check in CI (we need to wait until Node Test Runner move is complete).
  • Look again at chai and chai types versions, I tried bumping up the version to match Ignition and ended up moving it down to match hardhat-chai-matchers

Copy link

changeset-bot bot commented Jan 27, 2025

⚠️ No Changeset found

Latest commit: 5b743e2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jan 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hardhat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 3, 2025 1:52pm

@github-actions github-actions bot added the status:ready This issue is ready to be worked on label Jan 27, 2025
@kanej kanej added the no changeset needed This PR doesn't require a changeset label Jan 27, 2025
@kanej kanej self-assigned this Jan 27, 2025
@kanej kanej changed the title chore: move ignition packages into temp folder investigation: Ignition upgrade to Hardhat 3 Jan 27, 2025
@kanej kanej force-pushed the feat/port-ignition-hardhat-3 branch from 4f3cf66 to 8925350 Compare January 27, 2025 09:38
Copy link
Contributor

github-actions bot commented Jan 27, 2025

hardhat

Total size of the bundle: 213M
Total number of dependencies (including transitive): 54

List of dependencies (sorted by size)
208M	total
29M	@ignored/edr-optimism-linux-x64-musl
29M	@ignored/edr-optimism-linux-x64-gnu
26M	@ignored/edr-optimism-linux-arm64-musl
26M	@ignored/edr-optimism-linux-arm64-gnu
22M	@ignored/edr-optimism-win32-x64-msvc
20M	esbuild
20M	@ignored/edr-optimism-darwin-x64
19M	@ignored/edr-optimism-darwin-arm64
2.8M	@sentry/tracing
2.5M	micro-eth-signer
1.9M	@noble/curves
1.7M	undici
1.2M	@sentry/types
1.2M	@noble/hashes
932K	@sentry/node
920K	@sentry/utils
856K	zod
832K	@ignored/hardhat-vnext-utils
624K	micro-packed
576K	tsx
548K	@sentry/core
544K	fast-equals
492K	@scure/bip39
460K	@ignored/edr
368K	ethereum-cryptography
344K	@sentry/hub
324K	@ignored/hardhat-vnext-errors
320K	enquirer
288K	semver
264K	@ignored/edr-optimism
192K	ws
168K	@scure/base
136K	get-tsconfig
136K	adm-zip
96K	@scure/bip32
92K	chalk
88K	tslib
88K	@sentry/minimal
76K	agent-base
72K	@nomicfoundation/solidity-analyzer
68K	debug
64K	lru_map
64K	https-proxy-agent
60K	@ignored/hardhat-vnext-zod-utils
56K	rfdc
48K	ansi-colors
44K	resolve.exports
40K	resolve-pkg-maps
36K	p-map
32K	cookie
24K	strip-ansi
24K	env-paths
24K	ansi-regex
20K	ms

@kanej kanej force-pushed the feat/port-ignition-hardhat-3 branch from 8925350 to 58fe088 Compare January 27, 2025 09:43
@kanej kanej force-pushed the feat/port-ignition-hardhat-3 branch from 58fe088 to 1a56ee6 Compare January 27, 2025 09:46
@kanej kanej force-pushed the feat/port-ignition-hardhat-3 branch from fd66b53 to b27f434 Compare January 27, 2025 16:55
@kanej kanej force-pushed the feat/port-ignition-hardhat-3 branch from b27f434 to daf6d18 Compare January 27, 2025 17:13
@kanej kanej force-pushed the feat/port-ignition-hardhat-3 branch from 77627fe to fcac323 Compare January 29, 2025 13:39
@kanej kanej force-pushed the feat/port-ignition-hardhat-3 branch from fcac323 to ecdd3f8 Compare January 29, 2025 14:01
@kanej kanej force-pushed the feat/port-ignition-hardhat-3 branch from ecdd3f8 to 67b1746 Compare January 29, 2025 14:12
@alcuadrado alcuadrado added the v-next A Hardhat v3 development task label Jan 29, 2025
@kanej kanej force-pushed the feat/port-ignition-hardhat-3 branch from 67b1746 to 9191620 Compare January 31, 2025 10:22
kanej added 14 commits February 3, 2025 13:40
We will bring these back when we have Hardhat 3 as a proper dependency.
Remove the dep on fs-extra to avoid trying to figure out how to ESM the
usage.
This is to avoid asyncing every function.
Add a format property to mimic the Hardhat version. This allows us to
not rely directly on the Hardhat artifact type from `core`.
We were pulling in Artifact for testing, and HRE for testing.

I have left a todo to rewire HRE setup to a proper type.
We work around asyncing up the chain by directly importing the specific
function.
We don't actually have access to HRE. We will bring it back later.
We are holding on pulling in the hardhat-utils version for the moment.
`cbor` is deprecated and commonjs.
The readFile changes to util changed the error returned. An assertion
(flow control throw exceptions booooo) guard had to be changed to match
the new error found.
@kanej kanej force-pushed the feat/port-ignition-hardhat-3 branch from cc9a9e8 to e68811e Compare February 3, 2025 13:41
kanej added 9 commits February 3, 2025 13:42
This should be temporary. To run mocha with the latest tsconfig, we
override the tsconfig rules via an env variable. For this to work with
windows we are using `cross-env`.

This should be removed when we port to Node Test Runner.
Bring all `v-next` packages into line on the latest `ethers`.
Bring all v-next packages into line on ^4.1.7 for `@types/debug`.
This brings all the `v-next` packages on to the latest.
Bring the `v-next` version inline with Ignition.
This involved moving the Ignition version down.
Hardhat was referring to the Hardhat 2 package. We are using new eslint
rules.
We will add it back in with the port to Node Test Runner for tests.
@kanej kanej marked this pull request as ready for review February 3, 2025 13:58
@kanej kanej requested a review from alcuadrado February 3, 2025 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changeset needed This PR doesn't require a changeset status:ready This issue is ready to be worked on v-next A Hardhat v3 development task
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Migrate ignition-core to v-next
2 participants