# This is a combination of 50 commits.

# This is the 1st commit message:

executors

# This is the commit message #2:

libs

# This is the commit message #3:

remixd

# This is the commit message #4:

add react app

# This is the commit message #5:

debugging

# This is the commit message #6:

debug + sol

# This is the commit message #7:

fixes

# This is the commit message #8:

tsconfig

# This is the commit message #9:

ast walker

# This is the commit message #10:

as walker

# This is the commit message #11:

remixd etc

# This is the commit message #12:

commander

# This is the commit message #13:

remove jest

# This is the commit message #14:

rm ui files

# This is the commit message #15:

rm reserved keywords

# This is the commit message #16:

testrunner

# This is the commit message #17:

compiler

# This is the commit message #18:

production build

# This is the commit message #19:

config

# This is the commit message #20:

config

# This is the commit message #21:

web types

# This is the commit message #22:

update react

# This is the commit message #23:

add vm

# This is the commit message #24:

add workers

# This is the commit message #25:

worker2

# This is the commit message #26:

rm react app

# This is the commit message #27:

remixd

# This is the commit message #28:

worker fix

# This is the commit message #29:

fix detection

# This is the commit message #30:

revert react

# This is the commit message #31:

rename type

# This is the commit message #32:

loading handler

# This is the commit message #33:

remove import

# This is the commit message #34:

rename

# This is the commit message #35:

local plugin

# This is the commit message #36:

etherscan

# This is the commit message #37:

revert react

# This is the commit message #38:

port

# This is the commit message #39:

rm worker

# This is the commit message #40:

publicpath

# This is the commit message #41:

fix test

# This is the commit message #42:

112

# This is the commit message #43:

show version

# This is the commit message #44:

"axios": "1.1.2",

# This is the commit message #45:

config

# This is the commit message #46:

lint

# This is the commit message #47:

fix build

# This is the commit message #48:

lint

# This is the commit message #49:

error on purpose

# This is the commit message #50:

test error
executors2
filip mertens 2 years ago
parent 8a0de8fc1d
commit edaaeebea7
  1. 16
      .circleci/config.yml
  2. 37
      .eslintrc.json
  3. 5
      .gitignore
  4. 3
      ___babel.config.json
  5. 0
      ___workspace.json
  6. 218
      __nx.json
  7. 1680
      _workspace.json
  8. 4
      apps/debugger/.babelrc
  9. 61
      apps/debugger/project.json
  10. 12
      apps/debugger/src/app/debugger-api.ts
  11. 16
      apps/debugger/tsconfig.app.json
  12. 18
      apps/debugger/tsconfig.json
  13. 19
      apps/debugger/webpack.config.js
  14. 62
      apps/etherscan/project.json
  15. 28
      apps/etherscan/webpack.config.js
  16. 62
      apps/remix-ide-e2e/src/local-plugin/project.json
  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. 1
      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. 4
      apps/remix-ide/src/app/plugins/notification.tsx
  29. 2
      apps/remix-ide/src/app/plugins/parser/code-parser.tsx
  30. 83
      apps/remix-ide/src/app/plugins/parser/services/antlr-worker.ts
  31. 4
      apps/remix-ide/src/app/plugins/parser/services/code-parser-antlr-service.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. 6
      apps/remix-ide/src/assets/css/themes/bootstrap-cerulean.min.css
  36. 2
      apps/remix-ide/src/assets/css/themes/remix-hacker_owl.css
  37. 0
      apps/remix-ide/src/polyfills.ts
  38. 1
      apps/remix-ide/stats.json
  39. 5
      apps/remix-ide/tsconfig.app.json
  40. 59
      apps/remix-ide/webpack.config.js
  41. 61
      apps/solidity-compiler/project.json
  42. 16
      apps/solidity-compiler/tsconfig.app.json
  43. 18
      apps/solidity-compiler/tsconfig.json
  44. 39
      apps/solidity-compiler/webpack.config.js
  45. 62
      apps/vyper/project.json
  46. 9
      babel.config.js
  47. 6
      jest.config.js
  48. 4
      libs/remix-analyzer/.eslintrc
  49. 8
      libs/remix-analyzer/package.json
  50. 31
      libs/remix-analyzer/project.json
  51. 1
      libs/remix-analyzer/src/index.ts
  52. 4
      libs/remix-analyzer/test/analysis/staticAnalysisCommon-test.ts
  53. 2
      libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.ts
  54. 4
      libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
  55. 7
      libs/remix-astwalker/.eslintrc
  56. 1
      libs/remix-astwalker/package.json
  57. 30
      libs/remix-astwalker/project.json
  58. 1
      libs/remix-astwalker/src/@types/remix-lib/index.d.ts
  59. 10
      libs/remix-astwalker/tests/newTests.ts
  60. 2
      libs/remix-astwalker/tests/resources/legacyAST.ts
  61. 4
      libs/remix-astwalker/tests/resources/newAST.ts
  62. 14
      libs/remix-core-plugin/.eslintrc
  63. 6
      libs/remix-core-plugin/package.json
  64. 27
      libs/remix-core-plugin/project.json
  65. 1
      libs/remix-core-plugin/src/lib/compiler-content-imports.ts
  66. 4
      libs/remix-debug/bin/rdb
  67. 8
      libs/remix-debug/package.json
  68. 31
      libs/remix-debug/project.json
  69. 2
      libs/remix-debug/src/cmdline/index.ts
  70. 11
      libs/remix-debug/src/index.ts
  71. 24
      libs/remix-debug/test.ts
  72. 2
      libs/remix-debug/test/codeManager.ts
  73. 16
      libs/remix-debug/test/debugger.ts
  74. 14
      libs/remix-debug/test/decoder/decodeInfo.ts
  75. 28
      libs/remix-debug/test/decoder/localDecoder.ts
  76. 12
      libs/remix-debug/test/decoder/localsTests/calldata.ts
  77. 19
      libs/remix-debug/test/decoder/localsTests/int.ts
  78. 11
      libs/remix-debug/test/decoder/localsTests/misc.ts
  79. 11
      libs/remix-debug/test/decoder/localsTests/misc2.ts
  80. 11
      libs/remix-debug/test/decoder/localsTests/structArray.ts
  81. 6
      libs/remix-debug/test/decoder/mockStorageResolver.ts
  82. 12
      libs/remix-debug/test/decoder/stateTests/mapping.ts
  83. 32
      libs/remix-debug/test/decoder/storageDecoder.ts
  84. 12
      libs/remix-debug/test/decoder/storageLocation.ts
  85. 2
      libs/remix-debug/test/init.ts
  86. 6
      libs/remix-debug/test/resources/testWeb3.ts
  87. 4
      libs/remix-debug/test/sourceLocationTracker.ts
  88. 2
      libs/remix-debug/test/sourceMappingDecoder.ts
  89. 8
      libs/remix-debug/test/vmCall.ts
  90. 3
      libs/remix-lib/.eslintrc
  91. 6
      libs/remix-lib/package.json
  92. 27
      libs/remix-lib/project.json
  93. 2
      libs/remix-lib/test/init.ts
  94. 10
      libs/remix-lib/test/txFormat.ts
  95. 8
      libs/remix-lib/test/txResultHelper.ts
  96. 2
      libs/remix-lib/tsconfig.json
  97. 8
      libs/remix-simulator/package.json
  98. 30
      libs/remix-simulator/project.json
  99. 6
      libs/remix-simulator/src/server.ts
  100. 48
      libs/remix-solidity/jest.config.js
  101. Some files were not shown because too many files have changed in this diff Show More

