Skip to content

Commit f9b25e0

Browse files
authored
Merge pull request ethereum#100 from multi-geth/sp-update-upstream-20190611
Update upstream to HEAD 2b54666
2 parents 6148a5d + 18c5098 commit f9b25e0

File tree

811 files changed

+35989
-133392
lines changed

Some content is hidden

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

811 files changed

+35989
-133392
lines changed

.travis.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@ matrix:
66
# These are the latest Go versions.
77
- os: linux
88
dist: xenial
9-
sudo: required
10-
go: 1.11.x
9+
go: 1.12.x
1110
script:
12-
- sudo modprobe fuse
13-
- sudo chmod 666 /dev/fuse
14-
- sudo chown root:$USER /etc/fuse.conf
1511
- go run build/ci.go install
1612
- travis_wait 60 go run build/ci.go test
1713
before_deploy:
@@ -30,7 +26,7 @@ matrix:
3026
tag_name: "$TRAVIS_TAG"
3127

3228
- os: osx
33-
go: 1.11.x
29+
go: 1.12.x
3430
script:
3531
- echo "Increase the maximum number of open file descriptors on macOS"
3632
- NOFILE=20480
@@ -60,7 +56,7 @@ matrix:
6056
# This builder only tests code linters on latest version of Go
6157
- os: linux
6258
dist: xenial
63-
go: 1.11.x
59+
go: 1.12.x
6460
env:
6561
- lint
6662
git:

Makefile

Lines changed: 1 addition & 9 deletions
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: geth android ios geth-cross swarm evm all test clean
5+
.PHONY: geth android ios geth-cross evm all test clean
66
.PHONY: geth-linux geth-linux-386 geth-linux-amd64 geth-linux-mips64 geth-linux-mips64le
77
.PHONY: geth-linux-arm geth-linux-arm-5 geth-linux-arm-6 geth-linux-arm-7 geth-linux-arm64
88
.PHONY: geth-darwin geth-darwin-386 geth-darwin-amd64
@@ -16,11 +16,6 @@ geth:
1616
@echo "Done building."
1717
@echo "Run \"$(GOBIN)/geth\" to launch geth."
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-
2419
all:
2520
build/env.sh go run build/ci.go install
2621

@@ -57,9 +52,6 @@ devtools:
5752
@type "solc" 2> /dev/null || echo 'Please install solc'
5853
@type "protoc" 2> /dev/null || echo 'Please install protoc'
5954

60-
swarm-devtools:
61-
env GOBIN= go install ./cmd/swarm/mimegen
62-
6355
# Cross Compilation Targets (xgo)
6456

6557
geth-cross: geth-linux geth-darwin geth-windows geth-android geth-ios

