Skip to content

Commit 8cc6647

Browse files
committed
Merge branch 'release/0.8.5'
2 parents 5912f0a + 321dce1 commit 8cc6647

File tree

13 files changed

+60
-39
lines changed

13 files changed

+60
-39
lines changed

cmd/ethereum/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import (
3737

3838
const (
3939
ClientIdentifier = "Ethereum(G)"
40-
Version = "0.8.4"
40+
Version = "0.8.5"
4141
)
4242

4343
var clilogger = logger.NewLogger("CLI")

cmd/mist/assets/examples/coin.html

+11-12
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ <h1>JevCoin <code id="contract_addr"></code></h1>
1414
</div>
1515

1616
<div>
17-
<span class="amount">Amount:</span>
17+
<span>Address:</span>
1818
<input type="text" id="address" style="width:200px">
19+
<span>Amount:</span>
1920
<input type="text" id="amount" style="width:200px">
2021
<button onclick="transact()">Send</button>
2122
</div>
@@ -58,7 +59,7 @@ <h1>JevCoin <code id="contract_addr"></code></h1>
5859
}],
5960
"outputs": []
6061
}, {
61-
"name":"received",
62+
"name":"Changed",
6263
"type":"event",
6364
"inputs": [
6465
{"name":"from","type":"address","indexed":true},
@@ -69,18 +70,14 @@ <h1>JevCoin <code id="contract_addr"></code></h1>
6970
var address = localStorage.getItem("address");
7071
// deploy if not exist
7172
if (address == null) {
72-
var code = "0x60056013565b61012b806100346000396000f35b6103e8600033600160a060020a0316600052602052604060002081905550560060e060020a6000350480637bb98a681461002b578063d0679d3414610039578063e3d670d71461004d57005b610033610126565b60006000f35b610047600435602435610062565b60006000f35b610058600435610104565b8060005260206000f35b80600033600160a060020a0316600052602052604060002054101561008657610100565b80600033600160a060020a0316600052602052604060002090815403908190555080600083600160a060020a0316600052602052604060002090815401908190555033600160a060020a0316600052806020527ff11e547d796cc64acdf758e7cee90439494fd886a19159454aa61e473fdbafef60406000a15b5050565b6000600082600160a060020a03166000526020526040600020549050919050565b5b60008156";
73+
var code = "0x60056013565b61014f8061003a6000396000f35b620f42406000600033600160a060020a0316815260200190815260200160002081905550560060e060020a600035048063d0679d3414610020578063e3d670d71461003457005b61002e600435602435610049565b60006000f35b61003f600435610129565b8060005260206000f35b806000600033600160a060020a03168152602001908152602001600020541061007157610076565b610125565b806000600033600160a060020a03168152602001908152602001600020908154039081905550806000600084600160a060020a031681526020019081526020016000209081540190819055508033600160a060020a03167fb52dda022b6c1a1f40905a85f257f689aa5d69d850e49cf939d688fbe5af594660006000a38082600160a060020a03167fb52dda022b6c1a1f40905a85f257f689aa5d69d850e49cf939d688fbe5af594660006000a35b5050565b60006000600083600160a060020a0316815260200190815260200160002054905091905056";
7374
address = web3.eth.transact({data: code});
7475
localStorage.setItem("address", address);
7576
}
76-
document.querySelector("#contract_addr").innerHTML = address.toUpperCase();
77+
document.querySelector("#contract_addr").innerHTML = address;
7778

7879
var contract = web3.eth.contract(address, desc);
79-
contract.received({from: eth.coinbase}).changed(function() {
80-
refresh();
81-
});
82-
83-
eth.watch('chain').changed(function() {
80+
contract.Changed({from: eth.coinbase}).changed(function() {
8481
refresh();
8582
});
8683

@@ -93,7 +90,7 @@ <h1>JevCoin <code id="contract_addr"></code></h1>
9390
var storage = eth.storageAt(address);
9491
table.innerHTML = "";
9592
for( var item in storage ) {
96-
table.innerHTML += "<tr><td>"+item.toUpperCase()+"</td><td>"+web3.toDecimal(storage[item])+"</td></tr>";
93+
table.innerHTML += "<tr><td>"+item+"</td><td>"+web3.toDecimal(storage[item])+"</td></tr>";
9794
}
9895
}
9996

@@ -106,6 +103,7 @@ <h1>JevCoin <code id="contract_addr"></code></h1>
106103
}
107104

108105
var value = parseInt( document.querySelector("#amount").value );
106+
console.log("transact: ", to, " => ", value)
109107

110108
contract.send( to, value );
111109
}
@@ -121,15 +119,16 @@ <h1>JevCoin <code id="contract_addr"></code></h1>
121119
balances[msg.sender] = 1000000;
122120
}
123121

