Repository navigation
fix(hardhat): make cofhe.mocks.deployMocks() fall back to the cofhe config - #438
Open
nftpoetrist wants to merge 1 commit into
Open
nftpoetrist wants to merge 1 commit into
nftpoetrist wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 5dc114f The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
conn.cofhe.mocks.deployMocks()now falls back to thecofheconfig forgasWarning,mocksDeployVerbosityandlogMocks, the options the deploy onnetwork.connect()already uses. Options passed in still win.hre.cofhe.mocks.deployMocks()already tookmocksDeployVerbosityfrom the config anddeployMocksreadslogMocksitself; it now takesgasWarningtoo.Root cause
The Hardhat 3 README documents these options as "inherits config", but the connection's
deployMockspassed the caller's options straight through (hre.ts#L87-L89), anddeployMocksdefaults a missinggasWarningtotrue(deploy.ts#L74). With the default config (gasWarning: false) a re-deploy printed the gas warning,mocksDeployVerbosity: ''was ignored, andlogMocks: truewas not applied again. #420 wiredlogMocksinto the deploy on connect; this is the other deploy path.In Hardhat 2 the manual deploy built its defaults from
mocksDeployVerbosityonly (index.ts#L559-L561), sogasWarning: truenever printed the warning on a re-deploy.Fix
Hardhat 3 passes the resolved
hre.config.cofhetocreateCofheConnection, and the connection'sdeployMocksbuilds its defaults from it, then spreads the caller's options over them. Hardhat 2 addsgasWarningto the defaults it already spreads.Testing
hardhat-3-plugin-test: "logMocks: true turns logging back on when cofhe.mocks.deployMocks() re-deploys" and "follows gasWarning and mocksDeployVerbosity from the config" (spies onconsole.log). RED onmaster:logOpsstaysfalse, andconsole.logis called 4 times instead of 0. With the fix: 45 passing.hardhat-plugin-test: "prints the gas warning when gasWarning is true in the config" (snapshot and revert, like the fix(hardhat): apply cofhe.logMocks when deploying the mocks #420 test). RED onmaster: no warning. With the fix: 103 passing.pnpm check:types,pnpm lint,pnpm check:formatting(tracked files),check:circles,check:pinned-deps: pass.Scope
Only the defaults of the manual deploy change. The deploy on connect sends the same transactions as before.
Related: #431 also edits
hooks/hre.ts. This change stays out of the deploy-on-connect block it touches; merged together locally, the two apply cleanly andhardhat-3-plugin-testpasses (47 passing).Note
Low Risk
Behavior-only default wiring for mock re-deploy console/logging; deploy-on-connect path unchanged.
Overview
Manual
cofhe.mocks.deployMocks()re-deploys now inheritgasWarning,mocksDeployVerbosity, andlogMocksfrom the resolved Hardhatcofheconfig (same as deploy-on-connect), with explicit call options still overriding.On Hardhat 3, the connection factory receives
hre.config.cofheand merges those values before callingdeployMocks, fixing re-deploys that wrongly showed the gas warning, ignored silent verbosity, and left FHE op logging off afterlogMocks: true. On Hardhat 2,hre.cofhe.mocks.deployMocksnow also passesgasWarningfrom config (verbosity was already wired).Tests cover re-deploy
logOpsrestoration and quiet console output whengasWarning: falseand empty verbosity; Hardhat 2 adds a gas-warning print assertion. A patch changeset bumps both plugins.Reviewed by Cursor Bugbot for commit 5dc114f. Bugbot is set up for automated code reviews on this repo. Configure here.