aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rw-r--r--common/compiler/solidity_test.go4
-rw-r--r--core/filter.go15
-rw-r--r--rpc/api.go32
-rw-r--r--rpc/args.go50
-rw-r--r--rpc/args_test.go81
-rw-r--r--xeth/xeth.go33
7 files changed, 163 insertions, 58 deletions
diff --git a/README.md b/README.md
index 68904e63d..df335f242 100644
--- a/README.md
+++ b/README.md
@@ -12,15 +12,17 @@ master | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=L
[![Stories in Progress](https://badge.waffle.io/ethereum/go-ethereum.svg?label=in%20progress&title=In Progress)](http://waffle.io/ethereum/go-ethereum)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ethereum/go-ethereum?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
-Automated (dev) builds
+Automated development builds
======================
+The following builds are build automatically by our build servers after each push to the [develop](https://github.com/ethereum/go-ethereum/tree/develop) branch.
+
* [Docker](https://registry.hub.docker.com/u/ethereum/client-go/)
* [OS X](http://build.ethdev.com/builds/OSX%20Go%20develop%20branch/Mist-OSX-latest.dmg)
* Ubuntu
[trusty](https://build.ethdev.com/builds/Linux%20Go%20develop%20deb%20i386-trusty/latest/) |
[utopic](https://build.ethdev.com/builds/Linux%20Go%20develop%20deb%20i386-utopic/latest/)
-* [Windows 64-bit](https://build.ethdev.com/builds/Windows%20Go%20develop%20branch/Geth-Win64-latest.7z)
+* [Windows 64-bit](https://build.ethdev.com/builds/Windows%20Go%20develop%20branch/Geth-Win64-latest.zip)
Building the source
===================
diff --git a/common/compiler/solidity_test.go b/common/compiler/solidity_test.go
index 46f733e59..59b6b6cd6 100644
--- a/common/compiler/solidity_test.go
+++ b/common/compiler/solidity_test.go
@@ -31,7 +31,7 @@ func TestCompiler(t *testing.T) {
if err != nil {
t.Skip("solc not found: skip")
} else if sol.Version() != solcVersion {
- t.Logf("WARNING: a newer version of solc found (%v, expect %v)", sol.Version(), solcVersion)
+ t.Skip("WARNING: skipping due to a newer version of solc found (%v, expect %v)", sol.Version(), solcVersion)
}
contracts, err := sol.Compile(source)
if err != nil {
@@ -54,7 +54,7 @@ func TestCompileError(t *testing.T) {
if err != nil || sol.version != solcVersion {
t.Skip("solc not found: skip")
} else if sol.Version() != solcVersion {
- t.Logf("WARNING: a newer version of solc found (%v, expect %v)", sol.Version(), solcVersion)
+ t.Skip("WARNING: skipping due to a newer version of solc found (%v, expect %v)", sol.Version(), solcVersion)
}
contracts, err := sol.Compile(source[2:])
if err == nil {
diff --git a/core/filter.go b/core/filter.go
index 2ca57da65..fcdf68dd0 100644
--- a/core/filter.go
+++ b/core/filter.go
@@ -1,6 +1,7 @@
package core
import (
+ "fmt"
"math"
"github.com/ethereum/go-ethereum/common"
@@ -75,15 +76,19 @@ func (self *Filter) Find() state.Logs {
var (
logs state.Logs
block = self.eth.ChainManager().GetBlockByNumber(latestBlockNo)
- quit bool
)
- for i := 0; !quit && block != nil; i++ {
+
+done:
+ for i := 0; block != nil; i++ {
+ fmt.Println(block.NumberU64() == 0)
// Quit on latest
switch {
- case block.NumberU64() == earliestBlockNo, block.NumberU64() == 0:
- quit = true
+ case block.NumberU64() == 0:
+ break done
+ case block.NumberU64() == earliestBlockNo:
+ break done
case self.max <= len(logs):
- break
+ break done
}
// Use bloom filtering to see if this block is interesting given the
diff --git a/rpc/api.go b/rpc/api.go
index 6b37acb03..e35395734 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -182,7 +182,21 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
nonce = args.Nonce.String()
}
- v, err := api.xeth().Transact(args.From, args.To, nonce, args.Value.String(), args.Gas.String(), args.GasPrice.String(), args.Data)
+ var gas string
+ if args.Gas == nil {
+ gas = ""
+ } else {
+ gas = args.Gas.String()
+ }
+
+ var gasprice string
+ if args.GasPrice == nil {
+ gasprice = ""
+ } else {
+ gasprice = args.GasPrice.String()
+ }
+
+ v, err := api.xeth().Transact(args.From, args.To, nonce, args.Value.String(), gas, gasprice, args.Data)
if err != nil {
return err
}
@@ -603,5 +617,19 @@ func (api *EthereumApi) doCall(params json.RawMessage) (string, string, error) {
return "", "", err
}
- return api.xethAtStateNum(args.BlockNumber).Call(args.From, args.To, args.Value.String(), args.Gas.String(), args.GasPrice.String(), args.Data)
+ var gas string
+ if args.Gas == nil {
+ gas = ""
+ } else {
+ gas = args.Gas.String()
+ }
+
+ var gasprice string
+ if args.GasPrice == nil {
+ gasprice = ""
+ } else {
+ gasprice = args.GasPrice.String()
+ }
+
+ return api.xethAtStateNum(args.BlockNumber).Call(args.From, args.To, args.Value.String(), gas, gasprice, args.Data)
}
diff --git a/rpc/args.go b/rpc/args.go
index 686872a59..65f0f6043 100644
--- a/rpc/args.go
+++ b/rpc/args.go
@@ -172,13 +172,8 @@ type NewSigArgs struct {
}
func (args *NewSigArgs) UnmarshalJSON(b []byte) (err error) {
- var obj []json.RawMessage
- var ext struct {
- From string
- Data string
- }
+ var obj []interface{}
- // Decode byte slice to array of RawMessages
if err := json.Unmarshal(b, &obj); err != nil {
return NewDecodeParamError(err.Error())
}
@@ -188,21 +183,26 @@ func (args *NewSigArgs) UnmarshalJSON(b []byte) (err error) {
return NewInsufficientParamsError(len(obj), 1)
}
- // Decode 0th RawMessage to temporary struct
- if err := json.Unmarshal(obj[0], &ext); err != nil {
- return NewDecodeParamError(err.Error())
+ from, ok := obj[0].(string)
+ if !ok {
+ return NewInvalidTypeError("from", "not a string")
}
+ args.From = from
- if len(ext.From) == 0 {
+ if len(args.From) == 0 {
return NewValidationError("from", "is required")
}
- if len(ext.Data) == 0 {
+ data, ok := obj[1].(string)
+ if !ok {
+ return NewInvalidTypeError("data", "not a string")
+ }
+ args.Data = data
+
+ if len(args.Data) == 0 {
return NewValidationError("data", "is required")
}
- args.From = ext.From
- args.Data = ext.Data
return nil
}
@@ -261,22 +261,22 @@ func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) {
args.Value = num
num = nil
- if ext.Gas == nil {
- num = big.NewInt(0)
- } else {
+ if ext.Gas != nil {
if num, err = numString(ext.Gas); err != nil {
return err
}
+ } else {
+ num = nil
}
args.Gas = num
num = nil
- if ext.GasPrice == nil {
- num = big.NewInt(0)
- } else {
+ if ext.GasPrice != nil {
if num, err = numString(ext.GasPrice); err != nil {
return err
}
+ } else {
+ num = nil
}
args.GasPrice = num
@@ -346,21 +346,21 @@ func (args *CallArgs) UnmarshalJSON(b []byte) (err error) {
}
args.Value = num
- if ext.Gas == nil {
- num = big.NewInt(0)
- } else {
+ if ext.Gas != nil {
if num, err = numString(ext.Gas); err != nil {
return err
}
+ } else {
+ num = nil
}
args.Gas = num
- if ext.GasPrice == nil {
- num = big.NewInt(0)
- } else {
+ if ext.GasPrice != nil {
if num, err = numString(ext.GasPrice); err != nil {
return err
}
+ } else {
+ num = nil
}
args.GasPrice = num
diff --git a/rpc/args_test.go b/rpc/args_test.go
index 09ce12467..fc10d68cf 100644
--- a/rpc/args_test.go
+++ b/rpc/args_test.go
@@ -573,14 +573,15 @@ func TestNewTxArgsGasMissing(t *testing.T) {
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}]`
expected := new(NewTxArgs)
- expected.Gas = big.NewInt(0)
+ expected.Gas = nil
args := new(NewTxArgs)
if err := json.Unmarshal([]byte(input), &args); err != nil {
t.Error(err)
}
- if bytes.Compare(expected.Gas.Bytes(), args.Gas.Bytes()) != 0 {
+ if args.Gas != expected.Gas {
+ // if bytes.Compare(expected.Gas.Bytes(), args.Gas.Bytes()) != 0 {
t.Errorf("Gas shoud be %v but is %v", expected.Gas, args.Gas)
}
}
@@ -594,14 +595,15 @@ func TestNewTxArgsBlockGaspriceMissing(t *testing.T) {
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}]`
expected := new(NewTxArgs)
- expected.GasPrice = big.NewInt(0)
+ expected.GasPrice = nil
args := new(NewTxArgs)
if err := json.Unmarshal([]byte(input), &args); err != nil {
t.Error(err)
}
- if bytes.Compare(expected.GasPrice.Bytes(), args.GasPrice.Bytes()) != 0 {
+ if args.GasPrice != expected.GasPrice {
+ // if bytes.Compare(expected.GasPrice.Bytes(), args.GasPrice.Bytes()) != 0 {
t.Errorf("GasPrice shoud be %v but is %v", expected.GasPrice, args.GasPrice)
}
@@ -829,9 +831,10 @@ func TestCallArgsGasMissing(t *testing.T) {
}
expected := new(CallArgs)
- expected.Gas = big.NewInt(0)
+ expected.Gas = nil
- if bytes.Compare(expected.Gas.Bytes(), args.Gas.Bytes()) != 0 {
+ if args.Gas != expected.Gas {
+ // if bytes.Compare(expected.Gas.Bytes(), args.Gas.Bytes()) != 0 {
t.Errorf("Gas shoud be %v but is %v", expected.Gas, args.Gas)
}
@@ -852,9 +855,10 @@ func TestCallArgsBlockGaspriceMissing(t *testing.T) {
}
expected := new(CallArgs)
- expected.GasPrice = big.NewInt(0)
+ expected.GasPrice = nil
- if bytes.Compare(expected.GasPrice.Bytes(), args.GasPrice.Bytes()) != 0 {
+ if args.GasPrice != expected.GasPrice {
+ // if bytes.Compare(expected.GasPrice.Bytes(), args.GasPrice.Bytes()) != 0 {
t.Errorf("GasPrice shoud be %v but is %v", expected.GasPrice, args.GasPrice)
}
}
@@ -2504,3 +2508,64 @@ func TestSourceArgsEmpty(t *testing.T) {
t.Error(str)
}
}
+
+func TestSigArgs(t *testing.T) {
+ input := `["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", "0x0"]`
+ expected := new(NewSigArgs)
+ expected.From = "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"
+ expected.Data = "0x0"
+
+ args := new(NewSigArgs)
+ if err := json.Unmarshal([]byte(input), &args); err != nil {
+ t.Error(err)
+ }
+}
+
+func TestSigArgsEmptyData(t *testing.T) {
+ input := `["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", ""]`
+
+ args := new(NewSigArgs)
+ str := ExpectValidationError(json.Unmarshal([]byte(input), args))
+ if len(str) > 0 {
+ t.Error(str)
+ }
+}
+
+func TestSigArgsDataType(t *testing.T) {
+ input := `["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", 13]`
+
+ args := new(NewSigArgs)
+ str := ExpectInvalidTypeError(json.Unmarshal([]byte(input), args))
+ if len(str) > 0 {
+ t.Error(str)
+ }
+}
+
+func TestSigArgsEmptyFrom(t *testing.T) {
+ input := `["", "0x0"]`
+
+ args := new(NewSigArgs)
+ str := ExpectValidationError(json.Unmarshal([]byte(input), args))
+ if len(str) > 0 {
+ t.Error(str)
+ }
+}
+
+func TestSigArgsFromType(t *testing.T) {
+ input := `[false, "0x0"]`
+
+ args := new(NewSigArgs)
+ str := ExpectInvalidTypeError(json.Unmarshal([]byte(input), args))
+ if len(str) > 0 {
+ t.Error(str)
+ }
+}
+
+func TestSigArgsEmpty(t *testing.T) {
+ input := `[]`
+ args := new(NewSigArgs)
+ str := ExpectInsufficientParamsError(json.Unmarshal([]byte(input), args))
+ if len(str) > 0 {
+ t.Error(str)
+ }
+}
diff --git a/xeth/xeth.go b/xeth/xeth.go
index d0d51bfe0..9b49b412c 100644
--- a/xeth/xeth.go
+++ b/xeth/xeth.go
@@ -885,12 +885,29 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS
from = common.HexToAddress(fromStr)
to = common.HexToAddress(toStr)
value = common.Big(valueStr)
- gas = common.Big(gasStr)
- price = common.Big(gasPriceStr)
+ gas *big.Int
+ price *big.Int
data []byte
contractCreation bool
)
+ if len(gasStr) == 0 {
+ gas = DefaultGas()
+ } else {
+ gas = common.Big(gasStr)
+ }
+
+ if len(gasPriceStr) == 0 {
+ price = DefaultGasPrice()
+ } else {
+ price = common.Big(gasPriceStr)
+ }
+
+ data = common.FromHex(codeStr)
+ if len(toStr) == 0 {
+ contractCreation = true
+ }
+
// 2015-05-18 Is this still needed?
// TODO if no_private_key then
//if _, exists := p.register[args.From]; exists {
@@ -916,18 +933,6 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS
// TODO: align default values to have the same type, e.g. not depend on
// common.Value conversions later on
- if gas.Cmp(big.NewInt(0)) == 0 {
- gas = DefaultGas()
- }
-
- if price.Cmp(big.NewInt(0)) == 0 {
- price = DefaultGasPrice()
- }
-
- data = common.FromHex(codeStr)
- if len(toStr) == 0 {
- contractCreation = true
- }
var tx *types.Transaction
if contractCreation {