Merge pull request #3233 from ethereum/nxmerge

Nxmerge
pull/3095/head^2
yann300 2 years ago committed by GitHub
commit 93d9556477
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      .circleci/config.yml
  2. 37
      .eslintrc.json
  3. 5
      .gitignore
  4. 4
      apps/debugger/.babelrc
  5. 61
      apps/debugger/project.json
  6. 12
      apps/debugger/src/app/debugger-api.ts
  7. 16
      apps/debugger/tsconfig.app.json
  8. 18
      apps/debugger/tsconfig.json
  9. 15
      apps/debugger/tsconfig.spec.json
  10. 24
      apps/debugger/webpack.config.js
  11. 62
      apps/etherscan/project.json
  12. 13
      apps/etherscan/tsconfig.app.json
  13. 6
      apps/etherscan/tsconfig.json
  14. 28
      apps/etherscan/webpack.config.js
  15. 62
      apps/remix-ide-e2e/src/local-plugin/project.json
  16. 2
      apps/remix-ide-e2e/src/tests/editorAutoComplete.test.ts
  17. 4
      apps/remix-ide-e2e/tsconfig.json
  18. 9
      apps/remix-ide/.babelrc
  19. 7
      apps/remix-ide/.eslintrc
  20. 19
      apps/remix-ide/ci/lint-targets.js
  21. 22
      apps/remix-ide/ci/lint.sh
  22. 1
      apps/remix-ide/ci/sauceDisconnect.js
  23. 74
      apps/remix-ide/project.json
  24. 4
      apps/remix-ide/src/app/components/panel.ts
  25. 2
      apps/remix-ide/src/app/components/side-panel.tsx
  26. 3
      apps/remix-ide/src/app/files/fileManager.ts
  27. 3
      apps/remix-ide/src/app/panels/terminal.js
  28. 2
      apps/remix-ide/src/app/plugins/parser/code-parser.tsx
  29. 83
      apps/remix-ide/src/app/plugins/parser/services/antlr-worker.ts
  30. 6
      apps/remix-ide/src/app/plugins/parser/services/code-parser-antlr-service.ts
  31. 2
      apps/remix-ide/src/app/plugins/parser/services/code-parser-compiler.ts
  32. 4
      apps/remix-ide/src/app/plugins/permission-handler-plugin.tsx
  33. 1
      apps/remix-ide/src/app/tabs/abstract-provider.tsx
  34. 6
      apps/remix-ide/src/app/tabs/analysis-tab.js
  35. 2
      apps/remix-ide/src/app/tabs/compile-tab.js
  36. 6
      apps/remix-ide/src/assets/css/themes/bootstrap-cerulean.min.css
  37. 2
      apps/remix-ide/src/assets/css/themes/remix-hacker_owl.css
  38. 0
      apps/remix-ide/src/polyfills.ts
  39. 1
      apps/remix-ide/stats.json
  40. 5
      apps/remix-ide/tsconfig.app.json
  41. 59
      apps/remix-ide/webpack.config.js
  42. 61
      apps/solidity-compiler/project.json
  43. 2
      apps/solidity-compiler/src/app/compiler-api.ts
  44. 2
      apps/solidity-compiler/src/app/compiler.ts
  45. 16
      apps/solidity-compiler/tsconfig.app.json
  46. 18
      apps/solidity-compiler/tsconfig.json
  47. 15
      apps/solidity-compiler/tsconfig.spec.json
  48. 39
      apps/solidity-compiler/webpack.config.js
  49. 62
      apps/vyper/project.json
  50. 24
      apps/vyper/webpack.config.js
  51. 9
      babel.config.js
  52. 25
      jest.config.js
  53. 4
      libs/remix-analyzer/.eslintrc
  54. 8
      libs/remix-analyzer/package.json
  55. 31
      libs/remix-analyzer/project.json
  56. 1
      libs/remix-analyzer/src/index.ts
  57. 4
      libs/remix-analyzer/test/analysis/staticAnalysisCommon-test.ts
  58. 2
      libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.ts
  59. 4
      libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
  60. 7
      libs/remix-astwalker/.eslintrc
  61. 1
      libs/remix-astwalker/package.json
  62. 30
      libs/remix-astwalker/project.json
  63. 1
      libs/remix-astwalker/src/@types/remix-lib/index.d.ts
  64. 10
      libs/remix-astwalker/tests/newTests.ts
  65. 2
      libs/remix-astwalker/tests/resources/legacyAST.ts
  66. 4
      libs/remix-astwalker/tests/resources/newAST.ts
  67. 14
      libs/remix-core-plugin/.eslintrc
  68. 6
      libs/remix-core-plugin/package.json
  69. 27
      libs/remix-core-plugin/project.json
  70. 1
      libs/remix-core-plugin/src/lib/compiler-content-imports.ts
  71. 4
      libs/remix-debug/bin/rdb
  72. 8
      libs/remix-debug/package.json
  73. 31
      libs/remix-debug/project.json
  74. 2
      libs/remix-debug/src/cmdline/index.ts
  75. 11
      libs/remix-debug/src/index.ts
  76. 24
      libs/remix-debug/test.ts
  77. 2
      libs/remix-debug/test/codeManager.ts
  78. 16
      libs/remix-debug/test/debugger.ts
  79. 14
      libs/remix-debug/test/decoder/decodeInfo.ts
  80. 28
      libs/remix-debug/test/decoder/localDecoder.ts
  81. 12
      libs/remix-debug/test/decoder/localsTests/calldata.ts
  82. 19
      libs/remix-debug/test/decoder/localsTests/int.ts
  83. 11
      libs/remix-debug/test/decoder/localsTests/misc.ts
  84. 11
      libs/remix-debug/test/decoder/localsTests/misc2.ts
  85. 11
      libs/remix-debug/test/decoder/localsTests/structArray.ts
  86. 6
      libs/remix-debug/test/decoder/mockStorageResolver.ts
  87. 20
      libs/remix-debug/test/decoder/stateTests/mapping.ts
  88. 32
      libs/remix-debug/test/decoder/storageDecoder.ts
  89. 12
      libs/remix-debug/test/decoder/storageLocation.ts
  90. 2
      libs/remix-debug/test/init.ts
  91. 6
      libs/remix-debug/test/resources/testWeb3.ts
  92. 4
      libs/remix-debug/test/sourceLocationTracker.ts
  93. 2
      libs/remix-debug/test/sourceMappingDecoder.ts
  94. 8
      libs/remix-debug/test/vmCall.ts
  95. 3
      libs/remix-lib/.eslintrc
  96. 6
      libs/remix-lib/package.json
  97. 27
      libs/remix-lib/project.json
  98. 2
      libs/remix-lib/test/init.ts
  99. 8
      libs/remix-lib/test/txFormat.ts
  100. 8
      libs/remix-lib/test/txResultHelper.ts
  101. Some files were not shown because too many files have changed in this diff Show More

@ -25,7 +25,10 @@ jobs:
paths:
- node_modules
- run: NX_BIN_URL=http://127.0.0.1:8080/assets/js NX_WASM_URL=http://127.0.0.1:8080/assets/js yarn build:production
- run: npx nx build remix-ide-e2e-src-local-plugin & yarn run build:libs
- run: yarn nx build remix-ide-e2e-src-local-plugin & yarn run build:libs
- run: yarn nx run debugger:build:production
- run: yarn nx run solidity-compiler:build:production
- run: yarn nx run remixd:build
- run: mkdir persist && zip -0 -r persist/dist.zip dist
- persist_to_workspace:
root: .
@ -37,16 +40,17 @@ jobs:
resource_class:
xlarge
working_directory: ~/remix-project
parallelism: 35
parallelism: 1
steps:
- checkout
- restore_cache:
keys:
- v1-deps-{{ checksum "yarn.lock" }}
- run: yarn
- run: yarn nx graph --file=./projects.json
- run:
name: Remix Libs Linting
command: ./apps/remix-ide/ci/lint.sh
command: node ./apps/remix-ide/ci/lint-targets.js
remix-libs:
docker:
- image: cimg/node:14.17.6-browsers
@ -133,7 +137,7 @@ jobs:
parameters:
script:
type: string
parallelism: 10
parallelism: 4
steps:
- browser-tools/install-browser-tools
- run:

@ -1,10 +1,19 @@
{
"root": true,
"ignorePatterns": [],
"plugins": ["@nrwl/nx"],
"ignorePatterns": [
"**/node_modules/**"
],
"plugins": [
"@nrwl/nx"
],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
@ -14,7 +23,9 @@
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
"onlyDependOnLibsWithTags": [
"*"
]
}
]
}
@ -22,8 +33,13 @@
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"files": [
"*.ts",
"*.tsx"
],
"extends": [
"plugin:@nrwl/nx/typescript"
],
"rules": {
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-this-alias": "off",
@ -35,8 +51,13 @@
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"files": [
"*.js",
"*.jsx"
],
"extends": [
"plugin:@nrwl/nx/javascript"
],
"rules": {}
}
],

5
.gitignore vendored

@ -14,6 +14,7 @@ soljson.js
*~
*_group*.*.ts
*_group*.ts
stats.json
# compiled output
@ -56,3 +57,7 @@ testem.log
.DS_Store
.vscode/settings.json
.vscode/launch.json
libs/remix-node/
libs/remix-niks/
apps/remix-react

@ -1,4 +0,0 @@
{
"presets": ["@nrwl/react/babel"],
"plugins": []
}

