Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
df6b7ff
wip
Amxx Jan 14, 2026
feec869
new hook
Amxx Jan 22, 2026
7eaa9d6
It works! implemented exposed by rewritting context.solidity.build
Amxx Jan 23, 2026
a115cfe
move the solidity path push to the config hook
Amxx Jan 23, 2026
8c1f55c
test migration
Amxx Jan 27, 2026
a03c738
test network env
Amxx Jan 27, 2026
319dd41
update package.json scripts
Amxx Jan 27, 2026
75ed0fa
plugin update
Amxx Jan 28, 2026
8c53c5d
fix package logic
Amxx Jan 28, 2026
85bd93b
remove old unused file
Amxx Jan 28, 2026
52fc608
migrate generation logic
Amxx Jan 28, 2026
d6e4477
migrate inheritance-ordering and pragma check/minimize check
Amxx Jan 28, 2026
4f4c783
Merge branch 'master' into hardhat3
Amxx Jan 28, 2026
825a203
remove supperfluous test that doesn't run in hh3
Amxx Jan 28, 2026
2f62a2c
Merge remote-tracking branch 'amxx/hardhat3' into hardhat3
Amxx Jan 28, 2026
3b840e6
update patch
frangio Jan 30, 2026
561a427
update transpile.sh
frangio Jan 30, 2026
4f8812b
remove npmPackage name for internal plugins
Amxx Jan 30, 2026
eadb1bd
fix hardhat error for local plugins
frangio Jan 30, 2026
033bced
use .ts imports
frangio Jan 30, 2026
9e6dfd7
add --paths to transpiler
frangio Jan 30, 2026
75ce57f
fix heredoc
frangio Jan 30, 2026
6173cb9
add project prefix
frangio Jan 30, 2026
1f582f7
Merge branch 'hardhat3' into hardhat3-transpiler
frangio Jan 30, 2026
64f435a
Merge pull request #18 from frangio/hardhat3-transpiler
Amxx Jan 30, 2026
09b2af1
Hardhat transpile action
Amxx Jan 30, 2026
3c2ecd3
Use a JSON file for transpiler settings
Amxx Jan 31, 2026
0471363
hardhat 3.1.6 + use build hook for exposed
Amxx Feb 2, 2026
de13540
Refactor transpile
Amxx Feb 2, 2026
66d21a9
add flag for noExpose
Amxx Feb 2, 2026
b7d7c71
disable noExpose flag that was breaking tests
Amxx Feb 2, 2026
713cc11
migrate new test
Amxx Feb 2, 2026
5be3970
testing of upgradeable contracts
Amxx Feb 3, 2026
0308965
refactor expose include filter
Amxx Feb 3, 2026
13d8d4b
migrate task-test-get-files.js to skip test
Amxx Feb 3, 2026
252388e
Merge branch 'master' into hardhat3
Amxx Feb 3, 2026
eb7e57d
use hardhat-ignore-warnings 0.3.0
Amxx Feb 4, 2026
10ab3c2
redesign exposed plugin: closer to original version + support imports…
Amxx Feb 4, 2026
fffa3e8
update hardhat-predeploy
Amxx Feb 4, 2026
008e9a0
add exposed spinner
Amxx Feb 4, 2026
119a16f
anvil free testing thanks to eth_getProof support
Amxx Feb 6, 2026
34725db
fix account testing issue
Amxx Feb 17, 2026
3fd9f6e
disable foundry tests in favor of hardhat solidity testing
Amxx Feb 20, 2026
ad40b76
update hardhat3 to fix eip7212 testing in solidity
Amxx Feb 20, 2026
a618058
remove dependency on default.allow_internal_expect_revert because har…
Amxx Feb 20, 2026
2ae2edd
fix solhint
Amxx Feb 20, 2026
499e5c2
Merge branch 'master' into hardhat3
Amxx Feb 26, 2026
bfea5cc
add changeset
Amxx Feb 26, 2026
ce3943b
codespell
Amxx Feb 26, 2026
d4648cc
fetch submodules
Amxx Feb 26, 2026
37e96ff
install forge when running halmos
Amxx Feb 26, 2026
b9ffcbb
migrate new tests
Amxx Feb 26, 2026
331ef29
up
Amxx Feb 26, 2026
0078040
Merge branch 'master' into hardhat3
Amxx Mar 6, 2026
d952f94
update hardhat
Amxx Apr 10, 2026
c95eaa9
hardhat now supports forge-config & hardhat-config overrides
Amxx Apr 10, 2026
f9c3d33
generate gas report
Amxx Apr 10, 2026
28f0b80
update gas comparaison script
Amxx Apr 10, 2026
71a622c
Merge branch 'master' into hardhat3
Amxx Apr 22, 2026
e7abecd
use hardhat 3.4.0 and network.create()
Amxx Apr 22, 2026
58a567f
Merge upstream/master into amxx/hardhat3
kanej May 5, 2026
96002f7
Merge branch 'master' into hardhat3
Amxx May 6, 2026
f6acf10
Merge remote-tracking branch 'amxx/hardhat3' into hardhat3
Amxx May 6, 2026
f76b4ff
Optimize the `hre.artifacts.readArtifact` overload
alcuadrado Apr 21, 2026
1c3fcfb
refactor: leverage extracted variable
kanej May 5, 2026
5ca9127
refactor: switch from loop to functional pattern
kanej May 5, 2026
a6cce3e
Revamp `hardhat-exposed`.
alcuadrado Apr 21, 2026
2aa835b
TS cleanup
alcuadrado Apr 23, 2026
452b09c
refactor: apply expression based approach
kanej May 6, 2026
5575911
Update hardhat/hardhat-exposed/tasks/build.ts
kanej May 6, 2026
2bc24b9
refactor: guard for type system
kanej May 6, 2026
7bfa7bf
refactor: apply functional style
kanej May 6, 2026
a3df447
Merge pull request #20 from NomicFoundation/optimize-hardhat-oz-contr…
Amxx May 6, 2026
46dacbf
Merge branch 'hardhat3' of https://github.com/Amxx/openzeppelin-contr…
Amxx May 6, 2026
67b8436
simply typescript types
Amxx May 6, 2026
593e23e
chore: update to hardhat 3.4.4
kanej Apr 23, 2026
2089f5f
chore: tweak gas comparison CI step
kanej Apr 23, 2026
f223159
chore: update compare layout and extract layout scripts to ESM
kanej Apr 27, 2026
0b1191e
fix: deal with deployment null in gas comparison script
kanej Apr 23, 2026
3cc085f
chore: don't compare on previous json files if none present
kanej Apr 27, 2026
7e6ea2e
fix(transpile): scope transpiler input to the main contracts tree
kanej Apr 24, 2026
bb179c1
fix(transpile): delete peer copies of already-initializable files
kanej Apr 24, 2026
95ed1e2
chore: exclude mocks/tests/entire peer dep from linearization check
kanej Apr 27, 2026
1a9aa13
fix(tests): use @openzeppelin/contracts/… imports in .t.sol files
kanej Apr 24, 2026
3a11b3d
Merge branch 'master' into hardhat3
Amxx May 19, 2026
5665c2f
Merge branch 'hardhat3' into update-hardhat-exposed
Amxx May 19, 2026
d6afa0e
test migration for Create3
Amxx May 19, 2026
c35db48
Fix transpilation script. Missing cleanup
Amxx May 19, 2026
d819a26
Merge branch 'hardhat3' into update-hardhat-exposed
Amxx May 19, 2026
555c172
Merge pull request #21 from NomicFoundation/update-hardhat-exposed
Amxx May 19, 2026
839bceb
Update action.yml
Amxx May 19, 2026
967deec
Update action.yml
Amxx May 19, 2026
d75faac
skip exposed contracts from coverage
Amxx May 19, 2026
2b37b94
Merge branch 'small-ci-changes' of https://github.com/NomicFoundation…
Amxx May 19, 2026
a53631b
script naming consistency
Amxx May 19, 2026
765719e
Merge pull request #22 from NomicFoundation/small-ci-changes
Amxx May 20, 2026
a96ae51
refactor transpile.ts
Amxx May 20, 2026
f72b6b4
Merge pull request #23 from NomicFoundation/fixes_for_transpile
Amxx May 20, 2026
df1e340
test: bump gas usage to allow coverage run
kanej May 4, 2026
e945300
chore: bump Hardhat version to 3.5
kanej May 20, 2026
0d3ae5a
Apply suggestion from @Amxx
Amxx May 20, 2026
e2a37c6
Merge pull request #24 from NomicFoundation/chore/fix-failing-coverag…
Amxx May 20, 2026
02db468
fix test
Amxx May 21, 2026
1388c35
Update inheritance-ordering.js
Amxx May 21, 2026
0d25b23
update
Amxx May 21, 2026
da05630
revert unecessary changes to solidity tests
Amxx May 21, 2026
d08d2c5
Apply suggestion from @Amxx
Amxx May 21, 2026
cbf2c99
more updates / cleanup
Amxx May 21, 2026
330f381
get file patterns from package.json
Amxx May 21, 2026
402ab1b
more tests rewrite
Amxx May 21, 2026
db1ee9c
Update compare-gas-reports.js
Amxx May 21, 2026
fe1f223
Update TimelockController.test.js
Amxx May 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/spotty-teeth-show.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---

