Skip to content

Commit 3ba216b

Browse files
committed
fix conflicts
2 parents bf90c49 + 9ac2402 commit 3ba216b

File tree

77 files changed

+846
-494
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+846
-494
lines changed

.circleci/config.yml

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,83 @@ jobs:
175175
key: remixdesktop-windows-deps-{{ checksum "apps/remixdesktop/yarn.lock" }}
176176
paths:
177177
- apps/remixdesktop/node_modules
178+
- persist_to_workspace:
179+
root: apps/remixdesktop
180+
paths:
181+
- "release"
182+
# see https://docs.digicert.com/en/software-trust-manager/ci-cd-integrations/script-integrations/github-integration-ksp.html
183+
sign-remixdesktop-windows:
184+
executor: win/default # executor type
185+
working_directory: ~/remix-project
186+
steps:
187+
- checkout
188+
- attach_workspace:
189+
at: .
190+
- run:
191+
name: "Certificate-Setup"
192+
shell: powershell.exe
193+
command: |
194+
cd C:\
195+
New-Item C:\CERT_FILE.p12.b64
196+
Set-Content -Path C:\CERT_FILE.p12.b64 -Value $env:SM_CLIENT_CERT_FILE_B64
197+
certutil -decode CERT_FILE.p12.b64 Certificate_pkcs12.p12
198+
cat Certificate_pkcs12.p12
199+
- restore_cache:
200+
name: Restore smtools-windows-x64.msi
201+
keys:
202+
- dl-smtools-windows-x64.msi
203+
- run:
204+
name: "Client-Tool-Download"
205+
shell: powershell.exe
206+
command: |
207+
cd C:\
208+
if (Test-Path 'c:\smtools-windows-x64.msi') {
209+
echo 'File exists, skipping download...'
210+
} else {
211+
echo 'Downloading smtools-windows-x64.msi ...'
212+
curl.exe -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download -H "x-api-key:$env:SM_API_KEY" -o smtools-windows-x64.msi
213+
}
214+
- save_cache:
215+
key: dl-smtools-windows-x64.msi
216+
paths:
217+
- c:\smtools-windows-x64.msi
218+
- run:
219+
name: "Client-Tool-Setup"
220+
shell: powershell.exe
221+
command: |
222+
cd C:\
223+
msiexec.exe /i smtools-windows-x64.msi /quiet /qn | Wait-Process
224+
& $env:SSM\smksp_cert_sync.exe
225+
& $env:SSM\smctl.exe healthcheck
226+
- run:
227+
name: "Find Signtool"
228+
shell: powershell.exe
229+
command: |
230+
Get-ChildItem -Path 'C:\Program Files (x86)\Windows Kits\10\App Certification Kit' -Filter signtool.exe -Recurse
231+
- run:
232+
name: "Signtool-Signing"
233+
shell: powershell.exe
234+
command: |
235+
& $env:Signtool sign /sha1 $env:SM_CODE_SIGNING_CERT_SHA1_HASH /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 $env:RemixSetupExe
236+
- run:
237+
name: "Signtool-Verification"
238+
shell: powershell.exe
239+
command: |
240+
$verify_output = $(& $env:Signtool verify /v /pa $env:RemixSetupExe)
241+
echo ${verify_output}
242+
if (!$verify_output.Contains("Number of files successfully Verified: 1")) {
243+
echo 'Verification failed'
244+
exit 1
245+
}
178246
- store_artifacts:
179-
path: apps/remixdesktop/release/
247+
path: ~/remix-project/release/
180248
destination: remixdesktop-windows
181-
249+
environment:
250+
SM_CLIENT_CERT_FILE: 'C:\Certificate_pkcs12.p12'
251+
Signtool: 'C:\Program Files (x86)\Windows Kits\10\App Certification Kit\signtool.exe'
252+
SSM: 'C:\Program Files\DigiCert\DigiCert One Signing Manager Tools'
253+
RemixSetupExe: 'C:\Users\circleci\remix-project\release\Remix IDE.exe'
254+
182255
build-remixdesktop-mac:
183256
macos:
184257
xcode: 14.2.0
@@ -452,6 +525,9 @@ workflows:
452525
- build-remixdesktop-windows:
453526
requires:
454527
- build-desktop
528+
- sign-remixdesktop-windows:
529+
requires:
530+
- build-remixdesktop-windows
455531
- build-remixdesktop-linux:
456532
requires:
457533
- build-desktop

.github/workflows/pr-reminder.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ jobs:
1414
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1515
with:
1616
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
17-
freeze-date: '2024-01-15T18:00:00Z'
17+
freeze-date: '2024-01-29T18:00:00Z'