@ -0,0 +1,61 @@
{
"name": "debugger",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/debugger/src",
"projectType": "application",
"implicitDependencies": [
"remix-debug"
],
"targets": {
"build": {
"executor": "@nrwl/webpack:webpack",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "development",
"options": {
"compiler": "babel",
"outputPath": "dist/apps/debugger",
"index": "apps/debugger/src/index.html",
"baseHref": "/",
"main": "apps/debugger/src/main.tsx",
"polyfills": "apps/debugger/src/polyfills.ts",
"tsConfig": "apps/debugger/tsconfig.app.json",
"assets": [
"apps/debugger/src/favicon.ico",
"apps/debugger/src/assets"
],
"styles": ["apps/debugger/src/styles.css"],
"scripts": [],
"webpackConfig": "apps/debugger/webpack.config.js"
},
"configurations": {
"development": {
},
"production": {
"fileReplacements": [
{
"replace": "apps/debugger/src/environments/environment.ts",
"with": "apps/debugger/src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"executor": "@nrwl/webpack:dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "debugger:build",
"hmr": true
},
"configurations": {
"development": {
"buildTarget": "debugger:build:development"
},
"production": {
"buildTarget": "debugger:build:production"
}
}
}
},
"tags": []
}

@ -1,5 +1,5 @@
import Web3 from 'web3'
import remixDebug, { TransactionDebugger as Debugger } from '@remix-project/remix-debug'
import {init , traceHelper, TransactionDebugger as Debugger } from '@remix-project/remix-debug'
import { CompilerAbstract } from '@remix-project/remix-solidity'
import { lineText } from '@remix-ui/editor'
@ -20,7 +20,7 @@ export const DebuggerApiMixin = (Base) => class extends Base {
this._web3 = new Web3(this.web3Provider)
// this._web3 can be overwritten and reset to initial value in 'debug' method
this.initialWeb3 = this._web3
remixDebug.init.extendWeb3(this._web3)
init.extendWeb3(this._web3)
this.offsetToLineColumnConverter = {
async offsetToLineColumn (rawLocation, file, sources, asts) {
@ -94,7 +94,7 @@ export const DebuggerApiMixin = (Base) => class extends Base {
}
async fetchContractAndCompile (address, receipt) {
const target = (address && remixDebug.traceHelper.isContractCreation(address)) ? receipt.contractAddress : address
const target = (address && traceHelper.isContractCreation(address)) ? receipt.contractAddress : address
const targetAddress = target || receipt.contractAddress || receipt.to
const codeAtAddress = await this._web3.eth.getCode(targetAddress)
const output = await this.call('fetchAndCompile', 'resolve', targetAddress, codeAtAddress, '.debug')
@ -113,10 +113,10 @@ export const DebuggerApiMixin = (Base) => class extends Base {
web3 = this.web3()
}
if (!web3) {
const webDebugNode = remixDebug.init.web3DebugNode(network.name)
const webDebugNode = init.web3DebugNode(network.name)
web3 = !webDebugNode ? this.web3() : webDebugNode
}
remixDebug.init.extendWeb3(web3)
init.extendWeb3(web3)
return web3
}
@ -148,7 +148,7 @@ export const DebuggerApiMixin = (Base) => class extends Base {
}
if (web3) this._web3 = web3
else this._web3 = this.initialWeb3
remixDebug.init.extendWeb3(this._web3)
init.extendWeb3(this._web3)
if (this.onDebugRequestedListener) {
this.onDebugRequestedListener(hash, web3).then((debuggerBackend) => {
this.debuggerBackend = debuggerBackend

@ -4,6 +4,20 @@
"outDir": "../../dist/out-tsc",
"types": ["node"]
},
"exclude": ["**/*.spec.ts", "**/*.spec.tsx"],
"files": [
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
"../../node_modules/@nrwl/react/typings/image.d.ts"
],
"exclude": [
"jest.config.ts",
"**/*.spec.ts",
"**/*.test.ts",
"**/*.spec.tsx",
"**/*.test.tsx",
"**/*.spec.js",
"**/*.test.js",
"**/*.spec.jsx",
"**/*.test.jsx"
],
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
}

@ -1,16 +1,16 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"jsx": "react-jsx",
"allowJs": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"types": ["node", "jest"],
"resolveJsonModule": true
"allowSyntheticDefaultImports": true
},
"files": [
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
"../../node_modules/@nrwl/react/typings/image.d.ts"
],
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.app.json"
}
]
}

@ -1,15 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.spec.js",
"**/*.spec.jsx",
"**/*.d.ts"
]
}

@ -1,17 +1,21 @@
const nxWebpack = require('@nrwl/react/plugins/webpack')
const TerserPlugin = require('terser-webpack-plugin')
module.exports = config => {
const nxWebpackConfig = nxWebpack(config)
const webpackConfig = {
...nxWebpackConfig,
node: {
fs: 'empty',
tls: 'empty',
readline: 'empty',
net: 'empty',
module: 'empty',
child_process: 'empty'
resolve : {
...nxWebpackConfig.resolve,
fallback: {
...nxWebpackConfig.resolve.fallback,
"crypto": require.resolve("crypto-browserify"),
"stream": require.resolve("stream-browserify"),
"http" : require.resolve("stream-http"),
"https" : require.resolve("https-browserify"),
"path" : require.resolve("path-browserify"),
"module": false,
"fs" : false
},
}
}
@ -20,10 +24,6 @@ module.exports = config => {
...webpackConfig,
mode: 'production',
devtool: 'source-map',
optimization: {
minimize: true,
minimizer: [new TerserPlugin()]
}
}
} else {
return webpackConfig

@ -0,0 +1,62 @@
{
"name": "etherscan",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/etherscan/src",
"projectType": "application",
"implicitDependencies": [
"remix-debug"
],
"targets": {
"build": {
"executor": "@nrwl/webpack:webpack",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "development",
"options": {
"compiler": "babel",
"outputPath": "dist/apps/etherscan",
"index": "apps/etherscan/src/index.html",
"baseHref": "/",
"main": "apps/etherscan/src/main.tsx",
"polyfills": "apps/etherscan/src/polyfills.ts",
"tsConfig": "apps/etherscan/tsconfig.app.json",
"assets": [
"apps/etherscan/src/favicon.ico",
"apps/etherscan/src/assets"
],
"styles": ["apps/etherscan/src/styles.css"],
"scripts": [],
"webpackConfig": "apps/etherscan/webpack.config.js"
},
"configurations": {
"development": {
},
"production": {
"fileReplacements": [
{
"replace": "apps/etherscan/src/environments/environment.ts",
"with": "apps/etherscan/src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"executor": "@nrwl/webpack:dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "etherscan:build",
"hmr": true
},
"configurations": {
"development": {
"buildTarget": "etherscan:build:development",
"port": 5003
},
"production": {
"buildTarget": "etherscan:build:production"
}
}
}
},
"tags": []
}

@ -5,10 +5,19 @@
"types": ["node"]
},
"files": [
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
"../../node_modules/@nrwl/react/typings/image.d.ts"
],
"exclude": ["**/*.spec.ts", "**/*.spec.tsx"],
"exclude": [
"jest.config.ts",
"**/*.spec.ts",
"**/*.test.ts",
"**/*.spec.tsx",
"**/*.test.tsx",
"**/*.spec.js",
"**/*.test.js",
"**/*.spec.jsx",
"**/*.test.jsx"
],
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
}

@ -4,11 +4,7 @@
"jsx": "react-jsx",
"allowJs": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
"allowSyntheticDefaultImports": true
},
"files": [],
"include": [],

@ -0,0 +1,28 @@
const nxWebpack = require('@nrwl/react/plugins/webpack')
module.exports = config => {
const nxWebpackConfig = nxWebpack(config)
const webpackConfig = {
...nxWebpackConfig,
resolve : {
...nxWebpackConfig.resolve,
fallback: {
...nxWebpackConfig.resolve.fallback,
"http": require.resolve("stream-http"),
"https": require.resolve("https-browserify"),
"stream": require.resolve("stream-browserify"),
"zlib": require.resolve("browserify-zlib"),
},
}
}
if (process.env.NODE_ENV === 'production') {
return {
...webpackConfig,
mode: 'production',
devtool: 'source-map',
}
} else {
return webpackConfig
}
}

@ -0,0 +1,62 @@
{
"name": "remix-ide-e2e-src-local-plugin",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/remix-ide-e2e/src/local-plugin/src/",
"projectType": "application",
"implicitDependencies": [
"remix-debug"
],
"targets": {
"build": {
"executor": "@nrwl/webpack:webpack",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "development",
"options": {
"compiler": "babel",
"outputPath": "dist/apps/remix-ide-e2e-src-local-plugin",
"index": "apps/remix-ide-e2e/src/local-plugin/src/index.html",
"baseHref": "/",
"main": "apps/remix-ide-e2e/src/local-plugin/src/main.tsx",
"polyfills": "apps/remix-ide-e2e/src/local-plugin/src/polyfills.ts",
"tsConfig": "apps/remix-ide-e2e/src/local-plugin/tsconfig.app.json",
"assets": [
],
"styles": [
"apps/remix-ide-e2e/src/local-plugin/src/styles.css"
],
"scripts": [],
"webpackConfig": "@nrwl/react/plugins/webpack"
},
"configurations": {
"development": {
},
"production": {
"fileReplacements": [
{
"replace": "apps/remix-ide-e2e/src/local-plugin/src/environments/environment.ts",
"with": "apps/remix-ide-e2e/src/local-plugin/src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"executor": "@nrwl/webpack:dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "remix-ide-e2e-src-local-plugin:build",
"hmr": true
},
"configurations": {
"development": {
"buildTarget": "remix-ide-e2e-src-local-plugin:build:development",
"port": 2020
},
"production": {
"buildTarget": "remix-ide-e2e-src-local-plugin:build:production"
}
}
}
},
"tags": []
}

@ -112,7 +112,7 @@ module.exports = {
return actions.
sendKeys(' someaddress;')
.sendKeys(this.Keys.ENTER)
}).pause(4000)
}).pause(5000)
.perform(function () {
const actions = this.actions({ async: true });
return actions.

@ -3,7 +3,9 @@
"compilerOptions": {
"types": ["node", "nightwatch"],
"esModuleInterop": true,
"resolveJsonModule": true
"resolveJsonModule": true,
"target": "es2015",
"module": "commonjs",
},
"include": ["**/*.ts", "**/*.js"]
}

@ -1,4 +1,9 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": ["@babel/plugin-proposal-class-properties", "@babel/plugin-transform-runtime"]
"presets": ["@babel/preset-env", ["@babel/preset-react",
{"runtime": "automatic"}
]],
"plugins": ["@babel/plugin-proposal-class-properties", "@babel/plugin-transform-runtime"],
"ignore": [
"**/node_modules/**"
]
}

@ -14,5 +14,10 @@
},
"rules": {
"standard/no-callback-literal": "off"
}
},
"ignorePatterns": [
"**/node_modules/**",
"apps/remix-ide/src/assets/js/**/*.js"
]
}

@ -0,0 +1,19 @@
const { spawnSync } = require('child_process')
const fs = require('fs')
const { exit } = require('process')
const file = fs.readFileSync('projects.json')
const projects = JSON.parse(file)
console.log(Object.keys(projects.graph.nodes))
for(let node of Object.keys(projects.graph.nodes)){
if(projects.graph.nodes[node].data.targets.lint){
console.log(projects.graph.nodes[node].data.name)
const result = spawnSync('yarn', ['lint', projects.graph.nodes[node].data.name])
if(result.status == 0){
console.log('success')
}else{
console.log(result.stdout.toString())
console.log(result.stderr.toString())
exit(1)
}
}
}

@ -1,22 +0,0 @@
#!/usr/bin/env bash
set -e
BUILD_ID=${CIRCLE_BUILD_NUM:-${TRAVIS_JOB_NUMBER}}
echo "$BUILD_ID"
TEST_EXITCODE=0
KEYS=$(jq -r '.projects | keys' workspace.json | tr -d '[],"')
(for row in $KEYS; do
if [ "$row" != "debugger" ]
then
echo ${row}
fi
done) | circleci tests split | { while read i;do yarn run lint $i; done }
echo "$TEST_EXITCODE"
if [ "$TEST_EXITCODE" -eq 1 ]
then
exit 1
fi

@ -53,6 +53,7 @@ function callSauce (requestPath, type, callback) {
console.log('BODY: ' + chunk)
callback(null, chunk)
})
// eslint-disable-next-line @typescript-eslint/no-empty-function
res.on('end', function onEnd () {})
}

