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
ff235b5a
Commit
ff235b5a
authored
Dec 04, 2020
by
aniket-engg
Committed by
Aniket
Dec 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
type def and self removal
parent
982ba9f4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
38 deletions
+37
-38
eventsDecoder.ts
libs/remix-lib/src/execution/eventsDecoder.ts
+2
-2
execution-context.ts
libs/remix-lib/src/execution/execution-context.ts
+0
-1
web3VmProvider.ts
libs/remix-lib/src/web3Provider/web3VmProvider.ts
+35
-35
No files found.
libs/remix-lib/src/execution/eventsDecoder.ts
View file @
ff235b5a
...
...
@@ -38,8 +38,8 @@ export class EventsDecoder {
this
.
_decodeEvents
(
tx
,
receipt
.
logs
,
contract
,
contracts
,
cb
)
}
_eventABI
(
contract
):
Record
<
string
,
unknown
>
{
const
eventABI
:
Record
<
string
,
unknown
>
=
{}
_eventABI
(
contract
):
Record
<
string
,
{
event
,
inputs
,
object
,
abi
}
>
{
const
eventABI
:
Record
<
string
,
{
event
,
inputs
,
object
,
abi
}
>
=
{}
const
abi
=
new
ethers
.
utils
.
Interface
(
contract
.
abi
)
for
(
const
e
in
abi
.
events
)
{
const
event
=
abi
.
getEvent
(
e
)
...
...
libs/remix-lib/src/execution/execution-context.ts
View file @
ff235b5a
...
...
@@ -284,7 +284,6 @@ export class ExecutionContext {
}
// TODO: remove this when this function is moved
// const self = this
setProviderFromEndpoint
(
endpoint
,
context
,
cb
)
{
const
oldProvider
=
web3
.
currentProvider
...
...
libs/remix-lib/src/web3Provider/web3VmProvider.ts
View file @
ff235b5a
...
...
@@ -75,13 +75,13 @@ export class Web3VmProvider {
if
(
this
.
vm
===
vm
)
return
this
.
vm
=
vm
this
.
vm
.
on
(
'step'
,
(
data
)
=>
{
this
.
pushTrace
(
this
,
data
)
this
.
pushTrace
(
data
)
})
this
.
vm
.
on
(
'afterTx'
,
(
data
)
=>
{
this
.
txProcessed
(
this
,
data
)
this
.
txProcessed
(
data
)
})
this
.
vm
.
on
(
'beforeTx'
,
(
data
)
=>
{
this
.
txWillProcess
(
this
,
data
)
this
.
txWillProcess
(
data
)
})
}
...
...
@@ -91,16 +91,16 @@ export class Web3VmProvider {
return
ret
}
txWillProcess
(
self
,
data
)
{
self
.
incr
++
self
.
processingHash
=
hexConvert
(
data
.
hash
())
self
.
vmTraces
[
self
.
processingHash
]
=
{
txWillProcess
(
data
)
{
this
.
incr
++
this
.
processingHash
=
hexConvert
(
data
.
hash
())
this
.
vmTraces
[
this
.
processingHash
]
=
{
gas
:
'0x0'
,
return
:
'0x0'
,
structLogs
:
[]
}
const
tx
=
{}
tx
[
'hash'
]
=
self
.
processingHash
tx
[
'hash'
]
=
this
.
processingHash
tx
[
'from'
]
=
toChecksumAddress
(
hexConvert
(
data
.
getSenderAddress
()))
if
(
data
.
to
&&
data
.
to
.
length
)
{
tx
[
'to'
]
=
toChecksumAddress
(
hexConvert
(
data
.
to
))
...
...
@@ -112,25 +112,25 @@ export class Web3VmProvider {
if
(
data
.
value
)
{
tx
[
'value'
]
=
hexConvert
(
data
.
value
)
}
self
.
txs
[
self
.
processingHash
]
=
tx
self
.
txsReceipt
[
self
.
processingHash
]
=
tx
self
.
storageCache
[
self
.
processingHash
]
=
{}
this
.
txs
[
this
.
processingHash
]
=
tx
this
.
txsReceipt
[
this
.
processingHash
]
=
tx
this
.
storageCache
[
this
.
processingHash
]
=
{}
if
(
tx
[
'to'
])
{
const
account
=
toBuffer
(
tx
[
'to'
])
self
.
vm
.
stateManager
.
dumpStorage
(
account
,
(
storage
)
=>
{
self
.
storageCache
[
self
.
processingHash
][
tx
[
'to'
]]
=
storage
self
.
lastProcessedStorageTxHash
[
tx
[
'to'
]]
=
self
.
processingHash
this
.
vm
.
stateManager
.
dumpStorage
(
account
,
(
storage
)
=>
{
this
.
storageCache
[
this
.
processingHash
][
tx
[
'to'
]]
=
storage
this
.
lastProcessedStorageTxHash
[
tx
[
'to'
]]
=
this
.
processingHash
})
}
this
.
processingIndex
=
0
}
txProcessed
(
self
,
data
)
{
const
lastOp
=
self
.
vmTraces
[
self
.
processingHash
].
structLogs
[
self
.
processingIndex
-
1
]
txProcessed
(
data
)
{
const
lastOp
=
this
.
vmTraces
[
this
.
processingHash
].
structLogs
[
this
.
processingIndex
-
1
]
if
(
lastOp
)
{
lastOp
.
error
=
lastOp
.
op
!==
'RETURN'
&&
lastOp
.
op
!==
'STOP'
&&
lastOp
.
op
!==
'
SELF
DESTRUCT'
lastOp
.
error
=
lastOp
.
op
!==
'RETURN'
&&
lastOp
.
op
!==
'STOP'
&&
lastOp
.
op
!==
'
this
DESTRUCT'
}
self
.
vmTraces
[
self
.
processingHash
].
gas
=
'0x'
+
data
.
gasUsed
.
toString
(
16
)
this
.
vmTraces
[
this
.
processingHash
].
gas
=
'0x'
+
data
.
gasUsed
.
toString
(
16
)
const
logs
=
[]
for
(
const
l
in
data
.
execResult
.
logs
)
{
...
...
@@ -150,34 +150,34 @@ export class Web3VmProvider {
rawVMResponse
:
log
})
}
self
.
txsReceipt
[
self
.
processingHash
].
logs
=
logs
self
.
txsReceipt
[
self
.
processingHash
].
transactionHash
=
self
.
processingHash
this
.
txsReceipt
[
this
.
processingHash
].
logs
=
logs
this
.
txsReceipt
[
this
.
processingHash
].
transactionHash
=
this
.
processingHash
const
status
=
data
.
execResult
.
exceptionError
?
0
:
1
self
.
txsReceipt
[
self
.
processingHash
].
status
=
`0x
${
status
}
`
this
.
txsReceipt
[
this
.
processingHash
].
status
=
`0x
${
status
}
`
if
(
data
.
createdAddress
)
{
const
address
=
hexConvert
(
data
.
createdAddress
)
self
.
vmTraces
[
self
.
processingHash
].
return
=
toChecksumAddress
(
address
)
self
.
txsReceipt
[
self
.
processingHash
].
contractAddress
=
toChecksumAddress
(
address
)
this
.
vmTraces
[
this
.
processingHash
].
return
=
toChecksumAddress
(
address
)
this
.
txsReceipt
[
this
.
processingHash
].
contractAddress
=
toChecksumAddress
(
address
)
}
else
if
(
data
.
execResult
.
returnValue
)
{
self
.
vmTraces
[
self
.
processingHash
].
return
=
hexConvert
(
data
.
execResult
.
returnValue
)
this
.
vmTraces
[
this
.
processingHash
].
return
=
hexConvert
(
data
.
execResult
.
returnValue
)
}
else
{
self
.
vmTraces
[
self
.
processingHash
].
return
=
'0x'
this
.
vmTraces
[
this
.
processingHash
].
return
=
'0x'
}
this
.
processingIndex
=
null
this
.
processingAddress
=
null
this
.
previousDepth
=
0
}
pushTrace
(
self
,
data
)
{
pushTrace
(
data
)
{
const
depth
=
data
.
depth
+
1
// geth starts the depth from 1
if
(
!
self
.
processingHash
)
{
if
(
!
this
.
processingHash
)
{
console
.
log
(
'no tx processing'
)
return
}
let
previousopcode
if
(
self
.
vmTraces
[
self
.
processingHash
]
&&
self
.
vmTraces
[
self
.
processingHash
].
structLogs
[
this
.
processingIndex
-
1
])
{
previousopcode
=
self
.
vmTraces
[
self
.
processingHash
].
structLogs
[
this
.
processingIndex
-
1
]
if
(
this
.
vmTraces
[
this
.
processingHash
]
&&
this
.
vmTraces
[
this
.
processingHash
].
structLogs
[
this
.
processingIndex
-
1
])
{
previousopcode
=
this
.
vmTraces
[
this
.
processingHash
].
structLogs
[
this
.
processingIndex
-
1
]
}
if
(
this
.
previousDepth
>
depth
&&
previousopcode
)
{
...
...
@@ -195,7 +195,7 @@ export class Web3VmProvider {
depth
:
depth
,
error
:
data
.
error
===
false
?
undefined
:
data
.
error
}
self
.
vmTraces
[
self
.
processingHash
].
structLogs
.
push
(
step
)
this
.
vmTraces
[
this
.
processingHash
].
structLogs
.
push
(
step
)
if
(
step
.
op
===
'CREATE'
||
step
.
op
===
'CALL'
)
{
if
(
step
.
op
===
'CREATE'
)
{
this
.
processingAddress
=
'(Contract Creation - Step '
+
this
.
processingIndex
+
')'
...
...
@@ -204,11 +204,11 @@ export class Web3VmProvider {
}
else
{
this
.
processingAddress
=
normalizeHexAddress
(
step
.
stack
[
step
.
stack
.
length
-
2
])
this
.
processingAddress
=
toChecksumAddress
(
this
.
processingAddress
)
if
(
!
self
.
storageCache
[
self
.
processingHash
][
this
.
processingAddress
])
{
if
(
!
this
.
storageCache
[
this
.
processingHash
][
this
.
processingAddress
])
{
const
account
=
toBuffer
(
this
.
processingAddress
)
self
.
vm
.
stateManager
.
dumpStorage
(
account
,
function
(
storage
)
{
self
.
storageCache
[
self
.
processingHash
][
self
.
processingAddress
]
=
storage
self
.
lastProcessedStorageTxHash
[
self
.
processingAddress
]
=
self
.
processingHash
this
.
vm
.
stateManager
.
dumpStorage
(
account
,
function
(
storage
)
{
this
.
storageCache
[
this
.
processingHash
][
this
.
processingAddress
]
=
storage
this
.
lastProcessedStorageTxHash
[
this
.
processingAddress
]
=
this
.
processingHash
})
}
}
...
...
@@ -216,7 +216,7 @@ export class Web3VmProvider {
if
(
previousopcode
&&
previousopcode
.
op
===
'SHA3'
)
{
const
preimage
=
this
.
getSha3Input
(
previousopcode
.
stack
,
previousopcode
.
memory
)
const
imageHash
=
step
.
stack
[
step
.
stack
.
length
-
1
].
replace
(
'0x'
,
''
)
self
.
sha3Preimages
[
imageHash
]
=
{
this
.
sha3Preimages
[
imageHash
]
=
{
preimage
:
preimage
}
}
...
...
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