Migrate test suite and helpers to Hardhat 3
1 change: 1 addition & 0 deletions .codecov.yml

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Note: the current coverage system does not consider this file :/

Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ ignore:
- "test"
- "contracts/mocks"
- "contracts/vendor"
- "contracts-exposed"
5 changes: 2 additions & 3 deletions .github/actions/gas-compare/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ runs:
GITHUB_TOKEN: ${{ inputs.token }}
shell: bash
continue-on-error: true
id: reference
- name: Compare reports
if: steps.reference.outcome == 'success' && github.event_name == 'pull_request'
if: github.event_name == 'pull_request' && hashFiles(inputs.ref_report) != ''
run: |
node scripts/checks/compareGasReports.js ${{ inputs.report }} ${{ inputs.ref_report }} >> $GITHUB_STEP_SUMMARY
node scripts/checks/compare-gas-reports.js ${{ inputs.report }} ${{ inputs.ref_report }} >> $GITHUB_STEP_SUMMARY
env:
STYLE: markdown
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
foundry:
description: Whether to set up Foundry
required: false
default: 'on' # 'off' | 'on' | <specific version>
default: 'off' # 'off' | 'on' | <specific version>
java:
description: Whether to set up Java
required: false
Expand Down
3 changes: 1 addition & 2 deletions .github/actions/storage-layout/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ runs:
GITHUB_TOKEN: ${{ inputs.token }}
shell: bash
continue-on-error: true
id: reference
- name: Compare layouts
if: steps.reference.outcome == 'success' && github.event_name == 'pull_request'
if: github.event_name == 'pull_request' && hashFiles(inputs.ref_layout) != ''
run: |
node scripts/checks/compare-layout.js --head ${{ inputs.layout }} --ref ${{ inputs.ref_layout }}
shell: bash
Expand Down
23 changes: 12 additions & 11 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@ jobs:
GAS: true
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up environment
uses: ./.github/actions/setup
with:
foundry: 'on' # needed by npm run test:pragma
- name: Run tests and generate gas report
run: npm run test
run: npm run test -- --gas-stats-json gasReport.json
- name: Check linearisation of the inheritance graph
run: npm run test:inheritance
- name: Check pragma validity
Expand All @@ -49,6 +53,7 @@ jobs:
uses: ./.github/actions/gas-compare
with:
token: ${{ github.token }}
report: gasReport.json

