Skip to content

Commit

Permalink
Merge branch 'master' into solcoder/explain_contract
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 authored Apr 3, 2024
2 parents 0ddccf3 + a6e6f38 commit 060548c
Show file tree
Hide file tree
Showing 26 changed files with 187 additions and 228 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-reminder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
freeze-date: '2024-03-25T18:00:00Z'
freeze-date: '2024-04-08T18:00:00Z'
21 changes: 21 additions & 0 deletions apps/circuit-compiler/src/app/components/configurations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,27 @@ export function Configurations ({primeValue, setPrimeValue, versionValue}: Confi
<option value="vesta">vesta</option>
</>
</RenderIf>
<RenderIf condition={versionValue === '2.1.7'}>
<>
<option value="bn128">bn128</option>
<option value="bls12381">bls12381</option>
<option value="goldilocks">goldilocks</option>
<option value="grumpkin">grumpkin</option>
<option value="pallas">pallas</option>
<option value="vesta">vesta</option>
</>
</RenderIf>
<RenderIf condition={versionValue === '2.1.8'}>
<>
<option value="bn128">bn128</option>
<option value="bls12381">bls12381</option>
<option value="goldilocks">goldilocks</option>
<option value="grumpkin">grumpkin</option>
<option value="pallas">pallas</option>
<option value="vesta">vesta</option>
<option value="secq256r1">secq256r1</option>
</>
</RenderIf>
</select>
</div>
</CustomTooltip>
Expand Down
25 changes: 16 additions & 9 deletions apps/circuit-compiler/src/app/services/circomPluginClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { PluginClient } from '@remixproject/plugin'
import { createClient } from '@remixproject/plugin-webview'
import EventManager from 'events'
import pathModule from 'path'
import { compiler_list } from 'circom_wasm'
import { compiler_list, parse, compile, generate_r1cs, generate_witness } from 'circom_wasm'
import * as compilerV218 from 'circom_wasm/v2.1.8'
import * as compilerV217 from 'circom_wasm/v2.1.7'
import * as compilerV216 from 'circom_wasm/v2.1.6'
import * as compilerV215 from 'circom_wasm/v2.1.5'
import { extractNameFromKey, extractParentFromKey } from '@remix-ui/helper'
Expand All @@ -11,13 +13,13 @@ import { CompilationConfig, CompilerReport, PrimeValue, ResolverOutput } from '.
export class CircomPluginClient extends PluginClient {
public internalEvents: EventManager
private _compilationConfig: CompilationConfig = {
version: "2.1.6",
version: "2.1.8",
prime: "bn128"
}
private lastCompiledCircuitPath: string = ''
private lastParsedFiles: Record<string, string> = {}
private lastCompiledFile: string = ''
private compiler: typeof compilerV215 | typeof compilerV216 = compilerV216
private compiler: typeof compilerV215 & typeof compilerV216 & typeof compilerV217 & typeof compilerV218

constructor() {
super()
Expand All @@ -40,11 +42,16 @@ export class CircomPluginClient extends PluginClient {
this._compilationConfig.version = version
if (version === '2.1.5') this.compiler = compilerV215
else if (version === '2.1.6') this.compiler = compilerV216
else if (version === '2.1.7') this.compiler = compilerV217
else if (version === '2.1.8') this.compiler = compilerV218
else this.compiler = null
}

set compilerPrime (prime: PrimeValue) {
if ((prime !== "bn128") && (prime !== "bls12381") && (prime !== "goldilocks") && (this._compilationConfig.version === '2.1.5')) throw new Error('Invalid prime value')
if ((prime !== "bn128") && (prime !== "bls12381") && (prime !== "goldilocks") && (prime !== "grumpkin") && (prime !== "pallas") && (prime !== "vesta") && (this._compilationConfig.version === '2.1.6')) throw new Error('Invalid prime value')
if ((prime !== "bn128") && (prime !== "bls12381") && (prime !== "goldilocks") && (prime !== "grumpkin") && (prime !== "pallas") && (prime !== "vesta") && (this._compilationConfig.version === '2.1.7')) throw new Error('Invalid prime value')
if ((prime !== "bn128") && (prime !== "bls12381") && (prime !== "goldilocks") && (prime !== "grumpkin") && (prime !== "pallas") && (prime !== "vesta") && (prime !== "secq256r1") && (this._compilationConfig.version === '2.1.8')) throw new Error('Invalid prime value')
this._compilationConfig.prime = prime
}

Expand All @@ -54,7 +61,7 @@ export class CircomPluginClient extends PluginClient {
fileContent = await this.call('fileManager', 'readFile', path)
}
this.lastParsedFiles = await this.resolveDependencies(path, fileContent)
const parsedOutput = this.compiler.parse(path, this.lastParsedFiles)
const parsedOutput = this.compiler ? this.compiler.parse(path, this.lastParsedFiles) : parse(path, this.lastParsedFiles)

try {
const result: CompilerReport[] = JSON.parse(parsedOutput.report())
Expand Down Expand Up @@ -145,7 +152,7 @@ export class CircomPluginClient extends PluginClient {
this.compilerVersion = version
this.compilerPrime = prime
}
const circuitApi = this.compiler.compile(path, this.lastParsedFiles, { prime: this._compilationConfig.prime })
const circuitApi = this.compiler ? this.compiler.compile(path, this.lastParsedFiles, { prime: this._compilationConfig.prime }) : compile(path, this.lastParsedFiles, { prime: this._compilationConfig.prime })
const circuitProgram = circuitApi.program()

if (circuitProgram.length < 1) {
Expand Down Expand Up @@ -175,7 +182,7 @@ export class CircomPluginClient extends PluginClient {
log && this.call('terminal', 'log', { type: 'log', value: log })
})
// @ts-ignore
this.call('terminal', 'log', { type: 'typewritersuccess', value: 'Everything went okay, circom safe' })
this.call('terminal', 'log', { type: 'typewritersuccess', value: 'Everything went okay' })
}
}

Expand Down Expand Up @@ -203,7 +210,7 @@ export class CircomPluginClient extends PluginClient {
this.compilerVersion = version
this.compilerPrime = prime
}
const r1csApi = this.compiler.generate_r1cs(path, this.lastParsedFiles, { prime: this._compilationConfig.prime })
const r1csApi = this.compiler ? this.compiler.generate_r1cs(path, this.lastParsedFiles, { prime: this._compilationConfig.prime }) : generate_r1cs(path, this.lastParsedFiles, { prime: this._compilationConfig.prime })
const r1csProgram = r1csApi.program()

if (r1csProgram.length < 1) {
Expand All @@ -222,7 +229,7 @@ export class CircomPluginClient extends PluginClient {
log && this.call('terminal', 'log', { type: 'log', value: log })
})
// @ts-ignore
this.call('terminal', 'log', { type: 'typewritersuccess', value: 'Everything went okay, circom safe' })
this.call('terminal', 'log', { type: 'typewritersuccess', value: 'Everything went okay' })
}
}

