Skip to content

Commit ced39aa

Browse files
authored
Merge branch 'master' into use-textdecoder-decoding-code-param-payload
2 parents 32fcc32 + 967b651 commit ced39aa

File tree

175 files changed

+8179
-1622
lines changed

Some content is hidden

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

175 files changed

+8179
-1622
lines changed

.circleci/config.yml

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ parameters:
1515
run_flaky_tests:
1616
type: boolean
1717
default: false
18+
run_lint_only:
19+
type: boolean
20+
default: false
21+
run_build_only:
22+
type: boolean
23+
default: false
1824
resource_class:
1925
type: enum
2026
enum: ["small", "medium", "medium+", "large", "xlarge", "2xlarge"]
@@ -367,7 +373,7 @@ workflows:
367373
job: ["nogroup"]
368374
jobsize: ["1"]
369375
parallelism: [1]
370-
scriptparameter: ["\\.pr"]
376+
scriptparameter: ["\\.pr\\.js$"]
371377

372378
run_flaky_tests:
373379
when: << pipeline.parameters.run_flaky_tests >>
@@ -382,7 +388,7 @@ workflows:
382388
- build
383389
matrix:
384390
parameters:
385-
browser: ["chrome", "firefox"]
391+
browser: ["chrome"]
386392
script: ["singletest.sh"]
387393
job: ["nogroup"]
388394
jobsize: ["1"]
@@ -433,14 +439,29 @@ workflows:
433439
requires:
434440
- build
435441
matrix:
436-
alias: browser-tests
442+
alias: chrome-tests
437443
parameters:
438-
browser: ["chrome", "firefox"]
444+
browser: ["chrome"]
439445
script: ["browser_test.sh"]
440446
job: ["0","1","2","3","4","5","6","7","8","9"]
441447
jobsize: ["10"]
442448
parallelism: [15]
443449
scriptparameter: [""]
450+
- remix-ide-browser:
451+
requires:
452+
- build
453+
matrix:
454+
alias: firefox-tests
455+
parameters:
456+
browser: ["firefox"]
457+
script: ["browser_test.sh"]
458+
job: ["0","1","2","3","4","5","6","7","8","9"]
459+
jobsize: ["10"]
460+
parallelism: [15]
461+
scriptparameter: [""]
462+
filters:
463+
branches:
464+
only: ['master', 'remix_live', 'remix_beta', 'remix_alpha']
444465
- remix-ide-browser:
445466
requires:
446467
- build
@@ -460,7 +481,8 @@ workflows:
460481
requires:
461482
- lint
462483
- remix-libs
463-
- browser-tests
484+
- chrome-tests
485+
- firefox-tests
464486
- metamask
465487
- plugins
466488

@@ -474,7 +496,8 @@ workflows:
474496
requires:
475497
- lint
476498
- remix-libs
477-
- browser-tests
499+
- chrome-tests
500+
- firefox-tests
478501
- metamask
479502
- plugins
480503
- predeploy
@@ -487,7 +510,8 @@ workflows:
487510
requires:
488511
- lint
489512
- remix-libs
490-
- browser-tests
513+
- chrome-tests
514+
- firefox-tests
491515
- metamask
492516
- plugins
493517
- predeploy
@@ -500,12 +524,23 @@ workflows:
500524
requires:
501525
- lint
502526
- remix-libs
503-
- browser-tests
527+
- chrome-tests
528+
- firefox-tests
504529
- metamask
505530
- plugins
506531
- predeploy
507532
filters:
508533
branches:
509534
only: remix_beta
510535

536+
lint_only:
537+
when: << pipeline.parameters.run_lint_only >>
538+
jobs:
539+
- lint
540+
541+
build_only:
542+
when: << pipeline.parameters.run_build_only >>
543+
jobs:
544+
- build
545+
511546
# VS Code Extension Version: 1.5.1

