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
caf8d6cd
Commit
caf8d6cd
authored
Sep 21, 2020
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add debug endpoint to remix-simulator
parent
d0934846
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
5 deletions
+43
-5
web3VmProvider.js
libs/remix-lib/src/web3Provider/web3VmProvider.js
+6
-4
debug.js
libs/remix-simulator/src/methods/debug.js
+33
-0
transactions.js
libs/remix-simulator/src/methods/transactions.js
+2
-1
provider.js
libs/remix-simulator/src/provider.js
+2
-0
No files found.
libs/remix-lib/src/web3Provider/web3VmProvider.js
View file @
caf8d6cd
...
...
@@ -72,9 +72,9 @@ web3VmProvider.prototype.txWillProcess = function (self, data) {
}
let
tx
=
{}
tx
.
hash
=
self
.
processingHash
tx
.
from
=
util
.
hexConvert
(
data
.
getSenderAddress
(
))
tx
.
from
=
ethutil
.
toChecksumAddress
(
util
.
hexConvert
(
data
.
getSenderAddress
()
))
if
(
data
.
to
&&
data
.
to
.
length
)
{
tx
.
to
=
util
.
hexConvert
(
data
.
to
)
tx
.
to
=
ethutil
.
toChecksumAddress
(
util
.
hexConvert
(
data
.
to
)
)
}
this
.
processingAddress
=
tx
.
to
tx
.
data
=
util
.
hexConvert
(
data
.
data
)
...
...
@@ -128,8 +128,8 @@ web3VmProvider.prototype.txProcessed = function (self, data) {
if
(
data
.
createdAddress
)
{
const
address
=
util
.
hexConvert
(
data
.
createdAddress
)
self
.
vmTraces
[
self
.
processingHash
].
return
=
address
self
.
txsReceipt
[
self
.
processingHash
].
contractAddress
=
address
self
.
vmTraces
[
self
.
processingHash
].
return
=
ethutil
.
toChecksumAddress
(
address
)
self
.
txsReceipt
[
self
.
processingHash
].
contractAddress
=
ethutil
.
toChecksumAddress
(
address
)
}
else
if
(
data
.
execResult
.
returnValue
)
{
self
.
vmTraces
[
self
.
processingHash
].
return
=
util
.
hexConvert
(
data
.
execResult
.
returnValue
)
}
else
{
...
...
@@ -196,6 +196,7 @@ web3VmProvider.prototype.pushTrace = function (self, data) {
}
web3VmProvider
.
prototype
.
getCode
=
function
(
address
,
cb
)
{
address
=
ethutil
.
toChecksumAddress
(
address
)
const
account
=
ethutil
.
toBuffer
(
address
)
this
.
vm
.
stateManager
.
getContractCode
(
account
,
(
error
,
result
)
=>
{
cb
(
error
,
util
.
hexConvert
(
result
))
...
...
@@ -219,6 +220,7 @@ web3VmProvider.prototype.traceTransaction = function (txHash, options, cb) {
web3VmProvider
.
prototype
.
storageRangeAt
=
function
(
blockNumber
,
txIndex
,
address
,
start
,
maxLength
,
cb
)
{
// txIndex is the hash in the case of the VM
// we don't use the range params here
address
=
ethutil
.
toChecksumAddress
(
address
)
if
(
txIndex
===
'latest'
)
{
txIndex
=
this
.
lastProcessedStorageTxHash
[
address
]
...
...
libs/remix-simulator/src/methods/debug.js
0 → 100644
View file @
caf8d6cd
class
Debug
{
constructor
(
executionContext
)
{
this
.
executionContext
=
executionContext
}
methods
()
{
return
{
debug_traceTransaction
:
this
.
debug_traceTransaction
.
bind
(
this
),
debug_preimage
:
this
.
debug_preimage
.
bind
(
this
),
debug_storageRangeAt
:
this
.
debug_storageRangeAt
.
bind
(
this
),
}
}
debug_traceTransaction
(
payload
,
cb
)
{
this
.
executionContext
.
web3
().
debug
.
traceTransaction
(
payload
.
params
[
0
],
{},
cb
)
}
debug_preimage
(
payload
,
cb
)
{
this
.
executionContext
.
web3
().
debug
.
preimage
(
payload
.
params
[
0
],
cb
)
}
debug_storageRangeAt
(
payload
,
cb
)
{
this
.
executionContext
.
web3
().
debug
.
storageRangeAt
(
payload
.
params
[
0
],
payload
.
params
[
1
],
payload
.
params
[
2
],
payload
.
params
[
3
],
payload
.
params
[
4
],
cb
)
}
}
module
.
exports
=
Debug
libs/remix-simulator/src/methods/transactions.js
View file @
caf8d6cd
...
...
@@ -52,7 +52,8 @@ class Transactions{
'cumulativeGasUsed'
:
Web3
.
utils
.
toHex
(
receipt
.
gas
),
'contractAddress'
:
receipt
.
contractAddress
,
'logs'
:
receipt
.
logs
,
'status'
:
receipt
.
status
'status'
:
receipt
.
status
,
'to'
:
receipt
.
to
}
if
(
r
.
blockNumber
===
'0x'
)
{
...
...
libs/remix-simulator/src/provider.js
View file @
caf8d6cd
...
...
@@ -10,6 +10,7 @@ const Filters = require('./methods/filters.js')
const
Misc
=
require
(
'./methods/misc.js'
)
const
Net
=
require
(
'./methods/net.js'
)
const
Transactions
=
require
(
'./methods/transactions.js'
)
const
Debug
=
require
(
'./methods/debug.js'
)
const
generateBlock
=
require
(
'./genesis.js'
)
...
...
@@ -28,6 +29,7 @@ class Provider {
this
.
methods
=
merge
(
this
.
methods
,
(
new
Filters
(
this
.
executionContext
)).
methods
())
this
.
methods
=
merge
(
this
.
methods
,
(
new
Net
()).
methods
())
this
.
methods
=
merge
(
this
.
methods
,
this
.
Transactions
.
methods
())
this
.
methods
=
merge
(
this
.
methods
,
(
new
Debug
(
this
.
executionContext
)).
methods
())
generateBlock
(
this
.
executionContext
)
this
.
init
()
...
...
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