Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
a7706f86
Unverified
Commit
a7706f86
authored
Jan 17, 2019
by
yann300
Committed by
GitHub
Jan 17, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1109 from ethereum/remix_sim_improvs
add bins & command line params for simulator and debugger
parents
dab4a931
94b050e0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
179 additions
and
31 deletions
+179
-31
rdb
remix-debug/bin/rdb
+112
-0
package.json
remix-debug/package.json
+1
-0
test.js
remix-debug/test.js
+1
-0
ethsim
remix-simulator/bin/ethsim
+26
-1
package.json
remix-simulator/package.json
+1
-0
server.js
remix-simulator/src/server.js
+38
-30
No files found.
remix-debug/bin/rdb
0 → 100755
View file @
a7706f86
#!/usr/bin/env node
const
program
=
require
(
'commander'
)
const
version
=
require
(
'../package.json'
).
version
program
.
command
(
'version'
)
.
description
(
"outputs version number"
)
.
action
(()
=>
{
console
.
log
(
version
)
process
.
exit
(
0
)
})
program
.
command
(
'help'
)
.
description
(
"outputs usage information"
)
.
action
(()
=>
{
program
.
help
()
process
.
exit
(
0
)
})
program
.
option
(
'-f, --file [filename]'
,
'solidity filename to debug'
)
.
option
(
'--tx [txHash]'
,
'transaction hash to debug'
)
.
option
(
'--node [url]'
,
'node to connect to'
)
.
parse
(
process
.
argv
)
var
CmdLine
=
require
(
'../src/cmdline/index.js'
)
var
solc
=
require
(
'solc'
)
var
fs
=
require
(
'fs'
)
var
filename
=
'test/sol/simple_storage.sol'
var
shortFilename
=
'simple_storage.sol'
var
inputJson
=
{
language
:
'Solidity'
,
sources
:
{
},
settings
:
{
optimizer
:
{
enabled
:
true
,
runs
:
200
},
outputSelection
:
{
'*'
:
{
''
:
[
'legacyAST'
],
'*'
:
[
'abi'
,
'metadata'
,
'devdoc'
,
'userdoc'
,
'evm.legacyAssembly'
,
'evm.bytecode'
,
'evm.deployedBytecode'
,
'evm.methodIdentifiers'
,
'evm.gasEstimates'
]
}
}
}
}
inputJson
.
sources
[
shortFilename
]
=
{
content
:
fs
.
readFileSync
(
filename
).
toString
()}
console
.
log
(
'compiling...'
)
let
compilationData
=
JSON
.
parse
(
solc
.
compileStandardWrapper
(
JSON
.
stringify
(
inputJson
)))
var
compilation
=
{}
compilation
.
data
=
compilationData
compilation
.
source
=
{
sources
:
inputJson
.
sources
}
var
cmdLine
=
new
CmdLine
()
cmdLine
.
connect
(
'http'
,
'http://localhost:8545'
)
cmdLine
.
loadCompilationResult
(
compilation
)
cmdLine
.
initDebugger
()
var
tx
=
'0xf510c4f0b1d9ee262d7b9e9e87b4262f275fe029c2c733feef7dfa1e2b1e32aa'
cmdLine
.
startDebug
(
tx
,
shortFilename
)
cmdLine
.
events
.
on
(
'source'
,
()
=>
{
cmdLine
.
getSource
().
forEach
(
console
.
dir
)
})
const
repl
=
require
(
'repl'
)
repl
.
start
({
prompt
:
'> '
,
eval
:
(
cmd
,
context
,
filename
,
cb
)
=>
{
let
command
=
cmd
.
trim
()
if
(
command
===
'next'
||
command
===
'n'
)
{
cmdLine
.
stepOverForward
(
true
)
}
if
(
command
===
'previous'
||
command
===
'p'
||
command
===
'prev'
)
{
cmdLine
.
stepOverBack
(
true
)
}
if
(
command
===
'step'
||
command
===
's'
)
{
cmdLine
.
stepIntoForward
(
true
)
}
if
(
command
===
'stepback'
||
command
===
'sb'
)
{
cmdLine
.
stepIntoBack
(
true
)
}
if
(
command
===
'exit'
||
command
===
'quit'
)
{
process
.
exit
(
0
)
}
if
(
command
===
'var local'
||
command
===
'v l'
||
command
===
'vl'
)
{
cmdLine
.
displayLocals
()
}
if
(
command
===
'var global'
||
command
===
'v g'
||
command
===
'vg'
)
{
cmdLine
.
displayGlobals
()
}
if
(
command
.
split
(
' '
)[
0
]
===
'jump'
)
{
let
stepIndex
=
parseInt
(
command
.
split
(
' '
)[
1
],
10
)
cmdLine
.
jumpTo
(
stepIndex
)
}
cb
(
null
,
''
)
}
})
module
.
exports
=
cmdLine
remix-debug/package.json
View file @
a7706f86
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
],
],
"main"
:
"./index.js"
,
"main"
:
"./index.js"
,
"dependencies"
:
{
"dependencies"
:
{
"commander"
:
"^2.19.0"
,
"ethereumjs-util"
:
"^4.5.0"
,
"ethereumjs-util"
:
"^4.5.0"
,
"ethereumjs-vm"
:
"2.4.0"
,
"ethereumjs-vm"
:
"2.4.0"
,
"fast-async"
:
"^6.1.2"
,
"fast-async"
:
"^6.1.2"
,
...
...
remix-debug/
rdb
.js
→
remix-debug/
test
.js
View file @
a7706f86
// TODO: this file shoudl be removed at some point
var
CmdLine
=
require
(
'./src/cmdline/index.js'
)
var
CmdLine
=
require
(
'./src/cmdline/index.js'
)
// var compilation = require('./compilation.json')
// var compilation = require('./compilation.json')
...
...
remix-simulator/bin/ethsim
View file @
a7706f86
#!/usr/bin/env node
#!/usr/bin/env node
require
(
'../src/server'
);
const
program
=
require
(
'commander'
)
const
version
=
require
(
'../package.json'
).
version
program
.
command
(
'version'
)
.
description
(
"outputs version number"
)
.
action
(()
=>
{
console
.
log
(
version
)
process
.
exit
(
0
)
})
program
.
command
(
'help'
)
.
description
(
"outputs usage information"
)
.
action
(()
=>
{
program
.
help
()
process
.
exit
(
0
)
})
program
.
option
(
'-p, --port [port]'
,
'specify port'
)
.
parse
(
process
.
argv
)
const
Server
=
require
(
'../src/server'
)
const
server
=
new
Server
()
server
.
start
(
program
.
port
||
8545
)
remix-simulator/package.json
View file @
a7706f86
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
"ansi-gray"
:
"^0.1.1"
,
"ansi-gray"
:
"^0.1.1"
,
"body-parser"
:
"^1.18.2"
,
"body-parser"
:
"^1.18.2"
,
"color-support"
:
"^1.1.3"
,
"color-support"
:
"^1.1.3"
,
"commander"
:
"^2.19.0"
,
"express"
:
"^4.16.3"
,
"express"
:
"^4.16.3"
,
"express-ws"
:
"^4.0.0"
,
"express-ws"
:
"^4.0.0"
,
"fast-async"
:
"^6.3.7"
,
"fast-async"
:
"^6.3.7"
,
...
...
remix-simulator/src/server.js
View file @
a7706f86
...
@@ -5,35 +5,43 @@ const expressWs = require('express-ws')
...
@@ -5,35 +5,43 @@ const expressWs = require('express-ws')
const
Provider
=
require
(
'./provider'
)
const
Provider
=
require
(
'./provider'
)
const
log
=
require
(
'./utils/logs.js'
)
const
log
=
require
(
'./utils/logs.js'
)
expressWs
(
app
)
class
Server
{
constructor
()
{
var
provider
=
new
Provider
()
this
.
provider
=
new
Provider
()
}
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}))
app
.
use
(
bodyParser
.
json
())
start
(
port
)
{
expressWs
(
app
)
app
.
get
(
'/'
,
(
req
,
res
)
=>
{
res
.
send
(
'Welcome to remix-simulator'
)
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}))
})
app
.
use
(
bodyParser
.
json
())
app
.
use
((
req
,
res
)
=>
{
app
.
get
(
'/'
,
(
req
,
res
)
=>
{
provider
.
sendAsync
(
req
.
body
,
(
err
,
jsonResponse
)
=>
{
res
.
send
(
'Welcome to remix-simulator'
)
if
(
err
)
{
})
return
res
.
send
(
JSON
.
stringify
({
error
:
err
}))
}
app
.
use
((
req
,
res
)
=>
{
res
.
send
(
jsonResponse
)
this
.
provider
.
sendAsync
(
req
.
body
,
(
err
,
jsonResponse
)
=>
{
})
if
(
err
)
{
})
return
res
.
send
(
JSON
.
stringify
({
error
:
err
}))
}
app
.
ws
(
'/'
,
(
ws
,
req
)
=>
{
res
.
send
(
jsonResponse
)
ws
.
on
(
'message'
,
function
(
msg
)
{
})
provider
.
sendAsync
(
JSON
.
parse
(
msg
),
(
err
,
jsonResponse
)
=>
{
})
if
(
err
)
{
return
ws
.
send
(
JSON
.
stringify
({
error
:
err
}))
app
.
ws
(
'/'
,
(
ws
,
req
)
=>
{
}
ws
.
on
(
'message'
,
function
(
msg
)
{
ws
.
send
(
JSON
.
stringify
(
jsonResponse
))
this
.
provider
.
sendAsync
(
JSON
.
parse
(
msg
),
(
err
,
jsonResponse
)
=>
{
if
(
err
)
{
return
ws
.
send
(
JSON
.
stringify
({
error
:
err
}))
}
ws
.
send
(
JSON
.
stringify
(
jsonResponse
))
})
})
})
})
})
})
app
.
listen
(
8545
,
()
=>
log
(
'Remix Simulator listening on port 8545!'
))
app
.
listen
(
port
,
()
=>
log
(
'Remix Simulator listening on port '
+
port
))
}
}
module
.
exports
=
Server
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment