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
399b878a
Commit
399b878a
authored
Dec 05, 2019
by
aniket-engg
Committed by
Aniket
Dec 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
suggested changes and more ethereumjs-vm related update
parent
e052df4a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
15 deletions
+11
-15
opcodes.js
remix-lib/src/code/opcodes.js
+1
-1
txListener.js
remix-lib/src/execution/txListener.js
+4
-5
txResultHelper.js
remix-lib/src/helpers/txResultHelper.js
+4
-4
txProcess.js
remix-simulator/src/methods/txProcess.js
+2
-5
No files found.
remix-lib/src/code/opcodes.js
View file @
399b878a
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
var
codes
=
{
var
codes
=
{
// 0x0 range - arithmetic ops
// 0x0 range - arithmetic ops
// name, baseCost, off stack, on stack, dynamic, async
// name, baseCost, off stack, on stack, dynamic, async
// @todo can be improved
while refactoring
// @todo can be improved
on basis of this: https://github.com/ethereumjs/ethereumjs-vm/blob/master/lib/evm/opcodes.ts
0x00
:
[
'STOP'
,
0
,
0
,
0
,
false
],
0x00
:
[
'STOP'
,
0
,
0
,
0
,
false
],
0x01
:
[
'ADD'
,
3
,
2
,
1
,
false
],
0x01
:
[
'ADD'
,
3
,
2
,
1
,
false
],
...
...
remix-lib/src/execution/txListener.js
View file @
399b878a
...
@@ -40,14 +40,13 @@ class TxListener {
...
@@ -40,14 +40,13 @@ class TxListener {
// in web3 mode && listen remix txs only
// in web3 mode && listen remix txs only
if
(
!
this
.
_isListening
)
return
// we don't listen
if
(
!
this
.
_isListening
)
return
// we don't listen
if
(
this
.
_loopId
&&
executionContext
.
getProvider
()
!==
'vm'
)
return
// we seems to already listen on a "web3" network
if
(
this
.
_loopId
&&
executionContext
.
getProvider
()
!==
'vm'
)
return
// we seems to already listen on a "web3" network
var
call
=
{
var
call
=
{
from
:
from
,
from
:
from
,
to
:
to
,
to
:
to
,
input
:
data
,
input
:
data
,
hash
:
txResult
.
transactionHash
?
txResult
.
transactionHash
:
'call'
+
(
from
||
''
)
+
to
+
data
,
hash
:
txResult
.
transactionHash
?
txResult
.
transactionHash
:
'call'
+
(
from
||
''
)
+
to
+
data
,
isCall
:
true
,
isCall
:
true
,
returnValue
:
executionContext
.
isVM
()
?
txResult
.
result
.
vm
.
return
:
ethJSUtil
.
toBuffer
(
txResult
.
result
),
returnValue
:
executionContext
.
isVM
()
?
txResult
.
result
.
execResult
.
returnValue
:
ethJSUtil
.
toBuffer
(
txResult
.
result
),
envMode
:
executionContext
.
getProvider
()
envMode
:
executionContext
.
getProvider
()
}
}
...
@@ -80,9 +79,9 @@ class TxListener {
...
@@ -80,9 +79,9 @@ class TxListener {
function
addExecutionCosts
(
txResult
,
tx
)
{
function
addExecutionCosts
(
txResult
,
tx
)
{
if
(
txResult
&&
txResult
.
result
)
{
if
(
txResult
&&
txResult
.
result
)
{
if
(
txResult
.
result
.
vm
)
{
if
(
txResult
.
result
.
execResult
)
{
tx
.
returnValue
=
txResult
.
result
.
vm
.
return
tx
.
returnValue
=
txResult
.
result
.
execResult
.
returnValue
if
(
txResult
.
result
.
vm
.
gasUsed
)
tx
.
executionCost
=
txResult
.
result
.
vm
.
gasUsed
.
toString
(
10
)
if
(
txResult
.
result
.
execResult
.
gasUsed
)
tx
.
executionCost
=
txResult
.
result
.
execResult
.
gasUsed
.
toString
(
10
)
}
}
if
(
txResult
.
result
.
gasUsed
)
tx
.
transactionCost
=
txResult
.
result
.
gasUsed
.
toString
(
10
)
if
(
txResult
.
result
.
gasUsed
)
tx
.
transactionCost
=
txResult
.
result
.
gasUsed
.
toString
(
10
)
}
}
...
...
remix-lib/src/helpers/txResultHelper.js
View file @
399b878a
...
@@ -21,14 +21,14 @@ function convertToPrefixedHex (input) {
...
@@ -21,14 +21,14 @@ function convertToPrefixedHex (input) {
*/
*/
function
resultToRemixTx
(
txResult
)
{
function
resultToRemixTx
(
txResult
)
{
const
{
result
,
transactionHash
}
=
txResult
const
{
result
,
transactionHash
}
=
txResult
const
{
status
,
vm
,
gasUsed
,
createdAddress
,
contractAddress
}
=
result
const
{
status
,
execResult
,
gasUsed
,
createdAddress
,
contractAddress
}
=
result
let
returnValue
,
errorMessage
let
returnValue
,
errorMessage
if
(
isHexString
(
result
))
{
if
(
isHexString
(
result
))
{
returnValue
=
result
returnValue
=
result
}
else
if
(
vm
!==
undefined
)
{
}
else
if
(
execResult
!==
undefined
)
{
returnValue
=
vm
.
return
returnValue
=
execResult
.
return
errorMessage
=
vm
.
exceptionError
errorMessage
=
execResult
.
exceptionError
}
}
return
{
return
{
...
...
remix-simulator/src/methods/txProcess.js
View file @
399b878a
...
@@ -8,11 +8,8 @@ function runCall (payload, from, to, data, value, gasLimit, txRunner, callbacks,
...
@@ -8,11 +8,8 @@ function runCall (payload, from, to, data, value, gasLimit, txRunner, callbacks,
if
(
err
)
{
if
(
err
)
{
return
callback
(
err
)
return
callback
(
err
)
}
}
const
returnValue
=
result
.
result
.
execResult
.
returnValue
.
toString
(
'hex'
)
let
toReturn
=
'0x'
+
result
.
result
.
execResult
.
returnValue
.
toString
(
'hex'
)
const
toReturn
=
`0x
${
returnValue
||
'0'
}
`
if
(
toReturn
===
'0x'
)
{
toReturn
=
'0x0'
}
return
callback
(
null
,
toReturn
)
return
callback
(
null
,
toReturn
)
}
}
...
...
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