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
cbd30b86
Commit
cbd30b86
authored
May 24, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
typo + emptyFill if memory not yet filled
parent
4013d352
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
web3VmProvider.js
src/web3Provider/web3VmProvider.js
+16
-8
No files found.
src/web3Provider/web3VmProvider.js
View file @
cbd30b86
...
...
@@ -213,18 +213,26 @@ function getSha3Input (stack, memory) {
var
memLengthDec
=
(
new
ethutil
.
BN
(
memoryLength
.
replace
(
'0x'
,
''
),
16
).
toString
(
10
))
memoryLength
=
parseInt
(
memLengthDec
)
*
2
var
min
=
Math
.
floor
(
memoryStart
/
32
)
var
fillLength
=
Math
.
floor
(
memoryLength
/
32
)
var
sha3Input
=
memory
[
min
].
slice
(
memoryStart
-
32
*
min
)
min
++
while
(
min
<
fillLength
)
{
sha3Input
+=
memory
[
min
]
min
++
var
i
=
Math
.
floor
(
memoryStart
/
32
)
var
maxIndex
=
Math
.
floor
(
memoryLength
/
32
)
if
(
!
memory
[
i
])
{
return
emptyFill
(
memoryLength
)
}
var
sha3Input
=
memory
[
i
].
slice
(
memoryStart
-
32
*
i
)
i
++
while
(
i
<
maxIndex
)
{
sha3Input
+=
memory
[
i
]
?
memory
[
i
]
:
emptyFill
(
32
)
i
++
}
if
(
sha3Input
.
length
<
memoryLength
)
{
sha3Input
+=
memory
[
min
].
slice
(
0
,
memoryLength
-
sha3Input
.
length
)
var
leftSize
=
memoryLength
-
sha3Input
.
length
sha3Input
+=
memory
[
i
]
?
memory
[
i
].
slice
(
0
,
leftSize
)
:
emptyFill
(
leftSize
)
}
return
sha3Input
}
function
emptyFill
(
size
)
{
return
(
new
Array
(
size
)).
join
(
'0'
)
}
module
.
exports
=
web3VmProvider
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