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

ignition: port hardhat-ignition-ethers to Hardhat 3 #6290

Merged
merged 20 commits into from
Feb 14, 2025

Conversation

kanej
Copy link
Member

@kanej kanej commented Feb 14, 2025

Migrate hardhat-ignition-ethers to Hardhat 3.

NOTE: hardhat-ignition-ethers does not have typechain support

Preview

import apolloModule from "../../../../example-project/ignition/modules/Apollo.js";
import { createHardhatRuntimeEnvironment } from "@ignored/hardhat-vnext/hre";
import hardhatIgnitionEthersPlugin from "@ignored/hardhat-vnext-ignition-ethers";

const hre = await createHardhatRuntimeEnvironment({
  plugins: [hardhatIgnitionEthersPlugin],
});

const { ignition } = await hre.network.connect();

const { apollo } = await ignition.deploy(apolloModule);

const address = await apollo.getAddress();
const name = await apollo.name();
const status = await apollo.status();

console.log(
  `Deployed rocket with Ignition and Ethers from a Hardhat Script 🚀

  address: ${address}
  name: ${name}
  status: ${status}`,
);

Review Questions

  • Are we happy to add to the Mocha/Ethers template?
  • Supporting import { buildModule } from "@ignored/hardhat-vnext-ignition/modules"; in the Mocha/Ethers template without eslint error required adding @ignored/hardhat-vnext-ignition as a dev dependency

Manual run through

The hardhat-ignition-viem plugin has been added to the Hardhat templates (it will clash if added to the example project). There is also a script to show a deployment and demonstrate the returned types. To run the script:

cd v-next/hardhat/templates/02-mocha-ethers/
pnpm hardhat run ./scripts/deploy-rocket-from-script.ts
# Compiling your Solidity contracts
# Compiled 3 Solidity files with solc 0.8.24 (evm target: shanghai)

# Deployed rocket with Ignition and Ethers from a Hardhat Script 🚀

#   address: 0x5FbDB2315678afecb367f032d93F642f64180aa3
#   name: Saturn V
#   status: lift-off

TODO

  • ESmify the code
  • Format the code based up updated prettier
  • Apply latest eslint rules
  • Add in new plugin structures from HH3
  • Re-enable the tests
  • Add connection.ignition based on Hook system
  • Deal with other plugin check
  • Review HH3 todos
  • Move code to internal
  • Add plugin into the Mocha/Ethers template as a confirmation

Follow up tasks

  • Add typechain support
  • Convert tests to Node Test Runner
  • Remove npm scripts comparison exemption

Copy link

vercel bot commented Feb 14, 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 14, 2025 6:51pm

Copy link

changeset-bot bot commented Feb 14, 2025

⚠️ No Changeset found

Latest commit: 45f388f

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.

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

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package or glob expression "@nomicfoundation/hardhat-ethers-chai-matchers" is specified in the `ignore` option but it is not found in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.
The package "@nomicfoundation/hardhat-chai-matchers" depends on the ignored package "hardhat", but "@nomicfoundation/hardhat-chai-matchers" is not being ignored. Please add "@nomicfoundation/hardhat-chai-matchers" to the `ignore` option.
The package "@nomicfoundation/hardhat-chai-matchers" depends on the ignored package "@nomicfoundation/hardhat-ethers", but "@nomicfoundation/hardhat-chai-matchers" is not being ignored. Please add "@nomicfoundation/hardhat-chai-matchers" to the `ignore` option.
The package "@nomicfoundation/hardhat-chai-matchers" depends on the ignored package "@nomicfoundation/eslint-plugin-hardhat-internal-rules", but "@nomicfoundation/hardhat-chai-matchers" is not being ignored. Please add "@nomicfoundation/hardhat-chai-matchers" to the `ignore` option.
The package "@nomicfoundation/hardhat-chai-matchers" depends on the ignored package "@nomicfoundation/eslint-plugin-slow-imports", but "@nomicfoundation/hardhat-chai-matchers" is not being ignored. Please add "@nomicfoundation/hardhat-chai-matchers" to the `ignore` option.

@github-actions github-actions bot added the status:ready This issue is ready to be worked on label Feb 14, 2025
Copy link
Contributor

hardhat

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

List of dependencies (sorted by size)
209M	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
844K	@ignored/hardhat-vnext-utils
624K	micro-packed
576K	tsx
548K	@sentry/core
544K	fast-equals
492K	@scure/bip39
368K	ethereum-cryptography
348K	@ignored/hardhat-vnext-errors
344K	@sentry/hub
336K	@ignored/edr
320K	enquirer
288K	semver
280K	@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 added 19 commits February 14, 2025 18:35
This is a mechanical move, no other changes are present.
Pull across the same changes as seen in `hardhat-ignition-viem` Ignition
helper.
This is a mechanical application.
This is matching the same patterns as the `hardhat-ignition-viem`
companion plugin.
The interface matches the `EthersIgnitionHelper`. The same impl and
interface distinction as in `hardhat-ignition-viem` has been put in
place.

The interface is available in public, the impl has been moved to
internal.
To support imports at `@ignored/hardhat-vnext-ignition`, ignition was
add to the dev dependencies as well.
Until tests are ported to Node Test Runner.
In `hardhat-ignition-viem` it was identified that we should use the
network config of the connection itself.

This is because network config can be overriden at the point the
connection is created.
@kanej kanej added the v-next A Hardhat v3 development task label Feb 14, 2025
@kanej kanej marked this pull request as ready for review February 14, 2025 18:57
@kanej kanej requested a review from alcuadrado February 14, 2025 18:58
Copy link
Member

@alcuadrado alcuadrado left a comment

Choose a reason for hiding this comment

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

Left some minor comments, but LGTM

@kanej kanej added this pull request to the merge queue Feb 14, 2025
Merged via the queue into v-next with commit 21d99a5 Feb 14, 2025
143 checks passed
@kanej kanej deleted the feat/port-ignition-ethers branch February 14, 2025 19:39
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 v-next A Hardhat v3 development task
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Migrate hardhat-ignition-ethers to Hardhat 3
2 participants