Repository navigation
Conversation
Hardhat 3 does not emit artifacts for contracts that are only imported, but the exposed plugin (with `exposed.imports`) generates a `$`-prefixed version of every contract that import.sol imports by name, and those are compilation roots. Use that single mechanism for every dependency the tests deploy.
…e directory The exposed version of ECDSAOwnedDKIMRegistry cannot be used: with `exposed.initializers`, its constructor runs the initializer, so `initialize` reverts. A mock declared in the project sources is a compilation root, so it gets a plain artifact. This also stops compiling the unrelated contracts of that directory.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified in the test dependency artifact-generation changes.
No open issues 🎉
What changed in this PR
Simplifies test dependency artifact generation by using local compilation roots and the existing exposed-contract mechanism instead of separate Hardhat build configuration.
Changes:
- Moves four dependencies into
import.soland updates tests to deploy their$-prefixed versions. - Adds a plain
ECDSAOwnedDKIMRegistryMocksubclass to preserve explicit initialization in tests. - Removes
npmFilesToBuildand the extra dependency source directory from Hardhat configuration.
| File | Description |
|---|---|
test/utils/cryptography/ZKEmailUtils.test.js |
Deploys the new DKIM registry mock. |
test/proxy/HybridProxy.test.js |
Deploys $UpgradeableBeacon. |
test/account/RoleAccountFactory.test.js |
Deploys $CallReceiverMock. |
test/account/modules/ERC7579SignatureValidator.test.js |
Deploys exposed P256 and RSA verifiers. |
test/account/modules/ERC7579SelectorExecutor.test.js |
Deploys $CallReceiverMock. |
test/account/modules/ERC7579MultisigWeighted.test.js |
Deploys $CallReceiverMock. |
test/account/modules/ERC7579MultisigStorage.test.js |
Deploys $CallReceiverMock. |
test/account/modules/ERC7579Multisig.test.js |
Deploys $CallReceiverMock. |
test/account/modules/ERC7579Executor.test.js |
Deploys $CallReceiverMock. |
test/account/modules/ERC7579DelayedExecutor.test.js |
Deploys $CallReceiverMock. |
test/account/AccountZKEmail.test.js |
Uses the exposed call receiver and new registry mock. |
test/account/AccountERC7913.test.js |
Uses the exposed call receiver and new registry mock. |
hardhat.config.ts |
Removes explicit dependency build entries and the extra source directory. |
contracts/mocks/utils/cryptography/ECDSAOwnedDKIMRegistryMock.sol |
Adds a compilation root for the plain registry artifact. |
contracts/mocks/import.sol |
Adds four named imports and documents exposed artifact generation. |
Review effort: Balanced
The transpiler keeps ECDSAOwnedDKIMRegistryMock as-is (it already inherits Initializable), which would duplicate the copy that the tests get from lib/openzeppelin-community-contracts. The patch deletes it.
|
Closed in favor of #325 |
Uses a single mechanism to get artifacts for the dependencies that the tests deploy, instead of three.
Replace
npmFilesToBuildwithimport.solHardhat 3 only emits artifacts for compilation roots, so importing a contract is not enough to get its artifact. However, with
exposed.imports, the exposed plugin generates a$-prefixed version of every contract thatcontracts/mocks/import.solimports by name, and those are roots.import.solalready provided$AccessManager,$ERC721,$Create2, etc. this way.CallReceiverMock,UpgradeableBeacon,ERC7913P256VerifierandERC7913RSAVerifiermove fromnpmFilesToBuildtoimport.sol, and the tests now deploy their$versions. Those are subclasses with extra$-prefixed functions; no test depends on the exact ABI or bytecode.Replace the extra
paths.sourcesentry with a mockECDSAOwnedDKIMRegistrywas built by addinglib/email-tx-builder/packages/contracts/src/utilsas a source directory. Its exposed version cannot be used: withexposed.initializers, its constructor runs the initializer, soinitializereverts (anddkimRegistry/signerare never set). Instead,ECDSAOwnedDKIMRegistryMock(an empty subclass declared incontracts/mocks) is a root and gets a plain artifact. This also stops compiling the unrelated contracts of that directory.Upgradeable patch
The patch is updated for the new
paths.sources. It also deletesECDSAOwnedDKIMRegistryMock: the transpiler keeps it as-is (it already inheritsInitializable), which would duplicate the copy that the tests get fromlib/openzeppelin-community-contracts(HHE1001).Testing
npx hardhat test mocha: 1460 passing, 2 pendingnpm run lint:sol,forge build: passtests-upgradeablesteps, run locally (copy, transpile,npm run test,test:inheritance,test:pragma): pass