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
65c1d63d
Commit
65c1d63d
authored
Sep 03, 2020
by
aniket-engg
Committed by
Aniket
Sep 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more tests fixed
parent
58c1cfcd
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
31 deletions
+31
-31
decodeInfo.js
libs/remix-debug/src/solidity-decoder/decodeInfo.js
+1
-1
Enum.js
libs/remix-debug/src/solidity-decoder/types/Enum.js
+4
-4
sourceMappingDecoder.js
libs/remix-debug/src/source/sourceMappingDecoder.js
+4
-4
decodeInfo.js
libs/remix-debug/test/decoder/decodeInfo.js
+21
-21
sourceMappingDecoder.js
libs/remix-debug/test/sourceMappingDecoder.js
+1
-1
No files found.
libs/remix-debug/src/solidity-decoder/decodeInfo.js
View file @
65c1d63d
...
...
@@ -244,7 +244,7 @@ function getStructMembers (type, stateDefinitions, contractName, location) {
if
(
state
)
{
for
(
let
dec
of
state
.
stateDefinitions
)
{
if
(
dec
.
nodeType
===
'StructDefinition'
&&
type
===
contractName
+
'.'
+
dec
.
name
)
{
const
offsets
=
computeOffsets
(
dec
.
children
,
stateDefinitions
,
contractName
,
location
)
const
offsets
=
computeOffsets
(
dec
.
members
,
stateDefinitions
,
contractName
,
location
)
if
(
!
offsets
)
{
return
null
}
...
...
libs/remix-debug/src/solidity-decoder/types/Enum.js
View file @
65c1d63d
...
...
@@ -4,7 +4,7 @@ const ValueType = require('./ValueType')
class
Enum
extends
ValueType
{
constructor
(
enumDef
)
{
let
storageBytes
=
0
let
length
=
enumDef
.
children
.
length
let
length
=
enumDef
.
members
.
length
while
(
length
>
1
)
{
length
=
length
/
256
storageBytes
++
...
...
@@ -15,11 +15,11 @@ class Enum extends ValueType {
decodeValue
(
value
)
{
if
(
!
value
)
{
return
this
.
enumDef
.
children
[
0
].
attributes
.
name
return
this
.
enumDef
.
members
[
0
]
.
name
}
value
=
parseInt
(
value
,
16
)
if
(
this
.
enumDef
.
children
.
length
>
value
)
{
return
this
.
enumDef
.
children
[
value
].
attributes
.
name
if
(
this
.
enumDef
.
members
.
length
>
value
)
{
return
this
.
enumDef
.
members
[
value
]
.
name
}
return
'INVALID_ENUM<'
+
value
+
'>'
}
...
...
libs/remix-debug/src/source/sourceMappingDecoder.js
View file @
65c1d63d
...
...
@@ -152,7 +152,7 @@ function findNodeAtSourceLocation (astNodeType, sourceLocation, ast) {
return
true
}
if
(
nodeLocation
.
start
<=
sourceLocation
.
start
&&
nodeLocation
.
start
+
nodeLocation
.
length
>=
sourceLocation
.
start
+
sourceLocation
.
length
)
{
if
(
astNodeType
===
node
.
n
am
e
)
{
if
(
astNodeType
===
node
.
n
odeTyp
e
)
{
found
=
node
return
false
}
else
{
...
...
@@ -162,7 +162,7 @@ function findNodeAtSourceLocation (astNodeType, sourceLocation, ast) {
return
false
}
}
astWalker
.
walk
(
ast
.
legacyAST
,
callback
)
astWalker
.
walk
(
ast
.
ast
,
callback
)
return
found
}
...
...
@@ -176,7 +176,7 @@ function nodesAtPosition (astNodeType, position, ast) {
return
}
if
(
nodeLocation
.
start
<=
position
&&
nodeLocation
.
start
+
nodeLocation
.
length
>=
position
)
{
if
(
!
astNodeType
||
astNodeType
===
node
.
n
am
e
)
{
if
(
!
astNodeType
||
astNodeType
===
node
.
n
odeTyp
e
)
{
found
.
push
(
node
)
if
(
astNodeType
)
return
false
}
...
...
@@ -185,7 +185,7 @@ function nodesAtPosition (astNodeType, position, ast) {
return
false
}
}
astWalker
.
walk
(
ast
.
legacyAST
,
callback
)
astWalker
.
walk
(
ast
.
ast
,
callback
)
return
found
}
...
...
libs/remix-debug/test/decoder/decodeInfo.js
View file @
65c1d63d
...
...
@@ -17,51 +17,51 @@ tape('solidity', function (t) {
var
state
=
astHelper
.
extractStateDefinitions
(
'test.sol:contractUint'
,
output
.
sources
)
var
states
=
astHelper
.
extractStatesDefinitions
(
output
.
sources
)
var
stateDef
=
state
.
stateDefinitions
var
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
0
].
attributes
.
type
,
states
,
'contractUint'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
0
]))
var
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
0
].
typeDescriptions
.
typeString
,
states
,
'contractUint'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
0
]))
checkDecodeInfo
(
st
,
parsedType
,
1
,
1
,
'uint8'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
attributes
.
type
,
states
,
'contractUint'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
2
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
1
].
typeDescriptions
.
typeString
,
states
,
'contractUint'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
1
]))
checkDecodeInfo
(
st
,
parsedType
,
1
,
32
,
'uint256'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
3
].
attributes
.
type
,
states
,
'contractUint'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
3
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
typeDescriptions
.
typeString
,
states
,
'contractUint'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
2
]))
checkDecodeInfo
(
st
,
parsedType
,
1
,
32
,
'uint256'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
4
].
attributes
.
type
,
states
,
'contractUint'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
4
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
3
].
typeDescriptions
.
typeString
,
states
,
'contractUint'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
3
]))
checkDecodeInfo
(
st
,
parsedType
,
1
,
16
,
'bytes16'
)
state
=
astHelper
.
extractStateDefinitions
(
'test.sol:contractStructAndArray'
,
output
.
sources
)
stateDef
=
state
.
stateDefinitions
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
1
].
attributes
.
type
,
states
,
'contractStructAndArray'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
1
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
1
].
typeDescriptions
.
typeString
,
states
,
'contractStructAndArray'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
1
]))
checkDecodeInfo
(
st
,
parsedType
,
2
,
32
,
'struct contractStructAndArray.structDef'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
attributes
.
type
,
states
,
'contractStructAndArray'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
2
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
typeDescriptions
.
typeString
,
states
,
'contractStructAndArray'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
2
]))
checkDecodeInfo
(
st
,
parsedType
,
6
,
32
,
'struct contractStructAndArray.structDef[3]'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
3
].
attributes
.
type
,
states
,
'contractStructAndArray'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
3
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
3
].
typeDescriptions
.
typeString
,
states
,
'contractStructAndArray'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
3
]))
checkDecodeInfo
(
st
,
parsedType
,
2
,
32
,
'bytes12[4]'
)
state
=
astHelper
.
extractStateDefinitions
(
'test.sol:contractArray'
,
output
.
sources
)
stateDef
=
state
.
stateDefinitions
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
0
].
attributes
.
type
,
states
,
'contractArray'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
0
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
0
].
typeDescriptions
.
typeString
,
states
,
'contractArray'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
0
]))
checkDecodeInfo
(
st
,
parsedType
,
1
,
32
,
'uint32[5]'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
1
].
attributes
.
type
,
states
,
'contractArray'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
1
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
1
].
typeDescriptions
.
typeString
,
states
,
'contractArray'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
1
]))
checkDecodeInfo
(
st
,
parsedType
,
1
,
32
,
'int8[]'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
attributes
.
type
,
states
,
'contractArray'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
2
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
typeDescriptions
.
typeString
,
states
,
'contractArray'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
2
]))
checkDecodeInfo
(
st
,
parsedType
,
4
,
32
,
'int16[][3][][4]'
)
state
=
astHelper
.
extractStateDefinitions
(
'test.sol:contractEnum'
,
output
.
sources
)
stateDef
=
state
.
stateDefinitions
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
1
].
attributes
.
type
,
states
,
'contractEnum'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
1
].
typeDescriptions
.
typeString
,
states
,
'contractEnum'
)
checkDecodeInfo
(
st
,
parsedType
,
1
,
2
,
'enum'
)
state
=
astHelper
.
extractStateDefinitions
(
'test.sol:contractSmallVariable'
,
output
.
sources
)
stateDef
=
state
.
stateDefinitions
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
0
].
attributes
.
type
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
0
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
0
].
typeDescriptions
.
typeString
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
0
]))
checkDecodeInfo
(
st
,
parsedType
,
1
,
1
,
'int8'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
1
].
attributes
.
type
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
1
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
1
].
typeDescriptions
.
typeString
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
1
]))
checkDecodeInfo
(
st
,
parsedType
,
1
,
1
,
'uint8'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
attributes
.
type
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
2
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
typeDescriptions
.
typeString
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
2
]))
checkDecodeInfo
(
st
,
parsedType
,
1
,
2
,
'uint16'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
3
].
attributes
.
type
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
3
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
3
].
typeDescriptions
.
typeString
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
3
]))
checkDecodeInfo
(
st
,
parsedType
,
1
,
4
,
'int32'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
4
].
attributes
.
type
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
4
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
4
].
typeDescriptions
.
typeString
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
4
]))
checkDecodeInfo
(
st
,
parsedType
,
1
,
32
,
'uint256'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
5
].
attributes
.
type
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
5
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
5
].
typeDescriptions
.
typeString
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
5
]))
checkDecodeInfo
(
st
,
parsedType
,
1
,
2
,
'int16'
)
output
=
compiler
.
compile
(
compilerInput
(
simplecontracts
))
...
...
@@ -69,16 +69,16 @@ tape('solidity', function (t) {
state
=
astHelper
.
extractStateDefinitions
(
'test.sol:simpleContract'
,
output
.
sources
)
states
=
astHelper
.
extractStatesDefinitions
(
output
.
sources
)
stateDef
=
state
.
stateDefinitions
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
attributes
.
type
,
states
,
'simpleContract'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
2
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
typeDescriptions
.
typeString
,
states
,
'simpleContract'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
2
]))
checkDecodeInfo
(
st
,
parsedType
,
2
,
32
,
'struct simpleContract.structDef'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
3
].
attributes
.
type
,
states
,
'simpleContract'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
3
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
3
].
typeDescriptions
.
typeString
,
states
,
'simpleContract'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
3
]))
checkDecodeInfo
(
st
,
parsedType
,
6
,
32
,
'struct simpleContract.structDef[3]'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
4
].
attributes
.
type
,
states
,
'simpleContract'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
4
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
4
].
typeDescriptions
.
typeString
,
states
,
'simpleContract'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
4
]))
checkDecodeInfo
(
st
,
parsedType
,
1
,
1
,
'enum'
)
state
=
astHelper
.
extractStateDefinitions
(
'test.sol:test2'
,
output
.
sources
)
stateDef
=
state
.
stateDefinitions
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
0
].
attributes
.
type
,
states
,
'test1'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
0
]))
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
0
].
typeDescriptions
.
typeString
,
states
,
'test1'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
0
]))
checkDecodeInfo
(
st
,
parsedType
,
1
,
32
,
'struct test1.str'
)
state
=
stateDecoder
.
extractStateVariables
(
'test.sol:test2'
,
output
.
sources
)
...
...
libs/remix-debug/test/sourceMappingDecoder.js
View file @
65c1d63d
...
...
@@ -15,7 +15,7 @@ tape('SourceMappingDecoder', function (t) {
node
=
sourceMappingDecoder
.
findNodeAtInstructionIndex
(
'FunctionDefinition'
,
80
,
output
.
contracts
[
'test.sol'
][
'test'
].
evm
.
deployedBytecode
.
sourceMap
,
output
.
sources
[
'test.sol'
])
st
.
notEqual
(
node
,
null
)
if
(
node
)
{
st
.
equal
(
node
.
attributes
.
name
,
'f1'
)
st
.
equal
(
node
.
name
,
'f1'
)
}
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