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
d2da5fd6
Commit
d2da5fd6
authored
Jan 09, 2017
by
yann300
Browse files
Options
Browse Files
Download
Plain Diff
rename stackHeight stackDepth
parents
7d622f1c
d168f859
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
37 additions
and
37 deletions
+37
-37
localDecoder.js
src/solidity/localDecoder.js
+1
-1
Address.js
src/solidity/types/Address.js
+3
-3
ArrayType.js
src/solidity/types/ArrayType.js
+3
-3
Bool.js
src/solidity/types/Bool.js
+3
-3
DynamicByteArray.js
src/solidity/types/DynamicByteArray.js
+6
-6
Enum.js
src/solidity/types/Enum.js
+3
-3
FixedByteArray.js
src/solidity/types/FixedByteArray.js
+3
-3
Int.js
src/solidity/types/Int.js
+3
-3
StringType.js
src/solidity/types/StringType.js
+2
-2
Struct.js
src/solidity/types/Struct.js
+6
-6
Uint.js
src/solidity/types/Uint.js
+3
-3
internalCallTree.js
src/util/internalCallTree.js
+1
-1
No files found.
src/solidity/localDecoder.js
View file @
d2da5fd6
...
@@ -10,7 +10,7 @@ function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory) {
...
@@ -10,7 +10,7 @@ function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory) {
for
(
var
local
in
scope
.
locals
)
{
for
(
var
local
in
scope
.
locals
)
{
let
variable
=
scope
.
locals
[
local
]
let
variable
=
scope
.
locals
[
local
]
if
(
variable
.
type
.
decodeLocals
)
{
if
(
variable
.
type
.
decodeLocals
)
{
locals
[
variable
.
name
]
=
variable
.
type
.
decodeLocals
(
variable
.
stack
Height
,
stack
,
memory
)
locals
[
variable
.
name
]
=
variable
.
type
.
decodeLocals
(
variable
.
stack
Depth
,
stack
,
memory
)
}
else
{
}
else
{
locals
[
variable
.
name
]
=
''
locals
[
variable
.
name
]
=
''
}
}
...
...
src/solidity/types/Address.js
View file @
d2da5fd6
...
@@ -12,11 +12,11 @@ Address.prototype.decodeFromStorage = function (location, storageContent) {
...
@@ -12,11 +12,11 @@ Address.prototype.decodeFromStorage = function (location, storageContent) {
return
'0x'
+
value
.
toUpperCase
()
return
'0x'
+
value
.
toUpperCase
()
}
}
Address
.
prototype
.
decodeLocals
=
function
(
stack
Height
,
stack
,
memory
)
{
Address
.
prototype
.
decodeLocals
=
function
(
stack
Depth
,
stack
,
memory
)
{
if
(
stack
Height
>=
stack
.
length
)
{
if
(
stack
Depth
>=
stack
.
length
)
{
return
'0x0000000000000000000000000000000000000000'
return
'0x0000000000000000000000000000000000000000'
}
else
{
}
else
{
return
'0x'
+
util
.
extractHexByteSlice
(
stack
[
stack
.
length
-
1
-
stack
Height
],
this
.
storageBytes
,
0
)
return
'0x'
+
util
.
extractHexByteSlice
(
stack
[
stack
.
length
-
1
-
stack
Depth
],
this
.
storageBytes
,
0
)
}
}
}
}
...
...
src/solidity/types/ArrayType.js
View file @
d2da5fd6
...
@@ -54,11 +54,11 @@ ArrayType.prototype.decodeFromStorage = function (location, storageContent) {
...
@@ -54,11 +54,11 @@ ArrayType.prototype.decodeFromStorage = function (location, storageContent) {
}
}
}
}
ArrayType
.
prototype
.
decodeLocals
=
function
(
stack
Height
,
stack
,
memory
)
{
ArrayType
.
prototype
.
decodeLocals
=
function
(
stack
Depth
,
stack
,
memory
)
{
if
(
stack
.
length
-
1
<
stack
Height
)
{
if
(
stack
.
length
-
1
<
stack
Depth
)
{
return
[]
return
[]
}
else
{
// TODO manage decoding locals from storage
}
else
{
// TODO manage decoding locals from storage
var
offset
=
stack
[
stack
.
length
-
1
-
stack
Height
]
var
offset
=
stack
[
stack
.
length
-
1
-
stack
Depth
]
offset
=
2
*
parseInt
(
offset
,
16
)
offset
=
2
*
parseInt
(
offset
,
16
)
return
this
.
decodeFromMemory
(
offset
,
memory
)
return
this
.
decodeFromMemory
(
offset
,
memory
)
}
}
...
...
src/solidity/types/Bool.js
View file @
d2da5fd6
...
@@ -12,11 +12,11 @@ Bool.prototype.decodeFromStorage = function (location, storageContent) {
...
@@ -12,11 +12,11 @@ Bool.prototype.decodeFromStorage = function (location, storageContent) {
return
value
!==
'00'
return
value
!==
'00'
}
}
Bool
.
prototype
.
decodeLocals
=
function
(
stack
Height
,
stack
,
memory
)
{
Bool
.
prototype
.
decodeLocals
=
function
(
stack
Depth
,
stack
,
memory
)
{
if
(
stack
.
length
-
1
<
stack
Height
)
{
if
(
stack
.
length
-
1
<
stack
Depth
)
{
return
false
return
false
}
else
{
}
else
{
return
util
.
extractHexByteSlice
(
stack
[
stack
.
length
-
1
-
stack
Height
],
this
.
storageBytes
,
0
)
!==
'00'
return
util
.
extractHexByteSlice
(
stack
[
stack
.
length
-
1
-
stack
Depth
],
this
.
storageBytes
,
0
)
!==
'00'
}
}
}
}
...
...
src/solidity/types/DynamicByteArray.js
View file @
d2da5fd6
...
@@ -35,14 +35,14 @@ DynamicByteArray.prototype.decodeFromStorage = function (location, storageConten
...
@@ -35,14 +35,14 @@ DynamicByteArray.prototype.decodeFromStorage = function (location, storageConten
}
}
}
}
DynamicByteArray
.
prototype
.
decodeLocals
=
function
(
stack
Height
,
stack
,
memory
)
{
DynamicByteArray
.
prototype
.
decodeLocals
=
function
(
stack
Depth
,
stack
,
memory
)
{
if
(
stack
.
length
-
1
<
stack
Height
)
{
if
(
stack
.
length
-
1
<
stack
Depth
)
{
return
{
return
{
value
:
'0x'
,
value
:
'0x'
,
length
:
'0x0'
length
:
'0x0'
}
}
}
else
{
}
else
{
var
offset
=
stack
[
stack
.
length
-
1
-
stack
Height
]
var
offset
=
stack
[
stack
.
length
-
1
-
stack
Depth
]
offset
=
2
*
parseInt
(
offset
,
16
)
offset
=
2
*
parseInt
(
offset
,
16
)
return
this
.
decodeFromMemory
(
offset
,
memory
)
return
this
.
decodeFromMemory
(
offset
,
memory
)
}
}
...
@@ -57,14 +57,14 @@ DynamicByteArray.prototype.decodeFromMemory = function (offset, memory) {
...
@@ -57,14 +57,14 @@ DynamicByteArray.prototype.decodeFromMemory = function (offset, memory) {
}
}
}
}
DynamicByteArray
.
prototype
.
decodeLocals
=
function
(
stack
Height
,
stack
,
memory
)
{
DynamicByteArray
.
prototype
.
decodeLocals
=
function
(
stack
Depth
,
stack
,
memory
)
{
if
(
stack
.
length
-
1
<
stack
Height
)
{
if
(
stack
.
length
-
1
<
stack
Depth
)
{
return
{
return
{
value
:
'0x'
,
value
:
'0x'
,
length
:
'0x0'
length
:
'0x0'
}
}
}
else
{
}
else
{
var
offset
=
stack
[
stack
.
length
-
1
-
stack
Height
]
var
offset
=
stack
[
stack
.
length
-
1
-
stack
Depth
]
offset
=
2
*
parseInt
(
offset
,
16
)
offset
=
2
*
parseInt
(
offset
,
16
)
return
this
.
decodeFromMemory
(
offset
,
memory
)
return
this
.
decodeFromMemory
(
offset
,
memory
)
}
}
...
...
src/solidity/types/Enum.js
View file @
d2da5fd6
...
@@ -19,12 +19,12 @@ Enum.prototype.decodeFromStorage = function (location, storageContent) {
...
@@ -19,12 +19,12 @@ Enum.prototype.decodeFromStorage = function (location, storageContent) {
return
output
(
value
,
this
.
enumDef
)
return
output
(
value
,
this
.
enumDef
)
}
}
Enum
.
prototype
.
decodeLocals
=
function
(
stack
Height
,
stack
,
memory
)
{
Enum
.
prototype
.
decodeLocals
=
function
(
stack
Depth
,
stack
,
memory
)
{
var
defaultValue
=
0
var
defaultValue
=
0
if
(
stack
.
length
-
1
<
stack
Height
)
{
if
(
stack
.
length
-
1
<
stack
Depth
)
{
defaultValue
=
0
defaultValue
=
0
}
else
{
}
else
{
defaultValue
=
util
.
extractHexByteSlice
(
stack
[
stack
.
length
-
1
-
stack
Height
],
this
.
storageBytes
,
0
)
defaultValue
=
util
.
extractHexByteSlice
(
stack
[
stack
.
length
-
1
-
stack
Depth
],
this
.
storageBytes
,
0
)
defaultValue
=
parseInt
(
defaultValue
,
16
)
defaultValue
=
parseInt
(
defaultValue
,
16
)
}
}
return
output
(
defaultValue
,
this
.
enumDef
)
return
output
(
defaultValue
,
this
.
enumDef
)
...
...
src/solidity/types/FixedByteArray.js
View file @
d2da5fd6
...
@@ -12,11 +12,11 @@ FixedByteArray.prototype.decodeFromStorage = function (location, storageContent)
...
@@ -12,11 +12,11 @@ FixedByteArray.prototype.decodeFromStorage = function (location, storageContent)
return
'0x'
+
value
.
toUpperCase
()
return
'0x'
+
value
.
toUpperCase
()
}
}
FixedByteArray
.
prototype
.
decodeLocals
=
function
(
stack
Height
,
stack
,
memory
)
{
FixedByteArray
.
prototype
.
decodeLocals
=
function
(
stack
Depth
,
stack
,
memory
)
{
if
(
stack
.
length
-
1
<
stack
Height
)
{
if
(
stack
.
length
-
1
<
stack
Depth
)
{
return
'0x'
return
'0x'
}
else
{
}
else
{
var
value
=
stack
[
stack
.
length
-
1
-
stack
Height
]
var
value
=
stack
[
stack
.
length
-
1
-
stack
Depth
]
return
'0x'
+
value
.
substr
(
2
,
2
*
this
.
storageBytes
).
toUpperCase
()
return
'0x'
+
value
.
substr
(
2
,
2
*
this
.
storageBytes
).
toUpperCase
()
}
}
}
}
...
...
src/solidity/types/Int.js
View file @
d2da5fd6
...
@@ -11,11 +11,11 @@ Int.prototype.decodeFromStorage = function (location, storageContent) {
...
@@ -11,11 +11,11 @@ Int.prototype.decodeFromStorage = function (location, storageContent) {
return
util
.
decodeInt
(
location
,
storageContent
,
this
.
storageBytes
,
true
)
return
util
.
decodeInt
(
location
,
storageContent
,
this
.
storageBytes
,
true
)
}
}
Int
.
prototype
.
decodeLocals
=
function
(
stack
Height
,
stack
,
memory
)
{
Int
.
prototype
.
decodeLocals
=
function
(
stack
Depth
,
stack
,
memory
)
{
if
(
stack
Height
>=
stack
.
length
)
{
if
(
stack
Depth
>=
stack
.
length
)
{
return
'0'
return
'0'
}
else
{
}
else
{
return
util
.
decodeIntFromHex
(
stack
[
stack
.
length
-
1
-
stack
Height
].
replace
(
'0x'
,
''
),
32
,
true
)
return
util
.
decodeIntFromHex
(
stack
[
stack
.
length
-
1
-
stack
Depth
].
replace
(
'0x'
,
''
),
32
,
true
)
}
}
}
}
...
...
src/solidity/types/StringType.js
View file @
d2da5fd6
...
@@ -13,8 +13,8 @@ StringType.prototype.decodeFromStorage = function (location, storageContent) {
...
@@ -13,8 +13,8 @@ StringType.prototype.decodeFromStorage = function (location, storageContent) {
return
format
(
decoded
)
return
format
(
decoded
)
}
}
StringType
.
prototype
.
decodeLocals
=
function
(
stack
Height
,
stack
,
memory
)
{
StringType
.
prototype
.
decodeLocals
=
function
(
stack
Depth
,
stack
,
memory
)
{
var
decoded
=
this
.
dynamicBytes
.
decodeLocals
(
stack
Height
,
stack
,
memory
)
var
decoded
=
this
.
dynamicBytes
.
decodeLocals
(
stack
Depth
,
stack
,
memory
)
return
format
(
decoded
)
return
format
(
decoded
)
}
}
...
...
src/solidity/types/Struct.js
View file @
d2da5fd6
...
@@ -20,11 +20,11 @@ Struct.prototype.decodeFromStorage = function (location, storageContent) {
...
@@ -20,11 +20,11 @@ Struct.prototype.decodeFromStorage = function (location, storageContent) {
return
ret
return
ret
}
}
Struct
.
prototype
.
decodeLocals
=
function
(
stack
Height
,
stack
,
memory
)
{
Struct
.
prototype
.
decodeLocals
=
function
(
stack
Depth
,
stack
,
memory
)
{
if
(
stack
.
length
-
1
<
stack
Height
)
{
if
(
stack
.
length
-
1
<
stack
Depth
)
{
return
{}
return
{}
}
else
{
// TODO manage decoding locals from storage
}
else
{
// TODO manage decoding locals from storage
var
offset
=
stack
[
stack
.
length
-
1
-
stack
Height
]
var
offset
=
stack
[
stack
.
length
-
1
-
stack
Depth
]
offset
=
2
*
parseInt
(
offset
,
16
)
offset
=
2
*
parseInt
(
offset
,
16
)
return
this
.
decodeFromMemory
(
offset
,
memory
)
return
this
.
decodeFromMemory
(
offset
,
memory
)
}
}
...
@@ -45,11 +45,11 @@ Struct.prototype.decodeFromMemory = function (offset, memory) {
...
@@ -45,11 +45,11 @@ Struct.prototype.decodeFromMemory = function (offset, memory) {
return
ret
return
ret
}
}
Struct
.
prototype
.
decodeLocals
=
function
(
stack
Height
,
stack
,
memory
)
{
Struct
.
prototype
.
decodeLocals
=
function
(
stack
Depth
,
stack
,
memory
)
{
if
(
stack
.
length
-
1
<
stack
Height
)
{
if
(
stack
.
length
-
1
<
stack
Depth
)
{
return
{}
return
{}
}
else
{
// TODO manage decoding locals from storage
}
else
{
// TODO manage decoding locals from storage
var
offset
=
stack
[
stack
.
length
-
1
-
stack
Height
]
var
offset
=
stack
[
stack
.
length
-
1
-
stack
Depth
]
offset
=
2
*
parseInt
(
offset
,
16
)
offset
=
2
*
parseInt
(
offset
,
16
)
return
this
.
decodeFromMemory
(
offset
,
memory
)
return
this
.
decodeFromMemory
(
offset
,
memory
)
}
}
...
...
src/solidity/types/Uint.js
View file @
d2da5fd6
...
@@ -11,11 +11,11 @@ Uint.prototype.decodeFromStorage = function (location, storageContent) {
...
@@ -11,11 +11,11 @@ Uint.prototype.decodeFromStorage = function (location, storageContent) {
return
util
.
decodeInt
(
location
,
storageContent
,
this
.
storageBytes
,
false
)
return
util
.
decodeInt
(
location
,
storageContent
,
this
.
storageBytes
,
false
)
}
}
Uint
.
prototype
.
decodeLocals
=
function
(
stack
Height
,
stack
,
memory
)
{
Uint
.
prototype
.
decodeLocals
=
function
(
stack
Depth
,
stack
,
memory
)
{
if
(
stack
Height
>=
stack
.
length
)
{
if
(
stack
Depth
>=
stack
.
length
)
{
return
'0'
return
'0'
}
else
{
}
else
{
return
util
.
decodeIntFromHex
(
stack
[
stack
.
length
-
1
-
stack
Height
].
replace
(
'0x'
,
''
),
this
.
storageBytes
,
false
)
return
util
.
decodeIntFromHex
(
stack
[
stack
.
length
-
1
-
stack
Depth
].
replace
(
'0x'
,
''
),
this
.
storageBytes
,
false
)
}
}
}
}
...
...
src/util/internalCallTree.js
View file @
d2da5fd6
...
@@ -132,7 +132,7 @@ function includeVariableDeclaration (tree, step, sourceLocation, scopeId) {
...
@@ -132,7 +132,7 @@ function includeVariableDeclaration (tree, step, sourceLocation, scopeId) {
tree
.
scopes
[
scopeId
].
locals
[
variableDeclaration
.
attributes
.
name
]
=
{
tree
.
scopes
[
scopeId
].
locals
[
variableDeclaration
.
attributes
.
name
]
=
{
name
:
variableDeclaration
.
attributes
.
name
,
name
:
variableDeclaration
.
attributes
.
name
,
type
:
decodeInfo
.
parseType
(
variableDeclaration
.
attributes
.
type
,
states
,
contractName
),
type
:
decodeInfo
.
parseType
(
variableDeclaration
.
attributes
.
type
,
states
,
contractName
),
stack
Height
:
stack
.
leng
th
stack
Depth
:
stack
.
stackDep
th
}
}
}
}
})
})
...
...
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