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
24f0a13a
Commit
24f0a13a
authored
May 30, 2016
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
contract creation token in TraceManagerUtil.js
parent
bc5c8124
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
6 deletions
+18
-6
asmCode.js
src/asmCode.js
+2
-1
traceAnalyser.js
src/traceAnalyser.js
+2
-2
traceManagerUtil.js
src/traceManagerUtil.js
+10
-1
traceRetriever.js
src/traceRetriever.js
+2
-1
txBrowser.js
src/txBrowser.js
+2
-1
No files found.
src/asmCode.js
View file @
24f0a13a
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
var
React
=
require
(
'react'
)
var
React
=
require
(
'react'
)
var
style
=
require
(
'./basicStyles'
)
var
style
=
require
(
'./basicStyles'
)
var
codeResolver
=
require
(
'./codeResolver'
)
var
codeResolver
=
require
(
'./codeResolver'
)
var
traceManagerUtil
=
require
(
'./traceManagerUtil'
)
module
.
exports
=
React
.
createClass
({
module
.
exports
=
React
.
createClass
({
contextTypes
:
{
contextTypes
:
{
...
@@ -67,7 +68,7 @@ module.exports = React.createClass({
...
@@ -67,7 +68,7 @@ module.exports = React.createClass({
code
:
[
'loading...'
]
code
:
[
'loading...'
]
})
})
var
self
=
this
var
self
=
this
if
(
address
.
indexOf
(
'(Contract Creation Code)'
)
!==
-
1
)
{
if
(
traceManagerUtil
.
isContractCreation
(
address
)
)
{
this
.
context
.
traceManager
.
getContractCreationCode
(
address
,
function
(
error
,
hexCode
)
{
this
.
context
.
traceManager
.
getContractCreationCode
(
address
,
function
(
error
,
hexCode
)
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
...
...
src/traceAnalyser.js
View file @
24f0a13a
...
@@ -18,7 +18,7 @@ TraceAnalyser.prototype.analyse = function (trace, tx, callback) {
...
@@ -18,7 +18,7 @@ TraceAnalyser.prototype.analyse = function (trace, tx, callback) {
callStack
:
callStack
.
slice
(
0
)
callStack
:
callStack
.
slice
(
0
)
})
})
if
(
t
x
.
to
===
'(Contract Creation Code)'
)
{
if
(
t
raceManagerUtil
.
isContractCreation
(
tx
.
to
)
)
{
this
.
traceCache
.
pushContractCreation
(
tx
.
to
,
tx
.
input
)
this
.
traceCache
.
pushContractCreation
(
tx
.
to
,
tx
.
input
)
}
}
...
@@ -65,7 +65,7 @@ TraceAnalyser.prototype.buildStorage = function (index, step, context) {
...
@@ -65,7 +65,7 @@ TraceAnalyser.prototype.buildStorage = function (index, step, context) {
TraceAnalyser
.
prototype
.
buildDepth
=
function
(
index
,
step
,
callStack
)
{
TraceAnalyser
.
prototype
.
buildDepth
=
function
(
index
,
step
,
callStack
)
{
if
(
traceManagerUtil
.
isCallInstruction
(
step
)
&&
!
traceManagerUtil
.
isCallToPrecompiledContract
(
index
,
this
.
trace
))
{
if
(
traceManagerUtil
.
isCallInstruction
(
step
)
&&
!
traceManagerUtil
.
isCallToPrecompiledContract
(
index
,
this
.
trace
))
{
if
(
traceManagerUtil
.
isCreateInstruction
(
step
))
{
if
(
traceManagerUtil
.
isCreateInstruction
(
step
))
{
var
contractToken
=
'(Contract Creation Code) '
+
index
var
contractToken
=
traceManagerUtil
.
contractCreationToken
(
index
)
callStack
.
push
(
contractToken
)
callStack
.
push
(
contractToken
)
var
lastMemoryChange
=
this
.
traceCache
.
memoryChanges
[
this
.
traceCache
.
memoryChanges
.
length
-
1
]
var
lastMemoryChange
=
this
.
traceCache
.
memoryChanges
[
this
.
traceCache
.
memoryChanges
.
length
-
1
]
this
.
traceCache
.
pushContractCreationFromMemory
(
index
,
contractToken
,
this
.
trace
,
lastMemoryChange
)
this
.
traceCache
.
pushContractCreationFromMemory
(
index
,
contractToken
,
this
.
trace
,
lastMemoryChange
)
...
...
src/traceManagerUtil.js
View file @
24f0a13a
'use strict'
module
.
exports
=
{
module
.
exports
=
{
// util section
// util section
findLowerBound
:
function
(
target
,
changes
)
{
findLowerBound
:
function
(
target
,
changes
)
{
...
@@ -28,7 +29,7 @@ module.exports = {
...
@@ -28,7 +29,7 @@ module.exports = {
resolveCalledAddress
:
function
(
vmTraceIndex
,
trace
)
{
resolveCalledAddress
:
function
(
vmTraceIndex
,
trace
)
{
var
step
=
trace
[
vmTraceIndex
]
var
step
=
trace
[
vmTraceIndex
]
if
(
this
.
isCreateInstruction
(
step
))
{
if
(
this
.
isCreateInstruction
(
step
))
{
return
'(Contract Creation Code) '
+
vmTraceIndex
return
this
.
contractCreationToken
(
vmTraceIndex
)
}
else
if
(
this
.
isCallInstruction
(
step
))
{
}
else
if
(
this
.
isCallInstruction
(
step
))
{
var
stack
=
step
.
stack
// callcode, delegatecall, ...
var
stack
=
step
.
stack
// callcode, delegatecall, ...
return
stack
[
stack
.
length
-
2
]
return
stack
[
stack
.
length
-
2
]
...
@@ -60,5 +61,13 @@ module.exports = {
...
@@ -60,5 +61,13 @@ module.exports = {
}
else
{
}
else
{
return
false
return
false
}
}
},
contractCreationToken
:
function
(
index
)
{
return
'(Contract Creation - Step'
+
index
+
')'
},
isContractCreation
:
function
(
address
)
{
return
address
.
indexOf
(
'(Contract Creation - Step'
)
!==
-
1
}
}
}
}
src/traceRetriever.js
View file @
24f0a13a
'use strict'
'use strict'
var
traceManagerUtil
=
require
(
'./traceManagerUtil'
)
function
TraceRetriever
(
_web3
)
{
function
TraceRetriever
(
_web3
)
{
this
.
web3
=
_web3
this
.
web3
=
_web3
this
.
storages
=
{}
// contains all intial storage (by addresses)
this
.
storages
=
{}
// contains all intial storage (by addresses)
...
@@ -17,7 +18,7 @@ TraceRetriever.prototype.getTrace = function (txHash, callback) {
...
@@ -17,7 +18,7 @@ TraceRetriever.prototype.getTrace = function (txHash, callback) {
}
}
TraceRetriever
.
prototype
.
getStorage
=
function
(
tx
,
address
,
callback
)
{
TraceRetriever
.
prototype
.
getStorage
=
function
(
tx
,
address
,
callback
)
{
if
(
t
x
.
to
===
'(Contract Creation Code)'
||
address
.
indexOf
(
'(Contract Creation Code)'
)
!==
-
1
)
{
if
(
t
raceManagerUtil
.
isContractCreation
(
address
)
)
{
callback
(
null
,
{})
callback
(
null
,
{})
}
else
if
(
this
.
storages
[
address
])
{
}
else
if
(
this
.
storages
[
address
])
{
callback
(
null
,
this
.
storages
[
address
])
callback
(
null
,
this
.
storages
[
address
])
...
...
src/txBrowser.js
View file @
24f0a13a
'use strict'
'use strict'
var
React
=
require
(
'react'
)
var
React
=
require
(
'react'
)
var
style
=
require
(
'./basicStyles'
)
var
style
=
require
(
'./basicStyles'
)
var
traceManagerUtil
=
require
(
'./traceManagerUtil'
)
module
.
exports
=
React
.
createClass
({
module
.
exports
=
React
.
createClass
({
contextTypes
:
{
contextTypes
:
{
...
@@ -31,7 +32,7 @@ module.exports = React.createClass({
...
@@ -31,7 +32,7 @@ module.exports = React.createClass({
}
}
if
(
tx
)
{
if
(
tx
)
{
if
(
!
tx
.
to
)
{
if
(
!
tx
.
to
)
{
tx
.
to
=
'(Contract Creation Code)'
tx
.
to
=
traceManagerUtil
.
contractCreationToken
(
'0'
)
}
}
this
.
setState
({
from
:
tx
.
from
,
to
:
tx
.
to
,
hash
:
tx
.
hash
})
this
.
setState
({
from
:
tx
.
from
,
to
:
tx
.
to
,
hash
:
tx
.
hash
})
this
.
props
.
onNewTxRequested
(
this
.
state
.
blockNumber
,
parseInt
(
this
.
state
.
txNumber
),
tx
)
this
.
props
.
onNewTxRequested
(
this
.
state
.
blockNumber
,
parseInt
(
this
.
state
.
txNumber
),
tx
)
...
...
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