From c4f9151c67b1481490978a9dca0599b3e92680d5 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 2 Jul 2014 00:13:50 +0200 Subject: [PATCH 1/4] Moved files --- ethereal/Makefile | 22 -------------------- ethereal/{ui => }/debugger.go | 2 +- ethereal/{ui => }/ext_app.go | 2 +- ethereal/{ui => }/gui.go | 4 ++-- ethereal/{ui => }/html_container.go | 2 +- ethereal/main.go | 3 +-- ethereal/{ui/qml_app.go => qml_container.go} | 2 +- ethereal/{ui => }/ui_lib.go | 2 +- 8 files changed, 8 insertions(+), 31 deletions(-) delete mode 100644 ethereal/Makefile rename ethereal/{ui => }/debugger.go (99%) rename ethereal/{ui => }/ext_app.go (99%) rename ethereal/{ui => }/gui.go (99%) rename ethereal/{ui => }/html_container.go (99%) rename ethereal/{ui/qml_app.go => qml_container.go} (99%) rename ethereal/{ui => }/ui_lib.go (99%) diff --git a/ethereal/Makefile b/ethereal/Makefile deleted file mode 100644 index 1acf03049..000000000 --- a/ethereal/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -UNAME = $(shell uname) -FILES=qml *.png -GOPATH=$(PWD) - - -# Default is building -all: - go get -d - cp *.go $(GOPATH)/src/github.com/ethereum/go-ethereum - cp -r ui $(GOPATH)/src/github.com/ethereum/go-ethereum - go build - -install: -# Linux build -ifeq ($(UNAME),Linux) - cp -r assets/* /usr/share/ethereal - cp go-ethereum /usr/local/bin/ethereal -endif -# OS X build -ifeq ($(UNAME),Darwin) - # Execute py script -endif diff --git a/ethereal/ui/debugger.go b/ethereal/debugger.go similarity index 99% rename from ethereal/ui/debugger.go rename to ethereal/debugger.go index 5ad1b4a2c..416155835 100644 --- a/ethereal/ui/debugger.go +++ b/ethereal/debugger.go @@ -1,4 +1,4 @@ -package ethui +package main import ( "fmt" diff --git a/ethereal/ui/ext_app.go b/ethereal/ext_app.go similarity index 99% rename from ethereal/ui/ext_app.go rename to ethereal/ext_app.go index 0230c46ab..17c342a1b 100644 --- a/ethereal/ui/ext_app.go +++ b/ethereal/ext_app.go @@ -1,4 +1,4 @@ -package ethui +package main import ( "fmt" diff --git a/ethereal/ui/gui.go b/ethereal/gui.go similarity index 99% rename from ethereal/ui/gui.go rename to ethereal/gui.go index 91351aced..1e6fac4de 100644 --- a/ethereal/ui/gui.go +++ b/ethereal/gui.go @@ -1,4 +1,4 @@ -package ethui +package main import ( "bytes" @@ -40,7 +40,7 @@ type Gui struct { } // Create GUI, but doesn't start it -func New(ethereum *eth.Ethereum, session string, logLevel int) *Gui { +func NewWindow(ethereum *eth.Ethereum, session string, logLevel int) *Gui { db, err := ethdb.NewLDBDatabase("tx_database") if err != nil { diff --git a/ethereal/ui/html_container.go b/ethereal/html_container.go similarity index 99% rename from ethereal/ui/html_container.go rename to ethereal/html_container.go index f2ebd840c..1e835eebc 100644 --- a/ethereal/ui/html_container.go +++ b/ethereal/html_container.go @@ -1,4 +1,4 @@ -package ethui +package main import ( "errors" diff --git a/ethereal/main.go b/ethereal/main.go index 82427f088..f3f1d3140 100644 --- a/ethereal/main.go +++ b/ethereal/main.go @@ -2,7 +2,6 @@ package main import ( "github.com/ethereum/eth-go/ethlog" - "github.com/ethereum/go-ethereum/ethereal/ui" "github.com/ethereum/go-ethereum/utils" "github.com/go-qml/qml" "os" @@ -47,7 +46,7 @@ func main() { utils.StartRpc(ethereum, RpcPort) } - gui := ethui.New(ethereum, KeyRing, LogLevel) + gui := NewWindow(ethereum, KeyRing, LogLevel) utils.RegisterInterrupt(func(os.Signal) { gui.Stop() diff --git a/ethereal/ui/qml_app.go b/ethereal/qml_container.go similarity index 99% rename from ethereal/ui/qml_app.go rename to ethereal/qml_container.go index d23fdd110..a8ce1cb75 100644 --- a/ethereal/ui/qml_app.go +++ b/ethereal/qml_container.go @@ -1,4 +1,4 @@ -package ethui +package main import ( "github.com/ethereum/eth-go/ethchain" diff --git a/ethereal/ui/ui_lib.go b/ethereal/ui_lib.go similarity index 99% rename from ethereal/ui/ui_lib.go rename to ethereal/ui_lib.go index 892c1f065..997a3391a 100644 --- a/ethereal/ui/ui_lib.go +++ b/ethereal/ui_lib.go @@ -1,4 +1,4 @@ -package ethui +package main import ( "github.com/ethereum/eth-go" From 677de48f6cd849fde7f8a4733bbab4b992471a13 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 2 Jul 2014 00:28:45 +0200 Subject: [PATCH 2/4] Listen for namereg changes --- ethereal/gui.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ethereal/gui.go b/ethereal/gui.go index 1e6fac4de..ea91622c6 100644 --- a/ethereal/gui.go +++ b/ethereal/gui.go @@ -41,7 +41,6 @@ type Gui struct { // Create GUI, but doesn't start it func NewWindow(ethereum *eth.Ethereum, session string, logLevel int) *Gui { - db, err := ethdb.NewLDBDatabase("tx_database") if err != nil { panic(err) @@ -273,7 +272,11 @@ func (gui *Gui) update() { reactor.Subscribe("newBlock", blockChan) reactor.Subscribe("newTx:pre", txChan) reactor.Subscribe("newTx:post", txChan) - //reactor.Subscribe("object:"+string(namereg), objectChan) + + nameReg := ethpub.EthereumConfig(gui.eth.StateManager()).NameReg() + if nameReg != nil { + reactor.Subscribe("object:"+string(nameReg.Address()), objectChan) + } reactor.Subscribe("peerList", peerChan) ticker := time.NewTicker(5 * time.Second) From e5b45d1c86d51a61f666b8a80af78c790c57ba13 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 2 Jul 2014 01:04:32 +0200 Subject: [PATCH 3/4] VM Update --- ethereal/debugger.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ethereal/debugger.go b/ethereal/debugger.go index 416155835..763b26063 100644 --- a/ethereal/debugger.go +++ b/ethereal/debugger.go @@ -124,11 +124,12 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data Value: ethutil.Big(valueStr), }) vm.Verbose = true + vm.Hook = self.Db.halting self.Db.done = false self.Logf("callsize %d", len(script)) go func() { - ret, g, err := callerClosure.Call(vm, data, self.Db.halting) + ret, g, err := callerClosure.Call(vm, data) tot := new(big.Int).Mul(g, gasPrice) self.Logf("gas usage %v total price = %v (%v)", g, tot, ethutil.CurrencyToString(tot)) if err != nil { From 7d0004f058d7e93df684b0524fd52cd2eb1af3e3 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 2 Jul 2014 11:29:59 +0200 Subject: [PATCH 4/4] For namreg only show items starting without leading zeros. --- ethereal/gui.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ethereal/gui.go b/ethereal/gui.go index ea91622c6..1719d41b2 100644 --- a/ethereal/gui.go +++ b/ethereal/gui.go @@ -216,7 +216,9 @@ func (gui *Gui) loadAddressBook() { nameReg := ethpub.EthereumConfig(gui.eth.StateManager()).NameReg() if nameReg != nil { nameReg.State().EachStorage(func(name string, value *ethutil.Value) { - gui.win.Root().Call("addAddress", struct{ Name, Address string }{name, ethutil.Bytes2Hex(value.Bytes())}) + if name[0] != 0 { + gui.win.Root().Call("addAddress", struct{ Name, Address string }{name, ethutil.Bytes2Hex(value.Bytes())}) + } }) } }