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
92666bf9
Commit
92666bf9
authored
Jan 04, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use depth change to check for bas return (needed byt the js vm)
parent
ba9c610a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
20 deletions
+15
-20
traceAnalyser.js
src/trace/traceAnalyser.js
+1
-1
web3VmProvider.js
src/web3Provider/web3VmProvider.js
+14
-19
No files found.
src/trace/traceAnalyser.js
View file @
92666bf9
...
@@ -111,7 +111,7 @@ TraceAnalyser.prototype.buildDepth = function (index, step, tx, callStack, conte
...
@@ -111,7 +111,7 @@ TraceAnalyser.prototype.buildDepth = function (index, step, tx, callStack, conte
this
.
traceCache
.
pushSteps
(
index
,
context
.
currentCallIndex
)
this
.
traceCache
.
pushSteps
(
index
,
context
.
currentCallIndex
)
context
.
lastCallIndex
=
context
.
currentCallIndex
context
.
lastCallIndex
=
context
.
currentCallIndex
context
.
currentCallIndex
=
0
context
.
currentCallIndex
=
0
}
else
if
(
traceHelper
.
isReturnInstruction
(
step
)
||
traceHelper
.
isStopInstruction
(
step
)
||
outOfGas
)
{
}
else
if
(
traceHelper
.
isReturnInstruction
(
step
)
||
traceHelper
.
isStopInstruction
(
step
)
||
outOfGas
||
step
.
error
||
step
.
invalidDepthChange
)
{
if
(
index
+
1
<
this
.
trace
.
length
)
{
if
(
index
+
1
<
this
.
trace
.
length
)
{
callStack
.
pop
()
callStack
.
pop
()
this
.
traceCache
.
pushCall
(
step
,
index
+
1
,
null
,
callStack
.
slice
(
0
),
outOfGas
)
this
.
traceCache
.
pushCall
(
step
,
index
+
1
,
null
,
callStack
.
slice
(
0
),
outOfGas
)
...
...
src/web3Provider/web3VmProvider.js
View file @
92666bf9
...
@@ -2,8 +2,6 @@ var util = require('../helpers/util')
...
@@ -2,8 +2,6 @@ var util = require('../helpers/util')
var
uiutil
=
require
(
'../helpers/ui'
)
var
uiutil
=
require
(
'../helpers/ui'
)
var
traceHelper
=
require
(
'../helpers/traceHelper'
)
var
traceHelper
=
require
(
'../helpers/traceHelper'
)
var
Web3
=
require
(
'web3'
)
var
Web3
=
require
(
'web3'
)
var
fees
=
require
(
'ethereum-common'
)
var
ethutil
=
require
(
'ethereumjs-util'
)
function
web3VmProvider
()
{
function
web3VmProvider
()
{
var
self
=
this
var
self
=
this
...
@@ -14,6 +12,7 @@ function web3VmProvider () {
...
@@ -14,6 +12,7 @@ function web3VmProvider () {
this
.
processingHash
this
.
processingHash
this
.
processingAddress
this
.
processingAddress
this
.
processingIndex
this
.
processingIndex
this
.
previousDepth
=
0
this
.
incr
=
0
this
.
incr
=
0
this
.
eth
=
{}
this
.
eth
=
{}
this
.
debug
=
{}
this
.
debug
=
{}
...
@@ -48,7 +47,7 @@ web3VmProvider.prototype.releaseCurrentHash = function () {
...
@@ -48,7 +47,7 @@ web3VmProvider.prototype.releaseCurrentHash = function () {
return
ret
return
ret
}
}
web3VmProvider
.
prototype
.
txWillProcess
=
function
(
self
,
data
)
{
web3VmProvider
.
prototype
.
txWillProcess
=
function
(
self
,
data
)
{
self
.
incr
++
self
.
incr
++
self
.
processingHash
=
util
.
hexConvert
(
data
.
hash
())
self
.
processingHash
=
util
.
hexConvert
(
data
.
hash
())
self
.
vmTraces
[
self
.
processingHash
]
=
{
self
.
vmTraces
[
self
.
processingHash
]
=
{
...
@@ -88,13 +87,20 @@ web3VmProvider.prototype.txProcessed = function (self, data) {
...
@@ -88,13 +87,20 @@ web3VmProvider.prototype.txProcessed = function (self, data) {
}
}
this
.
processingIndex
=
null
this
.
processingIndex
=
null
this
.
processingAddress
=
null
this
.
processingAddress
=
null
this
.
previousDepth
=
0
}
}
web3VmProvider
.
prototype
.
pushTrace
=
function
(
self
,
data
)
{
web3VmProvider
.
prototype
.
pushTrace
=
function
(
self
,
data
)
{
var
depth
=
data
.
depth
+
1
// geth starts the depth from 1
if
(
!
self
.
processingHash
)
{
if
(
!
self
.
processingHash
)
{
console
.
log
(
'no tx processing'
)
console
.
log
(
'no tx processing'
)
return
return
}
}
if
(
this
.
previousDepth
>
depth
)
{
// returning from context, set error it is not STOP, RETURN
var
previousopcode
=
self
.
vmTraces
[
self
.
processingHash
].
structLogs
[
this
.
processingIndex
-
1
]
previousopcode
.
invalidDepthChange
=
previousopcode
.
op
!==
'RETURN'
&&
previousopcode
.
op
!==
'STOP'
}
var
step
=
{
var
step
=
{
stack
:
util
.
hexListConvert
(
data
.
stack
),
stack
:
util
.
hexListConvert
(
data
.
stack
),
memory
:
util
.
formatMemory
(
data
.
memory
),
memory
:
util
.
formatMemory
(
data
.
memory
),
...
@@ -102,23 +108,11 @@ web3VmProvider.prototype.pushTrace = function (self, data) {
...
@@ -102,23 +108,11 @@ web3VmProvider.prototype.pushTrace = function (self, data) {
op
:
data
.
opcode
.
name
,
op
:
data
.
opcode
.
name
,
pc
:
data
.
pc
,
pc
:
data
.
pc
,
gasCost
:
data
.
opcode
.
fee
.
toString
(),
gasCost
:
data
.
opcode
.
fee
.
toString
(),
gas
:
data
.
gasLeft
.
toString
()
gas
:
data
.
gasLeft
.
toString
(),
}
depth
:
depth
,
if
(
data
.
opcode
.
name
===
'SSTORE'
)
{
error
:
data
.
error
===
false
?
undefined
:
data
.
error
var
currentStorage
=
this
.
storageCache
[
this
.
processingHash
][
this
.
processingAddress
]
var
key
=
step
.
stack
[
step
.
stack
.
length
-
1
]
var
value
=
step
.
stack
[
step
.
stack
.
length
-
2
]
value
=
util
.
hexToIntArray
(
value
)
value
=
ethutil
.
unpad
(
value
)
if
(
value
.
length
===
0
)
{
data
.
opcode
.
fee
=
fees
.
sstoreResetGas
.
v
}
else
if
(
currentStorage
[
key
]
===
undefined
)
{
data
.
opcode
.
fee
=
fees
.
sstoreSetGas
.
v
}
else
{
data
.
opcode
.
fee
=
fees
.
sstoreResetGas
.
v
}
step
.
gasCost
=
data
.
opcode
.
fee
}
}
console
.
log
(
JSON
.
stringify
(
step
))
self
.
vmTraces
[
self
.
processingHash
].
structLogs
.
push
(
step
)
self
.
vmTraces
[
self
.
processingHash
].
structLogs
.
push
(
step
)
if
(
traceHelper
.
newContextStorage
(
step
))
{
if
(
traceHelper
.
newContextStorage
(
step
))
{
if
(
step
.
op
===
'CREATE'
)
{
if
(
step
.
op
===
'CREATE'
)
{
...
@@ -134,6 +128,7 @@ web3VmProvider.prototype.pushTrace = function (self, data) {
...
@@ -134,6 +128,7 @@ web3VmProvider.prototype.pushTrace = function (self, data) {
}
}
}
}
this
.
processingIndex
++
this
.
processingIndex
++
this
.
previousDepth
=
depth
}
}
web3VmProvider
.
prototype
.
getCode
=
function
(
address
,
cb
)
{
web3VmProvider
.
prototype
.
getCode
=
function
(
address
,
cb
)
{
...
...
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