README.md

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ The go-ethereum project comes with several wrappers/executables found in the `cm
103103
| `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 isolated, fine-grained debugging of EVM opcodes (e.g. `evm --code 60ff60ff --debug`). |
104104
| `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. |
105105
| `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`). |
106-
| `swarm` | Swarm daemon and tools. This is the entry point for the Swarm network. `swarm --help` for command line options and subcommands. See [Swarm README](https://github.com/ethereum/go-ethereum/tree/master/swarm) for more information. |
107106
| `puppeth` | a CLI wizard that aids in creating a new Ethereum network. |
108107

108+
109109
## Running geth
110110

111111
Going through all the possible command line flags is out of scope here (please consult our
@@ -133,12 +133,40 @@ This command will:
133133
(via the trailing `console` subcommand) through which you can invoke all official [`web3` methods](https://github.com/ethereum/wiki/wiki/JavaScript-API)
134134
as well as Geth's own [management APIs](https://github.com/ethereum/go-ethereum/wiki/Management-APIs).
135135
This tool is optional and if you leave it out you can always attach to an already running Geth instance
136-
with `geth attach`.
137-
> To keep the shell clear of event logs while interacting with the JS console, you
138-
> can append `2> stderr.log`, which will redirect the normal stderr log lines to a file for later reference, while
139-
> keeping the console and it's output (on stdout) visible in the shell.
140-
141-
### Full archive node on an Ethereum network
136+
with `geth attach`.
137+
138+
### A Full node on the Ethereum test network
139+
140+
Transitioning towards developers, if you'd like to play around with creating Ethereum contracts, you
141+
almost certainly would like to do that without any real money involved until you get the hang of the
142+
entire system. In other words, instead of attaching to the main network, you want to join the **test**
143+
network with your node, which is fully equivalent to the main network, but with play-Ether only.
144+
145+
```
146+
$ geth --testnet console
147+
```
148+
149+
The `console` subcommand has the exact same meaning as above and they are equally useful on the
150+
testnet too. Please see above for their explanations if you've skipped here.
151+
152+
Specifying the `--testnet` flag, however, will reconfigure your Geth instance a bit:
153+
154+
* Instead of using the default data directory (`~/.ethereum` on Linux for example), Geth will nest
155+
itself one level deeper into a `testnet` subfolder (`~/.ethereum/testnet` on Linux). Note, on OSX
156+
and Linux this also means that attaching to a running testnet node requires the use of a custom
157+
endpoint since `geth attach` will try to attach to a production node endpoint by default. E.g.
158+
`geth attach <datadir>/testnet/geth.ipc`. Windows users are not affected by this.
159+
* Instead of connecting the main Ethereum network, the client will connect to the test network,
160+
which uses different P2P bootnodes, different network IDs and genesis states.
161+
162+
*Note: Although there are some internal protective measures to prevent transactions from crossing
163+
over between the main network and test network, you should make sure to always use separate accounts
164+
for play-money and real-money. Unless you manually move accounts, Geth will by default correctly
165+
separate the two networks and will not make any accounts available between them.*
166+
167+
### Full node on the Rinkeby test network
168+
169+
The above test network is a cross-client one based on the ethash proof-of-work consensus algorithm. As such, it has certain extra overhead and is more susceptible to reorganization attacks due to the network's low difficulty/security. Go Ethereum also supports connecting to a proof-of-authority based test network called [*Rinkeby*](https://www.rinkeby.io) (operated by members of the community). This network is lighter, more secure, but is only supported by go-ethereum.
142170

143171
```
144172
$ geth [|--<chain>] --syncmode=full --gcmode=archive

