Commit Graph

13245 Commits

Author SHA1 Message Date
Suriyaa Sundararuban
9e08f7759f SECURITY.md: link to release page (#22067)
Add links to go-ethereum's GitHub release page.

Co-authored-by: Felix Lange <fjl@twurst.com>
2021-03-09 10:14:23 +01:00
rene
b734ae5e54 node: rename startNetworking to openEndpoints (#22105) 2021-03-09 10:14:13 +01:00
Vie
767a37fbeb cmd/geth: update copyright year (#22099)
# Conflicts:
#	cmd/geth/main.go
2021-03-09 10:14:06 +01:00
Melvin Junhee Woo
0699dae18a core/state/snapshot: gethring -> gathering typo (#22104)
# Conflicts:
#	core/state/snapshot/generate.go
2021-03-09 10:13:46 +01:00
yumiel yoomee1313
830b77785c accounts/abi/bind: fix erroneous test (#22053)
closes #22049
2021-03-09 10:13:28 +01:00
ucwong
c288146cdc core/rawdb, eth/protocols : Method name typo fix (#22026)
# Conflicts:
#	core/rawdb/accessors_snapshot.go
2021-03-09 10:13:21 +01:00
Suriyaa Sundararuban
225c409584 docs: replace wiki links with new doc pages in readme.md (#22065) (#22066)
# Conflicts:
#	README.md
2021-03-09 10:12:59 +01:00
jk-jeongkyun
b3e18e483d eth/downloader: remove unnecessary condition (#22052) 2021-03-09 10:12:43 +01:00
Suriyaa Sundararuban
f9493d9cc3 signer: docs - replace wiki links with new doc pages (#22069) 2021-03-09 10:12:35 +01:00
Suriyaa Sundararuban
320d7d9130 eth/filters: replace wiki links with new doc pages (#22070) 2021-03-09 10:12:26 +01:00
Suriyaa Sundararuban
6a49a3aa94 cmd/geth: replace wiki links with new doc pages (#22071)
# Conflicts:
#	cmd/geth/consolecmd.go
2021-03-09 10:12:18 +01:00
Martin Holst Swende
1b967fc04a tests/fuzzers: fix false positive in bitutil fuzzer (#22076) 2021-03-09 10:12:04 +01:00
Sina Mahmoodi
0907f5badc eth, eth/tracers: include intrinsic gas in calltracer, expose for all tracers (#22038)
* eth/tracers: share tx gas price with js tracer

* eth/tracers: use `go generate`

* eth/tracers: try with another version of go-bindata

* eth/tracers: export txGas

* eth, eth/tracers: pass intrinsic gas to js tracers

eth/tracers: include tx gas in tracers usedGas

eth/tracers: fix prestate tracer's sender balance

eth/tracers: rm unnecessary import

eth/tracers: pass intrinsicGas separately to tracer

eth/tracers: fix tests broken by lack of txdata

eth, eth/tracers: minor fix

* eth/tracers: regenerate assets + unexport test-struct + add testcase

* eth/tracers: simplify tests + make table-driven

Co-authored-by: Guillaume Ballet <gballet@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
# Conflicts:
#	eth/tracers/tracer.go
#	eth/tracers/tracer_test.go
2021-03-09 10:11:49 +01:00
Timo Tijhof
5e3d81b51f README.md: update Travis badge (#22079)
The legacy dot-org URL was displaying a message about the repository
having migrated to the dot-com service, which now covers open-source
projects as well.
# Conflicts:
#	README.md
2021-03-09 10:06:20 +01:00
Martin Holst Swende
5d418f317b common,crypto: move fuzzers out of core (#22029)
* common,crypto: move fuzzers out of core

* fuzzers: move vm fuzzer out from core

* fuzzing: rework cover package logic

* fuzzers: lint
2021-03-09 10:06:00 +01:00
Marius van der Wijden
9c22ecdeb8 internal/ethapi: restore net_version RPC method (#22061)
During the snap and eth refactor, the net_version rpc call was falsely deprecated.
This restores the net_version RPC handler as most eth2 nodes and other software
depend on it.
# Conflicts:
#	eth/backend.go
#	les/client.go
2021-03-09 10:05:52 +01:00
ucwong
cf4c99c435 eth/downloader: fix typo in comment (#22019)
# Conflicts:
#	eth/downloader/modes.go
2021-03-09 10:04:57 +01:00
ucwong
193e8c98c7 eth/download/statesync : optimize to avoid a copy in state sync hashing (#22035)
* eth/download/statesync : state hash sum optimized

* go fmt with blank in imports

* keccak read arg fix
# Conflicts:
#	eth/downloader/statesync.go
2021-03-09 10:04:35 +01:00
Marius van der Wijden
97ddda04d8 cmd/faucet: sort requests by newest first (#22018)
# Conflicts:
#	cmd/faucet/faucet.go
2021-03-09 10:04:17 +01:00
Felföldi Zsolt
717e68a4a3 les: les/4 minimalistic version (#21909)
* les: allow tx unindexing in les/4 light server mode

* les: minor fixes

* les: more small fixes

* les: add meaningful constants for recentTxIndex handshake field
# Conflicts:
#	cmd/utils/flags.go
#	les/odr_requests.go
#	les/peer.go
#	les/protocol.go
2021-03-09 10:03:58 +01:00
Martin Holst Swende
7fc779e29f eth, core: speed up some tests (#22000) 2021-03-09 10:03:01 +01:00
Mr-Leshiy
8e872c1188 eth/protocols/eth: remove magic numbers in test (#21999) 2021-03-09 10:02:53 +01:00
Marius van der Wijden
e9386f34f6 cmd/geth: fixed parallelization flaw in account import test (#22002)
# Conflicts:
#	cmd/geth/accountcmd_test.go
2021-03-09 10:02:45 +01:00
Péter Szilágyi
693459073e core, eth: split eth package, implement snap protocol (#21482)
This commit splits the eth package, separating the handling of eth and snap protocols. It also includes the capability to run snap sync (https://github.com/ethereum/devp2p/blob/master/caps/snap.md) , but does not enable it by default.

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Martin Holst Swende <martin@swende.se>
# Conflicts:
#	cmd/geth/misccmd.go
#	cmd/utils/flags.go
#	core/blockchain.go
#	core/blockchain_snapshot_test.go
#	core/forkid/forkid.go
#	core/rawdb/accessors_snapshot.go
#	core/rawdb/schema.go
#	core/state/snapshot/generate.go
#	core/state/statedb.go
#	eth/api_test.go
#	eth/backend.go
#	eth/downloader/downloader.go
#	eth/downloader/downloader_test.go
#	eth/downloader/modes.go
#	eth/downloader/queue.go
#	eth/downloader/statesync.go
#	eth/gen_config.go
#	eth/handler.go
#	eth/handler_test.go
#	eth/helper_test.go
#	eth/peer.go
#	eth/protocol.go
#	eth/protocol_test.go
#	eth/sync.go
#	eth/sync_test.go
#	ethstats/ethstats.go
#	les/client.go
#	les/enr_entry.go
#	les/handler_test.go
#	les/peer.go
#	les/server_handler.go
#	tests/block_test_util.go
#	trie/proof.go
#	trie/proof_test.go
#	trie/trie.go
#	turbo/trie/notary.go
#	turbo/trie/sync_bloom.go
2021-03-08 17:07:38 +01:00
Shiming
2dfac7aedb cmd/abigen: clarify abigen alias flag usage (#21875)
* doc: clarify abigen alias flag usage

update the `abigen --alias` flag help info, give an example to make it more clear

related issue: https://github.com/ethereum/go-ethereum/issues/21846

* Update cmd/abigen/main.go

Co-authored-by: ligi <ligi@ligi.de>

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: ligi <ligi@ligi.de>
2021-03-08 14:39:15 +01:00
Connor Stein
9e0528aa75 abi/bind: fix error-handling in generated wrappers for functions returning structs (#22005)
Fixes the template used when generating code, which in some scenarios would lead to panic instead of returning an error.
2021-03-08 14:39:07 +01:00
Martin Holst Swende
c64c3100f0 core, eth, les: implement unclean-shutdown marker (#21893)
This PR implements unclean shutdown marker. Every time geth boots, it adds a timestamp to a list of timestamps in the database. This list is capped at 10. At a clean shutdown, the timestamp is removed again.
Thus, when geth exits unclean, the marker remains, and at boot up we show the most recent unclean shutdowns to the user, which makes it easier to diagnose root-causes to certain problems.

Co-authored-by: Nagy Salem <me@muhnagy.com>
# Conflicts:
#	core/rawdb/accessors_metadata.go
#	core/rawdb/database.go
#	core/rawdb/schema.go
#	eth/backend.go
#	les/client.go
2021-03-08 14:38:56 +01:00
Mr-Leshiy
4d9b4fd146 consensus: refactor FinalizeAndAssemble to use Finalize (#21993)
# Conflicts:
#	consensus/clique/clique.go
#	consensus/ethash/consensus.go
2021-03-08 14:35:53 +01:00
Martin Holst Swende
2135bf3a09 consensus/ethash: implement faster difficulty calculators (#21976)
This PR adds re-written difficulty calculators, which are based on uint256. It also adds a fuzzer + oss-fuzz integration for the new fuzzer. It does differential fuzzing between the new and old calculators.

Note: this PR does not actually enable the new calculators.
# Conflicts:
#	consensus/ethash/consensus_test.go
2021-03-08 14:34:27 +01:00
gary rong
9fbe42bcee core/txpool: remove "local" notion from the txpool price heap (#21478)
* core: separate the local notion from the pricedHeap

* core: add benchmarks

* core: improve tests

* core: address comments

* core: degrade the panic to error message

* core: fix typo

* core: address comments

* core: address comment

* core: use PEAK instead of POP

* core: address comments
# Conflicts:
#	core/tx_list.go
#	core/tx_pool.go
2021-03-08 14:34:06 +01:00
Mudit Gupta
0c2992922f cmd/faucet: use Twitter API instead of scraping webpage (#21850)
This PR adds support for using Twitter API to query the tweet and author details. There are two reasons behind this change:

- Twitter will be deprecating the legacy website on 15th December. The current method is expected to stop working then.
- More importantly, the current system uses Twitter handle for spam protection but the Twitter handle can be changed via automated calls. This allows bots to use the same tweet to withdraw funds infinite times as long as they keep changing their handle between every request. The Rinkeby as well as the Goerli faucet are being actively drained via this method. This PR changes the spam protection to be based on Twitter IDs instead of usernames. A user can not change their Twitter ID.

# Conflicts:
#	cmd/faucet/faucet.go
2021-03-08 14:31:14 +01:00
lzhfromustc
4ef76f9a58 miner, test: fix potential goroutine leak (#21989)
In miner/worker.go, there are two goroutine using channel w.newWorkCh: newWorkerLoop() sends to this channel, and mainLoop() receives from this channel. Only the receive operation is in a select.

However, w.exitCh may be closed by another goroutine. This is fine for the receive since receive is in select, but if the send operation is blocking, then it will block forever. This commit puts the send in a select, so it won't block even if w.exitCh is closed.

Similarly, there are two goroutines using channel errc: the parent that runs the test receives from it, and the child created at line 573 sends to it. If the parent goroutine exits too early by calling t.Fatalf() at line 614, then the child goroutine will be blocked at line 574 forever. This commit adds 1 buffer to errc. Now send will not block, and receive is not influenced because receive still needs to wait for the send.
# Conflicts:
#	miner/worker.go
2021-03-08 14:30:49 +01:00
Guillaume Ballet
4204389b5a les: rework float conversion on arm64 and other architectures (#21994)
The previous fix #21960 converted the float to an intermediate signed int, before attempting the uint conversion. Although this works, this doesn't guarantee that other architectures will work the same.
# Conflicts:
#	les/utils/expiredvalue.go
2021-03-08 14:27:39 +01:00
Felix Lange
20c0407042 params: begin v1.9.26 release cycle
# Conflicts:
#	params/version.go
2021-03-08 14:27:22 +01:00
Felix Lange
9257ab6568 params: go-ethereum v1.9.25 stable
# Conflicts:
#	params/version.go
2021-03-08 14:27:06 +01:00
Felix Lange
49103fcb4d build: upgrade to Go 1.15.6 (#21986)
# Conflicts:
#	build/checksums.txt
#	build/ci.go
2021-03-08 14:26:47 +01:00
Martin Holst Swende
09e8a539dc core, trie: speed up some tests with quadratic processing flaw (#21987)
This commit fixes a flaw in two testcases, and brings down the exec-time from ~40s to ~8s for trie/TestIncompleteSync.

The checkConsistency was performed over and over again on the complete set of nodes, not just the recently added, turning it into a quadratic runtime.
# Conflicts:
#	core/state/sync_test.go
#	trie/sync_test.go
2021-03-08 14:26:20 +01:00
gary rong
583b92af1d les, light: remove untrusted header retrieval in ODR (#21907)
* les, light: remove untrusted header retrieval in ODR

* les: polish

* light: check the hash equality in odr
# Conflicts:
#	les/client_handler.go
#	les/odr.go
#	les/odr_requests.go
#	les/retrieve.go
#	les/sync.go
#	les/sync_test.go
#	light/odr.go
#	light/odr_util.go
#	light/trie.go
2021-03-08 14:25:31 +01:00
Felix Lange
82f1d29cf1 p2p/enode: avoid crashing for invalid IP (#21981)
The database panicked for invalid IPs. This is usually no problem
because all code paths leading to node DB access verify the IP, but it's
dangerous because improper validation can turn this panic into a DoS
vulnerability. The quick fix here is to just turn database accesses
using invalid IP into a noop. This isn't great, but I'm planning to
remove the node DB for discv5 long-term, so it should be fine to have
this quick fix for half a year.

Fixes #21849
2021-03-08 14:25:11 +01:00
Felix Lange
0e87ceceed crypto/signify, build: fix archive signing with signify (#21977)
This fixes some issues in crypto/signify and makes release signing work.

The archive signing step in ci.go used getenvBase64, which decodes the key data.
This is incorrect here because crypto/signify already base64-decodes the key.
# Conflicts:
#	build/ci.go
2021-03-08 14:25:03 +01:00
Martin Holst Swende
13670846d2 cmd/geth: add test to verify regexps in version check (#21962)
# Conflicts:
#	cmd/geth/version_check_test.go
#	design/logos/Illustrator/vcheck/vulnerabilities.json
2021-03-08 14:24:47 +01:00
Martin Holst Swende
cb5a995060 core,les: headerchain import in batches (#21471)
* core: add test for headerchain inserts

* core, light: write headerchains in batches

* core: change to one callback per batch of inserted headers + review concerns

* core: error-check on batch write

* core: unexport writeHeaders

* core: remove callback parameter in InsertHeaderChain

The semantics of InsertHeaderChain are now much simpler: it is now an
all-or-nothing operation. The new WriteStatus return value allows
callers to check for the canonicality of the insertion. This change
simplifies use of HeaderChain in package les, where the callback was
previously used to post chain events.

* core: skip some hashing when writing headers

* core: less hashing in header validation

* core: fix headerchain flaw regarding blacklisted hashes

Co-authored-by: Felix Lange <fjl@twurst.com>
# Conflicts:
#	core/blockchain.go
#	core/headerchain.go
#	light/lightchain.go
2021-03-08 14:24:23 +01:00
Li, Cheng
000991b09d common: improve printing of Hash and Address (#21834)
Both Hash and Address have a String method, which returns the value as
hex with 0x prefix. They also had a Format method which tried to print
the value using printf of []byte. The way Format worked was at odds with
String though, leading to a situation where fmt.Sprintf("%v", hash)
returned the decimal notation and hash.String() returned a hex string.

This commit makes it consistent again. Both types now support the %v,
%s, %q format verbs for 0x-prefixed hex output. %x, %X creates
unprefixed hex output. %d is also supported and returns the decimal
notation "[1 2 3...]".

For Address, the case of hex characters in %v, %s, %q output is
determined using the EIP-55 checksum. Using %x, %X with Address
disables checksumming.

Co-authored-by: Felix Lange <fjl@twurst.com>
2021-03-08 14:18:13 +01:00
Marius van der Wijden
e04e33eac2 accounts/abi/bind: allow specifying signer on transactOpts (#21356)
This commit enables users to specify which signer they want to use while creating their transactOpts.
Previously all contract interactions used the homestead signer. Now a user can specify whether they
want to sign with homestead or EIP155 and specify the chainID which adds another layer of security.

Closes #16484
# Conflicts:
#	accounts/abi/bind/auth.go
#	accounts/abi/bind/backends/simulated.go
#	accounts/abi/bind/bind_test.go
#	les/sync_test.go
#	les/test_helper.go
#	mobile/bind.go
2021-03-08 14:18:03 +01:00
Igor Mandrigin
9e6adf94fb p2p/nodestate: fix deadlock during shutdown of les server (#21927)
This PR fixes a deadlock reported here: #21925

The cause is that many operations may be pending, but if the close happens, only one of them gets awoken and exits, the others remain waiting for a signal that never comes.
# Conflicts:
#	p2p/nodestate/nodestate.go
2021-03-08 12:54:34 +01:00
Steve Ruckdashel
c5a77ff083 crypto/secp256k1: add workaround for go mod vendor (#21735)
Go won't vendor C files if there are no Go files present in the directory.
Workaround is to add dummy Go files.

Fixes: #20232
2021-03-08 12:54:31 +01:00
Guillaume Ballet
35d46a61db les: cosmetic rewrite of the arm64 float bug workaround (#21960)
* les: revert arm float bug workaround to check go 1.15

* add traces to reproduce outside travis

* simpler workaround
# Conflicts:
#	les/utils/expiredvalue.go
2021-03-08 12:54:24 +01:00
Martin Holst Swende
2d3ae40a9f cmd/geth: implement vulnerability check (#21859)
* cmd/geth: implement vulnerability check

* cmd/geth: use minisign to verify vulnerability feed

* cmd/geth: add the test too

* cmd/geth: more minisig/signify testing

* cmd/geth: support multiple pubfiles for signing

* cmd/geth: add @holiman minisig pubkey

* cmd/geth: polishes on vulnerability check

* cmd/geth: fix ineffassign linter nit

* cmd/geth: add CVE to version check struct

* cmd/geth/testdata: add missing testfile

* cmd/geth: add more keys to versionchecker

* cmd/geth: support file:// URLs in version check

* cmd/geth: improve key ID printing when signature check fails

Co-authored-by: Felix Lange <fjl@twurst.com>
# Conflicts:
#	cmd/geth/main.go
#	cmd/geth/misccmd.go
#	design/logos/Illustrator/vcheck/data.json
#	design/logos/Illustrator/vcheck/data2.json
#	design/logos/Illustrator/vcheck/minisig-sigs/vulnerabilities.json.minisig.1
#	design/logos/Illustrator/vcheck/minisig-sigs/vulnerabilities.json.minisig.2
#	design/logos/Illustrator/vcheck/minisig-sigs/vulnerabilities.json.minisig.3
#	design/logos/Illustrator/vcheck/minisign.pub
#	design/logos/Illustrator/vcheck/minisign.sec
#	design/logos/Illustrator/vcheck/signify-sigs/data.json.sig
#	design/logos/Illustrator/vcheck/signifykey.pub
#	design/logos/Illustrator/vcheck/signifykey.sec
#	design/logos/Illustrator/vcheck/sigs/vulnerabilities.json.minisig.1
#	design/logos/Illustrator/vcheck/sigs/vulnerabilities.json.minisig.2
#	design/logos/Illustrator/vcheck/sigs/vulnerabilities.json.minisig.3
2021-03-08 12:54:09 +01:00
Martin Holst Swende
c3e523b87a core: improve contextual information on core errors (#21869)
A lot of times when we hit 'core' errors, example: invalid tx, the information provided is
insufficient. We miss several pieces of information: what account has nonce too high,
and what transaction in that block was offending?

This PR adds that information, using the new type of wrapped errors.
It also adds a testcase which (partly) verifies the output from the errors.

The first commit changes all usage of direct equality-checks on core errors, into
using errors.Is. The second commit adds contextual information. This wraps most
of the core errors with more information, and also wraps it one more time in
stateprocessor, to further provide tx index and tx hash, if such a tx is encoutered in
a block. The third commit uses the chainmaker to try to generate chains with such
errors in them, thus triggering the errors and checking that the generated string meets
expectations.
# Conflicts:
#	core/state_processor.go
#	core/state_transition.go
#	core/tx_pool_test.go
#	light/lightchain_test.go
#	turbo/stages/blockchain_test.go
2021-03-08 12:52:32 +01:00
Chris Ziogas
7a57b1ace0 core/vm/runtime: remove duplicated line (#21956)
This line is duplicated, though it doesn't cause any issues.
2021-03-08 12:48:08 +01:00