tests-upgradeable:
runs-on: ubuntu-latest
Expand All @@ -57,9 +62,12 @@ jobs:
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0 # Include history so patch conflicts are resolved automatically
- name: Set up environment
uses: ./.github/actions/setup
with:
foundry: 'on' # needed by npm run test:pragma
- name: Copy non-upgradeable contracts as dependency
run: |
mkdir -p lib/openzeppelin-contracts
Expand All @@ -78,21 +86,12 @@ jobs:
with:
token: ${{ github.token }}

tests-foundry:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up environment
uses: ./.github/actions/setup
- name: Run tests
run: forge test -vvv

coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up environment
uses: ./.github/actions/setup
- name: Run coverage
Expand All @@ -105,6 +104,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up environment
uses: ./.github/actions/setup
- name: Compile harnesses
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/formal-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
- name: Set up environment
uses: ./.github/actions/setup
with:
foundry: 'on'
python: 'on'
python-requirements: 'fv-requirements.txt'
- name: Run Halmos
Expand Down
11 changes: 0 additions & 11 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,4 @@ optimizer_runs = 200
src = 'contracts'
out = 'out'
libs = ['node_modules', 'lib']
test = 'test'
cache_path = 'cache_forge'
fs_permissions = [{ access = "read", path = "./node_modules/hardhat-predeploy/bin" }]