.eslintrc.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,24 @@
6060
"object-curly-spacing": ["error", "always", { "arraysInObjects": false }],
6161
"no-trailing-spaces": "error",
6262
"no-multi-spaces": "error",
63-
"no-multiple-empty-lines": ["error" , { "max": 1}]
63+
"no-multiple-empty-lines": ["error" , { "max": 1}],
64+
"no-restricted-syntax": [
65+
"error",
66+
{
67+
"selector": "MemberExpression[object.type='Identifier'][object.name='window'][property.type='Identifier'][property.name='_paq']",
68+
"message": "Direct usage of window._paq is not allowed. Use one of these alternatives instead:\n 1. TrackingContext: track(eventBuilder)\n 2. MatomoManager: matomoManager.trackEvent(...)\n 3. Matomo Plugin: plugin.call('matomo', 'track', ...)\n 4. Helper: trackMatomoEvent(plugin, eventBuilder)"
69+
},
70+
{
71+
"selector": "MemberExpression[object.type='MemberExpression'][object.object.type='Identifier'][object.object.name='window'][object.property.type='Identifier'][object.property.name='_paq']",
72+
"message": "Direct usage of window._paq methods is not allowed. Use one of these alternatives instead:\n 1. TrackingContext: track(eventBuilder)\n 2. MatomoManager: matomoManager.trackEvent(...)\n 3. Matomo Plugin: plugin.call('matomo', 'track', ...)\n 4. Helper: trackMatomoEvent(plugin, eventBuilder)"
73+
}
74+
]
75+
}
76+
},
77+
{
78+
"files": ["**/src/app/matomo/*.ts", "**/src/assets/js/**/*.js"],
79+
"rules": {
80+
"no-restricted-syntax": "off"
6481
}
6582
},
6683
{

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,4 @@ apps/remix-ide-e2e/tmp/
8282

8383
# IDE - Cursor
8484
.cursor/
85+
PR_MESSAGE.md

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { CircomPluginClient } from "../services/circomPluginClient"
33
import { ActionPayloadTypes, AppState, ICircuitAppContext } from "../types"
44
import { GROTH16_VERIFIER, PLONK_VERIFIER } from './constant'
55
import { extractNameFromKey, extractParentFromKey } from '@remix-ui/helper'
6+
import { trackMatomoEvent } from '@remix-api'
67
import isElectron from 'is-electron'
78

89
export const compileCircuit = async (plugin: CircomPluginClient, appState: AppState) => {
@@ -32,7 +33,7 @@ export const computeWitness = async (plugin: CircomPluginClient, appState: AppSt
3233
const writePath = extractParentFromKey(appState.filePath) + `/.bin/${fileName.replace('.circom', '_js')}/${fileName.replace('.circom', '.wtn.json')}`
3334

3435
await plugin.call('fileManager', 'writeFile', writePath, JSON.stringify(wtnsJson, null, 2))
35-
plugin._paq.push(['trackEvent', 'circuit-compiler', 'computeWitness', 'wtns.exportJson', writePath])
36+
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'computeWitness', name: 'wtns.exportJson', value: writePath, isClick: true })
3637
}
3738
} else {
3839
console.log('Existing witness computation in progress')
@@ -61,46 +62,46 @@ export const runSetupAndExport = async (plugin: CircomPluginClient, appState: Ap
6162
const zkey_final = { type: "mem" }
6263

6364
if (appState.provingScheme === 'groth16') {
64-
plugin._paq.push(['trackEvent', 'circuit-compiler', 'runSetupAndExport', 'provingScheme', 'groth16'])
65+
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'runSetupAndExport', name: 'provingScheme', value: 'groth16', isClick: true })
6566
await snarkjs.zKey.newZKey(r1cs, ptau_final, zkey_final, zkLogger(plugin, dispatch, 'SET_SETUP_EXPORT_FEEDBACK'))
6667
const vKey = await snarkjs.zKey.exportVerificationKey(zkey_final, zkLogger(plugin, dispatch, 'SET_SETUP_EXPORT_FEEDBACK'))
6768

6869
if (appState.exportVerificationKey) {
6970
await plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/groth16/zk/keys/verification_key.json`, JSON.stringify(vKey, null, 2))
70-
plugin._paq.push(['trackEvent', 'circuit-compiler', 'runSetupAndExport', 'zKey.exportVerificationKey', `${extractParentFromKey(appState.filePath)}/groth16/zk/keys/verification_key.json`])
71+
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'runSetupAndExport', name: 'zKey.exportVerificationKey', value: `${extractParentFromKey(appState.filePath)}/groth16/zk/keys/verification_key.json`, isClick: true })
7172
}
7273
if (appState.exportVerificationContract) {
7374
const templates = { groth16: GROTH16_VERIFIER }
7475
const solidityContract = await snarkjs.zKey.exportSolidityVerifier(zkey_final, templates, zkLogger(plugin, dispatch, 'SET_SETUP_EXPORT_FEEDBACK'))
7576

7677
await plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/groth16/zk/build/zk_verifier.sol`, solidityContract)
77-
plugin._paq.push(['trackEvent', 'circuit-compiler', 'runSetupAndExport', 'zKey.exportSolidityVerifier', `${extractParentFromKey(appState.filePath)}/groth16/zk/build/zk_verifier.sol`])
78+
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'runSetupAndExport', name: 'zKey.exportSolidityVerifier', value: `${extractParentFromKey(appState.filePath)}/groth16/zk/build/zk_verifier.sol`, isClick: true })
7879
}
7980
dispatch({ type: 'SET_ZKEY', payload: zkey_final })
8081
dispatch({ type: 'SET_VERIFICATION_KEY', payload: vKey })
8182
} else if (appState.provingScheme === 'plonk') {
82-
plugin._paq.push(['trackEvent', 'circuit-compiler', 'runSetupAndExport', 'provingScheme', 'plonk'])
83+
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'runSetupAndExport', name: 'provingScheme', value: 'plonk', isClick: true })
8384
await snarkjs.plonk.setup(r1cs, ptau_final, zkey_final, zkLogger(plugin, dispatch, 'SET_SETUP_EXPORT_FEEDBACK'))
8485
const vKey = await snarkjs.zKey.exportVerificationKey(zkey_final, zkLogger(plugin, dispatch, 'SET_SETUP_EXPORT_FEEDBACK'))
8586

