-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Migrate to Hardhat 3 #6317
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
Closed
+7,478
−9,375
Closed
Migrate to Hardhat 3 #6317
Changes from all commits
Commits
Show all changes
112 commits
Select commit
Hold shift + click to select a range
df6b7ff
wip
Amxx feec869
new hook
Amxx 7eaa9d6
It works! implemented exposed by rewritting context.solidity.build
Amxx a115cfe
move the solidity path push to the config hook
Amxx 8c1f55c
test migration
Amxx a03c738
test network env
Amxx 319dd41
update package.json scripts
Amxx 75ed0fa
plugin update
Amxx 8c53c5d
fix package logic
Amxx 85bd93b
remove old unused file
Amxx 52fc608
migrate generation logic
Amxx d6e4477
migrate inheritance-ordering and pragma check/minimize check
Amxx 4f4c783
Merge branch 'master' into hardhat3
Amxx 825a203
remove supperfluous test that doesn't run in hh3
Amxx 2f62a2c
Merge remote-tracking branch 'amxx/hardhat3' into hardhat3
Amxx 3b840e6
update patch
frangio 561a427
update transpile.sh
frangio 4f8812b
remove npmPackage name for internal plugins
Amxx eadb1bd
fix hardhat error for local plugins
frangio 033bced
use .ts imports
frangio 9e6dfd7
add --paths to transpiler
frangio 75ce57f
fix heredoc
frangio 6173cb9
add project prefix
frangio 1f582f7
Merge branch 'hardhat3' into hardhat3-transpiler
frangio 64f435a
Merge pull request #18 from frangio/hardhat3-transpiler
Amxx 09b2af1
Hardhat transpile action
Amxx 3c2ecd3
Use a JSON file for transpiler settings
Amxx 0471363
hardhat 3.1.6 + use build hook for exposed
Amxx de13540
Refactor transpile
Amxx 66d21a9
add flag for noExpose
Amxx b7d7c71
disable noExpose flag that was breaking tests
Amxx 713cc11
migrate new test
Amxx 5be3970
testing of upgradeable contracts
Amxx 0308965
refactor expose include filter
Amxx 13d8d4b
migrate task-test-get-files.js to skip test
Amxx 252388e
Merge branch 'master' into hardhat3
Amxx eb7e57d
use hardhat-ignore-warnings 0.3.0
Amxx 10ab3c2
redesign exposed plugin: closer to original version + support imports…
Amxx fffa3e8
update hardhat-predeploy
Amxx 008e9a0
add exposed spinner
Amxx 119a16f
anvil free testing thanks to eth_getProof support
Amxx 34725db
fix account testing issue
Amxx 3fd9f6e
disable foundry tests in favor of hardhat solidity testing
Amxx ad40b76
update hardhat3 to fix eip7212 testing in solidity
Amxx a618058
remove dependency on default.allow_internal_expect_revert because har…
Amxx 2ae2edd
fix solhint
Amxx 499e5c2
Merge branch 'master' into hardhat3
Amxx bfea5cc
add changeset
Amxx ce3943b
codespell
Amxx d4648cc
fetch submodules
Amxx 37e96ff
install forge when running halmos
Amxx b9ffcbb
migrate new tests
Amxx 331ef29
up
Amxx 0078040
Merge branch 'master' into hardhat3
Amxx d952f94
update hardhat
Amxx c95eaa9
hardhat now supports forge-config & hardhat-config overrides
Amxx f9c3d33
generate gas report
Amxx 28f0b80
update gas comparaison script
Amxx 71a622c
Merge branch 'master' into hardhat3
Amxx e7abecd
use hardhat 3.4.0 and network.create()
Amxx 58a567f
Merge upstream/master into amxx/hardhat3
kanej 96002f7
Merge branch 'master' into hardhat3
Amxx f6acf10
Merge remote-tracking branch 'amxx/hardhat3' into hardhat3
Amxx f76b4ff
Optimize the `hre.artifacts.readArtifact` overload
alcuadrado 1c3fcfb
refactor: leverage extracted variable
kanej 5ca9127
refactor: switch from loop to functional pattern
kanej a6cce3e
Revamp `hardhat-exposed`.
alcuadrado 2aa835b
TS cleanup
alcuadrado 452b09c
refactor: apply expression based approach
kanej 5575911
Update hardhat/hardhat-exposed/tasks/build.ts
kanej 2bc24b9
refactor: guard for type system
kanej 7bfa7bf
refactor: apply functional style
kanej a3df447
Merge pull request #20 from NomicFoundation/optimize-hardhat-oz-contr…
Amxx 46dacbf
Merge branch 'hardhat3' of https://github.com/Amxx/openzeppelin-contr…
Amxx 67b8436
simply typescript types
Amxx 593e23e
chore: update to hardhat 3.4.4
kanej 2089f5f
chore: tweak gas comparison CI step
kanej f223159
chore: update compare layout and extract layout scripts to ESM
kanej 0b1191e
fix: deal with deployment null in gas comparison script
kanej 3cc085f
chore: don't compare on previous json files if none present
kanej 7e6ea2e
fix(transpile): scope transpiler input to the main contracts tree
kanej bb179c1
fix(transpile): delete peer copies of already-initializable files
kanej 95ed1e2
chore: exclude mocks/tests/entire peer dep from linearization check
kanej 1a9aa13
fix(tests): use @openzeppelin/contracts/… imports in .t.sol files
kanej 3a11b3d
Merge branch 'master' into hardhat3
Amxx 5665c2f
Merge branch 'hardhat3' into update-hardhat-exposed
Amxx d6afa0e
test migration for Create3
Amxx c35db48
Fix transpilation script. Missing cleanup
Amxx d819a26
Merge branch 'hardhat3' into update-hardhat-exposed
Amxx 555c172
Merge pull request #21 from NomicFoundation/update-hardhat-exposed
Amxx 839bceb
Update action.yml
Amxx 967deec
Update action.yml
Amxx d75faac
skip exposed contracts from coverage
Amxx 2b37b94
Merge branch 'small-ci-changes' of https://github.com/NomicFoundation…
Amxx a53631b
script naming consistency
Amxx 765719e
Merge pull request #22 from NomicFoundation/small-ci-changes
Amxx a96ae51
refactor transpile.ts
Amxx f72b6b4
Merge pull request #23 from NomicFoundation/fixes_for_transpile
Amxx df1e340
test: bump gas usage to allow coverage run
kanej e945300
chore: bump Hardhat version to 3.5
kanej 0d3ae5a
Apply suggestion from @Amxx
Amxx e2a37c6
Merge pull request #24 from NomicFoundation/chore/fix-failing-coverag…
Amxx 02db468
fix test
Amxx 1388c35
Update inheritance-ordering.js
Amxx 0d25b23
update
Amxx da05630
revert unecessary changes to solidity tests
Amxx d08d2c5
Apply suggestion from @Amxx
Amxx cbf2c99
more updates / cleanup
Amxx 330f381
get file patterns from package.json
Amxx 402ab1b
more tests rewrite
Amxx db1ee9c
Update compare-gas-reports.js
Amxx fe1f223
Update TimelockController.test.js
Amxx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,3 +14,4 @@ ignore: | |
| - "test" | ||
| - "contracts/mocks" | ||
| - "contracts/vendor" | ||
| - "contracts-exposed" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'], | ||
| }, | ||
| }); |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }), | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 :/