From 9c77530737ecd5ec8eb4f0e7e797e1643e24a695 Mon Sep 17 00:00:00 2001 From: Farivar Tabatabaei Date: Fri, 26 Dec 2025 20:06:54 +0330 Subject: [PATCH 1/3] Fix issue bug: `lz:deploy` requires deploy task name matches `contractName` Fixes #1066 feat(deploy): add warning for no deployed contracts with specified tags --- .../devtools-evm-hardhat/src/tasks/deploy.ts | 18 ++++++++++++++++++ .../deploy-all-missing-tag.exp | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/devtools-evm-hardhat/src/tasks/deploy.ts b/packages/devtools-evm-hardhat/src/tasks/deploy.ts index d45c83843a..a2eb8facd3 100644 --- a/packages/devtools-evm-hardhat/src/tasks/deploy.ts +++ b/packages/devtools-evm-hardhat/src/tasks/deploy.ts @@ -261,6 +261,24 @@ const action: ActionType = async ( error == null ? [] : [{ networkName, error }] ) + // We count the total number of contracts that were deployed across all networks + const totalDeployedContracts = Object.values(results).reduce( + (acc, { contracts }) => acc + (contracts ? Object.keys(contracts).length : 0), + 0 + ) + + // If tags were specified but no contracts were deployed, warn the user + if (selectedTags.length > 0 && totalDeployedContracts === 0 && errors.length === 0) { + logger.warn( + `${printBoolean(false)} No deploy scripts matched the given ${pluralizeNoun(selectedTags.length, 'tag', 'tags')}: ${selectedTags.join(', ')}` + ) + + // Mark the process as unsuccessful + process.exitCode = process.exitCode || 1 + + return results + } + // If nothing went wrong we just exit if (errors.length === 0) { return logger.info(`${printBoolean(true)} Your contracts are now deployed`), results diff --git a/tests/devtools-evm-hardhat-test/test/task/deploy.test.expectations/deploy-all-missing-tag.exp b/tests/devtools-evm-hardhat-test/test/task/deploy.test.expectations/deploy-all-missing-tag.exp index fb6a053772..f6816ba0b6 100755 --- a/tests/devtools-evm-hardhat-test/test/task/deploy.test.expectations/deploy-all-missing-tag.exp +++ b/tests/devtools-evm-hardhat-test/test/task/deploy.test.expectations/deploy-all-missing-tag.exp @@ -44,6 +44,6 @@ expect "Do you want to continue?" send -- "\r" expect "Deploying..." -expect "Your contracts are now deployed" +expect "No deploy scripts matched the given tag: MeNoExist" expect eof From 8d12576c3eff88836573707529311b8f2e3dcfe2 Mon Sep 17 00:00:00 2001 From: Farivar Tabatabaei Date: Fri, 26 Dec 2025 20:18:54 +0330 Subject: [PATCH 2/3] fix: improve warning message for no deployed contracts with specified tags --- packages/devtools-evm-hardhat/src/tasks/deploy.ts | 6 ++---- .../deploy.test.expectations/deploy-all-missing-tag.exp | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/devtools-evm-hardhat/src/tasks/deploy.ts b/packages/devtools-evm-hardhat/src/tasks/deploy.ts index a2eb8facd3..78a1c9f16c 100644 --- a/packages/devtools-evm-hardhat/src/tasks/deploy.ts +++ b/packages/devtools-evm-hardhat/src/tasks/deploy.ts @@ -268,14 +268,12 @@ const action: ActionType = async ( ) // If tags were specified but no contracts were deployed, warn the user + // This could happen if the tag doesn't match any deploy scripts, or if all matching contracts are already deployed if (selectedTags.length > 0 && totalDeployedContracts === 0 && errors.length === 0) { logger.warn( - `${printBoolean(false)} No deploy scripts matched the given ${pluralizeNoun(selectedTags.length, 'tag', 'tags')}: ${selectedTags.join(', ')}` + `${printBoolean(false)} No contracts were deployed. This could mean no deploy scripts matched the given ${pluralizeNoun(selectedTags.length, 'tag', 'tags')} (${selectedTags.join(', ')}), or the contracts are already deployed` ) - // Mark the process as unsuccessful - process.exitCode = process.exitCode || 1 - return results } diff --git a/tests/devtools-evm-hardhat-test/test/task/deploy.test.expectations/deploy-all-missing-tag.exp b/tests/devtools-evm-hardhat-test/test/task/deploy.test.expectations/deploy-all-missing-tag.exp index f6816ba0b6..ff29e72e1a 100755 --- a/tests/devtools-evm-hardhat-test/test/task/deploy.test.expectations/deploy-all-missing-tag.exp +++ b/tests/devtools-evm-hardhat-test/test/task/deploy.test.expectations/deploy-all-missing-tag.exp @@ -44,6 +44,6 @@ expect "Do you want to continue?" send -- "\r" expect "Deploying..." -expect "No deploy scripts matched the given tag: MeNoExist" +expect "No contracts were deployed" expect eof From 44ae34bebb86841b317be19dd870a4ff40159bbb Mon Sep 17 00:00:00 2001 From: Farivar Tabatabaei Date: Fri, 26 Dec 2025 20:25:14 +0330 Subject: [PATCH 3/3] I have no idea why I removed this previously --- packages/devtools-evm-hardhat/src/tasks/deploy.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/devtools-evm-hardhat/src/tasks/deploy.ts b/packages/devtools-evm-hardhat/src/tasks/deploy.ts index 78a1c9f16c..9e7b6847dd 100644 --- a/packages/devtools-evm-hardhat/src/tasks/deploy.ts +++ b/packages/devtools-evm-hardhat/src/tasks/deploy.ts @@ -274,6 +274,9 @@ const action: ActionType = async ( `${printBoolean(false)} No contracts were deployed. This could mean no deploy scripts matched the given ${pluralizeNoun(selectedTags.length, 'tag', 'tags')} (${selectedTags.join(', ')}), or the contracts are already deployed` ) + // Mark the process as unsuccessful + process.exitCode = process.exitCode || 1 + return results }