module split

pull/7/head
yann300 7 years ago
parent 007a2dcf27
commit f550bd8cff
  1. 10
      .travis.yml
  2. 20
      remix-core/index.js
  3. 81
      remix-core/package.json
  4. 5
      remix-core/src/code/breakpointManager.js
  5. 7
      remix-core/src/code/codeManager.js
  6. 5
      remix-core/src/code/codeResolver.js
  7. 0
      remix-core/src/code/codeUtils.js
  8. 3
      remix-core/src/code/disassembler.js
  9. 0
      remix-core/src/code/opcodes.js
  10. 3
      remix-core/src/storage/mappingPreimages.js
  11. 7
      remix-core/src/storage/storageResolver.js
  12. 5
      remix-core/src/storage/storageViewer.js
  13. 3
      remix-core/src/trace/traceAnalyser.js
  14. 3
      remix-core/src/trace/traceCache.js
  15. 9
      remix-core/src/trace/traceManager.js
  16. 5
      remix-core/src/trace/traceRetriever.js
  17. 5
      remix-core/src/trace/traceStepManager.js
  18. 13
      remix-core/test/codeManager.js
  19. 0
      remix-core/test/disassembler.js
  20. 0
      remix-core/test/init.js
  21. 2
      remix-core/test/resources/testWeb3.js
  22. 0
      remix-core/test/resources/testWeb3.json
  23. 3
      remix-core/test/tests.js
  24. 9
      remix-core/test/traceManager.js
  25. 0
      remix-debugger/assets/css/font-awesome.min.css
  26. 0
      remix-debugger/assets/fonts/FontAwesome.otf
  27. 0
      remix-debugger/assets/fonts/fontawesome-webfont.eot
  28. 0
      remix-debugger/assets/fonts/fontawesome-webfont.svg
  29. 0
      remix-debugger/assets/fonts/fontawesome-webfont.ttf
  30. 0
      remix-debugger/assets/fonts/fontawesome-webfont.woff
  31. 0
      remix-debugger/assets/fonts/fontawesome-webfont.woff2
  32. 0
      remix-debugger/ci/browser_tests.sh
  33. 0
      remix-debugger/ci/deploy_from_travis.sh
  34. 0
      remix-debugger/ci/deploy_key.enc
  35. 0
      remix-debugger/ci/sauceDisconnect.js
  36. 0
      remix-debugger/findClient.js
  37. 0
      remix-debugger/index.html
  38. 26
      remix-debugger/index.js
  39. 4
      remix-debugger/nightwatch.js
  40. 31
      remix-debugger/package.json
  41. 0
      remix-debugger/runNode.sh
  42. 3
      remix-debugger/src/ui/BasicPanel.js
  43. 3
      remix-debugger/src/ui/ButtonNavigator.js
  44. 0
      remix-debugger/src/ui/CalldataPanel.js
  45. 0
      remix-debugger/src/ui/CallstackPanel.js
  46. 5
      remix-debugger/src/ui/CodeListView.js
  47. 5
      remix-debugger/src/ui/DropdownPanel.js
  48. 25
      remix-debugger/src/ui/Ethdebugger.js
  49. 3
      remix-debugger/src/ui/FullStoragesChanges.js
  50. 5
      remix-debugger/src/ui/MemoryPanel.js
  51. 5
      remix-debugger/src/ui/Slider.js
  52. 6
      remix-debugger/src/ui/SolidityLocals.js
  53. 6
      remix-debugger/src/ui/SolidityState.js
  54. 0
      remix-debugger/src/ui/SolidityTypeFormatter.js
  55. 3
      remix-debugger/src/ui/StackPanel.js
  56. 0
      remix-debugger/src/ui/StepDetail.js
  57. 7
      remix-debugger/src/ui/StepManager.js
  58. 3
      remix-debugger/src/ui/StoragePanel.js
  59. 3
      remix-debugger/src/ui/TreeView.js
  60. 25
      remix-debugger/src/ui/TxBrowser.js
  61. 3
      remix-debugger/src/ui/VmDebugger.js
  62. 0
      remix-debugger/src/ui/styles/basicStyles.js
  63. 0
      remix-debugger/src/ui/styles/dropdownPanel.js
  64. 0
      remix-debugger/src/ui/styles/sliderStyles.js
  65. 0
      remix-debugger/src/ui/styles/style-guide.js
  66. 0
      remix-debugger/src/ui/styles/treeView.js
  67. 10
      remix-debugger/test-browser/resources/insertTestWeb3.js
  68. 17
      remix-debugger/test-browser/resources/testWeb3.json
  69. 2
      remix-debugger/test-browser/test/init.js
  70. 0
      remix-debugger/test-browser/test/sauce.js
  71. 0
      remix-debugger/test-browser/test/vmdebugger.js
  72. 40
      remix-lib/index.js
  73. 43
      remix-lib/package.json
  74. 0
      remix-lib/src/astWalker.js
  75. 0
      remix-lib/src/eventManager.js
  76. 3
      remix-lib/src/global.js
  77. 2
      remix-lib/src/helpers/traceHelper.js
  78. 0
      remix-lib/src/helpers/uiHelper.js
  79. 17
      remix-lib/src/init.js
  80. 8
      remix-lib/src/sourceLocationTracker.js
  81. 2
      remix-lib/src/sourceMappingDecoder.js
  82. 9
      remix-lib/src/util.js
  83. 0
      remix-lib/src/web3Provider/dummyProvider.js
  84. 2
      remix-lib/src/web3Provider/web3Providers.js
  85. 4
      remix-lib/src/web3Provider/web3VmProvider.js
  86. 2
      remix-lib/test/astwalker.js
  87. 2
      remix-lib/test/eventManager.js
  88. 0
      remix-lib/test/resources/ast.js
  89. 0
      remix-lib/test/resources/sourceMapping.js
  90. 84
      remix-lib/test/sourceMappingDecoder.js
  91. 4
      remix-lib/test/tests.js
  92. 31
      remix-lib/test/util.js
  93. 11
      remix-solidity/index.js
  94. 84
      remix-solidity/package.json
  95. 3
      remix-solidity/src/astHelper.js
  96. 0
      remix-solidity/src/decodeInfo.js
  97. 13
      remix-solidity/src/internalCallTree.js
  98. 0
      remix-solidity/src/localDecoder.js
  99. 5
      remix-solidity/src/solidityProxy.js
  100. 0
      remix-solidity/src/stateDecoder.js
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,12 +1,16 @@
language: node_js
node_js:
- stable
env:
- TEST_DIR=remix-core
- TEST_DIR=remix-lib
- TEST_DIR=remix-solidity
- TEST_DIR=remix-debugger
script:
- npm run test
- ./ci/browser_tests.sh
- cd $TEST_DIR && npm install && npm test
deploy:
provider: script
script: ci/deploy_from_travis.sh
script: remix-debugger/ci/deploy_from_travis.sh
skip_cleanup: true
on:
branch: master

