indentation

pull/7/head
yann300 9 years ago
parent 9e107f8bef
commit 1164dc67b5
  1. 126
      src/assemblyItemsBrowser.js
  2. 32
      src/debugger.js
  3. 4
      src/index.js
  4. 10
      src/txBrowser.js
  5. 4
      src/vmTraceBrowser.js
  6. 496
      src/web3Admin.js

@ -2,52 +2,52 @@ var React = require('react');
module.exports = React.createClass({ module.exports = React.createClass({
getInitialState: function() getInitialState: function()
{ {
return { return {
currentSelected: null, currentSelected: null,
currentAddress: null currentAddress: null
}; };
}, },
getDefaultProps: function() getDefaultProps: function()
{ {
return { return {
vmTrace: null vmTrace: null
}; };
}, },
render: function() render: function()
{ {
if (!this.props.vmTrace || !this.props.vmTrace.vmtrace || this.props.vmTrace.vmtrace.length === 0) if (!this.props.vmTrace || !this.props.vmTrace.vmtrace || this.props.vmTrace.vmtrace.length === 0)
return null; return null;
this.state.currentAddress = this.props.vmTrace.vmtrace[0].address this.state.currentAddress = this.props.vmTrace.vmtrace[0].address
this.state.currentSelected = this.props.vmTrace.codesmap[this.state.currentAddress][this.props.vmTrace.vmtrace[0].pc] this.state.currentSelected = this.props.vmTrace.codesmap[this.state.currentAddress][this.props.vmTrace.vmtrace[0].pc]
return ( return (
<div> <div>
<div id="action" > <div id="action" >
<button onClick={this.stepIntoBack} >stepIntoBack</button> <button onClick={this.stepIntoBack} >stepIntoBack</button>
<button onClick={this.stepOverBack} >stepOverBack</button> <button onClick={this.stepOverBack} >stepOverBack</button>
<button onClick={this.stepOverForward} >stepOverForward</button> <button onClick={this.stepOverForward} >stepOverForward</button>
<button onClick={this.stepIntoForward} >stepIntoForward</button> <button onClick={this.stepIntoForward} >stepIntoForward</button>
</div> </div>
<div> <div>
<select size="10" ref='itemsList' value={this.state.currentSelected}> <select size="10" ref='itemsList' value={this.state.currentSelected}>
{ this.renderAssemblyItems() } { this.renderAssemblyItems() }
</select> </select>
</div>
</div> </div>
</div> );
);
}, },
renderAssemblyItems: function() renderAssemblyItems: function()
{ {
if (this.props.vmTrace) if (this.props.vmTrace)
{ {
var selectedItem = this.state.currentSelected var selectedItem = this.state.currentSelected
return this.props.vmTrace.vmtrace.map(function(item, i) return this.props.vmTrace.vmtrace.map(function(item, i)
{ {
return <option key={i} value={i} >{item.instname}</option>; return <option key={i} value={i} >{item.instname}</option>;
}); });
} }
}, },
@ -55,7 +55,7 @@ module.exports = React.createClass({
stepIntoBack: function () stepIntoBack: function ()
{ {
this.moveSelection(-1) this.moveSelection(-1)
}, },
stepOverBack: function() stepOverBack: function()
@ -116,39 +116,39 @@ module.exports = React.createClass({
if (depth == 0) if (depth == 0)
break; break;
else depth--; else depth--;
else if (this.isReturnInstruction(i)) else if (this.isReturnInstruction(i))
depth++; depth++;
} }
this.selectState(i); this.selectState(i);
}, },
stepOutForward: function() stepOutForward: function()
{ {
var i = this.state.currentSelected; var i = this.state.currentSelected;
var depth = 0; var depth = 0;
while (++i < this.props.vmTrace.vmtrace.length) { while (++i < this.props.vmTrace.vmtrace.length) {
if (this.isReturnInstruction(i)) if (this.isReturnInstruction(i))
if (depth == 0) if (depth == 0)
break; break;
else else
depth--; depth--;
else if (this.isCallInstruction(i)) else if (this.isCallInstruction(i))
depth++; depth++;
} }
this.selectState(i + 1); this.selectState(i + 1);
}, },
moveSelection: function(incr) moveSelection: function(incr)
{ {
this.selectState(this.state.currentSelected + incr) this.selectState(this.state.currentSelected + incr)
}, },
selectState: function(index) selectState: function(index)
{ {
var newIndex = this.props.vmTrace.codesmap[this.state.currentAddress][this.props.vmTrace.vmtrace[index].pc] var newIndex = this.props.vmTrace.codesmap[this.state.currentAddress][this.props.vmTrace.vmtrace[index].pc]
this.state.currentSelected = index this.state.currentSelected = index
this.refs.itemsList.value = this.state.currentSelected this.refs.itemsList.value = this.state.currentSelected
if (this.props.vmTrace.vmtrace[index].address && this.state.currentAddress !== this.props.vmTrace.vmtrace[index].address) if (this.props.vmTrace.vmtrace[index].address && this.state.currentAddress !== this.props.vmTrace.vmtrace[index].address)
this.state.currentAddress = this.props.vmTrace.vmtrace[index].address this.state.currentAddress = this.props.vmTrace.vmtrace[index].address
}, },
}) })

