From a0f73c2703aacab189c5cf26a5c95e156039eb9e Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 27 May 2014 16:09:04 +0200 Subject: [PATCH] Minor fixes and improvements to the ui --- ethereal/assets/debugger/debugger.qml | 12 ++++----- ethereal/assets/heart.png | Bin 0 -> 4277 bytes ethereal/assets/qml/wallet.qml | 21 +++------------- ethereal/ui/debugger.go | 34 +++++++++++++++++++++++--- 4 files changed, 40 insertions(+), 27 deletions(-) create mode 100644 ethereal/assets/heart.png diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml index bf69b4254..9ea131d7d 100644 --- a/ethereal/assets/debugger/debugger.qml +++ b/ethereal/assets/debugger/debugger.qml @@ -8,7 +8,7 @@ import Ethereum 1.0 ApplicationWindow { visible: false - title: "Debugger" + title: "IceCream" minimumWidth: 1280 minimumHeight: 900 width: 1290 @@ -58,9 +58,10 @@ ApplicationWindow { anchors.bottom: parent.bottom Label { - text: "Data" + text: "Arbitrary data" } TextArea { + id: rawDataField anchors.left: parent.left anchors.right: parent.right height: 150 @@ -105,7 +106,7 @@ ApplicationWindow { SplitView { orientation: Qt.Horizontal - height: 300 + height: 250 TableView { id: stackTableView @@ -149,16 +150,15 @@ ApplicationWindow { } } } - statusBar: StatusBar { + toolBar: ToolBar { RowLayout { spacing: 5 - anchors.fill: parent Button { property var enabled: true id: debugStart onClicked: { - dbg.debug(txValue.text, txGas.text, txGasPrice.text, codeEditor.text) + dbg.debug(txValue.text, txGas.text, txGasPrice.text, codeEditor.text, rawDataField.text) } text: "Debug" } diff --git a/ethereal/assets/heart.png b/ethereal/assets/heart.png new file mode 100644 index 0000000000000000000000000000000000000000..3c874ab7f36da5f25e7295ee5572738941dfe2e8 GIT binary patch literal 4277 zcmZ`*2{@GN`yNboQnpB?$&zBmF56fJV?>BBvdu6U`!Wp4nk9^63zH>OvMY*cNcMCL z*%g`?OGwJGCV$lL9RIG)T-P`AefM+U@AKTx`##q`aIucb(FKKWsUY22MxO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Text { text: 'Block found at: ' + prettyTime; color: "#F2F2F2"} } + } } - } ListView { model: singleBlock delegate: blockDetailsDelegate diff --git a/ethereal/ui/debugger.go b/ethereal/ui/debugger.go index 817c0b08f..8b27c2fe5 100644 --- a/ethereal/ui/debugger.go +++ b/ethereal/ui/debugger.go @@ -5,6 +5,8 @@ import ( "github.com/ethereum/eth-go/ethchain" "github.com/ethereum/eth-go/ethutil" "github.com/go-qml/qml" + "math/big" + "strings" ) type DebuggerWindow struct { @@ -39,11 +41,35 @@ func (self *DebuggerWindow) Show() { }() } -func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, data string) { +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) +} + +func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, dataStr string) { if !self.Db.done { 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() { @@ -52,7 +78,7 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, data string) { } }() - script, err := ethutil.Compile(data) + script, err := ethutil.Compile(scriptStr) if err != nil { ethutil.Config.Log.Debugln(err) @@ -72,7 +98,7 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, data string) { account := self.lib.eth.StateManager().TransState().GetAccount(keyPair.Address()) contract := ethchain.MakeContract(callerTx, state) - callerClosure := ethchain.NewClosure(account, contract, contract.Init(), state, ethutil.Big(gasStr), ethutil.Big(gasPriceStr)) + callerClosure := ethchain.NewClosure(account, contract, script, state, ethutil.Big(gasStr), ethutil.Big(gasPriceStr)) block := self.lib.eth.BlockChain().CurrentBlock vm := ethchain.NewVm(state, self.lib.eth.StateManager(), ethchain.RuntimeVars{ @@ -86,7 +112,7 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, data string) { self.Db.done = false go func() { - callerClosure.Call(vm, contract.Init(), self.Db.halting) + callerClosure.Call(vm, data, self.Db.halting) state.Reset()