Skip to content

Commit 5c1a764

Browse files
author
ci-bot
committed
run deployment verification processes in parallel
1 parent b7a979a commit 5c1a764

File tree

2 files changed

+41
-18
lines changed

2 files changed

+41
-18
lines changed

apps/contract-verification/src/app/ContractVerificationPluginClient.ts

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -119,32 +119,34 @@ export class ContractVerificationPluginClient extends PluginClient {
119119
const compilerAbstract: CompilerAbstract = compilationResult
120120
const chainSettings = mergeChainSettingsWithDefaults(chainId, userSettings)
121121

122+
const verificationPromises = []
123+
122124
if (validConfiguration(chainSettings, 'Sourcify')) {
123-
await this._verifyWithProvider('Sourcify', submittedContract, compilerAbstract, chainId, chainSettings)
125+
verificationPromises.push(this._verifyWithProvider('Sourcify', submittedContract, compilerAbstract, chainId, chainSettings))
124126
}
125127

126128
if (currentChain.explorers && currentChain.explorers.some(explorer => explorer.name.toLowerCase().includes('routescan'))) {
127-
await this._verifyWithProvider('Routescan', submittedContract, compilerAbstract, chainId, chainSettings)
129+
verificationPromises.push(this._verifyWithProvider('Routescan', submittedContract, compilerAbstract, chainId, chainSettings))
128130
}
129131

130-
if (currentChain.explorers && currentChain.explorers.some(explorer => explorer.name.toLowerCase().includes('blockscout'))) {
131-
await this._verifyWithProvider('Blockscout', submittedContract, compilerAbstract, chainId, chainSettings)
132+
if (currentChain.explorers && currentChain.explorers.some(explorer => explorer.url.includes('blockscout'))) {
133+
verificationPromises.push(this._verifyWithProvider('Blockscout', submittedContract, compilerAbstract, chainId, chainSettings))
132134
}
133135

134-
if (currentChain.explorers && currentChain.explorers.some(explorer => explorer.name.toLowerCase().includes('etherscan'))) {
136+
if (currentChain.explorers && currentChain.explorers.some(explorer => explorer.name.includes('etherscan'))) {
135137
if (etherscanApiKey) {
136-
if (!chainSettings.verifiers.Etherscan) chainSettings.verifiers.Etherscan = {}
137-
chainSettings.verifiers.Etherscan.apiKey = etherscanApiKey
138-
await this._verifyWithProvider('Etherscan', submittedContract, compilerAbstract, chainId, chainSettings)
138+
verificationPromises.push(this._verifyWithProvider('Etherscan', submittedContract, compilerAbstract, chainId, chainSettings))
139139
} else {
140140
await this.call('terminal', 'log', { type: 'warn', value: 'Etherscan verification skipped: API key not found in global Settings.' })
141141
}
142142
}
143143

144-
submittedContracts[submittedContract.id] = submittedContract
144+
await Promise.all(verificationPromises)
145145

146+
submittedContracts[submittedContract.id] = submittedContract
146147
window.localStorage.setItem('contract-verification:submitted-contracts', JSON.stringify(submittedContracts))
147148
this.internalEvents.emit('submissionUpdated')
149+
148150
} catch (error) {
149151
await this.call('terminal', 'log', { type: 'error', value: `An unexpected error occurred during verification: ${error.message}` })
150152
}
@@ -196,15 +198,36 @@ export class ContractVerificationPluginClient extends PluginClient {
196198
}
197199
}
198200
} catch (e) {
199-
receipt = {
200-
verifierInfo: { name: providerName, apiUrl: verifier?.apiUrl || 'N/A' },
201-
status: 'failed',
202-
message: e.message,
203-
contractId: submittedContract.id,
204-
isProxyReceipt: false,
205-
failedChecks: 0
201+
if (e.message.includes('Unable to locate ContractCode')) {
202+
const checkUrl = `${verifier.explorerUrl}/address/${submittedContract.address}`;
203+
const friendlyMessage = `Initial verification failed, possibly due to a sync delay. Please check the status manually.`
204+
205+
await this.call('terminal', 'log', { type: 'warn', value: `${providerName}: ${friendlyMessage}` })
206+
207+
const textMessage = `Check Manually: ${checkUrl}`
208+
await this.call('terminal', 'log', { type: 'info', value: textMessage })
209+
210+
receipt = {
211+
verifierInfo: { name: providerName, apiUrl: verifier?.apiUrl || 'N/A' },
212+
status: 'failed',
213+
message: 'Failed initially (sync delay), check manually.',
214+
contractId: submittedContract.id,
215+
isProxyReceipt: false,
216+
failedChecks: 0
217+
}
218+
219+
} else {
220+
receipt = {
221+
verifierInfo: { name: providerName, apiUrl: verifier?.apiUrl || 'N/A' },
222+
status: 'failed',
223+
message: e.message,
224+
contractId: submittedContract.id,
225+
isProxyReceipt: false,
226+
failedChecks: 0
227+
}
228+
await this.call('terminal', 'log', { type: 'error', value: `${providerName} verification failed: ${e.message}` })
206229
}
207-
await this.call('terminal', 'log', { type: 'error', value: `${providerName} verification failed: ${e.message}` })
230+
208231
} finally {
209232
if (receipt) {
210233
submittedContract.receipts.push(receipt)

libs/remix-ui/run-tab/src/lib/actions/deploy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ export const createInstance = async (
217217

218218
setTimeout(async () => {
219219
await plugin.call('contract-verification', 'verifyOnDeploy', verificationData)
220-
}, 1000)
220+
}, 1500)
221221

222222
} catch (e) {
223223
const errorMsg = `Verification setup failed: ${e.message}`

0 commit comments

Comments
 (0)