Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions apps/circuit-compiler/src/app/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const computeWitness = async (plugin: CircomPluginClient, appState: AppSt
const writePath = extractParentFromKey(appState.filePath) + `/.bin/${fileName.replace('.circom', '_js')}/${fileName.replace('.circom', '.wtn.json')}`

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

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

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

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

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

await plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/plonk/zk/build/zk_verifier.sol`, solidityContract)
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'runSetupAndExport', name: 'zKey.exportSolidityVerifier', value: `${extractParentFromKey(appState.filePath)}/plonk/zk/build/zk_verifier.sol`, isClick: true })
trackMatomoEvent(plugin, { category: 'circuit-compiler', action: 'runSetupAndExport', name: 'zKey.exportSolidityVerifier', value: `${extractParentFromKey(appState.filePath)}/plonk/zk/build/zk_verifier.sol`, isClick: true })
}
dispatch({ type: 'SET_ZKEY', payload: zkey_final })
dispatch({ type: 'SET_VERIFICATION_KEY', payload: vKey })
}
dispatch({ type: 'SET_COMPILER_STATUS', payload: 'idle' })
dispatch({ type: 'SET_SETUP_EXPORT_STATUS', payload: 'done' })
} catch (e) {
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'runSetupAndExport', name: 'error', value: e.message, isClick: true })
trackMatomoEvent(plugin, { category: 'circuit-compiler', action: 'runSetupAndExport', name: 'error', value: e.message, isClick: true })
dispatch({ type: 'SET_COMPILER_STATUS', payload: 'errored' })
console.error(e)
}
Expand Down Expand Up @@ -133,25 +133,25 @@ export const generateProof = async (plugin: CircomPluginClient, appState: AppSta

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

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

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

plugin.call('fileManager', 'writeFile', `${extractParentFromKey(appState.filePath)}/plonk/zk/build/verifierCalldata.json`, calldata)
trackMatomoEvent(plugin, { category: 'circuitCompiler', action: 'generateProof', name: 'plonk.exportSolidityCallData', value: `${extractParentFromKey(appState.filePath)}/plonk/zk/build/verifierCalldata.json`, isClick: true })
trackMatomoEvent(plugin, { category: 'circuit-compiler', action: 'generateProof', name: 'plonk.exportSolidityCallData', value: `${extractParentFromKey(appState.filePath)}/plonk/zk/build/verifierCalldata.json`, isClick: true })
}
}
dispatch({ type: 'SET_COMPILER_STATUS', payload: 'idle' })
Expand Down
10 changes: 5 additions & 5 deletions apps/circuit-compiler/src/app/services/circomPluginClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export class CircomPluginClient extends PluginClient {
const circuitErrors = circuitApi.report()

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

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

// @ts-ignore
await this.call('fileManager', 'writeFile', writePath, r1csProgram, true)
trackMatomoEvent(this, { category: 'circuitCompiler', action: 'generateR1cs', name: 'R1CS Generation successful', isClick: true })
trackMatomoEvent(this, { category: 'circuit-compiler', action: 'generateR1cs', name: 'R1CS Generation successful', isClick: true })
r1csApi.log().map(log => {
log && this.call('terminal', 'log', { type: 'log', value: log })
})
Expand Down Expand Up @@ -338,7 +338,7 @@ export class CircomPluginClient extends PluginClient {
const witness = this.compiler ? await this.compiler.generate_witness(dataRead, input) : await generate_witness(dataRead, input)
// @ts-ignore
await this.call('fileManager', 'writeFile', wasmPath.replace('.wasm', '.wtn'), witness, { encoding: null })
trackMatomoEvent(this, { category: 'circuitCompiler', action: 'computeWitness', name: wasmPath.replace('.wasm', '.wtn'), isClick: true })
trackMatomoEvent(this, { category: 'circuit-compiler', action: 'compiler.generate_witness', name: wasmPath.replace('.wasm', '.wtn'), isClick: true })
this.internalEvents.emit('circuit_computing_witness_done')
this.emit('statusChanged', { key: 'succeed', title: 'witness computed successfully', type: 'success' })
return witness
Expand Down
18 changes: 9 additions & 9 deletions apps/learneth/src/redux/models/remixide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const Model: ModelType = {
return
}

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

toast.info(`loading ${path} into IDE`)
yield put({
Expand All @@ -96,7 +96,7 @@ const Model: ModelType = {
})
toast.dismiss()
} catch (error) {
trackMatomoEvent(remixClient, { category: 'learneth', action: 'displayFileError', name: error.message, isClick: false })
trackMatomoEvent(remixClient, { category: 'learneth', action: 'display_file_error', name: error.message, isClick: false })
toast.dismiss()
toast.error('File could not be loaded. Please try again.')
yield put({
Expand Down Expand Up @@ -146,7 +146,7 @@ const Model: ModelType = {
type: 'remixide/save',
payload: { errors: ['Compiler failed to test this file']},
});
trackMatomoEvent(remixClient, { category: 'learneth', action: 'testStepError', name: 'Compiler failed to test this file', isClick: false })
trackMatomoEvent(remixClient, { category: 'learneth', action: 'test_step_error', name: 'Compiler failed to test this file', isClick: false })
} else {
const success = result.totalFailing === 0;
if (success) {
Expand All @@ -162,14 +162,14 @@ const Model: ModelType = {
},
})
}
trackMatomoEvent(remixClient, { category: 'learneth', action: 'testStep', name: String(success), isClick: true })
trackMatomoEvent(remixClient, { category: 'learneth', action: 'test_step', name: String(success), isClick: true })
}
} catch (err) {
yield put({
type: 'remixide/save',
payload: { errors: [String(err)]},
});
trackMatomoEvent(remixClient, { category: 'learneth', action: 'testStepError', name: String(err), isClick: false })
trackMatomoEvent(remixClient, { category: 'learneth', action: 'test_step_error', name: String(err), isClick: false })
}
yield put({
type: 'loading/save',
Expand Down Expand Up @@ -199,13 +199,13 @@ const Model: ModelType = {
yield remixClient.call('fileManager', 'setFile', path, content)
yield remixClient.call('fileManager', 'switchFile', `${path}`);

trackMatomoEvent(remixClient, { category: 'learneth', action: 'showAnswer', name: path, isClick: true })
trackMatomoEvent(remixClient, { category: 'learneth', action: 'show_answer', name: path, isClick: true })
} catch (err) {
yield put({
type: 'remixide/save',
payload: { errors: [String(err)]},
});
trackMatomoEvent(remixClient, { category: 'learneth', action: 'showAnswerError', name: err.message, isClick: false })
trackMatomoEvent(remixClient, { category: 'learneth', action: 'show_answer_error', name: err.message, isClick: false })
}

toast.dismiss()
Expand All @@ -219,7 +219,7 @@ const Model: ModelType = {
*testSolidityCompiler(_, { put, select }) {
try {
yield remixClient.call('solidity', 'getCompilationResult');
trackMatomoEvent(remixClient, { category: 'learneth', action: 'testSolidityCompiler', isClick: true })
trackMatomoEvent(remixClient, { category: 'learneth', action: 'test_solidity_compiler', isClick: true })
} catch (err) {
const errors = yield select((state) => state.remixide.errors)
yield put({
Expand All @@ -228,7 +228,7 @@ const Model: ModelType = {
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'>"],
},
});
trackMatomoEvent(remixClient, { category: 'learneth', action: 'testSolidityCompilerError', name: err.message, isClick: false })
trackMatomoEvent(remixClient, { category: 'learneth', action: 'test_solidity_compiler_error', name: err.message, isClick: false })
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions apps/remix-ide/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ class AppComponent {
if (callDetails.length > 1) {
this.appManager.call('notification', 'toast', `initiating ${callDetails[0]} and calling "${callDetails[1]}" ...`)
// @todo(remove the timeout when activatePlugin is on 0.3.0)
this.track({ category: 'App', action: 'queryParamsCalls', name: this.params.call, isClick: false })
this.track({ category: 'App', action: 'queryParams-calls', name: this.params.call, isClick: false })
//@ts-ignore
await this.appManager.call(...callDetails).catch(console.error)
}
Expand All @@ -696,7 +696,7 @@ class AppComponent {

// call all functions in the list, one after the other
for (const call of calls) {
this.track({ category: 'App', action: 'queryParamsCalls', name: call, isClick: false })
this.track({ category: 'App', action: 'queryParams-calls', name: call, isClick: false })
const callDetails = call.split('//')
if (callDetails.length > 1) {
this.appManager.call('notification', 'toast', `initiating ${callDetails[0]} and calling "${callDetails[1]}" ...`)
Expand Down
2 changes: 1 addition & 1 deletion apps/remix-ide/src/app/components/preload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const Preload = (props: PreloadProps) => {
setShowDownloader(false)
const fsUtility = new fileSystemUtility()
const migrationResult = await fsUtility.migrate(localStorageFileSystem.current, remixIndexedDB.current)
trackMatomoEvent?.({ category: 'migrate', action: 'result', name: migrationResult ? 'success' : 'fail', isClick: false })
trackMatomoEvent?.({ category: 'Migrate', action: 'result', name: migrationResult ? 'success' : 'fail', isClick: false })
await setFileSystems()
}

Expand Down
4 changes: 2 additions & 2 deletions apps/remix-ide/src/app/files/filesystems/fileSystemUtility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ export class fileSystemUtility {
console.log('file migration successful')
return true
} else {
track({ category: 'migrate', action: 'error', name: 'hash mismatch', isClick: false })
track({ category: 'Migrate', action: 'error', name: 'hash mismatch', isClick: false })
console.log('file migration failed falling back to ' + fsFrom.name)
fsTo.loaded = false
return false
}
} catch (err) {
console.log(err)
track({ category: 'migrate', action: 'error', name: err && err.message, isClick: false })
track({ category: 'Migrate', action: 'error', name: err && err.message, isClick: false })
console.log('file migration failed falling back to ' + fsFrom.name)
fsTo.loaded = false
return false
Expand Down
5 changes: 3 additions & 2 deletions apps/remix-ide/src/app/plugins/remix-ai-assistant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ export class RemixAIAssistant extends ViewPlugin {
}

async handleActivity(type: string, payload: any) {
// Use the proper type-safe tracking helper with RemixAI events
trackMatomoEvent(this, { category: 'ai', action: 'remixAI', name: `${type}-${payload}`, isClick: true })
// Never log user prompts - only track the activity type
const eventName = type === 'promptSend' ? 'remixai-assistant-promptSend' : `remixai-assistant-${type}-${payload}`;
trackMatomoEvent(this, { category: 'ai', action: 'remixAI', name: eventName as any, isClick: true })
}

updateComponent(state: {
Expand Down
Loading