aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorAlexandre Van de Sande <alex.vandesande@ethdev.com>2015-02-23 20:05:15 +0800
committerAlexandre Van de Sande <alex.vandesande@ethdev.com>2015-02-23 20:05:15 +0800
commitdea65840186fe861017524c9cb59ae07ac97ed06 (patch)
tree5cb5e339b9ce77a2a3c92cf8a10c4294fcf7965c /cmd
parentbb3338df6363d8267a24190584f0908463241a6c (diff)
parentdd086791acf477da7641c168f82de70ed0b2dca6 (diff)
downloadgo-tangerine-dea65840186fe861017524c9cb59ae07ac97ed06.tar.gz
go-tangerine-dea65840186fe861017524c9cb59ae07ac97ed06.tar.zst
go-tangerine-dea65840186fe861017524c9cb59ae07ac97ed06.zip
Merge branch 'develop' into ui
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ethereum/flags.go2
-rw-r--r--cmd/ethereum/main.go5
-rw-r--r--cmd/ethtest/main.go4
-rw-r--r--cmd/mist/assets/examples/bomb.html22
-rw-r--r--cmd/mist/assets/examples/coin.html28
-rw-r--r--cmd/mist/assets/examples/info.html4
-rw-r--r--cmd/mist/assets/ext/ethereum.js/dist/ethereum.js2
-rw-r--r--cmd/mist/assets/qml/main.qml8
-rw-r--r--cmd/mist/assets/qml/views/pending_tx.qml9
-rw-r--r--cmd/mist/flags.go3
-rw-r--r--cmd/mist/gui.go58
-rw-r--r--cmd/mist/main.go28
-rw-r--r--cmd/mist/ui_lib.go4
-rw-r--r--cmd/utils/cmd.go4
14 files changed, 88 insertions, 93 deletions
diff --git a/cmd/ethereum/flags.go b/cmd/ethereum/flags.go
index 1e6869a69..577bee442 100644
--- a/cmd/ethereum/flags.go
+++ b/cmd/ethereum/flags.go
@@ -132,7 +132,7 @@ func Init() {
natstr = flag.String("nat", "any", "port mapping mechanism (any|none|upnp|pmp|extip:<IP>)")
)
flag.BoolVar(&Dial, "dial", true, "dial out connections (default on)")
- flag.BoolVar(&SHH, "shh", true, "run whisper protocol (default on)")
+ //flag.BoolVar(&SHH, "shh", true, "run whisper protocol (default on)")
flag.StringVar(&OutboundPort, "port", "30303", "listening port")
flag.StringVar(&BootNodes, "bootnodes", "", "space-separated node URLs for discovery bootstrap")
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go
index 0dba462be..9c840de58 100644
--- a/cmd/ethereum/main.go
+++ b/cmd/ethereum/main.go
@@ -37,7 +37,7 @@ import (
const (
ClientIdentifier = "Ethereum(G)"
- Version = "0.8.3"
+ Version = "0.8.5"
)
var clilogger = logger.NewLogger("CLI")
@@ -67,11 +67,12 @@ func main() {
DataDir: Datadir,
LogFile: LogFile,
LogLevel: LogLevel,
+ LogFormat: LogFormat,
MaxPeers: MaxPeer,
Port: OutboundPort,
NAT: NAT,
KeyRing: KeyRing,
- Shh: SHH,
+ Shh: true,
Dial: Dial,
BootNodes: BootNodes,
NodeKey: NodeKey,
diff --git a/cmd/ethtest/main.go b/cmd/ethtest/main.go
index e1c4806ad..40874616c 100644
--- a/cmd/ethtest/main.go
+++ b/cmd/ethtest/main.go
@@ -51,8 +51,8 @@ func StateObjectFromAccount(db ethutil.Database, addr string, account Account) *
if ethutil.IsHex(account.Code) {
account.Code = account.Code[2:]
}
- obj.Code = ethutil.Hex2Bytes(account.Code)
- obj.Nonce = ethutil.Big(account.Nonce).Uint64()
+ obj.SetCode(ethutil.Hex2Bytes(account.Code))
+ obj.SetNonce(ethutil.Big(account.Nonce).Uint64())
return obj
}
diff --git a/cmd/mist/assets/examples/bomb.html b/cmd/mist/assets/examples/bomb.html
new file mode 100644
index 000000000..62540f9bb
--- /dev/null
+++ b/cmd/mist/assets/examples/bomb.html
@@ -0,0 +1,22 @@
+<html>
+<head>
+<script src="../ext/bignumber.min.js"></script>
+<script src="../ext/ethereum.js/dist/ethereum.js"></script>
+
+<script>
+var web3 = require('web3');
+web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8545'));
+var eth = web3.eth;
+
+function bomb() {
+ for (var i = 0; i < 200; i++) {
+ eth.transact({})
+ }
+}
+</script>
+</head>
+
+<body>
+<button onclick="bomb();">BOOM!</button>
+</body>
+</html>
diff --git a/cmd/mist/assets/examples/coin.html b/cmd/mist/assets/examples/coin.html
index ca7a9c0dd..18a6811d7 100644
--- a/cmd/mist/assets/examples/coin.html
+++ b/cmd/mist/assets/examples/coin.html
@@ -14,8 +14,9 @@
</div>
<div>
- <span class="amount">Amount:</span>
+ <span>Address:</span>
<input type="text" id="address" style="width:200px">
+ <span>Amount:</span>
<input type="text" id="amount" style="width:200px">
<button onclick="transact()">Send</button>
</div>
@@ -58,7 +59,7 @@
}],
"outputs": []
}, {
- "name":"received",
+ "name":"Changed",
"type":"event",
"inputs": [
{"name":"from","type":"address","indexed":true},
@@ -69,23 +70,14 @@
var address = localStorage.getItem("address");
// deploy if not exist
if (address == null) {
- var code = "0x60056013565b61012b806100346000396000f35b6103e8600033600160a060020a0316600052602052604060002081905550560060e060020a6000350480637bb98a681461002b578063d0679d3414610039578063e3d670d71461004d57005b610033610126565b60006000f35b610047600435602435610062565b60006000f35b610058600435610104565b8060005260206000f35b80600033600160a060020a0316600052602052604060002054101561008657610100565b80600033600160a060020a0316600052602052604060002090815403908190555080600083600160a060020a0316600052602052604060002090815401908190555033600160a060020a0316600052806020527ff11e547d796cc64acdf758e7cee90439494fd886a19159454aa61e473fdbafef60406000a15b5050565b6000600082600160a060020a03166000526020526040600020549050919050565b5b60008156";
+ var code = "0x60056013565b61014f8061003a6000396000f35b620f42406000600033600160a060020a0316815260200190815260200160002081905550560060e060020a600035048063d0679d3414610020578063e3d670d71461003457005b61002e600435602435610049565b60006000f35b61003f600435610129565b8060005260206000f35b806000600033600160a060020a03168152602001908152602001600020541061007157610076565b610125565b806000600033600160a060020a03168152602001908152602001600020908154039081905550806000600084600160a060020a031681526020019081526020016000209081540190819055508033600160a060020a03167fb52dda022b6c1a1f40905a85f257f689aa5d69d850e49cf939d688fbe5af594660006000a38082600160a060020a03167fb52dda022b6c1a1f40905a85f257f689aa5d69d850e49cf939d688fbe5af594660006000a35b5050565b60006000600083600160a060020a0316815260200190815260200160002054905091905056";
address = web3.eth.transact({data: code});
localStorage.setItem("address", address);
}
- document.querySelector("#contract_addr").innerHTML = address.toUpperCase();
+ document.querySelector("#contract_addr").innerHTML = address;
var contract = web3.eth.contract(address, desc);
- contract.received({from: eth.coinbase}).changed(function() {
- refresh();
- });
-
- var ev = contract.SingleTransact({})
- ev.watch(function(log) {
- someElement.innerHTML += "tnaheousnthaoeu";
- });
-
- eth.watch('chain').changed(function() {
+ contract.Changed({from: eth.coinbase}).changed(function() {
refresh();
});
@@ -98,7 +90,7 @@
var storage = eth.storageAt(address);
table.innerHTML = "";
for( var item in storage ) {
- table.innerHTML += "<tr><td>"+item.toUpperCase()+"</td><td>"+web3.toDecimal(storage[item])+"</td></tr>";
+ table.innerHTML += "<tr><td>"+item+"</td><td>"+web3.toDecimal(storage[item])+"</td></tr>";
}
}
@@ -111,6 +103,7 @@
}
var value = parseInt( document.querySelector("#amount").value );
+ console.log("transact: ", to, " => ", value)
contract.send( to, value );
}
@@ -126,7 +119,7 @@ contract JevCoin {
balances[msg.sender] = 1000000;
}
- event changed(address indexed from, address indexed to);
+ event Changed(address indexed from, uint indexed amount);
function send(address to, uint value)
{
if( balances[msg.sender] < value ) return;
@@ -134,7 +127,8 @@ contract JevCoin {
balances[msg.sender] -= value;
balances[to] += value;
- changed(msg.sender, to);
+ Changed(msg.sender, value);
+ Changed(to, value);
}
function balance(address who) constant returns(uint t)
diff --git a/cmd/mist/assets/examples/info.html b/cmd/mist/assets/examples/info.html
index d8816b19f..2a405c280 100644
--- a/cmd/mist/assets/examples/info.html
+++ b/cmd/mist/assets/examples/info.html
@@ -71,6 +71,10 @@
document.querySelector("#gas_price").innerHTML = eth.gasPrice;
document.querySelector("#mining").innerHTML = eth.mining;
document.querySelector("#listening").innerHTML = eth.listening;
+ eth.watch('chain').changed(function() {
+ document.querySelector("#number").innerHTML = eth.number;
+ });
+
</script>
</html>
diff --git a/cmd/mist/assets/ext/ethereum.js/dist/ethereum.js b/cmd/mist/assets/ext/ethereum.js/dist/ethereum.js
index d0e9d3cb7..83b598b3f 100644
--- a/cmd/mist/assets/ext/ethereum.js/dist/ethereum.js
+++ b/cmd/mist/assets/ext/ethereum.js/dist/ethereum.js
@@ -1417,6 +1417,8 @@ var ethMethods = function () {
var methods = [
{ name: 'balanceAt', call: 'eth_balanceAt' },
+ { name: 'register', call: 'eth_register' },
+ { name: 'unregister', call: 'eth_unregister' },
{ name: 'stateAt', call: 'eth_stateAt' },
{ name: 'storageAt', call: 'eth_storageAt' },
{ name: 'countAt', call: 'eth_countAt'},
diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml
index 3c5772d84..1f7fcbec6 100644
--- a/cmd/mist/assets/qml/main.qml
+++ b/cmd/mist/assets/qml/main.qml
@@ -256,6 +256,7 @@ ApplicationWindow {
}
}
}
+
}
property var blockModel: ListModel {
@@ -895,7 +896,7 @@ ApplicationWindow {
}
function setWalletValue(value) {
- walletValueLabel.text = value
+ //walletValueLabel.text = value
}
function loadPlugin(name) {
@@ -947,7 +948,8 @@ ApplicationWindow {
model: peerModel
TableViewColumn{width: 180; role: "addr" ; title: "Remote Address" }
TableViewColumn{width: 280; role: "nodeID" ; title: "Node ID" }
- TableViewColumn{width: 180; role: "caps" ; title: "Capabilities" }
+ TableViewColumn{width: 100; role: "name" ; title: "Name" }
+ TableViewColumn{width: 40; role: "caps" ; title: "Capabilities" }
}
}
}
@@ -978,7 +980,7 @@ ApplicationWindow {
anchors.top: parent.top
anchors.topMargin: 30
font.pointSize: 12
- 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>"
+ text: "<h2>Mist (0.8.5)</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Viktor Trón<br>Felix Lange<br>Taylor Gerring<br>Daniel Nagy<br>Gustav Simonsson<br><h3>UX/UI</h3>Alex van de Sande<br>Fabian Vogelsteller"
}
}
diff --git a/cmd/mist/assets/qml/views/pending_tx.qml b/cmd/mist/assets/qml/views/pending_tx.qml
index 4442a69db..3dcedeff2 100644
--- a/cmd/mist/assets/qml/views/pending_tx.qml
+++ b/cmd/mist/assets/qml/views/pending_tx.qml
@@ -41,4 +41,13 @@ Rectangle {
pendingTxModel.insert(0, {hash: tx.hash, to: tx.address, from: tx.sender, value: tx.value, contract: isContract})
}
+
+ function removeTx(tx) {
+ for (var i = 0; i < pendingTxModel.count; i++) {
+ if (tx.hash === pendingTxModel.get(i).hash) {
+ pendingTxModel.remove(i);
+ break;
+ }
+ }
+ }
}
diff --git a/cmd/mist/flags.go b/cmd/mist/flags.go
index eb280f71b..d9487de9e 100644
--- a/cmd/mist/flags.go
+++ b/cmd/mist/flags.go
@@ -63,6 +63,7 @@ var (
DebugFile string
LogLevel int
VmType int
+ MinerThreads int
)
// flags specific to gui client
@@ -137,6 +138,8 @@ func Init() {
flag.StringVar(&BootNodes, "bootnodes", "", "space-separated node URLs for discovery bootstrap")
flag.IntVar(&MaxPeer, "maxpeer", 30, "maximum desired peers")
+ flag.IntVar(&MinerThreads, "minerthreads", runtime.NumCPU(), "number of miner threads")
+
flag.Parse()
var err error
diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go
index 9ce6ba650..4af0cff43 100644
--- a/cmd/mist/gui.go
+++ b/cmd/mist/gui.go
@@ -131,6 +131,7 @@ func (gui *Gui) Start(assetPath string) {
context.SetVar("gui", gui)
context.SetVar("eth", gui.uiLib)
context.SetVar("shh", gui.whisper)
+ //clipboard.SetQMLClipboard(context)
win, err := gui.showWallet(context)
if err != nil {
@@ -386,16 +387,11 @@ func (gui *Gui) update() {
generalUpdateTicker := time.NewTicker(500 * time.Millisecond)
statsUpdateTicker := time.NewTicker(5 * time.Second)
- state := gui.eth.ChainManager().TransState()
-
- gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Balance())))
-
lastBlockLabel := gui.getObjectByName("lastBlockLabel")
miningLabel := gui.getObjectByName("miningLabel")
events := gui.eth.EventMux().Subscribe(
- //eth.PeerListEvent{},
- core.NewBlockEvent{},
+ core.ChainEvent{},
core.TxPreEvent{},
core.TxPostEvent{},
)
@@ -408,41 +404,13 @@ func (gui *Gui) update() {
return
}
switch ev := ev.(type) {
- case core.NewBlockEvent:
+ case core.ChainEvent:
gui.processBlock(ev.Block, false)
- //gui.setWalletValue(gui.eth.ChainManager().State().GetBalance(gui.address()), nil)
- balance := ethutil.CurrencyToString(gui.eth.ChainManager().State().GetBalance(gui.address()))
- gui.getObjectByName("balanceLabel").Set("text", fmt.Sprintf("%v", balance))
-
case core.TxPreEvent:
- tx := ev.Tx
-
- tstate := gui.eth.ChainManager().TransState()
- cstate := gui.eth.ChainManager().State()
-
- 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)
+ gui.insertTransaction("pre", ev.Tx)
case core.TxPostEvent:
- tx := ev.Tx
- object := state.GetAccount(gui.address())
-
- if bytes.Compare(tx.From(), gui.address()) == 0 {
- object.SubAmount(tx.Value())
-
- gui.txDb.Put(tx.Hash(), tx.RlpEncode())
- } else if bytes.Compare(tx.To(), gui.address()) == 0 {
- object.AddAmount(tx.Value())
-
- gui.txDb.Put(tx.Hash(), tx.RlpEncode())
- }
-
- gui.setWalletValue(object.Balance(), nil)
- state.UpdateStateObject(object)
+ gui.getObjectByName("pendingTxView").Call("removeTx", xeth.NewTx(ev.Tx))
}
case <-peerUpdateTicker.C:
@@ -453,19 +421,6 @@ func (gui *Gui) update() {
lastBlockLabel.Set("text", statusText)
miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.Miner().HashRate(), 10)+"/Khash")
- /*
- blockLength := gui.eth.BlockPool().BlocksProcessed
- chainLength := gui.eth.BlockPool().ChainLength
-
- var (
- pct float64 = 1.0 / float64(chainLength) * float64(blockLength)
- 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))
- */
-
case <-statsUpdateTicker.C:
gui.setStatsPane()
}
@@ -498,7 +453,7 @@ NumGC: %d
))
}
-type qmlpeer struct{ Addr, NodeID, Caps string }
+type qmlpeer struct{ Addr, NodeID, Name, Caps string }
type peersByID []*qmlpeer
@@ -513,6 +468,7 @@ func (gui *Gui) setPeerInfo() {
qpeers[i] = &qmlpeer{
NodeID: p.ID().String(),
Addr: p.RemoteAddr().String(),
+ Name: p.Name(),
Caps: fmt.Sprint(p.Caps()),
}
}
diff --git a/cmd/mist/main.go b/cmd/mist/main.go
index 32222fbef..ad6eb5bec 100644
--- a/cmd/mist/main.go
+++ b/cmd/mist/main.go
@@ -36,7 +36,7 @@ import (
const (
ClientIdentifier = "Mist"
- Version = "0.8.3"
+ Version = "0.8.5"
)
var ethereum *eth.Ethereum
@@ -52,18 +52,20 @@ func run() error {
config := utils.InitConfig(VmType, ConfigFile, Datadir, "ETH")
ethereum, err := eth.New(&eth.Config{
- Name: p2p.MakeName(ClientIdentifier, Version),
- KeyStore: KeyStore,
- DataDir: Datadir,
- LogFile: LogFile,
- LogLevel: LogLevel,
- MaxPeers: MaxPeer,
- Port: OutboundPort,
- NAT: NAT,
- BootNodes: BootNodes,
- NodeKey: NodeKey,
- KeyRing: KeyRing,
- Dial: true,
+ Name: p2p.MakeName(ClientIdentifier, Version),
+ KeyStore: KeyStore,
+ DataDir: Datadir,
+ LogFile: LogFile,
+ LogLevel: LogLevel,
+ MaxPeers: MaxPeer,
+ Port: OutboundPort,
+ NAT: NAT,
+ Shh: true,
+ BootNodes: BootNodes,
+ NodeKey: NodeKey,
+ KeyRing: KeyRing,
+ Dial: true,
+ MinerThreads: MinerThreads,
})
if err != nil {
mainlogger.Fatalln(err)
diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go
index 1a4d21012..4fa6e8e55 100644
--- a/cmd/mist/ui_lib.go
+++ b/cmd/mist/ui_lib.go
@@ -146,8 +146,8 @@ func (ui *UiLib) AssetPath(p string) string {
func (self *UiLib) StartDbWithContractAndData(contractHash, data string) {
dbWindow := NewDebuggerWindow(self)
object := self.eth.ChainManager().State().GetStateObject(ethutil.Hex2Bytes(contractHash))
- if len(object.Code) > 0 {
- dbWindow.SetCode(ethutil.Bytes2Hex(object.Code))
+ if len(object.Code()) > 0 {
+ dbWindow.SetCode(ethutil.Bytes2Hex(object.Code()))
}
dbWindow.SetData(data)
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go
index ecb847fc3..bc8fafafb 100644
--- a/cmd/utils/cmd.go
+++ b/cmd/utils/cmd.go
@@ -225,7 +225,7 @@ func StartMining(ethereum *eth.Ethereum) bool {
go func() {
clilogger.Infoln("Start mining")
if gminer == nil {
- gminer = miner.New(addr, ethereum)
+ gminer = miner.New(addr, ethereum, 4)
}
gminer.Start()
}()
@@ -272,7 +272,7 @@ func BlockDo(ethereum *eth.Ethereum, hash []byte) error {
parent := ethereum.ChainManager().GetBlock(block.ParentHash())
statedb := state.New(parent.Root(), ethereum.Db())
- _, err := ethereum.BlockProcessor().TransitionState(statedb, parent, block)
+ _, err := ethereum.BlockProcessor().TransitionState(statedb, parent, block, true)
if err != nil {
return err
}