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
a1d4be80
Commit
a1d4be80
authored
Aug 28, 2019
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
track last known transaction for an address
parent
c3f24090
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
web3VmProvider.js
remix-lib/src/web3Provider/web3VmProvider.js
+9
-0
No files found.
remix-lib/src/web3Provider/web3VmProvider.js
View file @
a1d4be80
...
@@ -29,6 +29,7 @@ function web3VmProvider () {
...
@@ -29,6 +29,7 @@ function web3VmProvider () {
this
.
providers
=
{
'HttpProvider'
:
function
(
url
)
{}
}
this
.
providers
=
{
'HttpProvider'
:
function
(
url
)
{}
}
this
.
currentProvider
=
{
'host'
:
'vm provider'
}
this
.
currentProvider
=
{
'host'
:
'vm provider'
}
this
.
storageCache
=
{}
this
.
storageCache
=
{}
this
.
lastProcessedStorageTxHash
=
{}
this
.
sha3Preimages
=
{}
this
.
sha3Preimages
=
{}
// util
// util
this
.
sha3
=
function
()
{
return
self
.
web3
.
sha3
.
apply
(
self
.
web3
,
arguments
)
}
this
.
sha3
=
function
()
{
return
self
.
web3
.
sha3
.
apply
(
self
.
web3
,
arguments
)
}
...
@@ -92,6 +93,7 @@ web3VmProvider.prototype.txWillProcess = function (self, data) {
...
@@ -92,6 +93,7 @@ web3VmProvider.prototype.txWillProcess = function (self, data) {
const
account
=
ethutil
.
toBuffer
(
tx
.
to
)
const
account
=
ethutil
.
toBuffer
(
tx
.
to
)
self
.
vm
.
stateManager
.
dumpStorage
(
account
,
function
(
storage
)
{
self
.
vm
.
stateManager
.
dumpStorage
(
account
,
function
(
storage
)
{
self
.
storageCache
[
self
.
processingHash
][
tx
.
to
]
=
storage
self
.
storageCache
[
self
.
processingHash
][
tx
.
to
]
=
storage
self
.
lastProcessedStorageTxHash
[
tx
.
to
]
=
self
.
processingHash
})
})
}
}
this
.
processingIndex
=
0
this
.
processingIndex
=
0
...
@@ -171,12 +173,14 @@ web3VmProvider.prototype.pushTrace = function (self, data) {
...
@@ -171,12 +173,14 @@ web3VmProvider.prototype.pushTrace = function (self, data) {
if
(
step
.
op
===
'CREATE'
)
{
if
(
step
.
op
===
'CREATE'
)
{
this
.
processingAddress
=
traceHelper
.
contractCreationToken
(
this
.
processingIndex
)
this
.
processingAddress
=
traceHelper
.
contractCreationToken
(
this
.
processingIndex
)
this
.
storageCache
[
this
.
processingHash
][
this
.
processingAddress
]
=
{}
this
.
storageCache
[
this
.
processingHash
][
this
.
processingAddress
]
=
{}
this
.
lastProcessedStorageTxHash
[
this
.
processingAddress
]
=
this
.
processingHash
}
else
{
}
else
{
this
.
processingAddress
=
uiutil
.
normalizeHexAddress
(
step
.
stack
[
step
.
stack
.
length
-
2
])
this
.
processingAddress
=
uiutil
.
normalizeHexAddress
(
step
.
stack
[
step
.
stack
.
length
-
2
])
if
(
!
self
.
storageCache
[
self
.
processingHash
][
this
.
processingAddress
])
{
if
(
!
self
.
storageCache
[
self
.
processingHash
][
this
.
processingAddress
])
{
const
account
=
ethutil
.
toBuffer
(
this
.
processingAddress
)
const
account
=
ethutil
.
toBuffer
(
this
.
processingAddress
)
self
.
vm
.
stateManager
.
dumpStorage
(
account
,
function
(
storage
)
{
self
.
vm
.
stateManager
.
dumpStorage
(
account
,
function
(
storage
)
{
self
.
storageCache
[
self
.
processingHash
][
self
.
processingAddress
]
=
storage
self
.
storageCache
[
self
.
processingHash
][
self
.
processingAddress
]
=
storage
self
.
lastProcessedStorageTxHash
[
self
.
processingAddress
]
=
self
.
processingHash
})
})
}
}
}
}
...
@@ -217,6 +221,11 @@ web3VmProvider.prototype.traceTransaction = function (txHash, options, cb) {
...
@@ -217,6 +221,11 @@ web3VmProvider.prototype.traceTransaction = function (txHash, options, cb) {
web3VmProvider
.
prototype
.
storageRangeAt
=
function
(
blockNumber
,
txIndex
,
address
,
start
,
maxLength
,
cb
)
{
// txIndex is the hash in the case of the VM
web3VmProvider
.
prototype
.
storageRangeAt
=
function
(
blockNumber
,
txIndex
,
address
,
start
,
maxLength
,
cb
)
{
// txIndex is the hash in the case of the VM
// we don't use the range params here
// we don't use the range params here
if
(
txIndex
===
'latest'
)
{
txIndex
=
this
.
lastProcessedStorageTxHash
[
address
]
}
if
(
this
.
storageCache
[
txIndex
]
&&
this
.
storageCache
[
txIndex
][
address
])
{
if
(
this
.
storageCache
[
txIndex
]
&&
this
.
storageCache
[
txIndex
][
address
])
{
var
storage
=
this
.
storageCache
[
txIndex
][
address
]
var
storage
=
this
.
storageCache
[
txIndex
][
address
]
return
cb
(
null
,
{
return
cb
(
null
,
{
...
...
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