aboutsummaryrefslogtreecommitdiffstats
path: root/ethereal
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-05-27 16:29:12 +0800
committerMaran <maran.hidskes@gmail.com>2014-05-27 16:29:12 +0800
commit474c85bc9d4b8ef88c933cf0fb9d58bf913f6cbe (patch)
tree1d37eab24c24ee7d7aeac452047d0749b6926797 /ethereal
parentf7eb4e587f83e4472e3d214076ba0c28102daefd (diff)
parentd694e00a3340a36c39872950bb7a2404e9686c18 (diff)
downloaddexon-474c85bc9d4b8ef88c933cf0fb9d58bf913f6cbe.tar.gz
dexon-474c85bc9d4b8ef88c933cf0fb9d58bf913f6cbe.tar.zst
dexon-474c85bc9d4b8ef88c933cf0fb9d58bf913f6cbe.zip
Fix merge conflict
Diffstat (limited to 'ethereal')
-rw-r--r--ethereal/assets/qml/wallet.qml75
-rw-r--r--ethereal/assets/samplecoin/samplecoin.html2
-rw-r--r--ethereal/ui/gui.go2
-rw-r--r--ethereal/ui/ui_lib.go32
4 files changed, 64 insertions, 47 deletions
diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml
index 81ad7ef24..f318ad173 100644
--- a/ethereal/assets/qml/wallet.qml
+++ b/ethereal/assets/qml/wallet.qml
@@ -505,7 +505,7 @@ ApplicationWindow {
}
- Window {
+ ApplicationWindow {
id: debugWindow
visible: false
title: "Debugger"
@@ -543,36 +543,49 @@ ApplicationWindow {
orientation: Qt.Vertical
anchors.fill: parent
- TableView {
- property var memModel: ListModel {
- id: memModel
- }
- height: parent.height/2
- width: parent.width
- TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50}
- TableViewColumn{ role: "value" ; title: "Memory" ; width: 750}
- model: memModel
- }
-
- SplitView {
- orientation: Qt.Horizontal
- TableView {
- property var debuggerLog: ListModel {
- id: debuggerLog
- }
- TableViewColumn{ role: "value"; title: "Debug messages" }
- model: debuggerLog
- }
- TableView {
- property var stackModel: ListModel {
- id: stackModel
- }
- height: parent.height/2
- width: parent.width
- TableViewColumn{ role: "value" ; title: "Stack"}
- model: stackModel
- }
- }
+ TableView {
+ property var memModel: ListModel {
+ id: memModel
+ }
+ height: parent.height/2
+ width: parent.width
+ TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50}
+ TableViewColumn{ role: "value" ; title: "Memory" ; width: 750}
+ model: memModel
+ }
+
+ SplitView {
+ orientation: Qt.Horizontal
+ TableView {
+ property var debuggerLog: ListModel {
+ id: debuggerLog
+ }
+ TableViewColumn{ role: "value"; title: "Debug messages" }
+ model: debuggerLog
+ }
+ TableView {
+ property var stackModel: ListModel {
+ id: stackModel
+ }
+ height: parent.height/2
+ width: parent.width
+ TableViewColumn{ role: "value" ; title: "Stack" ; width: parent.width }
+ model: stackModel
+ }
+ }
+ }
+ }
+ }
+ statusBar: StatusBar {
+ RowLayout {
+ anchors.fill: parent
+ Button {
+ property var enabled: true
+ id: debugNextButton
+ onClicked: {
+ ui.next()
+ }
+ text: "Next"
}
}
}
diff --git a/ethereal/assets/samplecoin/samplecoin.html b/ethereal/assets/samplecoin/samplecoin.html
index 3892141cd..e780aefb4 100644
--- a/ethereal/assets/samplecoin/samplecoin.html
+++ b/ethereal/assets/samplecoin/samplecoin.html
@@ -9,7 +9,7 @@
<script type="text/javascript">
-var jefcoinAddr = "fc0a9436890478bb9b1c6ed7455c2535366f4a99"
+var jefcoinAddr = "518546ffa883dcc838a64bc2dabada0fd64af459"
var mAddr = ""
function createTransaction() {
diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go
index 794786d97..64c739c15 100644
--- a/ethereal/ui/gui.go
+++ b/ethereal/ui/gui.go
@@ -130,7 +130,7 @@ func (gui *Gui) createWindow(comp qml.Object) *qml.Window {
gui.win = win
gui.uiLib.win = win
- db := &Debugger{gui.win, make(chan bool)}
+ db := &Debugger{gui.win, make(chan bool), true}
gui.lib.Db = db
gui.uiLib.Db = db
diff --git a/ethereal/ui/ui_lib.go b/ethereal/ui/ui_lib.go
index 1c88b0181..51fa26a88 100644
--- a/ethereal/ui/ui_lib.go
+++ b/ethereal/ui/ui_lib.go
@@ -6,9 +6,7 @@ import (
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethutil"
- "github.com/ethereum/go-ethereum/utils"
"github.com/go-qml/qml"
- "github.com/obscuren/mutan"
"os"
"path"
"path/filepath"
@@ -121,27 +119,28 @@ func DefaultAssetPath() string {
func (ui *UiLib) DebugTx(recipient, valueStr, gasStr, gasPriceStr, data string) {
state := ui.eth.BlockChain().CurrentBlock.State()
- mainInput, _ := mutan.PreParse(data)
- callerScript, err := utils.Compile(mainInput)
+ script, err := ethutil.Compile(data)
if err != nil {
ethutil.Config.Log.Debugln(err)
return
}
- dis := ethchain.Disassemble(callerScript)
+ dis := ethchain.Disassemble(script)
ui.win.Root().Call("clearAsm")
for _, str := range dis {
ui.win.Root().Call("setAsm", str)
}
- callerTx := ethchain.NewContractCreationTx(ethutil.Big(valueStr), ethutil.Big(gasStr), ethutil.Big(gasPriceStr), nil)
-
// 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)
+
account := ui.eth.StateManager().TransState().GetStateObject(keyPair.Address())
- c := ethchain.MakeContract(callerTx, state)
- callerClosure := ethchain.NewClosure(account, c, c.Script(), state, ethutil.Big(gasStr), ethutil.Big(gasPriceStr))
+ contract := ethchain.MakeContract(callerTx, state)
+ callerClosure := ethchain.NewClosure(account, contract, contract.Init(), state, ethutil.Big(gasStr), ethutil.Big(gasPriceStr))
block := ui.eth.BlockChain().CurrentBlock
vm := ethchain.NewVm(state, ui.eth.StateManager(), ethchain.RuntimeVars{
@@ -151,23 +150,28 @@ func (ui *UiLib) DebugTx(recipient, valueStr, gasStr, gasPriceStr, data string)
Coinbase: block.Coinbase,
Time: block.Time,
Diff: block.Difficulty,
- TxData: nil,
})
+ ui.Db.done = false
go func() {
- callerClosure.Call(vm, nil, ui.Db.halting)
+ callerClosure.Call(vm, contract.Init(), ui.Db.halting)
state.Reset()
+
+ ui.Db.done = true
}()
}
func (ui *UiLib) Next() {
- ui.Db.Next()
+ if !ui.Db.done {
+ ui.Db.Next()
+ }
}
type Debugger struct {
- win *qml.Window
- N chan bool
+ win *qml.Window
+ N chan bool
+ done bool
}
func (d *Debugger) halting(pc int, op ethchain.OpCode, mem *ethchain.Memory, stack *ethchain.Stack) {