@ -4,22 +4,22 @@ var VmTraceManager = require('./vmTraceManager');
var VmTraceBrowser = require('./vmTraceBrowser'); var VmTraceBrowser = require('./vmTraceBrowser');
module.exports = React.createClass({ module.exports = React.createClass({
getInitialState: function() { getInitialState: function() {
return {vmTrace: null} return {vmTrace: null}
}, },
render: function() { render: function() {
return ( return (
<div> <div>
<h1>Debugger</h1> <h1>Debugger</h1>
<TxBrowser onNewTxRequested={this.retrieveVmTrace} /> <TxBrowser onNewTxRequested={this.retrieveVmTrace} />
<VmTraceBrowser vmTrace={this.state.vmTrace} /> <VmTraceBrowser vmTrace={this.state.vmTrace} />
</div> </div>
); );
}, },
retrieveVmTrace: function(blockNumber, txNumber) retrieveVmTrace: function(blockNumber, txNumber)
{ {
this.setState({vmTrace: VmTraceManager.retrieveVmTrace(blockNumber, txNumber)}); this.setState({vmTrace: VmTraceManager.retrieveVmTrace(blockNumber, txNumber)});
} }
}); });

@ -10,6 +10,6 @@ Web3Admin.extend(web3);
var Debugger = require('./debugger'); var Debugger = require('./debugger');
ReactDOM.render( ReactDOM.render(
<Debugger/>, <Debugger/>,
document.getElementById('app') document.getElementById('app')
); );

@ -15,21 +15,21 @@ module.exports = React.createClass({
}, },
updateBlockN: function(ev) { updateBlockN: function(ev) {
this.state.blockNumber = ev.target.value; this.state.blockNumber = ev.target.value;
}, },
updateTxN: function(ev) { updateTxN: function(ev) {
this.state.txNumber = ev.target.value; this.state.txNumber = ev.target.value;
}, },
render: function() { render: function() {
return ( return (
<div> <div>
<div><h3>Transaction details</h3></div> <div><h3>Transaction details</h3></div>
<input onChange={this.updateBlockN} type="text" placeholder= {"Block number e.g. : " + this.state.blockNumber}></input> <input onChange={this.updateBlockN} type="text" placeholder= {"Block number e.g. : " + this.state.blockNumber}></input>
<input onChange={this.updateTxN} type="text" placeholder={"Transaction Number e.g. : " + this.state.txNumber}></input> <input onChange={this.updateTxN} type="text" placeholder={"Transaction Number e.g. : " + this.state.txNumber}></input>
<button onClick={this.submit}>Get</button> <button onClick={this.submit}>Get</button>
</div> </div>
); );
} }
}) })

@ -2,7 +2,7 @@ var React = require('react');
var AssemblyItemsBrowser = require('./assemblyItemsBrowser'); var AssemblyItemsBrowser = require('./assemblyItemsBrowser');
module.exports = React.createClass({ module.exports = React.createClass({
render: function() { render: function() {
return ( <AssemblyItemsBrowser vmTrace={this.props.vmTrace} /> ) return ( <AssemblyItemsBrowser vmTrace={this.props.vmTrace} /> )
} }
}); });

