diff --git a/.changeset/hip-mayflies-worry.md b/.changeset/hip-mayflies-worry.md new file mode 100644 index 000000000..28df1fb8e --- /dev/null +++ b/.changeset/hip-mayflies-worry.md @@ -0,0 +1,6 @@ +--- +'@chugsplash/executor': patch +'@chugsplash/plugins': patch +--- + +Remove redundant Proxy verification attempts. Link ChugSplashManager proxy with its implementation on Etherscan. diff --git a/packages/executor/src/utils/etherscan.ts b/packages/executor/src/utils/etherscan.ts index a3f72247f..3c12ba39f 100644 --- a/packages/executor/src/utils/etherscan.ts +++ b/packages/executor/src/utils/etherscan.ts @@ -32,9 +32,8 @@ import { buildContractUrl } from '@nomiclabs/hardhat-etherscan/dist/src/util' import { getLongVersion } from '@nomiclabs/hardhat-etherscan/dist/src/solc/version' import { encodeArguments } from '@nomiclabs/hardhat-etherscan/dist/src/ABIEncoder' import { - buildInfo as proxyBuildInfo, ChugSplashManagerABI, - ProxyArtifact, + CHUGSPLASH_MANAGER_ADDRESS, } from '@chugsplash/contracts' import { EthereumProvider, HardhatRuntimeEnvironment } from 'hardhat/types' import { request } from 'undici' @@ -66,6 +65,18 @@ export const verifyChugSplashConfig = async ( hre.ethers.provider ) + // Link the project's ChugSplashManagerProxy with the ChugSplashManager. + const chugsplashManagerProxyAddress = getChugSplashManagerProxyAddress( + canonicalConfig.options.projectName + ) + await linkProxyWithImplementation( + etherscanApiEndpoints, + etherscanApiKey, + chugsplashManagerProxyAddress, + CHUGSPLASH_MANAGER_ADDRESS, + 'ChugSplashManager' + ) + for (const referenceName of Object.keys(canonicalConfig.contracts)) { const artifact = artifacts[referenceName] const { abi, contractName, sourceName, compilerOutput } = artifact @@ -81,33 +92,13 @@ export const verifyChugSplashConfig = async ( const implementationAddress = await ChugSplashManager.implementations( referenceName ) - - const compilerInput = canonicalConfig.inputs.find((compilerInputs) => - Object.keys(compilerInputs.input.sources).includes(sourceName) - ) - - // Verify the proxy const proxyAddress = getProxyAddress( canonicalConfig.options.projectName, referenceName ) - const { - sourceName: proxySourceName, - contractName: proxyContractName, - abi: proxyAbi, - } = ProxyArtifact - await attemptVerification( - hre.network.provider, - hre.network.name, - etherscanApiEndpoints, - proxyAddress, - proxySourceName, - proxyContractName, - proxyAbi, - etherscanApiKey, - proxyBuildInfo.input, - proxyBuildInfo.solcVersion, - [getChugSplashManagerProxyAddress(canonicalConfig.options.projectName)] + + const compilerInput = canonicalConfig.inputs.find((compilerInputs) => + Object.keys(compilerInputs.input.sources).includes(sourceName) ) // Verify the implementation @@ -269,7 +260,7 @@ export const linkProxyWithImplementation = async ( etherscanApiKey: string, proxyAddress: string, implAddress: string, - contractName: string + implContractName: string ) => { const params = { module: 'contract', @@ -304,10 +295,13 @@ export const linkProxyWithImplementation = async ( } if (responseBody.status === RESPONSE_OK) { - console.log(`Successfully linked ${contractName} proxy to implementation.`) + console.log( + `Successfully linked ${implContractName} proxy to implementation.` + ) } else { throw new Error( - `Failed to link ${contractName} proxy with its implementation. Reason: ${responseBody.result}` + `Failed to link ${implContractName} proxy with its implementation. +Reason: ${responseBody.result}` ) } } @@ -331,7 +325,8 @@ export const callEtherscanApi = async ( if (!(response.statusCode >= 200 && response.statusCode <= 299)) { const responseBodyText = await response.body.text() throw new Error( - `Etherscan API call failed with status ${response.statusCode}. Response: ${responseBodyText}` + `Etherscan API call failed with status ${response.statusCode}. +Response: ${responseBodyText}` ) } diff --git a/packages/plugins/src/hardhat/execution.ts b/packages/plugins/src/hardhat/execution.ts index 6f5e03863..1a7ff90c2 100644 --- a/packages/plugins/src/hardhat/execution.ts +++ b/packages/plugins/src/hardhat/execution.ts @@ -140,7 +140,7 @@ export const postExecutionActions = async ( const currChugSplashManagerOwner = await ChugSplashManager.owner() // Exit early if the calling address is not the current owner of the ChugSplashManager. - if (signer.getAddress() !== currChugSplashManagerOwner) { + if ((await signer.getAddress()) !== currChugSplashManagerOwner) { return }