diff --git a/src/block-explorer.ts b/src/block-explorer.ts index e519856..159352e 100644 --- a/src/block-explorer.ts +++ b/src/block-explorer.ts @@ -62,6 +62,9 @@ async function checkAddressContractStatus({ return; } } + if (body.status == "0" && body.result.includes("Invalid API Key")) { + throw new Error(`Invalid API key`); + } logCallback(`${address} appears to be an EOA. Retrying in ${checkInterval / 1000} seconds...`, LogType.Level1); await new Promise((resolve) => setTimeout(resolve, checkInterval)); @@ -70,8 +73,9 @@ async function checkAddressContractStatus({ await new Promise((resolve) => setTimeout(resolve, checkInterval)); } } - - logCallback(`${address} could not be confirmed as a contract after ${maxTries} attempts.`, LogType.Level1); + const errorMessage = `${address} could not be confirmed as a contract after ${maxTries} attempts.`; + logCallback(errorMessage, LogType.Level1); + throw new Error(errorMessage); } export { diff --git a/src/integration-tests.ts b/src/integration-tests.ts index 6654079..c7f0306 100644 --- a/src/integration-tests.ts +++ b/src/integration-tests.ts @@ -31,7 +31,6 @@ function setupIntegrationTests( TESTING_OPT_L2_REBASABLE_TOKEN: deployedContracts.l2.tokenRebasableProxyAddress, TESTING_OPT_L2_ERC20_TOKEN_BRIDGE: deployedContracts.l2.tokenBridgeProxyAddress, }, { override: true }); - console.log("process.env=", process.env); } async function runIntegrationTestsScript({ diff --git a/src/steps.ts b/src/steps.ts index 4ea84d2..3a86a28 100644 --- a/src/steps.ts +++ b/src/steps.ts @@ -27,7 +27,7 @@ import { LogCallback, LogType } from "./log-utils"; import { DeployParameters, MainConfig, TestingParameters } from "./main-config"; import { diffyscanRpcUrl, l1RpcUrl, l2RpcUrl, localL1RpcPort, localL2RpcPort, NetworkType } from "./rpc-utils"; import { runStateMateScript, setupStateMateConfig, setupStateMateEnvs } from "./state-mate"; -import { runVerificationScript, setupGovExecutorVerification } from "./verification"; +import { runVerificationScript, setupGovExecutorVerification, setupHardhatConfigInL2Repo } from "./verification"; const NUM_L1_DEPLOYED_CONTRACTS = 10; @@ -197,6 +197,11 @@ const deployAndTestOnForksSteps: Step[] = [ ]; const deployOnRealNetworkSteps: Step[] = [ + { + name: "Burn L2 Deployer Nonces", + action: (_, logCallback) => + burnL2DeployerNonces(l2RpcUrl(NetworkType.Live), NUM_L1_DEPLOYED_CONTRACTS, logCallback), + }, { name: "Deploy Governance Executor", action: async (ctx, logCallback) => { @@ -216,11 +221,6 @@ const deployOnRealNetworkSteps: Step[] = [ }); }, }, - { - name: "Burn L2 Deployer Nonces", - action: (_, logCallback) => - burnL2DeployerNonces(l2RpcUrl(NetworkType.Live), NUM_L1_DEPLOYED_CONTRACTS, logCallback), - }, { name: "Run Deploy Script", action: async (ctx, logCallback) => { @@ -282,6 +282,7 @@ const publishSourcesSteps: Step[] = [ { name: "Verification", action: async (_, logCallback) => { + setupHardhatConfigInL2Repo(); await runVerificationScript({ config: "l1_live_deployment_args.json", network: "l1", diff --git a/src/verification.ts b/src/verification.ts index efffc13..57bfa7f 100644 --- a/src/verification.ts +++ b/src/verification.ts @@ -81,8 +81,27 @@ function setupGovExecutorVerification() { ); } +function setupHardhatConfigInL2Repo() { + dotenv.populate( + process.env as { [key: string]: string }, + { + L1_PRC_URL: env.url("L1_REMOTE_RPC_URL"), + L2_PRC_URL: env.url("L2_REMOTE_RPC_URL"), + L1_BLOCK_EXPLORER_API_KEY: env.string("L1_EXPLORER_TOKEN"), + L2_BLOCK_EXPLORER_API_KEY: env.string("L2_EXPLORER_TOKEN"), + L1_CHAIN_ID: env.string("L1_CHAIN_ID"), + L2_CHAIN_ID: env.string("L2_CHAIN_ID"), + L1_BLOCK_EXPLORER_BROWSER_URL: env.url("L1_BLOCK_EXPLORER_BROWSER_URL"), + L2_BLOCK_EXPLORER_BROWSER_URL: env.url("L2_BLOCK_EXPLORER_BROWSER_URL"), + L1_BLOCK_EXPLORER_API_URL: `https://${env.string("L1_BLOCK_EXPLORER_API_HOST")}/api`, + L2_BLOCK_EXPLORER_API_URL: `https://${env.string("L2_BLOCK_EXPLORER_API_HOST")}/api` + } + ); +} + export { runVerificationScript, waitForBlockFinalization, - setupGovExecutorVerification -} \ No newline at end of file + setupGovExecutorVerification, + setupHardhatConfigInL2Repo +}