@ -25,7 +25,10 @@ jobs:
paths: paths:
- node_modules - 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: 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 - run: mkdir persist && zip -0 -r persist/dist.zip dist
- persist_to_workspace: - persist_to_workspace:
root: . root: .
@ -37,16 +40,17 @@ jobs:
resource_class: resource_class:
xlarge xlarge
working_directory: ~/remix-project working_directory: ~/remix-project
parallelism: 35 parallelism: 1
steps: steps:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- v1-deps-{{ checksum "yarn.lock" }} - v1-deps-{{ checksum "yarn.lock" }}
- run: yarn - run: yarn
- run: yarn nx graph --file=./projects.json
- run: - run:
name: Remix Libs Linting name: Remix Libs Linting
command: ./apps/remix-ide/ci/lint.sh command: node ./apps/remix-ide/ci/lint-targets.js
remix-libs: remix-libs:
docker: docker:
- image: cimg/node:14.17.6-browsers - image: cimg/node:14.17.6-browsers
@ -64,6 +68,12 @@ jobs:
- v1-deps-{{ checksum "yarn.lock" }} - v1-deps-{{ checksum "yarn.lock" }}
- run: yarn - run: yarn
- run: cd dist/libs/remix-tests && yarn - run: cd dist/libs/remix-tests && yarn
- run: cd dist/libs/remix-tests && yarn add @remix-project/remix-url-resolver ../../libs/remix-url-resolver
- run: cd dist/libs/remix-tests && yarn add @remix-project/remix-lib ../../libs/remix-lib
- run: cd dist/libs/remix-tests && yarn add @remix-project/remix-solidity ../../libs/remix-solidity
- run: cd dist/libs/remix-tests && yarn add @remix-project/remix-simulator ../../libs/remix-simulator
- run: cd dist/libs/remix-tests && ./bin/remix-tests ./../../../libs/remix-tests/tests/examples_0/assert_ok_test.sol
- run: node dist/libs/remix-tests/bin/remix-tests ./libs/remix-tests/tests/examples_0/assert_ok_test.sol
- run: yarn run test:libs - run: yarn run test:libs
remix-ide-browser: remix-ide-browser:

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

5
.gitignore vendored

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

@ -0,0 +1,3 @@
{
"babelrcRoots": ["*"]
}

@ -0,0 +1,218 @@
{
"implicitDependencies": {
"workspace.json": "*",
"package.json": {
"dependencies": "*",
"devDependencies": "*"
},
"tsconfig.base.json": "*",
"tslint.json": "*",
".eslintrc.json": "*",
"nx.json": "*"
},
"npmScope": "remix-project",
"tasksRunnerOptions": {
"default": {
"runner": "@nrwl/workspace/tasks-runners/default",
"options": {
"cacheableOperations": [
"build",
"lint",
"test",
"e2e"
]
}
}
},
"projects": {
"remix-lib": {
"tags": []
},
"remix-astwalker": {
"tags": [],
"implicitDependencies": [
"remix-lib"
]
},
"remix-analyzer": {
"tags": [],
"implicitDependencies": [
"remix-astwalker",
"remix-lib"
]
},
"remix-debug": {
"tags": [],
"implicitDependencies": [
"remix-astwalker",
"remix-lib"
]
},
"remix-simulator": {
"tags": [],
"implicitDependencies": [
"remix-lib"
]
},
"remix-solidity": {
"tags": [],
"implicitDependencies": [
"remix-lib"
]
},
"remix-tests": {
"tags": [],
"implicitDependencies": [
"remix-lib",
"remix-simulator",
"remix-solidity"
]
},
"remix-url-resolver": {
"tags": []
},
"remix-ws-templates": {
"tags": []
},
"remix-ide": {
"tags": [],
"implicitDependencies": [
"remix-analyzer",
"remix-debug",
"remix-lib",
"remix-simulator",
"remix-solidity",
"remix-tests",
"remix-astwalker",
"remix-url-resolver",
"remix-ws-templates"
]
},
"remix-ide-e2e": {
"tags": [],
"implicitDependencies": [
"remix-ide"
]
},
"remixd": {
"tags": []
},
"remix-ui-tree-view": {
"tags": []
},
"remix-ui-debugger-ui": {
"tags": []
},
"remix-ui-utils": {
"tags": []
},
"remix-ui-clipboard": {
"tags": []
},
"remix-ui-modal-dialog": {
"tags": []
},
"remix-ui-toaster": {
"tags": []
},
"debugger": {
"tags": []
},
"remix-ui-workspace": {
"tags": []
},
"remix-ui-settings": {
"tags": []
},
"remix-ui-static-analyser": {
"tags": []
},
"remix-ui-checkbox": {
"tags": []
},
"remix-ui-plugin-manager": {
"tags": []
},
"remix-core-plugin": {
"tags": []
},
"remix-ui-solidity-compiler": {
"tags": []
},
"remix-ui-publish-to-storage": {
"tags": []
},
"remix-ui-renderer": {
"tags": []
},
"remix-ui-terminal": {
"tags": []
},
"solidity-compiler": {
"tags": []
},
"remix-ide-e2e-src-local-plugin": {
"tags": []
},
"remix-ui-editor": {
"tags": []
},
"remix-ui-app": {
"tags": []
},
"remix-ui-helper": {
"tags": []
},
"remix-ui-vertical-icons-panel": {
"tags": []
},
"remix-ui-search": {
"tags": []
},
"remix-ui-home-tab": {
"tags": []
},
"remix-ui-tabs": {
"tags": []
},
"remix-ui-panel": {
"tags": []
},
"remix-ui-theme-module": {
"tags": []
},
"solidity-unit-testing": {
"tags": []
},
"remix-ui-run-tab": {
"tags": []
},
"remix-ui-permission-handler": {
"tags": []
},
"remix-ui-file-decorators": {
"tags": []
},
"remix-ui-tooltip-popup": {
"tags": []
},
"vyper": {
"tags": []
},
"etherscan": {
"tags": []
},
"remix-ui-drag-n-drop": {
"tags": []
}
},
"targetDependencies": {
"build": [
{
"target": "build",
"projects": "dependencies"
}
]
}
}

File diff suppressed because it is too large Load Diff

