From a3fd5801ca5255cd79c3ae85520b3021b2a55ade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CF=87=C2=B2?= <88190723+ChiTimesChi@users.noreply.github.com> Date: Wed, 9 Oct 2024 15:29:20 +0100 Subject: [PATCH] fix(solidity-devops): always add verifier options to `forge script` (#3254) * refactor: better naming * fix: always add verifier options to `forge script` * ci: no-op GasBenchmark test --- packages/solidity-devops/js/forgeScriptRun.js | 9 +++++++-- packages/solidity-devops/js/utils/options.js | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/solidity-devops/js/forgeScriptRun.js b/packages/solidity-devops/js/forgeScriptRun.js index 4f61c9393c..a05f1b7eb3 100755 --- a/packages/solidity-devops/js/forgeScriptRun.js +++ b/packages/solidity-devops/js/forgeScriptRun.js @@ -3,6 +3,7 @@ const fs = require('fs') const { readChainSpecificOptions, + readChainVerificationOptions, logWallet, isVerifierEnabled, } = require('./utils/chain.js') @@ -18,7 +19,7 @@ const { logInfo } = require('./utils/logger.js') const { parseCommandLineArgs, isBroadcasted, - addVerifyOptions, + addVerifyIfNotPresent, addOptions, } = require('./utils/options.js') const { assertCondition } = require('./utils/utils.js') @@ -47,7 +48,11 @@ let forgeOptions = addOptions( forgeOptions = addOptions(forgeOptions, readChainSpecificOptions(chainName)) forgeOptions = addOptions(forgeOptions, options) if (isBroadcast && isVerifierEnabled(chainName)) { - forgeOptions = addVerifyOptions(forgeOptions) + forgeOptions = addOptions( + forgeOptions, + readChainVerificationOptions(chainName) + ) + forgeOptions = addVerifyIfNotPresent(forgeOptions) } const currentTimestamp = Date.now() diff --git a/packages/solidity-devops/js/utils/options.js b/packages/solidity-devops/js/utils/options.js index 661b5ddf98..f25bb8bc63 100644 --- a/packages/solidity-devops/js/utils/options.js +++ b/packages/solidity-devops/js/utils/options.js @@ -28,7 +28,7 @@ const isBroadcasted = (options) => { return options.includes('--broadcast') } -const addVerifyOptions = (options) => { +const addVerifyIfNotPresent = (options) => { return options.includes('--verify') ? options : `${options} --verify` } @@ -39,6 +39,6 @@ const addOptions = (options, newOptions) => { module.exports = { parseCommandLineArgs, isBroadcasted, - addVerifyOptions, + addVerifyIfNotPresent, addOptions, }