Skip to content

Commit 6cff6dd

Browse files
committed
Merge branch 'release/v0.7.10' into develop
2 parents 12671c8 + 0a9dc15 commit 6cff6dd

File tree

12 files changed

+81
-62
lines changed

12 files changed

+81
-62
lines changed

cmd/ethereum/flags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func Init() {
8585
flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file (db)")
8686
flag.StringVar(&OutboundPort, "port", "30303", "listening port")
8787
flag.BoolVar(&UseUPnP, "upnp", false, "enable UPnP support")
88-
flag.IntVar(&MaxPeer, "maxpeer", 10, "maximum desired peers")
88+
flag.IntVar(&MaxPeer, "maxpeer", 30, "maximum desired peers")
8989
flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on")
9090
flag.BoolVar(&StartRpc, "rpc", false, "start rpc server")
9191
flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server")

cmd/ethereum/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030

3131
const (
3232
ClientIdentifier = "Ethereum(G)"
33-
Version = "0.7.9"
33+
Version = "0.7.10"
3434
)
3535

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

cmd/mist/assets/qml/main.qml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -786,8 +786,8 @@ ApplicationWindow {
786786
title: "About"
787787
minimumWidth: 350
788788
maximumWidth: 350
789-
maximumHeight: 200
790-
minimumHeight: 200
789+
maximumHeight: 280
790+
minimumHeight: 280
791791

792792
Image {
793793
id: aboutIcon
@@ -797,7 +797,7 @@ ApplicationWindow {
797797
smooth: true
798798
source: "../facet.png"
799799
x: 10
800-
y: 10
800+
y: 30
801801
}
802802

803803
Text {
@@ -806,7 +806,7 @@ ApplicationWindow {
806806
anchors.top: parent.top
807807
anchors.topMargin: 30
808808
font.pointSize: 12
809-
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"
809+
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>"
810810
}
811811
}
812812

cmd/mist/flags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func Init() {
104104
flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file (db)")
105105
flag.StringVar(&OutboundPort, "port", "30303", "listening port")
106106
flag.BoolVar(&UseUPnP, "upnp", true, "enable UPnP support")
107-
flag.IntVar(&MaxPeer, "maxpeer", 10, "maximum desired peers")
107+
flag.IntVar(&MaxPeer, "maxpeer", 30, "maximum desired peers")
108108
flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on")
109109
flag.BoolVar(&StartRpc, "rpc", false, "start rpc server")
110110
flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server")

cmd/mist/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131

3232
const (
3333
ClientIdentifier = "Mist"
34-
Version = "0.7.9"
34+
Version = "0.7.10"
3535
)
3636

3737
var ethereum *eth.Ethereum

core/block_manager.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ done:
129129
statelogger.Infoln(err)
130130
erroneous = append(erroneous, tx)
131131
err = nil
132-
continue
133132
}
134133
}
135134

@@ -143,6 +142,7 @@ done:
143142
receipt := types.NewReceipt(state.Root(), cumulative)
144143
receipt.SetLogs(state.Logs())
145144
receipt.Bloom = types.CreateBloom(types.Receipts{receipt})
145+
chainlogger.Debugln(receipt)
146146

147147
// Notify all subscribers
148148
if !transientProcess {
@@ -215,6 +215,8 @@ func (sm *BlockManager) ProcessWithParent(block, parent *types.Block) (td *big.I
215215

216216
receiptSha := types.DeriveSha(receipts)
217217
if bytes.Compare(receiptSha, block.ReceiptSha) != 0 {
218+
//chainlogger.Debugf("validating receipt root. received=%x got=%x", block.ReceiptSha, receiptSha)
219+
fmt.Printf("%x\n", ethutil.Encode(receipts))
218220
err = fmt.Errorf("validating receipt root. received=%x got=%x", block.ReceiptSha, receiptSha)
219221
return
220222
}

core/execution.go

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package core
33
import (
44
"fmt"
55
"math/big"
6+
"time"
67

78
"github.com/ethereum/go-ethereum/state"
89
"github.com/ethereum/go-ethereum/vm"
@@ -12,7 +13,6 @@ type Execution struct {
1213
env vm.Environment
1314
address, input []byte
1415
Gas, price, value *big.Int
15-
object *state.StateObject
1616
SkipTransfer bool
1717
}
1818

@@ -35,8 +35,6 @@ func (self *Execution) exec(code, contextAddr []byte, caller vm.ClosureRef) (ret
3535
env := self.env
3636
evm := vm.New(env, vm.DebugVmTy)
3737

38-
chainlogger.Debugf("pre state %x\n", env.State().Root())
39-
4038
if env.Depth() == vm.MaxCallDepth {
4139
// Consume all gas (by not returning it) and return a depth error
4240
return nil, vm.DepthError{}
@@ -55,15 +53,12 @@ func (self *Execution) exec(code, contextAddr []byte, caller vm.ClosureRef) (ret
5553
}
5654

5755
snapshot := env.State().Copy()
58-
defer func() {
59-
if vm.IsOOGErr(err) {
60-
env.State().Set(snapshot)
61-
}
62-
chainlogger.Debugf("post state %x\n", env.State().Root())
63-
}()
64-
65-
self.object = to
56+
start := time.Now()
6657
ret, err = evm.Run(to, caller, code, self.value, self.Gas, self.price, self.input)
58+
if err != nil {
59+
env.State().Set(snapshot)
60+
}
61+
chainlogger.Debugf("vm took %v\n", time.Since(start))
6762

6863
return
6964
}

core/state_transition.go

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (self *StateTransition) BuyGas() error {
112112

113113
sender := self.From()
114114
if sender.Balance().Cmp(MessageGasValue(self.msg)) < 0 {
115-
return fmt.Errorf("Insufficient funds to pre-pay gas. Req %v, has %v", MessageGasValue(self.msg), sender.Balance())
115+
return fmt.Errorf("insufficient ETH for gas (%x). Req %v, has %v", sender.Address()[:4], MessageGasValue(self.msg), sender.Balance())
116116
}
117117

118118
coinbase := self.Coinbase()
@@ -186,15 +186,22 @@ func (self *StateTransition) TransitionState() (ret []byte, err error) {
186186
vmenv := self.VmEnv()
187187
var ref vm.ClosureRef
188188
if MessageCreatesContract(msg) {
189-
self.rec = MakeContract(msg, self.state)
190-
191-
ret, err, ref = vmenv.Create(sender, self.rec.Address(), self.msg.Data(), self.gas, self.gasPrice, self.value)
192-
ref.SetCode(ret)
189+
contract := MakeContract(msg, self.state)
190+
ret, err, ref = vmenv.Create(sender, contract.Address(), self.msg.Data(), self.gas, self.gasPrice, self.value)
191+
if err == nil {
192+
dataGas := big.NewInt(int64(len(ret)))
193+
dataGas.Mul(dataGas, vm.GasCreateByte)
194+
if err = self.UseGas(dataGas); err == nil {
195+
//self.state.SetCode(ref.Address(), ret)
196+
ref.SetCode(ret)
197+
}
198+
}
193199
} else {
194200
ret, err = vmenv.Call(self.From(), self.To().Address(), self.msg.Data(), self.gas, self.gasPrice, self.value)
195201
}
202+
196203
if err != nil {
197-
statelogger.Debugln(err)
204+
self.UseGas(self.gas)
198205
}
199206

200207
return
@@ -211,20 +218,19 @@ func MakeContract(msg Message, state *state.StateDB) *state.StateObject {
211218
}
212219

213220
func (self *StateTransition) RefundGas() {
214-
coinbaseSub := new(big.Int).Set(self.gas)
221+
coinbase, sender := self.Coinbase(), self.From()
222+
// Return remaining gas
223+
remaining := new(big.Int).Mul(self.gas, self.msg.GasPrice())
224+
sender.AddAmount(remaining)
225+
215226
uhalf := new(big.Int).Div(self.GasUsed(), ethutil.Big2)
216227
for addr, ref := range self.state.Refunds() {
217228
refund := ethutil.BigMin(uhalf, ref)
218-
coinbaseSub.Add(self.gas, refund)
229+
self.gas.Add(self.gas, refund)
219230
self.state.AddBalance([]byte(addr), refund.Mul(refund, self.msg.GasPrice()))
220231
}
221232

222-
coinbase, sender := self.Coinbase(), self.From()
223-
coinbase.RefundGas(coinbaseSub, self.msg.GasPrice())
224-
225-
// Return remaining gas
226-
remaining := new(big.Int).Mul(self.gas, self.msg.GasPrice())
227-
sender.AddAmount(remaining)
233+
coinbase.RefundGas(self.gas, self.msg.GasPrice())
228234
}
229235

230236
func (self *StateTransition) GasUsed() *big.Int {

core/types/transaction.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func NewTransactionFromValue(val *ethutil.Value) *Transaction {
4747
}
4848

4949
func (tx *Transaction) Hash() []byte {
50-
data := []interface{}{tx.Nonce, tx.gasPrice, tx.gas, tx.recipient, tx.Value, tx.Data}
50+
data := []interface{}{tx.nonce, tx.gasPrice, tx.gas, tx.recipient, tx.value, tx.data}
5151

5252
return crypto.Sha3(ethutil.NewValue(data).Encode())
5353
}
@@ -108,8 +108,8 @@ func (tx *Transaction) PublicKey() []byte {
108108
sig := append(r, s...)
109109
sig = append(sig, v-27)
110110

111-
pubkey := crypto.Ecrecover(append(hash, sig...))
112-
//pubkey, _ := secp256k1.RecoverPubkey(hash, sig)
111+
//pubkey := crypto.Ecrecover(append(hash, sig...))
112+
pubkey, _ := secp256k1.RecoverPubkey(hash, sig)
113113

114114
return pubkey
115115
}
@@ -138,9 +138,7 @@ func (tx *Transaction) Sign(privk []byte) error {
138138
}
139139

140140
func (tx *Transaction) RlpData() interface{} {
141-
data := []interface{}{tx.Nonce, tx.GasPrice, tx.Gas, tx.recipient, tx.Value, tx.Data}
142-
143-
// TODO Remove prefixing zero's
141+
data := []interface{}{tx.nonce, tx.gasPrice, tx.gas, tx.recipient, tx.value, tx.data}
144142

145143
return append(data, tx.v, new(big.Int).SetBytes(tx.r).Bytes(), new(big.Int).SetBytes(tx.s).Bytes())
146144
}
@@ -184,6 +182,7 @@ func (tx *Transaction) String() string {
184182
V: 0x%x
185183
R: 0x%x
186184
S: 0x%x
185+
Hex: %x
187186
`,
188187
tx.Hash(),
189188
len(tx.recipient) == 0,
@@ -192,11 +191,13 @@ func (tx *Transaction) String() string {
192191
tx.nonce,
193192
tx.gasPrice,
194193
tx.gas,
195-
tx.Value,
196-
tx.Data,
194+
tx.value,
195+
tx.data,
197196
tx.v,
198197
tx.r,
199-
tx.s)
198+
tx.s,
199+
ethutil.Encode(tx),
200+
)
200201
}
201202

202203
// Transaction slice type for basic sorting

state/state.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ func (self *StateDB) GetCode(addr []byte) []byte {
9494
return nil
9595
}
9696

97+
func (self *StateDB) SetCode(addr, code []byte) {
98+
stateObject := self.GetStateObject(addr)
99+
if stateObject != nil {
100+
stateObject.SetCode(code)
101+
}
102+
}
103+
97104
func (self *StateDB) GetState(a, b []byte) []byte {
98105
stateObject := self.GetStateObject(a)
99106
if stateObject != nil {

0 commit comments

Comments
 (0)