@ -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 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 { CompilationOutput, Sources } from '@remix-ui/debugger-ui' import { CompilationOutput, Sources } from '@remix-ui/debugger-ui'
import type { CompilationResult } from '@remix-project/remix-solidity-ts' import type { CompilationResult } from '@remix-project/remix-solidity-ts'
@ -19,7 +19,7 @@ export const DebuggerApiMixin = (Base) => class extends Base {
this._web3 = new Web3(this.web3Provider) this._web3 = new Web3(this.web3Provider)
// this._web3 can be overwritten and reset to initial value in 'debug' method // this._web3 can be overwritten and reset to initial value in 'debug' method
this.initialWeb3 = this._web3 this.initialWeb3 = this._web3
remixDebug.init.extendWeb3(this._web3) init.extendWeb3(this._web3)
this.offsetToLineColumnConverter = { this.offsetToLineColumnConverter = {
async offsetToLineColumn (rawLocation, file, sources, asts) { async offsetToLineColumn (rawLocation, file, sources, asts) {
@ -78,7 +78,7 @@ export const DebuggerApiMixin = (Base) => class extends Base {
} }
async fetchContractAndCompile (address, receipt) { 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 targetAddress = target || receipt.contractAddress || receipt.to
const codeAtAddress = await this._web3.eth.getCode(targetAddress) const codeAtAddress = await this._web3.eth.getCode(targetAddress)
const output = await this.call('fetchAndCompile', 'resolve', targetAddress, codeAtAddress, '.debug') const output = await this.call('fetchAndCompile', 'resolve', targetAddress, codeAtAddress, '.debug')
@ -97,10 +97,10 @@ export const DebuggerApiMixin = (Base) => class extends Base {
web3 = this.web3() web3 = this.web3()
} }
if (!web3) { if (!web3) {
const webDebugNode = remixDebug.init.web3DebugNode(network.name) const webDebugNode = init.web3DebugNode(network.name)
web3 = !webDebugNode ? this.web3() : webDebugNode web3 = !webDebugNode ? this.web3() : webDebugNode
} }
remixDebug.init.extendWeb3(web3) init.extendWeb3(web3)
return web3 return web3
} }
@ -132,7 +132,7 @@ export const DebuggerApiMixin = (Base) => class extends Base {
} }
if (web3) this._web3 = web3 if (web3) this._web3 = web3
else this._web3 = this.initialWeb3 else this._web3 = this.initialWeb3
remixDebug.init.extendWeb3(this._web3) init.extendWeb3(this._web3)
if (this.onDebugRequestedListener) this.onDebugRequestedListener(hash, web3) if (this.onDebugRequestedListener) this.onDebugRequestedListener(hash, web3)
} }

@ -4,6 +4,20 @@
"outDir": "../../dist/out-tsc", "outDir": "../../dist/out-tsc",
"types": ["node"] "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"] "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
} }

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

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

@ -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": []
}

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

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

@ -14,5 +14,10 @@
}, },
"rules": { "rules": {
"standard/no-callback-literal": "off" "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)
}
}
}

