Skip to content

Commit 0924595

Browse files
afa7789ericglau
andauthored
Migrate hardhat-upgrades plugin to use hardhat v3 (#1194)
Co-authored-by: Eric Lau <ericglau@outlook.com>
1 parent 59dcd33 commit 0924595

195 files changed

Lines changed: 6349 additions & 3264 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
root: true,
33
parserOptions: {
4-
ecmaVersion: 2020,
4+
ecmaVersion: 2022,
55
},
66
extends: ['eslint:recommended', 'plugin:prettier/recommended'],
77
env: {
@@ -15,7 +15,13 @@ module.exports = {
1515
'unicorn/no-array-reduce': 'warn',
1616
'no-plusplus': ['warn', { allowForLoopAfterthoughts: true }],
1717
},
18-
ignorePatterns: ['submodules'],
18+
ignorePatterns: [
19+
'submodules',
20+
// ESLint 8.x doesn't support ES2025 import attributes syntax
21+
// uses import attributes (import ... with { type: 'json' })
22+
// which is valid ES2025 syntax but ESLint parser doesn't support it yet
23+
'packages/plugin-hardhat/test/*.js',
24+
],
1925
overrides: [
2026
{
2127
files: ['*.ts'],
@@ -29,10 +35,14 @@ module.exports = {
2935
},
3036
},
3137
{
32-
files: ['ava.config.js'],
38+
files: ['ava.config.js', 'packages/plugin-hardhat/test/*.js', 'packages/plugin-hardhat/src/*.js'],
3339
parserOptions: {
40+
ecmaVersion: 'latest',
3441
sourceType: 'module',
3542
},
43+
rules: {
44+
'no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
45+
},
3646
},
3747
{
3848
files: ['packages/plugin-truffle/**'],

.github/actions/setup/action.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,19 @@ runs:
55
steps:
66
- uses: actions/setup-node@v4
77
with:
8-
node-version: 20.x
8+
node-version: 22.x
99
cache: yarn
1010

11+
- name: Cache Hardhat solc compilers
12+
uses: actions/cache@v4
13+
with:
14+
path: |
15+
~/.cache/hardhat/compilers-v3
16+
~/.cache/hardhat-nodejs/compilers-v3
17+
key: hardhat-compilers-${{ runner.os }}-${{ hashFiles('**/package.json', '**/yarn.lock') }}
18+
restore-keys: |
19+
hardhat-compilers-${{ runner.os }}-
20+
1121
- name: Install dependencies
1222
run: yarn --frozen-lockfile --prefer-offline
1323
shell: bash

.github/workflows/changeset.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
2323
with:
2424
fetch-depth: 0 # Include history so Changesets finds merge-base
25+
submodules: recursive
2526
- name: Set up environment
2627
uses: ./.github/actions/setup
2728
- name: Check changeset

.github/workflows/checks.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717

1818
steps:
1919
- uses: actions/checkout@v4
20+
with:
21+
submodules: recursive
2022

2123
- name: Set up environment
2224
uses: ./.github/actions/setup
@@ -35,10 +37,16 @@ jobs:
3537

3638
steps:
3739
- uses: actions/checkout@v4
40+
with:
41+
submodules: recursive
3842

3943
- name: Set up environment
4044
uses: ./.github/actions/setup
4145

46+
- name: Assert upgrades-core resolution (plugin-hardhat)
47+
if: matrix.package == 'plugin-hardhat'
48+
run: bash packages/plugin-hardhat/scripts/assert-upgrades-core-resolution.sh
49+
4250
- name: Run tests
4351
run: yarn --cwd "packages/${{matrix.package}}" run test
4452

@@ -47,10 +55,15 @@ jobs:
4755

4856
steps:
4957
- uses: actions/checkout@v4
58+
with:
59+
submodules: recursive
5060

5161
- name: Set up environment
5262
uses: ./.github/actions/setup
5363

64+
- name: Assert upgrades-core resolution
65+
run: bash packages/plugin-hardhat/scripts/assert-upgrades-core-resolution.sh
66+
5467
- name: Run coverage
5568
run: yarn coverage
5669

@@ -114,4 +127,4 @@ jobs:
114127
if: steps.create_pull_request.outcome == 'failure'
115128
run: |
116129
git push origin --delete $BRANCH_NAME
117-
130+

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
with:
1919
fetch-depth: 0 # To get all tags
2020
ref: ${{ github.ref }}
21+
submodules: recursive
2122
- name: Set up environment
2223
uses: ./.github/actions/setup
2324
- name: Create Prepare Release PR or Publish

.github/workflows/version.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
with:
2222
fetch-depth: 0 # To get all tags
2323
ref: ${{ github.ref }}
24+
submodules: recursive
2425
- name: Set up environment
2526
uses: ./.github/actions/setup
2627
- name: Create Prepare Release PR

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20
1+
22

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
[![Checks](https://github.com/OpenZeppelin/openzeppelin-upgrades/actions/workflows/checks.yml/badge.svg)](https://github.com/OpenZeppelin/openzeppelin-upgrades/actions/workflows/checks.yml)
66
[![License](https://img.shields.io/github/license/OpenZeppelin/openzeppelin-upgrades)](https://github.com/OpenZeppelin/openzeppelin-upgrades/blob/master/LICENSE)
77

8+
> [!NOTE]
9+
> This branch contains support for Hardhat 3. This version is still in testing. Do not use it to deploy or upgrade production deployments. For details and migration instructions, see:
10+
> - [Hardhat Upgrades for Hardhat 3](./packages/plugin-hardhat/README.md)
11+
> - [Hardhat 2 to 3 migration guide](./packages/plugin-hardhat/MIGRATION.md)
12+
813
**Integrate upgrades into your existing workflow.** Plugins for [Hardhat](https://hardhat.org/) and [Foundry](https://book.getfoundry.sh/) to deploy and manage upgradeable contracts on Ethereum.
914

1015
- Deploy upgradeable contracts.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"eslint-config-prettier": "^9.0.0",
2323
"eslint-plugin-prettier": "^5.0.0",
2424
"eslint-plugin-unicorn": "^51.0.0",
25-
"ethers": "^6.8.1",
25+
"ethers": "^6.14.0",
2626
"nyc": "^17.0.0",
2727
"prettier": "^3.0.0",
2828
"typescript": "^5.0.0",

packages/core/CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
# Changelog
22

3+
## 1.45.0-alpha.1 (2026-03-02)
4+
5+
- Improve support for validating build-info files in CLI for Hardhat 3, Hardhat 2, and Foundry. ([#1194](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/1194))
6+
7+
> **Note** ⚠️ This version is still in testing and should not be used in production.
8+
39
## 1.45.0-alpha.0 (2026-01-20)
410

511
- Support Hardhat 3 build-info file format for CLI validation ([#1203](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/1203))
612

713
> **Note** ⚠️ This version is still in testing and should not be used in production.
814
9-
1015
## 1.44.2 (2025-11-03)
1116

1217
- Add Celo Sepolia network to manifest file names. ([#1189](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/1189))

0 commit comments

Comments
 (0)