Skip to content

Commit f599f36

Browse files
committed
Add Language, Compiler, EVM Version etc. fields to issue report
1 parent 0ae11ad commit f599f36

File tree

1 file changed

+47
-23
lines changed

1 file changed

+47
-23
lines changed

app/utils/githubIssue.ts

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,74 @@ import type { VerificationJobStatus } from "./sourcifyApi";
22
import type { Chain } from "../types/chains";
33
import { getChainName } from "./chains";
44

5-
export function generateGitHubIssueUrl(
6-
jobData: VerificationJobStatus,
7-
chains: Chain[],
8-
serverUrl: string
9-
): string {
10-
if (!jobData.error || !jobData.contract) return '';
11-
5+
export function generateGitHubIssueUrl(jobData: VerificationJobStatus, chains: Chain[], serverUrl: string): string {
6+
if (!jobData.error || !jobData.contract) return "";
7+
128
const chainName = getChainName(chains, parseInt(jobData.contract.chainId));
139
const shortAddress = `${jobData.contract.address.slice(0, 6)}...${jobData.contract.address.slice(-4)}`;
14-
15-
const title = `Verification Failed: ${jobData.error.customCode || 'Unknown Error'} - ${chainName} (${jobData.contract.chainId}) ${shortAddress}`;
16-
10+
11+
const title = `Verification Failed: ${jobData.error.customCode || "Unknown Error"} - ${chainName} (${
12+
jobData.contract.chainId
13+
}) ${shortAddress}`;
14+
1715
const body = `<!--- Please fill the section in the end of this issue and explain why you expect this job to not fail. If possible, please provide the JSON input you used. --->
1816
1917
## Verification Job Failed
2018
2119
**Job ID:** \`${jobData.verificationId}\`
2220
**Chain:** ${getChainName(chains, parseInt(jobData.contract.chainId))} (${jobData.contract.chainId})
2321
**Contract Address:** \`${jobData.contract.address}\`
24-
**Error Code:** \`${jobData.error.customCode || 'N/A'}\`
22+
**Error Code:** \`${jobData.error.customCode || "N/A"}\`
2523
**Server URL:** \`${serverUrl}\`
2624
2725
### Error Details
2826
\`\`\`
2927
${jobData.error.message}
3028
\`\`\`
3129
32-
${jobData.error.errorData?.compilerErrors?.length ? `
30+
${
31+
jobData.error.errorData?.compilerErrors?.length
32+
? `
3333
### Compiler Errors (${jobData.error.errorData.compilerErrors.length})
3434
\`\`\`
35-
${jobData.error.errorData.compilerErrors.slice(0, 3).map(err => err.formattedMessage || err.message).join('\n\n')}
35+
${jobData.error.errorData.compilerErrors
36+
.slice(0, 3)
37+
.map((err) => err.formattedMessage || err.message)
38+
.join("\n\n")}
3639
\`\`\`
37-
${jobData.error.errorData.compilerErrors.length > 3 ? `\n... and ${jobData.error.errorData.compilerErrors.length - 3} more errors` : ''}
38-
` : ''}
40+
${
41+
jobData.error.errorData.compilerErrors.length > 3
42+
? `\n... and ${jobData.error.errorData.compilerErrors.length - 3} more errors`
43+
: ""
44+
}
45+
`
46+
: ""
47+
}
3948
4049
### Additional Information
4150
- **Job Started:** ${new Date(jobData.jobStartTime).toISOString()}
42-
${jobData.jobFinishTime ? `- **Job Finished:** ${new Date(jobData.jobFinishTime).toISOString()}` : ''}
43-
${jobData.compilationTime ? `- **Compilation Time:** ${jobData.compilationTime}ms` : ''}
51+
${jobData.jobFinishTime ? `- **Job Finished:** ${new Date(jobData.jobFinishTime).toISOString()}` : ""}
52+
${jobData.compilationTime ? `- **Compilation Time:** ${jobData.compilationTime}ms` : ""}
4453
4554
### User Input and Expectation
4655
**Why do you expect this verification to succeed?**
4756
<!-- Please explain why you believe this verification should work -->
4857
58+
**Language:**
59+
<!-- Solidity or Vyper -->
60+
61+
**Compiler Version:**
62+
<!-- e.g., 0.8.19, 0.7.6+commit.7338295f -->
63+
64+
**EVM Version:**
65+
<!-- e.g., london, paris, shanghai, cancun -->
66+
67+
**Optimizer Settings:**
68+
<!-- e.g., enabled: true, runs: 200 -->
69+
70+
**Contract Identifier:**
71+
<!-- e.g., contracts/MyContract.sol:MyContract -->
72+
4973
**Files Used:**
5074
<!-- Please upload the files you submitted for verification (source code, metadata, etc.) by dragging and dropping them here or sharing them via a link -->
5175
\`\`\`
@@ -58,10 +82,10 @@ ${jobData.compilationTime ? `- **Compilation Time:** ${jobData.compilationTime}m
5882
---
5983
*This issue was automatically generated from the Sourcify verification UI.*`;
6084

61-
const issueUrl = new URL('https://github.com/ethereum/sourcify/issues/new');
62-
issueUrl.searchParams.set('title', title);
63-
issueUrl.searchParams.set('body', body);
64-
issueUrl.searchParams.set('labels', 'bug,verification-failure');
65-
85+
const issueUrl = new URL("https://github.com/ethereum/sourcify/issues/new");
86+
issueUrl.searchParams.set("title", title);
87+
issueUrl.searchParams.set("body", body);
88+
issueUrl.searchParams.set("labels", "bug,verification-failure");
89+
6690
return issueUrl.toString();
67-
}
91+
}

0 commit comments

Comments
 (0)