diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2014-12-22 01:42:32 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2014-12-22 01:42:32 +0800 |
commit | 1360f027d9e365242466ca346b2b56f421729d91 (patch) | |
tree | a30ff7292e87583781b682b47d851d0f6e1925fc /cmd | |
parent | b3629c6f62bd3774eb8858819a8ee07dfb775b73 (diff) | |
parent | 795b14330ad4399ef292835eac452d258dcd7464 (diff) | |
download | go-tangerine-1360f027d9e365242466ca346b2b56f421729d91.tar go-tangerine-1360f027d9e365242466ca346b2b56f421729d91.tar.gz go-tangerine-1360f027d9e365242466ca346b2b56f421729d91.tar.bz2 go-tangerine-1360f027d9e365242466ca346b2b56f421729d91.tar.lz go-tangerine-1360f027d9e365242466ca346b2b56f421729d91.tar.xz go-tangerine-1360f027d9e365242466ca346b2b56f421729d91.tar.zst go-tangerine-1360f027d9e365242466ca346b2b56f421729d91.zip |
Merge pull request #216 from ethereum/develop
Update tests branch from develop
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/ethereum/flags.go | 2 | ||||
-rw-r--r-- | cmd/ethereum/main.go | 4 | ||||
-rw-r--r-- | cmd/evm/main.go | 6 | ||||
-rw-r--r-- | cmd/mist/assets/qml/main.qml | 8 | ||||
-rw-r--r-- | cmd/mist/assets/qml/views/wallet.qml | 23 | ||||
-rw-r--r-- | cmd/mist/bindings.go | 2 | ||||
-rw-r--r-- | cmd/mist/debugger.go | 6 | ||||
-rw-r--r-- | cmd/mist/flags.go | 2 | ||||
-rw-r--r-- | cmd/mist/gui.go | 61 | ||||
-rw-r--r-- | cmd/mist/main.go | 2 | ||||
-rw-r--r-- | cmd/mist/ui_lib.go | 2 | ||||
-rw-r--r-- | cmd/peerserver/main.go | 40 | ||||
-rw-r--r-- | cmd/utils/cmd.go | 2 | ||||
-rw-r--r-- | cmd/utils/vm_env.go | 4 |
14 files changed, 95 insertions, 69 deletions
diff --git a/cmd/ethereum/flags.go b/cmd/ethereum/flags.go index 783944cf2..85aca47c3 100644 --- a/cmd/ethereum/flags.go +++ b/cmd/ethereum/flags.go @@ -85,7 +85,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", false, "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") diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index c39f904fb..2a3c46054 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -30,7 +30,7 @@ import ( const ( ClientIdentifier = "Ethereum(G)" - Version = "0.7.7" + Version = "0.7.10" ) var clilogger = logger.NewLogger("CLI") @@ -77,7 +77,7 @@ func main() { var block *types.Block if len(DumpHash) == 0 && DumpNumber == -1 { - block = ethereum.ChainManager().CurrentBlock + block = ethereum.ChainManager().CurrentBlock() } else if len(DumpHash) > 0 { block = ethereum.ChainManager().GetBlock(ethutil.Hex2Bytes(DumpHash)) } else { diff --git a/cmd/evm/main.go b/cmd/evm/main.go index 1e6c807b1..2bdfdfa9f 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -133,7 +133,7 @@ func (self *VMEnv) Value() *big.Int { return self.value } func (self *VMEnv) GasLimit() *big.Int { return big.NewInt(1000000000) } func (self *VMEnv) Depth() int { return 0 } func (self *VMEnv) SetDepth(i int) { self.depth = i } -func (self *VMEnv) AddLog(log *state.Log) { +func (self *VMEnv) AddLog(log state.Log) { self.state.AddLog(log) } func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error { @@ -141,9 +141,7 @@ func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error { } func (self *VMEnv) vm(addr, data []byte, gas, price, value *big.Int) *core.Execution { - evm := vm.New(self, vm.DebugVmTy) - - return core.NewExecution(evm, addr, data, gas, price, value) + return core.NewExecution(self, addr, data, gas, price, value) } func (self *VMEnv) Call(caller vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) { 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: "<h2>Mist (0.6.5)</h2><h4>Amalthea</h4><br><h3>Development</h3>Jeffrey Wilcke<br>Viktor Trón<br><h3>Building</h3>Maran Hidskes" + text: "<h2>Mist (0.7.10)</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Viktor Trón<br>Felix Lange<br>Taylor Gerring<br>Daniel Nagy<br><h3>UX</h3>Alex van de Sande<br>" } } diff --git a/cmd/mist/assets/qml/views/wallet.qml b/cmd/mist/assets/qml/views/wallet.qml index 9ffb1024d..9727ef35c 100644 --- a/cmd/mist/assets/qml/views/wallet.qml +++ b/cmd/mist/assets/qml/views/wallet.qml @@ -148,17 +148,21 @@ 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 { 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/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..a7a286e23 100644 --- a/cmd/mist/debugger.go +++ b/cmd/mist/debugger.go @@ -141,15 +141,15 @@ 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) 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/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") diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index e58e349d1..7775889cc 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 @@ -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())) + if core.MessageCreatesContract(tx) { + rec = nameReg.Storage(core.AddressFromMessage(tx)) } if send.Len() != 0 { @@ -322,10 +322,10 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { if rec.Len() != 0 { r = strings.Trim(rec.Str(), "\x00") } else { - if tx.CreatesContract() { - r = ethutil.Bytes2Hex(tx.CreationAddress(pipe.World().State())) + if core.MessageCreatesContract(tx) { + r = ethutil.Bytes2Hex(core.AddressFromMessage(tx)) } else { - r = ethutil.Bytes2Hex(tx.Recipient) + r = ethutil.Bytes2Hex(tx.To()) } } ptx.Sender = s @@ -389,7 +389,6 @@ func (gui *Gui) update() { gui.loadAddressBook() gui.loadMergedMiningOptions() gui.setPeerInfo() - //gui.readPreviousTransactions() }() for _, plugin := range gui.plugins { @@ -402,9 +401,8 @@ 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() - unconfirmedFunds := new(big.Int) gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Balance()))) lastBlockLabel := gui.getObjectByName("lastBlockLabel") @@ -418,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 { @@ -433,20 +428,20 @@ 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 - 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.ChainManager().TransState() + cstate := gui.eth.ChainManager().State() - 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: @@ -454,40 +449,26 @@ 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.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) + } else if bytes.Compare(tx.To(), 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: 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") diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 8c46de6d9..eaf0af0c7 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.10" ) var ethereum *eth.Ethereum 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)) } diff --git a/cmd/peerserver/main.go b/cmd/peerserver/main.go new file mode 100644 index 000000000..0fa7a9b44 --- /dev/null +++ b/cmd/peerserver/main.go @@ -0,0 +1,40 @@ +package main + +import ( + "crypto/elliptic" + "fmt" + "log" + "net" + "os" + + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/p2p" +) + +func main() { + logger.AddLogSystem(logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.InfoLevel)) + key, _ := crypto.GenerateKey() + marshaled := elliptic.Marshal(crypto.S256(), key.PublicKey.X, key.PublicKey.Y) + + srv := p2p.Server{ + MaxPeers: 10, + Identity: p2p.NewSimpleClientIdentity("Ethereum(G)", "0.1", "Peer Server Two", string(marshaled)), + ListenAddr: ":30301", + NAT: p2p.UPNP(), + } + if err := srv.Start(); err != nil { + fmt.Println("could not start server:", err) + os.Exit(1) + } + + // add seed peers + seed, err := net.ResolveTCPAddr("tcp", "poc-7.ethdev.com:30300") + if err != nil { + fmt.Println("couldn't resolve:", err) + os.Exit(1) + } + srv.SuggestPeer(seed.IP, seed.Port, nil) + + select {} +} diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index d9b26c701..db7bcd35e 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -145,7 +145,6 @@ func NewDatabase() ethutil.Database { } func NewClientIdentity(clientIdentifier, version, customIdentifier string) *wire.SimpleClientIdentity { - clilogger.Infoln("identity created") return wire.NewSimpleClientIdentity(clientIdentifier, version, customIdentifier) } @@ -240,6 +239,7 @@ func KeyTasks(keyManager *crypto.KeyManager, KeyRing string, GenAddr bool, Secre exit(err) } } + clilogger.Infof("Main address %x\n", keyManager.Address()) } func StartRpc(ethereum *eth.Ethereum, RpcPort int) { diff --git a/cmd/utils/vm_env.go b/cmd/utils/vm_env.go index eb52602c4..461a797c2 100644 --- a/cmd/utils/vm_env.go +++ b/cmd/utils/vm_env.go @@ -49,9 +49,7 @@ func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error { } func (self *VMEnv) vm(addr, data []byte, gas, price, value *big.Int) *core.Execution { - evm := vm.New(self, vm.DebugVmTy) - - return core.NewExecution(evm, addr, data, gas, price, value) + return core.NewExecution(self, addr, data, gas, price, value) } func (self *VMEnv) Call(caller vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) { |