Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
752c75fb
Commit
752c75fb
authored
Jan 11, 2016
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/vm: resolve circular dependency to debug vm storage
parent
1b8566a7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
14 deletions
+20
-14
contract.go
core/vm/contract.go
+7
-0
environment.go
core/vm/environment.go
+1
-0
jit_test.go
core/vm/jit_test.go
+9
-8
vm.go
core/vm/vm.go
+3
-6
No files found.
core/vm/contract.go
View file @
752c75fb
...
...
@@ -27,6 +27,7 @@ type ContractRef interface {
ReturnGas
(
*
big
.
Int
,
*
big
.
Int
)
Address
()
common
.
Address
SetCode
([]
byte
)
EachStorage
(
cb
func
(
key
,
value
[]
byte
))
}
// Contract represents an ethereum contract in the state database. It contains
...
...
@@ -124,3 +125,9 @@ func (self *Contract) SetCallCode(addr *common.Address, code []byte) {
self
.
Code
=
code
self
.
CodeAddr
=
addr
}
// EachStorage iterates the contract's storage and calls a method for every key
// value pair.
func
(
self
*
Contract
)
EachStorage
(
cb
func
(
key
,
value
[]
byte
))
{
self
.
caller
.
EachStorage
(
cb
)
}
core/vm/environment.go
View file @
752c75fb
...
...
@@ -121,4 +121,5 @@ type Account interface {
Address
()
common
.
Address
ReturnGas
(
*
big
.
Int
,
*
big
.
Int
)
SetCode
([]
byte
)
EachStorage
(
cb
func
(
key
,
value
[]
byte
))
}
core/vm/jit_test.go
View file @
752c75fb
...
...
@@ -125,14 +125,15 @@ type vmBench struct {
type
account
struct
{}
func
(
account
)
SubBalance
(
amount
*
big
.
Int
)
{}
func
(
account
)
AddBalance
(
amount
*
big
.
Int
)
{}
func
(
account
)
SetBalance
(
*
big
.
Int
)
{}
func
(
account
)
SetNonce
(
uint64
)
{}
func
(
account
)
Balance
()
*
big
.
Int
{
return
nil
}
func
(
account
)
Address
()
common
.
Address
{
return
common
.
Address
{}
}
func
(
account
)
ReturnGas
(
*
big
.
Int
,
*
big
.
Int
)
{}
func
(
account
)
SetCode
([]
byte
)
{}
func
(
account
)
SubBalance
(
amount
*
big
.
Int
)
{}
func
(
account
)
AddBalance
(
amount
*
big
.
Int
)
{}
func
(
account
)
SetBalance
(
*
big
.
Int
)
{}
func
(
account
)
SetNonce
(
uint64
)
{}
func
(
account
)
Balance
()
*
big
.
Int
{
return
nil
}
func
(
account
)
Address
()
common
.
Address
{
return
common
.
Address
{}
}
func
(
account
)
ReturnGas
(
*
big
.
Int
,
*
big
.
Int
)
{}
func
(
account
)
SetCode
([]
byte
)
{}
func
(
account
)
EachStorage
(
cb
func
(
key
,
value
[]
byte
))
{}
func
runVmBench
(
test
vmBench
,
b
*
testing
.
B
)
{
var
sender
account
...
...
core/vm/vm.go
View file @
752c75fb
...
...
@@ -376,12 +376,9 @@ func (self *Vm) log(pc uint64, op OpCode, gas, cost *big.Int, memory *Memory, st
stck
[
i
]
=
new
(
big
.
Int
)
.
Set
(
item
)
}
storage
:=
make
(
map
[
common
.
Hash
][]
byte
)
/*
object := contract.self.(*state.StateObject)
object.EachStorage(func(k, v []byte) {
storage[common.BytesToHash(k)] = v
})
*/
contract
.
self
.
EachStorage
(
func
(
k
,
v
[]
byte
)
{
storage
[
common
.
BytesToHash
(
k
)]
=
v
})
self
.
env
.
AddStructLog
(
StructLog
{
pc
,
op
,
new
(
big
.
Int
)
.
Set
(
gas
),
cost
,
mem
,
stck
,
storage
,
err
})
}
}
...
...
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