Expand All @@ -234,7 +241,7 @@ export class CircomPluginClient extends PluginClient {
// @ts-ignore
const buffer: any = await this.call('fileManager', 'readFile', wasmPath, { encoding: null })
const dataRead = new Uint8Array(buffer)
const witness = await this.compiler.generate_witness(dataRead, input)
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, true)
this.internalEvents.emit('circuit_computing_witness_done')
Expand Down
4 changes: 2 additions & 2 deletions apps/learneth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ addRepository(repoName, branch)
startTutorial(repoName,branch,id)
```

You don't need to add a seperate addRepository before calling startTutorial, this call will also add the repo.
You don't need to add a separate addRepository before calling startTutorial, this call will also add the repo.

_Parameters_

Expand All @@ -117,7 +117,7 @@ tags:
```
(function () {
try {
// You don't need to add a seperate addRepository before calling startTutorial, this is just an example
// You don't need to add a separate addRepository before calling startTutorial, this is just an example
remix.call('LearnEth', 'addRepository', "ethereum/remix-workshops", "master")
remix.call('LearnEth', 'startTutorial', "ethereum/remix-workshops", "master", "basics")
remix.call('LearnEth', 'startTutorial', "ethereum/remix-workshops", "master", 2)
Expand Down
4 changes: 2 additions & 2 deletions apps/remix-ide-e2e/src/tests/circom.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ module.exports = {
.waitForElementPresent('[data-id="circuit_feedback"]')
.waitForElementVisible('[data-id="circuit_feedback"]')
.assert.hasClass('[data-id="circuit_feedback"]', 'alert-warning')
.waitForElementContainsText('[data-id="circuit_feedback"]', 'File circuits/simple.circom does not include pragma version. Assuming pragma version (2, 1, 6)')
.waitForElementContainsText('[data-id="circuit_feedback"]', 'File circuits/simple.circom does not include pragma version. Assuming pragma version (2, 1, 8)')
},
'Should hide/show warnings for compiled circuit #group4': function (browser: NightwatchBrowser) {
browser
.click('[data-id="hide_circuit_warnings_checkbox_input"]')
.waitForElementNotPresent('[data-id="circuit_feedback"]')
.click('[data-id="hide_circuit_warnings_checkbox_input"]')
.waitForElementVisible('[data-id="circuit_feedback"]')
.waitForElementContainsText('[data-id="circuit_feedback"]', 'File circuits/simple.circom does not include pragma version. Assuming pragma version (2, 1, 6)')
.waitForElementContainsText('[data-id="circuit_feedback"]', 'File circuits/simple.circom does not include pragma version. Assuming pragma version (2, 1, 8)')
},
'Should display error for invalid circuit #group4': function (browser: NightwatchBrowser) {
browser
Expand Down
2 changes: 1 addition & 1 deletion apps/remixdesktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"axios": "^1.6.1",
"byline": "^5.0.0",
"chokidar": "^3.5.3",
"express": "^4.18.2",
"express": "^4.19.2",
"isomorphic-git": "^1.24.2",
"node-pty": "^0.10.1",
"semver": "^7.5.4"
Expand Down
50 changes: 11 additions & 39 deletions apps/remixdesktop/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1259,25 +1259,7 @@ bn.js@^5.1.2, bn.js@^5.2.0, bn.js@^5.2.1:
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70"
integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==

[email protected]:
version "1.20.1"
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.1.tgz#b1812a8912c195cd371a3ee5e66faa2338a5c668"
integrity sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==
dependencies:
bytes "3.1.2"
content-type "~1.0.4"
debug "2.6.9"
depd "2.0.0"
destroy "1.2.0"
http-errors "2.0.0"
iconv-lite "0.4.24"
on-finished "2.4.1"
qs "6.11.0"
raw-body "2.5.1"
type-is "~1.6.18"
unpipe "1.0.0"

body-parser@^1.16.0:
[email protected], body-parser@^1.16.0:
version "1.20.2"
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.2.tgz#6feb0e21c4724d06de7ff38da36dad4f57a747fd"
integrity sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==
Expand Down Expand Up @@ -1709,10 +1691,10 @@ [email protected]:
resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c"
integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==

cookie@0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b"
integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==
cookie@0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051"
integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==

[email protected]:
version "1.0.2"
Expand Down Expand Up @@ -2393,17 +2375,17 @@ exponential-backoff@^3.1.1:
resolved "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.1.tgz"
integrity sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==

express@^4.14.0, express@^4.18.2:
version "4.18.2"
resolved "https://registry.yarnpkg.com/express/-/express-4.18.2.tgz#3fabe08296e930c796c19e3c516979386ba9fd59"
integrity sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==
express@^4.14.0, express@^4.19.2:
version "4.19.2"
resolved "https://registry.yarnpkg.com/express/-/express-4.19.2.tgz#e25437827a3aa7f2a827bc8171bbbb664a356465"
integrity sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==
dependencies:
accepts "~1.3.8"
array-flatten "1.1.1"
body-parser "1.20.1"
body-parser "1.20.2"
content-disposition "0.5.4"
content-type "~1.0.4"
cookie "0.5.0"
cookie "0.6.0"
cookie-signature "1.0.6"
debug "2.6.9"
depd "2.0.0"
Expand Down Expand Up @@ -4216,16 +4198,6 @@ range-parser@~1.2.1:
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031"
integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==

[email protected]:
version "2.5.1"
resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857"
integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==
dependencies:
bytes "3.1.2"
http-errors "2.0.0"
iconv-lite "0.4.24"
unpipe "1.0.0"

[email protected]:
version "2.5.2"
resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a"
Expand Down
8 changes: 4 additions & 4 deletions libs/ghaction-helper/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@remix-project/ghaction-helper",
"version": "0.1.24",
"version": "0.1.26",
"description": "Solidity Tests GitHub Action Helper",
"main": "src/index.js",
"scripts": {
Expand All @@ -19,17 +19,17 @@
},
"homepage": "https://github.com/ethereum/remix-project#readme",
"devDependencies": {
"@remix-project/remix-solidity": "^0.5.30",
"@remix-project/remix-solidity": "^0.5.32",
"@types/chai": "^4.3.4",
"typescript": "^4.9.3"
},
"dependencies": {
"@ethereum-waffle/chai": "^3.4.4",
"@remix-project/remix-simulator": "^0.2.44",
"@remix-project/remix-simulator": "^0.2.46",
"chai": "^4.3.7",
"ethers": "^5.7.2",
"web3": "^4.1.1"
},
"types": "./src/index.d.ts",
"gitHead": "751c821c0264dec832ee8739800e32b79b09c00a"
"gitHead": "b6fdc61a09e0b748d0034aee789916e79ec73bfd"
}
8 changes: 4 additions & 4 deletions libs/remix-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-analyzer",
"version": "0.5.53",
"version": "0.5.55",
"description": "Tool to perform static analysis on Solidity smart contracts",
"scripts": {
"test": "./../../node_modules/.bin/ts-node --project ../../tsconfig.base.json --require tsconfig-paths/register ./../../node_modules/.bin/tape ./test/tests.ts"
Expand All @@ -25,8 +25,8 @@
"@ethereumjs/tx": "5.3.0",
"@ethereumjs/util": "9.0.3",
"@ethereumjs/vm": "8.0.0",
"@remix-project/remix-astwalker": "^0.0.74",
"@remix-project/remix-lib": "^0.5.51",
"@remix-project/remix-astwalker": "^0.0.76",
"@remix-project/remix-lib": "^0.5.53",
"async": "^2.6.2",
"ethers": "^5.4.2",
"ethjs-util": "^0.1.6",
Expand All @@ -50,6 +50,6 @@
"typescript": "^3.7.5"
},
"typings": "src/index.d.ts",
"gitHead": "751c821c0264dec832ee8739800e32b79b09c00a",
"gitHead": "b6fdc61a09e0b748d0034aee789916e79ec73bfd",
"main": "./src/index.js"
}
6 changes: 3 additions & 3 deletions libs/remix-astwalker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-astwalker",
"version": "0.0.74",
"version": "0.0.76",
"description": "Tool to walk through Solidity AST",
"main": "src/index.js",
"scripts": {
Expand Down Expand Up @@ -37,7 +37,7 @@
"@ethereumjs/tx": "5.3.0",
"@ethereumjs/util": "9.0.3",
"@ethereumjs/vm": "8.0.0",
"@remix-project/remix-lib": "^0.5.51",
"@remix-project/remix-lib": "^0.5.53",
"@types/tape": "^4.2.33",
"async": "^2.6.2",
"ethers": "^5.4.2",
Expand All @@ -53,6 +53,6 @@
"tap-spec": "^5.0.0"
},
"typings": "src/index.d.ts",
"gitHead": "751c821c0264dec832ee8739800e32b79b09c00a",
"gitHead": "b6fdc61a09e0b748d0034aee789916e79ec73bfd",
"types": "./src/index.d.ts"
}
12 changes: 6 additions & 6 deletions libs/remix-debug/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-debug",
"version": "0.5.44",
"version": "0.5.46",
"description": "Tool to debug Ethereum transactions",
"contributors": [
{
Expand All @@ -26,10 +26,10 @@
"@ethereumjs/tx": "5.3.0",
"@ethereumjs/util": "9.0.3",
"@ethereumjs/vm": "8.0.0",
"@remix-project/remix-astwalker": "^0.0.74",
"@remix-project/remix-lib": "^0.5.51",
"@remix-project/remix-simulator": "^0.2.44",
"@remix-project/remix-solidity": "^0.5.30",
"@remix-project/remix-astwalker": "^0.0.76",
"@remix-project/remix-lib": "^0.5.53",
"@remix-project/remix-simulator": "^0.2.46",
"@remix-project/remix-solidity": "^0.5.32",
"ansi-gray": "^0.1.1",
"async": "^2.6.2",
"color-support": "^1.1.3",
Expand Down Expand Up @@ -69,6 +69,6 @@
},
"homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-debug#readme",
"typings": "src/index.d.ts",
"gitHead": "751c821c0264dec832ee8739800e32b79b09c00a",
"gitHead": "b6fdc61a09e0b748d0034aee789916e79ec73bfd",
"types": "./src/index.d.ts"
}
4 changes: 2 additions & 2 deletions libs/remix-lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-lib",
"version": "0.5.51",
"version": "0.5.53",
"description": "Library to various Remix tools",
"contributors": [
{
Expand Down Expand Up @@ -55,6 +55,6 @@
},
"homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-lib#readme",
"typings": "src/index.d.ts",
"gitHead": "751c821c0264dec832ee8739800e32b79b09c00a",
"gitHead": "b6fdc61a09e0b748d0034aee789916e79ec73bfd",
"types": "./src/index.d.ts"
}
Loading

0 comments on commit 060548c

Please sign in to comment.