Merge pull request #713 from ethereum/fallbacknode

Add debug nodes reference
pull/3094/head
yann300 7 years ago committed by GitHub
commit aa66d8f42d
  1. 2
      remix-core/src/storage/mappingPreimages.js
  2. 2
      remix-core/src/storage/storageResolver.js
  3. 2
      remix-core/src/trace/traceRetriever.js
  4. 1
      remix-core/test/traceManager.js
  5. 10
      remix-debugger/src/ui/Ethdebugger.js
  6. 1
      remix-debugger/test-browser/test/vmdebugger.js
  7. 3
      remix-lib/src/global.js
  8. 16
      remix-lib/src/init.js

@ -44,7 +44,7 @@ async function decodeMappingsKeys (storage, callback) {
*/
function getPreimage (key) {
return new Promise((resolve, reject) => {
global.web3.debug.preimage(key.indexOf('0x') === 0 ? key : '0x' + key, function (error, preimage) {
global.web3Debug.debug.preimage(key.indexOf('0x') === 0 ? key : '0x' + key, function (error, preimage) {
if (error) {
resolve(null)
} else {

@ -146,7 +146,7 @@ function storageRangeWeb3Call (tx, address, start, maxSize, callback) {
if (traceHelper.isContractCreation(address)) {
callback(null, {}, null)
} else {
global.web3.debug.storageRangeAt(
global.web3Debug.debug.storageRangeAt(
tx.blockHash, tx.transactionIndex === undefined ? tx.hash : tx.transactionIndex,
address,
start,

@ -12,7 +12,7 @@ TraceRetriever.prototype.getTrace = function (txHash, callback) {
disableStack: false,
fullStorage: false
}
global.web3.debug.traceTransaction(txHash, options, function (error, result) {
global.web3Debug.debug.traceTransaction(txHash, options, function (error, result) {
callback(error, result)
})
}

@ -19,6 +19,7 @@ tape('TraceManager', function (t) {
st.fail(mes)
} else {
global.web3 = obj
global.web3Debug = obj
traceManager = new TraceManager()
st.end()
}

@ -6,6 +6,8 @@ var TraceManager = remixCore.trace.TraceManager
var VmDebugger = require('./VmDebugger')
var remixLib = require('remix-lib')
var global = remixLib.global
var init = remixLib.init
var executionContext = remixLib.execution.executionContext
var EventManager = remixLib.EventManager
var yo = require('yo-yo')
var csjs = require('csjs-inject')
@ -97,6 +99,14 @@ Ethdebugger.prototype.switchProvider = function (type) {
console.log('provider ' + type + ' not defined')
} else {
global.web3 = obj
executionContext.detectNetwork((error, network) => {
if (error || !network) {
global.web3Debug = obj
} else {
var webDebugNode = init.web3DebugNode(network.name)
global.web3Debug = !webDebugNode ? obj : webDebugNode
}
})
self.event.trigger('providerChanged', [type])
}
})

@ -59,7 +59,6 @@ function loadTrace (browser) {
.execute(function () {
return document.querySelector('#txinfo .dropdownpanel .dropdownrawcontent').innerHTML
}, [], function (result) {
console.log(result.value)
if (result.value.indexOf('0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') === -1) {
browser.assert.fail(' txinput panel does not contain 0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51 ', 'info about error', '')
}

@ -1,3 +1,4 @@
module.exports = {
web3: null
web3: null,
web3Debug: null // this node should support the debug endpoint
}

@ -2,9 +2,10 @@
var Web3 = require('web3')
module.exports = {
loadWeb3: function () {
loadWeb3: function (url) {
if (!url) url = 'http://localhost:8545'
var web3 = new Web3()
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'))
web3.setProvider(new web3.providers.HttpProvider(url))
this.extend(web3)
return web3
},
@ -17,6 +18,13 @@ module.exports = {
web3.setProvider(new web3.providers.HttpProvider(url))
},
web3DebugNode: function (network) {
if (web3DebugNodes[network]) {
return this.loadWeb3(web3DebugNodes[network])
}
return null
},
extend: function (web3) {
if (!web3._extend) {
return
@ -58,3 +66,7 @@ module.exports = {
}
}
}
var web3DebugNodes = {
'Main': 'https://mainnet.infura.io/remix'
}

Loading…
Cancel
Save