8687
if (appState.exportVerificationKey) {
8788
await plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/plonk/zk/keys/verification_key.json`, JSON.stringify(vKey, null, 2))
88-
plugin._paq.push(['trackEvent', 'circuit-compiler', 'runSetupAndExport', 'zKey.exportVerificationKey', `${extractParentFromKey(appState.filePath)}/plonk/zk/keys/verification_key.json`])
89+
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'runSetupAndExport', name: 'zKey.exportVerificationKey', value: `${extractParentFromKey(appState.filePath)}/plonk/zk/keys/verification_key.json`, isClick: true })
8990
}
9091
if (appState.exportVerificationContract) {
9192
const templates = { plonk: PLONK_VERIFIER }
9293
const solidityContract = await snarkjs.zKey.exportSolidityVerifier(zkey_final, templates, zkLogger(plugin, dispatch, 'SET_SETUP_EXPORT_FEEDBACK'))
9394

9495
await plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/plonk/zk/build/zk_verifier.sol`, solidityContract)
95-
plugin._paq.push(['trackEvent', 'circuit-compiler', 'runSetupAndExport', 'zKey.exportSolidityVerifier', `${extractParentFromKey(appState.filePath)}/plonk/zk/build/zk_verifier.sol`])
96+
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'runSetupAndExport', name: 'zKey.exportSolidityVerifier', value: `${extractParentFromKey(appState.filePath)}/plonk/zk/build/zk_verifier.sol`, isClick: true })
9697
}
9798
dispatch({ type: 'SET_ZKEY', payload: zkey_final })
9899
dispatch({ type: 'SET_VERIFICATION_KEY', payload: vKey })
99100
}
100101
dispatch({ type: 'SET_COMPILER_STATUS', payload: 'idle' })
101102
dispatch({ type: 'SET_SETUP_EXPORT_STATUS', payload: 'done' })
102103
} catch (e) {
103-
plugin._paq.push(['trackEvent', 'circuit-compiler', 'runSetupAndExport', 'error', e.message])
104+
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'runSetupAndExport', name: 'error', value: e.message, isClick: true })
104105
dispatch({ type: 'SET_COMPILER_STATUS', payload: 'errored' })
105106
console.error(e)
106107
}
@@ -132,25 +133,25 @@ export const generateProof = async (plugin: CircomPluginClient, appState: AppSta
132133

133134
plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/groth16/zk/build/proof.json`, JSON.stringify(proof, null, 2))
134135
plugin.call('terminal', 'log', { type: 'log', value: 'zk proof validity ' + verified })
135-
plugin._paq.push(['trackEvent', 'circuit-compiler', 'generateProof', 'groth16.prove', verified])
136+
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'generateProof', name: 'groth16.prove', value: verified, isClick: true })
136137
if (appState.exportVerifierCalldata) {
137138
const calldata = await snarkjs.groth16.exportSolidityCallData(proof, publicSignals)
138139

139140
plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/groth16/zk/build/verifierCalldata.json`, calldata)
140-
plugin._paq.push(['trackEvent', 'circuit-compiler', 'generateProof', 'groth16.exportSolidityCallData', `${extractParentFromKey(appState.filePath)}/groth16/zk/build/verifierCalldata.json`])
141+
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'generateProof', name: 'groth16.exportSolidityCallData', value: `${extractParentFromKey(appState.filePath)}/groth16/zk/build/verifierCalldata.json`, isClick: true })
141142
}
142143
} else if (appState.provingScheme === 'plonk') {
143144
const { proof, publicSignals } = await snarkjs.plonk.prove(zkey_final, wtns, zkLogger(plugin, dispatch, 'SET_PROOF_FEEDBACK'))
144145
const verified = await snarkjs.plonk.verify(vKey, publicSignals, proof, zkLogger(plugin, dispatch, 'SET_PROOF_FEEDBACK'))
145146

146147
plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/plonk/zk/build/proof.json`, JSON.stringify(proof, null, 2))
147148
plugin.call('terminal', 'log', { type: 'log', value: 'zk proof validity ' + verified })
148-
plugin._paq.push(['trackEvent', 'circuit-compiler', 'generateProof', 'plonk.prove', verified])
149+
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'generateProof', name: 'plonk.prove', value: verified, isClick: true })
149150
if (appState.exportVerifierCalldata) {
150151
const calldata = await snarkjs.plonk.exportSolidityCallData(proof, publicSignals)
151152

152153
plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/plonk/zk/build/verifierCalldata.json`, calldata)
153-
plugin._paq.push(['trackEvent', 'circuit-compiler', 'generateProof', 'plonk.exportSolidityCallData', `${extractParentFromKey(appState.filePath)}/plonk/zk/build/verifierCalldata.json`])
154+
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'generateProof', name: 'plonk.exportSolidityCallData', value: `${extractParentFromKey(appState.filePath)}/plonk/zk/build/verifierCalldata.json`, isClick: true })
154155
}
155156
}
156157
dispatch({ type: 'SET_COMPILER_STATUS', payload: 'idle' })

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { PluginClient } from '@remixproject/plugin'
22
import { createClient } from '@remixproject/plugin-webview'
3+
import { trackMatomoEvent } from '@remix-api'
34
import EventManager from 'events'
45
import pathModule from 'path'
56
import { compiler_list, parse, compile, generate_r1cs, generate_witness } from 'circom_wasm'
@@ -21,11 +22,6 @@ export class CircomPluginClient extends PluginClient {
2122
private lastParsedFiles: Record<string, string> = {}
2223
private lastCompiledFile: string = ''
2324
private compiler: typeof compilerV215 & typeof compilerV216 & typeof compilerV217 & typeof compilerV218
24-
public _paq = {
25-
push: (args) => {
26-
this.call('matomo' as any, 'track', args)
27-
}
28-
}
2925

3026
constructor() {
3127
super()
@@ -175,7 +171,7 @@ export class CircomPluginClient extends PluginClient {
175171
const circuitErrors = circuitApi.report()
176172

177173
this.logCompilerReport(circuitErrors)
178-
this._paq.push(['trackEvent', 'circuit-compiler', 'compile', 'Compilation failed'])
174+
trackMatomoEvent(this, { category: 'circuitCompiler', action: 'compile', name: 'Compilation failed', isClick: true })
179175
throw new Error(circuitErrors)
180176
} else {
181177
this.lastCompiledFile = path
@@ -204,7 +200,7 @@ export class CircomPluginClient extends PluginClient {
204200
this.internalEvents.emit('circuit_parsing_done', parseErrors, filePathToId)
205201
this.emit('statusChanged', { key: 'succeed', title: 'circuit compiled successfully', type: 'success' })
206202
}
207-
this._paq.push(['trackEvent', 'circuit-compiler', 'compile', 'Compilation successful'])
203+
trackMatomoEvent(this, { category: 'circuitCompiler', action: 'compile', name: 'Compilation successful', isClick: true })
208204
circuitApi.log().map(log => {
209205
log && this.call('terminal', 'log', { type: 'log', value: log })
210206
})
@@ -286,15 +282,15 @@ export class CircomPluginClient extends PluginClient {
286282
const r1csErrors = r1csApi.report()
287283

288284
this.logCompilerReport(r1csErrors)
289-
this._paq.push(['trackEvent', 'circuit-compiler', 'generateR1cs', 'R1CS Generation failed'])
285+
trackMatomoEvent(this, { category: 'circuitCompiler', action: 'generateR1cs', name: 'R1CS Generation failed', isClick: true })
290286
throw new Error(r1csErrors)
291287
} else {
292288
const fileName = extractNameFromKey(path)
293289
const writePath = extractParentFromKey(path) + "/.bin/" + fileName.replace('.circom', '.r1cs')
294290

295291
// @ts-ignore
296292
await this.call('fileManager', 'writeFile', writePath, r1csProgram, true)
297-
this._paq.push(['trackEvent', 'circuit-compiler', 'generateR1cs', 'R1CS Generation successful'])
293+
trackMatomoEvent(this, { category: 'circuitCompiler', action: 'generateR1cs', name: 'R1CS Generation successful', isClick: true })
298294
r1csApi.log().map(log => {
299295
log && this.call('terminal', 'log', { type: 'log', value: log })
300296
})
@@ -342,7 +338,7 @@ export class CircomPluginClient extends PluginClient {
342338
const witness = this.compiler ? await this.compiler.generate_witness(dataRead, input) : await generate_witness(dataRead, input)
343339
// @ts-ignore
344340
await this.call('fileManager', 'writeFile', wasmPath.replace('.wasm', '.wtn'), witness, { encoding: null })
345-
this._paq.push(['trackEvent', 'circuit-compiler', 'computeWitness', 'compiler.generate_witness', wasmPath.replace('.wasm', '.wtn')])
341+
trackMatomoEvent(this, { category: 'circuitCompiler', action: 'computeWitness', name: wasmPath.replace('.wasm', '.wtn'), isClick: true })
346342
this.internalEvents.emit('circuit_computing_witness_done')
347343
this.emit('statusChanged', { key: 'succeed', title: 'witness computed successfully', type: 'success' })
348344
return witness

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export class ContractVerificationPluginClient extends PluginClient {
169169
await this.call('terminal', 'log', { type: 'log', value: `Verifying with ${providerName}...` })
170170

171171
if (providerName === 'Etherscan' || providerName === 'Routescan' || providerName === 'Blockscout') {
172-
await new Promise(resolve => setTimeout(resolve, 10000))
172+
await new Promise(resolve => setTimeout(resolve, 9000))
173173
}
174174

175175
if (verifier && typeof verifier.verify === 'function') {

apps/contract-verification/src/app/Verifiers/EtherscanVerifier.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export class EtherscanVerifier extends AbstractVerifier {
144144

145145
if (!response.ok) {
146146
const responseText = await response.text()
147-
console.error('Error on Etherscan API check verification status at ' + this.apiUrl + '\nStatus: ' + response.status + '\nResponse: ' + responseText)
147+
console.error('Error on API check verification status at ' + this.apiUrl + '\nStatus: ' + response.status + '\nResponse: ' + responseText)
148148
throw new Error(responseText)
149149
}
150150

@@ -163,12 +163,12 @@ export class EtherscanVerifier extends AbstractVerifier {
163163
return { status: 'already verified', receiptId }
164164
}
165165
if (checkStatusResponse.result === 'Unknown UID') {
166-
console.error('Error on Etherscan API check verification status at ' + this.apiUrl + '\nStatus: ' + checkStatusResponse.status + '\nMessage: ' + checkStatusResponse.message + '\nResult: ' + checkStatusResponse.result)
166+
console.error('Error on API check verification status at ' + this.apiUrl + '\nStatus: ' + checkStatusResponse.status + '\nMessage: ' + checkStatusResponse.message + '\nResult: ' + checkStatusResponse.result)
167167
return { status: 'failed', receiptId, message: checkStatusResponse.result }
168168
}
169169

170170
if (checkStatusResponse.status !== '1' || !checkStatusResponse.message.startsWith('OK')) {
171-
console.error('Error on Etherscan API check verification status at ' + this.apiUrl + '\nStatus: ' + checkStatusResponse.status + '\nMessage: ' + checkStatusResponse.message + '\nResult: ' + checkStatusResponse.result)
171+
console.error('Error on API check verification status at ' + this.apiUrl + '\nStatus: ' + checkStatusResponse.status + '\nMessage: ' + checkStatusResponse.message + '\nResult: ' + checkStatusResponse.result)
172172
throw new Error(checkStatusResponse.result)
173173
}
174174

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ const App = () => {
161161
setSubmittedContracts((prev) => Object.assign({}, prev, changedSubmittedContracts))
162162
}
163163

164-
timer.current = setInterval(pollStatus, 1000)
164+
timer.current = setInterval(pollStatus, 3000)
165165
}
166166
}, [submittedContracts])
167167

0 commit comments

Comments
 (0)