124-
event changed(address indexed from, address indexed to);
122+
event Changed(address indexed from, uint indexed amount);
125123
function send(address to, uint value)
126124
{
127125
if( balances[msg.sender] < value ) return;
128126

129127
balances[msg.sender] -= value;
130128
balances[to] += value;
131129

132-
changed(msg.sender, to);
130+
Changed(msg.sender, value);
131+
Changed(to, value);
133132
}
134133

135134
function balance(address who) constant returns(uint t)

cmd/mist/assets/qml/main.qml

+1-1
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ ApplicationWindow {
964964
anchors.top: parent.top
965965
anchors.topMargin: 30
966966
font.pointSize: 12
967-
text: "<h2>Mist (0.8.4)</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"
967+
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"
968968
}
969969
}
970970

cmd/mist/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636

3737
const (
3838
ClientIdentifier = "Mist"
39-
Version = "0.8.4"
39+
Version = "0.8.5"
4040
)
4141

4242
var ethereum *eth.Ethereum

cmd/utils/cmd.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ func BlockDo(ethereum *eth.Ethereum, hash []byte) error {
272272
parent := ethereum.ChainManager().GetBlock(block.ParentHash())
273273

274274
statedb := state.New(parent.Root(), ethereum.Db())
275-
_, err := ethereum.BlockProcessor().TransitionState(statedb, parent, block)
275+
_, err := ethereum.BlockProcessor().TransitionState(statedb, parent, block, true)
276276
if err != nil {
277277
return err
278278
}

core/block_processor.go

+6-10
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ func NewBlockProcessor(db ethutil.Database, txpool *TxPool, chainManager *ChainM
6060
return sm
6161
}
6262

63-
func (sm *BlockProcessor) TransitionState(statedb *state.StateDB, parent, block *types.Block) (receipts types.Receipts, err error) {
63+
func (sm *BlockProcessor) TransitionState(statedb *state.StateDB, parent, block *types.Block, transientProcess bool) (receipts types.Receipts, err error) {
6464
coinbase := statedb.GetOrNewStateObject(block.Header().Coinbase)
6565
coinbase.SetGasPool(CalcGasLimit(parent, block))
6666

6767
// Process the transactions on to parent state
68-
receipts, _, _, _, err = sm.ApplyTransactions(coinbase, statedb, block, block.Transactions(), false)
68+
receipts, _, _, _, err = sm.ApplyTransactions(coinbase, statedb, block, block.Transactions(), transientProcess)
6969
if err != nil {
7070
return nil, err
7171
}
@@ -100,10 +100,9 @@ func (self *BlockProcessor) ApplyTransaction(coinbase *state.StateObject, stated
100100
// Notify all subscribers
101101
if !transientProcess {
102102
go self.eventMux.Post(TxPostEvent{tx})
103+
go self.eventMux.Post(statedb.Logs())
103104
}
104105

105-
go self.eventMux.Post(statedb.Logs())
106-
107106
return receipt, txGas, err
108107
}
109108

@@ -179,7 +178,7 @@ func (sm *BlockProcessor) processWithParent(block, parent *types.Block) (td *big
179178
return
180179
}
181180

182-
receipts, err := sm.TransitionState(state, parent, block)
181+
receipts, err := sm.TransitionState(state, parent, block, false)
183182
if err != nil {
184183
return
185184
}
@@ -316,13 +315,10 @@ func (sm *BlockProcessor) GetLogs(block *types.Block) (logs state.Logs, err erro
316315

317316
var (
318317
parent = sm.bc.GetBlock(block.Header().ParentHash)
319-
//state = state.New(parent.Trie().Copy())
320-
state = state.New(parent.Root(), sm.db)
318+
state = state.New(parent.Root(), sm.db)
321319
)
322320

323-
defer state.Reset()
324-
325-
sm.TransitionState(state, parent, block)
321+
sm.TransitionState(state, parent, block, true)
326322
sm.AccumulateRewards(state, block, parent)
327323

328324
return state.Logs(), nil

core/filter.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ func (self *Filter) Find() state.Logs {
111111
// current parameters
112112
if self.bloomFilter(block) {
113113
// Get the logs of the block
114-
logs, err := self.eth.BlockProcessor().GetLogs(block)
114+
unfiltered, err := self.eth.BlockProcessor().GetLogs(block)
115115
if err != nil {
116116
chainlogger.Warnln("err: filter get logs ", err)
117117

118118
break
119119
}
120120

121-
logs = append(logs, self.FilterLogs(logs)...)
121+
logs = append(logs, self.FilterLogs(unfiltered)...)
122122
}
123123

124124
block = self.eth.ChainManager().GetBlock(block.ParentHash())
@@ -146,7 +146,6 @@ func (self *Filter) FilterLogs(logs state.Logs) state.Logs {
146146
Logs:
147147
for _, log := range logs {
148148
if !includes(self.address, log.Address()) {
149-
//if !bytes.Equal(self.address, log.Address()) {
150149
continue
151150
}
152151

rpc/packages.go

+15
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,15 @@ func (self *EthereumApi) Logs(id int, reply *interface{}) error {
167167
return nil
168168
}
169169

170+
func (self *EthereumApi) AllLogs(args *FilterOptions, reply *interface{}) error {
171+
filter := core.NewFilter(self.xeth.Backend())
172+
filter.SetOptions(toFilterOptions(args))
173+
174+
*reply = toLogs(filter.Find())
175+
176+
return nil
177+
}
178+
170179
func (p *EthereumApi) GetBlock(args *GetBlockArgs, reply *interface{}) error {
171180
err := args.requirements()
172181
if err != nil {
@@ -509,6 +518,12 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
509518
return err
510519
}
511520
return p.Logs(args, reply)
521+
case "eth_logs":
522+
args, err := req.ToFilterArgs()
523+
if err != nil {
524+
return err
525+
}
526+
return p.AllLogs(args, reply)
512527
case "eth_gasPrice":
513528
*reply = defaultGasPrice
514529
return nil

rpc/util.go

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ type Log struct {
8484
Address string `json:"address"`
8585
Topic []string `json:"topics"`
8686
Data string `json:"data"`
87+
Number uint64 `json:"number"`
8788
}
8889

8990
func toLogs(logs state.Logs) (ls []Log) {
@@ -94,6 +95,7 @@ func toLogs(logs state.Logs) (ls []Log) {
9495
l.Topic = make([]string, len(log.Topics()))
9596
l.Address = toHex(log.Address())
9697
l.Data = toHex(log.Data())
98+
l.Number = log.Number()
9799
for j, topic := range log.Topics() {
98100
l.Topic[j] = toHex(topic)
99101
}

state/log.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,19 @@ type Log interface {
1212
Address() []byte
1313
Topics() [][]byte
1414
Data() []byte
15+
16+
Number() uint64
1517
}
1618

1719
type StateLog struct {
1820
address []byte
1921
topics [][]byte
2022
data []byte
23+
number uint64
2124
}
2225

23-
func NewLog(address []byte, topics [][]byte, data []byte) *StateLog {
24-
return &StateLog{address, topics, data}
26+
func NewLog(address []byte, topics [][]byte, data []byte, number uint64) *StateLog {
27+
return &StateLog{address, topics, data, number}
2528
}
2629

2730
func (self *StateLog) Address() []byte {
@@ -36,6 +39,10 @@ func (self *StateLog) Data() []byte {
3639
return self.data
3740
}
3841

42+
func (self *StateLog) Number() uint64 {
43+
return self.number
44+
}
45+
3946
func NewLogFromValue(decoder *ethutil.Value) *StateLog {
4047
log := &StateLog{
4148
address: decoder.Get(0).Bytes(),

vm/environment.go

+5
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type Log struct {
5454
address []byte
5555
topics [][]byte
5656
data []byte
57+
log uint64
5758
}
5859

5960
func (self *Log) Address() []byte {
@@ -68,6 +69,10 @@ func (self *Log) Data() []byte {
6869
return self.data
6970
}
7071

72+
func (self *Log) Number() uint64 {
73+
return self.log
74+
}
75+
7176
func (self *Log) RlpData() interface{} {
7277
return []interface{}{self.address, ethutil.ByteSliceToInterface(self.topics), self.data}
7378
}

vm/vm.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
578578
}
579579

580580
data := mem.Get(mStart.Int64(), mSize.Int64())
581-
log := &Log{context.Address(), topics, data}
581+
log := &Log{context.Address(), topics, data, self.env.BlockNumber().Uint64()}
582582
self.env.AddLog(log)
583583

584584
self.Printf(" => %v", log)

xeth/xeth.go

+5-7
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,11 @@ func (self *XEth) Transact(toStr, valueStr, gasStr, gasPriceStr, codeStr string)
288288

289289
//fmt.Printf("create tx: %x %v\n", tx.Hash()[:4], tx.Nonce())
290290

291-
/*
292-
// Do some pre processing for our "pre" events and hooks
293-
block := self.chainManager.NewBlock(key.Address())
294-
coinbase := state.GetOrNewStateObject(key.Address())
295-
coinbase.SetGasPool(block.GasLimit())
296-
self.blockProcessor.ApplyTransactions(coinbase, state, block, types.Transactions{tx}, true)
297-
*/
291+
// Do some pre processing for our "pre" events and hooks
292+
block := self.chainManager.NewBlock(key.Address())
293+
coinbase := state.GetOrNewStateObject(key.Address())
294+
coinbase.SetGasPool(block.GasLimit())
295+
self.blockProcessor.ApplyTransactions(coinbase, state, block, types.Transactions{tx}, true)
298296

299297
err = self.eth.TxPool().Add(tx)
300298
if err != nil {

0 commit comments

Comments
 (0)