@ -0,0 +1,20 @@
var CodeManager = require('./src/code/codeManager')
var StorageViewer = require('./src/storage/storageViewer')
var StorageResolver = require('./src/storage/storageResolver')
var TraceManager = require('./src/trace/traceManager')
module.exports = {
global: {
web3: null
},
code: {
CodeManager: CodeManager
},
storage: {
StorageViewer: StorageViewer,
StorageResolver: StorageResolver
},
trace: {
TraceManager: TraceManager
}
}

@ -0,0 +1,81 @@
{
"name": "remix-core",
"version": "0.0.2",
"description": "Ethereum IDE and tools for the web",
"contributors": [
{
"name": "Yann Levreau",
"email": "yann@ethereum.com"
},
{
"name": "Liana Husikyan",
"email": "liana@ethereum.com"
}
],
"main": "./index.js",
"dependencies": {
"babel-preset-es2015": "^6.24.0",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-eslint": "^7.1.1",
"babelify": "^7.3.0",
"fast-async": "^6.1.2",
"npm-link-local": "^1.1.0",
"remix-lib": "^0.0.1",
"standard": "^7.0.1",
"tape": "^4.6.0"
},
"scripts": {
"postinstall": "npm-link-local ../remix-lib",
"test": "standard && tape ./test/tests.js"
},
"standard": {
"ignore": [
"node_modules/*",
"build/*",
"test/resources/*"
],
"parser": "babel-eslint"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ethereum/remix.git"
},
"author": "cpp-ethereum team",
"license": "MIT",
"bugs": {
"url": "https://github.com/ethereum/remix/issues"
},
"homepage": "https://github.com/ethereum/remix#readme",
"browserify": {
"transform": [
[
"babelify",
{
"plugins": [
[
"fast-async",
{
"runtimePatten": null,
"compiler": {
"promises": true,
"es7": true,
"noRuntime": true,
"wrapAwait": true
}
}
],
"transform-object-assign"
]
}
],
[
"babelify",
{
"presets": [
"es2015"
]
}
]
]
}
}

