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
2114218e
Commit
2114218e
authored
May 28, 2014
by
Maran
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release/poc5-rc11'
parents
198ef971
58032d60
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
106 additions
and
37 deletions
+106
-37
README.md
README.md
+1
-1
debugger.qml
ethereal/assets/debugger/debugger.qml
+5
-1
wallet.qml
ethereal/assets/qml/wallet.qml
+33
-8
debugger.go
ethereal/ui/debugger.go
+46
-24
gui.go
ethereal/ui/gui.go
+1
-1
ui_lib.go
ethereal/ui/ui_lib.go
+20
-2
No files found.
README.md
View file @
2114218e
...
...
@@ -5,7 +5,7 @@ Ethereum
Ethereum Go Client © 2014 Jeffrey Wilcke.
Current state: Proof of Concept 5.0 RC1
0
.
Current state: Proof of Concept 5.0 RC1
1
.
For the development package please see the
[
eth-go package
](
https://github.com/ethereum/eth-go
)
.
...
...
ethereal/assets/debugger/debugger.qml
View file @
2114218e
...
...
@@ -14,6 +14,9 @@ ApplicationWindow {
width
:
1290
height
:
900
property
alias
codeText
:
codeEditor
.
text
property
alias
dataText
:
rawDataField
.
text
MenuBar
{
Menu
{
title
:
"Debugger"
...
...
@@ -167,6 +170,7 @@ ApplicationWindow {
}
}
}
toolBar
:
ToolBar
{
RowLayout
{
spacing
:
5
...
...
@@ -205,7 +209,7 @@ ApplicationWindow {
function
setInstruction
(
num
)
{
asmTableView
.
selection
.
clear
()
asmTableView
.
selection
.
select
(
num
-
1
)
asmTableView
.
selection
.
select
(
num
)
}
function
setMem
(
mem
)
{
...
...
ethereal/assets/qml/wallet.qml
View file @
2114218e
...
...
@@ -340,10 +340,8 @@ ApplicationWindow {
id
:
popup
visible
:
false
property
var
block
width
:
800
height
:
280
x
:
root
.
x
y
:
root
.
y
+
root
.
height
width
:
root
.
width
height
:
240
Component
{
id
:
blockDetailsDelegate
Rectangle
{
...
...
@@ -389,17 +387,27 @@ ApplicationWindow {
onClicked
:
{
var
tx
=
transactionModel
.
get
(
row
)
if
(
tx
.
data
)
{
popup
.
showContractData
(
tx
.
data
)
popup
.
showContractData
(
tx
)
}
else
{
popup
.
height
=
230
}
}
}
function
showContractData
(
data
)
{
contractData
.
text
=
data
function
showContractData
(
tx
)
{
txDetailsDebugButton
.
tx
=
tx
if
(
tx
.
createsContract
)
{
contractData
.
text
=
tx
.
data
contractLabel
.
text
=
"<h4> Transaction created contract "
+
tx
.
address
+
"</h4>"
}
else
{
contractLabel
.
text
=
"<h4> Transaction ran contract "
+
tx
.
address
+
"</h4>"
contractData
.
text
=
tx
.
rawData
}
popup
.
height
=
400
}
Rectangle
{
id
:
txDetails
width
:
popup
.
width
height
:
300
anchors.left
:
listViewThing
.
left
...
...
@@ -411,11 +419,28 @@ ApplicationWindow {
id
:
contractLabel
anchors.leftMargin
:
10
}
Button
{
property
var
tx
id
:
txDetailsDebugButton
anchors.right
:
parent
.
right
anchors.rightMargin
:
10
anchors.top
:
parent
.
top
anchors.topMargin
:
10
text
:
"Debug contract"
onClicked
:
{
if
(
tx
.
createsContract
){
ui
.
startDbWithCode
(
tx
.
rawData
)
}
else
{
ui
.
startDbWithContractAndData
(
tx
.
address
,
tx
.
rawData
)
}
}
}
TextArea
{
id
:
contractData
text
:
"Contract"
anchors.top
:
contractLabel
.
bottom
anchors.left
:
parent
.
left
anchors.bottom
:
popup
.
bottom
wrapMode
:
Text
.
Wrap
width
:
parent
.
width
-
30
height
:
80
...
...
@@ -437,7 +462,7 @@ ApplicationWindow {
transactionModel
.
insert
(
0
,
block
.
txs
.
get
(
i
))
}
if
(
block
.
txs
.
get
(
0
).
data
){
popup
.
showContractData
(
block
.
txs
.
get
(
0
)
.
data
)
popup
.
showContractData
(
block
.
txs
.
get
(
0
))
}
}
txView
.
forceActiveFocus
()
...
...
ethereal/ui/debugger.go
View file @
2114218e
...
...
@@ -9,6 +9,23 @@ import (
"strings"
)
func
formatData
(
data
string
)
[]
byte
{
if
len
(
data
)
==
0
{
return
nil
}
// Simple stupid
d
:=
new
(
big
.
Int
)
if
data
[
0
:
1
]
==
"
\"
"
&&
data
[
len
(
data
)
-
1
:
]
==
"
\"
"
{
d
.
SetBytes
([]
byte
(
data
[
1
:
len
(
data
)
-
1
]))
}
else
if
data
[
:
2
]
==
"0x"
{
d
.
SetBytes
(
ethutil
.
FromHex
(
data
[
2
:
]))
}
else
{
d
.
SetString
(
data
,
0
)
}
return
ethutil
.
BigToBytes
(
d
,
256
)
}
type
DebuggerWindow
struct
{
win
*
qml
.
Window
engine
*
qml
.
Engine
...
...
@@ -41,21 +58,18 @@ func (self *DebuggerWindow) Show() {
}()
}
func
formatData
(
data
string
)
[]
byte
{
if
len
(
data
)
==
0
{
return
nil
}
// Simple stupid
d
:=
new
(
big
.
Int
)
if
data
[
0
:
1
]
==
"
\"
"
&&
data
[
len
(
data
)
-
1
:
]
==
"
\"
"
{
d
.
SetBytes
([]
byte
(
data
[
1
:
len
(
data
)
-
1
]))
}
else
if
data
[
:
2
]
==
"0x"
{
d
.
SetBytes
(
ethutil
.
FromHex
(
data
[
2
:
]))
}
else
{
d
.
SetString
(
data
,
0
)
}
func
(
self
*
DebuggerWindow
)
SetCode
(
code
string
)
{
self
.
win
.
Set
(
"codeText"
,
code
)
}
return
ethutil
.
BigToBytes
(
d
,
256
)
func
(
self
*
DebuggerWindow
)
SetData
(
data
string
)
{
self
.
win
.
Set
(
"dataText"
,
data
)
}
func
(
self
*
DebuggerWindow
)
SetAsm
(
data
string
)
{
dis
:=
ethchain
.
Disassemble
(
ethutil
.
FromHex
(
data
))
for
_
,
str
:=
range
dis
{
self
.
win
.
Root
()
.
Call
(
"setAsm"
,
str
)
}
}
func
(
self
*
DebuggerWindow
)
Debug
(
valueStr
,
gasStr
,
gasPriceStr
,
scriptStr
,
dataStr
string
)
{
...
...
@@ -63,22 +77,28 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
self
.
Db
.
Q
<-
true
}
dataSlice
:=
strings
.
Split
(
dataStr
,
"
\n
"
)
var
data
[]
byte
for
_
,
dataItem
:=
range
dataSlice
{
d
:=
formatData
(
dataItem
)
data
=
append
(
data
,
d
...
)
}
state
:=
self
.
lib
.
eth
.
BlockChain
()
.
CurrentBlock
.
State
()
defer
func
()
{
if
r
:=
recover
();
r
!=
nil
{
fmt
.
Println
(
r
)
self
.
Db
.
done
=
true
}
}()
script
,
err
:=
ethutil
.
Compile
(
scriptStr
)
data
:=
ethutil
.
StringToByteFunc
(
dataStr
,
func
(
s
string
)
(
ret
[]
byte
)
{
slice
:=
strings
.
Split
(
dataStr
,
"
\n
"
)
for
_
,
dataItem
:=
range
slice
{
d
:=
formatData
(
dataItem
)
ret
=
append
(
ret
,
d
...
)
}
return
})
var
err
error
script
:=
ethutil
.
StringToByteFunc
(
scriptStr
,
func
(
s
string
)
(
ret
[]
byte
)
{
ret
,
err
=
ethutil
.
Compile
(
s
)
return
})
if
err
!=
nil
{
ethutil
.
Config
.
Log
.
Debugln
(
err
)
...
...
@@ -91,11 +111,13 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
for
_
,
str
:=
range
dis
{
self
.
win
.
Root
()
.
Call
(
"setAsm"
,
str
)
}
// Contract addr as test address
keyPair
:=
ethutil
.
GetKeyRing
()
.
Get
(
0
)
callerTx
:=
ethchain
.
NewContractCreationTx
(
ethutil
.
Big
(
valueStr
),
ethutil
.
Big
(
gasStr
),
ethutil
.
Big
(
gasPriceStr
),
script
)
callerTx
.
Sign
(
keyPair
.
PrivateKey
)
state
:=
self
.
lib
.
eth
.
BlockChain
()
.
CurrentBlock
.
State
()
account
:=
self
.
lib
.
eth
.
StateManager
()
.
TransState
()
.
GetAccount
(
keyPair
.
Address
())
contract
:=
ethchain
.
MakeContract
(
callerTx
,
state
)
callerClosure
:=
ethchain
.
NewClosure
(
account
,
contract
,
script
,
state
,
ethutil
.
Big
(
gasStr
),
ethutil
.
Big
(
gasPriceStr
))
...
...
ethereal/ui/gui.go
View file @
2114218e
...
...
@@ -54,7 +54,7 @@ func New(ethereum *eth.Ethereum) *Gui {
}
func
(
gui
*
Gui
)
Start
(
assetPath
string
)
{
const
version
=
"0.5.0 RC1
0
"
const
version
=
"0.5.0 RC1
1
"
defer
gui
.
txDb
.
Close
()
...
...
ethereal/ui/ui_lib.go
View file @
2114218e
...
...
@@ -26,6 +26,7 @@ type UiLib struct {
// The main application window
win
*
qml
.
Window
Db
*
Debugger
DbWindow
*
DebuggerWindow
}
func
NewUiLib
(
engine
*
qml
.
Engine
,
eth
*
eth
.
Ethereum
,
assetPath
string
)
*
UiLib
{
...
...
@@ -88,9 +89,26 @@ func (ui *UiLib) ConnectToPeer(addr string) {
func
(
ui
*
UiLib
)
AssetPath
(
p
string
)
string
{
return
path
.
Join
(
ui
.
assetPath
,
p
)
}
func
(
self
*
UiLib
)
StartDbWithContractAndData
(
contractHash
,
data
string
)
{
dbWindow
:=
NewDebuggerWindow
(
self
)
object
:=
self
.
eth
.
StateManager
()
.
CurrentState
()
.
GetStateObject
(
ethutil
.
FromHex
(
contractHash
))
if
len
(
object
.
Script
())
>
0
{
dbWindow
.
SetCode
(
"0x"
+
ethutil
.
Hex
(
object
.
Script
()))
}
dbWindow
.
SetData
(
data
)
dbWindow
.
Show
()
}
func
(
self
*
UiLib
)
StartDbWithCode
(
code
string
)
{
dbWindow
:=
NewDebuggerWindow
(
self
)
dbWindow
.
SetCode
(
"0x"
+
code
)
dbWindow
.
Show
()
}
func
(
self
*
UiLib
)
StartDebugger
()
{
dbWindow
:=
NewDebuggerWindow
(
self
)
//self.DbWindow = dbWindow
dbWindow
.
Show
()
}
...
...
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