Skip to content

Commit

Permalink
Merge pull request sphinx-labs#539 from chugsplash/pate/fix-verificat…
Browse files Browse the repository at this point in the history
…ion-constructor-args

fix(exec): Etherscan Verification Bugs
  • Loading branch information
RPate97 authored Mar 1, 2023
2 parents 3af7077 + 6b3e2ed commit 3225d30
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 22 deletions.
6 changes: 6 additions & 0 deletions .changeset/fuzzy-years-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@chugsplash/executor': patch
'@chugsplash/core': patch
---

Fix Etherscan verification constructor args
6 changes: 6 additions & 0 deletions .changeset/soft-chicken-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@chugsplash/executor': patch
'@chugsplash/core': patch
---

Fix contract verification constructor args
5 changes: 3 additions & 2 deletions packages/core/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
ChugSplashBootLoaderArtifact,
ChugSplashManagerProxyArtifact,
ChugSplashManagerArtifact,
ProxyArtifact,
ProxyInitializerArtifact,
DefaultAdapterArtifact,
OZUUPSAdapterArtifact,
Expand All @@ -24,6 +23,7 @@ import {
DETERMINISTIC_DEPLOYMENT_PROXY_ADDRESS,
CHUGSPLASH_SALT,
CHUGSPLASH_RECORDER_ADDRESS,
ChugSplashRegistryProxyArtifact,
} from '@chugsplash/contracts'
import { utils } from 'ethers'

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/executor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/executor/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)
Expand Down
17 changes: 7 additions & 10 deletions packages/executor/src/utils/etherscan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
ChugSplashManagerArtifact,
ChugSplashBootLoaderArtifact,
CHUGSPLASH_BOOTLOADER_ADDRESS,
ProxyArtifact,
ChugSplashRegistryProxyArtifact,
CHUGSPLASH_REGISTRY_PROXY_ADDRESS,
ChugSplashManagerProxyArtifact,
ROOT_CHUGSPLASH_MANAGER_PROXY_ADDRESS,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
13 changes: 5 additions & 8 deletions packages/executor/src/utils/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
}
Expand Down Expand Up @@ -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 })
}
Expand Down Expand Up @@ -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}`
Expand Down

0 comments on commit 3225d30

Please sign in to comment.