From 1bb64cd210671d313b4ec5d04e7ea8832b21f5b2 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 6 Jul 2016 12:08:50 +0200 Subject: [PATCH] gremove old test resources --- ci/browser_tests.sh | 18 +- ci/sauceDisconnect.js | 72 ++++++++ src/BasicPanel.js | 5 +- src/CalldataPanel.js | 2 +- src/CallstackPanel.js | 2 +- src/MemoryPanel.js | 2 +- src/StackPanel.js | 2 +- src/StoragePanel.js | 2 +- src/VmDebugger.js | 22 +-- test-browser/index.js | 1 - test-browser/init.js | 77 +++++++- test-browser/vmdebugger.js | 178 ++++++++++++++++++- test-browser/vmdebugger/loadTraceFound.js | 31 ---- test-browser/vmdebugger/loadTraceNotFound.js | 25 --- test-browser/vmdebugger/panels.js | 40 ----- test-browser/vmdebugger/slider.js | 37 ---- test-browser/vmdebugger/stepping.js | 43 ----- test-browser/vmdebugger/sticker.js | 39 ---- test/codeManager.js | 11 +- test/resources/contractInvokationCode.js | 1 - test/resources/contractInvokationTrace.js | 2 - test/resources/contractInvokationTx.js | 2 - test/traceManager.js | 7 +- 23 files changed, 356 insertions(+), 265 deletions(-) create mode 100644 ci/sauceDisconnect.js delete mode 100644 test-browser/index.js delete mode 100644 test-browser/vmdebugger/loadTraceFound.js delete mode 100644 test-browser/vmdebugger/loadTraceNotFound.js delete mode 100644 test-browser/vmdebugger/panels.js delete mode 100644 test-browser/vmdebugger/slider.js delete mode 100644 test-browser/vmdebugger/stepping.js delete mode 100644 test-browser/vmdebugger/sticker.js delete mode 100644 test/resources/contractInvokationCode.js delete mode 100644 test/resources/contractInvokationTrace.js delete mode 100644 test/resources/contractInvokationTx.js diff --git a/ci/browser_tests.sh b/ci/browser_tests.sh index d691149cc1..aa8dfce7a4 100644 --- a/ci/browser_tests.sh +++ b/ci/browser_tests.sh @@ -1,10 +1,12 @@ #!/bin/bash + SAUCECONNECT_URL="http://saucelabs.com/downloads/sc-4.3.16-linux.tar.gz" SAUCECONNECT_USERNAME="yann300" SAUCECONNECT_ACCESSKEY="e6f430f2-daa0-48bb-90fd-8bee20f429eb" SAUCECONNECT_JOBIDENTIFIER="remix_tests_${TRAVIS_JOB_NUMBER}" SAUCECONNECT_READYFILE="sc.ready" +TEST_EXITCODE=0 npm run build npm run serve & @@ -18,7 +20,17 @@ done npm run nightwatch_remote_firefox npm run nightwatch_remote_chrome -#npm run nightwatch_remote_safari -#npm run nightwatch_remote_ie +npm run nightwatch_remote_safari +npm run nightwatch_remote_ie + +if [ $? -eq 1 ] +then + TEST_EXITCODE=1 +fi + +node ci/sauceDisconnect.js $SAUCECONNECT_USERNAME $SAUCECONNECT_ACCESSKEY $SAUCECONNECT_JOBIDENTIFIER -curl "http://saucelabs.com/rest/v1/${SAUCECONNECT_USERNAME}/tunnels/${SAUCECONNECT_JOBIDENTIFIER}" -u "${SAUCECONNECT_USERNAME}:${SAUCECONNECT_ACCESSKEY}" -X DELETE +if [ $TEST_EXITCODE -eq 1 ] +then + exit 1 +fi diff --git a/ci/sauceDisconnect.js b/ci/sauceDisconnect.js new file mode 100644 index 0000000000..b29328db5c --- /dev/null +++ b/ci/sauceDisconnect.js @@ -0,0 +1,72 @@ +const https = require('https') + +var userName = process.argv[2] +var accessKey = process.argv[3] +var tunnelName = process.argv[4] + +function removeTunnel () { + const requestPath = `/rest/v1/${userName}/tunnels` + console.log(requestPath) + callSauce(requestPath, 'GET', function (error, result) { + if (error) { + console.log(error) + } else { + var data = JSON.parse(result) + for (var k in data) { + retrieveTunnel(data[k], function (error, result) { + if (error) { + console.log(error) + } else if (result.identtifier === tunnelName) { + deleteTunnel(result.id, function () { + console.log('tunnel deleted ' + data[k] + ' ' + tunnelName) + }) + } + }) + } + } + }) +} + +function retrieveTunnel (tunnelid, callback) { + const requestPath = `/rest/v1/${userName}/tunnels/${tunnelid}` + callSauce(requestPath, 'GET', function (error, result) { + if (error) { + callback(error) + } else { + callback(null, {'identtifier': JSON.parse(result).tunnel_identifier, 'id': tunnelid}) + } + }) +} + +function deleteTunnel (tunnelid, callback) { + const requestPath = `/rest/v1/${userName}/tunnels/${tunnelid}` + callSauce(requestPath, 'DELETE', callback) +} + +function callSauce (requestPath, type, callback) { + function responseCallback (res) { + res.setEncoding('utf8') + console.log('Response: ', res.statusCode, JSON.stringify(res.headers)) + res.on('data', function onData (chunk) { + console.log('BODY: ' + chunk) + callback(null, chunk) + }) + res.on('end', function onEnd () {}) + } + + var req = https.request({ + hostname: 'saucelabs.com', + path: requestPath, + method: type, + auth: userName + ':' + accessKey + }, responseCallback) + + req.on('error', function onError (e) { + console.log('problem with request: ' + e.message) + callback(e.message) + }) + req.write('') + req.end() +} + +removeTunnel() diff --git a/src/BasicPanel.js b/src/BasicPanel.js index b344caae85..e484cf5a8b 100644 --- a/src/BasicPanel.js +++ b/src/BasicPanel.js @@ -3,9 +3,10 @@ var style = require('./styles/basicStyles') var yo = require('yo-yo') var ui = require('./helpers/ui') -function BasicPanel (_name) { +function BasicPanel (_name, _id) { this.data this.name = _name + this.id = _id this.view } @@ -20,7 +21,7 @@ BasicPanel.prototype.render = function () { ${this.name}
-
${this.data}
+
${this.data}
` if (!this.view) { diff --git a/src/CalldataPanel.js b/src/CalldataPanel.js index 759add9b2d..37aa51cd43 100644 --- a/src/CalldataPanel.js +++ b/src/CalldataPanel.js @@ -5,7 +5,7 @@ var yo = require('yo-yo') function CalldataPanel (_parent, _traceManager) { this.parent = _parent this.traceManager = _traceManager - this.basicPanel = new BasicPanel('Call Data') + this.basicPanel = new BasicPanel('Call Data', 'calldatapanel') this.init() } diff --git a/src/CallstackPanel.js b/src/CallstackPanel.js index 039dce19e1..4271a92832 100644 --- a/src/CallstackPanel.js +++ b/src/CallstackPanel.js @@ -5,7 +5,7 @@ var yo = require('yo-yo') function CallstackPanel (_parent, _traceManager) { this.parent = _parent this.traceManager = _traceManager - this.basicPanel = new BasicPanel('Call Stack') + this.basicPanel = new BasicPanel('Call Stack', 'callstackpanel') this.init() } diff --git a/src/MemoryPanel.js b/src/MemoryPanel.js index 81e1a2ec2d..959f7b9665 100644 --- a/src/MemoryPanel.js +++ b/src/MemoryPanel.js @@ -6,7 +6,7 @@ var yo = require('yo-yo') function MemoryPanel (_parent, _traceManager) { this.parent = _parent this.traceManager = _traceManager - this.basicPanel = new BasicPanel('Memory') + this.basicPanel = new BasicPanel('Memory', 'memorypanel') this.init() } diff --git a/src/StackPanel.js b/src/StackPanel.js index aa2aaa6944..df72bc7354 100644 --- a/src/StackPanel.js +++ b/src/StackPanel.js @@ -6,7 +6,7 @@ var yo = require('yo-yo') function StackPanel (_parent, _traceManager) { this.parent = _parent this.traceManager = _traceManager - this.basicPanel = new BasicPanel('Stack') + this.basicPanel = new BasicPanel('Stack', 'stackpanel') this.init() } diff --git a/src/StoragePanel.js b/src/StoragePanel.js index 7b4f9e9add..b25f98b51b 100644 --- a/src/StoragePanel.js +++ b/src/StoragePanel.js @@ -5,7 +5,7 @@ var yo = require('yo-yo') function StoragePanel (_parent, _traceManager) { this.parent = _parent this.traceManager = _traceManager - this.basicPanel = new BasicPanel('Storage Changes') + this.basicPanel = new BasicPanel('Storage Changes', 'storagepanel') this.init() } diff --git a/src/VmDebugger.js b/src/VmDebugger.js index 52e1a047af..7fe57dcb03 100644 --- a/src/VmDebugger.js +++ b/src/VmDebugger.js @@ -15,7 +15,7 @@ function VmDebugger (_parent, _traceManager, _web3) { this.storagePanel = new StoragePanel(_parent, _traceManager) this.memoryPanel = new MemoryPanel(_parent, _traceManager) this.calldataPanel = new CalldataPanel(_parent, _traceManager) - this.CallstackPanel = new CallstackPanel(_parent, _traceManager) + this.callstackPanel = new CallstackPanel(_parent, _traceManager) this.view var self = this _parent.register('newTraceLoaded', this, function () { @@ -35,25 +35,15 @@ VmDebugger.prototype.render = function () { ${this.asmCode.render()} - - ${this.stackPanel.render()} - + ${this.stackPanel.render()} - - ${this.storagePanel.render()} - - - ${this.memoryPanel.render()} - + ${this.storagePanel.render()} + ${this.memoryPanel.render()} - - ${this.calldataPanel.render()} - - - ${this.CallstackPanel.render()} - + ${this.calldataPanel.render()} + ${this.callstackPanel.render()} diff --git a/test-browser/index.js b/test-browser/index.js deleted file mode 100644 index 721fc1c2cb..0000000000 --- a/test-browser/index.js +++ /dev/null @@ -1 +0,0 @@ -require('./vmdebugger') diff --git a/test-browser/init.js b/test-browser/init.js index 90a13ad28c..90b4964ebf 100644 --- a/test-browser/init.js +++ b/test-browser/init.js @@ -110,17 +110,86 @@ function extendBrowser (browser) { browser.assertCallStackValue = function (index, value) { return assertPanelValue('#callstackpanel', browser, index, value) } + + browser.debugerKeyCode = { + 'Enter': 13, + 'Up': 38, + 'Down': 40, + 'Right': '39', + 'Left': 37, + 'Esc': 27, + 'SpaceBar': 32, + 'Ctrl': 17, + 'Alt': 18, + 'Shift': 16 + } + +/* browser.sendKeys is not working for safari */ +/* still not working properly +browser.fireEvent = function (el, key, times, callback) { + var data = { + 'id': el.substring(1), + 'key': key, + 'times': times + } + browser.execute(function (data) { + data = JSON.parse(data) + var el = document.getElementById(data.id) + var eventObj + console.log(el) + console.log(data) + var k = 0 + if (document.createEventObject) { + eventObj = document.createEventObject() + eventObj.keyCode = data.key + while (k < data.times) { + console.log('firing brfore createEventObject') + el.fireEvent('onkeypress', eventObj) + console.log('firing') + k++ + } + } else if (typeof (KeyboardEvent) === 'function') { + eventObj = new KeyboardEvent('keyup') + eventObj.key = data.key + eventObj.which = data.key + while (k < data.times) { + console.log('firing brfore createEvent') + el.dispatchEvent(eventObj) + console.log('firing') + k++ + } + } + }, [JSON.stringify(data)], function () { + callback() + }) +} +*/ } function assertPanel (id, browser, value) { - browser.expect.element(id + ' #basicpanel').text.to.equal(value) + browser.expect.element(id + 'basicpanel').text.to.equal(value) return browser } -function assertPanelValue (id, browser, index, value, done) { - browser.getText(id + ' #basicpanel', function (result) { - var values = result.value.split('\n') +function assertPanelValue (id, browser, index, value) { + getInnerText(id + 'basicpanel', browser, function (result) { + var values + if (result.value.indexOf('\r\n') !== -1) { + values = result.value.split('\r\n') + } else if (result.value.indexOf('\n') !== -1) { + values = result.value.split('\n') + } else if (result.value.indexOf('\r') !== -1) { + values = result.value.split('\r') + } browser.assert.equal(values[index], value) }) return browser } + +function getInnerText (id, browser, callback) { + browser.execute(function (data) { + return document.getElementById(data).innerText + }, [id.substring(1)], function (result) { + callback(result) + }) +} diff --git a/test-browser/vmdebugger.js b/test-browser/vmdebugger.js index bc644491e4..0a6bfdee50 100644 --- a/test-browser/vmdebugger.js +++ b/test-browser/vmdebugger.js @@ -1,7 +1,173 @@ 'use strict' -require('./vmdebugger/loadTraceNotFound') -require('./vmdebugger/loadTraceFound') -require('./vmdebugger/stepping') -require('./vmdebugger/slider') -require('./vmdebugger/sticker') -require('./vmdebugger/panels') +var init = require('./init') +var sauce = require('./sauce') + +module.exports = { + beforeEach: function (browser, done) { + try { + init(browser, done) + } catch (e) { + var mes = 'error ' + e.message + console.log(mes) + done(mes) + } + }, + + 'vmdebugger': function (browser) { + loadTrace(browser) + browser.click('#unload') + loadTraceNotFound(browser) + browser.click('#unload') + panels(browser) + browser.click('#unload') + slider(browser) + browser.click('#unload') + stepping(browser) + browser.click('#unload') + sticker(browser) + browser.end() + }, + + tearDown: sauce +} + +function loadTrace (browser) { + browser + .clearValue('#txinput') + .setValue('#txinput', '0x20ef65b8b186ca942zcccd634f37074dde49b541c27994fc7596740ef44cfd51') + .click('#load') + .assert.containsText('#txhash', '') + return browser +} + +function loadTraceNotFound (browser) { + browser + .clearValue('#txinput') + .setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') + .click('#load') + .waitForElementVisible('#vmdebugger', 1000) + .expect.element('#txhash').text.to.equal('0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') + browser.expect.element('#txfrom').text.to.equal('0x00101c5bfa3fc8bad02c9f5fd65b069306251915') + browser.expect.element('#txto').text.to.equal('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5') + browser.expect.element('#txto').text.to.equal('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5') + browser.click('#unload') + .waitForElementNotVisible('#vmdebugger', 1000) + return browser +} + +function panels (browser) { + browser + .clearValue('#txinput') + .setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') + .click('#load') + .waitForElementVisible('#vmdebugger', 1000) + .click('#nextcall') + .assertStack('0x\n0x60\n0x65\n0x38\n0x55\n0x60fe47b1') + .assertStorageChanges('0x00 0x38') + .assertCallData('0x60fe47b10000000000000000000000000000000000000000000000000000000000000038') + .assertCallStack('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5') + .assertStackValue(1, '0x60') + .assertMemoryValue(6, '0xc0 60 60 60 40 52 60 40 51 60 20 80 60 45 83 39 81 ????R??Q????E?9?') + .assertMemoryValue(7, '0xe0 01 60 40 52 80 80 51 90 60 20 01 90 91 90 50 50 ???R??Q???????PP') + .assertMemoryValue(8, '0x100 5b 80 60 01 01 60 00 60 00 50 81 90 55 50 5b 50 ?????????P??UP?P') + .click('#intoforward') // CREATE + .assertStack('') + .assertStorageChanges('') + .assertMemory('') + .assertCallData('0x0000000000000000000000000000000000000000000000000000000000000000000000000000006060606040526040516020806045833981016040528080519060200190919050505b806001016000600050819055') + .assertCallStack('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5\n(Contract Creation - Step 63)') + return browser +} + +function slider (browser) { + browser + .clearValue('#txinput') + .setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') + .click('#load') + .waitForElementVisible('#vmdebugger', 1000) + .click('#intoforward') + .click('#intoforward') + .click('#intoforward') + .click('#intoforward') + .click('#intoforward') + .click('#intoforward') + .click('#intoforward') + .click('#intoforward') + .click('#intoforward') + /* + .sendKeys('#slider', browser.Keys.RIGHT_ARROW) + .sendKeys('#slider', browser.Keys.RIGHT_ARROW) + .sendKeys('#slider', browser.Keys.RIGHT_ARROW) + .sendKeys('#slider', browser.Keys.RIGHT_ARROW) + .sendKeys('#slider', browser.Keys.RIGHT_ARROW) + .sendKeys('#slider', browser.Keys.RIGHT_ARROW) + .sendKeys('#slider', browser.Keys.RIGHT_ARROW) + .sendKeys('#slider', browser.Keys.RIGHT_ARROW) + .sendKeys('#slider', browser.Keys.LEFT_ARROW) + */ + .assertCurrentSelectedItem('041 PUSH 60fe47b1') + return browser +} + +function stepping (browser) { + browser + .clearValue('#txinput') + .setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') + .click('#load') + .waitForElementVisible('#vmdebugger', 1000) + .click('#intoforward') + .click('#intoforward') + .assertCurrentSelectedItem('004 MSTORE') + .click('#intoforward') + .click('#intoback') + .click('#intoback') + .assertCurrentSelectedItem('002 PUSH 40') + .click('#nextcall') + .assertCurrentSelectedItem('181 CREATE') + .click('#intoforward') + .click('#intoforward') + .click('#intoforward') + .click('#intoforward') + .click('#overforward') + .assertCurrentSelectedItem('058 RETURN') + .click('#intoforward') + .click('#overback') + .assertCurrentSelectedItem('181 CREATE') + return browser +} + +function sticker (browser) { + browser + .clearValue('#txinput') + .setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') + .click('#load') + .waitForElementVisible('#vmdebugger', 1000) + .click('#intoforward') + .click('#intoforward') + .click('#intoforward') + .click('#intoforward') + .click('#intoforward') + .click('#intoforward') + /* + .fireEvent('#slider', browser.debugerKeyCode.Right, 4, function () { + browser.assertSticker('6', '6', '', '3', '84476', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5') + .click('#nextcall') + .assertSticker('63', '63', '', '32000', '79283', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5') + .click('#intoforward') + .click('#overforward') + .assertSticker('108', '44', '', '0', '27145', '(Contract Creation - Step 63)') + .click('#intoforward') + .assertSticker('109', '64', '', '3', '25145', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5') + .end() + }) + */ + .assertSticker('6', '6', '', '3', '84476', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5') + .click('#nextcall') + .assertSticker('63', '63', '', '32000', '79283', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5') + .click('#intoforward') + .click('#overforward') + .assertSticker('108', '44', '', '0', '27145', '(Contract Creation - Step 63)') + .click('#intoforward') + .assertSticker('109', '64', '', '3', '25145', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5') + return browser +} diff --git a/test-browser/vmdebugger/loadTraceFound.js b/test-browser/vmdebugger/loadTraceFound.js deleted file mode 100644 index 7025e60b4b..0000000000 --- a/test-browser/vmdebugger/loadTraceFound.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict' -var init = require('../init') -var sauce = require('../sauce') - -module.exports = { - beforeEach: function (browser, done) { - try { - init(browser, done) - } catch (e) { - var mes = 'error ' + e.message - console.log(mes) - done(mes) - } - }, - - 'Load Trace - found': function (browser) { - browser - .clearValue('#txinput') - .setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') - .click('#load') - .waitForElementVisible('#vmdebugger', 1000) - .expect.element('#txhash').text.to.equal('0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') - browser.expect.element('#txfrom').text.to.equal('0x00101c5bfa3fc8bad02c9f5fd65b069306251915') - browser.expect.element('#txto').text.to.equal('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5') - browser.expect.element('#txto').text.to.equal('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5') - browser.click('#unload') - .waitForElementNotVisible('#vmdebugger', 1000) - .end() - }, - tearDown: sauce -} diff --git a/test-browser/vmdebugger/loadTraceNotFound.js b/test-browser/vmdebugger/loadTraceNotFound.js deleted file mode 100644 index 450b52ff4b..0000000000 --- a/test-browser/vmdebugger/loadTraceNotFound.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict' -var init = require('../init') -var sauce = require('../sauce') - -module.exports = { - beforeEach: function (browser, done) { - try { - init(browser, done) - } catch (e) { - var mes = 'error ' + e.message - console.log(mes) - done(mes) - } - }, - - 'Load Trace - not found': function (browser) { - browser - .clearValue('#txinput') - .setValue('#txinput', '0x20ef65b8b186ca942zcccd634f37074dde49b541c27994fc7596740ef44cfd51') - .click('#load') - .assert.containsText('#txhash', '') - .end() - }, - tearDown: sauce -} diff --git a/test-browser/vmdebugger/panels.js b/test-browser/vmdebugger/panels.js deleted file mode 100644 index 76ad06b9bd..0000000000 --- a/test-browser/vmdebugger/panels.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict' -var init = require('../init') -var sauce = require('../sauce') - -module.exports = { - beforeEach: function (browser, done) { - try { - init(browser, done) - } catch (e) { - var mes = 'error ' + e.message - console.log(mes) - done(mes) - } - }, - - 'Panels': function (browser, done) { - browser - .clearValue('#txinput') - .setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') - .click('#load') - .waitForElementVisible('#vmdebugger', 1000) - .click('#nextcall') - .assertStack('0x\n0x60\n0x65\n0x38\n0x55\n0x60fe47b1') - .assertStackValue(1, '0x60') - .assertStorageChanges('0x00 0x38') - .assertMemoryValue(6, '0xc0 60 60 60 40 52 60 40 51 60 20 80 60 45 83 39 81 ????R??Q????E?9?') - .assertMemoryValue(7, '0xe0 01 60 40 52 80 80 51 90 60 20 01 90 91 90 50 50 ???R??Q???????PP') - .assertMemoryValue(8, '0x100 5b 80 60 01 01 60 00 60 00 50 81 90 55 50 5b 50 ?????????P??UP?P') - .assertCallData('0x60fe47b10000000000000000000000000000000000000000000000000000000000000038') - .assertCallStack('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5') - .click('#intoforward') // CREATE - .assertStack('') - .assertStorageChanges('') - .assertMemory('') - .assertCallData('0x0000000000000000000000000000000000000000000000000000000000000000000000000000006060606040526040516020806045833981016040528080519060200190919050505b806001016000600050819055') - .assertCallStack('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5\n(Contract Creation - Step 63)') - .end() - }, - tearDown: sauce -} diff --git a/test-browser/vmdebugger/slider.js b/test-browser/vmdebugger/slider.js deleted file mode 100644 index d092c158bc..0000000000 --- a/test-browser/vmdebugger/slider.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict' -var init = require('../init') -var sauce = require('../sauce') - -module.exports = { - beforeEach: function (browser, done) { - try { - init(browser, done) - } catch (e) { - var mes = 'error ' + e.message - console.log(mes) - done(mes) - } - }, - - 'Slider': function (browser) { - browser - .clearValue('#txinput') - .setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') - .click('#load') - .waitForElementVisible('#vmdebugger', 1000) - .click('#intoforward') - .click('#intoforward') - .sendKeys('#slider', browser.Keys.RIGHT_ARROW) - .sendKeys('#slider', browser.Keys.RIGHT_ARROW) - .sendKeys('#slider', browser.Keys.RIGHT_ARROW) - .sendKeys('#slider', browser.Keys.RIGHT_ARROW) - .sendKeys('#slider', browser.Keys.RIGHT_ARROW) - .sendKeys('#slider', browser.Keys.RIGHT_ARROW) - .sendKeys('#slider', browser.Keys.RIGHT_ARROW) - .sendKeys('#slider', browser.Keys.RIGHT_ARROW) - .sendKeys('#slider', browser.Keys.LEFT_ARROW) - .assertCurrentSelectedItem('041 PUSH 60fe47b1') - .end() - }, - tearDown: sauce -} diff --git a/test-browser/vmdebugger/stepping.js b/test-browser/vmdebugger/stepping.js deleted file mode 100644 index a2bb7f151f..0000000000 --- a/test-browser/vmdebugger/stepping.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict' -var init = require('../init') -var sauce = require('../sauce') - -module.exports = { - beforeEach: function (browser, done) { - try { - init(browser, done) - } catch (e) { - var mes = 'error ' + e.message - console.log(mes) - done(mes) - } - }, - - 'Stepping': function (browser) { - browser - .clearValue('#txinput') - .setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') - .click('#load') - .waitForElementVisible('#vmdebugger', 1000) - .click('#intoforward') - .click('#intoforward') - .assertCurrentSelectedItem('004 MSTORE') - .click('#intoforward') - .click('#intoback') - .click('#intoback') - .assertCurrentSelectedItem('002 PUSH 40') - .click('#nextcall') - .assertCurrentSelectedItem('181 CREATE') - .click('#intoforward') - .click('#intoforward') - .click('#intoforward') - .click('#intoforward') - .click('#overforward') - .assertCurrentSelectedItem('058 RETURN') - .click('#intoforward') - .click('#overback') - .assertCurrentSelectedItem('181 CREATE') - .end() - }, - tearDown: sauce -} diff --git a/test-browser/vmdebugger/sticker.js b/test-browser/vmdebugger/sticker.js deleted file mode 100644 index f9af9816be..0000000000 --- a/test-browser/vmdebugger/sticker.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict' -var init = require('../init') -var sauce = require('../sauce') - -module.exports = { - beforeEach: function (browser, done) { - try { - init(browser, done) - } catch (e) { - var mes = 'error ' + e.message - console.log(mes) - done(mes) - } - }, - - 'Sticker': function (browser) { - browser - .clearValue('#txinput') - .setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') - .click('#load') - .waitForElementVisible('#vmdebugger', 1000) - .click('#intoforward') - .click('#intoforward') - .sendKeys('#slider', browser.Keys.RIGHT_ARROW) - .sendKeys('#slider', browser.Keys.RIGHT_ARROW) - .sendKeys('#slider', browser.Keys.RIGHT_ARROW) - .sendKeys('#slider', browser.Keys.RIGHT_ARROW) - .assertSticker('6', '6', '', '3', '84476', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5') - .click('#nextcall') - .assertSticker('63', '63', '', '32000', '79283', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5') - .click('#intoforward') - .click('#overforward') - .assertSticker('108', '44', '', '0', '27145', '(Contract Creation - Step 63)') - .click('#intoforward') - .assertSticker('109', '64', '', '3', '25145', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5') - .end() - }, - tearDown: sauce -} diff --git a/test/codeManager.js b/test/codeManager.js index 1a4bb75a9e..bcb7653496 100644 --- a/test/codeManager.js +++ b/test/codeManager.js @@ -1,8 +1,6 @@ 'use strict' var tape = require('tape') var init = require('../src/helpers/init') -var txInvokation = require('./resources/contractInvokationTx') -var contractCode = require('./resources/contractInvokationCode') var TraceManager = require('../src/trace/traceManager') var CodeManager = require('../src/code/codeManager') var web3Test = require('./resources/testWeb3') @@ -14,8 +12,10 @@ tape('CodeManager', function (t) { initWeb3.overrideWeb3(web3, web3Test) var traceManager = new TraceManager(web3) codeManager = new CodeManager(web3, traceManager) + var contractCode = web3.eth.getCode('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5') codeManager.codeResolver.cacheExecutingCode('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5', contractCode) // so a call to web3 is not necessary - traceManager.resolveTrace(txInvokation, function (error, result) { + var tx = web3.eth.getTransaction('0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') + traceManager.resolveTrace(tx, function (error, result) { if (error) { t.fail(' - traceManager.resolveTrace - failed ' + result) } else { @@ -54,8 +54,9 @@ function continueTesting (t, codeManager) { } } }) - codeManager.resolveStep(0, txInvokation) - codeManager.resolveStep(70, txInvokation) + var tx = codeManager.web3.eth.getTransaction('0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') + codeManager.resolveStep(0, tx) + codeManager.resolveStep(70, tx) }) t.test('CodeManager.getInstructionIndex', function (st) { diff --git a/test/resources/contractInvokationCode.js b/test/resources/contractInvokationCode.js deleted file mode 100644 index 6ad8e71169..0000000000 --- a/test/resources/contractInvokationCode.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = '0x60606040526000357c01000000000000000000000000000000000000000000000000000000009004806360fe47b11460415780636d4ce63c14605757603f565b005b605560048080359060200190919050506089565b005b606260048050506078565b6040518082815260200191505060405180910390f35b600060006000505490506086565b90565b80600060005081905550602d6040516045806100f083390180828152602001915050604051809103906000f0600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff02191690830217905550602281016000600050819055505b505660606040526040516020806045833981016040528080519060200190919050505b806001016000600050819055505b50600a80603b6000396000f360606040526008565b00' \ No newline at end of file diff --git a/test/resources/contractInvokationTrace.js b/test/resources/contractInvokationTrace.js deleted file mode 100644 index b10a9e4214..0000000000 --- a/test/resources/contractInvokationTrace.js +++ /dev/null @@ -1,2 +0,0 @@ -module.exports = -{'gas':'0x0000000000000000000000000000000000000000000000000000000000019def','return':'0x','structLogs':[{'calldata':'0x60fe47b10000000000000000000000000000000000000000000000000000000000000038','gas':'84503','gasCost':'3','memory':[],'op':'PUSH1','pc':'0','stack':[],'steps':0,'storage':{'0x00':'0x2d'}},{'gas':'84500','gasCost':'3','op':'PUSH1','pc':'2','stack':['0x60'],'steps':1,'storage':{'0x00':'0x2d'}},{'gas':'84497','gasCost':'12','memexpand':'3','op':'MSTORE','pc':'4','stack':['0x60','0x40'],'steps':2,'storage':{'0x00':'0x2d'}},{'gas':'84485','gasCost':'3','memory':['0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000060'],'op':'PUSH1','pc':'5','stack':[],'steps':3,'storage':{'0x00':'0x2d'}},{'gas':'84482','gasCost':'3','op':'CALLDATALOAD','pc':'7','stack':['0x00'],'steps':4,'storage':{'0x00':'0x2d'}},{'gas':'84479','gasCost':'3','op':'PUSH29','pc':'8','stack':['0x60fe47b100000000000000000000000000000000000000000000000000000000'],'steps':5,'storage':{'0x00':'0x2d'}},{'gas':'84476','gasCost':'3','op':'SWAP1','pc':'38','stack':['0x60fe47b100000000000000000000000000000000000000000000000000000000','0x0100000000000000000000000000000000000000000000000000000000'],'steps':6,'storage':{'0x00':'0x2d'}},{'gas':'84473','gasCost':'5','op':'DIV','pc':'39','stack':['0x0100000000000000000000000000000000000000000000000000000000','0x60fe47b100000000000000000000000000000000000000000000000000000000'],'steps':7,'storage':{'0x00':'0x2d'}},{'gas':'84468','gasCost':'3','op':'DUP1','pc':'40','stack':['0x60fe47b1'],'steps':8,'storage':{'0x00':'0x2d'}},{'gas':'84465','gasCost':'3','op':'PUSH4','pc':'41','stack':['0x60fe47b1','0x60fe47b1'],'steps':9,'storage':{'0x00':'0x2d'}},{'gas':'84462','gasCost':'3','op':'EQ','pc':'46','stack':['0x60fe47b1','0x60fe47b1','0x60fe47b1'],'steps':10,'storage':{'0x00':'0x2d'}},{'gas':'84459','gasCost':'3','op':'PUSH1','pc':'47','stack':['0x60fe47b1','0x01'],'steps':11,'storage':{'0x00':'0x2d'}},{'gas':'84456','gasCost':'10','op':'JUMPI','pc':'49','stack':['0x60fe47b1','0x01','0x41'],'steps':12,'storage':{'0x00':'0x2d'}},{'gas':'84446','gasCost':'1','op':'JUMPDEST','pc':'65','stack':['0x60fe47b1'],'steps':13,'storage':{'0x00':'0x2d'}},{'gas':'84445','gasCost':'3','op':'PUSH1','pc':'66','stack':['0x60fe47b1'],'steps':14,'storage':{'0x00':'0x2d'}},{'gas':'84442','gasCost':'3','op':'PUSH1','pc':'68','stack':['0x60fe47b1','0x55'],'steps':15,'storage':{'0x00':'0x2d'}},{'gas':'84439','gasCost':'3','op':'DUP1','pc':'70','stack':['0x60fe47b1','0x55','0x04'],'steps':16,'storage':{'0x00':'0x2d'}},{'gas':'84436','gasCost':'3','op':'DUP1','pc':'71','stack':['0x60fe47b1','0x55','0x04','0x04'],'steps':17,'storage':{'0x00':'0x2d'}},{'gas':'84433','gasCost':'3','op':'CALLDATALOAD','pc':'72','stack':['0x60fe47b1','0x55','0x04','0x04','0x04'],'steps':18,'storage':{'0x00':'0x2d'}},{'gas':'84430','gasCost':'3','op':'SWAP1','pc':'73','stack':['0x60fe47b1','0x55','0x04','0x04','0x38'],'steps':19,'storage':{'0x00':'0x2d'}},{'gas':'84427','gasCost':'3','op':'PUSH1','pc':'74','stack':['0x60fe47b1','0x55','0x04','0x38','0x04'],'steps':20,'storage':{'0x00':'0x2d'}},{'gas':'84424','gasCost':'3','op':'ADD','pc':'76','stack':['0x60fe47b1','0x55','0x04','0x38','0x04','0x20'],'steps':21,'storage':{'0x00':'0x2d'}},{'gas':'84421','gasCost':'3','op':'SWAP1','pc':'77','stack':['0x60fe47b1','0x55','0x04','0x38','0x24'],'steps':22,'storage':{'0x00':'0x2d'}},{'gas':'84418','gasCost':'3','op':'SWAP2','pc':'78','stack':['0x60fe47b1','0x55','0x04','0x24','0x38'],'steps':23,'storage':{'0x00':'0x2d'}},{'gas':'84415','gasCost':'3','op':'SWAP1','pc':'79','stack':['0x60fe47b1','0x55','0x38','0x24','0x04'],'steps':24,'storage':{'0x00':'0x2d'}},{'gas':'84412','gasCost':'2','op':'POP','pc':'80','stack':['0x60fe47b1','0x55','0x38','0x04','0x24'],'steps':25,'storage':{'0x00':'0x2d'}},{'gas':'84410','gasCost':'2','op':'POP','pc':'81','stack':['0x60fe47b1','0x55','0x38','0x04'],'steps':26,'storage':{'0x00':'0x2d'}},{'gas':'84408','gasCost':'3','op':'PUSH1','pc':'82','stack':['0x60fe47b1','0x55','0x38'],'steps':27,'storage':{'0x00':'0x2d'}},{'gas':'84405','gasCost':'8','op':'JUMP','pc':'84','stack':['0x60fe47b1','0x55','0x38','0x89'],'steps':28,'storage':{'0x00':'0x2d'}},{'gas':'84397','gasCost':'1','op':'JUMPDEST','pc':'137','stack':['0x60fe47b1','0x55','0x38'],'steps':29,'storage':{'0x00':'0x2d'}},{'gas':'84396','gasCost':'3','op':'DUP1','pc':'138','stack':['0x60fe47b1','0x55','0x38'],'steps':30,'storage':{'0x00':'0x2d'}},{'gas':'84393','gasCost':'3','op':'PUSH1','pc':'139','stack':['0x60fe47b1','0x55','0x38','0x38'],'steps':31,'storage':{'0x00':'0x2d'}},{'gas':'84390','gasCost':'3','op':'PUSH1','pc':'141','stack':['0x60fe47b1','0x55','0x38','0x38','0x00'],'steps':32,'storage':{'0x00':'0x2d'}},{'gas':'84387','gasCost':'2','op':'POP','pc':'143','stack':['0x60fe47b1','0x55','0x38','0x38','0x00','0x00'],'steps':33,'storage':{'0x00':'0x2d'}},{'gas':'84385','gasCost':'3','op':'DUP2','pc':'144','stack':['0x60fe47b1','0x55','0x38','0x38','0x00'],'steps':34,'storage':{'0x00':'0x2d'}},{'gas':'84382','gasCost':'3','op':'SWAP1','pc':'145','stack':['0x60fe47b1','0x55','0x38','0x38','0x00','0x38'],'steps':35,'storage':{'0x00':'0x2d'}},{'gas':'84379','gasCost':'5000','op':'SSTORE','pc':'146','stack':['0x60fe47b1','0x55','0x38','0x38','0x38','0x00'],'steps':36,'storage':{'0x00':'0x2d'}},{'gas':'79379','gasCost':'2','op':'POP','pc':'147','stack':['0x60fe47b1','0x55','0x38','0x38'],'steps':37,'storage':{'0x00':'0x38'}},{'gas':'79377','gasCost':'3','op':'PUSH1','pc':'148','stack':['0x60fe47b1','0x55','0x38'],'steps':38,'storage':{'0x00':'0x38'}},{'gas':'79374','gasCost':'3','op':'PUSH1','pc':'150','stack':['0x60fe47b1','0x55','0x38','0x2d'],'steps':39,'storage':{'0x00':'0x38'}},{'gas':'79371','gasCost':'3','op':'MLOAD','pc':'152','stack':['0x60fe47b1','0x55','0x38','0x2d','0x40'],'steps':40,'storage':{'0x00':'0x38'}},{'gas':'79368','gasCost':'3','memory':['0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000060'],'op':'PUSH1','pc':'153','stack':['0x60fe47b1','0x55','0x38','0x2d','0x60'],'steps':41,'storage':{'0x00':'0x38'}},{'gas':'79365','gasCost':'3','op':'DUP1','pc':'155','stack':['0x60fe47b1','0x55','0x38','0x2d','0x60','0x45'],'steps':42,'storage':{'0x00':'0x38'}},{'gas':'79362','gasCost':'3','op':'PUSH2','pc':'156','stack':['0x60fe47b1','0x55','0x38','0x2d','0x60','0x45','0x45'],'steps':43,'storage':{'0x00':'0x38'}},{'gas':'79359','gasCost':'3','op':'DUP4','pc':'159','stack':['0x60fe47b1','0x55','0x38','0x2d','0x60','0x45','0x45','0xf0'],'steps':44,'storage':{'0x00':'0x38'}},{'gas':'79356','gasCost':'21','memexpand':'3','op':'CODECOPY','pc':'160','stack':['0x60fe47b1','0x55','0x38','0x2d','0x60','0x45','0x45','0xf0','0x60'],'steps':45,'storage':{'0x00':'0x38'}},{'gas':'79335','gasCost':'3','memory':['0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000060','6060604052604051602080604583398101604052808051906020019091905050','5b806001016000600050819055505b50600a80603b6000396000f36060604052','6008565b00000000000000000000000000000000000000000000000000000000'],'op':'ADD','pc':'161','stack':['0x60fe47b1','0x55','0x38','0x2d','0x60','0x45'],'steps':46,'storage':{'0x00':'0x38'}},{'gas':'79332','gasCost':'3','op':'DUP1','pc':'162','stack':['0x60fe47b1','0x55','0x38','0x2d','0xa5'],'steps':47,'storage':{'0x00':'0x38'}},{'gas':'79329','gasCost':'3','op':'DUP3','pc':'163','stack':['0x60fe47b1','0x55','0x38','0x2d','0xa5','0xa5'],'steps':48,'storage':{'0x00':'0x38'}},{'gas':'79326','gasCost':'3','op':'DUP2','pc':'164','stack':['0x60fe47b1','0x55','0x38','0x2d','0xa5','0xa5','0x2d'],'steps':49,'storage':{'0x00':'0x38'}},{'gas':'79323','gasCost':'6','memexpand':'1','op':'MSTORE','pc':'165','stack':['0x60fe47b1','0x55','0x38','0x2d','0xa5','0xa5','0x2d','0xa5'],'steps':50,'storage':{'0x00':'0x38'}},{'gas':'79317','gasCost':'3','memory':['0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000060','6060604052604051602080604583398101604052808051906020019091905050','5b806001016000600050819055505b50600a80603b6000396000f36060604052','6008565b00000000000000000000000000000000000000000000000000000000','000000002d000000000000000000000000000000000000000000000000000000'],'op':'PUSH1','pc':'166','stack':['0x60fe47b1','0x55','0x38','0x2d','0xa5','0xa5'],'steps':51,'storage':{'0x00':'0x38'}},{'gas':'79314','gasCost':'3','op':'ADD','pc':'168','stack':['0x60fe47b1','0x55','0x38','0x2d','0xa5','0xa5','0x20'],'steps':52,'storage':{'0x00':'0x38'}},{'gas':'79311','gasCost':'3','op':'SWAP2','pc':'169','stack':['0x60fe47b1','0x55','0x38','0x2d','0xa5','0xc5'],'steps':53,'storage':{'0x00':'0x38'}},{'gas':'79308','gasCost':'2','op':'POP','pc':'170','stack':['0x60fe47b1','0x55','0x38','0xc5','0xa5','0x2d'],'steps':54,'storage':{'0x00':'0x38'}},{'gas':'79306','gasCost':'2','op':'POP','pc':'171','stack':['0x60fe47b1','0x55','0x38','0xc5','0xa5'],'steps':55,'storage':{'0x00':'0x38'}},{'gas':'79304','gasCost':'3','op':'PUSH1','pc':'172','stack':['0x60fe47b1','0x55','0x38','0xc5'],'steps':56,'storage':{'0x00':'0x38'}},{'gas':'79301','gasCost':'3','op':'MLOAD','pc':'174','stack':['0x60fe47b1','0x55','0x38','0xc5','0x40'],'steps':57,'storage':{'0x00':'0x38'}},{'gas':'79298','gasCost':'3','memory':['0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000060','6060604052604051602080604583398101604052808051906020019091905050','5b806001016000600050819055505b50600a80603b6000396000f36060604052','6008565b00000000000000000000000000000000000000000000000000000000','000000002d000000000000000000000000000000000000000000000000000000'],'op':'DUP1','pc':'175','stack':['0x60fe47b1','0x55','0x38','0xc5','0x60'],'steps':58,'storage':{'0x00':'0x38'}},{'gas':'79295','gasCost':'3','op':'SWAP2','pc':'176','stack':['0x60fe47b1','0x55','0x38','0xc5','0x60','0x60'],'steps':59,'storage':{'0x00':'0x38'}},{'gas':'79292','gasCost':'3','op':'SUB','pc':'177','stack':['0x60fe47b1','0x55','0x38','0x60','0x60','0xc5'],'steps':60,'storage':{'0x00':'0x38'}},{'gas':'79289','gasCost':'3','op':'SWAP1','pc':'178','stack':['0x60fe47b1','0x55','0x38','0x60','0x65'],'steps':61,'storage':{'0x00':'0x38'}},{'gas':'79286','gasCost':'3','op':'PUSH1','pc':'179','stack':['0x60fe47b1','0x55','0x38','0x65','0x60'],'steps':62,'storage':{'0x00':'0x38'}},{'gas':'79283','gasCost':'32000','op':'CREATE','pc':'181','stack':['0x60fe47b1','0x55','0x38','0x65','0x60','0x00'],'steps':63,'storage':{'0x00':'0x38'}},{'calldata':'0x','gas':'47283','gasCost':'3','memory':[],'op':'PUSH1','pc':'0','stack':[],'steps':0,'storage':{}},{'gas':'47280','gasCost':'3','op':'PUSH1','pc':'2','stack':['0x60'],'steps':1,'storage':{}},{'gas':'47277','gasCost':'12','memexpand':'3','op':'MSTORE','pc':'4','stack':['0x60','0x40'],'steps':2,'storage':{}},{'gas':'47265','gasCost':'3','memory':['0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000060'],'op':'PUSH1','pc':'5','stack':[],'steps':3,'storage':{}},{'gas':'47262','gasCost':'3','op':'MLOAD','pc':'7','stack':['0x40'],'steps':4,'storage':{}},{'gas':'47259','gasCost':'3','memory':['0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000060'],'op':'PUSH1','pc':'8','stack':['0x60'],'steps':5,'storage':{}},{'gas':'47256','gasCost':'3','op':'DUP1','pc':'10','stack':['0x60','0x20'],'steps':6,'storage':{}},{'gas':'47253','gasCost':'3','op':'PUSH1','pc':'11','stack':['0x60','0x20','0x20'],'steps':7,'storage':{}},{'gas':'47250','gasCost':'3','op':'DUP4','pc':'13','stack':['0x60','0x20','0x20','0x45'],'steps':8,'storage':{}},{'gas':'47247','gasCost':'9','memexpand':'1','op':'CODECOPY','pc':'14','stack':['0x60','0x20','0x20','0x45','0x60'],'steps':9,'storage':{}},{'gas':'47238','gasCost':'3','memory':['0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000060','000000000000000000000000000000000000000000000000000000000000002d'],'op':'DUP2','pc':'15','stack':['0x60','0x20'],'steps':10,'storage':{}},{'gas':'47235','gasCost':'3','op':'ADD','pc':'16','stack':['0x60','0x20','0x60'],'steps':11,'storage':{}},{'gas':'47232','gasCost':'3','op':'PUSH1','pc':'17','stack':['0x60','0x80'],'steps':12,'storage':{}},{'gas':'47229','gasCost':'3','op':'MSTORE','pc':'19','stack':['0x60','0x80','0x40'],'steps':13,'storage':{}},{'gas':'47226','gasCost':'3','memory':['0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000080','000000000000000000000000000000000000000000000000000000000000002d'],'op':'DUP1','pc':'20','stack':['0x60'],'steps':14,'storage':{}},{'gas':'47223','gasCost':'3','op':'DUP1','pc':'21','stack':['0x60','0x60'],'steps':15,'storage':{}},{'gas':'47220','gasCost':'3','op':'MLOAD','pc':'22','stack':['0x60','0x60','0x60'],'steps':16,'storage':{}},{'gas':'47217','gasCost':'3','memory':['0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000080','000000000000000000000000000000000000000000000000000000000000002d'],'op':'SWAP1','pc':'23','stack':['0x60','0x60','0x2d'],'steps':17,'storage':{}},{'gas':'47214','gasCost':'3','op':'PUSH1','pc':'24','stack':['0x60','0x2d','0x60'],'steps':18,'storage':{}},{'gas':'47211','gasCost':'3','op':'ADD','pc':'26','stack':['0x60','0x2d','0x60','0x20'],'steps':19,'storage':{}},{'gas':'47208','gasCost':'3','op':'SWAP1','pc':'27','stack':['0x60','0x2d','0x80'],'steps':20,'storage':{}},{'gas':'47205','gasCost':'3','op':'SWAP2','pc':'28','stack':['0x60','0x80','0x2d'],'steps':21,'storage':{}},{'gas':'47202','gasCost':'3','op':'SWAP1','pc':'29','stack':['0x2d','0x80','0x60'],'steps':22,'storage':{}},{'gas':'47199','gasCost':'2','op':'POP','pc':'30','stack':['0x2d','0x60','0x80'],'steps':23,'storage':{}},{'gas':'47197','gasCost':'2','op':'POP','pc':'31','stack':['0x2d','0x60'],'steps':24,'storage':{}},{'gas':'47195','gasCost':'1','op':'JUMPDEST','pc':'32','stack':['0x2d'],'steps':25,'storage':{}},{'gas':'47194','gasCost':'3','op':'DUP1','pc':'33','stack':['0x2d'],'steps':26,'storage':{}},{'gas':'47191','gasCost':'3','op':'PUSH1','pc':'34','stack':['0x2d','0x2d'],'steps':27,'storage':{}},{'gas':'47188','gasCost':'3','op':'ADD','pc':'36','stack':['0x2d','0x2d','0x01'],'steps':28,'storage':{}},{'gas':'47185','gasCost':'3','op':'PUSH1','pc':'37','stack':['0x2d','0x2e'],'steps':29,'storage':{}},{'gas':'47182','gasCost':'3','op':'PUSH1','pc':'39','stack':['0x2d','0x2e','0x00'],'steps':30,'storage':{}},{'gas':'47179','gasCost':'2','op':'POP','pc':'41','stack':['0x2d','0x2e','0x00','0x00'],'steps':31,'storage':{}},{'gas':'47177','gasCost':'3','op':'DUP2','pc':'42','stack':['0x2d','0x2e','0x00'],'steps':32,'storage':{}},{'gas':'47174','gasCost':'3','op':'SWAP1','pc':'43','stack':['0x2d','0x2e','0x00','0x2e'],'steps':33,'storage':{}},{'gas':'47171','gasCost':'20000','op':'SSTORE','pc':'44','stack':['0x2d','0x2e','0x2e','0x00'],'steps':34,'storage':{}},{'gas':'27171','gasCost':'2','op':'POP','pc':'45','stack':['0x2d','0x2e'],'steps':35,'storage':{'0x00':'0x2e'}},{'gas':'27169','gasCost':'1','op':'JUMPDEST','pc':'46','stack':['0x2d'],'steps':36,'storage':{'0x00':'0x2e'}},{'gas':'27168','gasCost':'2','op':'POP','pc':'47','stack':['0x2d'],'steps':37,'storage':{'0x00':'0x2e'}},{'gas':'27166','gasCost':'3','op':'PUSH1','pc':'48','stack':[],'steps':38,'storage':{'0x00':'0x2e'}},{'gas':'27163','gasCost':'3','op':'DUP1','pc':'50','stack':['0x0a'],'steps':39,'storage':{'0x00':'0x2e'}},{'gas':'27160','gasCost':'3','op':'PUSH1','pc':'51','stack':['0x0a','0x0a'],'steps':40,'storage':{'0x00':'0x2e'}},{'gas':'27157','gasCost':'3','op':'PUSH1','pc':'53','stack':['0x0a','0x0a','0x3b'],'steps':41,'storage':{'0x00':'0x2e'}},{'gas':'27154','gasCost':'6','op':'CODECOPY','pc':'55','stack':['0x0a','0x0a','0x3b','0x00'],'steps':42,'storage':{'0x00':'0x2e'}},{'gas':'27148','gasCost':'3','memory':['60606040526008565b0000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000080','000000000000000000000000000000000000000000000000000000000000002d'],'op':'PUSH1','pc':'56','stack':['0x0a'],'steps':43,'storage':{'0x00':'0x2e'}},{'gas':'27145','gasCost':'0','op':'RETURN','pc':'58','stack':['0x0a','0x00'],'steps':44,'storage':{'0x00':'0x2e'}},{'calldata':'0x60fe47b10000000000000000000000000000000000000000000000000000000000000038','gas':'25145','gasCost':'3','memory':['0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000060','6060604052604051602080604583398101604052808051906020019091905050','5b806001016000600050819055505b50600a80603b6000396000f36060604052','6008565b00000000000000000000000000000000000000000000000000000000','000000002d000000000000000000000000000000000000000000000000000000'],'op':'PUSH1','pc':'182','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'],'steps':64,'storage':{'0x00':'0x38'}},{'gas':'25142','gasCost':'3','memory':['0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000000','0000000000000000000000000000000000000000000000000000000000000060','6060604052604051602080604583398101604052808051906020019091905050','5b806001016000600050819055505b50600a80603b6000396000f36060604052','6008565b00000000000000000000000000000000000000000000000000000000','000000002d000000000000000000000000000000000000000000000000000000'],'op':'PUSH1','pc':'184','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95','0x01'],'steps':65,'storage':{'0x00':'0x38'}},{'gas':'25139','gasCost':'3','op':'PUSH2','pc':'186','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95','0x01','0x00'],'steps':66,'storage':{'0x00':'0x38'}},{'gas':'25136','gasCost':'10','op':'EXP','pc':'189','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95','0x01','0x00','0x0100'],'steps':67,'storage':{'0x00':'0x38'}},{'gas':'25126','gasCost':'3','op':'DUP2','pc':'190','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95','0x01','0x01'],'steps':68,'storage':{'0x00':'0x38'}},{'gas':'25123','gasCost':'50','op':'SLOAD','pc':'191','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95','0x01','0x01','0x01'],'steps':69,'storage':{'0x00':'0x38'}},{'gas':'25073','gasCost':'3','op':'DUP2','pc':'192','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95','0x01','0x01','0x00'],'steps':70,'storage':{'0x00':'0x38'}},{'gas':'25070','gasCost':'3','op':'PUSH20','pc':'193','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95','0x01','0x01','0x00','0x01'],'steps':71,'storage':{'0x00':'0x38'}},{'gas':'25067','gasCost':'5','op':'MUL','pc':'214','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95','0x01','0x01','0x00','0x01','0xffffffffffffffffffffffffffffffffffffffff'],'steps':72,'storage':{'0x00':'0x38'}},{'gas':'25062','gasCost':'3','op':'NOT','pc':'215','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95','0x01','0x01','0x00','0xffffffffffffffffffffffffffffffffffffffff'],'steps':73,'storage':{'0x00':'0x38'}},{'gas':'25059','gasCost':'3','op':'AND','pc':'216','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95','0x01','0x01','0x00','0xffffffffffffffffffffffff0000000000000000000000000000000000000000'],'steps':74,'storage':{'0x00':'0x38'}},{'gas':'25056','gasCost':'3','op':'SWAP1','pc':'217','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95','0x01','0x01','0x00'],'steps':75,'storage':{'0x00':'0x38'}},{'gas':'25053','gasCost':'3','op':'DUP4','pc':'218','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95','0x01','0x00','0x01'],'steps':76,'storage':{'0x00':'0x38'}},{'gas':'25050','gasCost':'5','op':'MUL','pc':'219','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95','0x01','0x00','0x01','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'],'steps':77,'storage':{'0x00':'0x38'}},{'gas':'25045','gasCost':'3','op':'OR','pc':'220','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95','0x01','0x00','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'],'steps':78,'storage':{'0x00':'0x38'}},{'gas':'25042','gasCost':'3','op':'SWAP1','pc':'221','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95','0x01','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'],'steps':79,'storage':{'0x00':'0x38'}},{'gas':'25039','gasCost':'20000','op':'SSTORE','pc':'222','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95','0x01'],'steps':80,'storage':{'0x00':'0x38'}},{'gas':'5039','gasCost':'2','op':'POP','pc':'223','stack':['0x60fe47b1','0x55','0x38','0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'],'steps':81,'storage':{'0x00':'0x38','0x01':'0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'}},{'gas':'5037','gasCost':'3','op':'PUSH1','pc':'224','stack':['0x60fe47b1','0x55','0x38'],'steps':82,'storage':{'0x00':'0x38','0x01':'0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'}},{'gas':'5034','gasCost':'3','op':'DUP2','pc':'226','stack':['0x60fe47b1','0x55','0x38','0x22'],'steps':83,'storage':{'0x00':'0x38','0x01':'0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'}},{'gas':'5031','gasCost':'3','op':'ADD','pc':'227','stack':['0x60fe47b1','0x55','0x38','0x22','0x38'],'steps':84,'storage':{'0x00':'0x38','0x01':'0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'}},{'gas':'5028','gasCost':'3','op':'PUSH1','pc':'228','stack':['0x60fe47b1','0x55','0x38','0x5a'],'steps':85,'storage':{'0x00':'0x38','0x01':'0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'}},{'gas':'5025','gasCost':'3','op':'PUSH1','pc':'230','stack':['0x60fe47b1','0x55','0x38','0x5a','0x00'],'steps':86,'storage':{'0x00':'0x38','0x01':'0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'}},{'gas':'5022','gasCost':'2','op':'POP','pc':'232','stack':['0x60fe47b1','0x55','0x38','0x5a','0x00','0x00'],'steps':87,'storage':{'0x00':'0x38','0x01':'0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'}},{'gas':'5020','gasCost':'3','op':'DUP2','pc':'233','stack':['0x60fe47b1','0x55','0x38','0x5a','0x00'],'steps':88,'storage':{'0x00':'0x38','0x01':'0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'}},{'gas':'5017','gasCost':'3','op':'SWAP1','pc':'234','stack':['0x60fe47b1','0x55','0x38','0x5a','0x00','0x5a'],'steps':89,'storage':{'0x00':'0x38','0x01':'0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'}},{'gas':'5014','gasCost':'5000','op':'SSTORE','pc':'235','stack':['0x60fe47b1','0x55','0x38','0x5a','0x5a','0x00'],'steps':90,'storage':{'0x00':'0x38','0x01':'0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'}},{'gas':'14','gasCost':'2','op':'POP','pc':'236','stack':['0x60fe47b1','0x55','0x38','0x5a'],'steps':91,'storage':{'0x00':'0x5a','0x01':'0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'}},{'gas':'12','gasCost':'1','op':'JUMPDEST','pc':'237','stack':['0x60fe47b1','0x55','0x38'],'steps':92,'storage':{'0x00':'0x5a','0x01':'0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'}},{'gas':'11','gasCost':'2','op':'POP','pc':'238','stack':['0x60fe47b1','0x55','0x38'],'steps':93,'storage':{'0x00':'0x5a','0x01':'0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'}},{'gas':'9','gasCost':'8','op':'JUMP','pc':'239','stack':['0x60fe47b1','0x55'],'steps':94,'storage':{'0x00':'0x5a','0x01':'0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'}},{'gas':'1','gasCost':'1','op':'JUMPDEST','pc':'85','stack':['0x60fe47b1'],'steps':95,'storage':{'0x00':'0x5a','0x01':'0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'}},{'gas':'0','gasCost':'0','op':'STOP','pc':'86','stack':['0x60fe47b1'],'steps':96,'storage':{'0x00':'0x5a','0x01':'0xd01f65e3472f24faf45f08f8698ec4da1bf32a95'}}]} \ No newline at end of file diff --git a/test/resources/contractInvokationTx.js b/test/resources/contractInvokationTx.js deleted file mode 100644 index c0eddd11a5..0000000000 --- a/test/resources/contractInvokationTx.js +++ /dev/null @@ -1,2 +0,0 @@ -module.exports = -{'blockHash':'0xd1d34932f8733e0485b7d9bf8500c4046d650f20ed7792508c304304fa7bbfac','blockNumber':89,'from':'0x00101c5bfa3fc8bad02c9f5fd65b069306251915','gas':105967,'gasPrice':'20000000000','hash':'0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51','input':'0x60fe47b10000000000000000000000000000000000000000000000000000000000000038','nonce':3,'to':'0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5','transactionIndex':0,'value':'0'} \ No newline at end of file diff --git a/test/traceManager.js b/test/traceManager.js index 1805eac1b4..5ab286b15a 100644 --- a/test/traceManager.js +++ b/test/traceManager.js @@ -2,7 +2,6 @@ var TraceManager = require('../src/trace/traceManager') var tape = require('tape') var init = require('../src/helpers/init') -var txInvokation = require('./resources/contractInvokationTx') var web3Test = require('./resources/testWeb3') var initWeb3 = require('./init') @@ -17,7 +16,8 @@ tape('TraceManager', function (t) { }) t.test('TraceManager.resolveTrace', function (st) { - traceManager.resolveTrace(txInvokation, function (error, result) { + var tx = traceManager.web3.eth.getTransaction('0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') + traceManager.resolveTrace(tx, function (error, result) { if (error) { st.fail(' - traceManager.resolveTrace - failed ' + result) } else { @@ -45,7 +45,8 @@ tape('TraceManager', function (t) { }) t.test('TraceManager.getStorageAt', function (st) { - traceManager.getStorageAt(110, txInvokation, function (error, result) { + var tx = traceManager.web3.eth.getTransaction('0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') + traceManager.getStorageAt(110, tx, function (error, result) { if (error) { st.fail(error) } else {