@ -1,270 +1,270 @@
module.exports = { module.exports = {
extend: function(web3) { extend: function(web3) {
// ADMIN // ADMIN
web3._extend({ web3._extend({
property: 'admin', property: 'admin',
methods: methods:
[ [
new web3._extend.Method({ new web3._extend.Method({
name: 'addPeer', name: 'addPeer',
call: 'admin_addPeer', call: 'admin_addPeer',
params: 1, params: 1,
inputFormatter: [web3._extend.utils.fromDecimal], inputFormatter: [web3._extend.utils.fromDecimal],
outputFormatter: web3._extend.formatters.formatOutputBool outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'exportChain', name: 'exportChain',
call: 'admin_exportChain', call: 'admin_exportChain',
params: 1, params: 1,
inputFormatter: [null], inputFormatter: [null],
outputFormatter: function(obj) { return obj; } outputFormatter: function(obj) { return obj; }
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'importChain', name: 'importChain',
call: 'admin_importChain', call: 'admin_importChain',
params: 1, params: 1,
inputFormatter: [null], inputFormatter: [null],
outputFormatter: function(obj) { return obj; } outputFormatter: function(obj) { return obj; }
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'verbosity', name: 'verbosity',
call: 'admin_verbosity', call: 'admin_verbosity',
params: 1, params: 1,
inputFormatter: [web3._extend.utils.formatInputInt], inputFormatter: [web3._extend.utils.formatInputInt],
outputFormatter: web3._extend.formatters.formatOutputBool outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'setSolc', name: 'setSolc',
call: 'admin_setSolc', call: 'admin_setSolc',
params: 1, params: 1,
inputFormatter: [null], inputFormatter: [null],
outputFormatter: web3._extend.formatters.formatOutputString outputFormatter: web3._extend.formatters.formatOutputString
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'startRPC', name: 'startRPC',
call: 'admin_startRPC', call: 'admin_startRPC',
params: 4, params: 4,
inputFormatter: [null,web3._extend.utils.formatInputInteger,null,null], inputFormatter: [null,web3._extend.utils.formatInputInteger,null,null],
outputFormatter: web3._extend.formatters.formatOutputBool outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'stopRPC', name: 'stopRPC',
call: 'admin_stopRPC', call: 'admin_stopRPC',
params: 0, params: 0,
inputFormatter: [], inputFormatter: [],
outputFormatter: web3._extend.formatters.formatOutputBool outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'vmTrace', name: 'vmTrace',
call: 'admin_eth_vmTrace', call: 'admin_eth_vmTrace',
inputFormatter: [null, null], inputFormatter: [null, null],
params: 2 params: 2
}), }),
], ],
properties: properties:
[ [
new web3._extend.Property({ new web3._extend.Property({
name: 'nodeInfo', name: 'nodeInfo',
getter: 'admin_nodeInfo', getter: 'admin_nodeInfo',
outputFormatter: web3._extend.formatters.formatOutputString outputFormatter: web3._extend.formatters.formatOutputString
}), }),
new web3._extend.Property({ new web3._extend.Property({
name: 'peers', name: 'peers',
getter: 'admin_peers', getter: 'admin_peers',
outputFormatter: function(obj) { return obj; } outputFormatter: function(obj) { return obj; }
}), }),
new web3._extend.Property({ new web3._extend.Property({
name: 'datadir', name: 'datadir',
getter: 'admin_datadir', getter: 'admin_datadir',
outputFormatter: web3._extend.formatters.formatOutputString outputFormatter: web3._extend.formatters.formatOutputString
}), }),
new web3._extend.Property({ new web3._extend.Property({
name: 'chainSyncStatus', name: 'chainSyncStatus',
getter: 'admin_chainSyncStatus', getter: 'admin_chainSyncStatus',
outputFormatter: function(obj) { return obj; } outputFormatter: function(obj) { return obj; }
}) })
] ]
}); });
// DEBUG // DEBUG
web3._extend({ web3._extend({
property: 'debug', property: 'debug',
methods: methods:
[ [
new web3._extend.Method({ new web3._extend.Method({
name: 'printBlock', name: 'printBlock',
call: 'debug_printBlock', call: 'debug_printBlock',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputInt], inputFormatter: [web3._extend.formatters.formatInputInt],
outputFormatter: web3._extend.formatters.formatOutputString outputFormatter: web3._extend.formatters.formatOutputString
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'getBlockRlp', name: 'getBlockRlp',
call: 'debug_getBlockRlp', call: 'debug_getBlockRlp',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputInt], inputFormatter: [web3._extend.formatters.formatInputInt],
outputFormatter: web3._extend.formatters.formatOutputString outputFormatter: web3._extend.formatters.formatOutputString
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'setHead', name: 'setHead',
call: 'debug_setHead', call: 'debug_setHead',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputInt], inputFormatter: [web3._extend.formatters.formatInputInt],
outputFormatter: web3._extend.formatters.formatOutputBool outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'processBlock', name: 'processBlock',
call: 'debug_processBlock', call: 'debug_processBlock',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputInt], inputFormatter: [web3._extend.formatters.formatInputInt],
outputFormatter: function(obj) { return obj; } outputFormatter: function(obj) { return obj; }
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'seedHash', name: 'seedHash',
call: 'debug_seedHash', call: 'debug_seedHash',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputInt], inputFormatter: [web3._extend.formatters.formatInputInt],
outputFormatter: web3._extend.formatters.formatOutputString outputFormatter: web3._extend.formatters.formatOutputString
}) , }) ,
new web3._extend.Method({ new web3._extend.Method({
name: 'dumpBlock', name: 'dumpBlock',
call: 'debug_dumpBlock', call: 'debug_dumpBlock',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputInt], inputFormatter: [web3._extend.formatters.formatInputInt],
outputFormatter: function(obj) { return obj; } outputFormatter: function(obj) { return obj; }
}) })
], ],
properties: properties:
[ [
] ]
}); });
// MINER // MINER
web3._extend({ web3._extend({
property: 'miner', property: 'miner',
methods: methods:
[ [
new web3._extend.Method({ new web3._extend.Method({
name: 'start', name: 'start',
call: 'miner_start', call: 'miner_start',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputInt], inputFormatter: [web3._extend.formatters.formatInputInt],
outputFormatter: web3._extend.formatters.formatOutputBool outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'stop', name: 'stop',
call: 'miner_stop', call: 'miner_stop',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputInt], inputFormatter: [web3._extend.formatters.formatInputInt],
outputFormatter: web3._extend.formatters.formatOutputBool outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'setExtra', name: 'setExtra',
call: 'miner_setExtra', call: 'miner_setExtra',
params: 1, params: 1,
inputFormatter: [web3._extend.utils.formatInputString], inputFormatter: [web3._extend.utils.formatInputString],
outputFormatter: web3._extend.formatters.formatOutputBool outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'setGasPrice', name: 'setGasPrice',
call: 'miner_setGasPrice', call: 'miner_setGasPrice',
params: 1, params: 1,
inputFormatter: [web3._extend.utils.formatInputString], inputFormatter: [web3._extend.utils.formatInputString],
outputFormatter: web3._extend.formatters.formatOutputBool outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'startAutoDAG', name: 'startAutoDAG',
call: 'miner_startAutoDAG', call: 'miner_startAutoDAG',
params: 0, params: 0,
inputFormatter: [], inputFormatter: [],
outputFormatter: web3._extend.formatters.formatOutputBool outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'stopAutoDAG', name: 'stopAutoDAG',
call: 'miner_stopAutoDAG', call: 'miner_stopAutoDAG',
params: 0, params: 0,
inputFormatter: [], inputFormatter: [],
outputFormatter: web3._extend.formatters.formatOutputBool outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'makeDAG', name: 'makeDAG',
call: 'miner_makeDAG', call: 'miner_makeDAG',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.inputDefaultBlockNumberFormatter], inputFormatter: [web3._extend.formatters.inputDefaultBlockNumberFormatter],
outputFormatter: web3._extend.formatters.formatOutputBool outputFormatter: web3._extend.formatters.formatOutputBool
}) })
], ],
properties: properties:
[ [
new web3._extend.Property({ new web3._extend.Property({
name: 'hashrate', name: 'hashrate',
getter: 'miner_hashrate', getter: 'miner_hashrate',
outputFormatter: web3._extend.utils.toDecimal outputFormatter: web3._extend.utils.toDecimal
}) })
] ]
}); });
// NETWORK // NETWORK
web3._extend({ web3._extend({
property: 'network', property: 'network',
methods: methods:
[ [
new web3._extend.Method({ new web3._extend.Method({
name: 'addPeer', name: 'addPeer',
call: 'net_addPeer', call: 'net_addPeer',
params: 1, params: 1,
inputFormatter: [web3._extend.utils.formatInputString], inputFormatter: [web3._extend.utils.formatInputString],
outputFormatter: web3._extend.formatters.formatOutputBool outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'getPeerCount', name: 'getPeerCount',
call: 'net_peerCount', call: 'net_peerCount',
params: 0, params: 0,
inputFormatter: [], inputFormatter: [],
outputFormatter: web3._extend.formatters.formatOutputString outputFormatter: web3._extend.formatters.formatOutputString
}) })
], ],
properties: properties:
[ [
new web3._extend.Property({ new web3._extend.Property({
name: 'listening', name: 'listening',
getter: 'net_listening', getter: 'net_listening',
outputFormatter: web3._extend.formatters.formatOutputBool outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Property({ new web3._extend.Property({
name: 'peerCount', name: 'peerCount',
getter: 'net_peerCount', getter: 'net_peerCount',
outputFormatter: web3._extend.utils.toDecimal outputFormatter: web3._extend.utils.toDecimal
}), }),
new web3._extend.Property({ new web3._extend.Property({
name: 'peers', name: 'peers',
getter: 'net_peers', getter: 'net_peers',
outputFormatter: function(obj) { return obj; } outputFormatter: function(obj) { return obj; }
}), }),
new web3._extend.Property({ new web3._extend.Property({
name: 'version', name: 'version',
getter: 'net_version', getter: 'net_version',
outputFormatter: web3._extend.formatters.formatOutputString outputFormatter: web3._extend.formatters.formatOutputString
}) })
] ]
}); });
// TX POOL // TX POOL
web3._extend({ web3._extend({
property: 'txpool', property: 'txpool',
methods: methods:
[ [
], ],
properties: properties:
[ [
new web3._extend.Property({ new web3._extend.Property({
name: 'status', name: 'status',
getter: 'txpool_status', getter: 'txpool_status',
outputFormatter: function(obj) { return obj; } outputFormatter: function(obj) { return obj; }
}) })
] ]
}); });
} }
}; };

Loading…
Cancel
Save