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
27735bbd
Commit
27735bbd
authored
Aug 17, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
State dumps from gui
parent
2eab964a
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
158 additions
and
26 deletions
+158
-26
ethereum.js
ethereal/assets/ext/ethereum.js
+14
-2
test.html
ethereal/assets/ext/test.html
+4
-0
chain.qml
ethereal/assets/qml/views/chain.qml
+51
-3
wallet.qml
ethereal/assets/qml/wallet.qml
+29
-17
webapp.qml
ethereal/assets/qml/webapp.qml
+15
-3
ext_app.go
ethereal/ext_app.go
+1
-0
gui.go
ethereal/gui.go
+35
-0
html_container.go
ethereal/html_container.go
+6
-0
qml_container.go
ethereal/qml_container.go
+2
-0
main.go
ethereum/main.go
+1
-1
No files found.
ethereal/assets/ext/ethereum.js
View file @
27735bbd
...
...
@@ -6,7 +6,8 @@ window.eth = {
test
:
function
()
{
var
t
=
undefined
;
navigator
.
qt
.
onmessage
=
function
(
d
)
{
t
=
d
;
}
postData
({
call
:
"test"
})
navigator
.
qt
.
onmessage
=
function
(
d
)
{
console
.
log
(
"onmessage called"
);
t
=
d
;
}
for
(;;)
{
if
(
t
!==
undefined
)
{
return
t
...
...
@@ -14,7 +15,8 @@ window.eth = {
}
},
mutan
:
function
(
code
)
{
mutan
:
function
(
code
,
cb
)
{
postData
({
call
:
"mutan"
,
args
:
[
code
]},
cb
)
},
toHex
:
function
(
str
)
{
...
...
@@ -281,3 +283,13 @@ navigator.qt.onmessage = function(ev) {
}
}
}
eth
.
on
(
"chain:changed"
,
function
()
{
})
eth
.
on
(
"messages"
,
{
/* filters */
},
function
(
messages
){
})
eth
.
on
(
"pending:changed"
,
function
()
{
})
ethereal/assets/ext/test.html
View file @
27735bbd
...
...
@@ -32,6 +32,10 @@ function test() {
eth
.
getBlock
(
"f70097659f329a09642a27f11338d9269de64f1d4485786e36bfc410832148cd"
,
function
(
block
)
{
console
.
log
(
block
)
})
eth
.
mutan
(
"var a = 10"
,
function
(
code
)
{
console
.
log
(
"code"
,
code
)
});
}
</script>
...
...
ethereal/assets/qml/views/chain.qml
View file @
27735bbd
...
...
@@ -25,9 +25,57 @@ Rectangle {
model
:
blockModel
onDoubleClicked
:
{
popup
.
visible
=
true
popup
.
setDetails
(
blockModel
.
get
(
row
))
itemDelegate
:
Item
{
Text
{
anchors
{
left
:
parent
.
left
right
:
parent
.
right
leftMargin
:
10
verticalCenter
:
parent
.
verticalCenter
}
color
:
styleData
.
textColor
elide
:
styleData
.
elideMode
text
:
styleData
.
value
font.pixelSize
:
11
MouseArea
{
acceptedButtons
:
Qt
.
RightButton
propagateComposedEvents
:
true
anchors.fill
:
parent
onClicked
:
{
blockTable
.
selection
.
clear
()
blockTable
.
selection
.
select
(
styleData
.
row
)
contextMenu
.
row
=
styleData
.
row
;
contextMenu
.
popup
()
}
}
}
}
Menu
{
id
:
contextMenu
property
var
row
;
MenuItem
{
text
:
"Details"
onTriggered
:
{
popup
.
visible
=
true
popup
.
setDetails
(
blockModel
.
get
(
this
.
row
))
}
}
MenuSeparator
{}
MenuItem
{
text
:
"Dump State"
onTriggered
:
{
generalFileDialog
.
show
(
false
,
function
(
path
)
{
var
hash
=
blockModel
.
get
(
this
.
row
).
hash
;
gui
.
dumpState
(
hash
,
path
);
});
}
}
}
}
...
...
ethereal/assets/qml/wallet.qml
View file @
27735bbd
...
...
@@ -49,8 +49,7 @@ ApplicationWindow {
text
:
"Import App"
shortcut
:
"Ctrl+o"
onTriggered
:
{
generalFileDialog
.
callback
=
importApp
;
generalFileDialog
.
open
()
generalFileDialog
.
show
(
true
,
importApp
)
}
}
...
...
@@ -62,10 +61,9 @@ ApplicationWindow {
MenuItem
{
text
:
"Add plugin"
onTriggered
:
{
generalFileDialog
.
callback
=
function
(
path
)
{
generalFileDialog
.
show
(
true
,
function
(
path
)
{
addPlugin
(
path
,
{
canClose
:
true
})
}
generalFileDialog
.
open
()
})
}
}
...
...
@@ -75,10 +73,9 @@ ApplicationWindow {
text
:
"Import key"
shortcut
:
"Ctrl+i"
onTriggered
:
{
generalFileDialog
.
callback
=
function
(
path
)
{
ui
.
importKey
(
path
)
}
generalFileDialog
.
open
()
generalFileDialog
.
show
(
true
,
function
(
path
)
{
gui
.
importKey
(
path
)
})
}
}
...
...
@@ -86,9 +83,8 @@ ApplicationWindow {
text
:
"Export keys"
shortcut
:
"Ctrl+e"
onTriggered
:
{
generalFileDialog
.
callback
=
function
(
path
)
{
}
generalFileDialog
.
open
()
generalFileDialog
.
show
(
false
,
function
(
path
)
{
})
}
}
}
...
...
@@ -111,10 +107,19 @@ ApplicationWindow {
MenuItem
{
text
:
"Run JS file"
onTriggered
:
{
generalFileDialog
.
callback
=
function
(
path
)
{
generalFileDialog
.
show
(
true
,
function
(
path
)
{
eth
.
evalJavascriptFile
(
path
)
}
generalFileDialog
.
open
()
})
}
}
MenuItem
{
text
:
"Dump state"
onTriggered
:
{
generalFileDialog
.
show
(
false
,
function
(
path
)
{
// Empty hash for latest
gui
.
dumpState
(
""
,
path
)
})
}
}
}
...
...
@@ -396,8 +401,15 @@ ApplicationWindow {
id
:
generalFileDialog
property
var
callback
;
onAccepted
:
{
var
path
=
this
.
fileUrl
.
toString
()
callback
.
call
(
this
,
path
)
var
path
=
this
.
fileUrl
.
toString
();
callback
.
call
(
this
,
path
);
}
function
show
(
selectExisting
,
callback
)
{
generalFileDialog
.
callback
=
callback
;
generalFileDialog
.
selectExisting
=
selectExisting
;
this
.
open
();
}
}
...
...
ethereal/assets/qml/webapp.qml
View file @
27735bbd
...
...
@@ -78,6 +78,7 @@ ApplicationWindow {
}
}
WebView
{
objectName
:
"webView"
id
:
webview
...
...
@@ -127,6 +128,8 @@ ApplicationWindow {
this
.
cleanPath
=
false
;
}
}
experimental.preferences.javascriptEnabled
:
true
experimental.preferences.navigatorQtObjectEnabled
:
true
experimental.preferences.developerExtrasEnabled
:
true
...
...
@@ -251,9 +254,13 @@ ApplicationWindow {
break
case
"debug"
:
console
.
log
(
data
.
args
[
0
]);
break
;
case
"mutan"
:
require
(
1
)
var
code
=
eth
.
compileMutan
(
data
.
args
[
0
])
postData
(
data
.
_seed
,
"0x"
+
code
)
break
;
}
}
catch
(
e
)
{
console
.
log
(
data
.
call
+
": "
+
e
)
...
...
@@ -262,6 +269,11 @@ ApplicationWindow {
}
}
function
post
(
seed
,
data
)
{
console
.
log
(
"data"
,
data
)
postData
(
data
.
_seed
,
data
)
}
function
require
(
args
,
num
)
{
if
(
args
.
length
<
num
)
{
throw
(
"required argument count of "
+
num
+
" got "
+
args
.
length
);
...
...
ethereal/ext_app.go
View file @
27735bbd
...
...
@@ -21,6 +21,7 @@ type AppContainer interface {
NewBlock
(
*
ethchain
.
Block
)
NewWatcher
(
chan
bool
)
Messages
(
ethstate
.
Messages
,
string
)
Post
(
string
,
int
)
}
type
ExtApplication
struct
{
...
...
ethereal/gui.go
View file @
27735bbd
...
...
@@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"math/big"
"os"
"strconv"
"strings"
"time"
...
...
@@ -155,6 +156,40 @@ func (gui *Gui) showWallet(context *qml.Context) (*qml.Window, error) {
return
gui
.
win
,
nil
}
func
(
self
*
Gui
)
DumpState
(
hash
,
path
string
)
{
var
stateDump
[]
byte
if
len
(
hash
)
==
0
{
stateDump
=
self
.
eth
.
StateManager
()
.
CurrentState
()
.
Dump
()
}
else
{
var
block
*
ethchain
.
Block
if
hash
[
0
]
==
'#'
{
i
,
_
:=
strconv
.
Atoi
(
hash
[
1
:
])
block
=
self
.
eth
.
BlockChain
()
.
GetBlockByNumber
(
uint64
(
i
))
}
else
{
block
=
self
.
eth
.
BlockChain
()
.
GetBlock
(
ethutil
.
Hex2Bytes
(
hash
))
}
if
block
==
nil
{
logger
.
Infof
(
"block err: not found %s
\n
"
,
hash
)
return
}
stateDump
=
block
.
State
()
.
Dump
()
}
file
,
err
:=
os
.
OpenFile
(
path
[
7
:
],
os
.
O_CREATE
|
os
.
O_RDWR
,
os
.
ModePerm
)
if
err
!=
nil
{
logger
.
Infoln
(
"dump err: "
,
err
)
return
}
defer
file
.
Close
()
logger
.
Infof
(
"dumped state (%s) to %s
\n
"
,
hash
,
path
)
file
.
Write
(
stateDump
)
}
// The done handler will be called by QML when all views have been loaded
func
(
gui
*
Gui
)
Done
()
{
gui
.
qmlDone
=
true
...
...
ethereal/html_container.go
View file @
27735bbd
...
...
@@ -3,6 +3,7 @@ package main
import
(
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/url"
"os"
...
...
@@ -139,3 +140,8 @@ func (self *HtmlApplication) Messages(messages ethstate.Messages, id string) {
func
(
app
*
HtmlApplication
)
Destroy
()
{
app
.
engine
.
Destroy
()
}
func
(
app
*
HtmlApplication
)
Post
(
data
string
,
seed
int
)
{
fmt
.
Println
(
"about to call 'post'"
)
app
.
webView
.
Call
(
"post"
,
seed
,
data
)
}
ethereal/qml_container.go
View file @
27735bbd
...
...
@@ -64,3 +64,5 @@ func (app *QmlApplication) Engine() *qml.Engine {
func
(
app
*
QmlApplication
)
Window
()
*
qml
.
Window
{
return
app
.
win
}
func
(
app
*
QmlApplication
)
Post
(
data
string
,
s
int
)
{}
ethereum/main.go
View file @
27735bbd
...
...
@@ -71,7 +71,7 @@ func main() {
}
// Leave the Println. This needs clean output for piping
fmt
.
Print
ln
(
block
.
State
()
.
Dump
())
fmt
.
Print
f
(
"%s
\n
"
,
block
.
State
()
.
Dump
())
os
.
Exit
(
0
)
}
...
...
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