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
c4030892
Commit
c4030892
authored
May 03, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attempt to remove hexConvert
parent
4fe1574b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
32 deletions
+10
-32
disassembler.ts
libs/remix-debug/src/code/disassembler.ts
+2
-1
util.ts
libs/remix-lib/src/util.ts
+2
-25
web3VmProvider.ts
libs/remix-lib/src/web3Provider/web3VmProvider.ts
+6
-6
No files found.
libs/remix-debug/src/code/disassembler.ts
View file @
c4030892
...
...
@@ -2,6 +2,7 @@
import
{
parseCode
}
from
'./codeUtils'
import
{
util
}
from
'@remix-project/remix-lib'
import
{
bufferToHex
}
from
'ethereumjs-util'
function
createExpressions
(
instructions
)
{
const
expressions
=
[]
...
...
@@ -36,7 +37,7 @@ function createExpressions (instructions) {
function
toString
(
expr
)
{
if
(
expr
.
name
.
slice
(
0
,
4
)
===
'PUSH'
)
{
return
util
.
hexConvert
(
expr
.
pushData
)
return
bufferToHex
(
expr
.
pushData
)
}
else
if
(
expr
.
name
===
'JUMPDEST'
)
{
return
expr
.
label
+
':'
}
else
if
(
expr
.
args
)
{
...
...
libs/remix-lib/src/util.ts
View file @
c4030892
...
...
@@ -13,20 +13,8 @@ import { BN, bufferToHex, keccak, setLengthLeft, toBuffer } from 'ethereumjs-uti
/*
ints: IntArray
*/
export
function
hexConvert
(
ints
)
{
let
ret
=
'0x'
for
(
let
i
=
0
;
i
<
ints
.
length
;
i
++
)
{
const
h
=
ints
[
i
]
if
(
h
)
{
ret
+=
(
h
<=
0xf
?
'0'
:
''
)
+
h
.
toString
(
16
)
}
else
{
ret
+=
'00'
}
}
return
ret
}
/**
/**
* Converts a hex string to an array of integers.
*/
export
function
hexToIntArray
(
hexString
)
{
...
...
@@ -57,21 +45,10 @@ export function hexListFromBNs (bnList) {
}
/*
ints: list of IntArrays
*/
export
function
hexListConvert
(
intsList
)
{
const
ret
=
[]
for
(
const
k
in
intsList
)
{
ret
.
push
(
this
.
hexConvert
(
intsList
[
k
]))
}
return
ret
}
/*
ints: ints: IntArray
*/
export
function
formatMemory
(
mem
)
{
const
hexMem
=
this
.
hexConvert
(
mem
).
substr
(
2
)
const
hexMem
=
bufferToHex
(
mem
).
substr
(
2
)
const
ret
=
[]
for
(
let
k
=
0
;
k
<
hexMem
.
length
;
k
+=
32
)
{
const
row
=
hexMem
.
substr
(
k
,
32
)
...
...
libs/remix-lib/src/web3Provider/web3VmProvider.ts
View file @
c4030892
import
{
hex
Convert
,
hex
ListFromBNs
,
formatMemory
}
from
'../util'
import
{
hexListFromBNs
,
formatMemory
}
from
'../util'
import
{
normalizeHexAddress
}
from
'../helpers/uiHelper'
import
{
toChecksumAddress
,
BN
,
toBuffer
,
Address
}
from
'ethereumjs-util'
import
{
toChecksumAddress
,
BN
,
bufferToHex
,
Address
}
from
'ethereumjs-util'
import
Web3
from
'web3'
export
class
Web3VmProvider
{
...
...
@@ -96,7 +96,7 @@ export class Web3VmProvider {
async
txWillProcess
(
data
)
{
this
.
incr
++
this
.
processingHash
=
hexConvert
(
data
.
hash
())
this
.
processingHash
=
bufferToHex
(
data
.
hash
())
this
.
vmTraces
[
this
.
processingHash
]
=
{
gas
:
'0x0'
,
return
:
'0x0'
,
...
...
@@ -109,7 +109,7 @@ export class Web3VmProvider {
tx
[
'to'
]
=
toChecksumAddress
(
data
.
to
.
toString
())
}
this
.
processingAddress
=
tx
[
'to'
]
tx
[
'input'
]
=
hexConvert
(
data
.
data
)
tx
[
'input'
]
=
bufferToHex
(
data
.
data
)
tx
[
'gas'
]
=
data
.
gasLimit
.
toString
(
10
)
if
(
data
.
value
)
{
tx
[
'value'
]
=
data
.
value
.
toString
(
10
)
...
...
@@ -164,7 +164,7 @@ export class Web3VmProvider {
this
.
vmTraces
[
this
.
processingHash
].
return
=
toChecksumAddress
(
address
)
this
.
txsReceipt
[
this
.
processingHash
].
contractAddress
=
toChecksumAddress
(
address
)
}
else
if
(
data
.
execResult
.
returnValue
)
{
this
.
vmTraces
[
this
.
processingHash
].
return
=
hexConvert
(
data
.
execResult
.
returnValue
)
this
.
vmTraces
[
this
.
processingHash
].
return
=
bufferToHex
(
data
.
execResult
.
returnValue
)
}
else
{
this
.
vmTraces
[
this
.
processingHash
].
return
=
'0x'
}
...
...
@@ -235,7 +235,7 @@ export class Web3VmProvider {
getCode
(
address
,
cb
)
{
address
=
toChecksumAddress
(
address
)
this
.
vm
.
stateManager
.
getContractCode
(
Address
.
fromString
(
address
)).
then
((
result
)
=>
{
cb
(
null
,
hexConvert
(
result
))
cb
(
null
,
bufferToHex
(
result
))
}).
catch
((
error
)
=>
{
cb
(
error
)
})
...
...
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