@ -1,6 +1,7 @@
'use strict'
var EventManager = require('../lib/eventManager')
var helper = require('../helpers/traceHelper')
var remixLib = require('remix-lib')
var EventManager = remixLib.EventManager
var helper = remixLib.helpers.trace
/**
* allow to manage breakpoint

@ -1,8 +1,9 @@
'use strict'
var traceHelper = require('../helpers/traceHelper')
var remixLib = require('remix-lib')
var EventManager = remixLib.EventManager
var traceHelper = remixLib.helpers.trace
var SourceMappingDecoder = remixLib.SourceMappingDecoder
var codeResolver = require('./codeResolver')
var EventManager = require('../lib/eventManager')
var SourceMappingDecoder = require('../util/sourceMappingDecoder')
/*
resolve contract code referenced by vmtrace in order to be used by asm listview.

@ -1,6 +1,7 @@
'use strict'
var codeUtils = require('./codeUtils')
var util = require('../helpers/global')
var remixLib = require('remix-lib')
var global = remixLib.global
module.exports = {
bytecodeByAddress: {}, // bytes code by contract addesses
@ -28,7 +29,7 @@ module.exports = {
loadCode: function (address, callback) {
console.log('loading new code from web3 ' + address)
util.web3.eth.getCode(address, function (error, result) {
global.web3.eth.getCode(address, function (error, result) {
if (error) {
console.log(error)
} else {

@ -1,7 +1,8 @@
'use strict'
var parseCode = require('./codeUtils').parseCode
var util = require('../helpers/util')
var remixLib = require('remix-lib')
var util = remixLib.util
var createExpressions = function (instructions) {
var expressions = []

@ -1,4 +1,5 @@
var global = require('../helpers/global')
var remixLib = require('remix-lib')
var global = remixLib.global
module.exports = {
decodeMappingsKeys: decodeMappingsKeys

@ -1,6 +1,7 @@
'use strict'
var traceHelper = require('../helpers/traceHelper')
var util = require('../helpers/global')
var remixLib = require('remix-lib')
var traceHelper = remixLib.helpers.trace
var global = remixLib.global
var mappingPreimages = require('./mappingPreimages')
/**
@ -145,7 +146,7 @@ function storageRangeWeb3Call (tx, address, start, maxSize, callback) {
if (traceHelper.isContractCreation(address)) {
callback(null, {}, null)
} else {
util.web3.debug.storageRangeAt(
global.web3.debug.storageRangeAt(
tx.blockHash, tx.transactionIndex === undefined ? tx.hash : tx.transactionIndex,
address,
start,

@ -1,5 +1,6 @@
'use strict'
var helper = require('../helpers/util')
var remixLib = require('remix-lib')
var util = remixLib.util
var mappingPreimages = require('./mappingPreimages')
/**
@ -44,7 +45,7 @@ class StorageViewer {
* @param {Function} - callback - {key, hashedKey, value} -
*/
storageSlot (slot, callback) {
var hashed = helper.sha3_256(slot)
var hashed = util.sha3_256(slot)
if (this.storageChanges[hashed]) {
return callback(null, this.storageChanges[hashed])
}

@ -1,5 +1,6 @@
'use strict'
var traceHelper = require('../helpers/traceHelper')
var remixLib = require('remix-lib')
var traceHelper = remixLib.helpers.trace
function TraceAnalyser (_cache) {
this.traceCache = _cache

@ -1,5 +1,6 @@
'use strict'
var helper = require('../helpers/util')
var remixLib = require('remix-lib')
var helper = remixLib.util
function TraceCache () {
this.init()

@ -3,9 +3,10 @@ var TraceAnalyser = require('./traceAnalyser')
var TraceRetriever = require('./traceRetriever')
var TraceCache = require('./traceCache')
var TraceStepManager = require('./traceStepManager')
var traceHelper = require('../helpers/traceHelper')
var util = require('../helpers/util')
var globalUtil = require('../helpers/global')
var remixLib = require('remix-lib')
var traceHelper = remixLib.helpers.trace
var util = remixLib.util
var global = remixLib.global
function TraceManager () {
this.isLoading = false
@ -21,7 +22,7 @@ function TraceManager () {
TraceManager.prototype.resolveTrace = function (tx, callback) {
this.tx = tx
this.init()
if (!globalUtil.web3) callback('web3 not loaded', false)
if (!global.web3) callback('web3 not loaded', false)
this.isLoading = true
var self = this
this.traceRetriever.getTrace(tx.hash, function (error, result) {

@ -1,5 +1,6 @@
'use strict'
var util = require('../helpers/global')
var remixLib = require('remix-lib')
var global = remixLib.global
function TraceRetriever () {
}
@ -11,7 +12,7 @@ TraceRetriever.prototype.getTrace = function (txHash, callback) {
disableStack: false,
fullStorage: false
}
util.web3.debug.traceTransaction(txHash, options, function (error, result) {
global.web3.debug.traceTransaction(txHash, options, function (error, result) {
callback(error, result)
})
}

@ -1,6 +1,7 @@
'use strict'
var traceHelper = require('../helpers/traceHelper')
var util = require('../helpers/util')
var remixLib = require('remix-lib')
var traceHelper = remixLib.helpers.trace
var util = remixLib.util
function TraceStepManager (_traceAnalyser) {
this.traceAnalyser = _traceAnalyser

@ -1,10 +1,11 @@
'use strict'
var tape = require('tape')
var Web3Providers = require('../src/web3Provider/web3Providers')
var remixLib = require('remix-lib')
var Web3Providers = remixLib.vm.Web3Providers
var TraceManager = require('../src/trace/traceManager')
var CodeManager = require('../src/code/codeManager')
var web3Test = require('./resources/testWeb3')
var util = require('../src/helpers/global')
var global = remixLib.global
tape('CodeManager', function (t) {
var codeManager
@ -16,12 +17,12 @@ tape('CodeManager', function (t) {
console.log(mes)
t.fail(mes)
} else {
util.web3 = obj
global.web3 = obj
var traceManager = new TraceManager()
codeManager = new CodeManager(traceManager)
var contractCode = util.web3.eth.getCode('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
var contractCode = global.web3.eth.getCode('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
codeManager.codeResolver.cacheExecutingCode('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5', contractCode) // so a call to web3 is not necessary
var tx = util.web3.eth.getTransaction('0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51')
var tx = global.web3.eth.getTransaction('0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51')
traceManager.resolveTrace(tx, function (error, result) {
if (error) {
t.fail(' - traceManager.resolveTrace - failed ' + result)
@ -62,7 +63,7 @@ function continueTesting (t, codeManager) {
}
}
})
var tx = util.web3.eth.getTransaction('0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51')
var tx = global.web3.eth.getTransaction('0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51')
codeManager.resolveStep(0, tx)
codeManager.resolveStep(70, tx)
})

@ -4,7 +4,7 @@ var web3Override = {}
web3Override.eth = {}
web3Override.debug = {}
var data = init.readFile(require('path').resolve(__dirname, 'testWeb3.json'))
var data = JSON.parse(data)
data = JSON.parse(data)
web3Override.eth.getCode = function (address, callback) {
if (callback) {

@ -0,0 +1,3 @@
require('./traceManager.js')
require('./codeManager.js')
require('./disassembler.js')

@ -1,8 +1,9 @@
'use strict'
var TraceManager = require('../src/trace/traceManager')
var tape = require('tape')
var Web3Providers = require('../src/web3Provider/web3Providers')
var util = require('../src/helpers/global')
var remixLib = require('remix-lib')
var Web3Providers = remixLib.vm.Web3Providers
var global = remixLib.global
var web3Test = require('./resources/testWeb3')
tape('TraceManager', function (t) {
@ -17,7 +18,7 @@ tape('TraceManager', function (t) {
console.log(mes)
st.fail(mes)
} else {
util.web3 = obj
global.web3 = obj
traceManager = new TraceManager()
st.end()
}
@ -25,7 +26,7 @@ tape('TraceManager', function (t) {
})
t.test('TraceManager.resolveTrace', function (st) {
var tx = util.web3.eth.getTransaction('0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51')
var tx = global.web3.eth.getTransaction('0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51')
traceManager.resolveTrace(tx, function (error, result) {
if (error) {
st.fail(' - traceManager.resolveTrace - failed ' + result)

Before

Width:  |  Height:  |  Size: 348 KiB

After

Width:  |  Height:  |  Size: 348 KiB

@ -0,0 +1,26 @@
'use strict'
var VMDebugger = require('./src/ui/VmDebugger')
var Debugger = require('./src/ui/Ethdebugger')
var BasicPanel = require('./src/ui/BasicPanel')
var TreeView = require('./src/ui/TreeView')
var styleGuide = require('./src/ui/styles/style-guide')
if (typeof (module) !== 'undefined' && typeof (module.exports) !== 'undefined') {
module.exports = modules()
}
if (typeof (window) !== 'undefined') {
window.remix = modules()
}
function modules () {
return {
ui: {
Debugger: Debugger,
VMdebugger: VMDebugger,
BasicPanel: BasicPanel,
TreeView: TreeView,
styleGuide: styleGuide
}
}
}

@ -2,8 +2,8 @@
var TRAVIS_JOB_NUMBER = process.env.TRAVIS_JOB_NUMBER
module.exports = {
'src_folders': ['./test-browser'],
'output_folder': './test-browser/reports',
'src_folders': ['./test-browser/test'],
'output_folder': './test-browser/test/reports',
'custom_commands_path': '',
'custom_assertions_path': '',
'globals_path': '',

@ -1,6 +1,6 @@
{
"name": "ethereum-remix",
"version": "0.0.4",
"name": "remix-debugger",
"version": "0.0.2",
"description": "Ethereum IDE and tools for the web",
"contributors": [
{
@ -12,17 +12,19 @@
"email": "liana@ethdev.com"
}
],
"main": "./src/index.js",
"dependencies": {
"which": "^1.2.10"
},
"main": "./index.js",
"devDependencies": {
"csjs-inject": "^1.0.1",
"yo-yo": "^1.2.1",
"yo-yoify": "^3.1.0",
"remix-lib": "^0.0.1",
"remix-core": "^0.0.1",
"remix-solidity": "^0.0.1",
"babel-eslint": "^7.1.1",
"babel-preset-es2015": "^6.24.0",
"babel-plugin-transform-object-assign": "^6.22.0",
"babelify": "^7.3.0",
"browserify": "^13.0.1",
"csjs-inject": "^1.0.1",
"ethereum-common": "0.0.18",
"ethereumjs-block": "^1.2.2",
"ethereumjs-tx": "^1.1.1",
@ -31,17 +33,17 @@
"fast-async": "^6.1.2",
"http-server": "^0.9.0",
"nightwatch": "^0.9.5",
"npm-link-local": "^1.1.0",
"selenium-standalone": "^6.0.1",
"solc": "^0.4.13",
"standard": "^7.0.1",
"standard-reporter": "^1.0.5",
"tape": "^4.6.0",
"web3": "^0.15.3",
"yo-yo": "^1.2.1",
"yo-yoify": "^3.1.0"
"web3": "^0.15.3"
},
"scripts": {
"build": "mkdirp build; browserify src/index.js > build/app.js",
"postinstall": "npm-link-local ../remix-lib && npm-link-local ../remix-core && npm-link-local ../remix-solidity",
"build": "mkdirp build; browserify index.js > build/app.js",
"lint": "standard | notify-error",
"nightwatch_local": "nightwatch --config nightwatch.js --env local",
"nightwatch_remote_chrome": "nightwatch --config nightwatch.js --env chrome",
@ -50,7 +52,6 @@
"nightwatch_remote_parallel": "nightwatch --config nightwatch.js --env ie,safari,chrome,default",
"nightwatch_remote_safari": "nightwatch --config nightwatch.js --env safari",
"onchange": "onchange build/app.js -- npm run lint",
"prepublish": "npm run build",
"selenium": "selenium-standalone start",
"selenium-install": "selenium-standalone install",
"serve": "http-server .",
@ -58,7 +59,7 @@
"start_dev": "npm-run-all -lpr serve watch onchange",
"start_eth": "npm run warning_message; eth -j --rpccorsdomain '*'",
"start_geth": "npm run warning_message; geth --rpc --rpcapi 'web3,eth,debug' --rpcport 8545 --rpccorsdomain '*'",
"test": "standard && tape ./test/tests.js",
"test": "standard && tape ./test/tests.js && ./ci/browser_tests.sh",
"test-browser": "npm-run-all -lpr selenium serve waittest",
"waittest": "sleep 5 && npm run nightwatch_local",
"warning_message": "echo 'DO NOT DO THIS IF eth/geth STORES PRIVATE KEYS!! External system might be able to access your node through the RPC server.\n\n';",
@ -79,8 +80,7 @@
"node_modules/*",
"build/*",
"test/resources/*"
],
"parser": "babel-eslint"
]
},
"browserify": {
"transform": [
@ -118,3 +118,4 @@
]
}
}

@ -1,7 +1,8 @@
'use strict'
var style = require('./styles/basicStyles')
var yo = require('yo-yo')
var ui = require('../helpers/ui')
var remixLib = require('remix-lib')
var ui = remixLib.helpers.ui
var csjs = require('csjs-inject')

@ -1,5 +1,6 @@
'use strict'
var EventManager = require('../lib/eventManager')
var remixLib = require('remix-lib')
var EventManager = remixLib.EventManager
var yo = require('yo-yo')
var csjs = require('csjs-inject')

@ -1,9 +1,10 @@
'use strict'
var style = require('./styles/basicStyles')
var yo = require('yo-yo')
var ui = require('../helpers/ui')
var remixLib = require('remix-lib')
var ui = remixLib.helpers.ui
var DropdownPanel = require('./DropdownPanel')
var EventManager = require('../lib/eventManager')
var EventManager = remixLib.EventManager
var csjs = require('csjs-inject')
var styleGuide = require('./styles/style-guide')
var styles = styleGuide()

@ -1,9 +1,10 @@
'use strict'
var yo = require('yo-yo')
var ui = require('../helpers/ui')
var remixLib = require('remix-lib')
var ui = remixLib.helpers.ui
var styleDropdown = require('./styles/dropdownPanel')
var TreeView = require('./TreeView')
var EventManager = require('../lib/eventManager')
var EventManager = remixLib.EventManager
var csjs = require('csjs-inject')
var styleGuide = require('./styles/style-guide')

@ -1,18 +1,21 @@
'use strict'
var TxBrowser = require('./TxBrowser')
var StepManager = require('./StepManager')
var TraceManager = require('../trace/traceManager')
var remixCore = require('remix-core')
var TraceManager = remixCore.trace.TraceManager
var VmDebugger = require('./VmDebugger')
var style = require('./styles/basicStyles')
var util = require('../helpers/global')
var EventManager = require('../lib/eventManager')
var remixLib = require('remix-lib')
var global = remixLib.global
var EventManager = remixLib.EventManager
var yo = require('yo-yo')
var ui = require('../helpers/ui')
var Web3Providers = require('../web3Provider/web3Providers')
var DummyProvider = require('../web3Provider/dummyProvider')
var CodeManager = require('../code/codeManager')
var SolidityProxy = require('../solidity/solidityProxy')
var InternalCallTree = require('../util/internalCallTree')
var ui = remixLib.helpers.ui
var Web3Providers = remixLib.vm.Web3Providers
var DummyProvider = remixLib.vm.DummyProvider
var CodeManager = remixCore.code.CodeManager
var remixSolidity = require('remix-solidity')
var SolidityProxy = remixSolidity.SolidityProxy
var InternalCallTree = remixSolidity.InternalCallTree
function Ethdebugger () {
var self = this
@ -67,7 +70,7 @@ Ethdebugger.prototype.setBreakpointManager = function (breakpointManager) {
}
Ethdebugger.prototype.web3 = function () {
return util.web3
return global.web3
}
Ethdebugger.prototype.addProvider = function (type, obj) {
@ -81,7 +84,7 @@ Ethdebugger.prototype.switchProvider = function (type) {
if (error) {
console.log('provider ' + type + ' not defined')
} else {
util.web3 = obj
global.web3 = obj
self.event.trigger('providerChanged', [type])
}
})

@ -1,6 +1,7 @@
'use strict'
var DropdownPanel = require('./DropdownPanel')
var StorageViewer = require('../storage/storageViewer')
var remixCore = require('remix-core')
var StorageViewer = remixCore.storage.StorageViewer
var yo = require('yo-yo')
function FullStoragesChanges (_parent, _traceManager) {

@ -1,6 +1,7 @@
'use strict'
var DropdownPanel = require('./DropdownPanel')
var util = require('../helpers/ui')
var remixLib = require('remix-lib')
var ui = remixLib.helpers.ui
var yo = require('yo-yo')
function MemoryPanel (_parent, _traceManager) {
@ -29,7 +30,7 @@ MemoryPanel.prototype.init = function () {
console.log(error)
self.basicPanel.update({})
} else if (self.parent.currentStepIndex === index) {
self.basicPanel.update(util.formatMemory(memory, 16))
self.basicPanel.update(ui.formatMemory(memory, 16))
}
})
})

@ -1,8 +1,9 @@
'use strict'
var style = require('./styles/sliderStyles')
var EventManager = require('../lib/eventManager')
var remixLib = require('remix-lib')
var EventManager = remixLib.EventManager
var yo = require('yo-yo')
var ui = require('../helpers/ui')
var ui = remixLib.helpers.ui
class Slider {
constructor (_traceManager, _stepOverride) {

@ -1,8 +1,10 @@
'use strict'
var DropdownPanel = require('./DropdownPanel')
var localDecoder = require('../solidity/localDecoder')
var remixSolidity = require('remix-solidity')
var localDecoder = remixSolidity.localDecoder
var solidityTypeFormatter = require('./SolidityTypeFormatter')
var StorageViewer = require('../storage/storageViewer')
var remixCore = require('remix-core')
var StorageViewer = remixCore.storage.StorageViewer
var yo = require('yo-yo')
class SolidityLocals {

@ -1,8 +1,10 @@
'use strict'
var DropdownPanel = require('./DropdownPanel')
var stateDecoder = require('../solidity/stateDecoder')
var remixSolidity = require('remix-solidity')
var stateDecoder = remixSolidity.stateDecoder
var solidityTypeFormatter = require('./SolidityTypeFormatter')
var StorageViewer = require('../storage/storageViewer')
var remixCore = require('remix-core')
var StorageViewer = remixCore.storage.StorageViewer
var yo = require('yo-yo')
function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy) {

@ -1,6 +1,7 @@
'use strict'
var DropdownPanel = require('./DropdownPanel')
var ui = require('../helpers/ui')
var remixLib = require('remix-lib')
var ui = remixLib.helpers.ui
var yo = require('yo-yo')
function StackPanel (_parent, _traceManager) {

@ -1,9 +1,10 @@
'use strict'
var ButtonNavigator = require('./ButtonNavigator')
var Slider = require('./Slider')
var EventManager = require('../lib/eventManager')
var remixLib = require('remix-lib')
var EventManager = remixLib.EventManager
var yo = require('yo-yo')
var utils = require('../helpers/util.js')
var util = remixLib.util
function StepManager (_parent, _traceManager) {
this.event = new EventManager()
@ -73,7 +74,7 @@ function StepManager (_parent, _traceManager) {
StepManager.prototype.resolveToReducedTrace = function (value, incr) {
if (this.parent.callTree.reducedTrace.length) {
var nextSource = utils.findClosestIndex(value, this.parent.callTree.reducedTrace)
var nextSource = util.findClosestIndex(value, this.parent.callTree.reducedTrace)
nextSource = nextSource + incr
if (nextSource <= 0) {
nextSource = 0

@ -1,6 +1,7 @@
'use strict'
var DropdownPanel = require('./DropdownPanel')
var StorageViewer = require('../storage/storageViewer')
var remixCore = require('remix-core')
var StorageViewer = remixCore.storage.StorageViewer
var yo = require('yo-yo')
function StoragePanel (_parent, _traceManager) {

@ -1,7 +1,8 @@
'use strict'
var yo = require('yo-yo')
var style = require('./styles/treeView')
var ui = require('../helpers/ui')
var remixLib = require('remix-lib')
var ui = remixLib.helpers.ui
class TreeView {

@ -1,9 +1,10 @@
var util = require('../helpers/global')
var EventManager = require('../lib/eventManager')
var traceHelper = require('../helpers/traceHelper')
var remixLib = require('remix-lib')
var global = remixLib.global
var EventManager = remixLib.EventManager
var traceHelper = remixLib.helpers.trace
var yo = require('yo-yo')
var ui = require('../helpers/ui')
var init = require('../helpers/init')
var ui = remixLib.helpers.ui
var init = remixLib.init
var DropdownPanel = require('./DropdownPanel')
var style = require('./styles/basicStyles')
var csjs = require('csjs-inject')
@ -87,11 +88,11 @@ TxBrowser.prototype.submit = function () {
try {
var self = this
if (this.txNumber.indexOf('0x') !== -1) {
util.web3.eth.getTransaction(this.txNumber, function (error, result) {
global.web3.eth.getTransaction(this.txNumber, function (error, result) {
self.update(error, result)
})
} else {
util.web3.eth.getTransactionFromBlock(this.blockNumber, this.txNumber, function (error, result) {
global.web3.eth.getTransactionFromBlock(this.blockNumber, this.txNumber, function (error, result) {
self.update(error, result)
})
}
@ -126,13 +127,13 @@ TxBrowser.prototype.update = function (error, tx) {
}
TxBrowser.prototype.updateWeb3Url = function (newhost) {
init.setProvider(util.web3, newhost)
init.setProvider(global.web3, newhost)
var self = this
this.checkWeb3(function (error, block) {
if (!error) {
self.connectInfo = 'Connected to ' + util.web3.currentProvider.host + '. Current block number: ' + block
self.connectInfo = 'Connected to ' + global.web3.currentProvider.host + '. Current block number: ' + block
} else {
self.connectInfo = 'Unable to connect to ' + util.web3.currentProvider.host + '. ' + error.message
self.connectInfo = 'Unable to connect to ' + global.web3.currentProvider.host + '. ' + error.message
}
yo.update(self.view, self.render())
})
@ -140,7 +141,7 @@ TxBrowser.prototype.updateWeb3Url = function (newhost) {
TxBrowser.prototype.checkWeb3 = function (callback) {
try {
util.web3.eth.getBlockNumber(function (error, block) {
global.web3.eth.getBlockNumber(function (error, block) {
callback(error, block)
})
} catch (e) {
@ -174,7 +175,7 @@ TxBrowser.prototype.init = function (ev) {
TxBrowser.prototype.connectionSetting = function () {
if (this.displayConnectionSetting) {
var self = this
return yo`<div style=${ui.formatCss(style.vmargin)}><span>Node URL: </span><input onkeyup=${function () { self.updateWeb3Url(arguments[0].target.value) }} value=${util.web3.currentProvider ? util.web3.currentProvider.host : ' - none - '} type='text' />
return yo`<div style=${ui.formatCss(style.vmargin)}><span>Node URL: </span><input onkeyup=${function () { self.updateWeb3Url(arguments[0].target.value) }} value=${global.web3.currentProvider ? global.web3.currentProvider.host : ' - none - '} type='text' />
<span>${this.connectInfo}</span></div>`
} else {
return ''

@ -10,7 +10,8 @@ var StepDetail = require('./StepDetail')
var DropdownPanel = require('./DropdownPanel')
var SolidityState = require('./SolidityState')
var SolidityLocals = require('./SolidityLocals')
var StorageResolver = require('../storage/storageResolver.js')
var remixCore = require('remix-core')
var StorageResolver = remixCore.storage.StorageResolver
var yo = require('yo-yo')
function VmDebugger (_parent, _traceManager, _codeManager, _solidityProxy, _callTree) {

@ -1,9 +1,10 @@
/* global XMLHttpRequest */
function loadJSON (url, callback) {
var xobj = new XMLHttpRequest()
xobj.overrideMimeType('application/json')
xobj.open('GET', url, true)
xobj.onreadystatechange = function () {
if (xobj.readyState == 4 && xobj.status == '200') {
if (xobj.readyState === 4 && xobj.status === 200) {
callback(xobj.responseText)
}
}
@ -23,7 +24,7 @@ function loadTestWeb3 (data) {
return data.testCodes[address]
}
}
uiTestweb3.debug.traceTransaction = function (txHash, options, callback) {
callback(null, data.testTraces[txHash])
}
@ -54,7 +55,7 @@ function loadTestWeb3 (data) {
uiTestweb3.setProvider = function (provider) {}
uiTestweb3.currentProvider = {host: 'web3 modified for testing purposes :)'}
uiTestweb3.currentProvider = {host: 'web3 modified for testing purposes :)'}
vmdebugger.addProvider('TEST', uiTestweb3)
vmdebugger.switchProvider('TEST')
}
@ -69,9 +70,8 @@ function waitForRemix (data) {
}, 500)
}
loadJSON('/test/resources/testWeb3.json', function (result) {
loadJSON('/test-browser/resources/testWeb3.json', function (result) {
var data = JSON.parse(result)
waitForRemix(data)
})

File diff suppressed because one or more lines are too long

@ -2,7 +2,7 @@ module.exports = function (browser, callback) {
extendBrowser(browser)
browser
.url('http://127.0.0.1:8080')
.injectScript('test/resources/insertTestWeb3.js', function () {
.injectScript('test-browser/resources/insertTestWeb3.js', function () {
// wait for the script to load test web3...
setTimeout(function () {
callback()

@ -0,0 +1,40 @@
'use strict'
var EventManager = require('./src/eventManager')
var traceHelper = require('./src/helpers/traceHelper')
var uiHelper = require('./src/helpers/uiHelper')
var SourceMappingDecoder = require('./src/sourceMappingDecoder')
var SourceLocationTracker = require('./src/sourceLocationTracker')
var init = require('./src/init')
var util = require('./src/util')
var Web3Providers = require('./src/web3Provider/web3Providers')
var DummyProvider = require('./src/web3Provider/dummyProvider')
var AstWalker = require('./src/astWalker')
var global = require('./src/global')
if (typeof (module) !== 'undefined' && typeof (module.exports) !== 'undefined') {
module.exports = modules()
}
if (typeof (window) !== 'undefined') {
window.remix = modules()
}
function modules () {
return {
EventManager: EventManager,
helpers: {
trace: traceHelper,
ui: uiHelper
},
vm: {
Web3Providers: Web3Providers,
DummyProvider: DummyProvider
},
SourceMappingDecoder: SourceMappingDecoder,
SourceLocationTracker: SourceLocationTracker,
init: init,
util: util,
AstWalker: AstWalker,
global: global
}
}

@ -0,0 +1,43 @@
{
"name": "remix-lib",
"version": "0.0.2",
"description": "Ethereum IDE and tools for the web",
"contributors": [
{
"name": "Yann Levreau",
"email": "yann@ethdev.com"
},
{
"name": "Liana Husikyan",
"email": "liana@ethdev.com"
}
],
"main": "./index.js",
"dependencies": {
"ethereumjs-util": "^4.5.0",
"web3": "^0.15.3",
"solc": "^0.4.13",
"standard": "^7.0.1",
"tape": "^4.6.0"
},
"scripts": {
"test": "standard && tape ./test/tests.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ethereum/remix.git"
},
"author": "cpp-ethereum team",
"license": "MIT",
"bugs": {
"url": "https://github.com/ethereum/remix/issues"
},
"homepage": "https://github.com/ethereum/remix#readme",
"standard": {
"ignore": [
"node_modules/*",
"build/*",
"test/resources/*"
]
}
}

@ -0,0 +1,3 @@
module.exports = {
web3: null
}

@ -1,5 +1,5 @@
'use strict'
var ui = require('../helpers/ui')
var ui = require('./uiHelper')
module.exports = {
// vmTraceIndex has to point to a CALL, CODECALL, ...
resolveCalledAddress: function (vmTraceIndex, trace) {

@ -1,5 +1,22 @@
'use strict'
var Web3 = require('web3')
module.exports = {
loadWeb3: function () {
var web3 = new Web3()
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'))
this.extend(web3)
return web3
},
extendWeb3: function (web3) {
this.extend(web3)
},
setProvider: function (web3, url) {
web3.setProvider(new web3.providers.HttpProvider(url))
},
extend: function (web3) {
if (!web3._extend) {
return

@ -1,8 +1,8 @@
'use strict'
var EventManager = require('../lib/eventManager')
var helper = require('../helpers/traceHelper')
var SourceMappingDecoder = require('../util/sourceMappingDecoder')
var util = require('../helpers/util')
var EventManager = require('./eventManager')
var helper = require('./helpers/traceHelper')
var SourceMappingDecoder = require('./sourceMappingDecoder')
var util = require('./util')
/**
* Process the source code location for the current executing bytecode

@ -1,5 +1,5 @@
'use strict'
var util = require('../helpers/util')
var util = require('./util')
var AstWalker = require('./astWalker')
/**

@ -1,6 +1,15 @@
'use strict'
var ethutil = require('ethereumjs-util')
/*
contains misc util: @TODO should be splitted
- hex convertion
- binary search
- CALL related look up
- sha3 calculation
- swarm hash extraction
- bytecode comparison
*/
module.exports = {
/*
ints: IntArray

@ -1,5 +1,5 @@
var Web3VMProvider = require('./web3VmProvider')
var init = require('../helpers/init')
var init = require('../init')
function Web3Providers () {
this.modes = {}

@ -1,5 +1,5 @@
var util = require('../helpers/util')
var uiutil = require('../helpers/ui')
var util = require('../util')
var uiutil = require('../helpers/uiHelper')
var traceHelper = require('../helpers/traceHelper')
var ethutil = require('ethereumjs-util')
var Web3 = require('web3')

@ -1,6 +1,6 @@
'use strict'
var tape = require('tape')
var AstWalker = require('../src/util/astWalker')
var AstWalker = require('../src/astWalker')
var node = require('./resources/ast')
tape('ASTWalker', function (t) {

@ -1,6 +1,6 @@
'use strict'
var tape = require('tape')
var EventManager = require('../src/lib/eventManager')
var EventManager = require('../src/eventManager')
tape('eventManager', function (t) {
t.test('eventManager', function (st) {
var events = new EventManager()

@ -1,40 +1,28 @@
'use strict'
var sourceMapping = require('./resources/sourceMapping')
var index = require('../src/index')
var tape = require('tape')
var util = require('../src/helpers/util')
tape('Util', function (t) {
t.test('lowerbound', function (st) {
st.plan(7)
var array = [2, 5, 8, 9, 45, 56, 78]
var lowerBound = util.findLowerBound(10, array)
st.equal(lowerBound, 3)
lowerBound = util.findLowerBound(3, array)
st.equal(lowerBound, 0)
lowerBound = util.findLowerBound(100, array)
st.equal(lowerBound, 6)
lowerBound = util.findLowerBound(1, array)
st.equal(lowerBound, -1)
lowerBound = util.findLowerBound(45, array)
st.equal(lowerBound, 4)
array = [2, 5, 8, 9, 9, 45, 56, 78]
lowerBound = util.findLowerBound(9, array)
st.equal(lowerBound, 4)
lowerBound = util.findLowerBound(9, [])
st.equal(lowerBound, -1)
var sourceMapping = require('./resources/sourceMapping')
var SourceMappingDecoder = require('../src/sourceMappingDecoder')
var compiler = require('solc')
tape('SourceMappingDecoder', function (t) {
t.test('SourceMappingDecoder.findNodeAtInstructionIndex', function (st) {
var output = compiler.compileStandardWrapper(compilerInput(contracts))
output = JSON.parse(output)
var sourceMappingDecoder = new SourceMappingDecoder()
var node = sourceMappingDecoder.findNodeAtInstructionIndex('FunctionDefinition', 2, output.contracts['test.sol']['test'].evm.deployedBytecode.sourceMap, output.sources['test.sol'])
st.equal(node, null)
node = sourceMappingDecoder.findNodeAtInstructionIndex('FunctionDefinition', 80, output.contracts['test.sol']['test'].evm.deployedBytecode.sourceMap, output.sources['test.sol'])
st.notEqual(node, null)
if (node) {
st.equal(node.attributes.name, 'f1')
}
st.end()
})
var testSourceMapping = {}
t.test('sourceMappingDecoder', function (st) {
st.plan(28)
var sourceMappingDecoder = new index.util.SourceMappingDecoder()
var sourceMappingDecoder = new SourceMappingDecoder()
console.log('test decompressAll')
var result = sourceMappingDecoder.decompressAll(sourceMapping.mapping)
st.equal(result[0].start, 0)
@ -88,7 +76,7 @@ tape('Util', function (t) {
t.test('sourceMappingLineColumnConverter', function (st) {
st.plan(14)
var sourceMappingDecoder = new index.util.SourceMappingDecoder()
var sourceMappingDecoder = new SourceMappingDecoder()
var linesbreak = sourceMappingDecoder.getLinebreakPositions(sourceMapping.source)
st.equal(linesbreak[0], 16)
st.equal(linesbreak[5], 84)
@ -116,3 +104,37 @@ tape('Util', function (t) {
st.equal(result.end.column, 16)
})
})
var contracts = `contract test {
function f1() returns (uint) {
uint t = 4;
return t;
}
function f2() {
}
}
`
function compilerInput (contracts) {
return JSON.stringify({
language: 'Solidity',
sources: {
'test.sol': {
content: contracts
}
},
settings: {
optimizer: {
enabled: false,
runs: 500
}
},
outputSelection: {
'*': {
'*': [ 'metadata', 'evm.bytecode', 'abi', 'legacyAST', 'metadata', 'evm.assembly', 'evm.methodIdentifiers', 'evm.gasEstimates' ]
}
}
})
}

@ -0,0 +1,4 @@
require('./astwalker.js')
require('./eventManager.js')
require('./sourceMappingDecoder.js')
require('./util.js')

@ -0,0 +1,31 @@
'use strict'
var tape = require('tape')
var util = require('../src/util')
tape('Util', function (t) {
t.test('lowerbound', function (st) {
st.plan(7)
var array = [2, 5, 8, 9, 45, 56, 78]
var lowerBound = util.findLowerBound(10, array)
st.equal(lowerBound, 3)
lowerBound = util.findLowerBound(3, array)
st.equal(lowerBound, 0)
lowerBound = util.findLowerBound(100, array)
st.equal(lowerBound, 6)
lowerBound = util.findLowerBound(1, array)
st.equal(lowerBound, -1)
lowerBound = util.findLowerBound(45, array)
st.equal(lowerBound, 4)
array = [2, 5, 8, 9, 9, 45, 56, 78]
lowerBound = util.findLowerBound(9, array)
st.equal(lowerBound, 4)
lowerBound = util.findLowerBound(9, [])
st.equal(lowerBound, -1)
})
})

@ -0,0 +1,11 @@
var InternalCallTree = require('./src/internalCallTree')
var SolidityProxy = require('./src/solidityProxy')
var localDecoder = require('./src/localDecoder')
var stateDecoder = require('./src/stateDecoder')
module.exports = {
InternalCallTree: InternalCallTree,
SolidityProxy: SolidityProxy,
localDecoder: localDecoder,
stateDecoder: stateDecoder
}

@ -0,0 +1,84 @@
{
"name": "remix-solidity",
"version": "0.0.2",
"description": "Ethereum IDE and tools for the web",
"contributors": [
{
"name": "Yann Levreau",
"email": "yann@ethdev.com"
},
{
"name": "Liana Husikyan",
"email": "liana@ethdev.com"
}
],
"main": "./index.js",
"dependencies": {
"babel-preset-es2015": "^6.24.0",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-eslint": "^7.1.1",
"babelify": "^7.3.0",
"ethereumjs-util": "^4.5.0",
"ethereumjs-vm": "2.3.1",
"fast-async": "^6.1.2",
"npm-link-local": "^1.1.0",
"remix-core": "^0.0.1",
"remix-lib": "^0.0.1",
"solc": "^0.4.13",
"standard": "^7.0.1",
"tape": "^4.6.0"
},
"scripts": {
"postinstall": "npm-link-local ../remix-lib && npm-link-local ../remix-core",
"test": "standard && tape ./test/tests.js"
},
"standard": {
"ignore": [
"node_modules/*",
"build/*"
],
"parser": "babel-eslint"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ethereum/remix.git"
},
"author": "cpp-ethereum team",
"license": "MIT",
"bugs": {
"url": "https://github.com/ethereum/remix/issues"
},
"homepage": "https://github.com/ethereum/remix#readme",
"browserify": {
"transform": [
[
"babelify",
{
"plugins": [
[
"fast-async",
{
"runtimePatten": null,
"compiler": {
"promises": true,
"es7": true,
"noRuntime": true,
"wrapAwait": true
}
}
],
"transform-object-assign"
]
}
],
[
"babelify",
{
"presets": [
"es2015"
]
}
]
]
}
}

@ -1,5 +1,6 @@
'use strict'
var AstWalker = require('../util/astWalker')
var remixLib = require('remix-lib')
var AstWalker = remixLib.AstWalker
/**
* return all contract definitions of the given @astList

@ -1,10 +1,11 @@
'use strict'
var SourceLocationTracker = require('../code/sourceLocationTracker')
var AstWalker = require('./astWalker')
var EventManager = require('../lib/eventManager')
var decodeInfo = require('../solidity/decodeInfo')
var util = require('../helpers/util')
var traceHelper = require('../helpers/traceHelper')
var remixLib = require('remix-lib')
var SourceLocationTracker = remixLib.SourceLocationTracker
var AstWalker = remixLib.AstWalker
var EventManager = remixLib.EventManager
var decodeInfo = require('./decodeInfo')
var util = remixLib.util
var traceHelper = remixLib.helpers.trace
/**
* Tree representing internal jump into function.

@ -1,8 +1,9 @@
'use strict'
var traceHelper = require('../helpers/traceHelper')
var remixLib = require('remix-lib')
var traceHelper = remixLib.helpers.trace
var stateDecoder = require('./stateDecoder')
var astHelper = require('./astHelper')
var util = require('../helpers/util')
var util = remixLib.util
class SolidityProxy {
constructor (traceManager, codeManager) {

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

Loading…
Cancel
Save