From 184055b3e2995894ccaba364484223e488730627 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 23 Oct 2014 15:48:53 +0200 Subject: cmd/*: add license headers --- cmd/mist/assets/ext/big.js | 17 +++++++++++++++++ cmd/mist/assets/ext/ethereum.js | 17 +++++++++++++++++ cmd/mist/assets/ext/filter.js | 17 +++++++++++++++++ cmd/mist/assets/ext/html_messaging.js | 17 +++++++++++++++++ cmd/mist/assets/ext/http.js | 17 +++++++++++++++++ cmd/mist/assets/ext/qml_messaging.js | 17 +++++++++++++++++ cmd/mist/assets/ext/qt_messaging_adapter.js | 17 +++++++++++++++++ cmd/mist/assets/ext/string.js | 17 +++++++++++++++++ cmd/mist/assets/muted/muted.js | 17 +++++++++++++++++ cmd/mist/bindings.go | 17 +++++++++++++++++ cmd/mist/debugger.go | 17 +++++++++++++++++ cmd/mist/errors.go | 17 +++++++++++++++++ cmd/mist/ext_app.go | 17 +++++++++++++++++ cmd/mist/flags.go | 17 +++++++++++++++++ cmd/mist/gui.go | 17 +++++++++++++++++ cmd/mist/html_container.go | 17 +++++++++++++++++ cmd/mist/main.go | 17 +++++++++++++++++ cmd/mist/qml_container.go | 17 +++++++++++++++++ cmd/mist/ui_lib.go | 17 +++++++++++++++++ 19 files changed, 323 insertions(+) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/ext/big.js b/cmd/mist/assets/ext/big.js index db633fd2f..daa8d7227 100644 --- a/cmd/mist/assets/ext/big.js +++ b/cmd/mist/assets/ext/big.js @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + var bigInt = (function () { var base = 10000000, logBase = 7; var sign = { diff --git a/cmd/mist/assets/ext/ethereum.js b/cmd/mist/assets/ext/ethereum.js index 697a404a3..aeb79e488 100644 --- a/cmd/mist/assets/ext/ethereum.js +++ b/cmd/mist/assets/ext/ethereum.js @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + // Main Ethereum library window.eth = { prototype: Object(), diff --git a/cmd/mist/assets/ext/filter.js b/cmd/mist/assets/ext/filter.js index c23706249..f8529c54b 100644 --- a/cmd/mist/assets/ext/filter.js +++ b/cmd/mist/assets/ext/filter.js @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + var ethx = { prototype: Object, diff --git a/cmd/mist/assets/ext/html_messaging.js b/cmd/mist/assets/ext/html_messaging.js index 91310e998..f58eb7c29 100644 --- a/cmd/mist/assets/ext/html_messaging.js +++ b/cmd/mist/assets/ext/html_messaging.js @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + // The magic return variable. The magic return variable will be set during the execution of the QML call. (function(window) { var Promise = window.Promise; diff --git a/cmd/mist/assets/ext/http.js b/cmd/mist/assets/ext/http.js index 725ce8e6b..81908266f 100644 --- a/cmd/mist/assets/ext/http.js +++ b/cmd/mist/assets/ext/http.js @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + // this function is included locally, but you can also include separately via a header definition function request(url, callback) { var xhr = new XMLHttpRequest(); diff --git a/cmd/mist/assets/ext/qml_messaging.js b/cmd/mist/assets/ext/qml_messaging.js index 8222c848d..031c5efd1 100644 --- a/cmd/mist/assets/ext/qml_messaging.js +++ b/cmd/mist/assets/ext/qml_messaging.js @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + function HandleMessage(data) { var message; try { message = JSON.parse(data) } catch(e) {}; diff --git a/cmd/mist/assets/ext/qt_messaging_adapter.js b/cmd/mist/assets/ext/qt_messaging_adapter.js index ff6976177..04f8e034a 100644 --- a/cmd/mist/assets/ext/qt_messaging_adapter.js +++ b/cmd/mist/assets/ext/qt_messaging_adapter.js @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + window._messagingAdapter = function(data) { navigator.qt.postMessage(data); }; diff --git a/cmd/mist/assets/ext/string.js b/cmd/mist/assets/ext/string.js index 2473b5c36..e8dbd14d4 100644 --- a/cmd/mist/assets/ext/string.js +++ b/cmd/mist/assets/ext/string.js @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + String.prototype.pad = function(l, r) { if (r === undefined) { r = l diff --git a/cmd/mist/assets/muted/muted.js b/cmd/mist/assets/muted/muted.js index 72e858d7a..467411577 100644 --- a/cmd/mist/assets/muted/muted.js +++ b/cmd/mist/assets/muted/muted.js @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + // Helper function for generating pseudo callbacks and sending data to the QML part of the application function postData(data, cb) { data._seed = Math.floor(Math.random() * 1000000) diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go index 639033a32..0a6427938 100644 --- a/cmd/mist/bindings.go +++ b/cmd/mist/bindings.go @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + package main import ( diff --git a/cmd/mist/debugger.go b/cmd/mist/debugger.go index a2e60271f..ff3a30b3b 100644 --- a/cmd/mist/debugger.go +++ b/cmd/mist/debugger.go @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + package main import ( diff --git a/cmd/mist/errors.go b/cmd/mist/errors.go index 409b7a281..2069bf26d 100644 --- a/cmd/mist/errors.go +++ b/cmd/mist/errors.go @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + package main import ( diff --git a/cmd/mist/ext_app.go b/cmd/mist/ext_app.go index 8927a4b25..7680106f0 100644 --- a/cmd/mist/ext_app.go +++ b/cmd/mist/ext_app.go @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + package main import ( diff --git a/cmd/mist/flags.go b/cmd/mist/flags.go index 3990f266a..5283c332b 100644 --- a/cmd/mist/flags.go +++ b/cmd/mist/flags.go @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + package main import ( diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 2a9ab3918..45a99659b 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + package main import "C" diff --git a/cmd/mist/html_container.go b/cmd/mist/html_container.go index 7dafa025d..2e2818027 100644 --- a/cmd/mist/html_container.go +++ b/cmd/mist/html_container.go @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + package main import ( diff --git a/cmd/mist/main.go b/cmd/mist/main.go index c6cca9de5..0f853748b 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + package main import ( diff --git a/cmd/mist/qml_container.go b/cmd/mist/qml_container.go index b0f4f6127..7538fb919 100644 --- a/cmd/mist/qml_container.go +++ b/cmd/mist/qml_container.go @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + package main import ( diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index f44f2f711..32ca3c2c9 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + package main import ( -- cgit v1.2.3 From b095bd32371f02d204a4d0fbde75dc58baa7430d Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 27 Oct 2014 11:50:38 +0100 Subject: events should be set prior to calling mainloop --- cmd/mist/flags.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/flags.go b/cmd/mist/flags.go index 5283c332b..3aa2e21c8 100644 --- a/cmd/mist/flags.go +++ b/cmd/mist/flags.go @@ -67,7 +67,7 @@ func defaultAssetPath() string { // assume a debug build and use the source directory as // asset directory. pwd, _ := os.Getwd() - if pwd == path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "mist") { + if pwd == path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "cmd", "mist") { assetPath = path.Join(pwd, "assets") } else { switch runtime.GOOS { -- cgit v1.2.3 From 003280888d54ddcb7d776f549633d280edee1c8c Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 27 Oct 2014 12:25:54 +0100 Subject: increased default gas from 500 to 5000 --- cmd/mist/assets/qml/views/transaction.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/views/transaction.qml b/cmd/mist/assets/qml/views/transaction.qml index 8792e31eb..62c762956 100644 --- a/cmd/mist/assets/qml/views/transaction.qml +++ b/cmd/mist/assets/qml/views/transaction.qml @@ -114,7 +114,7 @@ Rectangle { width: 50 validator: RegExpValidator { regExp: /\d*/ } placeholderText: "Gas" - text: "500" + text: "5000" } Label { id: atLabel -- cgit v1.2.3 From cbc67099379712cb037b4f2cdf1126f735948635 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 27 Oct 2014 16:53:31 +0100 Subject: Version bump --- cmd/mist/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 0f853748b..e739bbff5 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -29,7 +29,7 @@ import ( const ( ClientIdentifier = "Mist" - Version = "0.7.1" + Version = "0.7.2" ) var ethereum *eth.Ethereum -- cgit v1.2.3 From 6b3f5fb82b0304f477a1c36b68b0d07232405aff Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 29 Oct 2014 03:50:20 +0100 Subject: cmd/mist, ethchain, ethminer: split TxEvent (#165) --- cmd/mist/gui.go | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 45a99659b..e6da33475 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -408,7 +408,8 @@ func (gui *Gui) update() { eth.ChainSyncEvent{}, eth.PeerListEvent{}, ethchain.NewBlockEvent{}, - ethchain.TxEvent{}, + ethchain.TxPreEvent{}, + ethchain.TxPostEvent{}, ethminer.Event{}, ) @@ -430,40 +431,38 @@ func (gui *Gui) update() { gui.setWalletValue(gui.eth.StateManager().CurrentState().GetAccount(gui.address()).Balance(), nil) } - case ethchain.TxEvent: + case ethchain.TxPreEvent: tx := ev.Tx - if ev.Type == ethchain.TxPre { - object := state.GetAccount(gui.address()) + object := state.GetAccount(gui.address()) - if bytes.Compare(tx.Sender(), gui.address()) == 0 { - unconfirmedFunds.Sub(unconfirmedFunds, tx.Value) - } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { - unconfirmedFunds.Add(unconfirmedFunds, tx.Value) - } - - gui.setWalletValue(object.Balance(), unconfirmedFunds) - - gui.insertTransaction("pre", tx) + if bytes.Compare(tx.Sender(), gui.address()) == 0 { + unconfirmedFunds.Sub(unconfirmedFunds, tx.Value) + } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { + unconfirmedFunds.Add(unconfirmedFunds, tx.Value) + } - } else if ev.Type == ethchain.TxPost { - object := state.GetAccount(gui.address()) - if bytes.Compare(tx.Sender(), gui.address()) == 0 { - object.SubAmount(tx.Value) + gui.setWalletValue(object.Balance(), unconfirmedFunds) + gui.insertTransaction("pre", tx) - //gui.getObjectByName("transactionView").Call("addTx", ethpipe.NewJSTx(tx), "send") - gui.txDb.Put(tx.Hash(), tx.RlpEncode()) - } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { - object.AddAmount(tx.Value) + case ethchain.TxPostEvent: + tx := ev.Tx + object := state.GetAccount(gui.address()) - //gui.getObjectByName("transactionView").Call("addTx", ethpipe.NewJSTx(tx), "recv") - gui.txDb.Put(tx.Hash(), tx.RlpEncode()) - } + if bytes.Compare(tx.Sender(), gui.address()) == 0 { + object.SubAmount(tx.Value) - gui.setWalletValue(object.Balance(), nil) + //gui.getObjectByName("transactionView").Call("addTx", ethpipe.NewJSTx(tx), "send") + gui.txDb.Put(tx.Hash(), tx.RlpEncode()) + } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { + object.AddAmount(tx.Value) - state.UpdateStateObject(object) + //gui.getObjectByName("transactionView").Call("addTx", ethpipe.NewJSTx(tx), "recv") + gui.txDb.Put(tx.Hash(), tx.RlpEncode()) } + gui.setWalletValue(object.Balance(), nil) + state.UpdateStateObject(object) + // case object: // gui.loadAddressBook() -- cgit v1.2.3 From 8e0a39f33f9d24ebeca9cc88edf24cc6294552d7 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 31 Oct 2014 10:50:16 +0100 Subject: Updated to use ethereum.js --- cmd/mist/assets/ext/eth.js/.gitignore | 14 ++ cmd/mist/assets/ext/eth.js/README.md | 18 ++ cmd/mist/assets/ext/eth.js/httprpc.js | 70 ++++++ cmd/mist/assets/ext/eth.js/index.html | 33 +++ cmd/mist/assets/ext/eth.js/main.js | 432 ++++++++++++++++++++++++++++++++ cmd/mist/assets/ext/eth.js/qt.js | 27 ++ cmd/mist/assets/ext/eth.js/websocket.js | 51 ++++ cmd/mist/assets/ext/setup.js | 8 + cmd/mist/assets/qml/webapp.qml | 141 ++++++----- 9 files changed, 726 insertions(+), 68 deletions(-) create mode 100644 cmd/mist/assets/ext/eth.js/.gitignore create mode 100644 cmd/mist/assets/ext/eth.js/README.md create mode 100644 cmd/mist/assets/ext/eth.js/httprpc.js create mode 100644 cmd/mist/assets/ext/eth.js/index.html create mode 100644 cmd/mist/assets/ext/eth.js/main.js create mode 100644 cmd/mist/assets/ext/eth.js/qt.js create mode 100644 cmd/mist/assets/ext/eth.js/websocket.js create mode 100644 cmd/mist/assets/ext/setup.js (limited to 'cmd/mist') diff --git a/cmd/mist/assets/ext/eth.js/.gitignore b/cmd/mist/assets/ext/eth.js/.gitignore new file mode 100644 index 000000000..de3a847ac --- /dev/null +++ b/cmd/mist/assets/ext/eth.js/.gitignore @@ -0,0 +1,14 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile ~/.gitignore_global + +/tmp +*/**/*un~ +*un~ +.DS_Store +*/**/.DS_Store +ethereum/ethereum +ethereal/ethereal + diff --git a/cmd/mist/assets/ext/eth.js/README.md b/cmd/mist/assets/ext/eth.js/README.md new file mode 100644 index 000000000..86e2969be --- /dev/null +++ b/cmd/mist/assets/ext/eth.js/README.md @@ -0,0 +1,18 @@ +# Ethereum JavaScript API + +This is the Ethereum compatible JavaScript API using `Promise`s +which implements the [Generic JSON RPC](https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC) spec. + +For an example see `index.html`. + +**Please note this repo is in it's early stage.** + +If you'd like to run a WebSocket ethereum node check out +[go-ethereum](https://github.com/ethereum/go-ethereum). + +To install ethereum and spawn a node: + +``` +go get github.com/ethereum/go-ethereum/ethereum +ethereum -ws -loglevel=4 +``` diff --git a/cmd/mist/assets/ext/eth.js/httprpc.js b/cmd/mist/assets/ext/eth.js/httprpc.js new file mode 100644 index 000000000..085b4693d --- /dev/null +++ b/cmd/mist/assets/ext/eth.js/httprpc.js @@ -0,0 +1,70 @@ +(function () { + var HttpRpcProvider = function (host) { + this.handlers = []; + this.host = host; + }; + + function formatJsonRpcObject(object) { + return { + jsonrpc: '2.0', + method: object.call, + params: object.args, + id: object._id + } + }; + + function formatJsonRpcMessage(message) { + var object = JSON.parse(message); + + return { + _id: object.id, + data: object.result + }; + }; + + HttpRpcProvider.prototype.sendRequest = function (payload, cb) { + var data = formatJsonRpcObject(payload); + + var request = new XMLHttpRequest(); + request.open("POST", this.host, true); + request.send(JSON.stringify(data)); + request.onreadystatechange = function () { + if (request.readyState === 4 && cb) { + cb(request); + } + } + }; + + HttpRpcProvider.prototype.send = function (payload) { + var self = this; + this.sendRequest(payload, function (request) { + self.handlers.forEach(function (handler) { + handler.call(self, formatJsonRpcMessage(request.responseText)); + }); + }); + }; + + HttpRpcProvider.prototype.poll = function (payload, id) { + var self = this; + this.sendRequest(payload, function (request) { + var parsed = JSON.parse(request.responseText); + if (parsed.result instanceof Array ? parsed.result.length === 0 : !parsed.result) { + return; + } + self.handlers.forEach(function (handler) { + handler.call(self, {_event: payload.call, _id: id, data: parsed.result}); + }); + }); + }; + + Object.defineProperty(HttpRpcProvider.prototype, "onmessage", { + set: function (handler) { + this.handlers.push(handler); + } + }); + + if (typeof(web3) !== "undefined" && web3.providers !== undefined) { + web3.providers.HttpRpcProvider = HttpRpcProvider; + } +})(); + diff --git a/cmd/mist/assets/ext/eth.js/index.html b/cmd/mist/assets/ext/eth.js/index.html new file mode 100644 index 000000000..2b3f50a14 --- /dev/null +++ b/cmd/mist/assets/ext/eth.js/index.html @@ -0,0 +1,33 @@ + + + + + + + + + + + + + +

std::name_reg

+ + +
+ + + + diff --git a/cmd/mist/assets/ext/eth.js/main.js b/cmd/mist/assets/ext/eth.js/main.js new file mode 100644 index 000000000..5c7ca0603 --- /dev/null +++ b/cmd/mist/assets/ext/eth.js/main.js @@ -0,0 +1,432 @@ +(function(window) { + function isPromise(o) { + return o instanceof Promise + } + + function flattenPromise (obj) { + if (obj instanceof Promise) { + return Promise.resolve(obj); + } + + if (obj instanceof Array) { + return new Promise(function (resolve) { + var promises = obj.map(function (o) { + return flattenPromise(o); + }); + + return Promise.all(promises).then(function (res) { + for (var i = 0; i < obj.length; i++) { + obj[i] = res[i]; + } + resolve(obj); + }); + }); + } + + if (obj instanceof Object) { + return new Promise(function (resolve) { + var keys = Object.keys(obj); + var promises = keys.map(function (key) { + return flattenPromise(obj[key]); + }); + + return Promise.all(promises).then(function (res) { + for (var i = 0; i < keys.length; i++) { + obj[keys[i]] = res[i]; + } + resolve(obj); + }); + }); + } + + return Promise.resolve(obj); + }; + + var ethMethods = function () { + var blockCall = function (args) { + return typeof args[0] === "string" ? "blockByHash" : "blockByNumber"; + }; + + var transactionCall = function (args) { + return typeof args[0] === "string" ? 'transactionByHash' : 'transactionByNumber'; + }; + + var uncleCall = function (args) { + return typeof args[0] === "string" ? 'uncleByHash' : 'uncleByNumber'; + }; + + var methods = [ + { name: 'balanceAt', call: 'balanceAt' }, + { name: 'stateAt', call: 'stateAt' }, + { name: 'countAt', call: 'countAt'}, + { name: 'codeAt', call: 'codeAt' }, + { name: 'transact', call: 'transact' }, + { name: 'call', call: 'call' }, + { name: 'block', call: blockCall }, + { name: 'transaction', call: transactionCall }, + { name: 'uncle', call: uncleCall }, + { name: 'compile', call: 'compile' } + ]; + return methods; + }; + + var ethProperties = function () { + return [ + { name: 'coinbase', getter: 'coinbase', setter: 'setCoinbase' }, + { name: 'listening', getter: 'listening', setter: 'setListening' }, + { name: 'mining', getter: 'mining', setter: 'setMining' }, + { name: 'gasPrice', getter: 'gasPrice' }, + { name: 'account', getter: 'account' }, + { name: 'accounts', getter: 'accounts' }, + { name: 'peerCount', getter: 'peerCount' }, + { name: 'defaultBlock', getter: 'defaultBlock', setter: 'setDefaultBlock' }, + { name: 'number', getter: 'number'} + ]; + }; + + var dbMethods = function () { + return [ + { name: 'put', call: 'put' }, + { name: 'get', call: 'get' }, + { name: 'putString', call: 'putString' }, + { name: 'getString', call: 'getString' } + ]; + }; + + var shhMethods = function () { + return [ + { name: 'post', call: 'post' }, + { name: 'newIdentity', call: 'newIdentity' }, + { name: 'haveIdentity', call: 'haveIdentity' }, + { name: 'newGroup', call: 'newGroup' }, + { name: 'addToGroup', call: 'addToGroup' } + ]; + }; + + var ethWatchMethods = function () { + var newFilter = function (args) { + return typeof args[0] === 'string' ? 'newFilterString' : 'newFilter'; + }; + + return [ + { name: 'newFilter', call: newFilter }, + { name: 'uninstallFilter', call: 'uninstallFilter' }, + { name: 'getMessages', call: 'getMessages' } + ]; + }; + + var shhWatchMethods = function () { + return [ + { name: 'newFilter', call: 'shhNewFilter' }, + { name: 'uninstallFilter', call: 'shhUninstallFilter' }, + { name: 'getMessage', call: 'shhGetMessages' } + ]; + }; + + var setupMethods = function (obj, methods) { + methods.forEach(function (method) { + obj[method.name] = function () { + return flattenPromise(Array.prototype.slice.call(arguments)).then(function (args) { + var call = typeof method.call === "function" ? method.call(args) : method.call; + return {call: call, args: args}; + }).then(function (request) { + return new Promise(function (resolve, reject) { + web3.provider.send(request, function (result) { + //if (result || typeof result === "boolean") { + resolve(result); + return; + //} + //reject(result); + }); + }); + }).catch(function( err) { + console.error(err); + }); + }; + }); + }; + + var setupProperties = function (obj, properties) { + properties.forEach(function (property) { + var proto = {}; + proto.get = function () { + return new Promise(function(resolve, reject) { + web3.provider.send({call: property.getter}, function(result) { + resolve(result); + }); + }); + }; + if (property.setter) { + proto.set = function (val) { + return flattenPromise([val]).then(function (args) { + return new Promise(function (resolve) { + web3.provider.send({call: property.setter, args: args}, function (result) { + resolve(result); + }); + }); + }).catch(function (err) { + console.error(err); + }); + } + } + Object.defineProperty(obj, property.name, proto); + }); + }; + + var web3 = { + _callbacks: {}, + _events: {}, + providers: {}, + toHex: function(str) { + var hex = ""; + for(var i = 0; i < str.length; i++) { + var n = str.charCodeAt(i).toString(16); + hex += n.length < 2 ? '0' + n : n; + } + + return hex; + }, + + toAscii: function(hex) { + // Find termination + var str = ""; + var i = 0, l = hex.length; + for(; i < l; i+=2) { + var code = hex.charCodeAt(i) + if(code == 0) { + break; + } + + str += String.fromCharCode(parseInt(hex.substr(i, 2), 16)); + } + + return str; + }, + + toDecimal: function (val) { + return parseInt(val, 16); + }, + + fromAscii: function(str, pad) { + pad = pad === undefined ? 32 : pad; + var hex = this.toHex(str); + while(hex.length < pad*2) + hex += "00"; + return hex + }, + + eth: { + prototype: Object(), + watch: function (params) { + return new Filter(params, ethWatch); + }, + }, + + db: { + prototype: Object() + }, + + shh: { + prototype: Object(), + watch: function (params) { + return new Filter(params, shhWatch); + } + }, + + on: function(event, id, cb) { + if(web3._events[event] === undefined) { + web3._events[event] = {}; + } + + web3._events[event][id] = cb; + return this + }, + + off: function(event, id) { + if(web3._events[event] !== undefined) { + delete web3._events[event][id]; + } + + return this + }, + + trigger: function(event, id, data) { + var callbacks = web3._events[event]; + if (!callbacks || !callbacks[id]) { + return; + } + var cb = callbacks[id]; + cb(data); + }, + }; + + var eth = web3.eth; + setupMethods(eth, ethMethods()); + setupProperties(eth, ethProperties()); + setupMethods(web3.db, dbMethods()); + setupMethods(web3.shh, shhMethods()); + + var ethWatch = { + changed: 'changed' + }; + setupMethods(ethWatch, ethWatchMethods()); + var shhWatch = { + changed: 'shhChanged' + }; + setupMethods(shhWatch, shhWatchMethods()); + + var ProviderManager = function() { + this.queued = []; + this.polls = []; + this.ready = false; + this.provider = undefined; + this.id = 1; + + var self = this; + var poll = function () { + if (self.provider && self.provider.poll) { + self.polls.forEach(function (data) { + data.data._id = self.id; + self.id++; + self.provider.poll(data.data, data.id); + }); + } + setTimeout(poll, 12000); + }; + poll(); + }; + + ProviderManager.prototype.send = function(data, cb) { + data._id = this.id; + if (cb) { + web3._callbacks[data._id] = cb; + } + + data.args = data.args || []; + this.id++; + + if(this.provider !== undefined) { + this.provider.send(data); + } else { + console.warn("provider is not set"); + this.queued.push(data); + } + }; + + ProviderManager.prototype.set = function(provider) { + if(this.provider !== undefined && this.provider.unload !== undefined) { + this.provider.unload(); + } + + this.provider = provider; + this.ready = true; + }; + + ProviderManager.prototype.sendQueued = function() { + for(var i = 0; this.queued.length; i++) { + // Resend + this.send(this.queued[i]); + } + }; + + ProviderManager.prototype.installed = function() { + return this.provider !== undefined; + }; + + ProviderManager.prototype.startPolling = function (data, pollId) { + if (!this.provider || !this.provider.poll) { + return; + } + this.polls.push({data: data, id: pollId}); + }; + + ProviderManager.prototype.stopPolling = function (pollId) { + for (var i = this.polls.length; i--;) { + var poll = this.polls[i]; + if (poll.id === pollId) { + this.polls.splice(i, 1); + } + } + }; + + web3.provider = new ProviderManager(); + + web3.setProvider = function(provider) { + provider.onmessage = messageHandler; + web3.provider.set(provider); + web3.provider.sendQueued(); + }; + + var Filter = function(options, impl) { + this.impl = impl; + this.callbacks = []; + + var self = this; + this.promise = impl.newFilter(options); + this.promise.then(function (id) { + self.id = id; + web3.on(impl.changed, id, self.trigger.bind(self)); + web3.provider.startPolling({call: impl.changed, args: [id]}, id); + }); + }; + + Filter.prototype.arrived = function(callback) { + this.changed(callback); + } + + Filter.prototype.changed = function(callback) { + var self = this; + this.promise.then(function(id) { + self.callbacks.push(callback); + }); + }; + + Filter.prototype.trigger = function(messages) { + for(var i = 0; i < this.callbacks.length; i++) { + this.callbacks[i].call(this, messages); + } + }; + + Filter.prototype.uninstall = function() { + var self = this; + this.promise.then(function (id) { + self.impl.uninstallFilter(id); + web3.provider.stopPolling(id); + web3.off(impl.changed, id); + }); + }; + + Filter.prototype.messages = function() { + var self = this; + return this.promise.then(function (id) { + return self.impl.getMessages(id); + }); + }; + + function messageHandler(data) { + if(data._event !== undefined) { + web3.trigger(data._event, data._id, data.data); + return; + } + + if(data._id) { + var cb = web3._callbacks[data._id]; + if (cb) { + cb.call(this, data.data) + delete web3._callbacks[data._id]; + } + } + } + + /* + // Install default provider + if(!web3.provider.installed()) { + var sock = new web3.WebSocket("ws://localhost:40404/eth"); + + web3.setProvider(sock); + } + */ + + window.web3 = web3; + +})(this); diff --git a/cmd/mist/assets/ext/eth.js/qt.js b/cmd/mist/assets/ext/eth.js/qt.js new file mode 100644 index 000000000..644c37737 --- /dev/null +++ b/cmd/mist/assets/ext/eth.js/qt.js @@ -0,0 +1,27 @@ +(function() { + var QtProvider = function() { + this.handlers = []; + + var self = this; + navigator.qt.onmessage = function (message) { + self.handlers.forEach(function (handler) { + handler.call(self, JSON.parse(message.data)); + }); + } + }; + + QtProvider.prototype.send = function(payload) { + navigator.qt.postMessage(JSON.stringify(payload)); + }; + + Object.defineProperty(QtProvider.prototype, "onmessage", { + set: function(handler) { + this.handlers.push(handler); + }, + }); + + if(typeof(web3) !== "undefined" && web3.providers !== undefined) { + web3.providers.QtProvider = QtProvider; + } +})(); + diff --git a/cmd/mist/assets/ext/eth.js/websocket.js b/cmd/mist/assets/ext/eth.js/websocket.js new file mode 100644 index 000000000..732a086f2 --- /dev/null +++ b/cmd/mist/assets/ext/eth.js/websocket.js @@ -0,0 +1,51 @@ +(function() { + var WebSocketProvider = function(host) { + // onmessage handlers + this.handlers = []; + // queue will be filled with messages if send is invoked before the ws is ready + this.queued = []; + this.ready = false; + + this.ws = new WebSocket(host); + + var self = this; + this.ws.onmessage = function(event) { + for(var i = 0; i < self.handlers.length; i++) { + self.handlers[i].call(self, JSON.parse(event.data), event) + } + }; + + this.ws.onopen = function() { + self.ready = true; + + for(var i = 0; i < self.queued.length; i++) { + // Resend + self.send(self.queued[i]); + } + }; + }; + WebSocketProvider.prototype.send = function(payload) { + if(this.ready) { + var data = JSON.stringify(payload); + + this.ws.send(data); + } else { + this.queued.push(payload); + } + }; + + WebSocketProvider.prototype.onMessage = function(handler) { + this.handlers.push(handler); + }; + + WebSocketProvider.prototype.unload = function() { + this.ws.close(); + }; + Object.defineProperty(WebSocketProvider.prototype, "onmessage", { + set: function(provider) { this.onMessage(provider); } + }); + + if(typeof(web3) !== "undefined" && web3.providers !== undefined) { + web3.providers.WebSocketProvider = WebSocketProvider; + } +})(); diff --git a/cmd/mist/assets/ext/setup.js b/cmd/mist/assets/ext/setup.js new file mode 100644 index 000000000..8317937b3 --- /dev/null +++ b/cmd/mist/assets/ext/setup.js @@ -0,0 +1,8 @@ +(function() { + if (typeof(Promise) === "undefined") + window.Promise = Q.Promise; + + var eth = web3.eth; + + web3.setProvider(new web3.providers.QtProvider()); +})() diff --git a/cmd/mist/assets/qml/webapp.qml b/cmd/mist/assets/qml/webapp.qml index c35f325d5..bd7399dc9 100644 --- a/cmd/mist/assets/qml/webapp.qml +++ b/cmd/mist/assets/qml/webapp.qml @@ -155,7 +155,8 @@ Rectangle { experimental.preferences.javascriptEnabled: true experimental.preferences.navigatorQtObjectEnabled: true experimental.preferences.developerExtrasEnabled: true - experimental.userScripts: ["../ext/qt_messaging_adapter.js", "../ext/q.js", "../ext/big.js", "../ext/string.js", "../ext/html_messaging.js"] + //experimental.userScripts: ["../ext/qt_messaging_adapter.js", "../ext/q.js", "../ext/big.js", "../ext/string.js", "../ext/html_messaging.js"] + experimental.userScripts: ["../ext/q.js", "../ext/eth.js/main.js", "../ext/eth.js/qt.js", "../ext/setup.js"] experimental.onMessageReceived: { console.log("[onMessageReceived]: ", message.data) // TODO move to messaging.js @@ -164,51 +165,88 @@ Rectangle { try { switch(data.call) { case "compile": - postData(data._seed, eth.compile(data.args[0])) + postData(data._id, eth.compile(data.args[0])) break - case "getCoinBase": - postData(data._seed, eth.coinBase()) + case "coinbase": + postData(data._id, eth.coinBase()) - break + case "account": + postData(data._id, eth.key().address); - case "getIsListening": - postData(data._seed, eth.isListening()) + case "isListening": + postData(data._id, eth.isListening()) break - case "getIsMining": - postData(data._seed, eth.isMining()) + case "isMining": + postData(data._id, eth.isMining()) break - case "getPeerCount": - postData(data._seed, eth.peerCount()) + case "peerCount": + postData(data._id, eth.peerCount()) break - case "getCountAt": + case "countAt": require(1) - postData(data._seed, eth.txCountAt(data.args[0])) + postData(data._id, eth.txCountAt(data.args[0])) break - case "getCodeAt": + case "codeAt": require(1) var code = eth.codeAt(data.args[0]) - postData(data._seed, code); + postData(data._id, code); break - case "getBlockByNumber": + case "blockByNumber": + require(1) var block = eth.blockByNumber(data.args[0]) - postData(data._seed, block) + postData(data._id, block) + break + case "blockByHash": + require(1) + var block = eth.blockByHash(data.args[0]) + postData(data._id, block) break - case "getBlockByHash": + require(2) var block = eth.blockByHash(data.args[0]) - postData(data._seed, block) + postData(data._id, block.transactions[data.args[1]]) + break + + case "transactionByHash": + case "transactionByNumber": + require(2) + + var block; + if (data.call === "transactionByHash") + block = eth.blockByHash(data.args[0]) + else + block = eth.blockByNumber(data.args[0]) + + var tx = block.transactions.get(data.args[1]) + + postData(data._id, tx) + break + + case "uncleByHash": + case "uncleByNumber": + require(2) + + var block; + if (data.call === "uncleByHash") + block = eth.blockByHash(data.args[0]) + else + block = eth.blockByNumber(data.args[0]) + + var uncle = block.uncles.get(data.args[1]) + + postData(data._id, uncle) break @@ -216,50 +254,28 @@ Rectangle { require(5) var tx = eth.transact(data.args) - postData(data._seed, tx) + postData(data._id, tx) break - case "getStorageAt": + case "stateAt": require(2); var storage = eth.storageAt(data.args[0], data.args[1]); - postData(data._seed, storage) + postData(data._id, storage) break case "call": require(1); var ret = eth.call(data.args) - postData(data._seed, ret) - - break - - case "getEachStorage": - require(1); - var storage = JSON.parse(eth.eachStorage(data.args[0])) - postData(data._seed, storage) - - break - - case "getTransactionsFor": - require(1); - var txs = eth.transactionsFor(data.args[0], true) - postData(data._seed, txs) - + postData(data._id, ret) break - case "getBalanceAt": + case "balanceAt": require(1); - postData(data._seed, eth.balanceAt(data.args[0])); - - break - - case "getKey": - var key = eth.key().privateKey; - - postData(data._seed, key) + postData(data._id, eth.balanceAt(data.args[0])); break case "watch": @@ -268,45 +284,34 @@ Rectangle { case "disconnect": require(1) - postData(data._seed, null) - - break; - - case "getSecretToAddress": - require(1) - - var addr = eth.secretToAddress(data.args[0]) - console.log("getsecret", addr) - postData(data._seed, addr) - + postData(data._id, null) break; case "messages": require(1); var messages = JSON.parse(eth.getMessages(data.args[0])) - postData(data._seed, messages) - + postData(data._id, messages) break case "mutan": require(1) var code = eth.compileMutan(data.args[0]) - postData(data._seed, "0x"+code) - + postData(data._id, "0x"+code) break; case "newFilterString": require(1) var id = eth.newFilterString(data.args[0]) - postData(data._seed, id); + postData(data._id, id); break; + case "newFilter": require(1) var id = eth.newFilter(data.args[0]) - postData(data._seed, id); + postData(data._id, id); break; case "getMessages": @@ -314,7 +319,7 @@ Rectangle { var messages = eth.messages(data.args[0]); var m = JSON.parse(JSON.parse(JSON.stringify(messages))) - postData(data._seed, m); + postData(data._id, m); break; @@ -326,13 +331,13 @@ Rectangle { } catch(e) { console.log(data.call + ": " + e) - postData(data._seed, null); + postData(data._id, null); } } function post(seed, data) { - postData(data._seed, data) + postData(data._id, data) } function require(args, num) { @@ -341,7 +346,7 @@ Rectangle { } } function postData(seed, data) { - webview.experimental.postMessage(JSON.stringify({data: data, _seed: seed})) + webview.experimental.postMessage(JSON.stringify({data: data, _id: seed})) } function postEvent(event, data) { webview.experimental.postMessage(JSON.stringify({data: data, _event: event})) -- cgit v1.2.3 From 3ee0461cb5b6e4a5e2d287180afbdb681805a662 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 31 Oct 2014 10:59:17 +0100 Subject: Moved ethchain to chain --- cmd/mist/bindings.go | 4 ++-- cmd/mist/debugger.go | 4 ++-- cmd/mist/ext_app.go | 14 +++++++------- cmd/mist/gui.go | 20 ++++++++++---------- cmd/mist/html_container.go | 4 ++-- cmd/mist/qml_container.go | 4 ++-- cmd/mist/ui_lib.go | 8 ++++---- 7 files changed, 29 insertions(+), 29 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go index 0a6427938..03d35a574 100644 --- a/cmd/mist/bindings.go +++ b/cmd/mist/bindings.go @@ -22,7 +22,7 @@ import ( "os" "strconv" - "github.com/ethereum/go-ethereum/ethchain" + "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/ethlog" "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethutil" @@ -110,7 +110,7 @@ func (self *Gui) DumpState(hash, path string) { if len(hash) == 0 { stateDump = self.eth.StateManager().CurrentState().Dump() } else { - var block *ethchain.Block + var block *chain.Block if hash[0] == '#' { i, _ := strconv.Atoi(hash[1:]) block = self.eth.ChainManager().GetBlockByNumber(uint64(i)) diff --git a/cmd/mist/debugger.go b/cmd/mist/debugger.go index ff3a30b3b..d786a0395 100644 --- a/cmd/mist/debugger.go +++ b/cmd/mist/debugger.go @@ -24,7 +24,7 @@ import ( "strings" "unicode" - "github.com/ethereum/go-ethereum/ethchain" + "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/utils" @@ -81,7 +81,7 @@ func (self *DebuggerWindow) SetData(data string) { func (self *DebuggerWindow) SetAsm(data []byte) { self.win.Root().Call("clearAsm") - dis := ethchain.Disassemble(data) + dis := chain.Disassemble(data) for _, str := range dis { self.win.Root().Call("setAsm", str) } diff --git a/cmd/mist/ext_app.go b/cmd/mist/ext_app.go index 7680106f0..cb014aec4 100644 --- a/cmd/mist/ext_app.go +++ b/cmd/mist/ext_app.go @@ -20,7 +20,7 @@ package main import ( "encoding/json" - "github.com/ethereum/go-ethereum/ethchain" + "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/event" @@ -36,7 +36,7 @@ type AppContainer interface { Window() *qml.Window Engine() *qml.Engine - NewBlock(*ethchain.Block) + NewBlock(*chain.Block) NewWatcher(chan bool) Messages(ethstate.Messages, string) Post(string, int) @@ -44,12 +44,12 @@ type AppContainer interface { type ExtApplication struct { *ethpipe.JSPipe - eth ethchain.EthManager + eth chain.EthManager events event.Subscription watcherQuitChan chan bool - filters map[string]*ethchain.Filter + filters map[string]*chain.Filter container AppContainer lib *UiLib @@ -60,7 +60,7 @@ func NewExtApplication(container AppContainer, lib *UiLib) *ExtApplication { JSPipe: ethpipe.NewJSPipe(lib.eth), eth: lib.eth, watcherQuitChan: make(chan bool), - filters: make(map[string]*ethchain.Filter), + filters: make(map[string]*chain.Filter), container: container, lib: lib, } @@ -80,7 +80,7 @@ func (app *ExtApplication) run() { // Subscribe to events mux := app.lib.eth.EventMux() - app.events = mux.Subscribe(ethchain.NewBlockEvent{}, ethstate.Messages(nil)) + app.events = mux.Subscribe(chain.NewBlockEvent{}, ethstate.Messages(nil)) // Call the main loop go app.mainLoop() @@ -106,7 +106,7 @@ func (app *ExtApplication) stop() { func (app *ExtApplication) mainLoop() { for ev := range app.events.Chan() { switch ev := ev.(type) { - case ethchain.NewBlockEvent: + case chain.NewBlockEvent: app.container.NewBlock(ev.Block) case ethstate.Messages: diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index e6da33475..c917ad06e 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -31,7 +31,7 @@ import ( "time" "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/ethchain" + "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethlog" "github.com/ethereum/go-ethereum/ethminer" @@ -286,7 +286,7 @@ func (gui *Gui) loadAddressBook() { } } -func (gui *Gui) insertTransaction(window string, tx *ethchain.Transaction) { +func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) { pipe := ethpipe.New(gui.eth) nameReg := pipe.World().Config().Get("NameReg") addr := gui.address() @@ -336,7 +336,7 @@ func (gui *Gui) insertTransaction(window string, tx *ethchain.Transaction) { func (gui *Gui) readPreviousTransactions() { it := gui.txDb.Db().NewIterator(nil, nil) for it.Next() { - tx := ethchain.NewTransactionFromBytes(it.Value()) + tx := chain.NewTransactionFromBytes(it.Value()) gui.insertTransaction("post", tx) @@ -344,7 +344,7 @@ func (gui *Gui) readPreviousTransactions() { it.Release() } -func (gui *Gui) processBlock(block *ethchain.Block, initial bool) { +func (gui *Gui) processBlock(block *chain.Block, initial bool) { name := strings.Trim(gui.pipe.World().Config().Get("NameReg").Storage(block.Coinbase).Str(), "\x00") b := ethpipe.NewJSBlock(block) b.Name = name @@ -407,9 +407,9 @@ func (gui *Gui) update() { events := gui.eth.EventMux().Subscribe( eth.ChainSyncEvent{}, eth.PeerListEvent{}, - ethchain.NewBlockEvent{}, - ethchain.TxPreEvent{}, - ethchain.TxPostEvent{}, + chain.NewBlockEvent{}, + chain.TxPreEvent{}, + chain.TxPostEvent{}, ethminer.Event{}, ) @@ -425,13 +425,13 @@ func (gui *Gui) update() { return } switch ev := ev.(type) { - case ethchain.NewBlockEvent: + case chain.NewBlockEvent: gui.processBlock(ev.Block, false) if bytes.Compare(ev.Block.Coinbase, gui.address()) == 0 { gui.setWalletValue(gui.eth.StateManager().CurrentState().GetAccount(gui.address()).Balance(), nil) } - case ethchain.TxPreEvent: + case chain.TxPreEvent: tx := ev.Tx object := state.GetAccount(gui.address()) @@ -444,7 +444,7 @@ func (gui *Gui) update() { gui.setWalletValue(object.Balance(), unconfirmedFunds) gui.insertTransaction("pre", tx) - case ethchain.TxPostEvent: + case chain.TxPostEvent: tx := ev.Tx object := state.GetAccount(gui.address()) diff --git a/cmd/mist/html_container.go b/cmd/mist/html_container.go index 2e2818027..96bae1a9a 100644 --- a/cmd/mist/html_container.go +++ b/cmd/mist/html_container.go @@ -27,7 +27,7 @@ import ( "path" "path/filepath" - "github.com/ethereum/go-ethereum/ethchain" + "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethutil" @@ -138,7 +138,7 @@ func (app *HtmlApplication) Window() *qml.Window { return app.win } -func (app *HtmlApplication) NewBlock(block *ethchain.Block) { +func (app *HtmlApplication) NewBlock(block *chain.Block) { b := ðpipe.JSBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())} app.webView.Call("onNewBlockCb", b) } diff --git a/cmd/mist/qml_container.go b/cmd/mist/qml_container.go index 7538fb919..3318786e7 100644 --- a/cmd/mist/qml_container.go +++ b/cmd/mist/qml_container.go @@ -21,7 +21,7 @@ import ( "fmt" "runtime" - "github.com/ethereum/go-ethereum/ethchain" + "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethutil" @@ -65,7 +65,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) { } // Events -func (app *QmlApplication) NewBlock(block *ethchain.Block) { +func (app *QmlApplication) NewBlock(block *chain.Block) { pblock := ðpipe.JSBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())} app.win.Call("onNewBlockCb", pblock) } diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index 32ca3c2c9..a9b560b6f 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -25,7 +25,7 @@ import ( "strings" "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/ethchain" + "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/ethcrypto" "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethstate" @@ -120,7 +120,7 @@ func (self *UiLib) PastPeers() *ethutil.List { } func (self *UiLib) ImportTx(rlpTx string) { - tx := ethchain.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx)) + tx := chain.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx)) self.eth.TxPool().QueueTransaction(tx) } @@ -221,8 +221,8 @@ func (self *UiLib) NewFilter(object map[string]interface{}) (id int) { } func (self *UiLib) NewFilterString(typ string) (id int) { - filter := ethchain.NewFilter(self.eth) - filter.BlockCallback = func(block *ethchain.Block) { + filter := chain.NewFilter(self.eth) + filter.BlockCallback = func(block *chain.Block) { self.win.Root().Call("invokeFilterCallback", "{}", id) } id = self.eth.InstallFilter(filter) -- cgit v1.2.3 From fd9da72536b73351bbcdc1e9dbbbb8c0e4bfb21b Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 31 Oct 2014 12:37:43 +0100 Subject: ethcrypto => crypto --- cmd/mist/ui_lib.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index a9b560b6f..b12fab603 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -26,7 +26,7 @@ import ( "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/chain" - "github.com/ethereum/go-ethereum/ethcrypto" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethutil" @@ -69,7 +69,7 @@ func (self *UiLib) LookupDomain(domain string) string { world := self.World() if len(domain) > 32 { - domain = string(ethcrypto.Sha3([]byte(domain))) + domain = string(crypto.Sha3([]byte(domain))) } data := world.Config().Get("DnsReg").StorageString(domain).Bytes() -- cgit v1.2.3 From b1c247231b11f313ca0eedff75ea563926d23f68 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 31 Oct 2014 12:56:05 +0100 Subject: ethlog => logger --- cmd/mist/bindings.go | 16 ++++++++-------- cmd/mist/ext_app.go | 2 +- cmd/mist/flags.go | 3 +-- cmd/mist/gui.go | 34 +++++++++++++++++----------------- cmd/mist/html_container.go | 8 ++++---- cmd/mist/main.go | 4 ++-- cmd/mist/qml_container.go | 2 +- cmd/mist/ui_lib.go | 4 ++-- 8 files changed, 36 insertions(+), 37 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go index 03d35a574..8b038587b 100644 --- a/cmd/mist/bindings.go +++ b/cmd/mist/bindings.go @@ -23,9 +23,9 @@ import ( "strconv" "github.com/ethereum/go-ethereum/chain" - "github.com/ethereum/go-ethereum/ethlog" "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/utils" ) @@ -35,7 +35,7 @@ type plugin struct { } // LogPrint writes to the GUI log. -func (gui *Gui) LogPrint(level ethlog.LogLevel, msg string) { +func (gui *Gui) LogPrint(level logger.LogLevel, msg string) { /* str := strings.TrimRight(s, "\n") lines := strings.Split(str, "\n") @@ -74,14 +74,14 @@ func (gui *Gui) ToggleTurboMining() { gui.miner.ToggleTurbo() } -// functions that allow Gui to implement interface ethlog.LogSystem -func (gui *Gui) SetLogLevel(level ethlog.LogLevel) { +// functions that allow Gui to implement interface guilogger.LogSystem +func (gui *Gui) SetLogLevel(level logger.LogLevel) { gui.logLevel = level gui.stdLog.SetLogLevel(level) gui.config.Save("loglevel", level) } -func (gui *Gui) GetLogLevel() ethlog.LogLevel { +func (gui *Gui) GetLogLevel() logger.LogLevel { return gui.logLevel } @@ -119,7 +119,7 @@ func (self *Gui) DumpState(hash, path string) { } if block == nil { - logger.Infof("block err: not found %s\n", hash) + guilogger.Infof("block err: not found %s\n", hash) return } @@ -128,12 +128,12 @@ func (self *Gui) DumpState(hash, path string) { file, err := os.OpenFile(path[7:], os.O_CREATE|os.O_RDWR, os.ModePerm) if err != nil { - logger.Infoln("dump err: ", err) + guilogger.Infoln("dump err: ", err) return } defer file.Close() - logger.Infof("dumped state (%s) to %s\n", hash, path) + guilogger.Infof("dumped state (%s) to %s\n", hash, path) file.Write(stateDump) } diff --git a/cmd/mist/ext_app.go b/cmd/mist/ext_app.go index cb014aec4..8af9778bc 100644 --- a/cmd/mist/ext_app.go +++ b/cmd/mist/ext_app.go @@ -74,7 +74,7 @@ func (app *ExtApplication) run() { err := app.container.Create() if err != nil { - logger.Errorln(err) + guilogger.Errorln(err) return } diff --git a/cmd/mist/flags.go b/cmd/mist/flags.go index 3aa2e21c8..7de2a881d 100644 --- a/cmd/mist/flags.go +++ b/cmd/mist/flags.go @@ -28,7 +28,6 @@ import ( "runtime" "bitbucket.org/kardianos/osext" - "github.com/ethereum/go-ethereum/ethlog" "github.com/ethereum/go-ethereum/vm" ) @@ -117,7 +116,7 @@ func Init() { flag.StringVar(&Datadir, "datadir", defaultDataDir(), "specifies the datadir to use") flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file") flag.StringVar(&DebugFile, "debug", "", "debug file (no debugging if not set)") - flag.IntVar(&LogLevel, "loglevel", int(ethlog.InfoLevel), "loglevel: 0-5: silent,error,warn,info,debug,debug detail)") + flag.IntVar(&LogLevel, "loglevel", int(repllogger.InfoLevel), "loglevel: 0-5: silent,error,warn,info,debug,debug detail)") flag.StringVar(&AssetPath, "asset_path", defaultAssetPath(), "absolute path to GUI assets directory") diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index c917ad06e..4ae92a340 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -33,11 +33,11 @@ import ( "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethlog" "github.com/ethereum/go-ethereum/ethminer" "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/ethwire" + "github.com/ethereum/go-ethereum/logger" "gopkg.in/qml.v1" ) @@ -64,7 +64,7 @@ func LoadExtension(path string) (uintptr, error) { } */ -var logger = ethlog.NewLogger("GUI") +var guilogger = logger.NewLogger("GUI") type Gui struct { // The main application window @@ -81,7 +81,7 @@ type Gui struct { txDb *ethdb.LDBDatabase - logLevel ethlog.LogLevel + logLevel logger.LogLevel open bool pipe *ethpipe.JSPipe @@ -93,7 +93,7 @@ type Gui struct { plugins map[string]plugin miner *ethminer.Miner - stdLog ethlog.LogSystem + stdLog logger.LogSystem } // Create GUI, but doesn't start it @@ -104,7 +104,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden } pipe := ethpipe.NewJSPipe(ethereum) - gui := &Gui{eth: ethereum, txDb: db, pipe: pipe, logLevel: ethlog.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config, plugins: make(map[string]plugin)} + gui := &Gui{eth: ethereum, txDb: db, pipe: pipe, logLevel: logger.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config, plugins: make(map[string]plugin)} data, _ := ethutil.ReadAllFile(path.Join(ethutil.Config.ExecPath, "plugins.json")) json.Unmarshal([]byte(data), &gui.plugins) @@ -155,36 +155,36 @@ func (gui *Gui) Start(assetPath string) { addlog = true } if err != nil { - logger.Errorln("asset not found: you can set an alternative asset path on the command line using option 'asset_path'", err) + guilogger.Errorln("asset not found: you can set an alternative asset path on the command line using option 'asset_path'", err) panic(err) } - logger.Infoln("Starting GUI") + guilogger.Infoln("Starting GUI") gui.open = true win.Show() - // only add the gui logger after window is shown otherwise slider wont be shown + // only add the gui guilogger after window is shown otherwise slider wont be shown if addlog { - ethlog.AddLogSystem(gui) + logger.AddLogSystem(gui) } win.Wait() - // need to silence gui logger after window closed otherwise logsystem hangs (but do not save loglevel) - gui.logLevel = ethlog.Silence + // need to silence gui guilogger after window closed otherwise logsystem hangs (but do not save loglevel) + gui.logLevel = logger.Silence gui.open = false } func (gui *Gui) Stop() { if gui.open { - gui.logLevel = ethlog.Silence + gui.logLevel = logger.Silence gui.open = false gui.win.Hide() } gui.uiLib.jsEngine.Stop() - logger.Infoln("Stopped") + guilogger.Infoln("Stopped") } func (gui *Gui) showWallet(context *qml.Context) (*qml.Window, error) { @@ -229,17 +229,17 @@ func (gui *Gui) createWindow(comp qml.Object) *qml.Window { func (gui *Gui) ImportAndSetPrivKey(secret string) bool { err := gui.eth.KeyManager().InitFromString(gui.Session, 0, secret) if err != nil { - logger.Errorln("unable to import: ", err) + guilogger.Errorln("unable to import: ", err) return false } - logger.Errorln("successfully imported: ", err) + guilogger.Errorln("successfully imported: ", err) return true } func (gui *Gui) CreateAndSetPrivKey() (string, string, string, string) { err := gui.eth.KeyManager().Init(gui.Session, 0, true) if err != nil { - logger.Errorln("unable to create key: ", err) + guilogger.Errorln("unable to create key: ", err) return "", "", "", "" } return gui.eth.KeyManager().KeyPair().AsStrings() @@ -387,7 +387,7 @@ func (gui *Gui) update() { }() for _, plugin := range gui.plugins { - logger.Infoln("Loading plugin ", plugin.Name) + guilogger.Infoln("Loading plugin ", plugin.Name) gui.win.Root().Call("addPlugin", plugin.Path, "") } diff --git a/cmd/mist/html_container.go b/cmd/mist/html_container.go index 96bae1a9a..755d5ea6e 100644 --- a/cmd/mist/html_container.go +++ b/cmd/mist/html_container.go @@ -98,12 +98,12 @@ func (app *HtmlApplication) NewWatcher(quitChan chan bool) { app.watcher, err = fsnotify.NewWatcher() if err != nil { - logger.Infoln("Could not create new auto-reload watcher:", err) + guilogger.Infoln("Could not create new auto-reload watcher:", err) return } err = app.watcher.Watch(app.RootFolder()) if err != nil { - logger.Infoln("Could not start auto-reload watcher:", err) + guilogger.Infoln("Could not start auto-reload watcher:", err) return } for _, folder := range app.RecursiveFolders() { @@ -119,11 +119,11 @@ func (app *HtmlApplication) NewWatcher(quitChan chan bool) { app.watcher.Close() break out case <-app.watcher.Event: - //logger.Debugln("Got event:", ev) + //guilogger.Debugln("Got event:", ev) app.webView.Call("reload") case err := <-app.watcher.Error: // TODO: Do something here - logger.Infoln("Watcher error:", err) + guilogger.Infoln("Watcher error:", err) } } }() diff --git a/cmd/mist/main.go b/cmd/mist/main.go index e739bbff5..b7282d9b5 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -22,7 +22,7 @@ import ( "runtime" "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/ethlog" + "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/utils" "gopkg.in/qml.v1" ) @@ -108,5 +108,5 @@ func main() { } // this blocks the thread ethereum.WaitForShutdown() - ethlog.Flush() + logger.Flush() } diff --git a/cmd/mist/qml_container.go b/cmd/mist/qml_container.go index 3318786e7..13a50d988 100644 --- a/cmd/mist/qml_container.go +++ b/cmd/mist/qml_container.go @@ -50,7 +50,7 @@ func (app *QmlApplication) Create() error { component, err := app.engine.LoadFile(path) if err != nil { - logger.Warnln(err) + guilogger.Warnln(err) } app.win = component.CreateWindow(nil) diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index b12fab603..6fffa845f 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -62,7 +62,7 @@ func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib { } func (self *UiLib) Notef(args []interface{}) { - logger.Infoln(args...) + guilogger.Infoln(args...) } func (self *UiLib) LookupDomain(domain string) string { @@ -158,7 +158,7 @@ func (ui *UiLib) OpenBrowser() { func (ui *UiLib) Muted(content string) { component, err := ui.engine.LoadFile(ui.AssetPath("qml/muted.qml")) if err != nil { - logger.Debugln(err) + guilogger.Debugln(err) return } -- cgit v1.2.3 From 8826e9694c3a8d4f480f0a021d8c02f7f61612c6 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 31 Oct 2014 14:20:11 +0100 Subject: Moved utils to cmd --- cmd/mist/bindings.go | 2 +- cmd/mist/debugger.go | 2 +- cmd/mist/flags.go | 3 ++- cmd/mist/main.go | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go index 8b038587b..f5a0dfcff 100644 --- a/cmd/mist/bindings.go +++ b/cmd/mist/bindings.go @@ -23,10 +23,10 @@ import ( "strconv" "github.com/ethereum/go-ethereum/chain" + "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/utils" ) type plugin struct { diff --git a/cmd/mist/debugger.go b/cmd/mist/debugger.go index d786a0395..fadc241ff 100644 --- a/cmd/mist/debugger.go +++ b/cmd/mist/debugger.go @@ -25,9 +25,9 @@ import ( "unicode" "github.com/ethereum/go-ethereum/chain" + "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/utils" "github.com/ethereum/go-ethereum/vm" "gopkg.in/qml.v1" ) diff --git a/cmd/mist/flags.go b/cmd/mist/flags.go index 7de2a881d..2ae0a0487 100644 --- a/cmd/mist/flags.go +++ b/cmd/mist/flags.go @@ -28,6 +28,7 @@ import ( "runtime" "bitbucket.org/kardianos/osext" + "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/vm" ) @@ -116,7 +117,7 @@ func Init() { flag.StringVar(&Datadir, "datadir", defaultDataDir(), "specifies the datadir to use") flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file") flag.StringVar(&DebugFile, "debug", "", "debug file (no debugging if not set)") - flag.IntVar(&LogLevel, "loglevel", int(repllogger.InfoLevel), "loglevel: 0-5: silent,error,warn,info,debug,debug detail)") + flag.IntVar(&LogLevel, "loglevel", int(logger.InfoLevel), "loglevel: 0-5: silent,error,warn,info,debug,debug detail)") flag.StringVar(&AssetPath, "asset_path", defaultAssetPath(), "absolute path to GUI assets directory") diff --git a/cmd/mist/main.go b/cmd/mist/main.go index b7282d9b5..bb981b950 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -22,8 +22,8 @@ import ( "runtime" "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/utils" "gopkg.in/qml.v1" ) -- cgit v1.2.3 From 0ed1a8b50a9b9726cd57a2731d0405f6949c6188 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 31 Oct 2014 14:30:08 +0100 Subject: ethpipe => xeth (eXtended ETHereum) --- cmd/mist/bindings.go | 4 ++-- cmd/mist/ext_app.go | 6 +++--- cmd/mist/gui.go | 22 +++++++++++----------- cmd/mist/html_container.go | 4 ++-- cmd/mist/qml_container.go | 4 ++-- cmd/mist/ui_lib.go | 16 ++++++++-------- 6 files changed, 28 insertions(+), 28 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go index f5a0dfcff..196fd38a1 100644 --- a/cmd/mist/bindings.go +++ b/cmd/mist/bindings.go @@ -24,9 +24,9 @@ import ( "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/xeth" ) type plugin struct { @@ -46,7 +46,7 @@ func (gui *Gui) LogPrint(level logger.LogLevel, msg string) { } */ } -func (gui *Gui) Transact(recipient, value, gas, gasPrice, d string) (*ethpipe.JSReceipt, error) { +func (gui *Gui) Transact(recipient, value, gas, gasPrice, d string) (*xeth.JSReceipt, error) { var data string if len(recipient) == 0 { code, err := ethutil.Compile(d, false) diff --git a/cmd/mist/ext_app.go b/cmd/mist/ext_app.go index 8af9778bc..4a3ab1d2c 100644 --- a/cmd/mist/ext_app.go +++ b/cmd/mist/ext_app.go @@ -21,11 +21,11 @@ import ( "encoding/json" "github.com/ethereum/go-ethereum/chain" - "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/javascript" "github.com/ethereum/go-ethereum/ui/qt" + "github.com/ethereum/go-ethereum/xeth" "gopkg.in/qml.v1" ) @@ -43,7 +43,7 @@ type AppContainer interface { } type ExtApplication struct { - *ethpipe.JSPipe + *xeth.JSXEth eth chain.EthManager events event.Subscription @@ -57,7 +57,7 @@ type ExtApplication struct { func NewExtApplication(container AppContainer, lib *UiLib) *ExtApplication { return &ExtApplication{ - JSPipe: ethpipe.NewJSPipe(lib.eth), + JSXEth: xeth.NewJSXEth(lib.eth), eth: lib.eth, watcherQuitChan: make(chan bool), filters: make(map[string]*chain.Filter), diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 4ae92a340..2dfdd104f 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -34,10 +34,10 @@ import ( "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethminer" - "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/ethwire" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/xeth" "gopkg.in/qml.v1" ) @@ -84,7 +84,7 @@ type Gui struct { logLevel logger.LogLevel open bool - pipe *ethpipe.JSPipe + pipe *xeth.JSXEth Session string clientIdentity *ethwire.SimpleClientIdentity @@ -103,7 +103,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden panic(err) } - pipe := ethpipe.NewJSPipe(ethereum) + pipe := xeth.NewJSXEth(ethereum) gui := &Gui{eth: ethereum, txDb: db, pipe: pipe, logLevel: logger.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config, plugins: make(map[string]plugin)} data, _ := ethutil.ReadAllFile(path.Join(ethutil.Config.ExecPath, "plugins.json")) json.Unmarshal([]byte(data), &gui.plugins) @@ -117,11 +117,11 @@ func (gui *Gui) Start(assetPath string) { // Register ethereum functions qml.RegisterTypes("Ethereum", 1, 0, []qml.TypeSpec{{ - Init: func(p *ethpipe.JSBlock, obj qml.Object) { p.Number = 0; p.Hash = "" }, + Init: func(p *xeth.JSBlock, obj qml.Object) { p.Number = 0; p.Hash = "" }, }, { - Init: func(p *ethpipe.JSTransaction, obj qml.Object) { p.Value = ""; p.Hash = ""; p.Address = "" }, + Init: func(p *xeth.JSTransaction, obj qml.Object) { p.Value = ""; p.Hash = ""; p.Address = "" }, }, { - Init: func(p *ethpipe.KeyVal, obj qml.Object) { p.Key = ""; p.Value = "" }, + Init: func(p *xeth.KeyVal, obj qml.Object) { p.Key = ""; p.Value = "" }, }}) // Create a new QML engine gui.engine = qml.NewEngine() @@ -287,7 +287,7 @@ func (gui *Gui) loadAddressBook() { } func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) { - pipe := ethpipe.New(gui.eth) + pipe := xeth.New(gui.eth) nameReg := pipe.World().Config().Get("NameReg") addr := gui.address() @@ -299,7 +299,7 @@ func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) { } var ( - ptx = ethpipe.NewJSTx(tx, pipe.World().State()) + ptx = xeth.NewJSTx(tx, pipe.World().State()) send = nameReg.Storage(tx.Sender()) rec = nameReg.Storage(tx.Recipient) s, r string @@ -346,7 +346,7 @@ func (gui *Gui) readPreviousTransactions() { func (gui *Gui) processBlock(block *chain.Block, initial bool) { name := strings.Trim(gui.pipe.World().Config().Get("NameReg").Storage(block.Coinbase).Str(), "\x00") - b := ethpipe.NewJSBlock(block) + b := xeth.NewJSBlock(block) b.Name = name gui.getObjectByName("chainView").Call("addBlock", b, initial) @@ -451,12 +451,12 @@ func (gui *Gui) update() { if bytes.Compare(tx.Sender(), gui.address()) == 0 { object.SubAmount(tx.Value) - //gui.getObjectByName("transactionView").Call("addTx", ethpipe.NewJSTx(tx), "send") + //gui.getObjectByName("transactionView").Call("addTx", xeth.NewJSTx(tx), "send") gui.txDb.Put(tx.Hash(), tx.RlpEncode()) } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { object.AddAmount(tx.Value) - //gui.getObjectByName("transactionView").Call("addTx", ethpipe.NewJSTx(tx), "recv") + //gui.getObjectByName("transactionView").Call("addTx", xeth.NewJSTx(tx), "recv") gui.txDb.Put(tx.Hash(), tx.RlpEncode()) } diff --git a/cmd/mist/html_container.go b/cmd/mist/html_container.go index 755d5ea6e..082d65f67 100644 --- a/cmd/mist/html_container.go +++ b/cmd/mist/html_container.go @@ -28,10 +28,10 @@ import ( "path/filepath" "github.com/ethereum/go-ethereum/chain" - "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/javascript" + "github.com/ethereum/go-ethereum/xeth" "github.com/howeyc/fsnotify" "gopkg.in/qml.v1" ) @@ -139,7 +139,7 @@ func (app *HtmlApplication) Window() *qml.Window { } func (app *HtmlApplication) NewBlock(block *chain.Block) { - b := ðpipe.JSBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())} + b := &xeth.JSBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())} app.webView.Call("onNewBlockCb", b) } diff --git a/cmd/mist/qml_container.go b/cmd/mist/qml_container.go index 13a50d988..4f6ca0b7f 100644 --- a/cmd/mist/qml_container.go +++ b/cmd/mist/qml_container.go @@ -22,9 +22,9 @@ import ( "runtime" "github.com/ethereum/go-ethereum/chain" - "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/xeth" "gopkg.in/qml.v1" ) @@ -66,7 +66,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) { // Events func (app *QmlApplication) NewBlock(block *chain.Block) { - pblock := ðpipe.JSBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())} + pblock := &xeth.JSBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())} app.win.Call("onNewBlockCb", pblock) } diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index 6fffa845f..9d2554cf4 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -27,11 +27,11 @@ import ( "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/javascript" "github.com/ethereum/go-ethereum/ui/qt" + "github.com/ethereum/go-ethereum/xeth" "gopkg.in/qml.v1" ) @@ -42,7 +42,7 @@ type memAddr struct { // UI Library that has some basic functionality exposed type UiLib struct { - *ethpipe.JSPipe + *xeth.JSXEth engine *qml.Engine eth *eth.Ethereum connected bool @@ -58,7 +58,7 @@ type UiLib struct { } func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib { - return &UiLib{JSPipe: ethpipe.NewJSPipe(eth), engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth), filterCallbacks: make(map[int][]int)} //, filters: make(map[int]*ethpipe.JSFilter)} + return &UiLib{JSXEth: xeth.NewJSXEth(eth), engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth), filterCallbacks: make(map[int][]int)} //, filters: make(map[int]*xeth.JSFilter)} } func (self *UiLib) Notef(args []interface{}) { @@ -214,7 +214,7 @@ func (self *UiLib) StartDebugger() { func (self *UiLib) NewFilter(object map[string]interface{}) (id int) { filter := qt.NewFilterFromMap(object, self.eth) filter.MessageCallback = func(messages ethstate.Messages) { - self.win.Root().Call("invokeFilterCallback", ethpipe.ToJSMessages(messages), id) + self.win.Root().Call("invokeFilterCallback", xeth.ToJSMessages(messages), id) } id = self.eth.InstallFilter(filter) return id @@ -232,7 +232,7 @@ func (self *UiLib) NewFilterString(typ string) (id int) { func (self *UiLib) Messages(id int) *ethutil.List { filter := self.eth.GetFilter(id) if filter != nil { - messages := ethpipe.ToJSMessages(filter.Find()) + messages := xeth.ToJSMessages(filter.Find()) return messages } @@ -295,10 +295,10 @@ func mapToTxParams(object map[string]interface{}) map[string]string { return conv } -func (self *UiLib) Transact(params map[string]interface{}) (*ethpipe.JSReceipt, error) { +func (self *UiLib) Transact(params map[string]interface{}) (*xeth.JSReceipt, error) { object := mapToTxParams(params) - return self.JSPipe.Transact( + return self.JSXEth.Transact( object["from"], object["to"], object["value"], @@ -320,7 +320,7 @@ func (self *UiLib) Compile(code string) (string, error) { func (self *UiLib) Call(params map[string]interface{}) (string, error) { object := mapToTxParams(params) - return self.JSPipe.Execute( + return self.JSXEth.Execute( object["to"], object["value"], object["gas"], -- cgit v1.2.3 From af8f5f0b69f1c359991d12c7708804fe8dd1f944 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 31 Oct 2014 14:43:14 +0100 Subject: ethstate => state --- cmd/mist/debugger.go | 20 ++++++++++---------- cmd/mist/ext_app.go | 8 ++++---- cmd/mist/html_container.go | 4 ++-- cmd/mist/qml_container.go | 4 ++-- cmd/mist/ui_lib.go | 4 ++-- 5 files changed, 20 insertions(+), 20 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/debugger.go b/cmd/mist/debugger.go index fadc241ff..3fd48eec6 100644 --- a/cmd/mist/debugger.go +++ b/cmd/mist/debugger.go @@ -26,8 +26,8 @@ import ( "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/vm" "gopkg.in/qml.v1" ) @@ -40,7 +40,7 @@ type DebuggerWindow struct { vm *vm.DebugVm Db *Debugger - state *ethstate.State + state *state.State } func NewDebuggerWindow(lib *UiLib) *DebuggerWindow { @@ -141,17 +141,17 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data keyPair = self.lib.eth.KeyManager().KeyPair() ) - state := self.lib.eth.StateManager().TransState() + statedb := self.lib.eth.StateManager().TransState() account := self.lib.eth.StateManager().TransState().GetAccount(keyPair.Address()) - contract := ethstate.NewStateObject([]byte{0}) + contract := statedb.NewStateObject([]byte{0}) contract.SetBalance(value) self.SetAsm(script) block := self.lib.eth.ChainManager().CurrentBlock - callerClosure := vm.NewClosure(ðstate.Message{}, account, contract, script, gas, gasPrice) - env := utils.NewEnv(state, block, account.Address(), value) + callerClosure := vm.NewClosure(&state.Message{}, account, contract, script, gas, gasPrice) + env := utils.NewEnv(statedb, block, account.Address(), value) evm := vm.NewDebugVm(env) evm.Dbg = self.Db @@ -172,7 +172,7 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data } } - state.Reset() + statedb.Reset() if !self.Db.interrupt { self.Db.done = true @@ -267,13 +267,13 @@ type storeVal struct { Key, Value string } -func (self *Debugger) BreakHook(pc int, op vm.OpCode, mem *vm.Memory, stack *vm.Stack, stateObject *ethstate.StateObject) bool { +func (self *Debugger) BreakHook(pc int, op vm.OpCode, mem *vm.Memory, stack *vm.Stack, stateObject *state.StateObject) bool { self.main.Logln("break on instr:", pc) return self.halting(pc, op, mem, stack, stateObject) } -func (self *Debugger) StepHook(pc int, op vm.OpCode, mem *vm.Memory, stack *vm.Stack, stateObject *ethstate.StateObject) bool { +func (self *Debugger) StepHook(pc int, op vm.OpCode, mem *vm.Memory, stack *vm.Stack, stateObject *state.StateObject) bool { return self.halting(pc, op, mem, stack, stateObject) } @@ -285,7 +285,7 @@ func (self *Debugger) BreakPoints() []int64 { return self.breakPoints } -func (d *Debugger) halting(pc int, op vm.OpCode, mem *vm.Memory, stack *vm.Stack, stateObject *ethstate.StateObject) bool { +func (d *Debugger) halting(pc int, op vm.OpCode, mem *vm.Memory, stack *vm.Stack, stateObject *state.StateObject) bool { d.win.Root().Call("setInstruction", pc) d.win.Root().Call("clearMem") d.win.Root().Call("clearStack") diff --git a/cmd/mist/ext_app.go b/cmd/mist/ext_app.go index 4a3ab1d2c..d004f98c5 100644 --- a/cmd/mist/ext_app.go +++ b/cmd/mist/ext_app.go @@ -21,9 +21,9 @@ import ( "encoding/json" "github.com/ethereum/go-ethereum/chain" - "github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/javascript" + "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/ui/qt" "github.com/ethereum/go-ethereum/xeth" "gopkg.in/qml.v1" @@ -38,7 +38,7 @@ type AppContainer interface { NewBlock(*chain.Block) NewWatcher(chan bool) - Messages(ethstate.Messages, string) + Messages(state.Messages, string) Post(string, int) } @@ -80,7 +80,7 @@ func (app *ExtApplication) run() { // Subscribe to events mux := app.lib.eth.EventMux() - app.events = mux.Subscribe(chain.NewBlockEvent{}, ethstate.Messages(nil)) + app.events = mux.Subscribe(chain.NewBlockEvent{}, state.Messages(nil)) // Call the main loop go app.mainLoop() @@ -109,7 +109,7 @@ func (app *ExtApplication) mainLoop() { case chain.NewBlockEvent: app.container.NewBlock(ev.Block) - case ethstate.Messages: + case state.Messages: for id, filter := range app.filters { msgs := filter.FilterMessages(ev) if len(msgs) > 0 { diff --git a/cmd/mist/html_container.go b/cmd/mist/html_container.go index 082d65f67..35e351b02 100644 --- a/cmd/mist/html_container.go +++ b/cmd/mist/html_container.go @@ -28,9 +28,9 @@ import ( "path/filepath" "github.com/ethereum/go-ethereum/chain" - "github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/javascript" + "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/xeth" "github.com/howeyc/fsnotify" "gopkg.in/qml.v1" @@ -143,7 +143,7 @@ func (app *HtmlApplication) NewBlock(block *chain.Block) { app.webView.Call("onNewBlockCb", b) } -func (self *HtmlApplication) Messages(messages ethstate.Messages, id string) { +func (self *HtmlApplication) Messages(messages state.Messages, id string) { var msgs []javascript.JSMessage for _, m := range messages { msgs = append(msgs, javascript.NewJSMessage(m)) diff --git a/cmd/mist/qml_container.go b/cmd/mist/qml_container.go index 4f6ca0b7f..60013ec2b 100644 --- a/cmd/mist/qml_container.go +++ b/cmd/mist/qml_container.go @@ -22,8 +22,8 @@ import ( "runtime" "github.com/ethereum/go-ethereum/chain" - "github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/xeth" "gopkg.in/qml.v1" ) @@ -70,7 +70,7 @@ func (app *QmlApplication) NewBlock(block *chain.Block) { app.win.Call("onNewBlockCb", pblock) } -func (self *QmlApplication) Messages(msgs ethstate.Messages, id string) { +func (self *QmlApplication) Messages(msgs state.Messages, id string) { fmt.Println("IMPLEMENT QML APPLICATION MESSAGES METHOD") } diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index 9d2554cf4..db299f18d 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -27,9 +27,9 @@ import ( "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/javascript" + "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/ui/qt" "github.com/ethereum/go-ethereum/xeth" "gopkg.in/qml.v1" @@ -213,7 +213,7 @@ func (self *UiLib) StartDebugger() { func (self *UiLib) NewFilter(object map[string]interface{}) (id int) { filter := qt.NewFilterFromMap(object, self.eth) - filter.MessageCallback = func(messages ethstate.Messages) { + filter.MessageCallback = func(messages state.Messages) { self.win.Root().Call("invokeFilterCallback", xeth.ToJSMessages(messages), id) } id = self.eth.InstallFilter(filter) -- cgit v1.2.3 From 4914a78c8c650d7fc74570f25a682598aaeb6973 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 31 Oct 2014 14:53:42 +0100 Subject: ethwire => wire --- cmd/mist/gui.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 2dfdd104f..d309e0a9b 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -35,8 +35,8 @@ import ( "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethminer" "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/ethwire" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/wire" "github.com/ethereum/go-ethereum/xeth" "gopkg.in/qml.v1" ) @@ -87,7 +87,7 @@ type Gui struct { pipe *xeth.JSXEth Session string - clientIdentity *ethwire.SimpleClientIdentity + clientIdentity *wire.SimpleClientIdentity config *ethutil.ConfigManager plugins map[string]plugin @@ -97,7 +97,7 @@ type Gui struct { } // Create GUI, but doesn't start it -func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIdentity *ethwire.SimpleClientIdentity, session string, logLevel int) *Gui { +func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIdentity *wire.SimpleClientIdentity, session string, logLevel int) *Gui { db, err := ethdb.NewLDBDatabase("tx_database") if err != nil { panic(err) -- cgit v1.2.3 From 5af4ff985dc43b648bdc96394a3bd96d9658ae0a Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 31 Oct 2014 14:56:42 +0100 Subject: ethminer => miner --- cmd/mist/gui.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index d309e0a9b..d6f6832e2 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -33,9 +33,9 @@ import ( "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethminer" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/wire" "github.com/ethereum/go-ethereum/xeth" "gopkg.in/qml.v1" @@ -92,7 +92,7 @@ type Gui struct { plugins map[string]plugin - miner *ethminer.Miner + miner *miner.Miner stdLog logger.LogSystem } @@ -410,7 +410,7 @@ func (gui *Gui) update() { chain.NewBlockEvent{}, chain.TxPreEvent{}, chain.TxPostEvent{}, - ethminer.Event{}, + miner.Event{}, ) // nameReg := gui.pipe.World().Config().Get("NameReg") @@ -469,8 +469,8 @@ func (gui *Gui) update() { case eth.PeerListEvent: gui.setPeerInfo() - case ethminer.Event: - if ev.Type == ethminer.Started { + case miner.Event: + if ev.Type == miner.Started { gui.miner = ev.Miner } else { gui.miner = nil -- cgit v1.2.3 From bd4f51ff3c75c186dbc8a71439953c8fc05b16cd Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 3 Nov 2014 00:30:52 +0100 Subject: Use new iterator --- cmd/mist/gui.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index d6f6832e2..8fa068c14 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -334,7 +334,7 @@ func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) { } func (gui *Gui) readPreviousTransactions() { - it := gui.txDb.Db().NewIterator(nil, nil) + it := gui.txDb.NewIterator() for it.Next() { tx := chain.NewTransactionFromBytes(it.Value()) -- cgit v1.2.3 From d56d0c64aa84ae4f85f2ceb110e5b676f7adea7f Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 4 Nov 2014 01:50:16 +0100 Subject: Version bump --- cmd/mist/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/main.go b/cmd/mist/main.go index bb981b950..457773c14 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -29,7 +29,7 @@ import ( const ( ClientIdentifier = "Mist" - Version = "0.7.2" + Version = "0.7.3" ) var ethereum *eth.Ethereum -- cgit v1.2.3 From f59a3b67f69b26f969084e0de165435e80bd8e12 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 4 Nov 2014 10:57:02 +0100 Subject: StateManager => BlockManager --- cmd/mist/bindings.go | 2 +- cmd/mist/debugger.go | 4 ++-- cmd/mist/gui.go | 4 ++-- cmd/mist/ui_lib.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go index 196fd38a1..ebdd8ec73 100644 --- a/cmd/mist/bindings.go +++ b/cmd/mist/bindings.go @@ -108,7 +108,7 @@ func (self *Gui) DumpState(hash, path string) { var stateDump []byte if len(hash) == 0 { - stateDump = self.eth.StateManager().CurrentState().Dump() + stateDump = self.eth.BlockManager().CurrentState().Dump() } else { var block *chain.Block if hash[0] == '#' { diff --git a/cmd/mist/debugger.go b/cmd/mist/debugger.go index 3fd48eec6..a2aae6f0b 100644 --- a/cmd/mist/debugger.go +++ b/cmd/mist/debugger.go @@ -141,8 +141,8 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data keyPair = self.lib.eth.KeyManager().KeyPair() ) - statedb := self.lib.eth.StateManager().TransState() - account := self.lib.eth.StateManager().TransState().GetAccount(keyPair.Address()) + statedb := self.lib.eth.BlockManager().TransState() + account := self.lib.eth.BlockManager().TransState().GetAccount(keyPair.Address()) contract := statedb.NewStateObject([]byte{0}) contract.SetBalance(value) diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 8fa068c14..5af1b5c7b 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -396,7 +396,7 @@ func (gui *Gui) update() { generalUpdateTicker := time.NewTicker(500 * time.Millisecond) statsUpdateTicker := time.NewTicker(5 * time.Second) - state := gui.eth.StateManager().TransState() + state := gui.eth.BlockManager().TransState() unconfirmedFunds := new(big.Int) gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Balance()))) @@ -428,7 +428,7 @@ func (gui *Gui) update() { case chain.NewBlockEvent: gui.processBlock(ev.Block, false) if bytes.Compare(ev.Block.Coinbase, gui.address()) == 0 { - gui.setWalletValue(gui.eth.StateManager().CurrentState().GetAccount(gui.address()).Balance(), nil) + gui.setWalletValue(gui.eth.BlockManager().CurrentState().GetAccount(gui.address()).Balance(), nil) } case chain.TxPreEvent: diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index db299f18d..bb978707d 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -190,7 +190,7 @@ func (ui *UiLib) AssetPath(p string) string { func (self *UiLib) StartDbWithContractAndData(contractHash, data string) { dbWindow := NewDebuggerWindow(self) - object := self.eth.StateManager().CurrentState().GetStateObject(ethutil.Hex2Bytes(contractHash)) + object := self.eth.BlockManager().CurrentState().GetStateObject(ethutil.Hex2Bytes(contractHash)) if len(object.Code) > 0 { dbWindow.SetCode("0x" + ethutil.Bytes2Hex(object.Code)) } -- cgit v1.2.3 From 429dd2a100f3b9e2b612b59bcb48f79a805cd6f9 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 7 Nov 2014 12:18:48 +0100 Subject: Implemented new miner w/ ui interface for merged mining. Closes #177 * Miner has been rewritten * Added new miner pane * Added option for local txs * Added option to read from MergeMining contract and list them for merged mining --- cmd/mist/assets/miner.png | Bin 0 -> 2100 bytes cmd/mist/assets/qml/main.qml | 42 ++---- cmd/mist/assets/qml/views/miner.qml | 254 ++++++++++++++++++++++++++++++++++++ cmd/mist/bindings.go | 21 --- cmd/mist/gui.go | 51 ++++++-- cmd/mist/ui_lib.go | 38 +++++- 6 files changed, 342 insertions(+), 64 deletions(-) create mode 100644 cmd/mist/assets/miner.png create mode 100644 cmd/mist/assets/qml/views/miner.qml (limited to 'cmd/mist') diff --git a/cmd/mist/assets/miner.png b/cmd/mist/assets/miner.png new file mode 100644 index 000000000..58e3f4dfe Binary files /dev/null and b/cmd/mist/assets/miner.png differ diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index cfd227b49..d2a8d1d63 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -12,7 +12,6 @@ import "../ext/http.js" as Http ApplicationWindow { id: root - property alias miningButtonText: miningButton.text property var ethx : Eth.ethx property var browser @@ -47,6 +46,7 @@ ApplicationWindow { Component.onCompleted: { var wallet = addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "ethereum", active: true}); var browser = addPlugin("./webapp.qml", {noAdd: true, close: false, section: "ethereum", active: true}); + var browser = addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: true}); root.browser = browser; addPlugin("./views/transaction.qml", {noAdd: true, close: false, section: "legacy"}); @@ -252,29 +252,18 @@ ApplicationWindow { } statusBar: StatusBar { - height: 32 + //height: 32 id: statusBar - RowLayout { - Button { - id: miningButton - text: "Start Mining" - onClicked: { - gui.toggleMining() - } - } - - RowLayout { - Label { - id: walletValueLabel + Label { + //y: 6 + id: walletValueLabel - font.pixelSize: 10 - styleColor: "#797979" - } - } + font.pixelSize: 10 + styleColor: "#797979" } Label { - y: 6 + //y: 6 objectName: "miningLabel" visible: true font.pixelSize: 10 @@ -283,7 +272,7 @@ ApplicationWindow { } Label { - y: 6 + //y: 6 id: lastBlockLabel objectName: "lastBlockLabel" visible: true @@ -297,14 +286,14 @@ ApplicationWindow { id: downloadIndicator value: 0 objectName: "downloadIndicator" - y: 3 + y: -4 x: statusBar.width / 2 - this.width / 2 width: 160 } Label { objectName: "downloadLabel" - y: 7 + //y: 7 anchors.left: downloadIndicator.right anchors.leftMargin: 5 font.pixelSize: 10 @@ -314,7 +303,7 @@ ApplicationWindow { RowLayout { id: peerGroup - y: 7 + //y: 7 anchors.right: parent.right MouseArea { onDoubleClicked: peerWindow.visible = true @@ -323,14 +312,9 @@ ApplicationWindow { Label { id: peerLabel - font.pixelSize: 8 + font.pixelSize: 10 text: "0 / 0" } - Image { - id: peerImage - width: 10; height: 10 - source: "../network.png" - } } } diff --git a/cmd/mist/assets/qml/views/miner.qml b/cmd/mist/assets/qml/views/miner.qml new file mode 100644 index 000000000..e162d60a4 --- /dev/null +++ b/cmd/mist/assets/qml/views/miner.qml @@ -0,0 +1,254 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.0; +import QtQuick.Layouts 1.0; +import QtQuick.Dialogs 1.0; +import QtQuick.Window 2.1; +import QtQuick.Controls.Styles 1.1 +import Ethereum 1.0 + +Rectangle { + id: root + property var title: "Miner" + property var iconSource: "../miner.png" + property var menuItem + + color: "#00000000" + + ColumnLayout { + spacing: 10 + anchors.fill: parent + + Rectangle { + id: mainPane + color: "#00000000" + anchors { + top: parent.top + bottom: localTxPane.top + left: parent.left + right: parent.right + } + + Rectangle { + id: menu + height: 25 + anchors { + left: parent.left + } + + RowLayout { + id: tools + anchors { + left: parent.left + right: parent.right + } + + Button { + text: "Start" + onClicked: { + eth.setGasPrice(minGasPrice.text || "10000000000000"); + if (eth.toggleMining()) { + this.text = "Stop"; + } else { + this.text = "Start"; + } + } + } + + Rectangle { + anchors.top: parent.top + anchors.topMargin: 2 + width: 200 + TextField { + id: minGasPrice + placeholderText: "Min Gas: 10000000000000" + width: 200 + validator: RegExpValidator { regExp: /\d*/ } + } + } + } + } + + Column { + anchors { + left: parent.left + right: parent.right + top: menu.bottom + topMargin: 5 + } + + Text { + text: "Merged mining options" + } + + TableView { + id: mergedMiningTable + height: 300 + anchors { + left: parent.left + right: parent.right + } + Component { + id: checkBoxDelegate + + Item { + id: test + CheckBox { + anchors.fill: parent + checked: styleData.value + + onClicked: { + var model = mergedMiningModel.get(styleData.row) + + if (this.checked) { + model.id = txModel.createLocalTx(model.address, "0", "5000", "0", "") + } else { + txModel.removeWithId(model.id); + model.id = 0; + } + } + } + } + } + TableViewColumn{ role: "checked" ; title: "" ; width: 40 ; delegate: checkBoxDelegate } + TableViewColumn{ role: "name" ; title: "Name" ; width: 480 } + model: ListModel { + objectName: "mergedMiningModel" + id: mergedMiningModel + function addMergedMiningOption(model) { + this.append(model); + } + } + Component.onCompleted: { + /* interface test stuff + // XXX Temp. replace with above eventually + var tmpItems = ["JEVCoin", "Some coin", "Other coin", "Etc coin"]; + var address = "e6716f9544a56c530d868e4bfbacb172315bdead"; + for (var i = 0; i < tmpItems.length; i++) { + mergedMiningModel.append({checked: false, name: tmpItems[i], address: address, id: 0, itemId: i}); + } + */ + } + } + } + } + + Rectangle { + id: localTxPane + color: "#ececec" + border.color: "#cccccc" + border.width: 1 + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: 300 + + ColumnLayout { + spacing: 10 + anchors.fill: parent + RowLayout { + id: newLocalTx + anchors { + left: parent.left + leftMargin: 5 + top: parent.top + topMargin: 5 + bottomMargin: 5 + } + + Text { + text: "Local tx" + } + + Rectangle { + width: 250 + color: "#00000000" + anchors.top: parent.top + anchors.topMargin: 2 + + TextField { + id: to + placeholderText: "To" + width: 250 + validator: RegExpValidator { regExp: /[abcdefABCDEF1234567890]*/ } + } + } + TextField { + property var defaultGas: "5000" + id: gas + placeholderText: "Gas" + text: defaultGas + validator: RegExpValidator { regExp: /\d*/ } + } + TextField { + id: gasPrice + placeholderText: "Price" + validator: RegExpValidator { regExp: /\d*/ } + } + TextField { + id: value + placeholderText: "Amount" + text: "0" + validator: RegExpValidator { regExp: /\d*/ } + } + TextField { + id: data + placeholderText: "Data" + validator: RegExpValidator { regExp: /[abcdefABCDEF1234567890]*/ } + } + Button { + text: "Create" + onClicked: { + if (to.text.length == 40 && gasPrice.text.length != 0 && value.text.length != 0 && gas.text.length != 0) { + txModel.createLocalTx(to.text, gasPrice.text, gas.text, value.text, data.text); + + to.text = ""; gasPrice.text = ""; + gas.text = gas.defaultGas; + value.text = "0" + } + } + } + } + + TableView { + id: txTableView + anchors { + top: newLocalTx.bottom + topMargin: 5 + left: parent.left + right: parent.right + bottom: parent.bottom + } + TableViewColumn{ role: "to" ; title: "To" ; width: 480 } + TableViewColumn{ role: "gas" ; title: "Gas" ; width: 100 } + TableViewColumn{ role: "gasPrice" ; title: "Gas Price" ; width: 100 } + TableViewColumn{ role: "value" ; title: "Amount" ; width: 100 } + TableViewColumn{ role: "data" ; title: "Data" ; width: 100 } + + model: ListModel { + id: txModel + Component.onCompleted: { + } + function removeWithId(id) { + for (var i = 0; i < this.count; i++) { + if (txModel.get(i).id == id) { + this.remove(i); + eth.removeLocalTransaction(id) + break; + } + } + } + + function createLocalTx(to, gasPrice, gas, value, data) { + var id = eth.addLocalTransaction(to, data, gas, gasPrice, value) + txModel.insert(0, {to: to, gas: gas, gasPrice: gasPrice, value: value, data: data, id: id}); + + return id + } + } + } + } + } + } +} diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go index ebdd8ec73..480c38b2e 100644 --- a/cmd/mist/bindings.go +++ b/cmd/mist/bindings.go @@ -70,10 +70,6 @@ func (gui *Gui) GetCustomIdentifier() string { return gui.clientIdentity.GetCustomIdentifier() } -func (gui *Gui) ToggleTurboMining() { - gui.miner.ToggleTurbo() -} - // functions that allow Gui to implement interface guilogger.LogSystem func (gui *Gui) SetLogLevel(level logger.LogLevel) { gui.logLevel = level @@ -137,20 +133,3 @@ func (self *Gui) DumpState(hash, path string) { file.Write(stateDump) } -func (gui *Gui) ToggleMining() { - var txt string - if gui.eth.Mining { - utils.StopMining(gui.eth) - txt = "Start mining" - - gui.getObjectByName("miningLabel").Set("visible", false) - } else { - utils.StartMining(gui.eth) - gui.miner = utils.GetMiner() - txt = "Stop mining" - - gui.getObjectByName("miningLabel").Set("visible", true) - } - - gui.win.Root().Set("miningButtonText", txt) -} diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 5af1b5c7b..295011244 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -272,8 +272,6 @@ type address struct { func (gui *Gui) loadAddressBook() { view := gui.getObjectByName("infoView") - view.Call("clearAddress") - nameReg := gui.pipe.World().Config().Get("NameReg") if nameReg != nil { nameReg.EachStorage(func(name string, value *ethutil.Value) { @@ -286,6 +284,28 @@ func (gui *Gui) loadAddressBook() { } } +func (self *Gui) loadMergedMiningOptions() { + view := self.getObjectByName("mergedMiningModel") + + nameReg := self.pipe.World().Config().Get("MergeMining") + if nameReg != nil { + i := 0 + nameReg.EachStorage(func(name string, value *ethutil.Value) { + if name[0] != 0 { + value.Decode() + + view.Call("addMergedMiningOption", struct { + Checked bool + Name, Address string + Id, ItemId int + }{false, name, ethutil.Bytes2Hex(value.Bytes()), 0, i}) + + i++ + } + }) + } +} + func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) { pipe := xeth.New(gui.eth) nameReg := pipe.World().Config().Get("NameReg") @@ -382,6 +402,7 @@ func (gui *Gui) update() { go func() { go gui.setInitialChainManager() gui.loadAddressBook() + gui.loadMergedMiningOptions() gui.setPeerInfo() gui.readPreviousTransactions() }() @@ -410,7 +431,6 @@ func (gui *Gui) update() { chain.NewBlockEvent{}, chain.TxPreEvent{}, chain.TxPostEvent{}, - miner.Event{}, ) // nameReg := gui.pipe.World().Config().Get("NameReg") @@ -469,12 +489,14 @@ func (gui *Gui) update() { case eth.PeerListEvent: gui.setPeerInfo() - case miner.Event: - if ev.Type == miner.Started { - gui.miner = ev.Miner - } else { - gui.miner = nil - } + /* + case miner.Event: + if ev.Type == miner.Started { + gui.miner = ev.Miner + } else { + gui.miner = nil + } + */ } case <-peerUpdateTicker.C: @@ -483,10 +505,13 @@ func (gui *Gui) update() { statusText := "#" + gui.eth.ChainManager().CurrentBlock.Number.String() lastBlockLabel.Set("text", statusText) - if gui.miner != nil { - pow := gui.miner.GetPow() - miningLabel.Set("text", "Mining @ "+strconv.FormatInt(pow.GetHashrate(), 10)+"Khash") - } + miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.miner.GetPow().GetHashrate(), 10)+"Khash") + /* + if gui.miner != nil { + pow := gui.miner.GetPow() + miningLabel.Set("text", "Mining @ "+strconv.FormatInt(pow.GetHashrate(), 10)+"Khash") + } + */ blockLength := gui.eth.BlockPool().BlocksProcessed chainLength := gui.eth.BlockPool().ChainLength diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index bb978707d..bdf551325 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -29,6 +29,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/javascript" + "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/ui/qt" "github.com/ethereum/go-ethereum/xeth" @@ -55,10 +56,15 @@ type UiLib struct { jsEngine *javascript.JSRE filterCallbacks map[int][]int + + miner *miner.Miner } func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib { - return &UiLib{JSXEth: xeth.NewJSXEth(eth), engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth), filterCallbacks: make(map[int][]int)} //, filters: make(map[int]*xeth.JSFilter)} + lib := &UiLib{JSXEth: xeth.NewJSXEth(eth), engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth), filterCallbacks: make(map[int][]int)} //, filters: make(map[int]*xeth.JSFilter)} + lib.miner = miner.New(eth.KeyManager().Address(), eth) + + return lib } func (self *UiLib) Notef(args []interface{}) { @@ -328,3 +334,33 @@ func (self *UiLib) Call(params map[string]interface{}) (string, error) { object["data"], ) } + +func (self *UiLib) AddLocalTransaction(to, data, gas, gasPrice, value string) int { + return self.miner.AddLocalTx(&miner.LocalTx{ + To: ethutil.Hex2Bytes(to), + Data: ethutil.Hex2Bytes(data), + Gas: gas, + GasPrice: gasPrice, + Value: value, + }) - 1 +} + +func (self *UiLib) RemoveLocalTransaction(id int) { + self.miner.RemoveLocalTx(id) +} + +func (self *UiLib) SetGasPrice(price string) { + self.miner.MinAcceptedGasPrice = ethutil.Big(price) +} + +func (self *UiLib) ToggleMining() bool { + if !self.miner.Mining() { + self.miner.Start() + + return true + } else { + self.miner.Stop() + + return false + } +} -- cgit v1.2.3 From cbeebcd47da846e1b8990313f1ff1ffe7d0bf00f Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 10 Nov 2014 01:17:31 +0100 Subject: Fixed bloom, updated mining & block processing * Reverted back to process blocks in batches method * Bloom generation and lookup fix * Minor UI changed (mainly debug) --- cmd/mist/assets/qml/main.qml | 2 +- cmd/mist/assets/qml/views/chain.qml | 18 +++++++++++++----- cmd/mist/assets/qml/views/miner.qml | 2 -- cmd/mist/gui.go | 13 +------------ cmd/mist/ui_lib.go | 6 +++++- 5 files changed, 20 insertions(+), 21 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index d2a8d1d63..9f1f214a6 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -46,8 +46,8 @@ ApplicationWindow { Component.onCompleted: { var wallet = addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "ethereum", active: true}); var browser = addPlugin("./webapp.qml", {noAdd: true, close: false, section: "ethereum", active: true}); - var browser = addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: true}); root.browser = browser; + addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: true}); addPlugin("./views/transaction.qml", {noAdd: true, close: false, section: "legacy"}); addPlugin("./views/chain.qml", {noAdd: true, close: false, section: "legacy"}); diff --git a/cmd/mist/assets/qml/views/chain.qml b/cmd/mist/assets/qml/views/chain.qml index c4ceecfc0..6baf757a5 100644 --- a/cmd/mist/assets/qml/views/chain.qml +++ b/cmd/mist/assets/qml/views/chain.qml @@ -109,9 +109,9 @@ Rectangle { } if(initial){ - blockModel.append({size: block.size, number: block.number, name: block.name, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + blockModel.append({raw: block.raw, bloom: block.bloom, size: block.size, number: block.number, name: block.name, 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, {size: block.size, number: block.number, name: block.name, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + blockModel.insert(0, {bloom: block.bloom, size: block.size, number: block.number, name: block.name, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) } } @@ -136,6 +136,7 @@ Rectangle { Text { text: '

Block details

'; color: "#F2F2F2"} Text { text: 'Block number: ' + number + " (Size: " + size + ")"; color: "#F2F2F2"} Text { text: 'Hash: ' + hash; color: "#F2F2F2"} + Text { text: 'Bloom: ' + bloom; color: "#F2F2F2"} Text { text: 'Coinbase: <' + name + '> ' + coinbase; color: "#F2F2F2"} Text { text: 'Block found at: ' + prettyTime; color: "#F2F2F2"} Text { text: 'Gas used: ' + gasUsed + " / " + gasLimit; color: "#F2F2F2"} @@ -222,11 +223,17 @@ Rectangle { text: "Contract" anchors.top: contractLabel.bottom anchors.left: parent.left - anchors.bottom: popup.bottom + anchors.right: parent.right wrapMode: Text.Wrap - width: parent.width - 30 height: 80 - anchors.leftMargin: 10 + } + TextArea { + id: dumpData + anchors.top: contractData.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: 300 } } property var transactionModel: ListModel { @@ -248,6 +255,7 @@ Rectangle { } } txView.forceActiveFocus() + dumpData.text = bl.raw; } } } diff --git a/cmd/mist/assets/qml/views/miner.qml b/cmd/mist/assets/qml/views/miner.qml index e162d60a4..2d59bb3a4 100644 --- a/cmd/mist/assets/qml/views/miner.qml +++ b/cmd/mist/assets/qml/views/miner.qml @@ -119,14 +119,12 @@ Rectangle { } } Component.onCompleted: { - /* interface test stuff // XXX Temp. replace with above eventually var tmpItems = ["JEVCoin", "Some coin", "Other coin", "Etc coin"]; var address = "e6716f9544a56c530d868e4bfbacb172315bdead"; for (var i = 0; i < tmpItems.length; i++) { mergedMiningModel.append({checked: false, name: tmpItems[i], address: address, id: 0, itemId: i}); } - */ } } } diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 295011244..7e867395e 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -250,17 +250,6 @@ func (gui *Gui) setInitialChainManager() { blk := gui.eth.ChainManager().GetBlock(sBlk) for ; blk != nil; blk = gui.eth.ChainManager().GetBlock(sBlk) { sBlk = blk.PrevHash - addr := gui.address() - - // Loop through all transactions to see if we missed any while being offline - for _, tx := range blk.Transactions() { - if bytes.Compare(tx.Sender(), addr) == 0 || bytes.Compare(tx.Recipient, addr) == 0 { - if ok, _ := gui.txDb.Get(tx.Hash()); ok == nil { - gui.txDb.Put(tx.Hash(), tx.RlpEncode()) - } - - } - } gui.processBlock(blk, true) } @@ -404,7 +393,7 @@ func (gui *Gui) update() { gui.loadAddressBook() gui.loadMergedMiningOptions() gui.setPeerInfo() - gui.readPreviousTransactions() + //gui.readPreviousTransactions() }() for _, plugin := range gui.plugins { diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index bdf551325..4e480144f 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -229,7 +229,11 @@ func (self *UiLib) NewFilter(object map[string]interface{}) (id int) { func (self *UiLib) NewFilterString(typ string) (id int) { filter := chain.NewFilter(self.eth) filter.BlockCallback = func(block *chain.Block) { - self.win.Root().Call("invokeFilterCallback", "{}", id) + if self.win != nil && self.win.Root() != nil { + self.win.Root().Call("invokeFilterCallback", "{}", id) + } else { + fmt.Println("QML is lagging") + } } id = self.eth.InstallFilter(filter) return id -- cgit v1.2.3 From 6c9e503eb8d41d331d6a74e69539a06590072190 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 11 Nov 2014 22:51:26 +0100 Subject: Removed all implicit logging. Fixed gas issues and jump errors --- cmd/mist/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 457773c14..ae7101f14 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -29,7 +29,7 @@ import ( const ( ClientIdentifier = "Mist" - Version = "0.7.3" + Version = "0.7.4" ) var ethereum *eth.Ethereum -- cgit v1.2.3 From 711be7009ef5b9ad77f37a4ccd0dffcc9286e1f8 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 14 Nov 2014 13:51:41 +0100 Subject: Version bump --- cmd/mist/gui.go | 4 ++-- cmd/mist/main.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 7e867395e..785962ea0 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -526,7 +526,7 @@ func (gui *Gui) setStatsPane() { runtime.ReadMemStats(&memStats) statsPane := gui.getObjectByName("statsPane") - statsPane.Set("text", fmt.Sprintf(`###### Mist 0.6.8 (%s) ####### + statsPane.Set("text", fmt.Sprintf(`###### Mist %s (%s) ####### eth %d (p2p = %d) @@ -539,7 +539,7 @@ Heap Alloc: %d CGNext: %x NumGC: %d -`, runtime.Version(), +`, Version, runtime.Version(), eth.ProtocolVersion, eth.P2PVersion, runtime.NumCPU, runtime.NumGoroutine(), runtime.NumCgoCall(), memStats.Alloc, memStats.HeapAlloc, diff --git a/cmd/mist/main.go b/cmd/mist/main.go index ae7101f14..c106a7582 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -29,7 +29,7 @@ import ( const ( ClientIdentifier = "Mist" - Version = "0.7.4" + Version = "0.7.5" ) var ethereum *eth.Ethereum -- cgit v1.2.3 From 33afb10b0da43d55b1d6e1fe6b1b97c6ff8d8f75 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sat, 15 Nov 2014 00:29:27 +0100 Subject: clean up --- cmd/mist/gui.go | 42 ++++++++++++++---------------------------- cmd/mist/main.go | 11 +++++++---- 2 files changed, 21 insertions(+), 32 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 785962ea0..62943fa9e 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -63,6 +63,15 @@ func LoadExtension(path string) (uintptr, error) { return ptr.Interface().(uintptr), nil } */ +/* + vec, errr := LoadExtension("/Users/jeffrey/Desktop/build-libqmltest-Desktop_Qt_5_2_1_clang_64bit-Debug/liblibqmltest_debug.dylib") + fmt.Printf("Fetched vec with addr: %#x\n", vec) + if errr != nil { + fmt.Println(errr) + } else { + context.SetVar("vec", (unsafe.Pointer)(vec)) + } +*/ var guilogger = logger.NewLogger("GUI") @@ -112,9 +121,10 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden } func (gui *Gui) Start(assetPath string) { - defer gui.txDb.Close() + guilogger.Infoln("Starting GUI") + // Register ethereum functions qml.RegisterTypes("Ethereum", 1, 0, []qml.TypeSpec{{ Init: func(p *xeth.JSBlock, obj qml.Object) { p.Number = 0; p.Hash = "" }, @@ -132,16 +142,6 @@ func (gui *Gui) Start(assetPath string) { context.SetVar("gui", gui) context.SetVar("eth", gui.uiLib) - /* - vec, errr := LoadExtension("/Users/jeffrey/Desktop/build-libqmltest-Desktop_Qt_5_2_1_clang_64bit-Debug/liblibqmltest_debug.dylib") - fmt.Printf("Fetched vec with addr: %#x\n", vec) - if errr != nil { - fmt.Println(errr) - } else { - context.SetVar("vec", (unsafe.Pointer)(vec)) - } - */ - // Load the main QML interface data, _ := ethutil.Config.Db.Get([]byte("KeyRing")) @@ -160,7 +160,6 @@ func (gui *Gui) Start(assetPath string) { panic(err) } - guilogger.Infoln("Starting GUI") gui.open = true win.Show() @@ -245,7 +244,7 @@ func (gui *Gui) CreateAndSetPrivKey() (string, string, string, string) { return gui.eth.KeyManager().KeyPair().AsStrings() } -func (gui *Gui) setInitialChainManager() { +func (gui *Gui) setInitialChain(ancientBlocks bool) { sBlk := gui.eth.ChainManager().LastBlockHash blk := gui.eth.ChainManager().GetBlock(sBlk) for ; blk != nil; blk = gui.eth.ChainManager().GetBlock(sBlk) { @@ -255,10 +254,6 @@ func (gui *Gui) setInitialChainManager() { } } -type address struct { - Name, Address string -} - func (gui *Gui) loadAddressBook() { view := gui.getObjectByName("infoView") nameReg := gui.pipe.World().Config().Get("NameReg") @@ -385,11 +380,11 @@ func (self *Gui) getObjectByName(objectName string) qml.Object { func (gui *Gui) update() { // We have to wait for qml to be done loading all the windows. for !gui.qmlDone { - time.Sleep(500 * time.Millisecond) + time.Sleep(300 * time.Millisecond) } go func() { - go gui.setInitialChainManager() + go gui.setInitialChain(false) gui.loadAddressBook() gui.loadMergedMiningOptions() gui.setPeerInfo() @@ -493,14 +488,7 @@ func (gui *Gui) update() { case <-generalUpdateTicker.C: statusText := "#" + gui.eth.ChainManager().CurrentBlock.Number.String() lastBlockLabel.Set("text", statusText) - miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.miner.GetPow().GetHashrate(), 10)+"Khash") - /* - if gui.miner != nil { - pow := gui.miner.GetPow() - miningLabel.Set("text", "Mining @ "+strconv.FormatInt(pow.GetHashrate(), 10)+"Khash") - } - */ blockLength := gui.eth.BlockPool().BlocksProcessed chainLength := gui.eth.BlockPool().ChainLength @@ -510,7 +498,6 @@ func (gui *Gui) update() { dlWidget = gui.win.Root().ObjectByName("downloadIndicator") dlLabel = gui.win.Root().ObjectByName("downloadLabel") ) - dlWidget.Set("value", pct) dlLabel.Set("text", fmt.Sprintf("%d / %d", blockLength, chainLength)) @@ -549,7 +536,6 @@ NumGC: %d func (gui *Gui) setPeerInfo() { gui.win.Root().Call("setPeers", fmt.Sprintf("%d / %d", gui.eth.PeerCount(), gui.eth.MaxPeers)) - gui.win.Root().Call("resetPeers") for _, peer := range gui.pipe.Peers() { gui.win.Root().Call("addPeer", peer) diff --git a/cmd/mist/main.go b/cmd/mist/main.go index c106a7582..bc05d4f3d 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -18,8 +18,10 @@ package main import ( + "fmt" "os" "runtime" + "time" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/cmd/utils" @@ -38,6 +40,7 @@ func run() error { // precedence: code-internal flag default < config file < environment variables < command line Init() // parsing command line + tstart := time.Now() config := utils.InitConfig(VmType, ConfigFile, Datadir, "ETH") utils.InitDataDir(Datadir) @@ -51,14 +54,11 @@ func run() error { os.Exit(1) } - keyManager := utils.NewKeyManager(KeyStore, Datadir, db) // create, import, export keys utils.KeyTasks(keyManager, KeyRing, GenAddr, SecretFile, ExportDir, NonInteractive) - clientIdentity := utils.NewClientIdentity(ClientIdentifier, Version, Identifier) - ethereum = utils.NewEthereum(db, clientIdentity, keyManager, UseUPnP, OutboundPort, MaxPeer) if ShowGenesis { @@ -75,7 +75,10 @@ func run() error { utils.RegisterInterrupt(func(os.Signal) { gui.Stop() }) - utils.StartEthereum(ethereum, UseSeed) + go utils.StartEthereum(ethereum, UseSeed) + + fmt.Println("ETH stack took", time.Since(tstart)) + // gui blocks the main thread gui.Start(AssetPath) -- cgit v1.2.3 From a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 18 Nov 2014 16:58:22 +0100 Subject: Begin of moving objects to types package * Block(s) * Transaction(s) --- cmd/mist/bindings.go | 5 ++--- cmd/mist/ext_app.go | 3 ++- cmd/mist/gui.go | 7 ++++--- cmd/mist/html_container.go | 5 ++--- cmd/mist/qml_container.go | 5 ++--- cmd/mist/ui_lib.go | 5 +++-- 6 files changed, 15 insertions(+), 15 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go index 480c38b2e..eb78c3acc 100644 --- a/cmd/mist/bindings.go +++ b/cmd/mist/bindings.go @@ -21,8 +21,7 @@ import ( "encoding/json" "os" "strconv" - - "github.com/ethereum/go-ethereum/chain" + "github.com/ethereum/go-ethereum/chain/types" "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" @@ -106,7 +105,7 @@ func (self *Gui) DumpState(hash, path string) { if len(hash) == 0 { stateDump = self.eth.BlockManager().CurrentState().Dump() } else { - var block *chain.Block + var block *types.Block if hash[0] == '#' { i, _ := strconv.Atoi(hash[1:]) block = self.eth.ChainManager().GetBlockByNumber(uint64(i)) diff --git a/cmd/mist/ext_app.go b/cmd/mist/ext_app.go index d004f98c5..22fa4bfaf 100644 --- a/cmd/mist/ext_app.go +++ b/cmd/mist/ext_app.go @@ -21,6 +21,7 @@ import ( "encoding/json" "github.com/ethereum/go-ethereum/chain" + "github.com/ethereum/go-ethereum/chain/types" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/javascript" "github.com/ethereum/go-ethereum/state" @@ -36,7 +37,7 @@ type AppContainer interface { Window() *qml.Window Engine() *qml.Engine - NewBlock(*chain.Block) + NewBlock(*types.Block) NewWatcher(chan bool) Messages(state.Messages, string) Post(string, int) diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 62943fa9e..61b66cce3 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -32,6 +32,7 @@ import ( "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/chain" + "github.com/ethereum/go-ethereum/chain/types" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" @@ -290,7 +291,7 @@ func (self *Gui) loadMergedMiningOptions() { } } -func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) { +func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { pipe := xeth.New(gui.eth) nameReg := pipe.World().Config().Get("NameReg") addr := gui.address() @@ -340,7 +341,7 @@ func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) { func (gui *Gui) readPreviousTransactions() { it := gui.txDb.NewIterator() for it.Next() { - tx := chain.NewTransactionFromBytes(it.Value()) + tx := types.NewTransactionFromBytes(it.Value()) gui.insertTransaction("post", tx) @@ -348,7 +349,7 @@ func (gui *Gui) readPreviousTransactions() { it.Release() } -func (gui *Gui) processBlock(block *chain.Block, initial bool) { +func (gui *Gui) processBlock(block *types.Block, initial bool) { name := strings.Trim(gui.pipe.World().Config().Get("NameReg").Storage(block.Coinbase).Str(), "\x00") b := xeth.NewJSBlock(block) b.Name = name diff --git a/cmd/mist/html_container.go b/cmd/mist/html_container.go index 35e351b02..4c6609a95 100644 --- a/cmd/mist/html_container.go +++ b/cmd/mist/html_container.go @@ -26,8 +26,7 @@ import ( "os" "path" "path/filepath" - - "github.com/ethereum/go-ethereum/chain" + "github.com/ethereum/go-ethereum/chain/types" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/javascript" "github.com/ethereum/go-ethereum/state" @@ -138,7 +137,7 @@ func (app *HtmlApplication) Window() *qml.Window { return app.win } -func (app *HtmlApplication) NewBlock(block *chain.Block) { +func (app *HtmlApplication) NewBlock(block *types.Block) { b := &xeth.JSBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())} app.webView.Call("onNewBlockCb", b) } diff --git a/cmd/mist/qml_container.go b/cmd/mist/qml_container.go index 60013ec2b..b5986c16e 100644 --- a/cmd/mist/qml_container.go +++ b/cmd/mist/qml_container.go @@ -20,8 +20,7 @@ package main import ( "fmt" "runtime" - - "github.com/ethereum/go-ethereum/chain" + "github.com/ethereum/go-ethereum/chain/types" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/xeth" @@ -65,7 +64,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) { } // Events -func (app *QmlApplication) NewBlock(block *chain.Block) { +func (app *QmlApplication) NewBlock(block *types.Block) { pblock := &xeth.JSBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())} app.win.Call("onNewBlockCb", pblock) } diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index 4e480144f..01352f192 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -26,6 +26,7 @@ import ( "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/chain" + "github.com/ethereum/go-ethereum/chain/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/javascript" @@ -126,7 +127,7 @@ func (self *UiLib) PastPeers() *ethutil.List { } func (self *UiLib) ImportTx(rlpTx string) { - tx := chain.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx)) + tx := types.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx)) self.eth.TxPool().QueueTransaction(tx) } @@ -228,7 +229,7 @@ func (self *UiLib) NewFilter(object map[string]interface{}) (id int) { func (self *UiLib) NewFilterString(typ string) (id int) { filter := chain.NewFilter(self.eth) - filter.BlockCallback = func(block *chain.Block) { + filter.BlockCallback = func(block *types.Block) { if self.win != nil && self.win.Root() != nil { self.win.Root().Call("invokeFilterCallback", "{}", id) } else { -- cgit v1.2.3 From a3559c5e1b469890bb8d71e9992175febaae31c7 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 28 Nov 2014 21:38:10 +0100 Subject: updated PV --- cmd/mist/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/main.go b/cmd/mist/main.go index bc05d4f3d..39beeafdb 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -31,7 +31,7 @@ import ( const ( ClientIdentifier = "Mist" - Version = "0.7.5" + Version = "0.7.6" ) var ethereum *eth.Ethereum -- cgit v1.2.3 From 6dc46d3341dc5fa25bd005f9606de258874139be Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 1 Dec 2014 20:18:09 +0100 Subject: Changed the way transactions are being added to the transaction pool --- cmd/mist/bindings.go | 5 ++--- cmd/mist/ui_lib.go | 8 ++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go index 480c38b2e..cd139c67f 100644 --- a/cmd/mist/bindings.go +++ b/cmd/mist/bindings.go @@ -26,7 +26,6 @@ import ( "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/xeth" ) type plugin struct { @@ -46,12 +45,12 @@ func (gui *Gui) LogPrint(level logger.LogLevel, msg string) { } */ } -func (gui *Gui) Transact(recipient, value, gas, gasPrice, d string) (*xeth.JSReceipt, error) { +func (gui *Gui) Transact(recipient, value, gas, gasPrice, d string) (string, error) { var data string if len(recipient) == 0 { code, err := ethutil.Compile(d, false) if err != nil { - return nil, err + return "", err } data = ethutil.Bytes2Hex(code) } else { diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index 4e480144f..15799eb6a 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -127,7 +127,11 @@ func (self *UiLib) PastPeers() *ethutil.List { func (self *UiLib) ImportTx(rlpTx string) { tx := chain.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx)) - self.eth.TxPool().QueueTransaction(tx) + //self.eth.TxPool().QueueTransaction(tx) + err := self.eth.TxPool().Add(tx) + if err != nil { + guilogger.Infoln("import tx failed ", err) + } } func (self *UiLib) EvalJavascriptFile(path string) { @@ -305,7 +309,7 @@ func mapToTxParams(object map[string]interface{}) map[string]string { return conv } -func (self *UiLib) Transact(params map[string]interface{}) (*xeth.JSReceipt, error) { +func (self *UiLib) Transact(params map[string]interface{}) (string, error) { object := mapToTxParams(params) return self.JSXEth.Transact( -- cgit v1.2.3 From 5ebae82eeb3f5ecdffb96f9d692523d0b0d4f759 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 2 Dec 2014 12:23:27 +0100 Subject: Additional logging and removed temp merged mining options. --- cmd/mist/assets/qml/views/miner.qml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/views/miner.qml b/cmd/mist/assets/qml/views/miner.qml index 2d59bb3a4..e0182649f 100644 --- a/cmd/mist/assets/qml/views/miner.qml +++ b/cmd/mist/assets/qml/views/miner.qml @@ -119,12 +119,14 @@ Rectangle { } } Component.onCompleted: { + /* // XXX Temp. replace with above eventually var tmpItems = ["JEVCoin", "Some coin", "Other coin", "Etc coin"]; var address = "e6716f9544a56c530d868e4bfbacb172315bdead"; for (var i = 0; i < tmpItems.length; i++) { mergedMiningModel.append({checked: false, name: tmpItems[i], address: address, id: 0, itemId: i}); } + */ } } } -- cgit v1.2.3 From edc52bdcbf65b396a838a347b370ea859ae58247 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 2 Dec 2014 22:23:20 +0100 Subject: Updated value for mined blocks. Closes #197 --- cmd/mist/assets/qml/views/wallet.qml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/views/wallet.qml b/cmd/mist/assets/qml/views/wallet.qml index a57e7869a..9ffb1024d 100644 --- a/cmd/mist/assets/qml/views/wallet.qml +++ b/cmd/mist/assets/qml/views/wallet.qml @@ -16,7 +16,13 @@ Rectangle { anchors.fill: parent function onReady() { - menuItem.secondaryTitle = eth.numberToHuman(eth.balanceAt(eth.key().address)) + setBalance() + } + + function setBalance() { + balance.text = "Balance: " + eth.numberToHuman(eth.balanceAt(eth.key().address)) + if(menuItem) + menuItem.secondaryTitle = eth.numberToHuman(eth.balanceAt(eth.key().address)) } ListModel { @@ -39,7 +45,6 @@ Rectangle { Text { id: balance - text: "Balance: " + eth.numberToHuman(eth.balanceAt(eth.key().address)) font.pixelSize: 24 anchors { horizontalCenter: parent.horizontalCenter @@ -126,7 +131,6 @@ Rectangle { var value = txValue.text + denomModel.get(valueDenom.currentIndex).zeros; var gasPrice = "10000000000000" var res = eth.transact({from: eth.key().privateKey, to: txTo.text, value: value, gas: "500", gasPrice: gasPrice}) - console.log(res) } } } @@ -158,6 +162,8 @@ Rectangle { } function addTxs(messages) { + setBalance() + for(var i = 0; i < messages.length; i++) { var message = messages.get(i); var to = eth.lookupName(message.to); -- cgit v1.2.3 From 3d9a4e7084c33cb28a2265c0dd232a0ea3871c92 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 3 Dec 2014 12:21:12 +0100 Subject: Fixed mem error in vm. Fixed logs tests --- cmd/mist/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 39beeafdb..8c46de6d9 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -31,7 +31,7 @@ import ( const ( ClientIdentifier = "Mist" - Version = "0.7.6" + Version = "0.7.7" ) var ethereum *eth.Ethereum -- cgit v1.2.3 From 6d99c03d915789c445c2d40579419a16fde2b7c8 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 3 Dec 2014 17:22:26 +0100 Subject: Updated environments according to the new interface set --- cmd/mist/debugger.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/debugger.go b/cmd/mist/debugger.go index a2aae6f0b..8331b5566 100644 --- a/cmd/mist/debugger.go +++ b/cmd/mist/debugger.go @@ -144,24 +144,28 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data statedb := self.lib.eth.BlockManager().TransState() account := self.lib.eth.BlockManager().TransState().GetAccount(keyPair.Address()) contract := statedb.NewStateObject([]byte{0}) + contract.SetCode(script) contract.SetBalance(value) self.SetAsm(script) block := self.lib.eth.ChainManager().CurrentBlock - callerClosure := vm.NewClosure(&state.Message{}, account, contract, script, gas, gasPrice) env := utils.NewEnv(statedb, block, account.Address(), value) - evm := vm.NewDebugVm(env) - evm.Dbg = self.Db + /* + callerClosure := vm.NewClosure(&state.Message{}, account, contract, script, gas, gasPrice) + evm := vm.NewDebugVm(env) + evm.Dbg = self.Db + self.vm = evm + self.Db.done = false + */ - self.vm = evm - self.Db.done = false self.Logf("callsize %d", len(script)) go func() { - ret, g, err := callerClosure.Call(evm, data) - tot := new(big.Int).Mul(g, gasPrice) - self.Logf("gas usage %v total price = %v (%v)", g, tot, ethutil.CurrencyToString(tot)) + ret, err := env.Call(account, contract.Address(), data, gas, gasPrice, ethutil.Big0) + //ret, g, err := callerClosure.Call(evm, data) + tot := new(big.Int).Mul(env.Gas, gasPrice) + self.Logf("gas usage %v total price = %v (%v)", env.Gas, tot, ethutil.CurrencyToString(tot)) if err != nil { self.Logln("exited with errors:", err) } else { -- cgit v1.2.3 From b6cb5272de96185b424d5c6c4a817d99f536d29b Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 3 Dec 2014 17:35:57 +0100 Subject: Descriptive function names for closure getters --- cmd/mist/debugger.go | 7 ------- 1 file changed, 7 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/debugger.go b/cmd/mist/debugger.go index 8331b5566..407c9353a 100644 --- a/cmd/mist/debugger.go +++ b/cmd/mist/debugger.go @@ -152,13 +152,6 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data block := self.lib.eth.ChainManager().CurrentBlock env := utils.NewEnv(statedb, block, account.Address(), value) - /* - callerClosure := vm.NewClosure(&state.Message{}, account, contract, script, gas, gasPrice) - evm := vm.NewDebugVm(env) - evm.Dbg = self.Db - self.vm = evm - self.Db.done = false - */ self.Logf("callsize %d", len(script)) go func() { -- cgit v1.2.3 From 9008b155d3c8d2a32c4c8945f1174243d48d4e90 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 4 Dec 2014 10:28:02 +0100 Subject: Renamed `chain` => `core` --- cmd/mist/bindings.go | 3 ++- cmd/mist/debugger.go | 4 ++-- cmd/mist/ext_app.go | 14 +++++++------- cmd/mist/gui.go | 16 ++++++++-------- cmd/mist/html_container.go | 3 ++- cmd/mist/qml_container.go | 3 ++- cmd/mist/ui_lib.go | 6 +++--- 7 files changed, 26 insertions(+), 23 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go index a605cb03a..6dbcc3f1d 100644 --- a/cmd/mist/bindings.go +++ b/cmd/mist/bindings.go @@ -21,8 +21,9 @@ import ( "encoding/json" "os" "strconv" - "github.com/ethereum/go-ethereum/chain/types" + "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" ) diff --git a/cmd/mist/debugger.go b/cmd/mist/debugger.go index 407c9353a..06ff6b8cc 100644 --- a/cmd/mist/debugger.go +++ b/cmd/mist/debugger.go @@ -24,8 +24,8 @@ import ( "strings" "unicode" - "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/vm" @@ -81,7 +81,7 @@ func (self *DebuggerWindow) SetData(data string) { func (self *DebuggerWindow) SetAsm(data []byte) { self.win.Root().Call("clearAsm") - dis := chain.Disassemble(data) + dis := core.Disassemble(data) for _, str := range dis { self.win.Root().Call("setAsm", str) } diff --git a/cmd/mist/ext_app.go b/cmd/mist/ext_app.go index 22fa4bfaf..33c420a7a 100644 --- a/cmd/mist/ext_app.go +++ b/cmd/mist/ext_app.go @@ -20,8 +20,8 @@ package main import ( "encoding/json" - "github.com/ethereum/go-ethereum/chain" - "github.com/ethereum/go-ethereum/chain/types" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/javascript" "github.com/ethereum/go-ethereum/state" @@ -45,12 +45,12 @@ type AppContainer interface { type ExtApplication struct { *xeth.JSXEth - eth chain.EthManager + eth core.EthManager events event.Subscription watcherQuitChan chan bool - filters map[string]*chain.Filter + filters map[string]*core.Filter container AppContainer lib *UiLib @@ -61,7 +61,7 @@ func NewExtApplication(container AppContainer, lib *UiLib) *ExtApplication { JSXEth: xeth.NewJSXEth(lib.eth), eth: lib.eth, watcherQuitChan: make(chan bool), - filters: make(map[string]*chain.Filter), + filters: make(map[string]*core.Filter), container: container, lib: lib, } @@ -81,7 +81,7 @@ func (app *ExtApplication) run() { // Subscribe to events mux := app.lib.eth.EventMux() - app.events = mux.Subscribe(chain.NewBlockEvent{}, state.Messages(nil)) + app.events = mux.Subscribe(core.NewBlockEvent{}, state.Messages(nil)) // Call the main loop go app.mainLoop() @@ -107,7 +107,7 @@ func (app *ExtApplication) stop() { func (app *ExtApplication) mainLoop() { for ev := range app.events.Chan() { switch ev := ev.(type) { - case chain.NewBlockEvent: + case core.NewBlockEvent: app.container.NewBlock(ev.Block) case state.Messages: diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 61b66cce3..e58e349d1 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -31,8 +31,8 @@ import ( "time" "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/chain" - "github.com/ethereum/go-ethereum/chain/types" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" @@ -413,9 +413,9 @@ func (gui *Gui) update() { events := gui.eth.EventMux().Subscribe( eth.ChainSyncEvent{}, eth.PeerListEvent{}, - chain.NewBlockEvent{}, - chain.TxPreEvent{}, - chain.TxPostEvent{}, + core.NewBlockEvent{}, + core.TxPreEvent{}, + core.TxPostEvent{}, ) // nameReg := gui.pipe.World().Config().Get("NameReg") @@ -430,13 +430,13 @@ func (gui *Gui) update() { return } switch ev := ev.(type) { - case chain.NewBlockEvent: + case core.NewBlockEvent: gui.processBlock(ev.Block, false) if bytes.Compare(ev.Block.Coinbase, gui.address()) == 0 { gui.setWalletValue(gui.eth.BlockManager().CurrentState().GetAccount(gui.address()).Balance(), nil) } - case chain.TxPreEvent: + case core.TxPreEvent: tx := ev.Tx object := state.GetAccount(gui.address()) @@ -449,7 +449,7 @@ func (gui *Gui) update() { gui.setWalletValue(object.Balance(), unconfirmedFunds) gui.insertTransaction("pre", tx) - case chain.TxPostEvent: + case core.TxPostEvent: tx := ev.Tx object := state.GetAccount(gui.address()) diff --git a/cmd/mist/html_container.go b/cmd/mist/html_container.go index 4c6609a95..b3fc219fa 100644 --- a/cmd/mist/html_container.go +++ b/cmd/mist/html_container.go @@ -26,7 +26,8 @@ import ( "os" "path" "path/filepath" - "github.com/ethereum/go-ethereum/chain/types" + + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/javascript" "github.com/ethereum/go-ethereum/state" diff --git a/cmd/mist/qml_container.go b/cmd/mist/qml_container.go index b5986c16e..a0a46f9b1 100644 --- a/cmd/mist/qml_container.go +++ b/cmd/mist/qml_container.go @@ -20,7 +20,8 @@ package main import ( "fmt" "runtime" - "github.com/ethereum/go-ethereum/chain/types" + + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/xeth" diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index a0786cf2f..2b5e56646 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -25,8 +25,8 @@ import ( "strings" "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/chain" - "github.com/ethereum/go-ethereum/chain/types" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/javascript" @@ -231,7 +231,7 @@ func (self *UiLib) NewFilter(object map[string]interface{}) (id int) { } func (self *UiLib) NewFilterString(typ string) (id int) { - filter := chain.NewFilter(self.eth) + filter := core.NewFilter(self.eth) filter.BlockCallback = func(block *types.Block) { if self.win != nil && self.win.Root() != nil { self.win.Root().Call("invokeFilterCallback", "{}", id) -- cgit v1.2.3 From f298ffdbb8ec2b14f254e880a65f22f4d7c66305 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 4 Dec 2014 11:40:20 +0100 Subject: Renamed State => StateDB --- cmd/mist/debugger.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/debugger.go b/cmd/mist/debugger.go index 06ff6b8cc..ca3ff5af2 100644 --- a/cmd/mist/debugger.go +++ b/cmd/mist/debugger.go @@ -40,7 +40,7 @@ type DebuggerWindow struct { vm *vm.DebugVm Db *Debugger - state *state.State + state *state.StateDB } func NewDebuggerWindow(lib *UiLib) *DebuggerWindow { -- cgit v1.2.3 From 73c4ca3a6fcf948f4bc637f5c1b55277cf64c06f Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 4 Dec 2014 15:31:48 +0100 Subject: Upped protocol version --- cmd/mist/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 8c46de6d9..5503097f2 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -31,7 +31,7 @@ import ( const ( ClientIdentifier = "Mist" - Version = "0.7.7" + Version = "0.7.8" ) var ethereum *eth.Ethereum -- cgit v1.2.3 From a5b27bbc10d6a145152fc2629043c46ef4a9ca71 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 4 Dec 2014 16:44:43 +0100 Subject: Improved and simplified wallet functions and behaviour --- cmd/mist/assets/qml/views/wallet.qml | 19 ++++++++++++++----- cmd/mist/gui.go | 29 +++++++---------------------- 2 files changed, 21 insertions(+), 27 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/views/wallet.qml b/cmd/mist/assets/qml/views/wallet.qml index 9ffb1024d..ad7a11047 100644 --- a/cmd/mist/assets/qml/views/wallet.qml +++ b/cmd/mist/assets/qml/views/wallet.qml @@ -155,10 +155,14 @@ Rectangle { model: ListModel { id: txModel Component.onCompleted: { - var filter = ethx.watch({latest: -1, from: eth.key().address}); - filter.changed(addTxs) - - addTxs(filter.messages()) + var me = eth.key().address; + var filterTo = ethx.watch({latest: -1, to: me}); + var filterFrom = ethx.watch({latest: -1, from: me}); + filterTo.changed(addTxs) + filterFrom.changed(addTxs) + + addTxs(filterTo.messages()) + addTxs(filterFrom.messages()) } function addTxs(messages) { @@ -167,7 +171,12 @@ Rectangle { for(var i = 0; i < messages.length; i++) { var message = messages.get(i); var to = eth.lookupName(message.to); - var from = eth.lookupName(message.from); + var from; + if(message.from.length == 0) { + from = "- MINED -"; + } else { + from = eth.lookupName(message.from); + } txModel.insert(0, {num: txModel.count, from: from, to: to, value: eth.numberToHuman(message.value)}) } } diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index e58e349d1..6a28b48f9 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -404,7 +404,6 @@ func (gui *Gui) update() { state := gui.eth.BlockManager().TransState() - unconfirmedFunds := new(big.Int) gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Balance()))) lastBlockLabel := gui.getObjectByName("lastBlockLabel") @@ -438,15 +437,15 @@ func (gui *Gui) update() { case core.TxPreEvent: tx := ev.Tx - object := state.GetAccount(gui.address()) - if bytes.Compare(tx.Sender(), gui.address()) == 0 { - unconfirmedFunds.Sub(unconfirmedFunds, tx.Value) - } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { - unconfirmedFunds.Add(unconfirmedFunds, tx.Value) - } + tstate := gui.eth.BlockManager().TransState() + cstate := gui.eth.BlockManager().CurrentState() - gui.setWalletValue(object.Balance(), unconfirmedFunds) + taccount := tstate.GetAccount(gui.address()) + caccount := cstate.GetAccount(gui.address()) + unconfirmedFunds := new(big.Int).Sub(taccount.Balance(), caccount.Balance()) + + gui.setWalletValue(taccount.Balance(), unconfirmedFunds) gui.insertTransaction("pre", tx) case core.TxPostEvent: @@ -456,32 +455,18 @@ func (gui *Gui) update() { if bytes.Compare(tx.Sender(), gui.address()) == 0 { object.SubAmount(tx.Value) - //gui.getObjectByName("transactionView").Call("addTx", xeth.NewJSTx(tx), "send") gui.txDb.Put(tx.Hash(), tx.RlpEncode()) } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { object.AddAmount(tx.Value) - //gui.getObjectByName("transactionView").Call("addTx", xeth.NewJSTx(tx), "recv") gui.txDb.Put(tx.Hash(), tx.RlpEncode()) } gui.setWalletValue(object.Balance(), nil) state.UpdateStateObject(object) - // case object: - // gui.loadAddressBook() - case eth.PeerListEvent: gui.setPeerInfo() - - /* - case miner.Event: - if ev.Type == miner.Started { - gui.miner = ev.Miner - } else { - gui.miner = nil - } - */ } case <-peerUpdateTicker.C: -- cgit v1.2.3 From 085f604b27c8b3fbd82f2aa9d02a4251df0d5db5 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 4 Dec 2014 17:09:47 +0100 Subject: Show newly created private key during startup. Closes #126 --- cmd/mist/assets/qml/views/wallet.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/views/wallet.qml b/cmd/mist/assets/qml/views/wallet.qml index ad7a11047..9727ef35c 100644 --- a/cmd/mist/assets/qml/views/wallet.qml +++ b/cmd/mist/assets/qml/views/wallet.qml @@ -148,8 +148,8 @@ Rectangle { id: txTableView anchors.fill : parent TableViewColumn{ role: "num" ; title: "#" ; width: 30 } - TableViewColumn{ role: "from" ; title: "From" ; width: 280 } - TableViewColumn{ role: "to" ; title: "To" ; width: 280 } + TableViewColumn{ role: "from" ; title: "From" ; width: 340 } + TableViewColumn{ role: "to" ; title: "To" ; width: 340 } TableViewColumn{ role: "value" ; title: "Amount" ; width: 100 } model: ListModel { -- cgit v1.2.3 From 9925916851c00323336e213fc18c83da5fceee94 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 5 Dec 2014 16:26:39 +0100 Subject: upped proto version and modified block pool --- cmd/mist/gui.go | 4 ---- cmd/mist/main.go | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 6a28b48f9..0b03cdc1b 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -389,7 +389,6 @@ func (gui *Gui) update() { gui.loadAddressBook() gui.loadMergedMiningOptions() gui.setPeerInfo() - //gui.readPreviousTransactions() }() for _, plugin := range gui.plugins { @@ -417,9 +416,6 @@ func (gui *Gui) update() { core.TxPostEvent{}, ) - // nameReg := gui.pipe.World().Config().Get("NameReg") - // mux.Subscribe("object:"+string(nameReg.Address()), objectChan) - go func() { defer events.Unsubscribe() for { diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 5503097f2..14336b4e8 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -31,7 +31,7 @@ import ( const ( ClientIdentifier = "Mist" - Version = "0.7.8" + Version = "0.7.9" ) var ethereum *eth.Ethereum -- cgit v1.2.3 From 5553e5aaed5c3f4e303b7d6671d2c92a45aa487e Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 10 Dec 2014 19:59:12 +0100 Subject: states moved to chain --- cmd/mist/bindings.go | 2 +- cmd/mist/debugger.go | 4 ++-- cmd/mist/gui.go | 8 ++++---- cmd/mist/ui_lib.go | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go index 6dbcc3f1d..6d2342c87 100644 --- a/cmd/mist/bindings.go +++ b/cmd/mist/bindings.go @@ -103,7 +103,7 @@ func (self *Gui) DumpState(hash, path string) { var stateDump []byte if len(hash) == 0 { - stateDump = self.eth.BlockManager().CurrentState().Dump() + stateDump = self.eth.ChainManager().State().Dump() } else { var block *types.Block if hash[0] == '#' { diff --git a/cmd/mist/debugger.go b/cmd/mist/debugger.go index ca3ff5af2..d7c584eab 100644 --- a/cmd/mist/debugger.go +++ b/cmd/mist/debugger.go @@ -141,8 +141,8 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data keyPair = self.lib.eth.KeyManager().KeyPair() ) - statedb := self.lib.eth.BlockManager().TransState() - account := self.lib.eth.BlockManager().TransState().GetAccount(keyPair.Address()) + statedb := self.lib.eth.ChainManager().TransState() + account := self.lib.eth.ChainManager().TransState().GetAccount(keyPair.Address()) contract := statedb.NewStateObject([]byte{0}) contract.SetCode(script) contract.SetBalance(value) diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 0b03cdc1b..fe066e994 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -401,7 +401,7 @@ func (gui *Gui) update() { generalUpdateTicker := time.NewTicker(500 * time.Millisecond) statsUpdateTicker := time.NewTicker(5 * time.Second) - state := gui.eth.BlockManager().TransState() + state := gui.eth.ChainManager().TransState() gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Balance()))) @@ -428,14 +428,14 @@ func (gui *Gui) update() { case core.NewBlockEvent: gui.processBlock(ev.Block, false) if bytes.Compare(ev.Block.Coinbase, gui.address()) == 0 { - gui.setWalletValue(gui.eth.BlockManager().CurrentState().GetAccount(gui.address()).Balance(), nil) + gui.setWalletValue(gui.eth.ChainManager().State().GetBalance(gui.address()), nil) } case core.TxPreEvent: tx := ev.Tx - tstate := gui.eth.BlockManager().TransState() - cstate := gui.eth.BlockManager().CurrentState() + tstate := gui.eth.ChainManager().TransState() + cstate := gui.eth.ChainManager().State() taccount := tstate.GetAccount(gui.address()) caccount := cstate.GetAccount(gui.address()) diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index 2b5e56646..fdbde50fd 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -200,7 +200,7 @@ func (ui *UiLib) AssetPath(p string) string { func (self *UiLib) StartDbWithContractAndData(contractHash, data string) { dbWindow := NewDebuggerWindow(self) - object := self.eth.BlockManager().CurrentState().GetStateObject(ethutil.Hex2Bytes(contractHash)) + object := self.eth.ChainManager().State().GetStateObject(ethutil.Hex2Bytes(contractHash)) if len(object.Code) > 0 { dbWindow.SetCode("0x" + ethutil.Bytes2Hex(object.Code)) } -- cgit v1.2.3 From 2d09e67713757e2a80eb614562c97f962af36cf7 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 13:17:24 +0100 Subject: Updated to new methods --- cmd/mist/debugger.go | 2 +- cmd/mist/gui.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/debugger.go b/cmd/mist/debugger.go index d7c584eab..a7a286e23 100644 --- a/cmd/mist/debugger.go +++ b/cmd/mist/debugger.go @@ -149,7 +149,7 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data self.SetAsm(script) - block := self.lib.eth.ChainManager().CurrentBlock + block := self.lib.eth.ChainManager().CurrentBlock() env := utils.NewEnv(statedb, block, account.Address(), value) diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index fe066e994..773688ffc 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -246,7 +246,7 @@ func (gui *Gui) CreateAndSetPrivKey() (string, string, string, string) { } func (gui *Gui) setInitialChain(ancientBlocks bool) { - sBlk := gui.eth.ChainManager().LastBlockHash + sBlk := gui.eth.ChainManager().LastBlockHash() blk := gui.eth.ChainManager().GetBlock(sBlk) for ; blk != nil; blk = gui.eth.ChainManager().GetBlock(sBlk) { sBlk = blk.PrevHash @@ -468,7 +468,7 @@ func (gui *Gui) update() { case <-peerUpdateTicker.C: gui.setPeerInfo() case <-generalUpdateTicker.C: - statusText := "#" + gui.eth.ChainManager().CurrentBlock.Number.String() + statusText := "#" + gui.eth.ChainManager().CurrentBlock().Number.String() lastBlockLabel.Set("text", statusText) miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.miner.GetPow().GetHashrate(), 10)+"Khash") -- cgit v1.2.3 From db494170dc819b1eb0d267b6e1ab36c6cfb63569 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 15:18:13 +0100 Subject: Created generic message (easy for testing) --- cmd/mist/gui.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 773688ffc..46f264f35 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -305,13 +305,13 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { var ( ptx = xeth.NewJSTx(tx, pipe.World().State()) - send = nameReg.Storage(tx.Sender()) - rec = nameReg.Storage(tx.Recipient) + send = nameReg.Storage(tx.From()) + rec = nameReg.Storage(tx.To()) s, r string ) if tx.CreatesContract() { - rec = nameReg.Storage(tx.CreationAddress(pipe.World().State())) + rec = nameReg.Storage(core.AddressFromMessage(tx)) } if send.Len() != 0 { @@ -323,9 +323,9 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { r = strings.Trim(rec.Str(), "\x00") } else { if tx.CreatesContract() { - r = ethutil.Bytes2Hex(tx.CreationAddress(pipe.World().State())) + r = ethutil.Bytes2Hex(core.AddressFromMessage(tx)) } else { - r = ethutil.Bytes2Hex(tx.Recipient) + r = ethutil.Bytes2Hex(tx.To()) } } ptx.Sender = s @@ -449,11 +449,11 @@ func (gui *Gui) update() { object := state.GetAccount(gui.address()) if bytes.Compare(tx.Sender(), gui.address()) == 0 { - object.SubAmount(tx.Value) + object.SubAmount(tx.Value()) gui.txDb.Put(tx.Hash(), tx.RlpEncode()) - } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { - object.AddAmount(tx.Value) + } else if bytes.Compare(tx.To(), gui.address()) == 0 { + object.AddAmount(tx.Value()) gui.txDb.Put(tx.Hash(), tx.RlpEncode()) } -- cgit v1.2.3 From 5ad473d7581b92811c3a3e035274a82fc5568f57 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 15:33:22 +0100 Subject: Moved methods to messages --- cmd/mist/gui.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 46f264f35..7775889cc 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -310,7 +310,7 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { s, r string ) - if tx.CreatesContract() { + if core.MessageCreatesContract(tx) { rec = nameReg.Storage(core.AddressFromMessage(tx)) } @@ -322,7 +322,7 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { if rec.Len() != 0 { r = strings.Trim(rec.Str(), "\x00") } else { - if tx.CreatesContract() { + if core.MessageCreatesContract(tx) { r = ethutil.Bytes2Hex(core.AddressFromMessage(tx)) } else { r = ethutil.Bytes2Hex(tx.To()) -- cgit v1.2.3 From 88af879f7ae55249ff7a9669184b52a611e4fb20 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 19 Dec 2014 01:18:22 +0100 Subject: version bump --- cmd/mist/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 14336b4e8..eaf0af0c7 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -31,7 +31,7 @@ import ( const ( ClientIdentifier = "Mist" - Version = "0.7.9" + Version = "0.7.10" ) var ethereum *eth.Ethereum -- cgit v1.2.3 From 5da5db5a0a149235c742748aa4b3b94d13d6910f Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 19 Dec 2014 13:34:21 +0100 Subject: Added authors --- cmd/mist/assets/qml/main.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 9f1f214a6..a08a8b4ef 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -786,8 +786,8 @@ ApplicationWindow { title: "About" minimumWidth: 350 maximumWidth: 350 - maximumHeight: 200 - minimumHeight: 200 + maximumHeight: 280 + minimumHeight: 280 Image { id: aboutIcon @@ -797,7 +797,7 @@ ApplicationWindow { smooth: true source: "../facet.png" x: 10 - y: 10 + y: 30 } Text { @@ -806,7 +806,7 @@ ApplicationWindow { anchors.top: parent.top anchors.topMargin: 30 font.pointSize: 12 - text: "

Mist (0.6.5)

Amalthea


Development

Jeffrey Wilcke
Viktor Trón

Building

Maran Hidskes" + text: "

Mist (0.7.10)


Development

Jeffrey Wilcke
Viktor Trón
Felix Lange
Taylor Gerring
Daniel Nagy

UX

Alex van de Sande
" } } -- cgit v1.2.3 From 0a9dc1536c5d776844d6947a0090ff7e1a7c6ab4 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sat, 20 Dec 2014 02:33:45 +0100 Subject: Increased peer from 10 to 30 --- cmd/mist/flags.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/flags.go b/cmd/mist/flags.go index 2ae0a0487..e49408181 100644 --- a/cmd/mist/flags.go +++ b/cmd/mist/flags.go @@ -104,7 +104,7 @@ func Init() { flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file (db)") flag.StringVar(&OutboundPort, "port", "30303", "listening port") flag.BoolVar(&UseUPnP, "upnp", true, "enable UPnP support") - flag.IntVar(&MaxPeer, "maxpeer", 10, "maximum desired peers") + flag.IntVar(&MaxPeer, "maxpeer", 30, "maximum desired peers") flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on") flag.BoolVar(&StartRpc, "rpc", false, "start rpc server") flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server") -- cgit v1.2.3