Skip to content

Commit 3a0bc72

Browse files
Merge tag 'v1.6.7'
2 parents 6d29146 + ab5646c commit 3a0bc72

File tree

1,062 files changed

+12775
-2510443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,062 files changed

+12775
-2510443
lines changed

.dockerignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
.git
1+
**/.git
2+
**/*_test.go
3+
24
build/_workspace
35
build/_bin
6+
tests/testdata

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "tests"]
2+
path = tests/testdata
3+
url = https://github.com/ethereum/tests

Makefile

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# with Go source code. If you know what GOPATH is then you probably
33
# don't need to bother with make.
44

5-
.PHONY: gsoil android ios gsoil-cross evm all test clean
5+
.PHONY: gsoil android ios gsoil-cross swarm evm all test clean
66
.PHONY: gsoil-linux gsoil-linux-386 gsoil-linux-amd64 gsoil-linux-mips64 gsoil-linux-mips64le
77
.PHONY: gsoil-linux-arm gsoil-linux-arm-5 gsoil-linux-arm-6 gsoil-linux-arm-7 gsoil-linux-arm64
88
.PHONY: gsoil-darwin gsoil-darwin-386 gsoil-darwin-amd64
@@ -16,6 +16,11 @@ gsoil:
1616
@echo "Done building."
1717
@echo "Run \"$(GOBIN)/gsoil\" to launch gsoil."
1818

19+
swarm:
20+
build/env.sh go run build/ci.go install ./cmd/swarm
21+
@echo "Done building."
22+
@echo "Run \"$(GOBIN)/swarm\" to launch swarm."
23+
1924
evm:
2025
build/env.sh go run build/ci.go install ./cmd/evm
2126
@echo "Done building."
@@ -32,7 +37,7 @@ android:
3237
ios:
3338
build/env.sh go run build/ci.go xcode --local
3439
@echo "Done building."
35-
@echo "Import \"$(GOBIN)/gsoil.framework\" to use the library."
40+
@echo "Import \"$(GOBIN)/Geth.framework\" to use the library."
3641

3742
test: all
3843
build/env.sh go run build/ci.go test

README.md

+63-57
Large diffs are not rendered by default.

README.md.orig

+32-23
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
<<<<<<< HEAD
12
## Soil Go
3+
=======
4+
## Go Ethereum
5+
>>>>>>> v1.6.7
26

37
Official golang implementation of the Soil protocol.
48

@@ -28,13 +32,23 @@ The go-soil project comes with several wrappers/executables found in the `cmd` d
2832

2933
| Command | Description |
3034
|:----------:|-------------|
35+
<<<<<<< HEAD
3136
| **`gsoil`** | Our main Soil CLI client. It is the entry point into the Soil network (main-, test- or private net), capable of running as a full node (default) archive node (retaining all historical state) or a light node (retrieving data live). It can be used by other processes as a gateway into the Soil network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports. `gsoil --help` and the [CLI Wiki page](https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options) for command line options |
3237
| `abigen` | Source code generator to convert Soil contract definitions into easy to use, compile-time type-safe Go packages. It operates on plain [Soil contract ABIs](https://github.com/ethereum/wiki/wiki/Soil-Contract-ABI) with expanded functionality if the contract bytecode is also available. However it also accepts Solidity source files, making development much more streamlined. Please see our [Native DApps](https://github.com/ethereum/go-ethereum/wiki/Native-DApps:-Go-bindings-to-Soil-contracts) wiki page for details. |
3338
| `bootnode` | Stripped down version of our Soil client implementation that only takes part in the network node discovery protocol, but does not run any of the higher level application protocols. It can be used as a lightweight bootstrap node to aid in finding peers in private networks. |
3439
| `disasm` | Bytecode disassembler to convert EVM (Soil Virtual Machine) bytecode into more user friendly assembly-like opcodes (e.g. `echo "6001" | disasm`). For details on the individual opcodes, please see pages 22-30 of the [Soil Yellow Paper](http://gavwood.com/paper.pdf). |
3540
| `evm` | Developer utility version of the EVM (Soil Virtual Machine) that is capable of running bytecode snippets within a configurable environment and execution mode. Its purpose is to allow insolated, fine-grained debugging of EVM opcodes (e.g. `evm --code 60ff60ff --debug`). |
3641
| `gethrpctest` | Developer utility tool to support our [ethereum/rpc-test](https://github.com/ethereum/rpc-tests) test suite which validates baseline conformity to the [Soil JSON RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC) specs. Please see the [test suite's readme](https://github.com/ethereum/rpc-tests/blob/master/README.md) for details. |
3742
| `rlpdump` | Developer utility tool to convert binary RLP ([Recursive Length Prefix](https://github.com/ethereum/wiki/wiki/RLP)) dumps (data encoding used by the Soil protocol both network as well as consensus wise) to user friendlier hierarchical representation (e.g. `rlpdump --hex CE0183FFFFFFC4C304050583616263`). |
43+
=======
44+
| **`geth`** | Our main Ethereum CLI client. It is the entry point into the Ethereum network (main-, test- or private net), capable of running as a full node (default) archive node (retaining all historical state) or a light node (retrieving data live). It can be used by other processes as a gateway into the Ethereum network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports. `geth --help` and the [CLI Wiki page](https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options) for command line options. |
45+
| `abigen` | Source code generator to convert Ethereum contract definitions into easy to use, compile-time type-safe Go packages. It operates on plain [Ethereum contract ABIs](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI) with expanded functionality if the contract bytecode is also available. However it also accepts Solidity source files, making development much more streamlined. Please see our [Native DApps](https://github.com/ethereum/go-ethereum/wiki/Native-DApps:-Go-bindings-to-Ethereum-contracts) wiki page for details. |
46+
| `bootnode` | Stripped down version of our Ethereum client implementation that only takes part in the network node discovery protocol, but does not run any of the higher level application protocols. It can be used as a lightweight bootstrap node to aid in finding peers in private networks. |
47+
| `disasm` | Bytecode disassembler to convert EVM (Ethereum Virtual Machine) bytecode into more user friendly assembly-like opcodes (e.g. `echo "6001" | disasm`). For details on the individual opcodes, please see pages 22-30 of the [Ethereum Yellow Paper](http://gavwood.com/paper.pdf). |
48+
| `evm` | Developer utility version of the EVM (Ethereum Virtual Machine) that is capable of running bytecode snippets within a configurable environment and execution mode. Its purpose is to allow insolated, fine-grained debugging of EVM opcodes (e.g. `evm --code 60ff60ff --debug`). |
49+
| `gethrpctest` | Developer utility tool to support our [ethereum/rpc-test](https://github.com/ethereum/rpc-tests) test suite which validates baseline conformity to the [Ethereum JSON RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC) specs. Please see the [test suite's readme](https://github.com/ethereum/rpc-tests/blob/master/README.md) for details. |
50+
| `rlpdump` | Developer utility tool to convert binary RLP ([Recursive Length Prefix](https://github.com/ethereum/wiki/wiki/RLP)) dumps (data encoding used by the Ethereum protocol both network as well as consensus wise) to user friendlier hierarchical representation (e.g. `rlpdump --hex CE0183FFFFFFC4C304050583616263`). |
51+
>>>>>>> v1.6.7
3852
| `swarm` | swarm daemon and tools. This is the entrypoint for the swarm network. `swarm --help` for command line options and subcommands. See https://swarm-guide.readthedocs.io for swarm documentation. |
3953

4054
## Running gsoil
@@ -64,15 +78,9 @@ This command will:
6478
you'd like, though we'd recommend the 512MB - 2GB range.
6579
* Start up Gsoil's built-in interactive [JavaScript console](https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console),
6680
(via the trailing `console` subcommand) through which you can invoke all official [`web3` methods](https://github.com/ethereum/wiki/wiki/JavaScript-API)
67-
<<<<<<< HEAD
6881
as well as Gsoil's own [management APIs](https://github.com/ethereum/go-ethereum/wiki/Management-APIs).
6982
This too is optional and if you leave it out you can always attach to an already running Gsoil instance
7083
with `gsoil --attach`.
71-
=======
72-
as well as Geth's own [management APIs](https://github.com/ethereum/go-ethereum/wiki/Management-APIs).
73-
This too is optional and if you leave it out you can always attach to an already running Geth instance
74-
with `geth attach`.
75-
>>>>>>> upstream/master
7684

7785
### Full node on the Soil test network
7886

@@ -86,36 +94,37 @@ $ gsoil --testnet --fast --cache=512 console
8694
```
8795

8896
The `--fast`, `--cache` flags and `console` subcommand have the exact same meaning as above and they
89-
are equally useful on the testnet too. Please see above for their explanations if you've skipped to
97+
are equially useful on the testnet too. Please see above for their explanations if you've skipped to
9098
here.
9199

92100
Specifying the `--testnet` flag however will reconfigure your Gsoil instance a bit:
93101

94-
<<<<<<< HEAD
95102
* Instead of using the default data directory (`~/.ethereum` on Linux for example), Gsoil will nest
96103
itself one level deeper into a `testnet` subfolder (`~/.ethereum/testnet` on Linux).
97104
* Instead of connecting the main Soil network, the client will connect to the test network,
98-
=======
99-
* Instead of using the default data directory (`~/.ethereum` on Linux for example), Geth will nest
100-
itself one level deeper into a `testnet` subfolder (`~/.ethereum/testnet` on Linux). Note, on OSX
101-
and Linux this also means that attaching to a running testnet node requires the use of a custom
102-
endpoint since `geth attach` will try to attach to a production node endpoint by default. E.g.
103-
`geth attach <datadir>/testnet/geth.ipc`. Windows users are not affected by this.
104-
* Instead of connecting the main Ethereum network, the client will connect to the test network,
105-
>>>>>>> upstream/master
106105
which uses different P2P bootnodes, different network IDs and genesis states.
107-
106+
108107
*Note: Although there are some internal protective measures to prevent transactions from crossing
109-
<<<<<<< HEAD
110108
over between the main network and test network (different starting nonces), you should make sure to
111109
always use separate accounts for play-money and real-money. Unless you manually move accounts, Gsoil
112110
will by default correctly separate the two networks and will not make any accounts available between
113111
them.*
114-
=======
115-
over between the main network and test network, you should make sure to always use separate accounts
116-
for play-money and real-money. Unless you manually move accounts, Geth will by default correctly
117-
separate the two networks and will not make any accounts available between them.*
118-
>>>>>>> upstream/master
112+
113+
### Configuration
114+
115+
As an alternative to passing the numerous flags to the `geth` binary, you can also pass a configuration file via:
116+
117+
```
118+
$ geth --config /path/to/your_config.toml
119+
```
120+
121+
To get an idea how the file should look like you can use the `dumpconfig` subcommand to export your existing configuration:
122+
123+
```
124+
$ geth --your-favourite-flags dumpconfig
125+
```
126+
127+
*Note: This works only with geth v1.6.0 and above*
119128

120129
#### Docker quick start
121130

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.6.6
1+
1.6.7

accounts/abi/abi.go

+1-196
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717
package abi
1818

1919
import (
20-
"encoding/binary"
2120
"encoding/json"
2221
"fmt"
2322
"io"
24-
"math/big"
2523
"reflect"
2624
"strings"
2725

@@ -67,7 +65,7 @@ func (abi ABI) Pack(name string, args ...interface{}) ([]byte, error) {
6765
}
6866
method = m
6967
}
70-
arguments, err := method.pack(method, args...)
68+
arguments, err := method.pack(args...)
7169
if err != nil {
7270
return nil, err
7371
}
@@ -78,199 +76,6 @@ func (abi ABI) Pack(name string, args ...interface{}) ([]byte, error) {
7876
return append(method.Id(), arguments...), nil
7977
}
8078

81-
// toGoSliceType parses the input and casts it to the proper slice defined by the ABI
82-
// argument in T.
83-
func toGoSlice(i int, t Argument, output []byte) (interface{}, error) {
84-
index := i * 32
85-
// The slice must, at very least be large enough for the index+32 which is exactly the size required
86-
// for the [offset in output, size of offset].
87-
if index+32 > len(output) {
88-
return nil, fmt.Errorf("abi: cannot marshal in to go slice: insufficient size output %d require %d", len(output), index+32)
89-
}
90-
elem := t.Type.Elem
91-
92-
// first we need to create a slice of the type
93-
var refSlice reflect.Value
94-
switch elem.T {
95-
case IntTy, UintTy, BoolTy:
96-
// create a new reference slice matching the element type
97-
switch t.Type.Kind {
98-
case reflect.Bool:
99-
refSlice = reflect.ValueOf([]bool(nil))
100-
case reflect.Uint8:
101-
refSlice = reflect.ValueOf([]uint8(nil))
102-
case reflect.Uint16:
103-
refSlice = reflect.ValueOf([]uint16(nil))
104-
case reflect.Uint32:
105-
refSlice = reflect.ValueOf([]uint32(nil))
106-
case reflect.Uint64:
107-
refSlice = reflect.ValueOf([]uint64(nil))
108-
case reflect.Int8:
109-
refSlice = reflect.ValueOf([]int8(nil))
110-
case reflect.Int16:
111-
refSlice = reflect.ValueOf([]int16(nil))
112-
case reflect.Int32:
113-
refSlice = reflect.ValueOf([]int32(nil))
114-
case reflect.Int64:
115-
refSlice = reflect.ValueOf([]int64(nil))
116-
default:
117-
refSlice = reflect.ValueOf([]*big.Int(nil))
118-
}
119-
case AddressTy: // address must be of slice Address
120-
refSlice = reflect.ValueOf([]common.Address(nil))
121-
case HashTy: // hash must be of slice hash
122-
refSlice = reflect.ValueOf([]common.Hash(nil))
123-
case FixedBytesTy:
124-
refSlice = reflect.ValueOf([][]byte(nil))
125-
default: // no other types are supported
126-
return nil, fmt.Errorf("abi: unsupported slice type %v", elem.T)
127-
}
128-
129-
var slice []byte
130-
var size int
131-
var offset int
132-
if t.Type.IsSlice {
133-
// get the offset which determines the start of this array ...
134-
offset = int(binary.BigEndian.Uint64(output[index+24 : index+32]))
135-
if offset+32 > len(output) {
136-
return nil, fmt.Errorf("abi: cannot marshal in to go slice: offset %d would go over slice boundary (len=%d)", len(output), offset+32)
137-
}
138-
139-
slice = output[offset:]
140-
// ... starting with the size of the array in elements ...
141-
size = int(binary.BigEndian.Uint64(slice[24:32]))
142-
slice = slice[32:]
143-
// ... and make sure that we've at the very least the amount of bytes
144-
// available in the buffer.
145-
if size*32 > len(slice) {
146-
return nil, fmt.Errorf("abi: cannot marshal in to go slice: insufficient size output %d require %d", len(output), offset+32+size*32)
147-
}
148-
149-
// reslice to match the required size
150-
slice = slice[:size*32]
151-
} else if t.Type.IsArray {
152-
//get the number of elements in the array
153-
size = t.Type.SliceSize
154-
155-
//check to make sure array size matches up
156-
if index+32*size > len(output) {
157-
return nil, fmt.Errorf("abi: cannot marshal in to go array: offset %d would go over slice boundary (len=%d)", len(output), index+32*size)
158-
}
159-
//slice is there for a fixed amount of times
160-
slice = output[index : index+size*32]
161-
}
162-
163-
for i := 0; i < size; i++ {
164-
var (
165-
inter interface{} // interface type
166-
returnOutput = slice[i*32 : i*32+32] // the return output
167-
)
168-
// set inter to the correct type (cast)
169-
switch elem.T {
170-
case IntTy, UintTy:
171-
inter = readInteger(t.Type.Kind, returnOutput)
172-
case BoolTy:
173-
inter = !allZero(returnOutput)
174-
case AddressTy:
175-
inter = common.BytesToAddress(returnOutput)
176-
case HashTy:
177-
inter = common.BytesToHash(returnOutput)
178-
case FixedBytesTy:
179-
inter = returnOutput
180-
}
181-
// append the item to our reflect slice
182-
refSlice = reflect.Append(refSlice, reflect.ValueOf(inter))
183-
}
184-
185-
// return the interface
186-
return refSlice.Interface(), nil
187-
}
188-
189-
func readInteger(kind reflect.Kind, b []byte) interface{} {
190-
switch kind {
191-
case reflect.Uint8:
192-
return uint8(b[len(b)-1])
193-
case reflect.Uint16:
194-
return binary.BigEndian.Uint16(b[len(b)-2:])
195-
case reflect.Uint32:
196-
return binary.BigEndian.Uint32(b[len(b)-4:])
197-
case reflect.Uint64:
198-
return binary.BigEndian.Uint64(b[len(b)-8:])
199-
case reflect.Int8:
200-
return int8(b[len(b)-1])
201-
case reflect.Int16:
202-
return int16(binary.BigEndian.Uint16(b[len(b)-2:]))
203-
case reflect.Int32:
204-
return int32(binary.BigEndian.Uint32(b[len(b)-4:]))
205-
case reflect.Int64:
206-
return int64(binary.BigEndian.Uint64(b[len(b)-8:]))
207-
default:
208-
return new(big.Int).SetBytes(b)
209-
}
210-
}
211-
212-
func allZero(b []byte) bool {
213-
for _, byte := range b {
214-
if byte != 0 {
215-
return false
216-
}
217-
}
218-
return true
219-
}
220-
221-
// toGoType parses the input and casts it to the proper type defined by the ABI
222-
// argument in T.
223-
func toGoType(i int, t Argument, output []byte) (interface{}, error) {
224-
// we need to treat slices differently
225-
if (t.Type.IsSlice || t.Type.IsArray) && t.Type.T != BytesTy && t.Type.T != StringTy && t.Type.T != FixedBytesTy && t.Type.T != FunctionTy {
226-
return toGoSlice(i, t, output)
227-
}
228-
229-
index := i * 32
230-
if index+32 > len(output) {
231-
return nil, fmt.Errorf("abi: cannot marshal in to go type: length insufficient %d require %d", len(output), index+32)
232-
}
233-
234-
// Parse the given index output and check whether we need to read
235-
// a different offset and length based on the type (i.e. string, bytes)
236-
var returnOutput []byte
237-
switch t.Type.T {
238-
case StringTy, BytesTy: // variable arrays are written at the end of the return bytes
239-
// parse offset from which we should start reading
240-
offset := int(binary.BigEndian.Uint64(output[index+24 : index+32]))
241-
if offset+32 > len(output) {
242-
return nil, fmt.Errorf("abi: cannot marshal in to go type: length insufficient %d require %d", len(output), offset+32)
243-
}
244-
// parse the size up until we should be reading
245-
size := int(binary.BigEndian.Uint64(output[offset+24 : offset+32]))
246-
if offset+32+size > len(output) {
247-
return nil, fmt.Errorf("abi: cannot marshal in to go type: length insufficient %d require %d", len(output), offset+32+size)
248-
}
249-
250-
// get the bytes for this return value
251-
returnOutput = output[offset+32 : offset+32+size]
252-
default:
253-
returnOutput = output[index : index+32]
254-
}
255-
256-
// convert the bytes to whatever is specified by the ABI.
257-
switch t.Type.T {
258-
case IntTy, UintTy:
259-
return readInteger(t.Type.Kind, returnOutput), nil
260-
case BoolTy:
261-
return !allZero(returnOutput), nil
262-
case AddressTy:
263-
return common.BytesToAddress(returnOutput), nil
264-
case HashTy:
265-
return common.BytesToHash(returnOutput), nil
266-
case BytesTy, FixedBytesTy, FunctionTy:
267-
return returnOutput, nil
268-
case StringTy:
269-
return string(returnOutput), nil
270-
}
271-
return nil, fmt.Errorf("abi: unknown type %v", t.Type.T)
272-
}
273-
27479
// these variable are used to determine certain types during type assertion for
27580
// assignment.
27681
var (

0 commit comments

Comments
 (0)