accounts/abi/abi_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ func TestUnpackMethodIntoMap(t *testing.T) {
785785
if err = abi.UnpackIntoMap(getMap, "get", data); err != nil {
786786
t.Error(err)
787787
}
788-
if len(sendMap) != 1 {
788+
if len(getMap) != 1 {
789789
t.Error("unpacked `get` map expected to have length 1")
790790
}
791791
expectedBytes := []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 88, 0}

accounts/abi/bind/auth.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"io"
2323
"io/ioutil"
2424

25+
"github.com/ethereum/go-ethereum/accounts"
2526
"github.com/ethereum/go-ethereum/accounts/keystore"
2627
"github.com/ethereum/go-ethereum/common"
2728
"github.com/ethereum/go-ethereum/core/types"
@@ -42,6 +43,24 @@ func NewTransactor(keyin io.Reader, passphrase string) (*TransactOpts, error) {
4243
return NewKeyedTransactor(key.PrivateKey), nil
4344
}
4445

46+
// NewTransactor is a utility method to easily create a transaction signer from
47+
// an decrypted key from a keystore
48+
func NewTransactorFromKeyStore(keystore *keystore.KeyStore, account accounts.Account) (*TransactOpts, error) {
49+
return &TransactOpts{
50+
From: account.Address,
51+
Signer: func(signer types.Signer, address common.Address, tx *types.Transaction) (*types.Transaction, error) {
52+
if address != account.Address {
53+
return nil, errors.New("not authorized to sign this account")
54+
}
55+
signature, err := keystore.SignHash(account, signer.Hash(tx).Bytes())
56+
if err != nil {
57+
return nil, err
58+
}
59+
return tx.WithSignature(signer, signature)
60+
},
61+
}, nil
62+
}
63+
4564
// NewKeyedTransactor is a utility method to easily create a transaction signer
4665
// from a single private key.
4766
func NewKeyedTransactor(key *ecdsa.PrivateKey) *TransactOpts {

accounts/accounts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type Account struct {
3636
}
3737

3838
const (
39-
MimetypeTextWithValidator = "text/validator"
39+
MimetypeDataWithValidator = "data/validator"
4040
MimetypeTypedData = "data/typed"
4141
MimetypeClique = "application/x-clique-header"
4242
MimetypeTextPlain = "text/plain"

accounts/keystore/watch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// You should have received a copy of the GNU Lesser General Public License
1515
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
1616

17-
// +build darwin,!ios freebsd linux,!arm64 netbsd solaris
17+
// +build darwin,!ios,cgo freebsd linux,!arm64 netbsd solaris
1818

1919
package keystore
2020

accounts/keystore/watch_fallback.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// You should have received a copy of the GNU Lesser General Public License
1515
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
1616

17-
// +build ios linux,arm64 windows !darwin,!freebsd,!linux,!netbsd,!solaris
17+
// +build darwin,!cgo ios linux,arm64 windows !darwin,!freebsd,!linux,!netbsd,!solaris
1818

1919
// This is the fallback implementation of directory watching.
2020
// It is used on unsupported platforms.

accounts/scwallet/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
Start `geth` with the `console` command. You will notice the following warning:
2626

2727
```
28-
WARN [04-09|16:58:38.898] Failed to open wallet url=pcsc://044def09 err="smartcard: pairing password needed"
28+
WARN [04-09|16:58:38.898] Failed to open wallet url=keycard://044def09 err="smartcard: pairing password needed"
2929
```
3030

31-
Write down the URL (`pcsc://044def09` in this example). Then ask `geth` to open the wallet:
31+
Write down the URL (`keycard://044def09` in this example). Then ask `geth` to open the wallet:
3232

3333
```
34-
> personal.openWallet("pcsc://044def09")
34+
> personal.openWallet("keycard://044def09")
3535
Please enter the pairing password:
3636
```
3737

@@ -42,12 +42,12 @@
4242

4343
```
4444
> personal
45-
WARN [04-09|17:02:07.330] Smartcard wallet account derivation failed url=pcsc://044def09 err="Unexpected response status Cla=0x80, Ins=0xd1, Sw=0x6985"
45+
WARN [04-09|17:02:07.330] Smartcard wallet account derivation failed url=keycard://044def09 err="Unexpected response status Cla=0x80, Ins=0xd1, Sw=0x6985"
4646
{
4747
listAccounts: [],
4848
listWallets: [{
4949
status: "Empty, waiting for initialization",
50-
url: "pcsc://044def09"
50+
url: "keycard://044def09"
5151
}],
5252
...
5353
}
@@ -56,7 +56,7 @@
5656
So the communication with the card is working, but there is no key associated with this wallet. Let's create it:
5757

5858
```
59-
> personal.initializeWallet("pcsc://044def09")
59+
> personal.initializeWallet("keycard://044def09")
6060
"tilt ... impact"
6161
```
6262

@@ -67,10 +67,10 @@
6767
[{
6868
accounts: [{
6969
address: "0x678b7cd55c61917defb23546a41803c5bfefbc7a",
70-
url: "pcsc://044d/m/44'/60'/0'/0/0"
70+
url: "keycard://044d/m/44'/60'/0'/0/0"
7171
}],
7272
status: "Online",
73-
url: "pcsc://044def09"
73+
url: "keycard://044def09"
7474
}]
7575
```
7676

@@ -84,14 +84,14 @@
8484
```
8585
listWallets: [{
8686
status: "Online, can derive public keys",
87-
url: "pcsc://a4d73015"
87+
url: "keycard://a4d73015"
8888
}]
8989
```
9090

9191
3. Open the wallet, you will be prompted for your pairing password, then PIN:
9292

9393
```
94-
personal.openWallet("pcsc://a4d73015")
94+
personal.openWallet("keycard://a4d73015")
9595
```
9696

9797
4. Check that creation was successful by typing e.g. `personal`. Then use it like a regular wallet.

accounts/scwallet/hub.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import (
4949
)
5050

5151
// Scheme is the URI prefix for smartcard wallets.
52-
const Scheme = "pcsc"
52+
const Scheme = "keycard"
5353

5454
// refreshCycle is the maximum time between wallet refreshes (if USB hotplug
5555
// notifications don't work).
@@ -152,8 +152,8 @@ func (hub *Hub) setPairing(wallet *Wallet, pairing *smartcardPairing) error {
152152
}
153153

154154
// NewHub creates a new hardware wallet manager for smartcards.
155-
func NewHub(scheme string, datadir string) (*Hub, error) {
156-
context, err := pcsc.EstablishContext(pcsc.ScopeSystem)
155+
func NewHub(daemonPath string, scheme string, datadir string) (*Hub, error) {
156+
context, err := pcsc.EstablishContext(daemonPath, pcsc.ScopeSystem)
157157
if err != nil {
158158
return nil, err
159159
}

0 commit comments

Comments
 (0)