[lint]
exclude_lints = ["mixed-case-function", "asm-keccak256", "screaming-snake-case-immutable", "incorrect-shift", "mixed-case-variable"]
ignore = ["./contracts/interfaces/**/*.sol", "./contracts/mocks/Stateless.sol"]
lint_on_build = false

[fuzz]
runs = 5000
max_test_rejects = 150000
124 changes: 0 additions & 124 deletions hardhat.config.js

This file was deleted.

95 changes: 95 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { defineConfig } from 'hardhat/config';

// Plugins
import hardhatEthers from '@nomicfoundation/hardhat-ethers';
import hardhatEthersChaiMatchers from '@nomicfoundation/hardhat-ethers-chai-matchers';
import hardhatIgnoreWarnings from 'hardhat-ignore-warnings';
import hardhatMocha from '@nomicfoundation/hardhat-mocha';
import hardhatNetworkHelpers from '@nomicfoundation/hardhat-network-helpers';
import hardhatPredeploy from 'hardhat-predeploy';
import hardhatExposed from './hardhat/hardhat-exposed/plugin.ts';
import hardhatTranspiler from './hardhat/hardhat-transpiler/plugin.ts';
import hardhatOzContractsHelpers from './hardhat/hardhat-oz-contracts-helpers/plugin.ts';
import './hardhat/async-test-sanity.js';

// Parameters
import yargs from 'yargs/yargs';
const argv = await yargs()
.env('')
.options({
compiler: { type: 'string', default: '0.8.31' },
src: { type: 'string', default: 'contracts' },
runs: { type: 'number', default: 200 },
ir: { type: 'boolean', default: false },
evm: { type: 'string', default: 'osaka' },
})
.parse();

// Configuration
export default defineConfig({
plugins: [
// Imported plugins
hardhatEthers,
hardhatEthersChaiMatchers,
hardhatIgnoreWarnings,
hardhatMocha,
hardhatNetworkHelpers,
hardhatPredeploy,
// Local plugins
hardhatExposed,
hardhatTranspiler,
hardhatOzContractsHelpers,
],
paths: {
sources: argv.src,
},
solidity: {
version: argv.compiler,
settings: {
optimizer: {
enabled: true,
runs: argv.runs,
},
evmVersion: argv.evm,
viaIR: argv.ir,
outputSelection: { '*': { '*': ['storageLayout'] } },
},
},
networks: {
default: {
type: 'edr-simulated',
hardfork: argv.evm,
// Exposed contracts often exceed the maximum contract size. For normal contract,
// we rely on the `code-size` compiler warning, that will cause a compilation error.
allowUnlimitedContractSize: true,
},
},
test: {
solidity: {
fuzz: {
runs: 5000,
maxTestRejects: 150000,
},
fsPermissions: {
readDirectory: ['node_modules/hardhat-predeploy/bin'],
},
},
},
warnings: {
'npm/**/*': 'off',
'test/**/*': 'off',
'contracts-exposed/**/*': {
'code-size': 'off',
'initcode-size': 'off',
},
'*': {
'transient-storage': 'off',
default: 'error',
},
},
exposed: {
initializers: true,
include: ['contracts/**/*.sol'],
exclude: ['**/*WithInit.sol'],
},
});
29 changes: 0 additions & 29 deletions hardhat/env-artifacts.js

This file was deleted.

9 changes: 9 additions & 0 deletions hardhat/hardhat-exposed/hook-handlers/clean.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import fs from 'node:fs/promises';

import type { CleanHooks } from 'hardhat/types/hooks';

export type * from '../type-extensions.ts';

export default async (): Promise<Partial<CleanHooks>> => ({
onClean: context => fs.rm(context.config.exposed.outDir, { recursive: true, force: true }),
});
Loading
Loading