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
78b93513
Commit
78b93513
authored
Jul 22, 2020
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor resolveTrace into a promise
parent
c7018a7d
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
61 additions
and
77 deletions
+61
-77
Ethdebugger.js
libs/remix-debug/src/Ethdebugger.js
+11
-18
int.js
libs/remix-debug/test/decoder/localsTests/int.js
+4
-6
misc.js
libs/remix-debug/test/decoder/localsTests/misc.js
+4
-6
misc2.js
libs/remix-debug/test/decoder/localsTests/misc2.js
+4
-6
structArray.js
libs/remix-debug/test/decoder/localsTests/structArray.js
+4
-6
mapping.js
libs/remix-debug/test/decoder/stateTests/mapping.js
+2
-1
traceManager.js
libs/remix-lib/src/trace/traceManager.js
+24
-22
codeManager.js
libs/remix-lib/test/codeManager.js
+4
-6
traceManager.js
libs/remix-lib/test/traceManager.js
+4
-6
No files found.
libs/remix-debug/src/Ethdebugger.js
View file @
78b93513
...
@@ -112,11 +112,7 @@ Ethdebugger.prototype.decodeStateAt = async function (step, stateVars, callback)
...
@@ -112,11 +112,7 @@ Ethdebugger.prototype.decodeStateAt = async function (step, stateVars, callback)
}
}
Ethdebugger
.
prototype
.
storageViewAt
=
function
(
step
,
address
)
{
Ethdebugger
.
prototype
.
storageViewAt
=
function
(
step
,
address
)
{
return
new
StorageViewer
({
return
new
StorageViewer
({
stepIndex
:
step
,
tx
:
this
.
tx
,
address
:
address
},
this
.
storageResolver
,
this
.
traceManager
)
stepIndex
:
step
,
tx
:
this
.
tx
,
address
:
address
},
this
.
storageResolver
,
this
.
traceManager
)
}
}
Ethdebugger
.
prototype
.
updateWeb3
=
function
(
web3
)
{
Ethdebugger
.
prototype
.
updateWeb3
=
function
(
web3
)
{
...
@@ -134,21 +130,18 @@ Ethdebugger.prototype.debug = function (tx) {
...
@@ -134,21 +130,18 @@ Ethdebugger.prototype.debug = function (tx) {
if
(
this
.
traceManager
.
isLoading
)
{
if
(
this
.
traceManager
.
isLoading
)
{
return
return
}
}
if
(
!
tx
.
to
)
{
tx
.
to
=
tx
.
to
||
traceHelper
.
contractCreationToken
(
'0'
)
tx
.
to
=
traceHelper
.
contractCreationToken
(
'0'
)
}
this
.
tx
=
tx
this
.
tx
=
tx
this
.
traceManager
.
resolveTrace
(
tx
,
async
(
error
,
result
)
=>
{
if
(
result
)
{
this
.
traceManager
.
resolveTrace
(
tx
).
then
(
async
(
result
)
=>
{
this
.
setCompilationResult
(
await
this
.
compilationResult
(
tx
.
to
))
this
.
setCompilationResult
(
await
this
.
compilationResult
(
tx
.
to
))
this
.
event
.
trigger
(
'newTraceLoaded'
,
[
this
.
traceManager
.
trace
])
this
.
event
.
trigger
(
'newTraceLoaded'
,
[
this
.
traceManager
.
trace
])
if
(
this
.
breakpointManager
&&
this
.
breakpointManager
.
hasBreakpoint
())
{
if
(
this
.
breakpointManager
&&
this
.
breakpointManager
.
hasBreakpoint
())
{
this
.
breakpointManager
.
jumpNextBreakpoint
(
false
)
this
.
breakpointManager
.
jumpNextBreakpoint
(
false
)
}
this
.
storageResolver
=
new
StorageResolver
({
web3
:
this
.
traceManager
.
web3
})
}
else
{
this
.
statusMessage
=
error
?
error
.
message
:
'Trace not loaded'
}
}
this
.
storageResolver
=
new
StorageResolver
({
web3
:
this
.
traceManager
.
web3
})
}).
catch
((
error
)
=>
{
this
.
statusMessage
=
error
?
error
.
message
:
'Trace not loaded'
})
})
}
}
...
...
libs/remix-debug/test/decoder/localsTests/int.js
View file @
78b93513
...
@@ -119,12 +119,10 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
...
@@ -119,12 +119,10 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
cb
()
cb
()
})
})
})
})
traceManager
.
resolveTrace
(
tx
,
(
error
,
result
)
=>
{
traceManager
.
resolveTrace
(
tx
).
then
(()
=>
{
if
(
error
)
{
debuggerEvent
.
trigger
(
'newTraceLoaded'
,
[
traceManager
.
trace
])
st
.
fail
(
error
)
}).
catch
((
error
)
=>
{
}
else
{
st
.
fail
(
error
)
debuggerEvent
.
trigger
(
'newTraceLoaded'
,
[
traceManager
.
trace
])
}
})
})
}
}
})
})
...
...
libs/remix-debug/test/decoder/localsTests/misc.js
View file @
78b93513
...
@@ -65,12 +65,10 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
...
@@ -65,12 +65,10 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
cb
()
cb
()
})
})
})
})
traceManager
.
resolveTrace
(
tx
,
(
error
,
result
)
=>
{
traceManager
.
resolveTrace
(
tx
).
then
(()
=>
{
if
(
error
)
{
debuggerEvent
.
trigger
(
'newTraceLoaded'
,
[
traceManager
.
trace
])
st
.
fail
(
error
)
}).
catch
((
error
)
=>
{
}
else
{
st
.
fail
(
error
)
debuggerEvent
.
trigger
(
'newTraceLoaded'
,
[
traceManager
.
trace
])
}
})
})
}
}
})
})
...
...
libs/remix-debug/test/decoder/localsTests/misc2.js
View file @
78b93513
...
@@ -51,12 +51,10 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
...
@@ -51,12 +51,10 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
cb
()
cb
()
})
})
})
})
traceManager
.
resolveTrace
(
tx
,
(
error
,
result
)
=>
{
traceManager
.
resolveTrace
(
tx
).
then
(()
=>
{
if
(
error
)
{
debuggerEvent
.
trigger
(
'newTraceLoaded'
,
[
traceManager
.
trace
])
st
.
fail
(
error
)
}).
catch
((
error
)
=>
{
}
else
{
st
.
fail
(
error
)
debuggerEvent
.
trigger
(
'newTraceLoaded'
,
[
traceManager
.
trace
])
}
})
})
}
}
})
})
...
...
libs/remix-debug/test/decoder/localsTests/structArray.js
View file @
78b93513
...
@@ -109,12 +109,10 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
...
@@ -109,12 +109,10 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
cb
()
cb
()
})
})
})
})
traceManager
.
resolveTrace
(
tx
,
(
error
,
result
)
=>
{
traceManager
.
resolveTrace
(
tx
).
then
(()
=>
{
if
(
error
)
{
debuggerEvent
.
trigger
(
'newTraceLoaded'
,
[
traceManager
.
trace
])
st
.
fail
(
error
)
}).
catch
((
error
)
=>
{
}
else
{
st
.
fail
(
error
)
debuggerEvent
.
trigger
(
'newTraceLoaded'
,
[
traceManager
.
trace
])
}
})
})
}
}
})
})
...
...
libs/remix-debug/test/decoder/stateTests/mapping.js
View file @
78b93513
...
@@ -46,7 +46,8 @@ function testMapping (st, vm, privateKey, contractAddress, output, cb) {
...
@@ -46,7 +46,8 @@ function testMapping (st, vm, privateKey, contractAddress, output, cb) {
st
.
end
(
error
)
st
.
end
(
error
)
}
else
{
}
else
{
var
traceManager
=
new
TraceManager
({
web3
:
vm
.
web3
})
var
traceManager
=
new
TraceManager
({
web3
:
vm
.
web3
})
traceManager
.
resolveTrace
(
tx
,
()
=>
{
traceManager
.
resolveTrace
(
tx
).
then
(()
=>
{
var
storageViewer
=
new
StorageViewer
({
var
storageViewer
=
new
StorageViewer
({
stepIndex
:
268
,
stepIndex
:
268
,
tx
:
tx
,
tx
:
tx
,
...
...
libs/remix-lib/src/trace/traceManager.js
View file @
78b93513
...
@@ -17,30 +17,32 @@ function TraceManager (options) {
...
@@ -17,30 +17,32 @@ function TraceManager (options) {
}
}
// init section
// init section
TraceManager
.
prototype
.
resolveTrace
=
async
function
(
tx
,
callback
)
{
TraceManager
.
prototype
.
resolveTrace
=
async
function
(
tx
)
{
this
.
tx
=
tx
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
this
.
init
()
this
.
tx
=
tx
if
(
!
this
.
web3
)
callback
(
'web3 not loaded'
,
false
)
this
.
init
()
this
.
isLoading
=
true
if
(
!
this
.
web3
)
reject
(
'web3 not loaded'
)
try
{
this
.
isLoading
=
true
const
result
=
await
this
.
getTrace
(
tx
.
hash
)
try
{
const
result
=
await
this
.
getTrace
(
tx
.
hash
)
if
(
result
.
structLogs
.
length
>
0
)
{
this
.
trace
=
result
.
structLogs
if
(
result
.
structLogs
.
length
>
0
)
{
this
.
trace
=
result
.
structLogs
this
.
traceAnalyser
.
analyse
(
result
.
structLogs
,
tx
)
this
.
traceAnalyser
.
analyse
(
result
.
structLogs
,
tx
)
this
.
isLoading
=
false
return
resolve
(
true
)
}
var
mes
=
tx
.
hash
+
' is not a contract invocation or contract creation.'
console
.
log
(
mes
)
this
.
isLoading
=
false
reject
(
mes
)
}
catch
(
error
)
{
console
.
log
(
error
)
this
.
isLoading
=
false
this
.
isLoading
=
false
re
turn
callback
(
null
,
true
)
re
ject
(
error
)
}
}
var
mes
=
tx
.
hash
+
' is not a contract invocation or contract creation.'
})
console
.
log
(
mes
)
this
.
isLoading
=
false
callback
(
mes
,
false
)
}
catch
(
error
)
{
console
.
log
(
error
)
this
.
isLoading
=
false
callback
(
error
,
false
)
}
}
}
TraceManager
.
prototype
.
getTrace
=
function
(
txHash
)
{
TraceManager
.
prototype
.
getTrace
=
function
(
txHash
)
{
...
...
libs/remix-lib/test/codeManager.js
View file @
78b93513
...
@@ -23,12 +23,10 @@ tape('CodeManager', function (t) {
...
@@ -23,12 +23,10 @@ tape('CodeManager', function (t) {
const
contractCode
=
web3
.
eth
.
getCode
(
'0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5'
)
const
contractCode
=
web3
.
eth
.
getCode
(
'0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5'
)
codeManager
.
codeResolver
.
cacheExecutingCode
(
'0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5'
,
contractCode
)
// so a call to web3 is not necessary
codeManager
.
codeResolver
.
cacheExecutingCode
(
'0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5'
,
contractCode
)
// so a call to web3 is not necessary
const
tx
=
web3
.
eth
.
getTransaction
(
'0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51'
)
const
tx
=
web3
.
eth
.
getTransaction
(
'0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51'
)
traceManager
.
resolveTrace
(
tx
,
function
(
error
,
result
)
{
traceManager
.
resolveTrace
(
tx
).
then
(()
=>
{
if
(
error
)
{
continueTesting
(
t
,
codeManager
)
t
.
fail
(
' - traceManager.resolveTrace - failed '
+
result
)
}).
catch
(()
=>
{
}
else
{
t
.
fail
(
' - traceManager.resolveTrace - failed '
)
continueTesting
(
t
,
codeManager
)
}
})
})
}
}
})
})
...
...
libs/remix-lib/test/traceManager.js
View file @
78b93513
...
@@ -27,12 +27,10 @@ tape('TraceManager', function (t) {
...
@@ -27,12 +27,10 @@ tape('TraceManager', function (t) {
t
.
test
(
'TraceManager.resolveTrace'
,
function
(
st
)
{
t
.
test
(
'TraceManager.resolveTrace'
,
function
(
st
)
{
const
tx
=
web3
.
eth
.
getTransaction
(
'0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51'
)
const
tx
=
web3
.
eth
.
getTransaction
(
'0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51'
)
traceManager
.
resolveTrace
(
tx
,
function
(
error
,
result
)
{
traceManager
.
resolveTrace
(
tx
).
then
(()
=>
{
if
(
error
)
{
st
.
end
()
st
.
fail
(
' - traceManager.resolveTrace - failed '
+
result
)
}).
catch
(()
=>
{
}
else
{
st
.
fail
(
' - traceManager.resolveTrace - failed '
)
st
.
end
()
}
})
})
})
})
...
...
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