Skip to content

Commit 864d639

Browse files
authored
Merge branch 'master' into feat/nx-cloud/setup
2 parents 3376db6 + 4998811 commit 864d639

File tree

33 files changed

+223
-136
lines changed

33 files changed

+223
-136
lines changed

.github/workflows/pr-reminder.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: PRs reviews reminder
33
on:
44
schedule:
55
- cron: "0 8 * * 1-5"
6-
- cron: '50 8 * * 1-5'
6+
- cron: '52 9 * * 1-5'
77
workflow_dispatch:
88

99
jobs:
@@ -19,7 +19,7 @@ jobs:
1919
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
2020
freeze-date: '2025-07-21T18:00:00Z'
2121
- name: Reminder for standup
22-
if: github.event.schedule == '50 8 * * 1-5'
22+
if: github.event.schedule == '52 9 * * 1-5'
2323
uses: Aniket-Engg/pr-reviews-reminder-action@master
2424
env:
2525
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const computeWitness = async (plugin: CircomPluginClient, appState: AppSt
3333
const writePath = extractParentFromKey(appState.filePath) + `/.bin/${fileName.replace('.circom', '_js')}/${fileName.replace('.circom', '.wtn.json')}`
3434

3535
await plugin.call('fileManager', 'writeFile', writePath, JSON.stringify(wtnsJson, null, 2))
36-
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'computeWitness', name: 'wtns.exportJson', value: writePath, isClick: true })
36+
trackMatomoEvent(plugin, { category: 'circuit-compiler', action: 'compiler.generate_witness', name: 'wtns.exportJson', value: writePath, isClick: true })
3737
}
3838
} else {
3939
console.log('Existing witness computation in progress')
@@ -62,46 +62,46 @@ export const runSetupAndExport = async (plugin: CircomPluginClient, appState: Ap
6262
const zkey_final = { type: "mem" }
6363

6464
if (appState.provingScheme === 'groth16') {
65-
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'runSetupAndExport', name: 'provingScheme', value: 'groth16', isClick: true })
65+
trackMatomoEvent(plugin, { category: 'circuit-compiler', action: 'runSetupAndExport', name: 'provingScheme', value: 'groth16', isClick: true })
6666
await snarkjs.zKey.newZKey(r1cs, ptau_final, zkey_final, zkLogger(plugin, dispatch, 'SET_SETUP_EXPORT_FEEDBACK'))
6767
const vKey = await snarkjs.zKey.exportVerificationKey(zkey_final, zkLogger(plugin, dispatch, 'SET_SETUP_EXPORT_FEEDBACK'))
6868

6969
if (appState.exportVerificationKey) {
7070
await plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/groth16/zk/keys/verification_key.json`, JSON.stringify(vKey, null, 2))
71-
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'runSetupAndExport', name: 'zKey.exportVerificationKey', value: `${extractParentFromKey(appState.filePath)}/groth16/zk/keys/verification_key.json`, isClick: true })
71+
trackMatomoEvent(plugin, { category: 'circuit-compiler', action: 'runSetupAndExport', name: 'zKey.exportVerificationKey', value: `${extractParentFromKey(appState.filePath)}/groth16/zk/keys/verification_key.json`, isClick: true })
7272
}
7373
if (appState.exportVerificationContract) {
7474
const templates = { groth16: GROTH16_VERIFIER }
7575
const solidityContract = await snarkjs.zKey.exportSolidityVerifier(zkey_final, templates, zkLogger(plugin, dispatch, 'SET_SETUP_EXPORT_FEEDBACK'))
7676

7777
await plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/groth16/zk/build/zk_verifier.sol`, solidityContract)
78-
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'runSetupAndExport', name: 'zKey.exportSolidityVerifier', value: `${extractParentFromKey(appState.filePath)}/groth16/zk/build/zk_verifier.sol`, isClick: true })
78+
trackMatomoEvent(plugin, { category: 'circuit-compiler', action: 'runSetupAndExport', name: 'zKey.exportSolidityVerifier', value: `${extractParentFromKey(appState.filePath)}/groth16/zk/build/zk_verifier.sol`, isClick: true })
7979
}
8080
dispatch({ type: 'SET_ZKEY', payload: zkey_final })
8181
dispatch({ type: 'SET_VERIFICATION_KEY', payload: vKey })
8282
} else if (appState.provingScheme === 'plonk') {
83-
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'runSetupAndExport', name: 'provingScheme', value: 'plonk', isClick: true })
83+
trackMatomoEvent(plugin, { category: 'circuit-compiler', action: 'runSetupAndExport', name: 'provingScheme', value: 'plonk', isClick: true })
8484
await snarkjs.plonk.setup(r1cs, ptau_final, zkey_final, zkLogger(plugin, dispatch, 'SET_SETUP_EXPORT_FEEDBACK'))
8585
const vKey = await snarkjs.zKey.exportVerificationKey(zkey_final, zkLogger(plugin, dispatch, 'SET_SETUP_EXPORT_FEEDBACK'))
8686

