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
a06a84d1
Commit
a06a84d1
authored
Jul 24, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored to reflect the new VM and State
parent
e7a80ec6
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
77 additions
and
31 deletions
+77
-31
README.md
README.md
+1
-1
wallet.qml
ethereal/assets/qml/wallet.qml
+2
-0
debugger.go
ethereal/debugger.go
+26
-18
ext_app.go
ethereal/ext_app.go
+5
-4
html_container.go
ethereal/html_container.go
+3
-2
main.go
ethereal/main.go
+1
-1
qml_container.go
ethereal/qml_container.go
+3
-2
ui_lib.go
ethereal/ui_lib.go
+2
-2
main.go
ethereum/main.go
+1
-1
vm_env.go
utils/vm_env.go
+33
-0
No files found.
README.md
View file @
a06a84d1
...
...
@@ -5,7 +5,7 @@ Ethereum
Ethereum Go Client © 2014 Jeffrey Wilcke.
Current state: Proof of Concept 0.
5.17
.
Current state: Proof of Concept 0.
6.0
.
For the development package please see the
[
eth-go package
](
https://github.com/ethereum/eth-go
)
.
...
...
ethereal/assets/qml/wallet.qml
View file @
a06a84d1
...
...
@@ -249,6 +249,8 @@ ApplicationWindow {
}
TextField
{
text
:
eth
.
getCustomIdentifier
()
width
:
500
placeholderText
:
"Anonymous"
onTextChanged
:
{
eth
.
setCustomIdentifier
(
text
)
}
...
...
ethereal/debugger.go
View file @
a06a84d1
...
...
@@ -3,7 +3,10 @@ package main
import
(
"fmt"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethvm"
"github.com/ethereum/go-ethereum/utils"
"github.com/go-qml/qml"
"math/big"
"strconv"
...
...
@@ -15,10 +18,10 @@ type DebuggerWindow struct {
engine
*
qml
.
Engine
lib
*
UiLib
vm
*
eth
chain
.
Vm
vm
*
eth
vm
.
Vm
Db
*
Debugger
state
*
eth
chain
.
State
state
*
eth
state
.
State
}
func
NewDebuggerWindow
(
lib
*
UiLib
)
*
DebuggerWindow
{
...
...
@@ -32,7 +35,7 @@ func NewDebuggerWindow(lib *UiLib) *DebuggerWindow {
win
:=
component
.
CreateWindow
(
nil
)
w
:=
&
DebuggerWindow
{
engine
:
engine
,
win
:
win
,
lib
:
lib
,
vm
:
&
eth
chain
.
Vm
{}}
w
:=
&
DebuggerWindow
{
engine
:
engine
,
win
:
win
,
lib
:
lib
,
vm
:
&
eth
vm
.
Vm
{}}
w
.
Db
=
NewDebugger
(
w
)
return
w
...
...
@@ -130,24 +133,29 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
state
:=
self
.
lib
.
eth
.
StateManager
()
.
TransState
()
account
:=
self
.
lib
.
eth
.
StateManager
()
.
TransState
()
.
GetAccount
(
keyPair
.
Address
())
contract
:=
eth
chain
.
NewStateObject
([]
byte
{
0
})
contract
:=
eth
state
.
NewStateObject
([]
byte
{
0
})
contract
.
Amount
=
value
self
.
SetAsm
(
script
)
callerClosure
:=
eth
chain
.
NewClosure
(
account
,
contract
,
script
,
state
,
gas
,
gasPrice
)
callerClosure
:=
eth
vm
.
NewClosure
(
account
,
contract
,
script
,
gas
,
gasPrice
)
block
:=
self
.
lib
.
eth
.
BlockChain
()
.
CurrentBlock
vm
:=
ethchain
.
NewVm
(
state
,
self
.
lib
.
eth
.
StateManager
(),
ethchain
.
RuntimeVars
{
Block
:
block
,
Origin
:
account
.
Address
(),
BlockNumber
:
block
.
Number
,
PrevHash
:
block
.
PrevHash
,
Coinbase
:
block
.
Coinbase
,
Time
:
block
.
Time
,
Diff
:
block
.
Difficulty
,
Value
:
ethutil
.
Big
(
valueStr
),
})
/*
vm := ethchain.NewVm(state, self.lib.eth.StateManager(), ethchain.RuntimeVars{
Block: block,
Origin: account.Address(),
BlockNumber: block.Number,
PrevHash: block.PrevHash,
Coinbase: block.Coinbase,
Time: block.Time,
Diff: block.Difficulty,
Value: ethutil.Big(valueStr),
})
*/
env
:=
utils
.
NewEnv
(
state
,
block
,
account
.
Address
(),
value
)
vm
:=
ethvm
.
New
(
env
)
vm
.
Verbose
=
true
vm
.
Dbg
=
self
.
Db
...
...
@@ -257,13 +265,13 @@ type storeVal struct {
Key
,
Value
string
}
func
(
self
*
Debugger
)
BreakHook
(
pc
int
,
op
eth
chain
.
OpCode
,
mem
*
ethchain
.
Memory
,
stack
*
ethchain
.
Stack
,
stateObject
*
ethchain
.
StateObject
)
bool
{
func
(
self
*
Debugger
)
BreakHook
(
pc
int
,
op
eth
vm
.
OpCode
,
mem
*
ethvm
.
Memory
,
stack
*
ethvm
.
Stack
,
stateObject
*
ethstate
.
StateObject
)
bool
{
self
.
main
.
Logln
(
"break on instr:"
,
pc
)
return
self
.
halting
(
pc
,
op
,
mem
,
stack
,
stateObject
)
}
func
(
self
*
Debugger
)
StepHook
(
pc
int
,
op
eth
chain
.
OpCode
,
mem
*
ethchain
.
Memory
,
stack
*
ethchain
.
Stack
,
stateObject
*
ethchain
.
StateObject
)
bool
{
func
(
self
*
Debugger
)
StepHook
(
pc
int
,
op
eth
vm
.
OpCode
,
mem
*
ethvm
.
Memory
,
stack
*
ethvm
.
Stack
,
stateObject
*
ethstate
.
StateObject
)
bool
{
return
self
.
halting
(
pc
,
op
,
mem
,
stack
,
stateObject
)
}
...
...
@@ -275,7 +283,7 @@ func (self *Debugger) BreakPoints() []int64 {
return
self
.
breakPoints
}
func
(
d
*
Debugger
)
halting
(
pc
int
,
op
eth
chain
.
OpCode
,
mem
*
ethchain
.
Memory
,
stack
*
ethchain
.
Stack
,
stateObject
*
ethchain
.
StateObject
)
bool
{
func
(
d
*
Debugger
)
halting
(
pc
int
,
op
eth
vm
.
OpCode
,
mem
*
ethvm
.
Memory
,
stack
*
ethvm
.
Stack
,
stateObject
*
ethstate
.
StateObject
)
bool
{
d
.
win
.
Root
()
.
Call
(
"setInstruction"
,
pc
)
d
.
win
.
Root
()
.
Call
(
"clearMem"
)
d
.
win
.
Root
()
.
Call
(
"clearStack"
)
...
...
ethereal/ext_app.go
View file @
a06a84d1
...
...
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethutil"
"github.com/go-qml/qml"
)
...
...
@@ -16,8 +17,8 @@ type AppContainer interface {
Engine
()
*
qml
.
Engine
NewBlock
(
*
ethchain
.
Block
)
ObjectChanged
(
*
eth
chain
.
StateObject
)
StorageChanged
(
*
eth
chain
.
StorageState
)
ObjectChanged
(
*
eth
state
.
StateObject
)
StorageChanged
(
*
eth
state
.
StorageState
)
NewWatcher
(
chan
bool
)
}
...
...
@@ -108,9 +109,9 @@ out:
app
.
container
.
NewBlock
(
block
)
}
case
object
:=
<-
app
.
changeChan
:
if
stateObject
,
ok
:=
object
.
Resource
.
(
*
eth
chain
.
StateObject
);
ok
{
if
stateObject
,
ok
:=
object
.
Resource
.
(
*
eth
state
.
StateObject
);
ok
{
app
.
container
.
ObjectChanged
(
stateObject
)
}
else
if
storageObject
,
ok
:=
object
.
Resource
.
(
*
eth
chain
.
StorageState
);
ok
{
}
else
if
storageObject
,
ok
:=
object
.
Resource
.
(
*
eth
state
.
StorageState
);
ok
{
app
.
container
.
StorageChanged
(
storageObject
)
}
}
...
...
ethereal/html_container.go
View file @
a06a84d1
...
...
@@ -4,6 +4,7 @@ import (
"errors"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethutil"
"github.com/go-qml/qml"
"github.com/howeyc/fsnotify"
...
...
@@ -121,11 +122,11 @@ func (app *HtmlApplication) NewBlock(block *ethchain.Block) {
app
.
webView
.
Call
(
"onNewBlockCb"
,
b
)
}
func
(
app
*
HtmlApplication
)
ObjectChanged
(
stateObject
*
eth
chain
.
StateObject
)
{
func
(
app
*
HtmlApplication
)
ObjectChanged
(
stateObject
*
eth
state
.
StateObject
)
{
app
.
webView
.
Call
(
"onObjectChangeCb"
,
ethpub
.
NewPStateObject
(
stateObject
))
}
func
(
app
*
HtmlApplication
)
StorageChanged
(
storageObject
*
eth
chain
.
StorageState
)
{
func
(
app
*
HtmlApplication
)
StorageChanged
(
storageObject
*
eth
state
.
StorageState
)
{
app
.
webView
.
Call
(
"onStorageChangeCb"
,
ethpub
.
NewPStorageState
(
storageObject
))
}
...
...
ethereal/main.go
View file @
a06a84d1
...
...
@@ -10,7 +10,7 @@ import (
const
(
ClientIdentifier
=
"Ethereal"
Version
=
"0.
5.17
"
Version
=
"0.
6.0
"
)
func
main
()
{
...
...
ethereal/qml_container.go
View file @
a06a84d1
...
...
@@ -3,6 +3,7 @@ package main
import
(
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethutil"
"github.com/go-qml/qml"
"runtime"
...
...
@@ -50,11 +51,11 @@ func (app *QmlApplication) NewBlock(block *ethchain.Block) {
app
.
win
.
Call
(
"onNewBlockCb"
,
pblock
)
}
func
(
app
*
QmlApplication
)
ObjectChanged
(
stateObject
*
eth
chain
.
StateObject
)
{
func
(
app
*
QmlApplication
)
ObjectChanged
(
stateObject
*
eth
state
.
StateObject
)
{
app
.
win
.
Call
(
"onObjectChangeCb"
,
ethpub
.
NewPStateObject
(
stateObject
))
}
func
(
app
*
QmlApplication
)
StorageChanged
(
storageObject
*
eth
chain
.
StorageState
)
{
func
(
app
*
QmlApplication
)
StorageChanged
(
storageObject
*
eth
state
.
StorageState
)
{
app
.
win
.
Call
(
"onStorageChangeCb"
,
ethpub
.
NewPStorageState
(
storageObject
))
}
...
...
ethereal/ui_lib.go
View file @
a06a84d1
...
...
@@ -78,8 +78,8 @@ func (ui *UiLib) AssetPath(p string) string {
func
(
self
*
UiLib
)
StartDbWithContractAndData
(
contractHash
,
data
string
)
{
dbWindow
:=
NewDebuggerWindow
(
self
)
object
:=
self
.
eth
.
StateManager
()
.
CurrentState
()
.
GetStateObject
(
ethutil
.
Hex2Bytes
(
contractHash
))
if
len
(
object
.
Script
()
)
>
0
{
dbWindow
.
SetCode
(
"0x"
+
ethutil
.
Bytes2Hex
(
object
.
Script
()
))
if
len
(
object
.
Code
)
>
0
{
dbWindow
.
SetCode
(
"0x"
+
ethutil
.
Bytes2Hex
(
object
.
Code
))
}
dbWindow
.
SetData
(
"0x"
+
data
)
...
...
ethereum/main.go
View file @
a06a84d1
...
...
@@ -9,7 +9,7 @@ import (
const
(
ClientIdentifier
=
"Ethereum(G)"
Version
=
"0.
5.17
"
Version
=
"0.
6.0
"
)
var
logger
=
ethlog
.
NewLogger
(
"CLI"
)
...
...
utils/vm_env.go
0 → 100644
View file @
a06a84d1
package
utils
import
(
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethstate"
"math/big"
)
type
VMEnv
struct
{
state
*
ethstate
.
State
block
*
ethchain
.
Block
transactor
[]
byte
value
*
big
.
Int
}
func
NewEnv
(
state
*
ethstate
.
State
,
block
*
ethchain
.
Block
,
transactor
[]
byte
,
value
*
big
.
Int
)
*
VMEnv
{
return
&
VMEnv
{
state
:
state
,
block
:
block
,
transactor
:
transactor
,
value
:
value
,
}
}
func
(
self
*
VMEnv
)
Origin
()
[]
byte
{
return
self
.
transactor
}
func
(
self
*
VMEnv
)
BlockNumber
()
*
big
.
Int
{
return
self
.
block
.
Number
}
func
(
self
*
VMEnv
)
PrevHash
()
[]
byte
{
return
self
.
block
.
PrevHash
}
func
(
self
*
VMEnv
)
Coinbase
()
[]
byte
{
return
self
.
block
.
Coinbase
}
func
(
self
*
VMEnv
)
Time
()
int64
{
return
self
.
block
.
Time
}
func
(
self
*
VMEnv
)
Difficulty
()
*
big
.
Int
{
return
self
.
block
.
Difficulty
}
func
(
self
*
VMEnv
)
Value
()
*
big
.
Int
{
return
self
.
value
}
func
(
self
*
VMEnv
)
State
()
*
ethstate
.
State
{
return
self
.
state
}
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