Merge remote-tracking branch 'refs/remotes/ethereum/master'

This commit is contained in:
Christopher Franko 2017-04-19 13:50:17 -04:00
commit fd5b131723
9 changed files with 121 additions and 119 deletions

View file

@ -217,9 +217,16 @@ func doInstall(cmdline []string) {
} }
func buildFlags(env build.Environment) (flags []string) { func buildFlags(env build.Environment) (flags []string) {
// Set gitCommit constant via link-time assignment. var ld []string
if env.Commit != "" { if env.Commit != "" {
flags = append(flags, "-ldflags", "-X main.gitCommit="+env.Commit) ld = append(ld, "-X", "main.gitCommit="+env.Commit)
}
if runtime.GOOS == "darwin" {
ld = append(ld, "-s")
}
if len(ld) > 0 {
flags = append(flags, "-ldflags", strings.Join(ld, " "))
} }
return flags return flags
} }
@ -266,6 +273,7 @@ func doTest(cmdline []string) {
coverage = flag.Bool("coverage", false, "Whether to record code coverage") coverage = flag.Bool("coverage", false, "Whether to record code coverage")
) )
flag.CommandLine.Parse(cmdline) flag.CommandLine.Parse(cmdline)
env := build.Env()
packages := []string{"./..."} packages := []string{"./..."}
if len(flag.CommandLine.Args()) > 0 { if len(flag.CommandLine.Args()) > 0 {
@ -279,7 +287,7 @@ func doTest(cmdline []string) {
spellcheck(packages) spellcheck(packages)
} }
// Run the actual tests. // Run the actual tests.
gotest := goTool("test") gotest := goTool("test", buildFlags(env)...)
// Test a single package at a time. CI builders are slow // Test a single package at a time. CI builders are slow
// and some tests run into timeouts under load. // and some tests run into timeouts under load.
gotest.Args = append(gotest.Args, "-p", "1") gotest.Args = append(gotest.Args, "-p", "1")

View file

@ -1,4 +1,4 @@
// generated by github.com/fjl/gencodec, do not edit. // Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package core package core
@ -13,31 +13,29 @@ import (
"github.com/expanse-org/go-expanse/params" "github.com/expanse-org/go-expanse/params"
) )
func (g *Genesis) MarshalJSON() ([]byte, error) { func (g Genesis) MarshalJSON() ([]byte, error) {
type GenesisJSON struct { type GenesisJSON struct {
ChainConfig *params.ChainConfig `json:"config" optional:"true"` Config *params.ChainConfig `json:"config" optional:"true"`
Nonce *math.HexOrDecimal64 `json:"nonce" optional:"true"` Nonce math.HexOrDecimal64 `json:"nonce" optional:"true"`
Timestamp *math.HexOrDecimal64 `json:"timestamp" optional:"true"` Timestamp math.HexOrDecimal64 `json:"timestamp" optional:"true"`
ParentHash *common.Hash `json:"parentHash" optional:"true"` ParentHash common.Hash `json:"parentHash" optional:"true"`
ExtraData hexutil.Bytes `json:"extraData" optional:"true"` ExtraData hexutil.Bytes `json:"extraData" optional:"true"`
GasLimit *math.HexOrDecimal64 `json:"gasLimit"` GasLimit math.HexOrDecimal64 `json:"gasLimit"`
Difficulty *math.HexOrDecimal256 `json:"difficulty"` Difficulty *math.HexOrDecimal256 `json:"difficulty"`
Mixhash *common.Hash `json:"mixHash" optional:"true"` Mixhash common.Hash `json:"mixHash" optional:"true"`
Coinbase *common.Address `json:"coinbase" optional:"true"` Coinbase common.Address `json:"coinbase" optional:"true"`
Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc"` Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc"`
} }
var enc GenesisJSON var enc GenesisJSON
enc.ChainConfig = g.Config enc.Config = g.Config
enc.Nonce = (*math.HexOrDecimal64)(&g.Nonce) enc.Nonce = math.HexOrDecimal64(g.Nonce)
enc.Timestamp = (*math.HexOrDecimal64)(&g.Timestamp) enc.Timestamp = math.HexOrDecimal64(g.Timestamp)
enc.ParentHash = &g.ParentHash enc.ParentHash = g.ParentHash
if g.ExtraData != nil { enc.ExtraData = g.ExtraData
enc.ExtraData = g.ExtraData enc.GasLimit = math.HexOrDecimal64(g.GasLimit)
}
enc.GasLimit = (*math.HexOrDecimal64)(&g.GasLimit)
enc.Difficulty = (*math.HexOrDecimal256)(g.Difficulty) enc.Difficulty = (*math.HexOrDecimal256)(g.Difficulty)
enc.Mixhash = &g.Mixhash enc.Mixhash = g.Mixhash
enc.Coinbase = &g.Coinbase enc.Coinbase = g.Coinbase
if g.Alloc != nil { if g.Alloc != nil {
enc.Alloc = make(map[common.UnprefixedAddress]GenesisAccount, len(g.Alloc)) enc.Alloc = make(map[common.UnprefixedAddress]GenesisAccount, len(g.Alloc))
for k, v := range g.Alloc { for k, v := range g.Alloc {
@ -49,24 +47,24 @@ func (g *Genesis) MarshalJSON() ([]byte, error) {
func (g *Genesis) UnmarshalJSON(input []byte) error { func (g *Genesis) UnmarshalJSON(input []byte) error {
type GenesisJSON struct { type GenesisJSON struct {
ChainConfig *params.ChainConfig `json:"config" optional:"true"` Config *params.ChainConfig `json:"config" optional:"true"`
Nonce *math.HexOrDecimal64 `json:"nonce" optional:"true"` Nonce *math.HexOrDecimal64 `json:"nonce" optional:"true"`
Timestamp *math.HexOrDecimal64 `json:"timestamp" optional:"true"` Timestamp *math.HexOrDecimal64 `json:"timestamp" optional:"true"`
ParentHash *common.Hash `json:"parentHash" optional:"true"` ParentHash *common.Hash `json:"parentHash" optional:"true"`
ExtraData hexutil.Bytes `json:"extraData" optional:"true"` ExtraData hexutil.Bytes `json:"extraData" optional:"true"`
GasLimit *math.HexOrDecimal64 `json:"gasLimit"` GasLimit *math.HexOrDecimal64 `json:"gasLimit"`
Difficulty *math.HexOrDecimal256 `json:"difficulty"` Difficulty *math.HexOrDecimal256 `json:"difficulty"`
Mixhash *common.Hash `json:"mixHash" optional:"true"` Mixhash *common.Hash `json:"mixHash" optional:"true"`
Coinbase *common.Address `json:"coinbase" optional:"true"` Coinbase *common.Address `json:"coinbase" optional:"true"`
Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc"` Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc"`
} }
var dec GenesisJSON var dec GenesisJSON
if err := json.Unmarshal(input, &dec); err != nil { if err := json.Unmarshal(input, &dec); err != nil {
return err return err
} }
var x Genesis var x Genesis
if dec.ChainConfig != nil { if dec.Config != nil {
x.Config = dec.ChainConfig x.Config = dec.Config
} }
if dec.Nonce != nil { if dec.Nonce != nil {
x.Nonce = uint64(*dec.Nonce) x.Nonce = uint64(*dec.Nonce)

View file

@ -1,4 +1,4 @@
// generated by github.com/fjl/gencodec, do not edit. // Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package core package core
@ -12,31 +12,27 @@ import (
"github.com/expanse-org/go-expanse/common/math" "github.com/expanse-org/go-expanse/common/math"
) )
func (g *GenesisAccount) MarshalJSON() ([]byte, error) { func (g GenesisAccount) MarshalJSON() ([]byte, error) {
type GenesisAccountJSON struct { type GenesisAccountJSON struct {
Code hexutil.Bytes `json:"code" optional:"true"` Code hexutil.Bytes `json:"code,omitempty" optional:"true"`
Storage map[common.Hash]common.Hash `json:"storage" optional:"true"` Storage map[common.Hash]common.Hash `json:"storage,omitempty" optional:"true"`
Balance *math.HexOrDecimal256 `json:"balance"` Balance *math.HexOrDecimal256 `json:"balance"`
Nonce *math.HexOrDecimal64 `json:"nonce" optional:"true"` Nonce math.HexOrDecimal64 `json:"nonce,omitempty" optional:"true"`
} }
var enc GenesisAccountJSON var enc GenesisAccountJSON
if g.Code != nil { enc.Code = g.Code
enc.Code = g.Code enc.Storage = g.Storage
}
if g.Storage != nil {
enc.Storage = g.Storage
}
enc.Balance = (*math.HexOrDecimal256)(g.Balance) enc.Balance = (*math.HexOrDecimal256)(g.Balance)
enc.Nonce = (*math.HexOrDecimal64)(&g.Nonce) enc.Nonce = math.HexOrDecimal64(g.Nonce)
return json.Marshal(&enc) return json.Marshal(&enc)
} }
func (g *GenesisAccount) UnmarshalJSON(input []byte) error { func (g *GenesisAccount) UnmarshalJSON(input []byte) error {
type GenesisAccountJSON struct { type GenesisAccountJSON struct {
Code hexutil.Bytes `json:"code" optional:"true"` Code hexutil.Bytes `json:"code,omitempty" optional:"true"`
Storage map[common.Hash]common.Hash `json:"storage" optional:"true"` Storage map[common.Hash]common.Hash `json:"storage,omitempty" optional:"true"`
Balance *math.HexOrDecimal256 `json:"balance"` Balance *math.HexOrDecimal256 `json:"balance"`
Nonce *math.HexOrDecimal64 `json:"nonce" optional:"true"` Nonce *math.HexOrDecimal64 `json:"nonce,omitempty" optional:"true"`
} }
var dec GenesisAccountJSON var dec GenesisAccountJSON
if err := json.Unmarshal(input, &dec); err != nil { if err := json.Unmarshal(input, &dec); err != nil {

View file

@ -58,10 +58,10 @@ type GenesisAlloc map[common.Address]GenesisAccount
// GenesisAccount is an account in the state of the genesis block. // GenesisAccount is an account in the state of the genesis block.
type GenesisAccount struct { type GenesisAccount struct {
Code []byte `json:"code" optional:"true"` Code []byte `json:"code,omitempty" optional:"true"`
Storage map[common.Hash]common.Hash `json:"storage" optional:"true"` Storage map[common.Hash]common.Hash `json:"storage,omitempty" optional:"true"`
Balance *big.Int `json:"balance"` Balance *big.Int `json:"balance"`
Nonce uint64 `json:"nonce" optional:"true"` Nonce uint64 `json:"nonce,omitempty" optional:"true"`
} }
// field type overrides for gencodec // field type overrides for gencodec

View file

@ -1,4 +1,4 @@
// generated by github.com/fjl/gencodec, do not edit. // Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package types package types
@ -11,40 +11,40 @@ import (
"github.com/expanse-org/go-expanse/common/hexutil" "github.com/expanse-org/go-expanse/common/hexutil"
) )
func (h *Header) MarshalJSON() ([]byte, error) { func (h Header) MarshalJSON() ([]byte, error) {
type HeaderJSON struct { type HeaderJSON struct {
ParentHash *common.Hash `json:"parentHash"` ParentHash common.Hash `json:"parentHash"`
UncleHash *common.Hash `json:"sha3Uncles"` UncleHash common.Hash `json:"sha3Uncles"`
Coinbase *common.Address `json:"miner"` Coinbase common.Address `json:"miner"`
Root *common.Hash `json:"stateRoot"` Root common.Hash `json:"stateRoot"`
TxHash *common.Hash `json:"transactionsRoot"` TxHash common.Hash `json:"transactionsRoot"`
ReceiptHash *common.Hash `json:"receiptsRoot"` ReceiptHash common.Hash `json:"receiptsRoot"`
Bloom *Bloom `json:"logsBloom"` Bloom Bloom `json:"logsBloom"`
Difficulty *hexutil.Big `json:"difficulty"` Difficulty *hexutil.Big `json:"difficulty"`
Number *hexutil.Big `json:"number"` Number *hexutil.Big `json:"number"`
GasLimit *hexutil.Big `json:"gasLimit"` GasLimit *hexutil.Big `json:"gasLimit"`
GasUsed *hexutil.Big `json:"gasUsed"` GasUsed *hexutil.Big `json:"gasUsed"`
Time *hexutil.Big `json:"timestamp"` Time *hexutil.Big `json:"timestamp"`
Extra hexutil.Bytes `json:"extraData"` Extra hexutil.Bytes `json:"extraData"`
MixDigest *common.Hash `json:"mixHash"` MixDigest common.Hash `json:"mixHash"`
Nonce *BlockNonce `json:"nonce"` Nonce BlockNonce `json:"nonce"`
} }
var enc HeaderJSON var enc HeaderJSON
enc.ParentHash = &h.ParentHash enc.ParentHash = h.ParentHash
enc.UncleHash = &h.UncleHash enc.UncleHash = h.UncleHash
enc.Coinbase = &h.Coinbase enc.Coinbase = h.Coinbase
enc.Root = &h.Root enc.Root = h.Root
enc.TxHash = &h.TxHash enc.TxHash = h.TxHash
enc.ReceiptHash = &h.ReceiptHash enc.ReceiptHash = h.ReceiptHash
enc.Bloom = &h.Bloom enc.Bloom = h.Bloom
enc.Difficulty = (*hexutil.Big)(h.Difficulty) enc.Difficulty = (*hexutil.Big)(h.Difficulty)
enc.Number = (*hexutil.Big)(h.Number) enc.Number = (*hexutil.Big)(h.Number)
enc.GasLimit = (*hexutil.Big)(h.GasLimit) enc.GasLimit = (*hexutil.Big)(h.GasLimit)
enc.GasUsed = (*hexutil.Big)(h.GasUsed) enc.GasUsed = (*hexutil.Big)(h.GasUsed)
enc.Time = (*hexutil.Big)(h.Time) enc.Time = (*hexutil.Big)(h.Time)
enc.Extra = h.Extra enc.Extra = h.Extra
enc.MixDigest = &h.MixDigest enc.MixDigest = h.MixDigest
enc.Nonce = &h.Nonce enc.Nonce = h.Nonce
return json.Marshal(&enc) return json.Marshal(&enc)
} }

View file

@ -1,4 +1,4 @@
// generated by github.com/fjl/gencodec, do not edit. // Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package types package types
@ -10,28 +10,28 @@ import (
"github.com/expanse-org/go-expanse/common/hexutil" "github.com/expanse-org/go-expanse/common/hexutil"
) )
func (l *Log) MarshalJSON() ([]byte, error) { func (l Log) MarshalJSON() ([]byte, error) {
type LogJSON struct { type LogJSON struct {
Address *common.Address `json:"address"` Address common.Address `json:"address"`
Topics []common.Hash `json:"topics"` Topics []common.Hash `json:"topics"`
Data hexutil.Bytes `json:"data"` Data hexutil.Bytes `json:"data"`
BlockNumber *hexutil.Uint64 `json:"blockNumber" optional:"yes"` BlockNumber hexutil.Uint64 `json:"blockNumber" optional:"yes"`
TxHash *common.Hash `json:"transactionHash"` TxHash common.Hash `json:"transactionHash"`
TxIndex *hexutil.Uint `json:"transactionIndex"` TxIndex hexutil.Uint `json:"transactionIndex"`
BlockHash *common.Hash `json:"blockHash" optional:"yes"` BlockHash common.Hash `json:"blockHash" optional:"yes"`
Index *hexutil.Uint `json:"logIndex"` Index hexutil.Uint `json:"logIndex"`
Removed *bool `json:"removed" optional:"yes"` Removed bool `json:"removed" optional:"yes"`
} }
var enc LogJSON var enc LogJSON
enc.Address = &l.Address enc.Address = l.Address
enc.Topics = l.Topics enc.Topics = l.Topics
enc.Data = l.Data enc.Data = l.Data
enc.BlockNumber = (*hexutil.Uint64)(&l.BlockNumber) enc.BlockNumber = hexutil.Uint64(l.BlockNumber)
enc.TxHash = &l.TxHash enc.TxHash = l.TxHash
enc.TxIndex = (*hexutil.Uint)(&l.TxIndex) enc.TxIndex = hexutil.Uint(l.TxIndex)
enc.BlockHash = &l.BlockHash enc.BlockHash = l.BlockHash
enc.Index = (*hexutil.Uint)(&l.Index) enc.Index = hexutil.Uint(l.Index)
enc.Removed = &l.Removed enc.Removed = l.Removed
return json.Marshal(&enc) return json.Marshal(&enc)
} }

View file

@ -1,4 +1,4 @@
// generated by github.com/fjl/gencodec, do not edit. // Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package types package types
@ -11,23 +11,23 @@ import (
"github.com/expanse-org/go-expanse/common/hexutil" "github.com/expanse-org/go-expanse/common/hexutil"
) )
func (r *Receipt) MarshalJSON() ([]byte, error) { func (r Receipt) MarshalJSON() ([]byte, error) {
type ReceiptJSON struct { type ReceiptJSON struct {
PostState hexutil.Bytes `json:"root"` PostState hexutil.Bytes `json:"root"`
CumulativeGasUsed *hexutil.Big `json:"cumulativeGasUsed"` CumulativeGasUsed *hexutil.Big `json:"cumulativeGasUsed"`
Bloom *Bloom `json:"logsBloom"` Bloom Bloom `json:"logsBloom"`
Logs []*Log `json:"logs"` Logs []*Log `json:"logs"`
TxHash *common.Hash `json:"transactionHash"` TxHash common.Hash `json:"transactionHash"`
ContractAddress *common.Address `json:"contractAddress" optional:"true"` ContractAddress common.Address `json:"contractAddress" optional:"true"`
GasUsed *hexutil.Big `json:"gasUsed"` GasUsed *hexutil.Big `json:"gasUsed"`
} }
var enc ReceiptJSON var enc ReceiptJSON
enc.PostState = r.PostState enc.PostState = r.PostState
enc.CumulativeGasUsed = (*hexutil.Big)(r.CumulativeGasUsed) enc.CumulativeGasUsed = (*hexutil.Big)(r.CumulativeGasUsed)
enc.Bloom = &r.Bloom enc.Bloom = r.Bloom
enc.Logs = r.Logs enc.Logs = r.Logs
enc.TxHash = &r.TxHash enc.TxHash = r.TxHash
enc.ContractAddress = &r.ContractAddress enc.ContractAddress = r.ContractAddress
enc.GasUsed = (*hexutil.Big)(r.GasUsed) enc.GasUsed = (*hexutil.Big)(r.GasUsed)
return json.Marshal(&enc) return json.Marshal(&enc)
} }

View file

@ -1,4 +1,4 @@
// generated by github.com/fjl/gencodec, do not edit. // Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package types package types
@ -11,11 +11,11 @@ import (
"github.com/expanse-org/go-expanse/common/hexutil" "github.com/expanse-org/go-expanse/common/hexutil"
) )
func (t *txdata) MarshalJSON() ([]byte, error) { func (t txdata) MarshalJSON() ([]byte, error) {
type txdataJSON struct { type txdataJSON struct {
AccountNonce *hexutil.Uint64 `json:"nonce"` AccountNonce hexutil.Uint64 `json:"nonce"`
Price *hexutil.Big `json:"gasPrice"` Price *hexutil.Big `json:"gasPrice"`
GasLimit *hexutil.Big `json:"gasLimit"` GasLimit *hexutil.Big `json:"gas"`
Recipient *common.Address `json:"to" optional:"yes" rlp:"nil"` Recipient *common.Address `json:"to" optional:"yes" rlp:"nil"`
Amount *hexutil.Big `json:"value"` Amount *hexutil.Big `json:"value"`
Payload hexutil.Bytes `json:"input"` Payload hexutil.Bytes `json:"input"`
@ -25,7 +25,7 @@ func (t *txdata) MarshalJSON() ([]byte, error) {
Hash *common.Hash `json:"hash" optional:"yes" rlp:"-"` Hash *common.Hash `json:"hash" optional:"yes" rlp:"-"`
} }
var enc txdataJSON var enc txdataJSON
enc.AccountNonce = (*hexutil.Uint64)(&t.AccountNonce) enc.AccountNonce = hexutil.Uint64(t.AccountNonce)
enc.Price = (*hexutil.Big)(t.Price) enc.Price = (*hexutil.Big)(t.Price)
enc.GasLimit = (*hexutil.Big)(t.GasLimit) enc.GasLimit = (*hexutil.Big)(t.GasLimit)
enc.Recipient = t.Recipient enc.Recipient = t.Recipient
@ -42,7 +42,7 @@ func (t *txdata) UnmarshalJSON(input []byte) error {
type txdataJSON struct { type txdataJSON struct {
AccountNonce *hexutil.Uint64 `json:"nonce"` AccountNonce *hexutil.Uint64 `json:"nonce"`
Price *hexutil.Big `json:"gasPrice"` Price *hexutil.Big `json:"gasPrice"`
GasLimit *hexutil.Big `json:"gasLimit"` GasLimit *hexutil.Big `json:"gas"`
Recipient *common.Address `json:"to" optional:"yes" rlp:"nil"` Recipient *common.Address `json:"to" optional:"yes" rlp:"nil"`
Amount *hexutil.Big `json:"value"` Amount *hexutil.Big `json:"value"`
Payload hexutil.Bytes `json:"input"` Payload hexutil.Bytes `json:"input"`
@ -65,7 +65,7 @@ func (t *txdata) UnmarshalJSON(input []byte) error {
} }
x.Price = (*big.Int)(dec.Price) x.Price = (*big.Int)(dec.Price)
if dec.GasLimit == nil { if dec.GasLimit == nil {
return errors.New("missing required field 'gasLimit' for txdata") return errors.New("missing required field 'gas' for txdata")
} }
x.GasLimit = (*big.Int)(dec.GasLimit) x.GasLimit = (*big.Int)(dec.GasLimit)
if dec.Recipient != nil { if dec.Recipient != nil {

View file

@ -57,7 +57,7 @@ type Transaction struct {
type txdata struct { type txdata struct {
AccountNonce uint64 `json:"nonce"` AccountNonce uint64 `json:"nonce"`
Price *big.Int `json:"gasPrice"` Price *big.Int `json:"gasPrice"`
GasLimit *big.Int `json:"gasLimit"` GasLimit *big.Int `json:"gas"`
Recipient *common.Address `json:"to" optional:"yes" rlp:"nil"` // nil means contract creation Recipient *common.Address `json:"to" optional:"yes" rlp:"nil"` // nil means contract creation
Amount *big.Int `json:"value"` Amount *big.Int `json:"value"`
Payload []byte `json:"input"` Payload []byte `json:"input"`