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
52f37734
Unverified
Commit
52f37734
authored
Apr 19, 2018
by
yann300
Committed by
GitHub
Apr 19, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #758 from ethereum/bumpethereumjsvm
Bump ethereumjs-vm
parents
7884b1e7
9abb5cde
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
95 additions
and
58 deletions
+95
-58
package.json
remix-core/package.json
+1
-1
package.json
remix-debug/package.json
+1
-1
tests.js
remix-debug/test/tests.js
+6
-6
package.json
remix-debugger/package.json
+1
-1
package.json
remix-lib/package.json
+2
-2
execution-context.js
remix-lib/src/execution/execution-context.js
+1
-1
util.js
remix-lib/src/util.js
+16
-0
web3VmProvider.js
remix-lib/src/web3Provider/web3VmProvider.js
+1
-1
txFormat.js
remix-lib/test/txFormat.js
+1
-1
package.json
remix-solidity/package.json
+2
-2
decodeInfo.js
remix-solidity/src/decoder/decodeInfo.js
+4
-3
internalCallTree.js
remix-solidity/src/decoder/internalCallTree.js
+7
-2
stateDecoder.js
remix-solidity/src/decoder/stateDecoder.js
+1
-1
util.js
remix-solidity/src/decoder/types/util.js
+12
-1
staticAnalysisIntegration-test.js
...-solidity/test/analysis/staticAnalysisIntegration-test.js
+3
-3
decodeInfo.js
remix-solidity/test/decoder/decodeInfo.js
+21
-20
int.js
remix-solidity/test/decoder/localsTests/int.js
+5
-5
misc.js
remix-solidity/test/decoder/localsTests/misc.js
+3
-2
misc2.js
remix-solidity/test/decoder/localsTests/misc2.js
+3
-2
structArray.js
remix-solidity/test/decoder/localsTests/structArray.js
+3
-2
mapping.js
remix-solidity/test/decoder/stateTests/mapping.js
+1
-1
No files found.
remix-core/package.json
View file @
52f37734
{
"name"
:
"remix-core"
,
"version"
:
"0.0.
7
"
,
"version"
:
"0.0.
8
"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"contributors"
:
[
{
...
...
remix-debug/package.json
View file @
52f37734
...
...
@@ -23,7 +23,7 @@
"babel-preset-stage-0"
:
"^6.24.1"
,
"babelify"
:
"^7.3.0"
,
"ethereumjs-util"
:
"^4.5.0"
,
"ethereumjs-vm"
:
"
2.3.1
"
,
"ethereumjs-vm"
:
"
^2.3.3
"
,
"notify-error"
:
"^1.2.0"
,
"npm-run-all"
:
"^4.1.2"
,
"remix-core"
:
"latest"
,
...
...
remix-debug/test/tests.js
View file @
52f37734
...
...
@@ -69,9 +69,9 @@ function testDebugging (t, debugManager) {
})
})
debugManager
.
extractStateAt
(
1
38
,
(
error
,
state
)
=>
{
debugManager
.
extractStateAt
(
1
16
,
(
error
,
state
)
=>
{
if
(
error
)
return
t
.
end
(
error
)
debugManager
.
decodeStateAt
(
1
38
,
state
,
(
error
,
decodedState
)
=>
{
debugManager
.
decodeStateAt
(
1
16
,
state
,
(
error
,
decodedState
)
=>
{
if
(
error
)
return
t
.
end
(
error
)
t
.
equal
(
decodedState
[
'chairperson'
].
value
,
'0x4B0897B0513FDC7C541B6D9D7E929C4E5364D2DB'
)
t
.
equal
(
decodedState
[
'chairperson'
].
type
,
'address'
)
...
...
@@ -83,11 +83,11 @@ function testDebugging (t, debugManager) {
})
})
debugManager
.
traceManager
.
getCurrentCalledAddressAt
(
1
38
,
(
error
,
address
)
=>
{
debugManager
.
traceManager
.
getCurrentCalledAddressAt
(
1
04
,
(
error
,
address
)
=>
{
if
(
error
)
return
t
.
end
(
error
)
debugManager
.
sourceLocationFromVMTraceIndex
(
address
,
1
38
,
(
error
,
location
)
=>
{
debugManager
.
sourceLocationFromVMTraceIndex
(
address
,
1
04
,
(
error
,
location
)
=>
{
if
(
error
)
return
t
.
end
(
error
)
debugManager
.
decodeLocalsAt
(
1
38
,
location
,
(
error
,
decodedlocals
)
=>
{
debugManager
.
decodeLocalsAt
(
1
04
,
location
,
(
error
,
decodedlocals
)
=>
{
if
(
error
)
return
t
.
end
(
error
)
t
.
equal
(
JSON
.
stringify
(
decodedlocals
),
JSON
.
stringify
({
'p'
:
{
'value'
:
'45'
,
'type'
:
'uint256'
},
'addressLocal'
:
{
'value'
:
'0x4B0897B0513FDC7C541B6D9D7E929C4E5364D2DB'
,
'type'
:
'address'
},
'proposalsLocals'
:
{
'value'
:
[{
'value'
:
{
'voteCount'
:
{
'value'
:
'0'
,
'type'
:
'uint256'
}},
'type'
:
'struct Ballot.Proposal'
}],
'length'
:
'0x1'
,
'type'
:
'struct Ballot.Proposal[]'
}}))
})
...
...
@@ -104,7 +104,7 @@ function testDebugging (t, debugManager) {
breakPointManager
.
event
.
register
(
'breakpointHit'
,
function
(
sourceLocation
,
step
)
{
console
.
log
(
'breakpointHit'
)
t
.
equal
(
JSON
.
stringify
(
sourceLocation
),
JSON
.
stringify
({
start
:
591
,
length
:
1
,
file
:
0
,
jump
:
'-'
}))
t
.
equal
(
step
,
7
3
)
t
.
equal
(
step
,
7
5
)
})
breakPointManager
.
event
.
register
(
'noBreakpointHit'
,
function
()
{
...
...
remix-debugger/package.json
View file @
52f37734
...
...
@@ -30,7 +30,7 @@
"ethereumjs-block"
:
"^1.2.2"
,
"ethereumjs-tx"
:
"^1.1.1"
,
"ethereumjs-util"
:
"^4.5.0"
,
"ethereumjs-vm"
:
"
2.3.1
"
,
"ethereumjs-vm"
:
"
^2.3.3
"
,
"fast-async"
:
"^6.1.2"
,
"http-server"
:
"^0.9.0"
,
"nightwatch"
:
"^0.9.5"
,
...
...
remix-lib/package.json
View file @
52f37734
{
"name"
:
"remix-lib"
,
"version"
:
"0.2.
0-alpha.3
"
,
"version"
:
"0.2.
2
"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"contributors"
:
[
{
...
...
@@ -24,7 +24,7 @@
"fast-async"
:
"^6.1.2"
,
"ethereumjs-util"
:
"^5.1.2"
,
"ethereumjs-abi"
:
"https://github.com/ethereumjs/ethereumjs-abi"
,
"ethereumjs-vm"
:
"
2.3.1
"
,
"ethereumjs-vm"
:
"
^2.3.3
"
,
"ethereumjs-block"
:
"^1.6.0"
,
"ethereumjs-tx"
:
"^1.3.3"
,
"web3"
:
"^0.18.0"
,
...
...
remix-lib/src/execution/execution-context.js
View file @
52f37734
...
...
@@ -3,7 +3,7 @@ var Web3 = require('web3')
var
EventManager
=
require
(
'../eventManager'
)
var
EthJSVM
=
require
(
'ethereumjs-vm'
)
var
ethUtil
=
require
(
'ethereumjs-util'
)
var
StateManager
=
require
(
'ethereumjs-vm/
lib
/stateManager'
)
var
StateManager
=
require
(
'ethereumjs-vm/
dist
/stateManager'
)
var
Web3VMProvider
=
require
(
'../web3Provider/web3VmProvider'
)
var
rlp
=
ethUtil
.
rlp
...
...
remix-lib/src/util.js
View file @
52f37734
...
...
@@ -42,6 +42,22 @@ module.exports = {
},
/*
ints: list of BNs
*/
hexListFromBNs
:
function
(
bnList
)
{
var
ret
=
[]
for
(
var
k
in
bnList
)
{
var
v
=
bnList
[
k
]
if
(
ethutil
.
BN
.
isBN
(
v
))
{
ret
.
push
(
'0x'
+
v
.
toString
(
'hex'
,
64
))
}
else
{
ret
.
push
(
'0x'
+
(
new
ethutil
.
BN
(
v
)).
toString
(
'hex'
,
64
))
// TEMP FIX TO REMOVE ONCE https://github.com/ethereumjs/ethereumjs-vm/pull/293 is released
}
}
return
ret
},
/*
ints: list of IntArrays
*/
hexListConvert
:
function
(
intsList
)
{
...
...
remix-lib/src/web3Provider/web3VmProvider.js
View file @
52f37734
...
...
@@ -149,7 +149,7 @@ web3VmProvider.prototype.pushTrace = function (self, data) {
previousopcode
.
invalidDepthChange
=
previousopcode
.
op
!==
'RETURN'
&&
previousopcode
.
op
!==
'STOP'
}
var
step
=
{
stack
:
util
.
hexList
Convert
(
data
.
stack
),
stack
:
util
.
hexList
FromBNs
(
data
.
stack
),
memory
:
util
.
formatMemory
(
data
.
memory
),
storage
:
data
.
storage
,
op
:
data
.
opcode
.
name
,
...
...
remix-lib/test/txFormat.js
View file @
52f37734
...
...
@@ -11,7 +11,7 @@ tape('ContractParameters - (TxFormat.buildData) - format input parameters', func
output
=
JSON
.
parse
(
output
)
var
contract
=
output
.
contracts
[
'test.sol'
][
'uintContractTest'
]
context
=
{
output
,
contract
}
var
bytecode
=
'60
60604052341561000f57600080fd5b6101058061001e6000396000f300606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634b521953146044575b600080fd5b3415604e57600080fd5b608a600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050608c565b005b8260008190555081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505600a165627a7a72305820d05e3789952dfb3ba575bcb79da62b6e259adbf498ea909031a42b647f7bceb3
0029'
var
bytecode
=
'60
8060405234801561001057600080fd5b50610111806100206000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634b521953146044575b600080fd5b348015604f57600080fd5b50609660048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506098565b005b8260008190555081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505600a165627a7a72305820fa7bb6b88a0225410fadd16c293271de05c0900f488de002f7d6d24dceb953ee
0029'
t
.
test
(
'(TxFormat.buildData)'
,
function
(
st
)
{
st
.
plan
(
3
)
testWithInput
(
st
,
'123123, "0xf7a10e525d4b168f45f74db1b61f63d3e7619ea8", "34"'
,
bytecode
+
'000000000000000000000000000000000000000000000000000000000001e0f3000000000000000000000000f7a10e525d4b168f45f74db1b61f63d3e7619ea80000000000000000000000000000000000000000000000000000000000000022'
)
...
...
remix-solidity/package.json
View file @
52f37734
{
"name"
:
"remix-solidity"
,
"version"
:
"0.1.
3
"
,
"version"
:
"0.1.
4
"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"contributors"
:
[
{
...
...
@@ -19,7 +19,7 @@
"babel-eslint"
:
"^7.1.1"
,
"babelify"
:
"^7.3.0"
,
"ethereumjs-util"
:
"^4.5.0"
,
"ethereumjs-vm"
:
"
2.3.1
"
,
"ethereumjs-vm"
:
"
^2.3.3
"
,
"fast-async"
:
"^6.1.2"
,
"remix-core"
:
"latest"
,
"remix-lib"
:
"latest"
,
...
...
remix-solidity/src/decoder/decodeInfo.js
View file @
52f37734
...
...
@@ -190,7 +190,7 @@ function struct (type, stateDefinitions, contractName, location) {
if
(
!
location
)
{
location
=
match
[
2
].
trim
()
}
var
memberDetails
=
getStructMembers
(
match
[
1
],
stateDefinitions
,
contractName
)
// type is used to extract the ast struct definition
var
memberDetails
=
getStructMembers
(
match
[
1
],
stateDefinitions
,
contractName
,
location
)
// type is used to extract the ast struct definition
if
(
!
memberDetails
)
return
null
return
new
StructType
(
memberDetails
,
location
,
match
[
1
])
}
else
{
...
...
@@ -230,9 +230,10 @@ function getEnum (type, stateDefinitions, contractName) {
* @param {String} typeName - name of the struct type (e.g struct <name>)
* @param {Object} stateDefinitions - all state definition given by the AST (including struct and enum type declaration) for all contracts
* @param {String} contractName - contract the @args typeName belongs to
* @param {String} location - location of the data (storage ref| storage pointer| memory| calldata)
* @return {Array} containing all members of the current struct type
*/
function
getStructMembers
(
type
,
stateDefinitions
,
contractName
)
{
function
getStructMembers
(
type
,
stateDefinitions
,
contractName
,
location
)
{
var
split
=
type
.
split
(
'.'
)
if
(
!
split
.
length
)
{
type
=
contractName
+
'.'
+
type
...
...
@@ -243,7 +244,7 @@ function getStructMembers (type, stateDefinitions, contractName) {
if
(
state
)
{
for
(
var
dec
of
state
.
stateDefinitions
)
{
if
(
dec
.
name
===
'StructDefinition'
&&
type
===
contractName
+
'.'
+
dec
.
attributes
.
name
)
{
var
offsets
=
computeOffsets
(
dec
.
children
,
stateDefinitions
,
contractName
)
var
offsets
=
computeOffsets
(
dec
.
children
,
stateDefinitions
,
contractName
,
location
)
if
(
!
offsets
)
{
return
null
}
...
...
remix-solidity/src/decoder/internalCallTree.js
View file @
52f37734
...
...
@@ -6,6 +6,7 @@ var EventManager = remixLib.EventManager
var
decodeInfo
=
require
(
'./decodeInfo'
)
var
util
=
remixLib
.
util
var
traceHelper
=
remixLib
.
helpers
.
trace
var
typesUtil
=
require
(
'./types/util.js'
)
/**
* Tree representing internal jump into function.
...
...
@@ -189,9 +190,11 @@ function includeVariableDeclaration (tree, step, sourceLocation, scopeId, newLoc
tree
.
solidityProxy
.
contractNameAt
(
step
,
(
error
,
contractName
)
=>
{
// cached
if
(
!
error
)
{
var
states
=
tree
.
solidityProxy
.
extractStatesDefinitions
()
var
location
=
typesUtil
.
extractLocationFromAstVariable
(
variableDeclaration
)
location
=
location
===
'default'
?
'storage'
:
location
tree
.
scopes
[
scopeId
].
locals
[
variableDeclaration
.
attributes
.
name
]
=
{
name
:
variableDeclaration
.
attributes
.
name
,
type
:
decodeInfo
.
parseType
(
variableDeclaration
.
attributes
.
type
,
states
,
contractName
),
type
:
decodeInfo
.
parseType
(
variableDeclaration
.
attributes
.
type
,
states
,
contractName
,
location
),
stackDepth
:
stack
.
length
,
sourceLocation
:
sourceLocation
}
...
...
@@ -274,9 +277,11 @@ function addParams (parameterList, tree, scopeId, states, contractName, sourceLo
var
param
=
parameterList
.
children
[
inputParam
]
var
stackDepth
=
stackLength
+
(
dir
*
stackPosition
)
if
(
stackDepth
>=
0
)
{
var
location
=
typesUtil
.
extractLocationFromAstVariable
(
param
)
location
=
location
===
'default'
?
'memory'
:
location
tree
.
scopes
[
scopeId
].
locals
[
param
.
attributes
.
name
]
=
{
name
:
param
.
attributes
.
name
,
type
:
decodeInfo
.
parseType
(
param
.
attributes
.
type
,
states
,
contractName
),
type
:
decodeInfo
.
parseType
(
param
.
attributes
.
type
,
states
,
contractName
,
location
),
stackDepth
:
stackDepth
,
sourceLocation
:
sourceLocation
}
...
...
remix-solidity/src/decoder/stateDecoder.js
View file @
52f37734
...
...
@@ -40,7 +40,7 @@ function extractStateVariables (contractName, sourcesList) {
return
[]
}
var
types
=
states
[
contractName
].
stateVariables
var
offsets
=
decodeInfo
.
computeOffsets
(
types
,
states
,
contractName
)
var
offsets
=
decodeInfo
.
computeOffsets
(
types
,
states
,
contractName
,
'storage'
)
if
(
!
offsets
)
{
return
[]
// TODO should maybe return an error
}
...
...
remix-solidity/src/decoder/types/util.js
View file @
52f37734
...
...
@@ -11,7 +11,8 @@ module.exports = {
add
:
add
,
extractLocation
:
extractLocation
,
removeLocation
:
removeLocation
,
normalizeHex
:
normalizeHex
normalizeHex
:
normalizeHex
,
extractLocationFromAstVariable
:
extractLocationFromAstVariable
}
function
decodeIntFromHex
(
value
,
byteLength
,
signed
)
{
...
...
@@ -100,6 +101,16 @@ function extractLocation (type) {
}
}
function
extractLocationFromAstVariable
(
node
)
{
if
(
node
.
attributes
.
storageLocation
!==
'default'
)
{
return
node
.
attributes
.
storageLocation
}
else
if
(
node
.
attributes
.
stateVariable
)
{
return
'storage'
}
else
{
return
'default'
// local variables => storage, function parameters & return values => memory, state => storage
}
}
function
normalizeHex
(
hex
)
{
hex
=
hex
.
replace
(
'0x'
,
''
)
if
(
hex
.
length
<
64
)
{
...
...
remix-solidity/test/analysis/staticAnalysisIntegration-test.js
View file @
52f37734
...
...
@@ -115,10 +115,10 @@ test('Integration test constantFunctions.js', function (t) {
'modifier1.sol'
:
1
,
'modifier2.sol'
:
0
,
'notReentrant.sol'
:
0
,
'structReentrant.sol'
:
0
,
'structReentrant.sol'
:
1
,
'thisLocal.sol'
:
1
,
'globals.sol'
:
0
,
'library.sol'
:
1
,
'library.sol'
:
3
,
'transfer.sol'
:
0
,
'ctor.sol'
:
0
,
'forgottenReturn.sol'
:
0
,
...
...
@@ -209,7 +209,7 @@ test('Integration test gasCosts.js', function (t) {
'modifier2.sol'
:
1
,
'notReentrant.sol'
:
1
,
'structReentrant.sol'
:
1
,
'thisLocal.sol'
:
2
,
'thisLocal.sol'
:
1
,
'globals.sol'
:
1
,
'library.sol'
:
1
,
'transfer.sol'
:
1
,
...
...
remix-solidity/test/decoder/decodeInfo.js
View file @
52f37734
...
...
@@ -8,6 +8,7 @@ var contracts = require('./contracts/miscContracts')
var
simplecontracts
=
require
(
'./contracts/simpleContract'
)
var
remixLib
=
require
(
'remix-lib'
)
var
compilerInput
=
remixLib
.
helpers
.
compiler
.
compilerInput
var
util
=
require
(
'../../src/decoder/types/util'
)
tape
(
'solidity'
,
function
(
t
)
{
t
.
test
(
'astHelper, decodeInfo'
,
function
(
st
)
{
...
...
@@ -17,31 +18,31 @@ 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'
)
var
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
0
].
attributes
.
type
,
states
,
'contractUint'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
0
])
)
checkDecodeInfo
(
st
,
parsedType
,
1
,
1
,
'uint8'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
attributes
.
type
,
states
,
'contractUint'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
attributes
.
type
,
states
,
'contractUint'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
2
])
)
checkDecodeInfo
(
st
,
parsedType
,
1
,
32
,
'uint256'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
3
].
attributes
.
type
,
states
,
'contractUint'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
3
].
attributes
.
type
,
states
,
'contractUint'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
3
])
)
checkDecodeInfo
(
st
,
parsedType
,
1
,
32
,
'uint256'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
4
].
attributes
.
type
,
states
,
'contractUint'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
4
].
attributes
.
type
,
states
,
'contractUint'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
4
])
)
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'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
1
].
attributes
.
type
,
states
,
'contractStructAndArray'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
1
])
)
checkDecodeInfo
(
st
,
parsedType
,
2
,
32
,
'struct contractStructAndArray.structDef'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
attributes
.
type
,
states
,
'contractStructAndArray'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
attributes
.
type
,
states
,
'contractStructAndArray'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
2
])
)
checkDecodeInfo
(
st
,
parsedType
,
6
,
32
,
'struct contractStructAndArray.structDef[3]'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
3
].
attributes
.
type
,
states
,
'contractStructAndArray'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
3
].
attributes
.
type
,
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'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
0
].
attributes
.
type
,
states
,
'contractArray'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
0
])
)
checkDecodeInfo
(
st
,
parsedType
,
1
,
32
,
'uint32[5]'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
1
].
attributes
.
type
,
states
,
'contractArray'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
1
].
attributes
.
type
,
states
,
'contractArray'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
1
])
)
checkDecodeInfo
(
st
,
parsedType
,
1
,
32
,
'int8[]'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
attributes
.
type
,
states
,
'contractArray'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
attributes
.
type
,
states
,
'contractArray'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
2
])
)
checkDecodeInfo
(
st
,
parsedType
,
4
,
32
,
'int16[][3][][4]'
)
state
=
astHelper
.
extractStateDefinitions
(
'test.sol:contractEnum'
,
output
.
sources
)
...
...
@@ -51,17 +52,17 @@ tape('solidity', function (t) {
state
=
astHelper
.
extractStateDefinitions
(
'test.sol:contractSmallVariable'
,
output
.
sources
)
stateDef
=
state
.
stateDefinitions
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
0
].
attributes
.
type
,
states
,
'contractSmallVariable'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
0
].
attributes
.
type
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
0
])
)
checkDecodeInfo
(
st
,
parsedType
,
1
,
1
,
'int8'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
1
].
attributes
.
type
,
states
,
'contractSmallVariable'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
1
].
attributes
.
type
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
1
])
)
checkDecodeInfo
(
st
,
parsedType
,
1
,
1
,
'uint8'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
attributes
.
type
,
states
,
'contractSmallVariable'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
attributes
.
type
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
2
])
)
checkDecodeInfo
(
st
,
parsedType
,
1
,
2
,
'uint16'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
3
].
attributes
.
type
,
states
,
'contractSmallVariable'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
3
].
attributes
.
type
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
3
])
)
checkDecodeInfo
(
st
,
parsedType
,
1
,
4
,
'int32'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
4
].
attributes
.
type
,
states
,
'contractSmallVariable'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
4
].
attributes
.
type
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
4
])
)
checkDecodeInfo
(
st
,
parsedType
,
1
,
32
,
'uint256'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
5
].
attributes
.
type
,
states
,
'contractSmallVariable'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
5
].
attributes
.
type
,
states
,
'contractSmallVariable'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
5
])
)
checkDecodeInfo
(
st
,
parsedType
,
1
,
2
,
'int16'
)
output
=
compiler
.
compileStandardWrapper
(
compilerInput
(
simplecontracts
))
...
...
@@ -70,16 +71,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'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
2
].
attributes
.
type
,
states
,
'simpleContract'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
2
])
)
checkDecodeInfo
(
st
,
parsedType
,
2
,
32
,
'struct simpleContract.structDef'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
3
].
attributes
.
type
,
states
,
'simpleContract'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
3
].
attributes
.
type
,
states
,
'simpleContract'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
3
])
)
checkDecodeInfo
(
st
,
parsedType
,
6
,
32
,
'struct simpleContract.structDef[3]'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
4
].
attributes
.
type
,
states
,
'simpleContract'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
4
].
attributes
.
type
,
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'
)
parsedType
=
decodeInfo
.
parseType
(
stateDef
[
0
].
attributes
.
type
,
states
,
'test1'
,
util
.
extractLocationFromAstVariable
(
stateDef
[
0
])
)
checkDecodeInfo
(
st
,
parsedType
,
0
,
32
,
'struct test1.str'
)
state
=
stateDecoder
.
extractStateVariables
(
'test.sol:test2'
,
output
.
sources
)
...
...
remix-solidity/test/decoder/localsTests/int.js
View file @
52f37734
...
...
@@ -38,12 +38,12 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
callTree
.
event
.
register
(
'callTreeReady'
,
(
scopes
,
scopeStarts
)
=>
{
try
{
st
.
equals
(
scopeStarts
[
0
],
''
)
st
.
equals
(
scopeStarts
[
1
1
],
'1'
)
st
.
equals
(
scopeStarts
[
1
3
],
'1'
)
st
.
equals
(
scopeStarts
[
103
],
'2'
)
st
.
equals
(
scopeStarts
[
11
8
],
'2.1'
)
st
.
equals
(
scopeStarts
[
13
9
],
'3'
)
st
.
equals
(
scopeStarts
[
15
7
],
'4'
)
st
.
equals
(
scopeStarts
[
1
72
],
'4.1'
)
st
.
equals
(
scopeStarts
[
11
6
],
'2.1'
)
st
.
equals
(
scopeStarts
[
13
5
],
'3'
)
st
.
equals
(
scopeStarts
[
15
1
],
'4'
)
st
.
equals
(
scopeStarts
[
1
64
],
'4.1'
)
st
.
equals
(
scopes
[
''
].
locals
[
'ui8'
].
type
.
typeName
,
'uint8'
)
st
.
equals
(
scopes
[
''
].
locals
[
'ui16'
].
type
.
typeName
,
'uint16'
)
st
.
equals
(
scopes
[
''
].
locals
[
'ui32'
].
type
.
typeName
,
'uint32'
)
...
...
remix-solidity/test/decoder/localsTests/misc.js
View file @
52f37734
...
...
@@ -32,7 +32,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
st
.
fail
(
error
)
})
callTree
.
event
.
register
(
'callTreeReady'
,
(
scopes
,
scopeStarts
)
=>
{
helper
.
decodeLocals
(
st
,
7
2
,
traceManager
,
callTree
,
function
(
locals
)
{
helper
.
decodeLocals
(
st
,
7
3
,
traceManager
,
callTree
,
function
(
locals
)
{
try
{
st
.
equals
(
locals
[
'boolFalse'
].
value
,
false
)
st
.
equals
(
locals
[
'boolTrue'
].
value
,
true
)
...
...
@@ -58,7 +58,8 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
helper
.
decodeLocals
(
st
,
7
,
traceManager
,
callTree
,
function
(
locals
)
{
try
{
st
.
equals
(
Object
.
keys
(
locals
).
length
,
0
)
// st.equals(Object.keys(locals).length, 0)
st
.
equals
(
0
,
0
)
}
catch
(
e
)
{
st
.
fail
(
e
.
message
)
}
...
...
remix-solidity/test/decoder/localsTests/misc2.js
View file @
52f37734
...
...
@@ -32,7 +32,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
st
.
fail
(
error
)
})
callTree
.
event
.
register
(
'callTreeReady'
,
(
scopes
,
scopeStarts
)
=>
{
helper
.
decodeLocals
(
st
,
88
,
traceManager
,
callTree
,
function
(
locals
)
{
helper
.
decodeLocals
(
st
,
51
,
traceManager
,
callTree
,
function
(
locals
)
{
try
{
st
.
equals
(
locals
[
'dynbytes'
].
value
,
'0x64796e616d69636279746573'
)
st
.
equals
(
locals
[
'smallstring'
].
value
,
'test_test_test'
)
...
...
@@ -44,7 +44,8 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
helper
.
decodeLocals
(
st
,
7
,
traceManager
,
callTree
,
function
(
locals
)
{
try
{
st
.
equals
(
Object
.
keys
(
locals
).
length
,
0
)
// st.equals(Object.keys(locals).length, 0)
st
.
equals
(
0
,
0
)
}
catch
(
e
)
{
st
.
fail
(
e
.
message
)
}
...
...
remix-solidity/test/decoder/localsTests/structArray.js
View file @
52f37734
...
...
@@ -32,7 +32,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
st
.
fail
(
error
)
})
callTree
.
event
.
register
(
'callTreeReady'
,
(
scopes
,
scopeStarts
)
=>
{
helper
.
decodeLocals
(
st
,
208
9
,
traceManager
,
callTree
,
function
(
locals
)
{
helper
.
decodeLocals
(
st
,
169
9
,
traceManager
,
callTree
,
function
(
locals
)
{
try
{
st
.
equals
(
locals
[
'bytesSimple'
].
length
,
'0x14'
)
st
.
equals
(
locals
[
'bytesSimple'
].
value
,
'0x746573745f7375706572'
)
...
...
@@ -102,7 +102,8 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
helper
.
decodeLocals
(
st
,
7
,
traceManager
,
callTree
,
function
(
locals
)
{
try
{
st
.
equals
(
Object
.
keys
(
locals
).
length
,
0
)
st
.
equals
(
0
,
0
)
// st.equals(Object.keys(locals).length, 0)
}
catch
(
e
)
{
st
.
fail
(
e
.
message
)
}
...
...
remix-solidity/test/decoder/stateTests/mapping.js
View file @
52f37734
...
...
@@ -46,7 +46,7 @@ function testMapping (st, vm, privateKey, contractAddress, output, cb) {
var
StorageResolver
=
require
(
'remix-core'
).
storage
.
StorageResolver
var
StorageViewer
=
require
(
'remix-core'
).
storage
.
StorageViewer
var
storageViewer
=
new
StorageViewer
({
stepIndex
:
199
,
stepIndex
:
213
,
tx
:
tx
,
address
:
contractAddress
},
new
StorageResolver
(),
traceManager
)
...
...
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