@ -6,6 +6,7 @@ BUILD_ID=${CIRCLE_BUILD_NUM:-${TRAVIS_JOB_NUMBER}}
echo "$BUILD_ID" echo "$BUILD_ID"
TEST_EXITCODE=0 TEST_EXITCODE=0
npx nx graph --file=projects.json
KEYS=$(jq -r '.projects | keys' workspace.json | tr -d '[],"') KEYS=$(jq -r '.projects | keys' workspace.json | tr -d '[],"')
(for row in $KEYS; do (for row in $KEYS; do

@ -53,6 +53,7 @@ function callSauce (requestPath, type, callback) {
console.log('BODY: ' + chunk) console.log('BODY: ' + chunk)
callback(null, chunk) callback(null, chunk)
}) })
// eslint-disable-next-line @typescript-eslint/no-empty-function
res.on('end', function onEnd () {}) 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 React from 'react' // eslint-disable-line
import { EventEmitter } from 'events' import { EventEmitter } from 'events'
import { HostPlugin } from '@remixproject/engine-web' // eslint-disable-line import { HostPlugin } from '@remixproject/engine-web' // eslint-disable-line
import { PluginRecord } from 'libs/remix-ui/panel/src/lib/types' import { PluginRecord } from '@remix-ui/panel'
const EventManager = require('../../lib/events') import EventManager from '../../lib/events'
export class AbstractPanel extends HostPlugin { export class AbstractPanel extends HostPlugin {
events: EventEmitter events: EventEmitter

@ -3,7 +3,7 @@ import React from 'react'
import { AbstractPanel } from './panel' import { AbstractPanel } from './panel'
import { RemixPluginPanel } from '@remix-ui/panel' import { RemixPluginPanel } from '@remix-ui/panel'
import packageJson from '../../../../../package.json' 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' import { PluginViewWrapper } from '@remix-ui/helper'
// const csjs = require('csjs-inject') // const csjs = require('csjs-inject')

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

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

@ -1,8 +1,8 @@
import { Plugin } from '@remixproject/engine' import { Plugin } from '@remixproject/engine'
import { LibraryProfile, MethodApi, StatusEvents } from '@remixproject/plugin-utils' import { LibraryProfile, MethodApi, StatusEvents } from '@remixproject/plugin-utils'
import { AppModal } from '@remix-ui/app' import { AppModal } from '@remix-ui/app'
import { AlertModal } from 'libs/remix-ui/app/src/lib/remix-app/interface' import { AlertModal } from '@remix-ui/app'
import { dispatchModalInterface } from 'libs/remix-ui/app/src/lib/remix-app/context/context' import { dispatchModalInterface } from '@remix-ui/app'
interface INotificationApi { interface INotificationApi {
events: StatusEvents, events: StatusEvents,

@ -9,7 +9,7 @@ import CodeParserAntlrService from './services/code-parser-antlr-service'
import CodeParserImports, { CodeParserImportsData } from './services/code-parser-imports' import CodeParserImports, { CodeParserImportsData } from './services/code-parser-imports'
import React from 'react' import React from 'react'
import { Profile } from '@remixproject/plugin-utils' 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 { lastCompilationResult, RemixApi } from '@remixproject/plugin-api'
import { antlr } from './types' import { antlr } from './types'
import { ParseResult } from './types/antlr-types' import { ParseResult } from './types/antlr-types'

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

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

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

@ -43,6 +43,7 @@ export abstract class AbstractProvider extends Plugin {
} }
sendAsync (data: JsonDataRequest): Promise<any> { sendAsync (data: JsonDataRequest): Promise<any> {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
if (this.blocked) return reject(new Error('provider unable to connect')) 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 // 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 () { async onActivation () {
this.renderComponent()
const isSolidityActive = await this.call('manager', 'isActive', 'solidity') const isSolidityActive = await this.call('manager', 'isActive', 'solidity')
if (!isSolidityActive) { if (!isSolidityActive) {
await this.call('manager', 'activatePlugin', 'solidity') await this.call('manager', 'activatePlugin', 'solidity')
} }
this.renderComponent()
this.event.register('staticAnaysisWarning', (count) => { this.event.register('staticAnaysisWarning', (count) => {
if (count > 0) { if (count > 0) {
this.emit('statusChanged', { key: count, title: `${count} warning${count === 1 ? '' : 's'}`, type: 'warning' }) this.emit('statusChanged', { key: count, title: `${count} warning${count === 1 ? '' : 's'}`, type: 'warning' })
@ -59,6 +60,7 @@ class AnalysisTab extends ViewPlugin {
setDispatch (dispatch) { setDispatch (dispatch) {
this.dispatch = dispatch this.dispatch = dispatch
this.renderComponent()
} }
render () { render () {
@ -74,7 +76,7 @@ class AnalysisTab extends ViewPlugin {
} }
renderComponent () { renderComponent () {
this.dispatch({ this.dispatch && this.dispatch({
registry: this.registry, registry: this.registry,
analysisModule: this, analysisModule: this,
event: this.event event: this.event

@ -1915,10 +1915,10 @@ textarea.form-control {
.form-control.is-valid,.was-validated .form-control:valid { .form-control.is-valid,.was-validated .form-control:valid {
border-color:#73a839; border-color:#73a839;
padding-right:calc(1.5em + .75rem); 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-repeat:no-repeat;
background-position:right calc(.375em + .1875rem) center; 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 { .form-control.is-valid:focus,.was-validated .form-control:valid:focus {
border-color:#73a839; border-color:#73a839;
@ -1932,7 +1932,7 @@ textarea.form-control {
border-color:#73a839; border-color:#73a839;
padding-right:calc(.75em + 2.3125rem); 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) 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 { .custom-select.is-valid:focus,.was-validated .custom-select:valid:focus {
border-color:#73a839; border-color:#73a839;
box-shadow:0 0 0 .2rem rgba(115,168,57,.25) box-shadow:0 0 0 .2rem rgba(115,168,57,.25)

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

File diff suppressed because one or more lines are too long

@ -2,8 +2,9 @@
"extends": "./tsconfig.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"outDir": "../../dist/out-tsc", "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"] "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
} }

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

@ -4,6 +4,20 @@
"outDir": "../../dist/out-tsc", "outDir": "../../dist/out-tsc",
"types": ["node"] "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"] "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
} }

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

@ -1,18 +1,35 @@
const nxWebpack = require('@nrwl/react/plugins/webpack') const nxWebpack = require('@nrwl/react/plugins/webpack')
const TerserPlugin = require('terser-webpack-plugin') const webpack = require('webpack')
module.exports = config => { module.exports = config => {
const nxWebpackConfig = nxWebpack(config) const nxWebpackConfig = nxWebpack(config)
const webpackConfig = { const webpackConfig = {
...nxWebpackConfig, ...nxWebpackConfig,
node: { resolve: {
fs: 'empty', ...nxWebpackConfig.resolve,
tls: 'empty', fallback: {
readline: 'empty', ...nxWebpackConfig.resolve.fallback,
net: 'empty', "crypto": require.resolve("crypto-browserify"),
module: 'empty', "stream": require.resolve("stream-browserify"),
child_process: 'empty' "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') { if (process.env.NODE_ENV === 'production') {
@ -20,10 +37,6 @@ module.exports = config => {
...webpackConfig, ...webpackConfig,
mode: 'production', mode: 'production',
devtool: 'source-map', devtool: 'source-map',
optimization: {
minimize: true,
minimizer: [new TerserPlugin()]
}
} }
} else { } else {
return webpackConfig 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": "@nrwl/react/plugins/webpack"
},
"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,4 +1,9 @@
module.exports = { module.exports = {
"presets": ["@babel/preset-react", "@babel/preset-typescript"], "presets": ["@babel/preset-typescript", "@babel/preset-env", "@babel/preset-react"],
"plugins": ["@babel/plugin-transform-modules-commonjs", "@babel/plugin-proposal-class-properties"] "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,7 +1,11 @@
module.exports = { module.exports = {
preset: 'ts-jest/presets/default-esm',
testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'], testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],
transform: { transform: {
'^.+\\.(ts|js|html)$': 'ts-jest' '^.+\\.(ts|js|html)$': ['ts-jest',
{
useESM: true,
}]
}, },
resolver: '@nrwl/jest/plugins/resolver', resolver: '@nrwl/jest/plugins/resolver',
moduleFileExtensions: ['ts', 'js', 'html'], moduleFileExtensions: ['ts', 'js', 'html'],

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

@ -2,7 +2,9 @@
"name": "@remix-project/remix-analyzer", "name": "@remix-project/remix-analyzer",
"version": "0.5.25", "version": "0.5.25",
"description": "Tool to perform static analysis on Solidity smart contracts", "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", "types": "src/index.d.ts",
"contributors": [ "contributors": [
{ {
@ -34,10 +36,6 @@
"publishConfig": { "publishConfig": {
"access": "public" "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", "author": "Remix Team",
"license": "MIT", "license": "MIT",
"homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-analyzer#readme", "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 { 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, const { localCall, thisLocalCall, libCall, externalDirect, superLocal, assignment, abiNamespaceCallNodes,
inlineAssembly, unaryOperation, nowAst, blockTimestamp, stateVariableContractNode, inlineAssembly, unaryOperation, nowAst, blockTimestamp, stateVariableContractNode,
functionDefinition, requireCall, selfdestruct, storageVariableNodes, dynamicDeleteUnaryOp, functionDefinition, requireCall, selfdestruct, storageVariableNodes, dynamicDeleteUnaryOp,
// eslint-disable-next-line @typescript-eslint/no-var-requires
lowlevelCall, parameterFunction, parameterFunctionCall, inheritance, blockHashAccess, contractDefinition, funcDefForComplexParams } = require('./astBlocks') lowlevelCall, parameterFunction, parameterFunctionCall, inheritance, blockHashAccess, contractDefinition, funcDefForComplexParams } = require('./astBlocks')
// eslint-disable-next-line @typescript-eslint/no-var-requires
const compiledContractObj = require('./compilationDetails/CompiledContractObj.json') const compiledContractObj = require('./compilationDetails/CompiledContractObj.json')
function escapeRegExp (str) { function escapeRegExp (str) {
return str.replace(/[-[\]/{}()+?.\\^$|]/g, '\\$&') return str.replace(/[-[\]/{}()+?.\\^$|]/g, '\\$&')
@ -237,7 +239,7 @@ test('staticAnalysisCommon.getInheritsFromName', function (t) {
test('staticAnalysisCommon.getDeclaredVariableName', function (t) { test('staticAnalysisCommon.getDeclaredVariableName', function (t) {
t.plan(2) t.plan(2)
t.ok(common.getDeclaredVariableName(storageVariableNodes.node1) === 'c', 'extract right variable name') 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' node1.node1.nodeType = 'FunctionCall'
t.throws(() => common.getDeclaredVariableName(node1) === 'x', new RegExp('staticAnalysisCommon.js: not a VariableDeclaration Node'), 'throw if wrong node') 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() const statRunner: StatRunner = new StatRunner()
testFiles.forEach((fileName: string) => { testFiles.forEach((fileName: string) => {
const reports = statRunner.runWithModuleList(compilationResults[fileName], [{ name: new Module().name, mod: new Module() }]) 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'))) { if (report.some((x: AnalysisReportObj) => x.warning.includes('INTERNAL ERROR'))) {
t.comment('Error while executing Module: ' + JSON.stringify(report)) t.comment('Error while executing Module: ' + JSON.stringify(report))
} }

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

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

@ -4,7 +4,6 @@
"description": "Tool to walk through Solidity AST", "description": "Tool to walk through Solidity AST",
"main": "src/index.js", "main": "src/index.js",
"scripts": { "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" "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": { "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 // Type definitions for the things we need from remix-lib
declare module 'remix-lib' { declare module 'remix-lib' {
// eslint-disable-next-line @typescript-eslint/prefer-namespace-keyword
export module util { export module util {
export function findLowerBound(target: number, array: Array<number>): number; export function findLowerBound(target: number, array: Array<number>): number;
} }

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

@ -1,7 +1,5 @@
import { Node } from '../../src/' import { Node } from '../../src/'
let node: Node; const node: Node = {
node = {
"ast": "ast":
{ {
"absolutePath": "greeter.sol", "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", "name": "@remix-project/core-plugin",
"version": "0.0.1", "version": "0.0.1",
"description": "This library was generated with [Nx](https://nx.dev).", "description": "This library was generated with [Nx](https://nx.dev).",
"main": "index.js", "main": "src/index.js",
"scripts": { "type": "module",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Remix Team", "author": "Remix Team",
"license": "ISC" "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 * @returns {Promise} - string content
*/ */
async resolveAndSave (url, targetPath) { async resolveAndSave (url, targetPath) {
console.log('resolveAndSave', url, targetPath)
try { try {
if (targetPath && this.currentRequest) { if (targetPath && this.currentRequest) {
const canCall = await this.askUserPermission('resolveAndSave', 'This action will update the path ' + targetPath) const canCall = await this.askUserPermission('resolveAndSave', 'This action will update the path ' + targetPath)

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

@ -17,6 +17,9 @@
} }
], ],
"main": "src/index.js", "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": { "dependencies": {
"@ethereumjs/block": "^3.5.1", "@ethereumjs/block": "^3.5.1",
"@ethereumjs/common": "^2.5.0", "@ethereumjs/common": "^2.5.0",
@ -28,7 +31,7 @@
"ansi-gray": "^0.1.1", "ansi-gray": "^0.1.1",
"async": "^2.6.2", "async": "^2.6.2",
"color-support": "^1.1.3", "color-support": "^1.1.3",
"commander": "^2.19.0", "commander": "^9.4.1",
"deep-equal": "^1.0.1", "deep-equal": "^1.0.1",
"ethereumjs-util": "^7.0.10", "ethereumjs-util": "^7.0.10",
"ethers": "^5.4.2", "ethers": "^5.4.2",
@ -51,9 +54,6 @@
"solc": "^0.7.4", "solc": "^0.7.4",
"tape": "^4.6.0" "tape": "^4.6.0"
}, },
"scripts": {
"test": "./../../node_modules/.bin/ts-node --require tsconfig-paths/register ./../../node_modules/.bin/tape ./test/tests.ts"
},
"publishConfig": { "publishConfig": {
"access": "public" "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 Web3 from 'web3'
import { Debugger } from '../debugger/debugger.js' import { Debugger } from '../debugger/debugger'
import { EventEmitter } from 'events' import { EventEmitter } from 'events'
export class CmdLine { export class CmdLine {

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

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

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

@ -5,10 +5,10 @@ import * as sourceMappingDecoder from '../src/source/sourceMappingDecoder'
import { Ethdebugger as Debugger } from '../src/Ethdebugger' import { Ethdebugger as Debugger } from '../src/Ethdebugger'
import { BreakpointManager } from '../src/code/breakpointManager' import { BreakpointManager } from '../src/code/breakpointManager'
var compiler = require('solc') const compiler = require('solc')
var vmCall = require('./vmCall') 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 * @title Ballot
@ -150,8 +150,8 @@ contract Ballot {
`; `;
(async () => { (async () => {
var privateKey = Buffer.from('503f38a9c967ed597e47fe25643985f032b072db8075426a92110f82df48dfcb', 'hex') const privateKey = Buffer.from('503f38a9c967ed597e47fe25643985f032b072db8075426a92110f82df48dfcb', 'hex')
var output = compiler.compile(compilerInput(ballot)) let output = compiler.compile(compilerInput(ballot))
output = JSON.parse(output) output = JSON.parse(output)
const param = '0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000148656c6c6f20576f726c64210000000000000000000000000000000000000000' const param = '0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000148656c6c6f20576f726c64210000000000000000000000000000000000000000'
const web3 = await vmCall.getWeb3() const web3 = await vmCall.getWeb3()
@ -164,7 +164,7 @@ contract Ballot {
if (error) { if (error) {
throw error throw error
} else { } else {
var debugManager = new Debugger({ const debugManager = new Debugger({
compilationResult: function () { compilationResult: function () {
return { data: output } return { data: output }
}, },
@ -224,7 +224,7 @@ function testDebugging (debugManager) {
try { try {
const address = debugManager.traceManager.getCurrentCalledAddressAt(38) const address = debugManager.traceManager.getCurrentCalledAddressAt(38)
console.log(address) console.log(address)
var storageView = debugManager.storageViewAt(196, address) const storageView = debugManager.storageViewAt(196, address)
storageView.storageRange().then((storage) => { storageView.storageRange().then((storage) => {
t.equal(JSON.stringify(storage), JSON.stringify({ '0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563': { key: '0x0000000000000000000000000000000000000000000000000000000000000000', value: '0x0000000000000000000000005b38da6a701c568545dcfcb03fcb875f56beddc4' } })) t.equal(JSON.stringify(storage), JSON.stringify({ '0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563': { key: '0x0000000000000000000000000000000000000000000000000000000000000000', value: '0x0000000000000000000000005b38da6a701c568545dcfcb03fcb875f56beddc4' } }))
@ -273,7 +273,7 @@ function testDebugging (debugManager) {
tape('breakPointManager', (t) => { tape('breakPointManager', (t) => {
t.plan(2) t.plan(2)
const {traceManager, callTree, solidityProxy} = debugManager const {traceManager, callTree, solidityProxy} = debugManager
var breakPointManager = new BreakpointManager({traceManager, callTree, solidityProxy, locationToRowConverter: async (rawLocation) => { const breakPointManager = new BreakpointManager({traceManager, callTree, solidityProxy, locationToRowConverter: async (rawLocation) => {
return sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, sourceMappingDecoder.getLinebreakPositions(ballot)) return sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, sourceMappingDecoder.getLinebreakPositions(ballot))
}}) }})

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

@ -1,27 +1,27 @@
'use strict' 'use strict'
import tape from 'tape' import tape from 'tape'
var compiler = require('solc') const compiler = require('solc')
var intLocal = require('./contracts/intLocal') const intLocal = require('./contracts/intLocal')
var miscLocal = require('./contracts/miscLocal') const miscLocal = require('./contracts/miscLocal')
var structArrayLocal = require('./contracts/structArrayLocal') const structArrayLocal = require('./contracts/structArrayLocal')
var calldataLocal = require('./contracts/calldata') const calldataLocal = require('./contracts/calldata')
var vmCall = require('../vmCall') const vmCall = require('../vmCall')
var intLocalTest = require('./localsTests/int') const intLocalTest = require('./localsTests/int')
var miscLocalTest = require('./localsTests/misc') const miscLocalTest = require('./localsTests/misc')
var misc2LocalTest = require('./localsTests/misc2') const misc2LocalTest = require('./localsTests/misc2')
var structArrayLocalTest = require('./localsTests/structArray') const structArrayLocalTest = require('./localsTests/structArray')
var calldataLocalTest = require('./localsTests/calldata') const calldataLocalTest = require('./localsTests/calldata')
var compilerInput = require('../helpers/compilerHelper').compilerInput const compilerInput = require('../helpers/compilerHelper').compilerInput
tape('solidity', function (t) { tape('solidity', function (t) {
t.test('local decoder', async function (st) { t.test('local decoder', async function (st) {
var privateKey = Buffer.from('503f38a9c967ed597e47fe25643985f032b072db8075426a92110f82df48dfcb', 'hex') const privateKey = Buffer.from('503f38a9c967ed597e47fe25643985f032b072db8075426a92110f82df48dfcb', 'hex')
await test(st, privateKey) await test(st, privateKey)
}) })
}) })
async function 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) output = JSON.parse(output)
await intLocalTest(st, privateKey, output.contracts['test.sol']['intLocal'].evm.bytecode.object, output) await intLocalTest(st, privateKey, output.contracts['test.sol']['intLocal'].evm.bytecode.object, output)
output = compiler.compile(compilerInput(miscLocal.contract)) output = compiler.compile(compilerInput(miscLocal.contract))

@ -14,7 +14,7 @@ module.exports = async function (st, privateKey, contractBytecode, compilationRe
let web3 let web3
try { try {
web3 = await (vmCall as any).getWeb3() 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 receipt = await web3.eth.getTransactionReceipt(hash)
const to = receipt.contractAddress const to = receipt.contractAddress
console.log('to', to) console.log('to', to)
@ -28,13 +28,13 @@ module.exports = async function (st, privateKey, contractBytecode, compilationRe
if (error) { if (error) {
return st.fail(error) return st.fail(error)
} }
var traceManager = new TraceManager({ web3 }) const traceManager = new TraceManager({ web3 })
var codeManager = new CodeManager(traceManager) const codeManager = new CodeManager(traceManager)
codeManager.clear() codeManager.clear()
var solidityProxy = new SolidityProxy({ getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), getCode: codeManager.getCode.bind(codeManager) }) const solidityProxy = new SolidityProxy({ getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), getCode: codeManager.getCode.bind(codeManager) })
solidityProxy.reset(compilationResult) solidityProxy.reset(compilationResult)
var debuggerEvent = new EventManager() const debuggerEvent = new EventManager()
var callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }) const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true })
callTree.event.register('callTreeBuildFailed', (error) => { callTree.event.register('callTreeBuildFailed', (error) => {
st.fail(error) st.fail(error)
}) })

@ -10,8 +10,9 @@ import { EventManager } from '../../../src/eventManager'
import * as helper from './helper' import * as helper from './helper'
module.exports = function (st, privateKey, contractBytecode, compilationResult) { module.exports = function (st, privateKey, contractBytecode, compilationResult) {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve) => { 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) { (vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, hash) {
if (error) { if (error) {
return st.fail(error) return st.fail(error)
@ -21,13 +22,13 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult)
return st.fail(error) return st.fail(error)
} }
tx.to = contractCreationToken('0') tx.to = contractCreationToken('0')
var traceManager = new TraceManager({ web3 }) const traceManager = new TraceManager({ web3 })
var codeManager = new CodeManager(traceManager) const codeManager = new CodeManager(traceManager)
codeManager.clear() codeManager.clear()
var solidityProxy = new SolidityProxy({ getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), getCode: codeManager.getCode.bind(codeManager) }) const solidityProxy = new SolidityProxy({ getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), getCode: codeManager.getCode.bind(codeManager) })
solidityProxy.reset(compilationResult) solidityProxy.reset(compilationResult)
var debuggerEvent = new EventManager() const debuggerEvent = new EventManager()
var callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }) const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true })
callTree.event.register('callTreeBuildFailed', (error) => { callTree.event.register('callTreeBuildFailed', (error) => {
st.fail(error) st.fail(error)
}) })
@ -36,9 +37,9 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult)
}) })
callTree.event.register('callTreeReady', (scopes, scopeStarts) => { callTree.event.register('callTreeReady', (scopes, scopeStarts) => {
try { try {
let functions1 = callTree.retrieveFunctionsStack(102) const functions1 = callTree.retrieveFunctionsStack(102)
let functions2 = callTree.retrieveFunctionsStack(115) const functions2 = callTree.retrieveFunctionsStack(115)
let functions3 = callTree.retrieveFunctionsStack(13) const functions3 = callTree.retrieveFunctionsStack(13)
st.equals(functions1.length, 1) st.equals(functions1.length, 1)
st.equals(functions2.length, 2) st.equals(functions2.length, 2)

@ -9,6 +9,7 @@ import { TraceManager } from '../../../src/trace/traceManager'
import { CodeManager } from '../../../src/code/codeManager' import { CodeManager } from '../../../src/code/codeManager'
module.exports = function (st, privateKey, contractBytecode, compilationResult) { module.exports = function (st, privateKey, contractBytecode, compilationResult) {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
const 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) { (vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, hash) {
@ -20,13 +21,13 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult)
return st.fail(error) return st.fail(error)
} }
tx.to = contractCreationToken('0') tx.to = contractCreationToken('0')
var traceManager = new TraceManager({ web3 }) const traceManager = new TraceManager({ web3 })
var codeManager = new CodeManager(traceManager) const codeManager = new CodeManager(traceManager)
codeManager.clear() codeManager.clear()
var solidityProxy = new SolidityProxy({ getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), getCode: codeManager.getCode.bind(codeManager) }) const solidityProxy = new SolidityProxy({ getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), getCode: codeManager.getCode.bind(codeManager) })
solidityProxy.reset(compilationResult) solidityProxy.reset(compilationResult)
var debuggerEvent = new EventManager() const debuggerEvent = new EventManager()
var callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }) const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true })
callTree.event.register('callTreeBuildFailed', (error) => { callTree.event.register('callTreeBuildFailed', (error) => {
st.fail(error) st.fail(error)
}) })

@ -9,6 +9,7 @@ import { TraceManager } from '../../../src/trace/traceManager'
import { CodeManager } from '../../../src/code/codeManager' import { CodeManager } from '../../../src/code/codeManager'
module.exports = function (st, privateKey, contractBytecode, compilationResult) { module.exports = function (st, privateKey, contractBytecode, compilationResult) {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
const 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) { (vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, hash) {
@ -20,13 +21,13 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult)
return st.fail(error) return st.fail(error)
} }
tx.to = contractCreationToken('0') tx.to = contractCreationToken('0')
var traceManager = new TraceManager({ web3 }) const traceManager = new TraceManager({ web3 })
var codeManager = new CodeManager(traceManager) const codeManager = new CodeManager(traceManager)
codeManager.clear() codeManager.clear()
var solidityProxy = new SolidityProxy({ getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), getCode: codeManager.getCode.bind(codeManager) }) const solidityProxy = new SolidityProxy({ getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), getCode: codeManager.getCode.bind(codeManager) })
solidityProxy.reset(compilationResult) solidityProxy.reset(compilationResult)
var debuggerEvent = new EventManager() const debuggerEvent = new EventManager()
var callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }) const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true })
callTree.event.register('callTreeBuildFailed', (error) => { callTree.event.register('callTreeBuildFailed', (error) => {
st.fail(error) st.fail(error)
}) })

@ -9,6 +9,7 @@ import { TraceManager } from '../../../src/trace/traceManager'
import { CodeManager } from '../../../src/code/codeManager' import { CodeManager } from '../../../src/code/codeManager'
module.exports = function (st, privateKey, contractBytecode, compilationResult) { module.exports = function (st, privateKey, contractBytecode, compilationResult) {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
const 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) { (vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, hash) {
@ -20,13 +21,13 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult)
return st.fail(error) return st.fail(error)
} }
tx.to = contractCreationToken('0') tx.to = contractCreationToken('0')
var traceManager = new TraceManager({ web3 }) const traceManager = new TraceManager({ web3 })
var codeManager = new CodeManager(traceManager) const codeManager = new CodeManager(traceManager)
codeManager.clear() codeManager.clear()
var solidityProxy = new SolidityProxy({ getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), getCode: codeManager.getCode.bind(codeManager) }) const solidityProxy = new SolidityProxy({ getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), getCode: codeManager.getCode.bind(codeManager) })
solidityProxy.reset(compilationResult) solidityProxy.reset(compilationResult)
var debuggerEvent = new EventManager() const debuggerEvent = new EventManager()
var callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }) const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true })
callTree.event.register('callTreeBuildFailed', (error) => { callTree.event.register('callTreeBuildFailed', (error) => {
st.fail(error) st.fail(error)
}) })

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

@ -8,9 +8,9 @@ import { StorageViewer } from '../../../src/storage/storageViewer'
import { Address, bufferToHex } from 'ethereumjs-util' import { Address, bufferToHex } from 'ethereumjs-util'
module.exports = async function testMappingStorage (st, cb) { module.exports = async function testMappingStorage (st, cb) {
var mappingStorage = require('../contracts/mappingStorage') const mappingStorage = require('../contracts/mappingStorage')
var privateKey = Buffer.from('503f38a9c967ed597e47fe25643985f032b072db8075426a92110f82df48dfcb', 'hex') const privateKey = Buffer.from('503f38a9c967ed597e47fe25643985f032b072db8075426a92110f82df48dfcb', 'hex')
var output = compile(compilerInput(mappingStorage.contract)) let output = compile(compilerInput(mappingStorage.contract))
output = JSON.parse(output); output = JSON.parse(output);
const web3 = await (vmCall as any).getWeb3(); const web3 = await (vmCall as any).getWeb3();
(vmCall as any).sendTx(web3, {nonce: 0, privateKey: privateKey}, null, 0, output.contracts['test.sol']['SimpleMappingState'].evm.bytecode.object, function (error, hash) { (vmCall as any).sendTx(web3, {nonce: 0, privateKey: privateKey}, null, 0, output.contracts['test.sol']['SimpleMappingState'].evm.bytecode.object, function (error, hash) {
@ -46,14 +46,14 @@ function testMapping (st, privateKey, contractAddress, output, web3, cb) {
console.log(error) console.log(error)
st.end(error) st.end(error)
} else { } else {
var traceManager = new TraceManager({web3}) const traceManager = new TraceManager({web3})
traceManager.resolveTrace(tx).then(() => { traceManager.resolveTrace(tx).then(() => {
var storageViewer = new StorageViewer({ const storageViewer = new StorageViewer({
stepIndex: 268, stepIndex: 268,
tx: tx, tx: tx,
address: contractAddress address: contractAddress
}, new StorageResolver({web3}), traceManager) }, new StorageResolver({web3}), traceManager)
var stateVars = stateDecoder.extractStateVariables('SimpleMappingState', output.sources) const stateVars = stateDecoder.extractStateVariables('SimpleMappingState', output.sources)
stateDecoder.decodeState(stateVars, storageViewer).then((result) => { stateDecoder.decodeState(stateVars, storageViewer).then((result) => {
st.equal(result['_num'].value, '1') st.equal(result['_num'].value, '1')
st.equal(result['_num'].type, 'uint256') st.equal(result['_num'].type, 'uint256')

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

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

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

@ -1,12 +1,12 @@
'use strict' 'use strict'
import { init } from '../init' import { init } from '../init'
var web3Override: Record<string, Record<string, unknown>> = {} const web3Override: Record<string, Record<string, unknown>> = {}
web3Override.eth = {} web3Override.eth = {}
web3Override.debug = {} 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) 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 = traceWithABIEncoder =
data.testTraces['0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd53'] = JSON.parse(traceWithABIEncoder) data.testTraces['0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd53'] = JSON.parse(traceWithABIEncoder)

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

@ -23,7 +23,7 @@ tape('sourceMappingDecoder', function (t) {
t.test('sourceMappingDecoder', function (st) { t.test('sourceMappingDecoder', function (st) {
st.plan(36) st.plan(36)
console.log('test decompressAll') 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].start, 0)
st.equal(result[0].length, 205) st.equal(result[0].length, 205)
st.equal(result[0].file, 4) st.equal(result[0].file, 4)

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

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

@ -13,6 +13,9 @@
} }
], ],
"main": "src/index.js", "main": "src/index.js",
"scripts": {
"test": "./../../node_modules/.bin/ts-node --require tsconfig-paths/register ./../../node_modules/.bin/tape ./test/tests.ts"
},
"dependencies": { "dependencies": {
"@ethereumjs/block": "^3.5.1", "@ethereumjs/block": "^3.5.1",
"@ethereumjs/tx": "^3.3.2", "@ethereumjs/tx": "^3.3.2",
@ -37,9 +40,6 @@
"babelify": "^10.0.0", "babelify": "^10.0.0",
"tape": "^4.6.0" "tape": "^4.6.0"
}, },
"scripts": {
"test": "./../../node_modules/.bin/ts-node --require tsconfig-paths/register ./../../node_modules/.bin/tape ./test/tests.ts"
},
"publishConfig": { "publishConfig": {
"access": "public" "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) { overrideWeb3: function (web3, web3Override) {
web3.eth.getCode = web3Override.getCode web3.eth.getCode = web3Override.getCode
web3.debug.traceTransaction = web3Override.traceTransaction 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) { tape('ContractNestedArrayParameters - (TxFormat.buildData) - format nested array input parameters', function (t) {
let output = compiler.compile(compilerInput(nestedArrayContract)) let output = compiler.compile(compilerInput(nestedArrayContract))
output = JSON.parse(output) output = JSON.parse(output)
let contract = output.contracts['test.sol']['nestedArrayContractTest'] const contract = output.contracts['test.sol']['nestedArrayContractTest']
context = { output, contract } context = { output, contract }
t.test('(TxFormat.buildData)', function (st) { t.test('(TxFormat.buildData)', function (st) {
st.plan(2) st.plan(2)
@ -125,9 +125,9 @@ function testWithNestedArrayInput (st, params, expected) {
} }
tape('abiEncoderV2InvalidTuple - (TxFormat.buildData) - should throw error for invalid tuple value', function (t) { tape('abiEncoderV2InvalidTuple - (TxFormat.buildData) - should throw error for invalid tuple value', function (t) {
let output = compiler.compile(compilerInput(abiEncoderV2InvalidTuple)) var output = compiler.compile(compilerInput(abiEncoderV2InvalidTuple))
output = JSON.parse(output) output = JSON.parse(output)
let contract = output.contracts['test.sol']['test'] const contract = output.contracts['test.sol']['test']
context = { output, contract } context = { output, contract }
t.test('(TxFormat.buildData)', function (st) { t.test('(TxFormat.buildData)', function (st) {
st.plan(4) st.plan(4)
@ -286,12 +286,12 @@ tape('test abiEncoderV2', function (t) {
st.plan(2) st.plan(2)
let output = compiler.compile(compilerInput(abiEncoderV2)) let output = compiler.compile(compilerInput(abiEncoderV2))
output = JSON.parse(output) 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) => { txFormat.encodeFunctionCall(decodedData, contract.abi[0], (error, encoded) => {
console.log(error) console.log(error)
st.equal(encoded.dataHex, functionId + encodedData.replace('0x', '')) 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) console.log(decoded)
st.equal(decoded[0], `tuple(uint256,uint256,string): ${value1},${value2},${value3}`) 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) { tape('converts node transaction result to RemixTx', function (t) {
// contract creation // contract creation
let txResult = { ...NODE_TX_RESULT } const txResult = { ...NODE_TX_RESULT }
let remixTx = resultToRemixTx(txResult, {}) let remixTx = resultToRemixTx(txResult, {})
t.equal(remixTx.transactionHash, TRANSACTION_HASH) 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) { tape('converts node call result to RemixTx', function (t) {
let txResult = { ...NODE_CALL_RESULT } const txResult = { ...NODE_CALL_RESULT }
let remixTx = resultToRemixTx(txResult, {}) const remixTx = resultToRemixTx(txResult, {})
t.equal(remixTx.transactionHash, undefined) t.equal(remixTx.transactionHash, undefined)
t.equal(remixTx.createdAddress, 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) { tape('converts VM result to RemixTx', function (t) {
let txResult = { ...VM_RESULT } const txResult = { ...VM_RESULT }
let remixTx = resultToRemixTx(txResult, EXEC_RESULT) let remixTx = resultToRemixTx(txResult, EXEC_RESULT)
t.equal(remixTx.transactionHash, t.equal(remixTx.transactionHash,

@ -2,7 +2,7 @@
"extends": "../../tsconfig.base.json", "extends": "../../tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"types": ["node", "tape"], "types": ["node", "tape"],
"esModuleInterop": true "esModuleInterop": true,
}, },
"include": ["**/*.ts"] "include": ["**/*.ts"]
} }

@ -13,6 +13,9 @@
} }
], ],
"main": "src/index.js", "main": "src/index.js",
"scripts": {
"test": "./../../node_modules/.bin/ts-node --project ../../tsconfig.base.json --require tsconfig-paths/register ./../../node_modules/.bin/mocha test/*.ts"
},
"dependencies": { "dependencies": {
"@ethereumjs/block": "^3.5.1", "@ethereumjs/block": "^3.5.1",
"@ethereumjs/common": "^2.5.0", "@ethereumjs/common": "^2.5.0",
@ -23,7 +26,7 @@
"async": "^3.1.0", "async": "^3.1.0",
"body-parser": "^1.18.2", "body-parser": "^1.18.2",
"color-support": "^1.1.3", "color-support": "^1.1.3",
"commander": "^2.19.0", "commander": "^9.4.1",
"cors": "^2.8.5", "cors": "^2.8.5",
"ethereumjs-util": "^7.0.10", "ethereumjs-util": "^7.0.10",
"ethers": "^5.4.2", "ethers": "^5.4.2",
@ -46,9 +49,6 @@
"babelify": "^10.0.0", "babelify": "^10.0.0",
"mocha": "^5.2.0" "mocha": "^5.2.0"
}, },
"scripts": {
"test": "./../../node_modules/.bin/ts-node --require tsconfig-paths/register ./../../node_modules/.bin/mocha test/*.ts"
},
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },

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

@ -21,7 +21,7 @@ class Server {
} }
start (host, port) { start (host, port) {
expressWs(app) const wsApp = expressWs(app)
app.use(cors()) app.use(cors())
app.use(bodyParser.urlencoded({ extended: true })) app.use(bodyParser.urlencoded({ extended: true }))
@ -41,9 +41,9 @@ class Server {
}) })
}) })
} else { } else {
app.ws('/', (ws, req) => { wsApp.app.ws('/', (ws, req) => {
ws.on('message', (msg) => { ws.on('message', (msg) => {
this.provider.sendAsync(JSON.parse(msg), (err, jsonResponse) => { this.provider.sendAsync(JSON.parse(msg.toString()), (err, jsonResponse) => {
if (err) { if (err) {
return ws.send(JSON.stringify({ error: err })) return ws.send(JSON.stringify({ error: err }))
} }

@ -1,24 +1,26 @@
module.exports = { module.exports = {
name: 'remix-solidity', name: 'remix-solidity',
preset: '../../jest.config.js', preset: '../../jest.config.js',
verbose: true, verbose: true,
silent: false, // Silent console messages, specially the 'remix-simulator' ones silent: false, // Silent console messages, specially the 'remix-simulator' ones
transform: { transform: {
'^.+\\.[tj]sx?$': 'ts-jest', '^.+\\.[tj]sx?$': ['ts-jest',
}, {
transformIgnorePatterns: ["/node_modules/", "/dist/", "\\.pnp\\.[^\\\/]+$"], useESM: true,
rootDir: "./", }]
testTimeout: 40000, },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html', 'json'], transformIgnorePatterns: ["/node_modules/", "/dist/", "\\.pnp\\.[^\\/]+$"],
// Coverage rootDir: "./",
collectCoverage: true, testTimeout: 40000,
coverageReporters: ['text', 'text-summary'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html', 'json'],
collectCoverageFrom: [ // Coverage
"**/*.ts", collectCoverage: true,
"!**/sol/**", coverageReporters: ['text', 'text-summary'],
"!src/types.ts", collectCoverageFrom: [
"!src/logger.ts" "**/*.ts",
], "!**/sol/**",
coverageDirectory: '../../coverage/libs/remix-solidity' "!src/types.ts",
}; "!src/logger.ts"
],
coverageDirectory: '../../coverage/libs/remix-solidity'
};

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

Loading…
Cancel
Save