From 6b3e2edc07bbc43a5c080d4f84798229401363df Mon Sep 17 00:00:00 2001 From: Ryan Pate Date: Tue, 28 Feb 2023 21:09:26 -0700 Subject: [PATCH] fix(exec): Fix verification constructor args --- .changeset/fuzzy-years-report.md | 6 ++++++ .changeset/soft-chicken-know.md | 6 ++++++ packages/core/src/constants.ts | 5 +++-- packages/executor/package.json | 2 +- packages/executor/src/index.ts | 2 +- packages/executor/src/utils/etherscan.ts | 17 +++++++---------- packages/executor/src/utils/execute.ts | 13 +++++-------- 7 files changed, 29 insertions(+), 22 deletions(-) create mode 100644 .changeset/fuzzy-years-report.md create mode 100644 .changeset/soft-chicken-know.md diff --git a/.changeset/fuzzy-years-report.md b/.changeset/fuzzy-years-report.md new file mode 100644 index 000000000..7110dd498 --- /dev/null +++ b/.changeset/fuzzy-years-report.md @@ -0,0 +1,6 @@ +--- +'@chugsplash/executor': patch +'@chugsplash/core': patch +--- + +Fix Etherscan verification constructor args diff --git a/.changeset/soft-chicken-know.md b/.changeset/soft-chicken-know.md new file mode 100644 index 000000000..d858166d9 --- /dev/null +++ b/.changeset/soft-chicken-know.md @@ -0,0 +1,6 @@ +--- +'@chugsplash/executor': patch +'@chugsplash/core': patch +--- + +Fix contract verification constructor args diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts index 8be22929b..d655fddd5 100644 --- a/packages/core/src/constants.ts +++ b/packages/core/src/constants.ts @@ -3,7 +3,6 @@ import { ChugSplashBootLoaderArtifact, ChugSplashManagerProxyArtifact, ChugSplashManagerArtifact, - ProxyArtifact, ProxyInitializerArtifact, DefaultAdapterArtifact, OZUUPSAdapterArtifact, @@ -24,6 +23,7 @@ import { DETERMINISTIC_DEPLOYMENT_PROXY_ADDRESS, CHUGSPLASH_SALT, CHUGSPLASH_RECORDER_ADDRESS, + ChugSplashRegistryProxyArtifact, } from '@chugsplash/contracts' import { utils } from 'ethers' @@ -40,7 +40,8 @@ const chugsplashBootLoaderSourceName = ChugSplashBootLoaderArtifact.sourceName const chugsplashManagerProxySourceName = ChugSplashManagerProxyArtifact.sourceName const chugsplashManagerSourceName = ChugSplashManagerArtifact.sourceName -const chugsplashRegistyProxySourceName = ProxyArtifact.sourceName +const chugsplashRegistyProxySourceName = + ChugSplashRegistryProxyArtifact.sourceName const proxyInitializerSourceName = ProxyInitializerArtifact.sourceName const defaultAdapterSourceName = DefaultAdapterArtifact.sourceName const OZUUPSAdapterSourceName = OZUUPSAdapterArtifact.sourceName diff --git a/packages/executor/package.json b/packages/executor/package.json index 15bdb44a8..4a611ac86 100644 --- a/packages/executor/package.json +++ b/packages/executor/package.json @@ -20,7 +20,7 @@ "lint:ts:check": "eslint . --max-warnings=0", "pre-commit": "lint-staged", "build-container": "docker build --tag chugsplash-executor .", - "container": "docker run --env-file ./.env chugsplash-executor" + "container": "docker run --platform linux/amd64 --env-file ./.env chugsplash-executor" }, "homepage": "https://github.com/smartcontracts/chugsplash/tree/develop/packages/executor#readme", "license": "MIT", diff --git a/packages/executor/src/index.ts b/packages/executor/src/index.ts index 632ca6347..1b4f26e47 100644 --- a/packages/executor/src/index.ts +++ b/packages/executor/src/index.ts @@ -305,7 +305,7 @@ export class ChugSplashExecutor extends BaseServiceV2< switch (message.action) { // on retry, put the new event back into the queue case 'retry': - if (message.payload === undefined) { + if (message.payload.retry === -1) { this.logger.info( '[ChugSplash]: execution failed, discarding event due to reaching retry limit' ) diff --git a/packages/executor/src/utils/etherscan.ts b/packages/executor/src/utils/etherscan.ts index a42163999..32247b8ba 100644 --- a/packages/executor/src/utils/etherscan.ts +++ b/packages/executor/src/utils/etherscan.ts @@ -38,7 +38,7 @@ import { ChugSplashManagerArtifact, ChugSplashBootLoaderArtifact, CHUGSPLASH_BOOTLOADER_ADDRESS, - ProxyArtifact, + ChugSplashRegistryProxyArtifact, CHUGSPLASH_REGISTRY_PROXY_ADDRESS, ChugSplashManagerProxyArtifact, ROOT_CHUGSPLASH_MANAGER_PROXY_ADDRESS, @@ -73,8 +73,7 @@ export const RESPONSE_OK = '1' export const verifyChugSplashConfig = async ( configUri: string, provider: ethers.providers.Provider, - networkName: string, - bundleId: string + networkName: string ) => { const { etherscanApiKey, etherscanApiEndpoints } = await getEtherscanInfo( provider, @@ -119,12 +118,7 @@ export const verifyChugSplashConfig = async ( abi ) const implementationAddress = await ChugSplashManager.implementations( - ethers.utils.keccak256( - ethers.utils.defaultAbiCoder.encode( - ['bytes32', 'string'], - [bundleId, referenceName] - ) - ) + ethers.utils.solidityKeccak256(['string'], [referenceName]) ) const { input, solcVersion } = canonicalConfig.inputs.find( @@ -195,7 +189,10 @@ export const verifyChugSplash = async ( }, { artifact: OZUUPSUpdaterArtifact, address: OZ_UUPS_UPDATER_ADDRESS }, { artifact: OZUUPSAdapterArtifact, address: OZ_UUPS_ADAPTER_ADDRESS }, - { artifact: ProxyArtifact, address: CHUGSPLASH_REGISTRY_PROXY_ADDRESS }, + { + artifact: ChugSplashRegistryProxyArtifact, + address: CHUGSPLASH_REGISTRY_PROXY_ADDRESS, + }, { artifact: ChugSplashManagerProxyArtifact, address: ROOT_CHUGSPLASH_MANAGER_PROXY_ADDRESS, diff --git a/packages/executor/src/utils/execute.ts b/packages/executor/src/utils/execute.ts index 48aaf5a30..870a2bddb 100644 --- a/packages/executor/src/utils/execute.ts +++ b/packages/executor/src/utils/execute.ts @@ -39,10 +39,6 @@ const generateRetryEvent = ( timesToRetry: number = 5, waitingPeriodMs?: number ): ExecutorEvent | undefined => { - if (event.retry >= timesToRetry) { - return undefined - } - let eventWaitingPeriodMs = waitingPeriodMs if (!eventWaitingPeriodMs) { eventWaitingPeriodMs = 2 * event.waitingPeriodMs @@ -53,7 +49,7 @@ const generateRetryEvent = ( const nextTryDate = new Date(nextTryMs) return { nextTry: nextTryDate, - retry: event.retry + 1, + retry: event.retry >= timesToRetry ? -1 : event.retry + 1, waitingPeriodMs: eventWaitingPeriodMs, event: event.event, } @@ -259,7 +255,9 @@ export const handleExecution = async (data: ExecutorMessage) => { activeBundleId ) if (errorBundleState.selectedExecutor !== wallet.address) { - logger.info('[ChugSplash]: execution failed due to ') + logger.info( + '[ChugSplash]: execution failed due to bundle being claimed by another executor' + ) if (remoteExecution) { process.send({ action: 'discard', payload: executorEvent }) } @@ -303,8 +301,7 @@ export const handleExecution = async (data: ExecutorMessage) => { await verifyChugSplashConfig( proposalEvent.args.configUri, rpcProvider, - network, - activeBundleId + network ) logger.info( `[ChugSplash]: finished attempting etherscan verification for project: ${projectName}`