@ -0,0 +1,74 @@
{
"name": "remix-ide",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/remix-ide/src",
"projectType": "application",
"implicitDependencies": [
],
"targets": {
"build": {
"executor": "@nrwl/webpack:webpack",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "development",
"options": {
"compiler": "babel",
"outputPath": "dist/apps/remix-ide",
"index": "apps/remix-ide/src/index.html",
"baseHref": "/",
"main": "apps/remix-ide/src/index.tsx",
"polyfills": "apps/remix-ide/src/polyfills.ts",
"tsConfig": "apps/remix-ide/tsconfig.app.json",
"assets": [
"apps/remix-ide/src/assets",
"apps/remix-ide/src/index.html",
"apps/remix-ide/src/404.html",
"apps/remix-ide/src/favicon.ico"
],
"styles": [],
"scripts": [],
"webpackConfig": "apps/remix-ide/webpack.config.js"
},
"configurations": {
"development": {
},
"production": {
"fileReplacements": [
{
"replace": "apps/remix-ide/src/environments/environment.ts",
"with": "apps/remix-ide/src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"executor": "@nrwl/webpack:dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "remix-ide:build",
"watch": true,
"liveReload": true,
"hmr": false
},
"configurations": {
"development": {
"buildTarget": "remix-ide:build:development",
"port": 8080
},
"production": {
"buildTarget": "remix-ide:build:production",
"port": 8080
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/remix-ide/**/*.{ts,tsx,js,jsx}"],
"eslintConfig": "apps/remix-ide/.eslintrc"
}
}
},
"tags": []
}

@ -1,8 +1,8 @@
import React from 'react' // eslint-disable-line
import { EventEmitter } from 'events'
import { HostPlugin } from '@remixproject/engine-web' // eslint-disable-line
import { PluginRecord } from 'libs/remix-ui/panel/src/lib/types'
const EventManager = require('../../lib/events')
import { PluginRecord } from '@remix-ui/panel'
import EventManager from '../../lib/events'
export class AbstractPanel extends HostPlugin {
events: EventEmitter

@ -3,7 +3,7 @@ import React from 'react'
import { AbstractPanel } from './panel'
import { RemixPluginPanel } from '@remix-ui/panel'
import packageJson from '../../../../../package.json'
import RemixUIPanelHeader from 'libs/remix-ui/panel/src/lib/plugins/panel-header'
import { RemixUIPanelHeader } from '@remix-ui/panel'
import { PluginViewWrapper } from '@remix-ui/helper'
// const csjs = require('csjs-inject')

@ -3,7 +3,6 @@ import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
import Registry from '../state/registry'
import { EventEmitter } from 'events'
import { RemixAppManager } from '../../../../../libs/remix-ui/plugin-manager/src/types'
import { fileChangedToastMsg, recursivePasteToastMsg, storageFullMessage } from '@remix-ui/helper'
import helper from '../../lib/helper.js'
@ -41,7 +40,7 @@ class FileManager extends Plugin {
events: EventEmitter
editor: any
_components: any
appManager: RemixAppManager
appManager: any
_deps: any
getCurrentFile: () => any
getFile: (path: any) => Promise<unknown>

@ -5,7 +5,7 @@ import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
import Registry from '../state/registry'
import { PluginViewWrapper } from '@remix-ui/helper'
const vm = require('vm')
import vm from 'vm'
const EventManager = require('../../lib/events')
import { CompilerImports } from '@remix-project/core-plugin' // eslint-disable-line
@ -121,6 +121,7 @@ class Terminal extends Plugin {
renderComponent () {
const onReady = (api) => { this.terminalApi = api }
console.log(this)
this.dispatch({
plugin: this,
onReady: onReady

@ -9,7 +9,7 @@ import CodeParserAntlrService from './services/code-parser-antlr-service'
import CodeParserImports, { CodeParserImportsData } from './services/code-parser-imports'
import React from 'react'
import { Profile } from '@remixproject/plugin-utils'
import { ContractDefinitionAstNode, EventDefinitionAstNode, FunctionCallAstNode, FunctionDefinitionAstNode, IdentifierAstNode, ImportDirectiveAstNode, ModifierDefinitionAstNode, SourceUnitAstNode, StructDefinitionAstNode, VariableDeclarationAstNode } from 'dist/libs/remix-analyzer/src/types'
import { ContractDefinitionAstNode, EventDefinitionAstNode, FunctionCallAstNode, FunctionDefinitionAstNode, IdentifierAstNode, ImportDirectiveAstNode, ModifierDefinitionAstNode, SourceUnitAstNode, StructDefinitionAstNode, VariableDeclarationAstNode } from '@remix-project/remix-analyzer'
import { lastCompilationResult, RemixApi } from '@remixproject/plugin-api'
import { antlr } from './types'
import { ParseResult } from './types/antlr-types'

@ -1,54 +1,45 @@
let parser: any
// 'DedicatedWorkerGlobalScope' object (the Worker global scope) is accessible through the self keyword
// 'dom' and 'webworker' library files can't be included together https://github.com/microsoft/TypeScript/issues/20595
export default function (self) { // eslint-disable-line @typescript-eslint/explicit-module-boundary-types
self.onmessage = (e: MessageEvent) => {
const data: any = e.data
switch (data.cmd) {
case 'load':
{
(self as any).importScripts(e.data.url)
// @ts-ignore
parser = SolidityParser as any;
self.addEventListener('message', (e) => {
const data: any = e.data
switch (data.cmd) {
case 'load':
{
delete self.Module
// NOTE: workaround some browsers?
self.Module = undefined
// importScripts() method of synchronously imports one or more scripts into the worker's scope
self.importScripts(e.data.url)
// @ts-ignore
parser = SolidityParser as any;
self.postMessage({
cmd: 'loaded',
})
break
}
case 'parse':
if (data.text && parser) {
try {
let startTime = performance.now()
const blocks = parser.parseBlock(data.text, { loc: true, range: true, tolerant: true })
const blockDuration = performance.now() - startTime
startTime = performance.now()
const ast = parser.parse(data.text, { loc: true, range: true, tolerant: true })
const endTime = performance.now()
self.postMessage({
cmd: 'loaded',
cmd: 'parsed',
timestamp: data.timestamp,
ast,
text: data.text,
file: data.file,
duration: endTime - startTime,
blockDuration,
blocks
})
break
} catch (e) {
// do nothing
}
case 'parse':
if (data.text && parser) {
try {
let startTime = performance.now()
const blocks = parser.parseBlock(data.text, { loc: true, range: true, tolerant: true })
const blockDuration = performance.now() - startTime
startTime = performance.now()
const ast = parser.parse(data.text, { loc: true, range: true, tolerant: true })
const endTime = performance.now()
self.postMessage({
cmd: 'parsed',
timestamp: data.timestamp,
ast,
text: data.text,
file: data.file,
duration: endTime - startTime,
blockDuration,
blocks
})
} catch (e) {
// do nothing
}
}
break
}
}, false)
}
break
}
}

@ -1,9 +1,9 @@
'use strict'
import { AstNode } from "@remix-project/remix-solidity-ts"
import { AstNode } from "@remix-project/remix-solidity"
import { CodeParser } from "../code-parser"
import { antlr } from '../types'
import work from 'webworkify-webpack'
import { pathToFileURL } from 'url'
const SolidityParser = (window as any).SolidityParser = (window as any).SolidityParser || []
@ -42,7 +42,7 @@ export default class CodeParserAntlrService {
}
createWorker() {
this.worker = work(require.resolve('./antlr-worker'));
this.worker = new Worker(new URL('./antlr-worker', import.meta.url))
this.worker.postMessage({
cmd: 'load',
url: document.location.protocol + '//' + document.location.host + '/assets/js/parser/antlr.js',

@ -6,7 +6,7 @@ import { CompilationResult, CompilationSource } from '@remix-project/remix-solid
import { CodeParser } from "../code-parser";
import { fileDecoration, fileDecorationType } from '@remix-ui/file-decorators'
import { sourceMappingDecoder } from '@remix-project/remix-debug'
import { CompilerRetriggerMode, CompilationSourceCode } from '@remix-project/remix-solidity-ts';
import { CompilerRetriggerMode, CompilationSourceCode } from '@remix-project/remix-solidity';
import { MarkerSeverity } from 'monaco-editor';
import { findLinesInStringWithMatch, SearchResultLine } from '@remix-ui/search'
import { lastCompilationResult } from '@remixproject/plugin-api';

@ -1,7 +1,7 @@
import React from 'react' // eslint-disable-line
import { Plugin } from '@remixproject/engine'
import { AppModal } from 'libs/remix-ui/app/src'
import { PermissionHandlerDialog, PermissionHandlerValue } from 'libs/remix-ui/permission-handler/src'
import { AppModal } from '@remix-ui/app'
import { PermissionHandlerDialog, PermissionHandlerValue } from '@remix-ui/permission-handler'
import { Profile } from '@remixproject/plugin-utils'
const profile = {

@ -43,6 +43,7 @@ export abstract class AbstractProvider extends Plugin {
}
sendAsync (data: JsonDataRequest): Promise<any> {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, reject) => {
if (this.blocked) return reject(new Error('provider unable to connect'))
// If provider is not set, allow to open modal only when provider is trying to connect

@ -40,11 +40,12 @@ class AnalysisTab extends ViewPlugin {
}
async onActivation () {
this.renderComponent()
const isSolidityActive = await this.call('manager', 'isActive', 'solidity')
if (!isSolidityActive) {
await this.call('manager', 'activatePlugin', 'solidity')
}
this.renderComponent()
this.event.register('staticAnaysisWarning', (count) => {
if (count > 0) {
this.emit('statusChanged', { key: count, title: `${count} warning${count === 1 ? '' : 's'}`, type: 'warning' })
@ -59,6 +60,7 @@ class AnalysisTab extends ViewPlugin {
setDispatch (dispatch) {
this.dispatch = dispatch
this.renderComponent()
}
render () {
@ -74,7 +76,7 @@ class AnalysisTab extends ViewPlugin {
}
renderComponent () {
this.dispatch({
this.dispatch && this.dispatch({
registry: this.registry,
analysisModule: this,
event: this.event

@ -5,7 +5,7 @@ import { CompileTabLogic } from '@remix-ui/solidity-compiler' // eslint-disable-
import { CompilerApiMixin } from '@remixproject/solidity-compiler-plugin' // eslint-disable-line
import { ViewPlugin } from '@remixproject/engine-web'
import { QueryParams } from '@remix-project/remix-lib'
// import { ICompilerApi } from '@remix-project/remix-lib-ts'
// import { ICompilerApi } from '@remix-project/remix-lib'
import * as packageJson from '../../../../../package.json'
import { compilerConfigChangedToastMsg, compileToastMsg } from '@remix-ui/helper'
import { isNative } from '../../remixAppManager'

@ -1915,10 +1915,10 @@ textarea.form-control {
.form-control.is-valid,.was-validated .form-control:valid {
border-color:#73a839;
padding-right:calc(1.5em + .75rem);
background-image:background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath fill='%2373a839' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath fill='%2373a839' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
background-repeat:no-repeat;
background-position:right calc(.375em + .1875rem) center;
background-size:calc(.75em + .375rem) calc(.75em + .375rem)}
background-size:calc(.75em + .375rem) calc(.75em + .375rem)
}
.form-control.is-valid:focus,.was-validated .form-control:valid:focus {
border-color:#73a839;
@ -1932,7 +1932,7 @@ textarea.form-control {
border-color:#73a839;
padding-right:calc(.75em + 2.3125rem);
background:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='4' height='5' viewBox='0 0 4 5'%3e%3cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3e%3c/svg%3e") no-repeat right .75rem center/8px 10px,url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath fill='%2373a839' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e") #fff no-repeat center right 1.75rem/calc(.75em + .375rem) calc(.75em + .375rem)
}rl("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23c71c22' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23c71c22' stroke='none'/%3e%3c/svg%3e");
}
.custom-select.is-valid:focus,.was-validated .custom-select:valid:focus {
border-color:#73a839;
box-shadow:0 0 0 .2rem rgba(115,168,57,.25)

@ -8910,7 +8910,7 @@ div[data-id="remixIdeSidePanel"] {
}
.custom-dropdown-items {
background: #011627!important; // override --custom-select
background: #011627!important;
}
.remix-ui-tabs {

File diff suppressed because one or more lines are too long

@ -2,8 +2,9 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": ["node"]
"types": ["node"],
"module": "es2020"
},
"exclude": ["**/*.spec.ts", "**/*.spec.tsx"],
"exclude": ["**/*.spec.ts", "**/*.spec.tsx", "./src/assets/**/*"],
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
}

@ -1,8 +1,9 @@
const nxWebpack = require('@nrwl/react/plugins/webpack')
const TerserPlugin = require('terser-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const CopyPlugin = require("copy-webpack-plugin");
const webpack = require('webpack')
const version = require('../../package.json').version
const fs = require('fs')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const versionData = {
version: version,
@ -18,31 +19,53 @@ module.exports = config => {
...nxWebpackConfig,
resolve: {
...nxWebpackConfig.resolve,
alias: {
path: require.resolve("path-browserify"),
}
fallback: {
...nxWebpackConfig.resolve.fallback,
"crypto": require.resolve("crypto-browserify"),
"stream": require.resolve("stream-browserify"),
"path": require.resolve("path-browserify"),
"http": require.resolve("stream-http"),
"https": require.resolve("https-browserify"),
"constants": require.resolve("constants-browserify"),
"os": false, //require.resolve("os-browserify/browser"),
"timers": false, // require.resolve("timers-browserify"),
"zlib": require.resolve("browserify-zlib"),
"fs": false,
"module": false,
"tls": false,
"net": false,
"readline": false,
"child_process": false,
"buffer": require.resolve("buffer/"),
"vm": require.resolve('vm-browserify'),
},
},
node: {
fs: 'empty',
tls: 'empty',
readline: 'empty',
net: 'empty',
module: 'empty',
child_process: 'empty'
externals: {
...nxWebpackConfig.externals,
solc: 'solc',
},
output: {
...nxWebpackConfig.output,
publicPath: '/',
filename: `[name].${versionData.version}.${versionData.timestamp}.js`,
chunkFilename: `[name].${versionData.version}.${versionData.timestamp}.js`,
},
plugins: [
...nxWebpackConfig.plugins,
new CopyWebpackPlugin({
//new BundleAnalyzerPlugin({
// analyzerMode: 'static'
//}),
new CopyPlugin({
patterns: [
{ from: '../../../node_modules/monaco-editor/dev/vs/', to: 'assets/js/monaco-editor/dev/vs' }
{ from: '../../node_modules/monaco-editor/dev/vs', to: 'assets/js/monaco-editor/dev/vs' }
].filter(Boolean)
})
}),
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
url: ['url', 'URL'],
process: 'process/browser',
}),
]
}
@ -53,10 +76,6 @@ module.exports = config => {
...webpackConfig,
mode: 'production',
devtool: 'source-map',
optimization: {
minimize: false,
minimizer: [new TerserPlugin()]
}
}
} else {
return webpackConfig

@ -0,0 +1,61 @@
{
"name": "solidity-compiler",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/solidity-compiler/src",
"projectType": "application",
"implicitDependencies": [],
"targets": {
"build": {
"executor": "@nrwl/webpack:webpack",
"outputs": [
"{options.outputPath}"
],
"defaultConfiguration": "development",
"options": {
"compiler": "babel",
"outputPath": "dist/apps/solidity-compiler",
"index": "apps/solidity-compiler/src/index.html",
"baseHref": "/",
"main": "apps/solidity-compiler/src/main.tsx",
"polyfills": "apps/solidity-compiler/src/polyfills.ts",
"tsConfig": "apps/solidity-compiler/tsconfig.app.json",
"assets": [
"apps/solidity-compiler/src/favicon.ico",
"apps/solidity-compiler/src/assets"
],
"styles": [
"apps/solidity-compiler/src/styles.css"
],
"scripts": [],
"webpackConfig": "apps/solidity-compiler/webpack.config.js"
},
"configurations": {
"development": {},
"production": {
"fileReplacements": [
{
"replace": "apps/solidity-compiler/src/environments/environment.ts",
"with": "apps/solidity-compiler/src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"executor": "@nrwl/webpack:dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "solidity-compiler:build"
},
"configurations": {
"development": {
"buildTarget": "solidity-compiler:build:development"
},
"production": {
"buildTarget": "solidity-compiler:build:production"
}
}
}
},
"tags": []
}

@ -1,7 +1,7 @@
import React from 'react';
import { compile, helper } from '@remix-project/remix-solidity'
import { CompileTabLogic, parseContracts } from '@remix-ui/solidity-compiler' // eslint-disable-line
import type { ConfigurationSettings } from '@remix-project/remix-lib-ts'
import type { ConfigurationSettings } from '@remix-project/remix-lib'
export const CompilerApiMixin = (Base) => class extends Base {
currentFile: string

@ -3,7 +3,7 @@
import { PluginClient } from '@remixproject/plugin'
import { createClient } from '@remixproject/plugin-webview'
import { CompilerApiMixin } from './compiler-api'
import { ICompilerApi } from '@remix-project/remix-lib-ts'
import { ICompilerApi } from '@remix-project/remix-lib'
import { CompileTabLogic } from '@remix-ui/solidity-compiler'
const defaultCompilerParameters = {

@ -4,6 +4,20 @@
"outDir": "../../dist/out-tsc",
"types": ["node"]
},
"exclude": ["**/*.spec.ts", "**/*.spec.tsx"],
"files": [
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
"../../node_modules/@nrwl/react/typings/image.d.ts"
],
"exclude": [
"jest.config.ts",
"**/*.spec.ts",
"**/*.test.ts",
"**/*.spec.tsx",
"**/*.test.tsx",
"**/*.spec.js",
"**/*.test.js",
"**/*.spec.jsx",
"**/*.test.jsx"
],
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
}

@ -1,16 +1,16 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react",
"jsx": "react-jsx",
"allowJs": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"types": ["node", "jest"],
"resolveJsonModule": true
"allowSyntheticDefaultImports": true
},
"files": [
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
"../../node_modules/@nrwl/react/typings/image.d.ts"
],
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.app.json"
}
]
}

@ -1,15 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.spec.js",
"**/*.spec.jsx",
"**/*.d.ts"
]
}

@ -1,18 +1,35 @@
const nxWebpack = require('@nrwl/react/plugins/webpack')
const TerserPlugin = require('terser-webpack-plugin')
const webpack = require('webpack')
module.exports = config => {
const nxWebpackConfig = nxWebpack(config)
const webpackConfig = {
...nxWebpackConfig,
node: {
fs: 'empty',
tls: 'empty',
readline: 'empty',
net: 'empty',
module: 'empty',
child_process: 'empty'
}
resolve: {
...nxWebpackConfig.resolve,
fallback: {
...nxWebpackConfig.resolve.fallback,
"crypto": require.resolve("crypto-browserify"),
"stream": require.resolve("stream-browserify"),
"path": require.resolve("path-browserify"),
"http": require.resolve("stream-http"),
"https": require.resolve("https-browserify"),
"zlib": require.resolve("browserify-zlib"),
"fs": false,
"module": false,
"tls": false,
"net": false,
"readline": false,
"child_process": false,
"buffer": require.resolve("buffer/"),
},
},
plugins: [
...nxWebpackConfig.plugins,
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
],
}
if (process.env.NODE_ENV === 'production') {
@ -20,10 +37,6 @@ module.exports = config => {
...webpackConfig,
mode: 'production',
devtool: 'source-map',
optimization: {
minimize: true,
minimizer: [new TerserPlugin()]
}
}
} else {
return webpackConfig

@ -0,0 +1,62 @@
{
"name": "vyper",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/vyper/src",
"projectType": "application",
"implicitDependencies": [
"remix-debug"
],
"targets": {
"build": {
"executor": "@nrwl/webpack:webpack",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "development",
"options": {
"compiler": "babel",
"outputPath": "dist/apps/vyper",
"index": "apps/vyper/src/index.html",
"baseHref": "/",
"main": "apps/vyper/src/main.tsx",
"polyfills": "apps/vyper/src/polyfills.ts",
"tsConfig": "apps/vyper/tsconfig.app.json",
"assets": [
"apps/vyper/src/favicon.ico",
"apps/vyper/src/assets"
],
"styles": ["apps/vyper/src/styles.css"],
"scripts": [],
"webpackConfig": "apps/vyper/webpack.config.js"
},
"configurations": {
"development": {
},
"production": {
"fileReplacements": [
{
"replace": "apps/vyper/src/environments/environment.ts",
"with": "apps/vyper/src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"executor": "@nrwl/webpack:dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "vyper:build",
"hmr": true
},
"configurations": {
"development": {
"buildTarget": "vyper:build:development",
"port": 5002
},
"production": {
"buildTarget": "vyper:build:production"
}
}
}
},
"tags": []
}

@ -1,17 +1,21 @@
const nxWebpack = require('@nrwl/react/plugins/webpack')
const TerserPlugin = require('terser-webpack-plugin')
module.exports = config => {
const nxWebpackConfig = nxWebpack(config)
const webpackConfig = {
...nxWebpackConfig,
node: {
fs: 'empty',
tls: 'empty',
readline: 'empty',
net: 'empty',
module: 'empty',
child_process: 'empty'
resolve : {
...nxWebpackConfig.resolve,
fallback: {
...nxWebpackConfig.resolve.fallback,
"crypto": require.resolve("crypto-browserify"),
"stream": require.resolve("stream-browserify"),
"http" : require.resolve("stream-http"),
"https" : require.resolve("https-browserify"),
"path" : require.resolve("path-browserify"),
"module": false,
"fs" : false
},
}
}
@ -20,10 +24,6 @@ module.exports = config => {
...webpackConfig,
mode: 'production',
devtool: 'source-map',
optimization: {
minimize: true,
minimizer: [new TerserPlugin()]
}
}
} else {
return webpackConfig

@ -1,4 +1,9 @@
module.exports = {
"presets": ["@babel/preset-react", "@babel/preset-typescript"],
"plugins": ["@babel/plugin-transform-modules-commonjs", "@babel/plugin-proposal-class-properties"]
"presets": ["@babel/preset-typescript", "@babel/preset-env", "@babel/preset-react"],
"plugins": [
"babel-plugin-replace-ts-export-assignment",
"@babel/plugin-transform-modules-commonjs",
"@babel/plugin-proposal-class-properties",
["@babel/plugin-proposal-private-property-in-object", { "loose": false }],
["@babel/plugin-proposal-private-methods", { "loose": false }]]
}

@ -1,25 +0,0 @@
module.exports = {
testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],
transform: {
'^.+\\.(ts|js|html)$': 'ts-jest'
},
resolver: '@nrwl/jest/plugins/resolver',
moduleFileExtensions: ['ts', 'js', 'html'],
coverageReporters: ['html'],
moduleNameMapper:{
"@remix-project/remix-analyzer": "<rootDir>/../../dist/libs/remix-analyzer/src/index.js",
"@remix-project/remix-astwalker": "<rootDir>/../../dist/libs/remix-astwalker/src/index.js",
"@remix-project/remix-debug": "<rootDir>/../../dist/libs/remix-debug/src/index.js",
"@remix-project/remix-lib": "<rootDir>/../../dist/libs/remix-lib/src/index.js",
"@remix-project/remix-simulator": "<rootDir>/../../dist/libs/remix-simulator/src/index.js",
"@remix-project/remix-solidity": "<rootDir>/../../dist/libs/remix-solidity/src/index.js",
"@remix-project/remix-tests": "<rootDir>/../../dist/libs/remix-tests/src/index.js",
"@remix-project/remix-url-resolver":
"<rootDir>/../../dist/libs/remix-url-resolver/src/index.js"
,
"@remix-project/remix-ws-templates":
"<rootDir>/../../dist/libs/remix-ws-templates/src/index.js"
,
"@remix-project/remixd": "<rootDir>/../../dist/libs/remixd/index.js"
}
};

@ -7,5 +7,7 @@
"dot-notation": "off",
"no-use-before-define": "off"
},
"ignorePatterns": ["!**/*"]
"ignorePatterns": [
"**/node_modules/**"
]
}

@ -2,7 +2,9 @@
"name": "@remix-project/remix-analyzer",
"version": "0.5.30",
"description": "Tool to perform static analysis on Solidity smart contracts",
"main": "src/index.js",
"scripts": {
"test": "./../../node_modules/.bin/ts-node --project ../../tsconfig.base.json --require tsconfig-paths/register ./../../node_modules/.bin/tape ./test/tests.ts"
},
"types": "src/index.d.ts",
"contributors": [
{
@ -34,10 +36,6 @@
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "tsc",
"test": "./../../node_modules/.bin/ts-node --require tsconfig-paths/register ./../../node_modules/.bin/tape ./test/tests.ts"
},
"author": "Remix Team",
"license": "MIT",
"homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-analyzer#readme",

@ -0,0 +1,31 @@
{
"name": "remix-analyzer",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/remix-analyzer/src",
"projectType": "library",
"implicitDependencies": [
"remix-astwalker",
"remix-lib"
],
"targets": {
"build": {
"executor": "@nrwl/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/remix-analyzer",
"main": "libs/remix-analyzer/src/index.ts",
"tsConfig": "libs/remix-analyzer/tsconfig.lib.json",
"assets": []
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/remix-analyzer/**/*.ts"]
}
}
},
"tags": []
}

@ -1 +1,2 @@
export { default as CodeAnalysis } from './solidity-analyzer'
export { ContractDefinitionAstNode, EventDefinitionAstNode, FunctionCallAstNode, FunctionDefinitionAstNode, IdentifierAstNode, ImportDirectiveAstNode, ModifierDefinitionAstNode, SourceUnitAstNode, StructDefinitionAstNode, VariableDeclarationAstNode } from './types'

@ -3,9 +3,11 @@ import * as common from '../../src/solidity-analyzer/modules/staticAnalysisCommo
const { localCall, thisLocalCall, libCall, externalDirect, superLocal, assignment, abiNamespaceCallNodes,
inlineAssembly, unaryOperation, nowAst, blockTimestamp, stateVariableContractNode,
functionDefinition, requireCall, selfdestruct, storageVariableNodes, dynamicDeleteUnaryOp,
// eslint-disable-next-line @typescript-eslint/no-var-requires
lowlevelCall, parameterFunction, parameterFunctionCall, inheritance, blockHashAccess, contractDefinition, funcDefForComplexParams } = require('./astBlocks')
// eslint-disable-next-line @typescript-eslint/no-var-requires
const compiledContractObj = require('./compilationDetails/CompiledContractObj.json')
function escapeRegExp (str) {
return str.replace(/[-[\]/{}()+?.\\^$|]/g, '\\$&')
@ -237,7 +239,7 @@ test('staticAnalysisCommon.getInheritsFromName', function (t) {
test('staticAnalysisCommon.getDeclaredVariableName', function (t) {
t.plan(2)
t.ok(common.getDeclaredVariableName(storageVariableNodes.node1) === 'c', 'extract right variable name')
let node1 = JSON.parse(JSON.stringify(storageVariableNodes))
const node1 = JSON.parse(JSON.stringify(storageVariableNodes))
node1.node1.nodeType = 'FunctionCall'
t.throws(() => common.getDeclaredVariableName(node1) === 'x', new RegExp('staticAnalysisCommon.js: not a VariableDeclaration Node'), 'throw if wrong node')
})

@ -815,7 +815,7 @@ function runModuleOnFiles (Module: any, t: test.Test, cb: ((fname: string, repor
const statRunner: StatRunner = new StatRunner()
testFiles.forEach((fileName: string) => {
const reports = statRunner.runWithModuleList(compilationResults[fileName], [{ name: new Module().name, mod: new Module() }])
let report: AnalysisReportObj[] = reports[0].report
const report: AnalysisReportObj[] = reports[0].report
if (report.some((x: AnalysisReportObj) => x.warning.includes('INTERNAL ERROR'))) {
t.comment('Error while executing Module: ' + JSON.stringify(report))
}

@ -38,7 +38,7 @@ const testFiles: string[] = [
'forLoopIteratesOverDynamicArray.sol'
]
let compilationResults: Record<string, CompilationResult> = {}
const compilationResults: Record<string, CompilationResult> = {}
test('setup', function (t) {
solc.loadRemoteVersion('v0.5.0+commit.1d4f565a', (error, compiler) => {
@ -817,7 +817,7 @@ function runModuleOnFiles (Module: any, t: test.Test, cb: ((fname: string, repor
const statRunner: StatRunner = new StatRunner()
testFiles.forEach((fileName: string) => {
const reports = statRunner.runWithModuleList(compilationResults[fileName], [{ name: new Module().name, mod: new Module() }])
let report: AnalysisReportObj[] = reports[0].report
const report: AnalysisReportObj[] = reports[0].report
if (report.some((x: AnalysisReportObj) => x['warning'].includes('INTERNAL ERROR'))) {
t.comment('Error while executing Module: ' + JSON.stringify(report))
}

@ -2,9 +2,12 @@
"extends": "../../.eslintrc",
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/prefer-namespace-keyword": "off",
"@typescript-eslint/no-unused-vars": "off",
"no-unused-vars": "off",
"dot-notation": "off",
"no-use-before-define": "off"
},
"ignorePatterns": ["!**/*"]
"ignorePatterns": [
"**/node_modules/**"
]
}

@ -4,7 +4,6 @@
"description": "Tool to walk through Solidity AST",
"main": "src/index.js",
"scripts": {
"build": "tsc",
"test": "./../../node_modules/.bin/nyc --reporter=lcov --require ts-node/register --require tsconfig-paths/register ./../../node_modules/.bin/tape ./tests/*.ts | ./../../node_modules/.bin/tap-spec; ./../../node_modules/.bin/nyc report ---reporter=text"
},
"publishConfig": {

@ -0,0 +1,30 @@
{
"name": "remix-astwalker",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/remix-astwalker/src",
"projectType": "library",
"implicitDependencies": [
"remix-lib"
],
"targets": {
"build": {
"executor": "@nrwl/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/remix-astwalker",
"main": "libs/remix-astwalker/src/index.ts",
"tsConfig": "libs/remix-astwalker/tsconfig.lib.json",
"assets": []
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/remix-astwalker/**/*.ts"]
}
}
},
"tags": []
}

@ -1,6 +1,7 @@
// Type definitions for the things we need from remix-lib
declare module 'remix-lib' {
// eslint-disable-next-line @typescript-eslint/prefer-namespace-keyword
export module util {
export function findLowerBound(target: number, array: Array<number>): number;
}

@ -33,7 +33,7 @@ tape("New ASTWalker", (t: tape.Test) => {
});
// Callback Object
var callback: any = {};
const callback: any = {};
callback.FunctionDefinition = function(node: AstNode): boolean {
st.equal(node.name, "FunctionDefinition");
@ -60,7 +60,7 @@ tape("New ASTWalker", (t: tape.Test) => {
st.plan(26);
st.equal(latestAST.nodeType, 'SourceUnit')
let subNodes1 = astWalker.getASTNodeChildren(latestAST)
const subNodes1 = astWalker.getASTNodeChildren(latestAST)
st.equal(subNodes1.length, 3)
st.equal(subNodes1[0].nodeType, 'PragmaDirective')
@ -95,11 +95,11 @@ tape("New ASTWalker", (t: tape.Test) => {
st.equal(subNodes4.length, 1)
st.equal(subNodes4[0].nodeType, 'ExpressionStatement')
let subNodes5 = astWalker.getASTNodeChildren(subNodes4[0])
const subNodes5 = astWalker.getASTNodeChildren(subNodes4[0])
st.equal(subNodes5.length, 1)
st.equal(subNodes5[0].nodeType, 'Assignment')
let subNodes6 = astWalker.getASTNodeChildren(subNodes5[0])
const subNodes6 = astWalker.getASTNodeChildren(subNodes5[0])
st.equal(subNodes6.length, 2)
st.equal(subNodes6[0].nodeType, 'Identifier')
@ -125,7 +125,7 @@ tape("New ASTWalker", (t: tape.Test) => {
});
st.equal(count, astNodeCount, "traverses all AST nodes");
count = 0;
let badCall = function() {
const badCall = function() {
/* Typescript will keep us from calling walkFull with a legacyAST.
However, for non-typescript uses, we add this test which casts
to an AST to check that there is a run-time check in walkFull.

@ -1,4 +1,4 @@
let node = { "legacyAST": { "children": [{ "attributes": { "literals": ["solidity", ">=", "0.5", ".0", "<", "0.6", ".0"] }, "id": 1, "name": "PragmaDirective", "src": "0:31:0" }, { "attributes": { "SourceUnit": 53, "absolutePath": "mortal.sol", "file": "mortal.sol", "scope": 26, "symbolAliases": [null], "unitAlias": "" }, "id": 2, "name": "ImportDirective", "src": "32:20:0" }, { "attributes": { "contractDependencies": [52], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [25, 52], "name": "Greeter", "scope": 26 }, "children": [{ "attributes": { "arguments": null }, "children": [{ "attributes": { "contractScope": null, "name": "Mortal", "referencedDeclaration": 52, "type": "contract Mortal" }, "id": 3, "name": "UserDefinedTypeName", "src": "74:6:0" }], "id": 4, "name": "InheritanceSpecifier", "src": "74:6:0" }, { "attributes": { "constant": false, "name": "greeting", "scope": 25, "stateVariable": true, "storageLocation": "default", "type": "string", "value": null, "visibility": "internal" }, "children": [{ "attributes": { "name": "string", "type": "string" }, "id": 5, "name": "ElementaryTypeName", "src": "141:6:0" }], "id": 6, "name": "VariableDeclaration", "src": "141:15:0" }, { "attributes": { "documentation": null, "implemented": true, "isConstructor": true, "kind": "constructor", "modifiers": [null], "name": "", "scope": 25, "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, "children": [{ "children": [{ "attributes": { "constant": false, "name": "_greeting", "scope": 16, "stateVariable": false, "storageLocation": "memory", "type": "string", "value": null, "visibility": "internal" }, "children": [{ "attributes": { "name": "string", "type": "string" }, "id": 7, "name": "ElementaryTypeName", "src": "225:6:0" }], "id": 8, "name": "VariableDeclaration", "src": "225:23:0" }], "id": 9, "name": "ParameterList", "src": "224:25:0" }, { "attributes": { "parameters": [null] }, "children": [], "id": 10, "name": "ParameterList", "src": "257:0:0" }, { "children": [{ "children": [{ "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "=", "type": "string storage ref" }, "children": [{ "attributes": { "argumentTypes": null, "overloadedDeclarations": [null], "referencedDeclaration": 6, "type": "string storage ref", "value": "greeting" }, "id": 11, "name": "Identifier", "src": "267:8:0" }, { "attributes": { "argumentTypes": null, "overloadedDeclarations": [null], "referencedDeclaration": 8, "type": "string memory", "value": "_greeting" }, "id": 12, "name": "Identifier", "src": "278:9:0" }], "id": 13, "name": "Assignment", "src": "267:20:0" }], "id": 14, "name": "ExpressionStatement", "src": "267:20:0" }], "id": 15, "name": "Block", "src": "257:37:0" }], "id": 16, "name": "FunctionDefinition", "src": "213:81:0" }, { "attributes": { "documentation": null, "implemented": true, "isConstructor": false, "kind": "function", "modifiers": [null], "name": "greet", "scope": 25, "stateMutability": "view", "superFunction": null, "visibility": "public" }, "children": [{ "attributes": { "parameters": [null] }, "children": [], "id": 17, "name": "ParameterList", "src": "338:2:0" }, { "children": [{ "attributes": { "constant": false, "name": "", "scope": 24, "stateVariable": false, "storageLocation": "memory", "type": "string", "value": null, "visibility": "internal" }, "children": [{ "attributes": { "name": "string", "type": "string" }, "id": 18, "name": "ElementaryTypeName", "src": "362:6:0" }], "id": 19, "name": "VariableDeclaration", "src": "362:13:0" }], "id": 20, "name": "ParameterList", "src": "361:15:0" }, { "children": [{ "attributes": { "functionReturnParameters": 20 }, "children": [{ "attributes": { "argumentTypes": null, "overloadedDeclarations": [null], "referencedDeclaration": 6, "type": "string storage ref", "value": "greeting" }, "id": 21, "name": "Identifier", "src": "394:8:0" }], "id": 22, "name": "Return", "src": "387:15:0" }], "id": 23, "name": "Block", "src": "377:32:0" }], "id": 24, "name": "FunctionDefinition", "src": "324:85:0" }], "id": 25, "name": "ContractDefinition", "src": "54:357:0" }], "name": "SourceUnit", "attributes": { "absolutePath": "greeter.sol", "exportedSymbols": { "Greeter": [25] } }, "id": 26, "src": "0:412:0" } }
const node = { "legacyAST": { "children": [{ "attributes": { "literals": ["solidity", ">=", "0.5", ".0", "<", "0.6", ".0"] }, "id": 1, "name": "PragmaDirective", "src": "0:31:0" }, { "attributes": { "SourceUnit": 53, "absolutePath": "mortal.sol", "file": "mortal.sol", "scope": 26, "symbolAliases": [null], "unitAlias": "" }, "id": 2, "name": "ImportDirective", "src": "32:20:0" }, { "attributes": { "contractDependencies": [52], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [25, 52], "name": "Greeter", "scope": 26 }, "children": [{ "attributes": { "arguments": null }, "children": [{ "attributes": { "contractScope": null, "name": "Mortal", "referencedDeclaration": 52, "type": "contract Mortal" }, "id": 3, "name": "UserDefinedTypeName", "src": "74:6:0" }], "id": 4, "name": "InheritanceSpecifier", "src": "74:6:0" }, { "attributes": { "constant": false, "name": "greeting", "scope": 25, "stateVariable": true, "storageLocation": "default", "type": "string", "value": null, "visibility": "internal" }, "children": [{ "attributes": { "name": "string", "type": "string" }, "id": 5, "name": "ElementaryTypeName", "src": "141:6:0" }], "id": 6, "name": "VariableDeclaration", "src": "141:15:0" }, { "attributes": { "documentation": null, "implemented": true, "isConstructor": true, "kind": "constructor", "modifiers": [null], "name": "", "scope": 25, "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, "children": [{ "children": [{ "attributes": { "constant": false, "name": "_greeting", "scope": 16, "stateVariable": false, "storageLocation": "memory", "type": "string", "value": null, "visibility": "internal" }, "children": [{ "attributes": { "name": "string", "type": "string" }, "id": 7, "name": "ElementaryTypeName", "src": "225:6:0" }], "id": 8, "name": "VariableDeclaration", "src": "225:23:0" }], "id": 9, "name": "ParameterList", "src": "224:25:0" }, { "attributes": { "parameters": [null] }, "children": [], "id": 10, "name": "ParameterList", "src": "257:0:0" }, { "children": [{ "children": [{ "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "=", "type": "string storage ref" }, "children": [{ "attributes": { "argumentTypes": null, "overloadedDeclarations": [null], "referencedDeclaration": 6, "type": "string storage ref", "value": "greeting" }, "id": 11, "name": "Identifier", "src": "267:8:0" }, { "attributes": { "argumentTypes": null, "overloadedDeclarations": [null], "referencedDeclaration": 8, "type": "string memory", "value": "_greeting" }, "id": 12, "name": "Identifier", "src": "278:9:0" }], "id": 13, "name": "Assignment", "src": "267:20:0" }], "id": 14, "name": "ExpressionStatement", "src": "267:20:0" }], "id": 15, "name": "Block", "src": "257:37:0" }], "id": 16, "name": "FunctionDefinition", "src": "213:81:0" }, { "attributes": { "documentation": null, "implemented": true, "isConstructor": false, "kind": "function", "modifiers": [null], "name": "greet", "scope": 25, "stateMutability": "view", "superFunction": null, "visibility": "public" }, "children": [{ "attributes": { "parameters": [null] }, "children": [], "id": 17, "name": "ParameterList", "src": "338:2:0" }, { "children": [{ "attributes": { "constant": false, "name": "", "scope": 24, "stateVariable": false, "storageLocation": "memory", "type": "string", "value": null, "visibility": "internal" }, "children": [{ "attributes": { "name": "string", "type": "string" }, "id": 18, "name": "ElementaryTypeName", "src": "362:6:0" }], "id": 19, "name": "VariableDeclaration", "src": "362:13:0" }], "id": 20, "name": "ParameterList", "src": "361:15:0" }, { "children": [{ "attributes": { "functionReturnParameters": 20 }, "children": [{ "attributes": { "argumentTypes": null, "overloadedDeclarations": [null], "referencedDeclaration": 6, "type": "string storage ref", "value": "greeting" }, "id": 21, "name": "Identifier", "src": "394:8:0" }], "id": 22, "name": "Return", "src": "387:15:0" }], "id": 23, "name": "Block", "src": "377:32:0" }], "id": 24, "name": "FunctionDefinition", "src": "324:85:0" }], "id": 25, "name": "ContractDefinition", "src": "54:357:0" }], "name": "SourceUnit", "attributes": { "absolutePath": "greeter.sol", "exportedSymbols": { "Greeter": [25] } }, "id": 26, "src": "0:412:0" } }
node['source'] = `contract test {
int x;

@ -1,7 +1,5 @@
import { Node } from '../../src/'
let node: Node;
node = {
const node: Node = {
"ast":
{
"absolutePath": "greeter.sol",

@ -1 +1,13 @@
{ "extends": "../../.eslintrc", "rules": {}, "ignorePatterns": ["!**/*"] }
{
"extends": "../../.eslintrc",
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"no-unused-vars": "off",
"dot-notation": "off",
"no-use-before-define": "off"
},
"ignorePatterns": [
"**/node_modules/**"
]
}

@ -2,10 +2,8 @@
"name": "@remix-project/core-plugin",
"version": "0.0.1",
"description": "This library was generated with [Nx](https://nx.dev).",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"main": "src/index.js",
"type": "module",
"author": "Remix Team",
"license": "ISC"
}

@ -0,0 +1,27 @@
{
"name": "remix-core-plugin",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/remix-core-plugin/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nrwl/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/remix-core-plugin",
"main": "libs/remix-core-plugin/src/index.ts",
"tsConfig": "libs/remix-core-plugin/tsconfig.lib.json",
"assets": []
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/remix-core-plugin/**/*.ts"]
}
}
},
"tags": []
}

@ -123,6 +123,7 @@ export class CompilerImports extends Plugin {
* @returns {Promise} - string content
*/
async resolveAndSave (url, targetPath) {
console.log('resolveAndSave', url, targetPath)
try {
if (targetPath && this.currentRequest) {
const canCall = await this.askUserPermission('resolveAndSave', 'This action will update the path ' + targetPath)

@ -1,12 +1,14 @@
#!/usr/bin/env node
import program from 'commander'
import { Command } from 'commander';
import { compileStandardWrapper } from 'solc'
import { readFileSync } from 'fs'
import { start } from 'repl'
import { version } from '../package.json'
import { CmdLine } from '../src/cmdline/index'
const program = new Command();
program
.command('version')
.description("outputs version number")

@ -17,6 +17,9 @@
}
],
"main": "src/index.js",
"scripts": {
"test": "./../../node_modules/.bin/ts-node --project ../../tsconfig.base.json --require tsconfig-paths/register ./../../node_modules/.bin/tape ./test/tests.ts"
},
"dependencies": {
"@ethereumjs/block": "^3.5.1",
"@ethereumjs/common": "^2.5.0",
@ -29,7 +32,7 @@
"ansi-gray": "^0.1.1",
"async": "^2.6.2",
"color-support": "^1.1.3",
"commander": "^2.19.0",
"commander": "^9.4.1",
"deep-equal": "^1.0.1",
"ethereumjs-util": "^7.0.10",
"ethers": "^5.4.2",
@ -52,9 +55,6 @@
"solc": "^0.7.4",
"tape": "^4.6.0"
},
"scripts": {
"test": "./../../node_modules/.bin/ts-node --require tsconfig-paths/register ./../../node_modules/.bin/tape ./test/tests.ts"
},
"publishConfig": {
"access": "public"
},

@ -0,0 +1,31 @@
{
"name": "remix-debug",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/remix-debug/src",
"projectType": "library",
"implicitDependencies": [
"remix-lib",
"remix-astwalker"
],
"targets": {
"build": {
"executor": "@nrwl/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/remix-debug",
"main": "libs/remix-debug/src/index.ts",
"tsConfig": "libs/remix-debug/tsconfig.lib.json",
"assets": []
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/remix-debug/**/*.ts"]
}
}
},
"tags": []
}

@ -1,5 +1,5 @@
import Web3 from 'web3'
import { Debugger } from '../debugger/debugger.js'
import { Debugger } from '../debugger/debugger'
import { EventEmitter } from 'events'
export class CmdLine {

@ -10,6 +10,10 @@ import { BreakpointManager } from './code/breakpointManager'
import * as sourceMappingDecoder from './source/sourceMappingDecoder'
import * as traceHelper from './trace/traceHelper'
const storage = {
StorageViewer: StorageViewer,
StorageResolver: StorageResolver
}
/*
Use of breakPointManager :
@ -18,7 +22,7 @@ import * as traceHelper from './trace/traceHelper'
})
this.debugger.setBreakpointManager(breakPointManager)
*/
export = {
export {
init,
traceHelper,
sourceMappingDecoder,
@ -32,9 +36,6 @@ export = {
*/
BreakpointManager,
SolidityDecoder,
storage: {
StorageViewer: StorageViewer,
StorageResolver: StorageResolver
},
storage,
CmdLine
}

@ -1,14 +1,14 @@
// TODO: this file shoudl be removed at some point
var CmdLine = require('./src/cmdline/index')
const CmdLine = require('./src/cmdline/index')
// var compilation = require('./compilation.json')
var solc = require('solc')
var fs = require('fs')
const solc = require('solc')
const fs = require('fs')
var filename = 'test/sol/simple_storage.sol'
var shortFilename = 'simple_storage.sol'
const filename = 'test/sol/simple_storage.sol'
const shortFilename = 'simple_storage.sol'
var inputJson = {
const inputJson = {
language: 'Solidity',
sources: {
},
@ -32,15 +32,15 @@ console.dir(inputJson)
console.log('compiling...')
let compilationData = JSON.parse(solc.compileStandardWrapper(JSON.stringify(inputJson)))
const compilationData = JSON.parse(solc.compileStandardWrapper(JSON.stringify(inputJson)))
console.dir(Object.keys(compilationData))
var compilation = {}
const compilation = {}
compilation['data'] = compilationData
compilation['source'] = { sources: inputJson.sources }
console.dir(compilation)
console.dir(compilation['data'].errors)
var cmdLine = new CmdLine()
const cmdLine = new CmdLine()
cmdLine.connect('http', 'http://localhost:8545')
cmdLine.loadCompilationResult(compilation)
cmdLine.initDebugger()
@ -59,7 +59,7 @@ cmdLine.initDebugger()
// }
// let _web3 = cmdLine.debugger.debugger.web3
var tx = '0xf510c4f0b1d9ee262d7b9e9e87b4262f275fe029c2c733feef7dfa1e2b1e32aa'
const tx = '0xf510c4f0b1d9ee262d7b9e9e87b4262f275fe029c2c733feef7dfa1e2b1e32aa'
// deployContract((err, tx) => {
cmdLine.startDebug(tx, shortFilename)
@ -75,7 +75,7 @@ const repl = require('repl')
repl.start({
prompt: '> ',
eval: (cmd, context, filename, cb) => {
let command = cmd.trim()
const command = cmd.trim()
if (command === 'next' || command === 'n') {
cmdLine.stepOverForward(true)
}
@ -98,7 +98,7 @@ repl.start({
cmdLine.displayGlobals()
}
if (command.split(' ')[0] === 'jump') {
let stepIndex = parseInt(command.split(' ')[1], 10)
const stepIndex = parseInt(command.split(' ')[1], 10)
cmdLine.jumpTo(stepIndex)
}
cb(null, '')

@ -6,7 +6,7 @@ const web3Test = require('./resources/testWeb3.ts')
tape('CodeManager', function (t) {
const traceManager = new TraceManager({web3: web3Test})
let codeManager = new CodeManager(traceManager)
const codeManager = new CodeManager(traceManager)
const contractCode = web3Test.eth.getCode('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
codeManager.codeResolver.cacheExecutingCode('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5', contractCode) // so a call to web3 is not necessary
const tx = web3Test.eth.getTransaction('0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51')

@ -6,10 +6,10 @@ import * as sourceMappingDecoder from '../src/source/sourceMappingDecoder'
import { Ethdebugger as Debugger } from '../src/Ethdebugger'
import { BreakpointManager } from '../src/code/breakpointManager'
var compiler = require('solc')
var vmCall = require('./vmCall')
const compiler = require('solc')
const vmCall = require('./vmCall')
var ballot = `pragma solidity >=0.4.22 <0.8.0;
const ballot = `pragma solidity >=0.4.22 <0.8.0;
/**
* @title Ballot
@ -151,8 +151,8 @@ contract Ballot {
`;
(async () => {
var privateKey = Buffer.from('503f38a9c967ed597e47fe25643985f032b072db8075426a92110f82df48dfcb', 'hex')
var output = compiler.compile(compilerInput(ballot))
const privateKey = Buffer.from('503f38a9c967ed597e47fe25643985f032b072db8075426a92110f82df48dfcb', 'hex')
let output = compiler.compile(compilerInput(ballot))
output = JSON.parse(output)
const param = '0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000148656c6c6f20576f726c64210000000000000000000000000000000000000000'
const web3 = await vmCall.getWeb3()
@ -170,7 +170,7 @@ contract Ballot {
sources: { 'test.sol': { content: ballot } }
}
const compilationResults = new CompilerAbstract('json', output, sources)
var debugManager = new Debugger({
const debugManager = new Debugger({
compilationResult: () => compilationResults,
web3: web3,
offsetToLineColumnConverter: {
@ -233,7 +233,7 @@ function testDebugging (debugManager) {
try {
const address = debugManager.traceManager.getCurrentCalledAddressAt(38)
console.log(address)
var storageView = debugManager.storageViewAt(196, address)
const storageView = debugManager.storageViewAt(196, address)
storageView.storageRange().then((storage) => {
t.equal(JSON.stringify(storage), JSON.stringify({ '0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563': { key: '0x0000000000000000000000000000000000000000000000000000000000000000', value: '0x0000000000000000000000005b38da6a701c568545dcfcb03fcb875f56beddc4' } }))
@ -282,7 +282,7 @@ function testDebugging (debugManager) {
tape('breakPointManager', (t) => {
t.plan(2)
const {traceManager, callTree, solidityProxy} = debugManager
var breakPointManager = new BreakpointManager({traceManager, callTree, solidityProxy})
const breakPointManager = new BreakpointManager({traceManager, callTree, solidityProxy})
breakPointManager.add({fileName: 'test.sol', row: 39})

@ -4,20 +4,20 @@ import { compile } from 'solc'
import * as astHelper from '../../src/solidity-decoder/astHelper'
import * as decodeInfo from '../../src/solidity-decoder/decodeInfo'
import * as stateDecoder from '../../src/solidity-decoder/stateDecoder'
var contracts = require('./contracts/miscContracts')
var simplecontracts = require('./contracts/simpleContract')
const contracts = require('./contracts/miscContracts')
const simplecontracts = require('./contracts/simpleContract')
import { compilerInput } from '../helpers/compilerHelper'
import * as util from '../../src/solidity-decoder/types/util'
tape('solidity', function (t) {
t.test('astHelper, decodeInfo', function (st) {
var output = compile(compilerInput(contracts))
let output = compile(compilerInput(contracts))
output = JSON.parse(output)
var state: any = astHelper.extractStateDefinitions('test.sol:contractUint', output.sources, null)
var states = astHelper.extractStatesDefinitions(output.sources, null)
var stateDef = state.stateDefinitions
var parsedType = decodeInfo.parseType(stateDef[0].typeDescriptions.typeString, states, 'contractUint', util.extractLocationFromAstVariable(stateDef[0]))
let state: any = astHelper.extractStateDefinitions('test.sol:contractUint', output.sources, null)
let states = astHelper.extractStatesDefinitions(output.sources, null)
let stateDef = state.stateDefinitions
let parsedType = decodeInfo.parseType(stateDef[0].typeDescriptions.typeString, states, 'contractUint', util.extractLocationFromAstVariable(stateDef[0]))
checkDecodeInfo(st, parsedType, 1, 1, 'uint8')
parsedType = decodeInfo.parseType(stateDef[1].typeDescriptions.typeString, states, 'contractUint', util.extractLocationFromAstVariable(stateDef[1]))
checkDecodeInfo(st, parsedType, 1, 32, 'uint256')

@ -1,28 +1,28 @@
'use strict'
import tape from 'tape'
var compiler = require('solc')
import { CompilerAbstract } from '@remix-project/remix-solidity'
var intLocal = require('./contracts/intLocal')
var miscLocal = require('./contracts/miscLocal')
var structArrayLocal = require('./contracts/structArrayLocal')
var calldataLocal = require('./contracts/calldata')
var vmCall = require('../vmCall')
var intLocalTest = require('./localsTests/int')
var miscLocalTest = require('./localsTests/misc')
var misc2LocalTest = require('./localsTests/misc2')
var structArrayLocalTest = require('./localsTests/structArray')
var calldataLocalTest = require('./localsTests/calldata')
var compilerInput = require('../helpers/compilerHelper').compilerInput
const compiler = require('solc')
const intLocal = require('./contracts/intLocal')
const miscLocal = require('./contracts/miscLocal')
const structArrayLocal = require('./contracts/structArrayLocal')
const calldataLocal = require('./contracts/calldata')
const vmCall = require('../vmCall')
const intLocalTest = require('./localsTests/int')
const miscLocalTest = require('./localsTests/misc')
const misc2LocalTest = require('./localsTests/misc2')
const structArrayLocalTest = require('./localsTests/structArray')
const calldataLocalTest = require('./localsTests/calldata')
const compilerInput = require('../helpers/compilerHelper').compilerInput
tape('solidity', function (t) {
t.test('local decoder', async function (st) {
var privateKey = Buffer.from('503f38a9c967ed597e47fe25643985f032b072db8075426a92110f82df48dfcb', 'hex')
const privateKey = Buffer.from('503f38a9c967ed597e47fe25643985f032b072db8075426a92110f82df48dfcb', 'hex')
await test(st, privateKey)
})
})
async function test (st, privateKey) {
var output = compiler.compile(compilerInput(intLocal.contract))
let output = compiler.compile(compilerInput(intLocal.contract))
output = JSON.parse(output)
let sources = {
target: 'test.sol',

@ -15,7 +15,7 @@ module.exports = async function (st, privateKey, contractBytecode, compilationRe
let web3
try {
web3 = await (vmCall as any).getWeb3()
let hash = await (vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode)
const hash = await (vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode)
const receipt = await web3.eth.getTransactionReceipt(hash)
const to = receipt.contractAddress
console.log('to', to)
@ -29,15 +29,15 @@ module.exports = async function (st, privateKey, contractBytecode, compilationRe
if (error) {
return st.fail(error)
}
var traceManager = new TraceManager({ web3 })
var codeManager = new CodeManager(traceManager)
const traceManager = new TraceManager({ web3 })
const codeManager = new CodeManager(traceManager)
codeManager.clear()
var solidityProxy = new SolidityProxy({
const solidityProxy = new SolidityProxy({
getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager),
getCode: codeManager.getCode.bind(codeManager),
compilationResult: () => compilationResult
})
var debuggerEvent = new EventManager()
const debuggerEvent = new EventManager()
const offsetToLineColumnConverter = {
offsetToLineColumn: (rawLocation) => {
return new Promise((resolve) => {
@ -46,7 +46,7 @@ module.exports = async function (st, privateKey, contractBytecode, compilationRe
})
}
}
var callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter)
const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter)
callTree.event.register('callTreeBuildFailed', (error) => {
st.fail(error)
})

@ -11,8 +11,9 @@ import * as sourceMappingDecoder from '../../../src/source/sourceMappingDecoder'
import * as helper from './helper'
module.exports = function (st, privateKey, contractBytecode, compilationResult, contractCode) {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve) => {
let web3 = await (vmCall as any).getWeb3();
const web3 = await (vmCall as any).getWeb3();
(vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, hash) {
if (error) {
return st.fail(error)
@ -22,15 +23,15 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult,
return st.fail(error)
}
tx.to = contractCreationToken('0')
var traceManager = new TraceManager({ web3 })
var codeManager = new CodeManager(traceManager)
const traceManager = new TraceManager({ web3 })
const codeManager = new CodeManager(traceManager)
codeManager.clear()
var solidityProxy = new SolidityProxy({
const solidityProxy = new SolidityProxy({
getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager),
getCode: codeManager.getCode.bind(codeManager),
compilationResult: () => compilationResult
})
var debuggerEvent = new EventManager()
const debuggerEvent = new EventManager()
const offsetToLineColumnConverter = {
offsetToLineColumn: (rawLocation) => {
return new Promise((resolve) => {
@ -39,7 +40,7 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult,
})
}
}
var callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter)
const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter)
callTree.event.register('callTreeBuildFailed', (error) => {
st.fail(error)
})
@ -53,9 +54,9 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult,
st.equals((await callTree.getGasCostPerLine(0, 16)).gasCost, 11)
st.equals((await callTree.getGasCostPerLine(0, 32)).gasCost, 84)
let functions1 = callTree.retrieveFunctionsStack(103)
let functions2 = callTree.retrieveFunctionsStack(116)
let functions3 = callTree.retrieveFunctionsStack(13)
const functions1 = callTree.retrieveFunctionsStack(103)
const functions2 = callTree.retrieveFunctionsStack(116)
const functions3 = callTree.retrieveFunctionsStack(13)
st.equals(functions1.length, 2)
st.equals(functions2.length, 3)

@ -10,6 +10,7 @@ import { CodeManager } from '../../../src/code/codeManager'
import * as sourceMappingDecoder from '../../../src/source/sourceMappingDecoder'
module.exports = function (st, privateKey, contractBytecode, compilationResult, contractCode) {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve) => {
const web3 = await (vmCall as any).getWeb3();
(vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, hash) {
@ -21,15 +22,15 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult,
return st.fail(error)
}
tx.to = contractCreationToken('0')
var traceManager = new TraceManager({ web3 })
var codeManager = new CodeManager(traceManager)
const traceManager = new TraceManager({ web3 })
const codeManager = new CodeManager(traceManager)
codeManager.clear()
var solidityProxy = new SolidityProxy({
const solidityProxy = new SolidityProxy({
getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager),
getCode: codeManager.getCode.bind(codeManager),
compilationResult: () => compilationResult
})
var debuggerEvent = new EventManager()
const debuggerEvent = new EventManager()
const offsetToLineColumnConverter = {
offsetToLineColumn: (rawLocation) => {
return new Promise((resolve) => {
@ -38,7 +39,7 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult,
})
}
}
var callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter)
const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter)
callTree.event.register('callTreeBuildFailed', (error) => {
st.fail(error)
})

@ -10,6 +10,7 @@ import { CodeManager } from '../../../src/code/codeManager'
import * as sourceMappingDecoder from '../../../src/source/sourceMappingDecoder'
module.exports = function (st, privateKey, contractBytecode, compilationResult, contractCode) {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve) => {
const web3 = await (vmCall as any).getWeb3();
(vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, hash) {
@ -21,15 +22,15 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult,
return st.fail(error)
}
tx.to = contractCreationToken('0')
var traceManager = new TraceManager({ web3 })
var codeManager = new CodeManager(traceManager)
const traceManager = new TraceManager({ web3 })
const codeManager = new CodeManager(traceManager)
codeManager.clear()
var solidityProxy = new SolidityProxy({
const solidityProxy = new SolidityProxy({
getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager),
getCode: codeManager.getCode.bind(codeManager),
compilationResult: () => compilationResult
})
var debuggerEvent = new EventManager()
const debuggerEvent = new EventManager()
const offsetToLineColumnConverter = {
offsetToLineColumn: (rawLocation) => {
return new Promise((resolve) => {
@ -38,7 +39,7 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult,
})
}
}
var callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter)
const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter)
callTree.event.register('callTreeBuildFailed', (error) => {
st.fail(error)
})

@ -10,6 +10,7 @@ import { CodeManager } from '../../../src/code/codeManager'
import * as sourceMappingDecoder from '../../../src/source/sourceMappingDecoder'
module.exports = function (st, privateKey, contractBytecode, compilationResult,contractCode) {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve) => {
const web3 = await (vmCall as any).getWeb3();
(vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, hash) {
@ -21,15 +22,15 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult,c
return st.fail(error)
}
tx.to = contractCreationToken('0')
var traceManager = new TraceManager({ web3 })
var codeManager = new CodeManager(traceManager)
const traceManager = new TraceManager({ web3 })
const codeManager = new CodeManager(traceManager)
codeManager.clear()
var solidityProxy = new SolidityProxy({
const solidityProxy = new SolidityProxy({
getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager),
getCode: codeManager.getCode.bind(codeManager),
compilationResult: () => compilationResult
})
var debuggerEvent = new EventManager()
const debuggerEvent = new EventManager()
const offsetToLineColumnConverter = {
offsetToLineColumn: (rawLocation) => {
return new Promise((resolve) => {
@ -38,7 +39,7 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult,c
})
}
}
var callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter)
const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter)
callTree.event.register('callTreeBuildFailed', (error) => {
st.fail(error)
})

@ -7,8 +7,8 @@ export class MockStorageResolver {
constructor (_storage) {
this.storage = {}
for (var k in _storage) {
var hashed = util.sha3_256(k)
for (const k in _storage) {
const hashed = util.sha3_256(k)
this.storage[hashed] = {
hashed: hashed,
key: k,
@ -22,7 +22,7 @@ export class MockStorageResolver {
}
storageSlot (slot, callback) {
var hashed = util.sha3_256(slot)
const hashed = util.sha3_256(slot)
callback(null, this.storage[hashed])
}

@ -13,9 +13,9 @@ import { StorageViewer } from '../../../src/storage/storageViewer'
import { Address, bufferToHex } from 'ethereumjs-util'
module.exports = async function testMappingStorage (st, cb) {
var mappingStorage = require('../contracts/mappingStorage')
var privateKey = Buffer.from('503f38a9c967ed597e47fe25643985f032b072db8075426a92110f82df48dfcb', 'hex')
var output = compile(compilerInput(mappingStorage.contract))
const mappingStorage = require('../contracts/mappingStorage')
const privateKey = Buffer.from('503f38a9c967ed597e47fe25643985f032b072db8075426a92110f82df48dfcb', 'hex')
let output = compile(compilerInput(mappingStorage.contract))
output = JSON.parse(output);
const sources = {
target: 'test.sol',
@ -56,17 +56,17 @@ function testMapping (st, privateKey, contractAddress, output, compilationResult
console.log(error)
st.end(error)
} else {
var traceManager = new TraceManager({ web3 })
var codeManager = new CodeManager(traceManager)
const traceManager = new TraceManager({ web3 })
const codeManager = new CodeManager(traceManager)
codeManager.clear()
console.log(compilationResults)
var solidityProxy = new SolidityProxy({
const solidityProxy = new SolidityProxy({
getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager),
getCode: codeManager.getCode.bind(codeManager),
compilationResult: () => compilationResults
})
var debuggerEvent = new EventManager()
var callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true })
const debuggerEvent = new EventManager()
const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true })
callTree.event.register('callTreeBuildFailed', (error) => {
st.fail(error)
})
@ -74,12 +74,12 @@ function testMapping (st, privateKey, contractAddress, output, compilationResult
st.fail(reason)
})
callTree.event.register('callTreeReady', (scopes, scopeStarts) => {
var storageViewer = new StorageViewer({
const storageViewer = new StorageViewer({
stepIndex: 268,
tx: tx,
address: contractAddress
}, new StorageResolver({web3}), traceManager)
var stateVars = stateDecoder.extractStateVariables('SimpleMappingState', output.sources)
const stateVars = stateDecoder.extractStateVariables('SimpleMappingState', output.sources)
stateDecoder.decodeState(stateVars, storageViewer).then((result) => {
st.equal(result['_num'].value, '1')
st.equal(result['_num'].type, 'uint256')

@ -4,7 +4,7 @@ import { compile } from 'solc'
import * as stateDecoder from '../../src/solidity-decoder/stateDecoder'
import { MockStorageResolver } from './mockStorageResolver'
import { compilerInput } from '../helpers/compilerHelper'
var testMappingStorage = require('./stateTests/mapping')
const testMappingStorage = require('./stateTests/mapping')
tape('solidity', function (t) {
t.test('storage decoder', function (st) {
@ -25,11 +25,11 @@ tape('solidity', function (t) {
})
function testIntStorage (st, cb) {
var intStorage = require('./contracts/intStorage')
var output = compile(compilerInput(intStorage.contract))
const intStorage = require('./contracts/intStorage')
let output = compile(compilerInput(intStorage.contract))
output = JSON.parse(output)
var mockStorageResolver
for (var storage of [intStorage.fullStorage, shrinkStorage(intStorage.fullStorage)]) {
let mockStorageResolver
for (const storage of [intStorage.fullStorage, shrinkStorage(intStorage.fullStorage)]) {
mockStorageResolver = new MockStorageResolver(storage)
stateDecoder.solidityState(mockStorageResolver, output.sources, 'intStorage').then((decoded) => {
st.equal(decoded['ui8'].value, '130')
@ -72,11 +72,11 @@ function testIntStorage (st, cb) {
}
function testByteStorage (st, cb) {
var byteStorage = require('./contracts/byteStorage')
var output = compile(compilerInput(byteStorage.contract))
const byteStorage = require('./contracts/byteStorage')
let output = compile(compilerInput(byteStorage.contract))
output = JSON.parse(output)
var mockStorageResolver
for (var storage of [byteStorage.storage, shrinkStorage(byteStorage.storage)]) {
let mockStorageResolver
for (const storage of [byteStorage.storage, shrinkStorage(byteStorage.storage)]) {
mockStorageResolver = new MockStorageResolver(storage)
stateDecoder.solidityState(mockStorageResolver, output.sources, 'byteStorage').then((decoded) => {
st.equal(decoded['b1'].value, false)
@ -175,20 +175,20 @@ function testByteStorage (st, cb) {
}
function shrinkStorage (storage) {
var shrinkedStorage = {}
var regex = /0x(00)*(..)/
for (var key in storage) {
var value = storage[key]
const shrinkedStorage = {}
const regex = /0x(00)*(..)/
for (const key in storage) {
const value = storage[key]
shrinkedStorage[key.replace(regex, '0x$2')] = value.replace(regex, '0x$2')
}
return shrinkedStorage
}
function testStructArrayStorage (st, cb) {
var structArrayStorage = require('./contracts/structArrayStorage')
var output = compile(compilerInput(structArrayStorage.contract))
const structArrayStorage = require('./contracts/structArrayStorage')
let output = compile(compilerInput(structArrayStorage.contract))
output = JSON.parse(output)
var mockStorageResolver = new MockStorageResolver(structArrayStorage.storage)
const mockStorageResolver = new MockStorageResolver(structArrayStorage.storage)
stateDecoder.solidityState(mockStorageResolver, output.sources, 'structArrayStorage').then((decoded) => {
st.equal(decoded['intStructDec'].value['i8'].value, '32')
st.equal(decoded['intStructDec'].value['i16'].value, '-54')

@ -1,15 +1,15 @@
'use strict'
import tape from 'tape'
var compiler = require('solc')
var stateDecoder = require('../../src/solidity-decoder/stateDecoder')
var contracts = require('./contracts/miscContracts')
var compilerInput = require('../helpers/compilerHelper').compilerInput
const compiler = require('solc')
const stateDecoder = require('../../src/solidity-decoder/stateDecoder')
const contracts = require('./contracts/miscContracts')
const compilerInput = require('../helpers/compilerHelper').compilerInput
tape('solidity', function (t) {
t.test('storage location', function (st) {
var output = compiler.compile(compilerInput(contracts))
let output = compiler.compile(compilerInput(contracts))
output = JSON.parse(output)
var stateDec = stateDecoder.extractStateVariables('contractUint', output.sources)
let stateDec = stateDecoder.extractStateVariables('contractUint', output.sources)
checkLocation(st, stateDec[0].storagelocation, 0, 0)
checkLocation(st, stateDec[1].storagelocation, 1, 0)
checkLocation(st, stateDec[2].storagelocation, 2, 0)

@ -9,7 +9,7 @@ export const init = {
},
readFile: function (filename, callback) {
var fs = require('fs')
const fs = require('fs')
try {
console.log('reading ' + filename)
if (callback) {

@ -1,12 +1,12 @@
'use strict'
import { init } from '../init'
var web3Override: Record<string, Record<string, unknown>> = {}
const web3Override: Record<string, Record<string, unknown>> = {}
web3Override.eth = {}
web3Override.debug = {}
var data = init.readFile(require('path').resolve(__dirname, 'testWeb3.json'), null)
let data = init.readFile(require('path').resolve(__dirname, 'testWeb3.json'), null)
data = JSON.parse(data)
var traceWithABIEncoder = init.readFile(require('path').resolve(__dirname, 'traceWithABIEncoder.json'), null)
let traceWithABIEncoder = init.readFile(require('path').resolve(__dirname, 'traceWithABIEncoder.json'), null)
traceWithABIEncoder =
data.testTraces['0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd53'] = JSON.parse(traceWithABIEncoder)

@ -12,7 +12,7 @@ tape('SourceLocationTracker', function (t) {
t.test('SourceLocationTracker.getSourceLocationFromVMTraceIndex - simple contract', async function (st) {
const traceManager = new TraceManager({web3: web3Test})
let codeManager = new CodeManager(traceManager)
const codeManager = new CodeManager(traceManager)
let output = compiler.compile(compilerInput(contracts))
output = JSON.parse(output)
@ -43,7 +43,7 @@ tape('SourceLocationTracker', function (t) {
t.test('SourceLocationTracker.getSourceLocationFromVMTraceIndex - ABIEncoder V2 contract', async function (st) {
const traceManager = new TraceManager({web3: web3Test})
let codeManager = new CodeManager(traceManager)
const codeManager = new CodeManager(traceManager)
let output = compiler.compile(compilerInput(ABIEncoderV2))
output = JSON.parse(output)

@ -23,7 +23,7 @@ tape('sourceMappingDecoder', function (t) {
t.test('sourceMappingDecoder', function (st) {
st.plan(36)
console.log('test decompressAll')
let result = sourceMappingDecoder.decompressAll(sourceMapping.mapping)
const result = sourceMappingDecoder.decompressAll(sourceMapping.mapping)
st.equal(result[0].start, 0)
st.equal(result[0].length, 205)
st.equal(result[0].file, 4)

@ -4,10 +4,10 @@ import { Transaction } from '@ethereumjs/tx'
import VM from '@ethereumjs/vm'
import { rlp, keccak, bufferToHex } from 'ethereumjs-util'
import { extendWeb3 } from '../src/init'
var utileth = require('ethereumjs-util')
var Tx = require('@ethereumjs/tx').Transaction
var BN = require('ethereumjs-util').BN
var remixLib = require('@remix-project/remix-lib')
const utileth = require('ethereumjs-util')
const Tx = require('@ethereumjs/tx').Transaction
const BN = require('ethereumjs-util').BN
const remixLib = require('@remix-project/remix-lib')
const { Provider, extend } = require('@remix-project/remix-simulator')
const Web3 = require('web3')

@ -4,7 +4,8 @@
"standard/no-callback-literal": "off",
"no-unused-vars": "off",
"dot-notation": "off",
"no-use-before-define": "off"
"no-use-before-define": "off",
"@typescript-eslint/no-var-requires": "off"
},
"env": {
"browser": true,

@ -13,6 +13,9 @@
}
],
"main": "src/index.js",
"scripts": {
"test": "./../../node_modules/.bin/ts-node --require tsconfig-paths/register ./../../node_modules/.bin/tape ./test/tests.ts"
},
"dependencies": {
"@ethereumjs/block": "^3.5.1",
"@ethereumjs/tx": "^3.3.2",
@ -37,9 +40,6 @@
"babelify": "^10.0.0",
"tape": "^4.6.0"
},
"scripts": {
"test": "./../../node_modules/.bin/ts-node --require tsconfig-paths/register ./../../node_modules/.bin/tape ./test/tests.ts"
},
"publishConfig": {
"access": "public"
},

@ -0,0 +1,27 @@
{
"name": "remix-lib",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/remix-lib/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nrwl/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/remix-lib",
"main": "libs/remix-lib/src/index.ts",
"tsConfig": "libs/remix-lib/tsconfig.lib.json",
"assets": []
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/remix-lib/**/*.ts"]
}
}
},
"tags": []
}

@ -1,4 +1,4 @@
var init = {
const init = {
overrideWeb3: function (web3, web3Override) {
web3.eth.getCode = web3Override.getCode
web3.debug.traceTransaction = web3Override.traceTransaction

@ -101,7 +101,7 @@ function testWithArrayInput (st, params, expected) {
tape('ContractNestedArrayParameters - (TxFormat.buildData) - format nested array input parameters', function (t) {
let output = compiler.compile(compilerInput(nestedArrayContract))
output = JSON.parse(output)
let contract = output.contracts['test.sol']['nestedArrayContractTest']
const contract = output.contracts['test.sol']['nestedArrayContractTest']
context = { output, contract }
t.test('(TxFormat.buildData)', function (st) {
st.plan(2)
@ -127,7 +127,7 @@ function testWithNestedArrayInput (st, params, expected) {
tape('abiEncoderV2InvalidTuple - (TxFormat.buildData) - should throw error for invalid tuple value', function (t) {
let output = compiler.compile(compilerInput(abiEncoderV2InvalidTuple))
output = JSON.parse(output)
let contract = output.contracts['test.sol']['test']
const contract = output.contracts['test.sol']['test']
context = { output, contract }
t.test('(TxFormat.buildData)', function (st) {
st.plan(4)
@ -286,12 +286,12 @@ tape('test abiEncoderV2', function (t) {
st.plan(2)
let output = compiler.compile(compilerInput(abiEncoderV2))
output = JSON.parse(output)
let contract = output.contracts['test.sol']['test']
const contract = output.contracts['test.sol']['test']
txFormat.encodeFunctionCall(decodedData, contract.abi[0], (error, encoded) => {
console.log(error)
st.equal(encoded.dataHex, functionId + encodedData.replace('0x', ''))
})
let decoded = txFormat.decodeResponse(hexToIntArray(encodedData), contract.abi[0])
const decoded = txFormat.decodeResponse(hexToIntArray(encodedData), contract.abi[0])
console.log(decoded)
st.equal(decoded[0], `tuple(uint256,uint256,string): ${value1},${value2},${value3}`)
})

@ -63,7 +63,7 @@ const EXEC_RESULT_ERROR = {
tape('converts node transaction result to RemixTx', function (t) {
// contract creation
let txResult = { ...NODE_TX_RESULT }
const txResult = { ...NODE_TX_RESULT }
let remixTx = resultToRemixTx(txResult, {})
t.equal(remixTx.transactionHash, TRANSACTION_HASH)
@ -82,8 +82,8 @@ tape('converts node transaction result to RemixTx', function (t) {
})
tape('converts node call result to RemixTx', function (t) {
let txResult = { ...NODE_CALL_RESULT }
let remixTx = resultToRemixTx(txResult, {})
const txResult = { ...NODE_CALL_RESULT }
const remixTx = resultToRemixTx(txResult, {})
t.equal(remixTx.transactionHash, undefined)
t.equal(remixTx.createdAddress, undefined)
@ -96,7 +96,7 @@ tape('converts node call result to RemixTx', function (t) {
})
tape('converts VM result to RemixTx', function (t) {
let txResult = { ...VM_RESULT }
const txResult = { ...VM_RESULT }
let remixTx = resultToRemixTx(txResult, EXEC_RESULT)
t.equal(remixTx.transactionHash,

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save