From 0ee258bb75a4b6649f67499884871d4ca774cd1f Mon Sep 17 00:00:00 2001 From: Maran Date: Wed, 11 Jun 2014 10:27:58 +0200 Subject: [PATCH 1/9] Add GasLimit to the block explorer --- ethereal/assets/qml/wallet.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index fece8e7d6..70e877be6 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -419,6 +419,7 @@ ApplicationWindow { Text { text: 'Hash: ' + hash; color: "#F2F2F2"} Text { text: 'Coinbase: ' + coinbase; color: "#F2F2F2"} Text { text: 'Block found at: ' + prettyTime; color: "#F2F2F2"} + Text { text: 'Gas Limit: ' + gasLimit; color: "#F2F2F2"} } } } @@ -642,9 +643,9 @@ ApplicationWindow { } if(initial){ - blockModel.append({number: block.number, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + blockModel.append({number: block.number, gasLimit: block.gasLimit, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) }else{ - blockModel.insert(0, {number: block.number, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + blockModel.insert(0, {number: block.number, gasLimit: block.gasLimit, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) } } From 57e3b1b093a2533e26198e9198b85556bf362b27 Mon Sep 17 00:00:00 2001 From: Maran Date: Wed, 11 Jun 2014 11:40:13 +0200 Subject: [PATCH 2/9] Implemented usedGas to the explorer --- ethereal/assets/qml/wallet.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 70e877be6..0555cd2f2 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -419,7 +419,7 @@ ApplicationWindow { Text { text: 'Hash: ' + hash; color: "#F2F2F2"} Text { text: 'Coinbase: ' + coinbase; color: "#F2F2F2"} Text { text: 'Block found at: ' + prettyTime; color: "#F2F2F2"} - Text { text: 'Gas Limit: ' + gasLimit; color: "#F2F2F2"} + Text { text: 'Gas used: ' + gasUsed + " / " + gasLimit; color: "#F2F2F2"} } } } @@ -643,9 +643,9 @@ ApplicationWindow { } if(initial){ - blockModel.append({number: block.number, gasLimit: block.gasLimit, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + blockModel.append({number: block.number, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) }else{ - blockModel.insert(0, {number: block.number, gasLimit: block.gasLimit, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + blockModel.insert(0, {number: block.number, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) } } From e36badd744bc79c652deb3d45da1438982ec622a Mon Sep 17 00:00:00 2001 From: Maran Date: Wed, 11 Jun 2014 12:33:11 +0200 Subject: [PATCH 3/9] Reimplement -datadir flag. Implements #79 The config file is actually loaded from the folder that datadir points at --- ethereal/config.go | 4 ++++ ethereal/ethereum.go | 4 ++-- ethereum/config.go | 4 ++++ ethereum/ethereum.go | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ethereal/config.go b/ethereal/config.go index 6a42663e7..2315d1435 100644 --- a/ethereal/config.go +++ b/ethereal/config.go @@ -20,6 +20,8 @@ var ImportKey string var ExportKey bool var AssetPath string +var Datadir string + func Init() { flag.StringVar(&Identifier, "id", "", "Custom client identifier") flag.StringVar(&OutboundPort, "port", "30303", "listening port") @@ -35,5 +37,7 @@ func Init() { flag.BoolVar(&ExportKey, "export", false, "export private key") flag.StringVar(&ImportKey, "import", "", "imports the given private key (hex)") + flag.StringVar(&Datadir, "datadir", ".ethereal", "specifies the datadir to use. Takes precedence over config file.") + flag.Parse() } diff --git a/ethereal/ethereum.go b/ethereal/ethereum.go index b6e1c681b..7ace16760 100644 --- a/ethereal/ethereum.go +++ b/ethereal/ethereum.go @@ -43,14 +43,14 @@ func main() { ethchain.InitFees() g, err := globalconf.NewWithOptions(&globalconf.Options{ - Filename: path.Join(ethutil.ApplicationFolder(".ethereal"), "conf.ini"), + Filename: path.Join(ethutil.ApplicationFolder(Datadir), "conf.ini"), }) if err != nil { fmt.Println(err) } else { g.ParseAll() } - ethutil.ReadConfig(".ethereal", ethutil.LogFile|ethutil.LogStd, g, Identifier) + ethutil.ReadConfig(Datadir, ethutil.LogFile|ethutil.LogStd, g, Identifier) // Instantiated a eth stack ethereum, err := eth.New(eth.CapDefault, UseUPnP) diff --git a/ethereum/config.go b/ethereum/config.go index 39dc11727..a80b47a8e 100644 --- a/ethereum/config.go +++ b/ethereum/config.go @@ -24,6 +24,8 @@ var NonInteractive bool var StartJsConsole bool var InputFile string +var Datadir string + func Init() { flag.Usage = func() { fmt.Fprintf(os.Stderr, "%s [options] [filename]:\n", os.Args[0]) @@ -46,6 +48,8 @@ func Init() { flag.StringVar(&LogFile, "logfile", "", "log file (defaults to standard output)") flag.StringVar(&ImportKey, "import", "", "imports the given private key (hex)") + flag.StringVar(&Datadir, "datadir", ".ethereum", "specifies the datadir to use. Takes precedence over config file.") + flag.Parse() InputFile = flag.Arg(0) diff --git a/ethereum/ethereum.go b/ethereum/ethereum.go index 56ea46122..179a3f462 100644 --- a/ethereum/ethereum.go +++ b/ethereum/ethereum.go @@ -62,14 +62,14 @@ func main() { } g, err := globalconf.NewWithOptions(&globalconf.Options{ - Filename: path.Join(ethutil.ApplicationFolder(".ethereum"), "conf.ini"), + Filename: path.Join(ethutil.ApplicationFolder(Datadir), "conf.ini"), }) if err != nil { fmt.Println(err) } else { g.ParseAll() } - ethutil.ReadConfig(".ethereum", lt, g, Identifier) + ethutil.ReadConfig(Datadir, lt, g, Identifier) logger := ethutil.Config.Log From 1d300bbc108f9d404d2eb5cbc8990042c0129f04 Mon Sep 17 00:00:00 2001 From: Maran Date: Wed, 11 Jun 2014 15:55:47 +0200 Subject: [PATCH 4/9] Toggle inspector / reload using magic rectangle --- ethereal/assets/qml/webapp.qml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/ethereal/assets/qml/webapp.qml b/ethereal/assets/qml/webapp.qml index ec236a18c..4a5a1293a 100644 --- a/ethereal/assets/qml/webapp.qml +++ b/ethereal/assets/qml/webapp.qml @@ -170,6 +170,30 @@ ApplicationWindow { postEvent(ev, [storageObject.address, storageObject.value]) } } + Rectangle { + id: toggleInspector + color: "#bcbcbc" + visible: true + height: 12 + width: 12 + anchors { + right: root.right + } + MouseArea { + onClicked: { + if(inspector.visible == true){ + inspector.visible = false + }else{ + inspector.visible = true + } + } + onDoubleClicked: { + console.log('refreshing') + webView.reload() + } + anchors.fill: parent + } + } Rectangle { id: sizeGrip @@ -193,7 +217,7 @@ ApplicationWindow { WebView { id: inspector - visible: true + visible: false url: webview.experimental.remoteInspectorUrl anchors { left: root.left From e7a22af0e633db4da3d81f1ad07126ea3b06f891 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 12 Jun 2014 10:06:02 +0200 Subject: [PATCH 5/9] Minor UI adjustments --- ethereal/assets/qml/wallet.qml | 49 +++++++++++++++++++++++++++------- ethereal/ui/gui.go | 2 +- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 0555cd2f2..0e065caa4 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -768,6 +768,20 @@ ApplicationWindow { anchors.leftMargin: 5 anchors.topMargin: 5 + ListModel { + id: denomModel + ListElement { text: "Wei" ; zeros: "" } + ListElement { text: "Ada" ; zeros: "000" } + ListElement { text: "Babbage" ; zeros: "000000" } + ListElement { text: "Shannon" ; zeros: "000000000" } + ListElement { text: "Szabo" ; zeros: "000000000000" } + ListElement { text: "Finney" ; zeros: "000000000000000" } + ListElement { text: "Ether" ; zeros: "000000000000000000" } + ListElement { text: "Einstein" ;zeros: "000000000000000000000" } + ListElement { text: "Douglas" ; zeros: "000000000000000000000000000000000000000000" } + } + + TextField { id: txFuelRecipient placeholderText: "Address / Name or empty for contract" @@ -775,13 +789,21 @@ ApplicationWindow { width: 400 } - TextField { - id: txValue - width: 222 - placeholderText: "Amount" - validator: RegExpValidator { regExp: /\d*/ } - onTextChanged: { - contractFormReady() + RowLayout { + TextField { + id: txValue + width: 222 + placeholderText: "Amount" + validator: RegExpValidator { regExp: /\d*/ } + onTextChanged: { + contractFormReady() + } + } + + ComboBox { + id: valueDenom + currentIndex: 6 + model: denomModel } } @@ -807,7 +829,7 @@ ApplicationWindow { id: txGasPrice width: 200 placeholderText: "Gas price" - text: "1000000" + text: "10" validator: RegExpValidator { regExp: /\d*/ } /* onTextChanged: { @@ -815,6 +837,12 @@ ApplicationWindow { } */ } + + ComboBox { + id: gasDenom + currentIndex: 4 + model: denomModel + } } Label { @@ -848,8 +876,9 @@ ApplicationWindow { ] text: "Send" onClicked: { - //this.enabled = false - var res = eth.create(txFuelRecipient.text, txValue.text, txGas.text, txGasPrice.text, codeView.text) + var value = txValue.text + denomModel.get(valueDenom.currentIndex).zeros; + var gasPrice = txGasPrice.text + denomModel.get(gasDenom.currentIndex).zeros; + var res = eth.create(txFuelRecipient.text, value, txGas.text, gasPrice, codeView.text) if(res[1]) { txResult.text = "Your contract could not be send over the network:\n" txResult.text += res[1].error() diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go index 2ba89ce22..23f53ef47 100644 --- a/ethereal/ui/gui.go +++ b/ethereal/ui/gui.go @@ -69,7 +69,7 @@ func (gui *Gui) Start(assetPath string) { Init: func(p *ethpub.KeyVal, obj qml.Object) { p.Key = ""; p.Value = "" }, }}) - ethutil.Config.SetClientString(fmt.Sprintf("/Ethereal v%s", version)) + ethutil.Config.SetClientString("Ethereal") // Create a new QML engine gui.engine = qml.NewEngine() From ef1b923b31dfda78bc8f3dce415721aa9518fe4b Mon Sep 17 00:00:00 2001 From: obscuren Date: Sat, 14 Jun 2014 15:44:32 +0200 Subject: [PATCH 6/9] Added a log level slider which can change the log level --- ethereal/assets/debugger/debugger.qml | 6 ++-- ethereal/assets/qml/wallet.qml | 52 +++++++++++++++++++++++---- ethereal/ui/gui.go | 4 +++ 3 files changed, 53 insertions(+), 9 deletions(-) diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml index bc34233fd..31e0eb781 100644 --- a/ethereal/assets/debugger/debugger.qml +++ b/ethereal/assets/debugger/debugger.qml @@ -135,7 +135,7 @@ ApplicationWindow { } height: parent.height width: 300 - TableViewColumn{ role: "value" ; title: "Stack" ; width: 200 } + TableViewColumn{ role: "value" ; title: "Temp" ; width: 200 } model: stackModel } @@ -224,8 +224,8 @@ ApplicationWindow { } function setInstruction(num) { - //asmTableView.selection.clear() - //asmTableView.selection.select(num) + asmTableView.selection.clear() + asmTableView.selection.select(num) } function setMem(mem) { diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 0e065caa4..b98497aba 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -29,6 +29,7 @@ ApplicationWindow { } Menu { + title: "Developer" MenuItem { text: "Debugger" shortcut: "Ctrl+d" @@ -261,7 +262,7 @@ ApplicationWindow { id: addressView width: parent.width - 200 height: 200 - anchors.bottom: logView.top + anchors.bottom: logLayout.top TableViewColumn{ role: "name"; title: "name" } TableViewColumn{ role: "address"; title: "address"; width: 300} @@ -296,14 +297,48 @@ ApplicationWindow { property var logModel: ListModel { id: logModel } - TableView { - id: logView + RowLayout { + id: logLayout width: parent.width height: 200 anchors.bottom: parent.bottom - TableViewColumn{ role: "description" ; title: "log" } + TableView { + id: logView + headerVisible: false + anchors { + right: logLevelSlider.left + left: parent.left + bottom: parent.bottom + top: parent.top + } - model: logModel + TableViewColumn{ role: "description" ; title: "log" } + + model: logModel + } + + Slider { + id: logLevelSlider + value: 2 + anchors { + right: parent.right + top: parent.top + bottom: parent.bottom + + rightMargin: 5 + leftMargin: 5 + topMargin: 5 + bottomMargin: 5 + } + + orientation: Qt.Vertical + maximumValue: 3 + stepSize: 1 + + onValueChanged: { + eth.setLogLevel(value) + } + } } } @@ -651,7 +686,12 @@ ApplicationWindow { function addLog(str) { if(str.len != 0) { - logModel.insert(0, {description: str}) + if(logView.flickableItem.atYEnd) { + logModel.append({description: str}) + logView.positionViewAtRow(logView.rowCount - 1, ListView.Contain) + } else { + logModel.append({description: str}) + } } } diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go index 23f53ef47..b67035149 100644 --- a/ethereal/ui/gui.go +++ b/ethereal/ui/gui.go @@ -356,3 +356,7 @@ func (gui *Gui) ChangeClientId(id string) { func (gui *Gui) ClientId() string { return ethutil.Config.Identifier } + +func (gui *Gui) SetLogLevel(level int) { + ethutil.Config.Log.SetLevel(level) +} From 7ab735eb02f92a7bfc67dff2515eadea18036844 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sun, 15 Jun 2014 00:02:41 +0200 Subject: [PATCH 7/9] Max 250 log --- ethereal/assets/qml/wallet.qml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index b98497aba..a7c03f6d1 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -319,7 +319,7 @@ ApplicationWindow { Slider { id: logLevelSlider - value: 2 + value: 1 anchors { right: parent.right top: parent.top @@ -685,6 +685,11 @@ ApplicationWindow { } function addLog(str) { + // Remove first item once we've reached max log items + if(logModel.count > 250) { + logModel.remove(0) + } + if(str.len != 0) { if(logView.flickableItem.atYEnd) { logModel.append({description: str}) @@ -693,6 +698,7 @@ ApplicationWindow { logModel.append({description: str}) } } + } function setPeers(text) { From 3744151359a7ff352fde5be39905ecb3d22c9d28 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 16 Jun 2014 11:15:08 +0200 Subject: [PATCH 8/9] Removed init fees --- ethereal/ethereum.go | 3 --- ethereum/ethereum.go | 3 --- 2 files changed, 6 deletions(-) diff --git a/ethereal/ethereum.go b/ethereal/ethereum.go index 7ace16760..0db1fa4cd 100644 --- a/ethereal/ethereum.go +++ b/ethereal/ethereum.go @@ -3,7 +3,6 @@ package main import ( "fmt" "github.com/ethereum/eth-go" - "github.com/ethereum/eth-go/ethchain" "github.com/ethereum/eth-go/ethutil" "github.com/ethereum/go-ethereum/ethereal/ui" "github.com/ethereum/go-ethereum/utils" @@ -40,8 +39,6 @@ func main() { runtime.GOMAXPROCS(runtime.NumCPU()) - ethchain.InitFees() - g, err := globalconf.NewWithOptions(&globalconf.Options{ Filename: path.Join(ethutil.ApplicationFolder(Datadir), "conf.ini"), }) diff --git a/ethereum/ethereum.go b/ethereum/ethereum.go index 179a3f462..8812e0a60 100644 --- a/ethereum/ethereum.go +++ b/ethereum/ethereum.go @@ -3,7 +3,6 @@ package main import ( "fmt" "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/rakyll/globalconf" @@ -86,8 +85,6 @@ func main() { logSys = log.New(os.Stdout, "", flags) } - ethchain.InitFees() - // Instantiated a eth stack ethereum, err := eth.New(eth.CapDefault, UseUPnP) if err != nil { From c1220e87293e440f842095c5a601515c0c8f5cb0 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 16 Jun 2014 18:24:24 +0200 Subject: [PATCH 9/9] bump --- README.md | 2 +- ethereal/ui/gui.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 104e4725c..eee24f71e 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Ethereum Ethereum Go Client © 2014 Jeffrey Wilcke. -Current state: Proof of Concept 5.0 RC12. +Current state: Proof of Concept 5.0 RC13. For the development package please see the [eth-go package](https://github.com/ethereum/eth-go). diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go index b67035149..01d963332 100644 --- a/ethereal/ui/gui.go +++ b/ethereal/ui/gui.go @@ -56,7 +56,7 @@ func New(ethereum *eth.Ethereum) *Gui { } func (gui *Gui) Start(assetPath string) { - const version = "0.5.0 RC12" + const version = "0.5.0 RC13" defer gui.txDb.Close()