apps/circuit-compiler/src/app/app.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ function App() {
2929
if (filePath.endsWith('.circom')) {
3030
dispatch({ type: 'SET_FILE_PATH', payload: filePath })
3131
plugin.parse(filePath)
32-
} else {
33-
dispatch({ type: 'SET_FILE_PATH', payload: '' })
3432
}
3533
})
3634
// @ts-ignore
@@ -102,6 +100,9 @@ function App() {
102100
(async () => {
103101
if (appState.autoCompile) await compileCircuit(plugin, appState)
104102
})()
103+
dispatch({ type: 'SET_SIGNAL_INPUTS', payload: [] })
104+
dispatch({ type: 'SET_COMPILER_STATUS', payload: 'idle' })
105+
dispatch({ type: 'SET_COMPILER_FEEDBACK', payload: null })
105106
}
106107
}, [appState.filePath])
107108

apps/circuit-compiler/src/app/components/container.tsx

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { CircuitActions } from './actions'
1010
import { WitnessToggler } from './witnessToggler'
1111
import { WitnessSection } from './witness'
1212
import { CompilerFeedback } from './feedback'
13-
import { PrimeValue } from '../types'
13+
import { CompilerReport, PrimeValue } from '../types'
1414

1515
export function Container () {
1616
const circuitApp = useContext(CircuitAppContext)
@@ -58,6 +58,43 @@ export function Container () {
5858
circuitApp.dispatch({ type: 'SET_HIDE_WARNINGS', payload: value })
5959
}
6060

61+
const askGPT = async (report: CompilerReport) => {
62+
if (report.labels.length > 0) {
63+
const location = circuitApp.appState.filePathToId[report.labels[0].file_id]
64+
const error = report.labels[0].message
65+
66+
if (location) {
67+
const fullPathLocation = await circuitApp.plugin.resolveReportPath(location)
68+
const content = await circuitApp.plugin.call('fileManager', 'readFile', fullPathLocation)
69+
const message = `
70+
circom code: ${content}
71+
error message: ${error}
72+
full circom error: ${JSON.stringify(report, null, 2)}
73+
explain why the error occurred and how to fix it.
74+
`
75+
// @ts-ignore
76+
await circuitApp.plugin.call('openaigpt', 'message', message)
77+
} else {
78+
const message = `
79+
error message: ${error}
80+
full circom error: ${JSON.stringify(report, null, 2)}
81+
explain why the error occurred and how to fix it.
82+
`
83+
// @ts-ignore
84+
await circuitApp.plugin.call('openaigpt', 'message', message)
85+
}
86+
} else {
87+
const error = report.message
88+
const message = `
89+
error message: ${error}
90+
full circom error: ${JSON.stringify(report, null, 2)}
91+
explain why the error occurred and how to fix it.
92+
`
93+
// @ts-ignore
94+
await circuitApp.plugin.call('openaigpt', 'message', message)
95+
}
96+
}
97+
6198
return (
6299
<section>
63100
<article>
@@ -86,7 +123,7 @@ export function Container () {
86123
</WitnessToggler>
87124
</RenderIf>
88125
<RenderIf condition={(circuitApp.appState.status !== 'compiling') && (circuitApp.appState.status !== 'computing') && (circuitApp.appState.status !== 'generating')}>
89-
<CompilerFeedback feedback={circuitApp.appState.feedback} filePathToId={circuitApp.appState.filePathToId} openErrorLocation={handleOpenErrorLocation} hideWarnings={circuitApp.appState.hideWarnings} />
126+
<CompilerFeedback feedback={circuitApp.appState.feedback} filePathToId={circuitApp.appState.filePathToId} openErrorLocation={handleOpenErrorLocation} hideWarnings={circuitApp.appState.hideWarnings} askGPT={askGPT} />
90127
</RenderIf>
91128
</div>
92129
</div>

apps/circuit-compiler/src/app/components/feedback.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { RenderIf } from '@remix-ui/helper'
44
import {CopyToClipboard} from '@remix-ui/clipboard'
55
import { FeedbackAlert } from './feedbackAlert'
66

7-
export function CompilerFeedback ({ feedback, filePathToId, hideWarnings, openErrorLocation }: CompilerFeedbackProps) {
7+
export function CompilerFeedback ({ feedback, filePathToId, hideWarnings, openErrorLocation, askGPT }: CompilerFeedbackProps) {
88
const [ showException, setShowException ] = useState<boolean>(true)
99

1010
const handleCloseException = () => {
@@ -17,6 +17,10 @@ export function CompilerFeedback ({ feedback, filePathToId, hideWarnings, openEr
1717
}
1818
}
1919

20+
const handleAskGPT = (report: CompilerReport) => {
21+
askGPT(report)
22+
}
23+
2024
return (
2125
<div>
2226
<div className="circuit_errors_box py-4">
@@ -40,12 +44,18 @@ export function CompilerFeedback ({ feedback, filePathToId, hideWarnings, openEr
4044
<div key={index} onClick={() => handleOpenError(response)}>
4145
<RenderIf condition={response.type === 'Error'}>
4246
<div className={`circuit_feedback ${response.type.toLowerCase()} alert alert-danger`} data-id="circuit_feedback">
43-
<FeedbackAlert message={response.message} location={ response.labels[0] ? response.labels[0].message + ` ${filePathToId[response.labels[0].file_id]}:${response.labels[0].range.start}:${response.labels[0].range.end}` : null} />
47+
<FeedbackAlert
48+
message={response.message}
49+
location={ response.labels[0] ? response.labels[0].message + ` ${filePathToId[response.labels[0].file_id]}:${response.labels[0].range.start}:${response.labels[0].range.end}` : null}
50+
askGPT={ () => handleAskGPT(response) } />
4451
</div>
4552
</RenderIf>
4653
<RenderIf condition={(response.type === 'Warning') && !hideWarnings}>
4754
<div className={`circuit_feedback ${response.type.toLowerCase()} alert alert-warning`} data-id="circuit_feedback">
48-
<FeedbackAlert message={response.message} location={null} />
55+
<FeedbackAlert
56+
message={response.message}
57+
location={null}
58+
askGPT={() => { handleAskGPT(response) }} />
4959
</div>
5060
</RenderIf>
5161
</div>

apps/circuit-compiler/src/app/components/feedbackAlert.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { FeedbackAlertProps } from '../types'
33
import { RenderIf } from '@remix-ui/helper'
44
import {CopyToClipboard} from '@remix-ui/clipboard'
55

6-
export function FeedbackAlert ({ message, location }: FeedbackAlertProps) {
6+
export function FeedbackAlert ({ message, location, askGPT }: FeedbackAlertProps) {
77
const [ showAlert, setShowAlert] = useState<boolean>(true)
88

99
const handleCloseAlert = () => {
@@ -24,6 +24,7 @@ export function FeedbackAlert ({ message, location }: FeedbackAlertProps) {
2424
<span className="ml-3 pt-1 py-1" >
2525
<CopyToClipboard content={message} className="p-0 m-0 far fa-copy error" direction={'top'} />
2626
</span>
27+
<span className="border border-success text-success btn-sm" onClick={askGPT}>ASK GPT</span>
2728
</div>
2829
</>
2930
</RenderIf>

apps/circuit-compiler/src/app/components/witness.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { CompilerStatus } from "../types";
44
import { computeWitness } from "../actions";
55
import { useState } from "react";
66
import type { CircomPluginClient } from "../services/circomPluginClient";
7+
import * as remixLib from '@remix-project/remix-lib'
78

89
export function WitnessSection ({ plugin, signalInputs, status }: {plugin: CircomPluginClient, signalInputs: string[], status: CompilerStatus}) {
910
const [witnessValues, setWitnessValues] = useState<Record<string, string>>({})
@@ -12,13 +13,13 @@ export function WitnessSection ({ plugin, signalInputs, status }: {plugin: Circo
1213
let value = e.target.value
1314

1415
try {
15-
value = JSON.parse(value)
16+
value = remixLib.execution.txFormat.parseFunctionParams(value)
1617
} catch (e) {
1718
// do nothing
1819
}
1920
setWitnessValues({
2021
...witnessValues,
21-
[e.target.name]: value
22+
[e.target.name]: value[0]
2223
})
2324
}
2425

apps/circuit-compiler/src/app/services/circomPluginClient.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class CircomPluginClient extends PluginClient {
2121

2222
constructor() {
2323
super()
24-
this.methods = ['init', 'parse', 'compile', 'generateR1cs']
24+
this.methods = ['init', 'parse', 'compile', 'generateR1cs', 'resolveDependencies']
2525
createClient(this)
2626
this.internalEvents = new EventManager()
2727
this.onload()
@@ -123,14 +123,18 @@ export class CircomPluginClient extends PluginClient {
123123

124124
async compile(path: string, compilationConfig?: CompilationConfig): Promise<void> {
125125
this.internalEvents.emit('circuit_compiling_start')
126+
// @ts-ignore
127+
this.call('terminal', 'log', { type: 'log', value: 'Compiling ' + path })
126128
const [parseErrors, filePathToId] = await this.parse(path)
127129

128130
if (parseErrors && (parseErrors.length > 0)) {
129131
if (parseErrors[0].type === 'Error') {
130132
this.internalEvents.emit('circuit_parsing_errored', parseErrors, filePathToId)
133+
this.logCompilerReport(parseErrors)
131134
return
132135
} else if (parseErrors[0].type === 'Warning') {
133136
this.internalEvents.emit('circuit_parsing_warning', parseErrors, filePathToId)
137+
this.logCompilerReport(parseErrors)
134138
}
135139
} else {
136140
this.internalEvents.emit('circuit_parsing_done', parseErrors, filePathToId)
@@ -147,6 +151,7 @@ export class CircomPluginClient extends PluginClient {
147151
if (circuitProgram.length < 1) {
148152
const circuitErrors = circuitApi.report()
149153

154+
this.logCompilerReport(circuitErrors)
150155
throw new Error(circuitErrors)
151156
} else {
152157
this.lastCompiledFile = path
@@ -166,19 +171,28 @@ export class CircomPluginClient extends PluginClient {
166171
} else {
167172
this.internalEvents.emit('circuit_compiling_done', [])
168173
}
174+
circuitApi.log().map(log => {
175+
log && this.call('terminal', 'log', { type: 'log', value: log })
176+
})
177+
// @ts-ignore
178+
this.call('terminal', 'log', { type: 'typewritersuccess', value: 'Everything went okay, circom safe' })
169179
}
170180
}
171181

172182
async generateR1cs (path: string, compilationConfig?: CompilationConfig): Promise<void> {
173183
this.internalEvents.emit('circuit_generating_r1cs_start')
184+
// @ts-ignore
185+
this.call('terminal', 'log', { type: 'log', value: 'Generating R1CS for ' + path })
174186
const [parseErrors, filePathToId] = await this.parse(path)
175187

176188
if (parseErrors && (parseErrors.length > 0)) {
177189
if (parseErrors[0].type === 'Error') {
178190
this.internalEvents.emit('circuit_parsing_errored', parseErrors)
191+
this.logCompilerReport(parseErrors)
179192
return
180193
} else if (parseErrors[0].type === 'Warning') {
181194
this.internalEvents.emit('circuit_parsing_warning', parseErrors)
195+
this.logCompilerReport(parseErrors)
182196
}
183197
} else {
184198
this.internalEvents.emit('circuit_parsing_done', parseErrors, filePathToId)
@@ -195,6 +209,7 @@ export class CircomPluginClient extends PluginClient {
195209
if (r1csProgram.length < 1) {
196210
const r1csErrors = r1csApi.report()
197211

212+
this.logCompilerReport(r1csErrors)
198213
throw new Error(r1csErrors)
199214
} else {
200215
this.internalEvents.emit('circuit_generating_r1cs_done')
@@ -203,6 +218,11 @@ export class CircomPluginClient extends PluginClient {
203218

204219
// @ts-ignore
205220
await this.call('fileManager', 'writeFile', writePath, r1csProgram, true)
221+
r1csApi.log().map(log => {
222+
log && this.call('terminal', 'log', { type: 'log', value: log })
223+
})
224+
// @ts-ignore
225+
this.call('terminal', 'log', { type: 'typewritersuccess', value: 'Everything went okay, circom safe' })
206226
}
207227
}
208228

@@ -373,4 +393,10 @@ export class CircomPluginClient extends PluginClient {
373393
}
374394
}
375395
}
396+
397+
async logCompilerReport (report: CompilerReport[]): Promise<void> {
398+
this.call('terminal', 'log', { type: 'log', value: JSON.stringify(report, null, 2) })
399+
if (report[0].type === 'Error') this.call('terminal', 'log', { type: 'error', value: 'previous errors were found' })
400+
if (report[0].type === 'Warning') this.call('terminal', 'log', { type: 'log', value: 'previous warnings were found' })
401+
}
376402
}

apps/circuit-compiler/src/app/types/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { compiler_list } from 'circom_wasm'
22
import {Dispatch} from 'react'
3-
import { CircomPluginClient } from '../services/circomPluginClient'
3+
import type { CircomPluginClient } from '../services/circomPluginClient'
44

55
export type CompilerStatus = "compiling" | "generating" | "computing" | "idle" | "errored" | "warning"
66
export interface ICircuitAppContext {
@@ -51,7 +51,8 @@ export type CompilerFeedbackProps = {
5151
feedback: string | CompilerReport[],
5252
filePathToId: Record<string, string>,
5353
openErrorLocation: (location: string, startRange: string) => void,
54-
hideWarnings: boolean
54+
hideWarnings: boolean,
55+
askGPT: (report: CompilerReport) => void
5556
}
5657

5758
export type CompilerReport = {
@@ -71,7 +72,8 @@ export type CompilerReport = {
7172

7273
export type FeedbackAlertProps = {
7374
message: string,
74-
location: string
75+
location: string,
76+
askGPT: () => void
7577
}
7678

7779
export type ConfigurationsProps = {

apps/circuit-compiler/src/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
crossorigin="anonymous" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css">
1313
</head>
1414
<body>
15+
<script>
16+
var global = window
17+
</script>
1518
<div id="root"></div>
1619
<script src="snarkjs.min.js"> </script>
1720
<script src="https://kit.fontawesome.com/41dd021e94.js" crossorigin="anonymous"></script>

0 commit comments

Comments
 (0)