8787
if (appState.exportVerificationKey) {
8888
await plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/plonk/zk/keys/verification_key.json`, JSON.stringify(vKey, null, 2))
89-
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'runSetupAndExport', name: 'zKey.exportVerificationKey', value: `${extractParentFromKey(appState.filePath)}/plonk/zk/keys/verification_key.json`, isClick: true })
89+
trackMatomoEvent(plugin, { category: 'circuit-compiler', action: 'runSetupAndExport', name: 'zKey.exportVerificationKey', value: `${extractParentFromKey(appState.filePath)}/plonk/zk/keys/verification_key.json`, isClick: true })
9090
}
9191
if (appState.exportVerificationContract) {
9292
const templates = { plonk: PLONK_VERIFIER }
9393
const solidityContract = await snarkjs.zKey.exportSolidityVerifier(zkey_final, templates, zkLogger(plugin, dispatch, 'SET_SETUP_EXPORT_FEEDBACK'))
9494

9595
await plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/plonk/zk/build/zk_verifier.sol`, solidityContract)
96-
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'runSetupAndExport', name: 'zKey.exportSolidityVerifier', value: `${extractParentFromKey(appState.filePath)}/plonk/zk/build/zk_verifier.sol`, isClick: true })
96+
trackMatomoEvent(plugin, { category: 'circuit-compiler', action: 'runSetupAndExport', name: 'zKey.exportSolidityVerifier', value: `${extractParentFromKey(appState.filePath)}/plonk/zk/build/zk_verifier.sol`, isClick: true })
9797
}
9898
dispatch({ type: 'SET_ZKEY', payload: zkey_final })
9999
dispatch({ type: 'SET_VERIFICATION_KEY', payload: vKey })
100100
}
101101
dispatch({ type: 'SET_COMPILER_STATUS', payload: 'idle' })
102102
dispatch({ type: 'SET_SETUP_EXPORT_STATUS', payload: 'done' })
103103
} catch (e) {
104-
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'runSetupAndExport', name: 'error', value: e.message, isClick: true })
104+
trackMatomoEvent(plugin, { category: 'circuit-compiler', action: 'runSetupAndExport', name: 'error', value: e.message, isClick: true })
105105
dispatch({ type: 'SET_COMPILER_STATUS', payload: 'errored' })
106106
console.error(e)
107107
}
@@ -133,25 +133,25 @@ export const generateProof = async (plugin: CircomPluginClient, appState: AppSta
133133

134134
plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/groth16/zk/build/proof.json`, JSON.stringify(proof, null, 2))
135135
plugin.call('terminal', 'log', { type: 'log', value: 'zk proof validity ' + verified })
136-
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'generateProof', name: 'groth16.prove', value: verified, isClick: true })
136+
trackMatomoEvent(plugin, { category: 'circuit-compiler', action: 'generateProof', name: 'groth16.prove', value: verified, isClick: true })
137137
if (appState.exportVerifierCalldata) {
138138
const calldata = await snarkjs.groth16.exportSolidityCallData(proof, publicSignals)
139139

140140
plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/groth16/zk/build/verifierCalldata.json`, calldata)
141-
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'generateProof', name: 'groth16.exportSolidityCallData', value: `${extractParentFromKey(appState.filePath)}/groth16/zk/build/verifierCalldata.json`, isClick: true })
141+
trackMatomoEvent(plugin, { category: 'circuit-compiler', action: 'generateProof', name: 'groth16.exportSolidityCallData', value: `${extractParentFromKey(appState.filePath)}/groth16/zk/build/verifierCalldata.json`, isClick: true })
142142
}
143143
} else if (appState.provingScheme === 'plonk') {
144144
const { proof, publicSignals } = await snarkjs.plonk.prove(zkey_final, wtns, zkLogger(plugin, dispatch, 'SET_PROOF_FEEDBACK'))
145145
const verified = await snarkjs.plonk.verify(vKey, publicSignals, proof, zkLogger(plugin, dispatch, 'SET_PROOF_FEEDBACK'))
146146

147147
plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/plonk/zk/build/proof.json`, JSON.stringify(proof, null, 2))
148148
plugin.call('terminal', 'log', { type: 'log', value: 'zk proof validity ' + verified })
149-
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'generateProof', name: 'plonk.prove', value: verified, isClick: true })
149+
trackMatomoEvent(plugin, { category: 'circuit-compiler', action: 'generateProof', name: 'plonk.prove', value: verified, isClick: true })
150150
if (appState.exportVerifierCalldata) {
151151
const calldata = await snarkjs.plonk.exportSolidityCallData(proof, publicSignals)
152152

153153
plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/plonk/zk/build/verifierCalldata.json`, calldata)
154-
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'generateProof', name: 'plonk.exportSolidityCallData', value: `${extractParentFromKey(appState.filePath)}/plonk/zk/build/verifierCalldata.json`, isClick: true })
154+
trackMatomoEvent(plugin, { category: 'circuit-compiler', action: 'generateProof', name: 'plonk.exportSolidityCallData', value: `${extractParentFromKey(appState.filePath)}/plonk/zk/build/verifierCalldata.json`, isClick: true })
155155
}
156156
}
157157
dispatch({ type: 'SET_COMPILER_STATUS', payload: 'idle' })

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export class CircomPluginClient extends PluginClient {
171171
const circuitErrors = circuitApi.report()
172172

173173
this.logCompilerReport(circuitErrors)
174-
trackMatomoEvent(this, { category: 'circuitCompiler', action: 'compile', name: 'Compilation failed', isClick: true })
174+
trackMatomoEvent(this, { category: 'circuit-compiler', action: 'compile', name: 'Compilation failed', isClick: true })
175175
throw new Error(circuitErrors)
176176
} else {
177177
this.lastCompiledFile = path
@@ -200,7 +200,7 @@ export class CircomPluginClient extends PluginClient {
200200
this.internalEvents.emit('circuit_parsing_done', parseErrors, filePathToId)
201201
this.emit('statusChanged', { key: 'succeed', title: 'circuit compiled successfully', type: 'success' })
202202
}
203-
trackMatomoEvent(this, { category: 'circuitCompiler', action: 'compile', name: 'Compilation successful', isClick: true })
203+
trackMatomoEvent(this, { category: 'circuit-compiler', action: 'compile', name: 'Compilation successful', isClick: true })
204204
circuitApi.log().map(log => {
205205
log && this.call('terminal', 'log', { type: 'log', value: log })
206206
})
@@ -282,15 +282,15 @@ export class CircomPluginClient extends PluginClient {
282282
const r1csErrors = r1csApi.report()
283283

284284
this.logCompilerReport(r1csErrors)
285-
trackMatomoEvent(this, { category: 'circuitCompiler', action: 'generateR1cs', name: 'R1CS Generation failed', isClick: true })
285+
trackMatomoEvent(this, { category: 'circuit-compiler', action: 'generateR1cs', name: 'R1CS Generation failed', isClick: true })
286286
throw new Error(r1csErrors)
287287
} else {
288288
const fileName = extractNameFromKey(path)
289289
const writePath = extractParentFromKey(path) + "/.bin/" + fileName.replace('.circom', '.r1cs')
290290

291291
// @ts-ignore
292292
await this.call('fileManager', 'writeFile', writePath, r1csProgram, true)
293-
trackMatomoEvent(this, { category: 'circuitCompiler', action: 'generateR1cs', name: 'R1CS Generation successful', isClick: true })
293+
trackMatomoEvent(this, { category: 'circuit-compiler', action: 'generateR1cs', name: 'R1CS Generation successful', isClick: true })
294294
r1csApi.log().map(log => {
295295
log && this.call('terminal', 'log', { type: 'log', value: log })
296296
})
@@ -338,7 +338,7 @@ export class CircomPluginClient extends PluginClient {
338338
const witness = this.compiler ? await this.compiler.generate_witness(dataRead, input) : await generate_witness(dataRead, input)
339339
// @ts-ignore
340340
await this.call('fileManager', 'writeFile', wasmPath.replace('.wasm', '.wtn'), witness, { encoding: null })
341-
trackMatomoEvent(this, { category: 'circuitCompiler', action: 'computeWitness', name: wasmPath.replace('.wasm', '.wtn'), isClick: true })
341+
trackMatomoEvent(this, { category: 'circuit-compiler', action: 'compiler.generate_witness', name: wasmPath.replace('.wasm', '.wtn'), isClick: true })
342342
this.internalEvents.emit('circuit_computing_witness_done')
343343
this.emit('statusChanged', { key: 'succeed', title: 'witness computed successfully', type: 'success' })
344344
return witness

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { CompilerAbstract } from '@remix-project/remix-solidity'
99

1010
export class ContractVerificationPluginClient extends PluginClient {
1111
public internalEvents: EventManager
12+
private _isActivated: boolean = false
1213

1314
constructor() {
1415
super()
@@ -19,9 +20,14 @@ export class ContractVerificationPluginClient extends PluginClient {
1920
}
2021

2122
onActivation(): void {
23+
this._isActivated = true
2224
this.internalEvents.emit('verification_activated')
2325
}
2426

27+
isActivated(): boolean {
28+
return this._isActivated
29+
}
30+
2531
async lookupAndSave(verifierId: string, chainId: string, contractAddress: string): Promise<LookupResponse> {
2632
const canonicalVerifierId = VERIFIERS.find((id) => id.toLowerCase() === verifierId.toLowerCase())
2733
if (!canonicalVerifierId) {

apps/contract-verification/src/app/app.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const App = () => {
4141
const timer = useRef(null)
4242

4343
useEffect(() => {
44-
plugin.internalEvents.on('verification_activated', () => {
44+
const initializePlugin = () => {
4545
// @ts-ignore
4646
plugin.call('locale', 'currentLocale').then((locale: any) => {
4747
setLocale(locale)
@@ -51,6 +51,7 @@ const App = () => {
5151
plugin.on('locale', 'localeChanged', (locale: any) => {
5252
setLocale(locale)
5353
})
54+
5455
// Fetch compiler artefacts initially
5556
plugin.call('compilerArtefacts' as any, 'getAllCompilerAbstracts').then((obj: any) => {
5657
setCompilationOutput(obj)
@@ -60,7 +61,17 @@ const App = () => {
6061
plugin.on('compilerArtefacts' as any, 'compilationSaved', (compilerAbstracts: { [key: string]: CompilerAbstract }) => {
6162
setCompilationOutput((prev) => ({ ...(prev || {}), ...compilerAbstracts }))
6263
})
63-
})
64+
}
65+
66+
// Check if plugin is already activated
67+
if (plugin.isActivated()) {
68+
initializePlugin()
69+
} else {
70+
// Listen for activation event if not yet activated
71+
plugin.internalEvents.once('verification_activated', () => {
72+
initializePlugin()
73+
})
74+
}
6475

6576
// Fetch chains.json and update state
6677
fetch('https://chainid.network/chains.json')

apps/learneth/src/redux/models/remixide.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const Model: ModelType = {
6969
return
7070
}
7171

72-
trackMatomoEvent(remixClient, { category: 'learneth', action: 'displayFile', name: `${(step && step.name)}/${path}`, isClick: true })
72+
trackMatomoEvent(remixClient, { category: 'learneth', action: 'display_file', name: `${(step && step.name)}/${path}`, isClick: true })
7373

7474
toast.info(`loading ${path} into IDE`)
7575
yield put({
@@ -96,7 +96,7 @@ const Model: ModelType = {
9696
})
9797
toast.dismiss()
9898
} catch (error) {
99-
trackMatomoEvent(remixClient, { category: 'learneth', action: 'displayFileError', name: error.message, isClick: false })
99+
trackMatomoEvent(remixClient, { category: 'learneth', action: 'display_file_error', name: error.message, isClick: false })
100100
toast.dismiss()
101101
toast.error('File could not be loaded. Please try again.')
102102
yield put({
@@ -146,7 +146,7 @@ const Model: ModelType = {
146146
type: 'remixide/save',
147147
payload: { errors: ['Compiler failed to test this file']},
148148
});
149-
trackMatomoEvent(remixClient, { category: 'learneth', action: 'testStepError', name: 'Compiler failed to test this file', isClick: false })
149+
trackMatomoEvent(remixClient, { category: 'learneth', action: 'test_step_error', name: 'Compiler failed to test this file', isClick: false })
150150
} else {
151151
const success = result.totalFailing === 0;
152152
if (success) {
@@ -162,14 +162,14 @@ const Model: ModelType = {
162162
},
163163
})
164164
}
165-
trackMatomoEvent(remixClient, { category: 'learneth', action: 'testStep', name: String(success), isClick: true })
165+
trackMatomoEvent(remixClient, { category: 'learneth', action: 'test_step', name: String(success), isClick: true })
166166
}
167167
} catch (err) {
168168
yield put({
169169
type: 'remixide/save',
170170
payload: { errors: [String(err)]},
171171
});
172-
trackMatomoEvent(remixClient, { category: 'learneth', action: 'testStepError', name: String(err), isClick: false })
172+
trackMatomoEvent(remixClient, { category: 'learneth', action: 'test_step_error', name: String(err), isClick: false })
173173
}
174174
yield put({
175175
type: 'loading/save',
@@ -199,13 +199,13 @@ const Model: ModelType = {
199199
yield remixClient.call('fileManager', 'setFile', path, content)
200200
yield remixClient.call('fileManager', 'switchFile', `${path}`);
201201

202-
trackMatomoEvent(remixClient, { category: 'learneth', action: 'showAnswer', name: path, isClick: true })
202+
trackMatomoEvent(remixClient, { category: 'learneth', action: 'show_answer', name: path, isClick: true })
203203
} catch (err) {
204204
yield put({
205205
type: 'remixide/save',
206206
payload: { errors: [String(err)]},
207207
});
208-
trackMatomoEvent(remixClient, { category: 'learneth', action: 'showAnswerError', name: err.message, isClick: false })
208+
trackMatomoEvent(remixClient, { category: 'learneth', action: 'show_answer_error', name: err.message, isClick: false })
209209
}
210210

211211
toast.dismiss()
@@ -219,7 +219,7 @@ const Model: ModelType = {
219219
*testSolidityCompiler(_, { put, select }) {
220220
try {
221221
yield remixClient.call('solidity', 'getCompilationResult');
222-
trackMatomoEvent(remixClient, { category: 'learneth', action: 'testSolidityCompiler', isClick: true })
222+
trackMatomoEvent(remixClient, { category: 'learneth', action: 'test_solidity_compiler', isClick: true })
223223
} catch (err) {
224224
const errors = yield select((state) => state.remixide.errors)
225225
yield put({
@@ -228,7 +228,7 @@ const Model: ModelType = {
228228
errors: [...errors, "The `Solidity Compiler` is not yet activated.<br>Please activate it using the `SOLIDITY` button in the `Featured Plugins` section of the homepage.<img class='img-thumbnail mt-3' src='assets/activatesolidity.png'>"],
229229
},
230230
});
231-
trackMatomoEvent(remixClient, { category: 'learneth', action: 'testSolidityCompilerError', name: err.message, isClick: false })
231+
trackMatomoEvent(remixClient, { category: 'learneth', action: 'test_solidity_compiler_error', name: err.message, isClick: false })
232232
}
233233
}
234234
},

0 commit comments

Comments
 (0)