Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: select: fatal error: index out of range #40397

Open
prestonvanloon opened this issue Jul 24, 2020 · 14 comments
Open

runtime: select: fatal error: index out of range #40397

prestonvanloon opened this issue Jul 24, 2020 · 14 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@prestonvanloon
Copy link

What version of Go are you using (go version)?

I'm using bazel rules_go release v0.22.6 which is using go 1.14.2.

Does this issue reproduce with the latest release?

I'm not sure, this issue is not consistently reproducible.

What operating system and processor architecture are you using (go env)?

linux_amd64

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/preston/.cache/go-build"
GOENV="/home/preston/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/preston/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/snap/go/6123"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/snap/go/6123/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build083098668=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I was running llvm libfuzzer tests and saw this testcase appear. Binaries compiled with gc_goopts=-d=libfuzzer and linked with address sanitizer.

What did you expect to see?

No panics from the core select logic.

What did you see instead?

An index out of range here

c0 := scases[o].c

Full stack error below

fatal error: index out of range
--
  |  
  | goroutine 83 [running]:
  | runtime.throw(0x28d934, 0x12)
  | GOROOT/src/runtime/panic.go:1116 +0x74 fp=0x10c00007b910 sp=0x10c00007b8e0 pc=0x883a74
  | runtime.panicCheck1(0x8951ed, 0x28d934, 0x12)
  | GOROOT/src/runtime/panic.go:34 +0xdd fp=0x10c00007b940 sp=0x10c00007b910 pc=0x88125d
  | runtime.goPanicIndex(0x3d48, 0x7)
  | GOROOT/src/runtime/panic.go:87 +0x46 fp=0x10c00007b988 sp=0x10c00007b940 pc=0x881326
  | runtime.sellock(0x10c00007be90, 0x7, 0x7, 0x7f60c6d2c876, 0x7, 0x7)
  | GOROOT/src/runtime/select.go:48 +0xad fp=0x10c00007b9b8 sp=0x10c00007b988 pc=0x8951ed
  | runtime.selectgo(0x10c00007be90, 0x10c00007bb64, 0x7, 0x5, 0x8fb701)
  | GOROOT/src/runtime/select.go:319 +0xcc2 fp=0x10c00007bae0 sp=0x10c00007b9b8 pc=0x896092
  | github.com/ethereum/go-ethereum/consensus/ethash.(*remoteSealer).loop(0x10c000012f00)
  | external/com_github_ethereum_go_ethereum/consensus/ethash/sealer.go:278 +0x25a fp=0x10c00007bfd8 sp=0x10c00007bae0 pc=0x16098fa
  | runtime.goexit()
  | src/runtime/asm_amd64.s:1373 +0x1 fp=0x10c00007bfe0 sp=0x10c00007bfd8 pc=0x8b4ff1
  | created by github.com/ethereum/go-ethereum/consensus/ethash.startRemoteSealer
  | external/com_github_ethereum_go_ethereum/consensus/ethash/sealer.go:262 +0x2b0

@ianlancetaylor ianlancetaylor changed the title Select: fatal error: index out of range runtime: select: fatal error: index out of range Jul 24, 2020
@ianlancetaylor
Copy link
Contributor

Can you run the tests under the race detector?

@ianlancetaylor
Copy link
Contributor

CC @aclements @randall77

@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 24, 2020
@ianlancetaylor ianlancetaylor added this to the Go1.16 milestone Jul 24, 2020
@prestonvanloon
Copy link
Author

I tried recompiling these tests with race detection, but it failed to link due to duplicate symbols.
I'll fiddle around with it for a bit today.

Does race detection work with gc_goopts=-d=libfuzzer?

@ianlancetaylor
Copy link
Contributor

It should work to run go build -gcflags=-d=libfuzzer -race. But I don't know about Bazel.

Can you use the fuzzer to find a problematic case and then run that case without -d=libfuzzer?

@josharian
Copy link
Contributor

In theory this could also be caused by the libfuzzer instrumentation. cc @mdempsky just in case

@mdempsky
Copy link
Member

libfuzzer instrumentation is turned off when compiling the runtime, so I'd be really surprised if it was responsible for this.

go-ethereum is using reflect.SliceHeader incorrectly. For example, here: https://github.com/ethereum/go-ethereum/blob/master/consensus/ethash/algorithm.go#L154

It's only safe to use *reflect.SliceHeader as a pointer to an actual slice-typed variable. You should never have a value or variable of type reflect.SliceHeader.

Spot checking, I don't immediately see how this could be the fault, but I suggest fixing them, and then also using -d checkptr when fuzzing to enable runtime validation of unsafe.Pointer usage, and let us know if you still see the failure after that.

@mdempsky
Copy link
Member

mdempsky commented Jul 24, 2020

Why doesn't this code need to initialize pollorder[0] = 0?

go/src/runtime/select.go

Lines 158 to 163 in 074f2d8

// generate permuted order
for i := 1; i < ncases; i++ {
j := fastrandn(uint32(i + 1))
pollorder[i] = pollorder[j]
pollorder[j] = uint16(i)
}

If select is called in a loop and the compiler is able to reuse the pollorder array, isn't there a risk that pollorder[0] could be out of range? (Using select in a loop is hardly a rare usage, so I feel like I must be missing something obvious. Otherwise, surely this would fail super commonly?)

Edit: Nevermind, it's zero initialized by the compiler:

order := temp(types.NewArray(types.Types[TUINT16], 2*int64(n)))
r = nod(OAS, order, nil)

@prestonvanloon
Copy link
Author

Running fuzzer with -d checkptr now. I'll circle back here in a few hours to see if any new testcases appear.

@prestonvanloon
Copy link
Author

In an older build (without checkptr), I just saw this issue again.

goroutine 7 [running]:
--
  | runtime.throw(0x248753, 0x12)
  | GOROOT/src/runtime/panic.go:1116 +0x74 fp=0x10c000078cf8 sp=0x10c000078cc8 pc=0x48e174
  | runtime.panicCheck1(0x49f3ed, 0x248753, 0x12)
  | GOROOT/src/runtime/panic.go:34 +0xdd fp=0x10c000078d28 sp=0x10c000078cf8 pc=0x48b9cd
  | runtime.goPanicIndex(0x6170, 0x3)
  | GOROOT/src/runtime/panic.go:87 +0x46 fp=0x10c000078d70 sp=0x10c000078d28 pc=0x48ba96
  | runtime.sellock(0x10c000078f50, 0x3, 0x3, 0x10c000078f2a, 0x3, 0x3)
  | GOROOT/src/runtime/select.go:48 +0xad fp=0x10c000078da0 sp=0x10c000078d70 pc=0x49f3ed
  | runtime.selectgo(0x10c000078f50, 0x10c000078f24, 0x3, 0x10c000078f30, 0x7ffc34fdfc62)
  | GOROOT/src/runtime/select.go:319 +0xcc2 fp=0x10c000078ec8 sp=0x10c000078da0 pc=0x4a0242
  | github.com/dgraph-io/ristretto.(*Cache).processItems(0x10c000092720)
  | external/com_github_dgraph_io_ristretto/cache.go:299 +0x248 fp=0x10c000078fd8 sp=0x10c000078ec8 pc=0xa1b498
  | runtime.goexit()
  | src/runtime/asm_amd64.s:1373 +0x1 fp=0x10c000078fe0 sp=0x10c000078fd8 pc=0x4bd671
  | created by github.com/dgraph-io/ristretto.NewCache
  | external/com_github_dgraph_io_ristretto/cache.go:162 +0x2d7

@mdempsky
Copy link
Member

Notably, both of these failures happen when the channel locks are re-acquired after sleeping. So the first call to sellock(scases, lockorder) succeeded, and only the second one is failing. We can also see from the traceback that len(scases) is correct in both cases. So it seems like the contents of lockorder must be getting corrupted while the goroutine is parked.

karalabe added a commit to ethereum/go-ethereum that referenced this issue Nov 17, 2020
* consensus/ethash: only use *reflect.SliceHeader, not reflect.SliceHeader. See comment here: golang/go#40397

* consensus/ethash: pr feedback from @mdempsky, makes a copy of dest such that is not mutated

* consensus/ethash: remove noop assign

* consensus/ethash: apply same fix to another location

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
@odeke-em
Copy link
Member

odeke-em commented Feb 4, 2021

Thank you for filing this issue @prestonvanloon and for investigating the failures in Ethereum @josharian, @ianlancetaylor, and @mdempsky, plus for guiding their PR fixes. Given the movement in the go-ethereum code base, can we perhaps punt this to Backlog for future investigation. Should this hold up Go1.16? Thank you.

@mdempsky mdempsky modified the milestones: Go1.16, Backlog Feb 4, 2021
mandrigin pushed a commit to ledgerwatch/erigon that referenced this issue Mar 10, 2021
* consensus/ethash: only use *reflect.SliceHeader, not reflect.SliceHeader. See comment here: golang/go#40397

* consensus/ethash: pr feedback from @mdempsky, makes a copy of dest such that is not mutated

* consensus/ethash: remove noop assign

* consensus/ethash: apply same fix to another location

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
enriquefynn pushed a commit to enriquefynn/go-ethereum that referenced this issue Mar 10, 2021
* consensus/ethash: only use *reflect.SliceHeader, not reflect.SliceHeader. See comment here: golang/go#40397

* consensus/ethash: pr feedback from @mdempsky, makes a copy of dest such that is not mutated

* consensus/ethash: remove noop assign

* consensus/ethash: apply same fix to another location

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
sambacha pushed a commit to contractshark/turbo-geth that referenced this issue Apr 5, 2021
* consensus/ethash: only use *reflect.SliceHeader, not reflect.SliceHeader. See comment here: golang/go#40397

* consensus/ethash: pr feedback from @mdempsky, makes a copy of dest such that is not mutated

* consensus/ethash: remove noop assign

* consensus/ethash: apply same fix to another location

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
flyworker pushed a commit to nebulaai/nbai-node that referenced this issue Apr 7, 2021
* params: update CHTs for v1.9.19

* params: release Geth v1.9.19

* params: begin v1.9.20 release cycle

* cmd/geth/tests: try to fix spurious travis failure in les tests (#21410)

* cmd/geth/tests: try to fix spurious travis failure in les tests

* cmd/geth: les_test - remove extraneous option during boot

* metrics: make meter updates lock-free (#21446)

* core/state: fixed some comments (#21450)

* build: drop disco, enable groovy on Ubuntu PPAs

* cmd/evm: statet8n output folder + tx hashes on trace filenames (#21406)

* t8ntool: add output basedir

* t8ntool: add txhash to trace filename

* t8ntool: don't default to '.' basedir, allow absolute paths

* core: more detailed metering for reorgs (#21420)

* core: define and test chain rewind corner cases (#21409)

* core: define and test chain reparation cornercases

* core: write up a variety of set-head tests

* core, eth: unify chain rollbacks, handle all the cases

* core: make linter smile

* core: remove commented out legacy code

* core, eth/downloader: fix review comments

* core: revert a removed recovery mechanism

* travis, dockerfile, appveyor, build: bump to Go 1.15

* metrics: zero temp variable in  updateMeter (#21470)

* metrics: zero temp variable in  updateMeter

Previously the temp variable was not updated properly after summing it to count.
This meant we had astronomically high metrics, now we zero out the temp whenever we
sum it onto the snapshot count

* metrics: move temp variable to be aligned, unit tests

Moves the temp variable in MeterSnapshot to be 64-bit aligned because of the atomic bug.
Adds a unit test, that catches the previous bug.

* eth/downloader: fix rollback issue on short chains

* core, eth, les, trie: add a prefix to contract code (#21080)

* core: do less lookups when writing fast-sync block bodies (#21468)

* eth: utilize sync bloom for getNodeData (#21445)

* eth/downloader, eth/handler: utilize sync bloom for getNodeData

* trie: handle if bloom is nil

* trie, downloader: check bloom nilness externally

* core/state/snapshot: reduce disk layer depth during generation

* p2p/discover: avoid dropping unverified nodes when table is almost empty (#21396)

This change improves discovery behavior in small networks. Very small
networks would often fail to bootstrap because all member nodes were
dropping table content due to findnode failure. The check is now changed
to avoid dropping nodes on findnode failure when their bucket is almost
empty. It also relaxes the liveness check requirement for FINDNODE/v4
response nodes, returning unverified nodes as results when there aren't
any verified nodes yet.

The "findnode failed" log now reports whether the node was dropped
instead of the number of results. The value of the "results" was
always zero by definition.

Co-authored-by: Felix Lange <fjl@twurst.com>

* core/rawdb: only complain loudly if truncating many items

* graphql: add support for retrieving the chain id (#21451)

* params: update CHTs for v1.9.20 release

* params: release Geth v1.9.20

* params: begin v1.9.21 release cycle

* accounts/abi/bind/backends: Disallow AdjustTime for non-empty blocks (#21334)

* accounts/abi/bind/backends: Disallow timeshift for non-empty blocks

* accounts/abi/bind/backends: added tests for adjust time

* accounts/abi/bind/simulated: added comments, fixed test for AdjustTime

* accounts/abi/bind/backends: updated comment

* core/state, eth, trie: stabilize memory use, fix memory leak

* eth: updated comments (#21490)

* go.mod | goleveldb latest update (#21448)

* go.mod | goleveldb latest update

* go.mod update

* leveldb options

* go.mod: double check

Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* eth/tracers: revert reason in call_tracer + error for failed internal calls (#21387)

* tests: add testdata of call tracer

* eth/tracers: return revert reason in call_tracer

* eth/tracers: regenerate assets

* eth/tracers: add error message even if no exec occurrs, fixes #21438

Co-authored-by: Martin Holst Swende <martin@swende.se>

* rpc: fix issue with null JSON-RPC messages (#21497)

* accounts/abi: fix a bug in getTypeSize method (#21501)

* accounts/abi: fix a bug in getTypeSize method

e.g. for "Tuple[2]" type, the element of the array is a tuple type and the size of the tuple may not be 32.

* accounts/abi: add unit test of getTypeSize method

* internal: fix personal.sign() (#21503)

* "Downloader queue stats" is now provided once per minute (#21455)

* "Downloader queue stats" is now a DEBUG information

I think this info is more a DEBUG related information then an INFO. If it must remains an INFO, maybe it can be slow down to one time every 5 minutes or so.

* Update queue.go

"Downloader queue stats" information is now provided once every minute instead of once every 10 seconds.

* go.mod : update goja dependency (#21432)

* eth/downloader: change intial download size (#21366)

This changes how the downloader works, a little bit. Previously, when block sync started,
we immediately started filling up to 8192 blocks. Usually this is fine, blocks are small
in the early numbers. The threshold then is lowered as we measure the size of the blocks
that are filled.

However, if the node is shut down and restarts syncing while we're in a heavy segment,
that might be bad. This PR introduces a more conservative initial threshold of 2K blocks
instead.

* core, eth, trie: prepare trie sync for path based operation

* eth: added trace_call to trace on top of arbitrary blocks (#21338)

* eth: Added TraceTransactionPending

* eth: Implement Trace_Call, remove traceTxPending

* eth: debug_call -> debug_traceCall, recompute tx environment if pruned

* eth: fix nil panic

* eth: improve block retrieving logic in tracers

* internal/web3ext: add debug_traceCall to console

* accounts: abi/bid/backends; cleaned doc errors, camelCase refactors and anonymous variable assignments (#21514)

Co-authored-by: Osoro Bironga <osoro@doctaroo.com>

* whisper: remove whisper (#21487)

* whisper: remove whisper

* Update cmd/geth/config.go

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

* cmd/geth: warn on enabling whisper + remove more whisper deps

* mobile: remove all whisper references

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* accounts/usbwallet, signer/core: show accounts from ledger legacy derivation paths (#21517)

* accounts/usbwallet, signer/core: un-hide accounts from ledger legacy derivation paths

* Update accounts/usbwallet/wallet.go

* Update signer/core/api.go

* Update signer/core/api.go

* build: remove wnode from the list of packages binaries (#21526)

* .github: remove whisper from CODEOWNERS (#21527)

* params: update CHTs for v1.9.21 release

* params: release Geth v1.9.21

* params: begin v1.9.22 release cycle

* eth/downloader: only roll back light sync if not fully validating

* accounts/abi/bind/backends: reverted some stylistic changes (#21535)

* cmd, eth: offer maxprice flag for overwritting price cap (#21531)

* cmd, eth: offer maxprice flag for overwritting price cap

* eth: rename default price cap

* core/vm: fix benchmark overflow + prep for precompile repricings (#21530)

* core/vm/testdata: add gascost expectations to testcases

* core/vm: verify expected gas in tests for precompiles

* core/vm: fix overflow flaw in gas/s calculation

* go.mod: remove golang.org/x/sync (#21541)

* ethclient: add BlockNumber method (#21500)

This adds a new client method BlockNumber to fetch the most recent
block number of the chain.

* cmd/geth: print warning when whisper config is present in toml (#21544)

* cmd/geth: print warning when whisper config is present in toml

* Update cmd/geth/config.go

Co-authored-by: Martin Holst Swende <martin@swende.se>

* miner: use channels instead of atomics in update loop (#21536)

This PR changes several different things:

- Adds test cases for the miner loop
- Stops the worker if it wasn't already stopped in worker.Close()
- Uses channels instead of atomics in the miner.update() loop

Co-authored-by: Felix Lange <fjl@twurst.com>

* miner: fix regression, add test for starting while download (#21547)

Fixes a regression introduced in #21536

* p2p/discover: fix typo in comments (#21554)

* Dockerfile: unexpose port 8547 as GraphQL was merged into HTTP endpoint (#21556)

* p2p/nodestate: ensure correct callback order (#21436)

This PR adds an extra guarantee to NodeStateMachine: it ensures that all
immediate effects of a certain change are processed before any subsequent
effects of any of the immediate effects on the same node. In the original
version, if a cascaded change caused a subscription callback to be called
multiple times for the same node then these calls might have happened in a
wrong chronological order.

For example:

- a subscription to flag0 changes flag1 and flag2
- a subscription to flag1 changes flag3
- a subscription to flag1, flag2 and flag3 was called in the following order:

   [flag1] -> [flag1, flag3]
   [] -> [flag1]
   [flag1, flag3] -> [flag1, flag2, flag3]

This happened because the tree of changes was traversed in a "depth-first
order". Now it is traversed in a "breadth-first order"; each node has a
FIFO queue for pending callbacks and each triggered subscription callback
is added to the end of the list. The already existing guarantees are
retained; no SetState or SetField returns until the callback queue of the
node is empty again. Just like before, it is the responsibility of the
state machine design to ensure that infinite state loops are not possible.
Multiple changes affecting the same node can still happen simultaneously;
in this case the changes can be interleaved in the FIFO of the node but the
correct order is still guaranteed.

A new unit test is also added to verify callback order in the above scenario.

* js/tracers: make calltracer report value in selfdestructs  (#21549)

* rlp: add SplitUint64 (#21563)

This can be useful when working with raw RLP data.

* les, les/lespay/server: refactor client pool (#21236)

* les, les/lespay/server: refactor client pool

* les: use ns.Operation and sub calls where needed

* les: fixed tests

* les: removed active/inactive logic from peerSet

* les: removed active/inactive peer logic

* les: fixed linter warnings

* les: fixed more linter errors and added missing metrics

* les: addressed comments

* cmd/geth: fixed TestPriorityClient

* les: simplified clientPool state machine

* les/lespay/server: do not use goroutine for balance callbacks

* internal/web3ext: fix addBalance required parameters

* les: removed freeCapacity, always connect at minCapacity initially

* les: only allow capacity change with priority status

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>

* eth/tracers: regenerate assets from #21549 (#21564)

* COYPING: restore the full text text of GPL (#21568)

When the license was added to the repository, its text was changed (some
sections at the end removed) and, worse, the authors of go-ethereum
tried to claim copyright on the license text.

The correct way to apply GPL to a project is to copy it verbatim.
This change reverts the text of the GPL to the original.

* core/rawdb: single point of maintenance for writing and deleting tx lookup indexes (#21480)

* ethclient: fix BlockNumber (#21565)

It didn't actually work because it called a method that doesn't
exist. This fixes it also adds a test.

Co-authored-by: Felix Lange <fjl@twurst.com>

* params: allow setting Petersburg block before chain head (#21473)

* Allow setting PetersburgBlock before chainhead

if it is at the same block as ConstantinopleBlock

* Add a negative test

* les/lespay/server: bump database version (#21571)

* tests/fuzzers/abi: add fuzzer for fuzzing package accounts/abi (#21217)

* tests/fuzzers/abi: added abi fuzzer

* accounts/abi: fixed issues found by fuzzing

* tests/fuzzers/abi: update fuzzers, added repro test

* tests/fuzzers/abi: renamed abi_fuzzer to abifuzzer

* tests/fuzzers/abi: updated abi fuzzer

* tests/fuzzers/abi: updated abi fuzzer

* accounts/abi: minor style fix

* go.mod: added go-fuzz dependency

* tests/fuzzers/abi: updated abi fuzzer

* tests/fuzzers/abi: make linter happy

* tests/fuzzers/abi: make linter happy

* tests/fuzzers/abi: comment out false positives

* cmd/utils: use preconfigured testnet flags instead of networkid (#21561)

* cmd/utils: use preconfigured testnet flags instead of networkid

* cmd/utils: shorter description

Co-authored-by: Martin Holst Swende <martin@swende.se>

* Update flags.go

Co-authored-by: Martin Holst Swende <martin@swende.se>

* cmd/geth: added counters to the geth inspect report (#21495)

* database: added counters

* Improved stats for ancient db

* Small improvement

* Better message and added percentage while counting receipts

* Fast counting for receipts

* added info message

* Show both receips itemscount  from ancient db and counted receipts

* Fixed default case

* Removed counter for receipts in ancient store

* Removed counting of receipts present in leveldb

* eth/downloader: dynamically move pivot even during chain sync

* core: fix a typo in comment (#21439)

* accounts/abi: improve documentation and names (#21540)

* accounts: abi/bid/backends; cleaned doc errors, camelCase refactors and anonymous variable assignments

* acounts/abi/bind: doc errors, anonymous parameter assignments

* accounts/abi: doc edits, camelCase refactors

* accounts/abi/bind: review fix

* reverted name changes

* name revert

Co-authored-by: Osoro Bironga <osoro@doctaroo.com>

* mobile: better api for java users (#21580)

* (mobile): Adds string representations for types

* mobile: better interfaces add stringer to types

Co-authored-by: sarath <sarath@melvault.com>

* p2p: move rlpx into separate package (#21464)

This change moves the RLPx protocol implementation into a separate package,
p2p/rlpx. The new package can be used to establish RLPx connections for
protocol testing purposes.

Co-authored-by: Felix Lange <fjl@twurst.com>

* cmd/clef, cmd/geth: use SplitAndTrim from cmd/utils (#21579)

* trie: fix gaped range proof test case (#21484)

* trie: support empty range proof (#21199)

* internal/ethapi: add optional parameter blockNrOrHash to estimateGas (#21545)

This allows users to estimate gas on top of arbitrary blocks as well as pending and latest.
Tracing on pending is useful for most users as it takes into account the current txpool while
tracing on latest might be useful for users that have little to know knowledge of the current
transactions in the network.

If blockNrOrHash is not specified, estimateGas defaults to pending

* trie: extend range proof (#21250)

* trie: support non-existent right proof

* trie: improve test

* trie: minor linter fix

Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* internal/ethapi: fix nil deref + fix estimateGas console bindings (#21601)

* tried to fix

* fix for js api

* fix for nil pointer ex

* rev space

* rev space

* input call formatter

* cmd/devp2p: add eth protocol test suite (#21598)

This change adds a test framework for the "eth" protocol and some basic
tests. The tests can be run using the './devp2p rlpx eth-test' command.

* cmd/devp2p/internal/ethtest: update version in handshake (#21603)

* cmd/devp2p/internal/ethtest: lower protocol version to 64 (#21604)

* params: update CHTs for Geth v1.9.22

* params: release Geth v1.9.22

* params: begin v1.9.23 release cycle

* accounts/abi: ABI explicit difference between Unpack and UnpackIntoInterface (#21091)

* accounts/abi: refactored abi.Unpack

* accounts/abi/bind: fixed error

* accounts/abi/bind: modified template

* accounts/abi/bind: added ToStruct for conversion

* accounts/abi: reenabled tests

* accounts/abi: fixed tests

* accounts/abi: fixed tests for packing/unpacking

* accounts/abi: fixed tests

* accounts/abi: added more logic to ToStruct

* accounts/abi/bind: fixed template

* accounts/abi/bind: fixed ToStruct conversion

* accounts/abi/: removed unused code

* accounts/abi: updated template

* accounts/abi: refactored unused code

* contracts/checkpointoracle: updated contracts to sol ^0.6.0

* accounts/abi: refactored reflection logic

* accounts/abi: less code duplication in Unpack*

* accounts/abi: fixed rebasing bug

* fix a few typos in comments

* rebase on master

Co-authored-by: Guillaume Ballet <gballet@gmail.com>

* mobile: added constructor for big int (#21597)

* mobile: added constructor for big int

* mobile: tiny nitpick

* core/vm, params: make 2200 in line with spec (#21605)

* core: free pointer from slice after popping element from price heap (#21572)

* Fix potential memory leak in price heap

* core: nil free pointer slice (alternative version)

Co-authored-by: Martin Holst Swende <martin@swende.se>

* internal/web3ext: improve eth_getBlockByNumber and eth_getBlockByHash console api (#21608)

* light: fix wrong description in a comment (#21573)

* p2p/enode: remove unused code (#21612)

* build: keep geth-sources.jar build result for JavaDoc (#21596)

* ci: tooltips for javadoc for mobile app

* f space

* cmd/bootnode,internal/debug: fix some comments (#21623)

* trie: use stacktrie for Derivesha operation (#21407)

core/types: use stacktrie for derivesha

trie: add stacktrie file

trie: fix linter

core/types: use stacktrie for derivesha

rebased: adapt stacktrie to the newer version of DeriveSha

Co-authored-by: Martin Holst Swende <martin@swende.se>

More linter fixes

review feedback: no key offset for nodes converted to hashes

trie: use EncodeRLP for full nodes

core/types: insert txs in order in derivesha

trie: tests for derivesha with stacktrie

trie: make stacktrie use pooled hashers

trie: make stacktrie reuse tmp slice space

trie: minor polishes on stacktrie

trie/stacktrie: less rlp dancing

core/types: explain the contorsions in DeriveSha

ci: fix goimport errors

trie: clear mem on subtrie hashing

squashme: linter fix

stracktrie: use pooling, less allocs (#3)

trie: in-place hex prefix, reduce allocs and add rawNode.EncodeRLP

Reintroduce the `[]node` method, add the missing `EncodeRLP` implementation for `rawNode` and calculate the hex prefix in place.

Co-authored-by: Martin Holst Swende <martin@swende.se>

Co-authored-by: Martin Holst Swende <martin@swende.se>

* accounts, signer: implement gnosis safe support (#21593)

* accounts, signer: implement gnosis safe support

* common/math: add type for marshalling big to dec

* accounts, signer: properly sign gnosis requests

* signer, clef: implement account_signGnosisTx

* signer: fix auditlog print, change rpc-name (signGnosisTx to signGnosisSafeTx)

* signer: pass validation-messages/warnings to the UI for gnonsis-safe txs

* signer/core: minor change to validationmessages of typed data

* trie: polishes to trie committer (#21351)

* trie: update tests to check commit integrity

* trie: polish committer

* trie: fix typo

* trie: remove hasvalue notion

According to the benchmarks, type assertion between the pointer and
interface is extremely fast.

BenchmarkIntmethod-12           1000000000               1.91 ns/op
BenchmarkInterface-12           1000000000               2.13 ns/op
BenchmarkTypeSwitch-12          1000000000               1.81 ns/op
BenchmarkTypeAssertion-12       2000000000               1.78 ns/op

So the overhead for asserting whether the shortnode has "valuenode"
child is super tiny. No necessary to have another field.

* trie: linter nitpicks

Co-authored-by: Martin Holst Swende <martin@swende.se>

* trie: add Commit-sequence tests for stacktrie commit (#21643)

* core/state/snapshot: stop generator if it hits missing trie nodes (#21649)

* core/state/snapshot: exit Geth if generator hits missing trie nodes

* core/state/snapshot: error instead of hard die on generator fault

* core/state/snapshot: don't enable logging on the tests

* cmd/faucet: enable DNS discovery for known networks (#21636)

* params: update goerli testnet bootnodes (#21659)

* params: update pegasys besu bootnode

* params: update goerli initiative bootnodes

* core/bloombits: faster generator (#21625)

* core/bloombits: add benchmark

* core/bloombits: optimize inserts

* core/types: optimize bloom filters (#21624)

* core/types: tests for bloom

* core/types: refactored bloom filter for receipts, added tests

core/types: replaced old bloom implementation

core/types: change interface of bloom add+test

* core/types: refactor bloom

* core/types: minor tweak on LogsBloom

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

* cmd/devp2p/internal/ethtest: improve eth test suite (#21615)

This fixes issues with the protocol handshake and status exchange
and adds support for responding to GetBlockHeaders requests.

* node: relax websocket connection header check (#21646)

This makes it accept the "upgrade,keep-alive" header value, which
apparently is a thing.

* signer/core: don't mismatch reject and no accounts (#21677)

* signer/core: don't mismatch reject and zero accounts, fixes #21674

* signer/core: docs

* p2p/discover: remove use of shared hash instance for key derivation (#21673)

For some reason, using the shared hash causes a cryptographic incompatibility
when using Go 1.15. I noticed this during the development of Discovery v5.1
when I added test vector verification.

The go library commit that broke this is golang/go@97240d5, but the
way we used HKDF is slightly dodgy anyway and it's not a regression.

* core/vm: dedup config check in markdown logger (#21655)

* core/vm: dedup config check

* review feedback: reuse buffer

* eth/downloader: fix data race around the ancientlimit (#21681)

* eth/downloader: fix data race around the ancientlimit

* eth/downloader: initialize the ancientlimit as 0

* eth/downloader: cache parent hash instead of recomputing (#21678)

* core: fix txpool off-by-one error (#21683)

* trie: polish commit function (#21692)

* trie: polish commit function

* trie: fix typo

* accouts, consensus, core: fix some comments (#21617)

* console: fix admin.sleepBlocks (#21629)

* all: replace RWMutex with Mutex in places where RLock is not used (#21622)

* consensus/clique: unexport calcDifficulty and improve comment (#21619)

* trie: fix flaw in stacktrie pool reuse (#21699)

* internal/web3ext: improve some web3 apis (#21639)

* imporve some web3-ext apis

* Update web3ext.go

Co-authored-by: Felix Lange <fjl@twurst.com>

* eth, p2p: use truncated names  (#21698)

* peer: return localAddr instead of name to prevent spam

We currently use the name (which can be freely set by the peer) in several log messages.
This enables malicious actors to write spam into your geth log.
This commit returns the localAddr instead of the freely settable name.

* p2p: reduce usage of peer.Name in warn messages

* eth, p2p: use truncated names

* Update peer.go

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Felix Lange <fjl@twurst.com>

* cmd/geth, cmd/utils: fixed flags name (#21700)

* miner: don't interrupt mining after successful sync (#21701)

* miner: exit loop when downloader Done or Failed

Following the logic of the comment at the method,
this fixes a regression introduced at 7cf56d6f064869cb62b1673f9ee437020c595391
, which would allow external parties to DoS with
blocks, preventing mining progress.

Signed-off-by: meows <b5c6@protonmail.com>

* miner: remove ineff assign (lint)

Signed-off-by: meows <b5c6@protonmail.com>

* miner: update test re downloader events

Signed-off-by: meows <b5c6@protonmail.com>

* Revert "miner: remove ineff assign (lint)"

This reverts commit eaefcd34ab4862ebc936fb8a07578aa2744bc058.

* Revert "miner: exit loop when downloader Done or Failed"

This reverts commit 23abd34265aa246c38fc390bb72572ad6ae9fe3b.

* miner: add test showing imprecise TestMiner

Signed-off-by: meows <b5c6@protonmail.com>

* miner: fix waitForMiningState precision

This helper function would return an affirmation
on the first positive match on a desired bool.

This was imprecise; it return false positives
by not waiting initially for an 'updated' value.

This fix causes TestMiner_2 to fail, which is
expected.

Signed-off-by: meows <b5c6@protonmail.com>

* miner: remove TestMiner_2 demonstrating broken test

This test demonstrated the imprecision of the test
helper function waitForMiningState. This function
has been fixed with 6d365c2851, and this test test
may now be removed.

Signed-off-by: meows <b5c6@protonmail.com>

* miner: fix test regarding downloader event/mining expectations

See comment for logic.

Signed-off-by: meows <b5c6@protonmail.com>

* miner: add test describing expectations for downloader/mining events

We expect that once the downloader emits a DoneEvent,
signaling a successful sync, that subsequent StartEvents
are not longer permitted to stop the miner.

This prevents a security vulnerability where forced syncs via
fake high blocks would stall mining operation.

Signed-off-by: meows <b5c6@protonmail.com>

* miner: use 'canStop' state to fix downloader event handling

- Break downloader event handling into event
separating Done and Failed events. We need to
treat these cases differently since a DoneEvent
should prevent the miner from being stopped on
subsequent downloader Start events.

- Use canStop state to handle the one-off
case when a downloader first succeeds.

Signed-off-by: meows <b5c6@protonmail.com>

* miner: improve comment wording

Signed-off-by: meows <b5c6@protonmail.com>

* miner: start mining on downloader events iff not already mining

Signed-off-by: meows <b5c6@protonmail.com>

* miner: refactor miner update logic w/r/t downloader events

This makes mining pause/start logic regarding downloader
events more explicit. Instead of eternally handling downloader
events after the first done event, the subscription is closed
when downloader events are no longer actionable.

Signed-off-by: meows <b5c6@protonmail.com>

* miner: fix handling downloader events on subcription closed

Signed-off-by: meows <b5c6@protonmail.com>

* miner: (lint:gosimple) use range over chan instead of for/select

Signed-off-by: meows <b5c6@protonmail.com>

* miner: refactor update loop to remove race condition

The go routine handling the downloader events handling
vars in parallel with the parent routine, causing a
race condition.

This change, though ugly, remove the condition while
still allowing the downloader event subscription to be
closed when the miner has no further use for it (ie DoneEvent).

* miner: alternate fix for miner-flaw

Co-authored-by: meows <b5c6@protonmail.com>

* accounts/keystore: fix flaky test (#21703)

* accounts/keystore: add timeout to test to prevent failure on travis

The TestWalletNotifications test sporadically fails on travis.
This is because we shutdown the event collection before all events are received.
Adding a small timeout (10 milliseconds) allows the collector to be scheduled
and to consume all pending events before we shut it down.

* accounts/keystore: added newlines back in

* accounts/keystore: properly fix the walletNotifications test

* params: update CHTs (#21706)

* miner: set etherbase even if mining isn't possible at the moment (#21707)

* p2p/discover: implement v5.1 wire protocol (#21647)

This change implements the Discovery v5.1 wire protocol and
also adds an interactive test suite for this protocol.

* params: go-ethereum v1.9.23 stable

* params: begin v1.9.24 release cycle

* core/vm: marshall returnData as hexstring in trace logs (#21715)

* core/vm: marshall returnData as hexstring in trace logs

* core/vm: marshall returnData as hexstring in trace logs

* console: don't exit on ctrl-c, only on ctrl-d (#21660)

* add interrupt counter

* remove interrupt counter, allow ctrl-C to clear ONLY, ctrl-D will terminate console, stop node

* format

* add instructions to exit

* fix tests

* miner: fixed race condition in tests (#21664)

* core: track and improve tx indexing/unindexing (#21331)

* core: add background indexer to waitgroup

* core: make indexer stopable

* core/rawdb: add unit tests

* core/rawdb: fix lint

* core/rawdb: fix tests

* core/rawdb: fix linter

* eth/api: fix potential nil deref in AccountRange (#21710)

* Fix potential nil pointer error when neither block number nor hash is specified to accountRange

* Update error description

* les: remove clientPeerSet and serverSet (#21566)

* les: move NodeStateMachine from clientPool to LesServer

* les: new header broadcaster

* les: peerCommons.headInfo always contains last announced head

* les: remove clientPeerSet and serverSet

* les: fixed panic

* les: fixed --nodiscover option

* les: disconnect all peers at ns.Stop()

* les: added comments and fixed signed broadcasts

* les: removed unused parameter, fixed tests

* core: fix blockchain insert report time interval calculation (#21723)

* accounts/usbwallet: fix ledger version check (#21733)

The version check logic did not take into account the second digit (i.e. the '4' in v1.4.0) - this one line patch corrects this.

* all: implement EIP-2929 (gas cost increases for state access opcodes) + yolo-v2 (#21509)

* core/vm, core/state: implement EIP-2929 + YOLOv2

* core/state, core/vm: fix some review concerns

* core/state, core/vm: address review concerns

* core/vm: address review concerns

* core/vm: better documentation

* core/vm: unify sload cost as fully dynamic

* core/vm: fix typo

* core/vm/runtime: fix compilation flaw

* core/vm/runtime: fix renaming-err leftovers

* core/vm: renaming

* params/config: use correct yolov2 chainid for config

* core, params: use a proper new genesis for yolov2

* core/state/tests: golinter nitpicks

* cmd/devp2p/internal/ethtest: update test chain (#21742)

The old one was wrong in two ways: the first block in chain.rlp was the
genesis block, and the genesis difficulty was below minimum difficulty.

This also contains some other fixes to the test.

* utils, params: add yolov2 bootnode

* params: update yolov2 bootnode with elastic ip

* cmd/geth: fix dir path in geth attach for yolov2 network (#21749)

* accounts/abi/bind: restore error functionality (#21743)

* accounts/abi/bind: restore error functionality

* Update accounts/abi/bind/base.go

Co-authored-by: Guillaume Ballet <gballet@gmail.com>

Co-authored-by: Guillaume Ballet <gballet@gmail.com>

* core/state: maintain one more diff layer (#21730)

* core/state: maintain one more diff layer

* core/state: address comment

* core/state: disable snapshot iteration if it's not fully constructed (#21682)

* core/state/snapshot: add diskRoot function

* core/state/snapshot: disable iteration if the snapshot is generating

* core/state/snapshot: simplify the function

* core/state: panic for undefined layer

* core: improve snapshot journal recovery (#21594)

* core/state/snapshot: introduce snapshot journal version

* core: update the disk layer in an atomic way

* core: persist the disk layer generator periodically

* core/state/snapshot: improve logging

* core/state/snapshot: forcibly ensure the legacy snapshot is matched

* core/state/snapshot: add debug logs

* core, tests: fix tests and special recovery case

* core: polish

* core: add more blockchain tests for snapshot recovery

* core/state: fix comment

* core: add recovery flag for snapshot

* core: add restart after start-after-crash tests

* core/rawdb: fix imports

* core: fix tests

* core: remove log

* core/state/snapshot: fix snapshot

* core: avoid callbacks in SetHead

* core: fix setHead cornercase where the threshold root has state

* core: small docs for the test cases

Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* les, p2p/simulations/adapters: fix issues found while simulating les  (#21761)

This adds a few tiny fixes for les and the p2p simulation framework:

LES Parts

- Keep the LES-SERVER connection even it's non-synced

  We had this idea to reject the connections in LES protocol if the les-server itself is
  not synced. However, in LES protocol we will also receive the connection from another
  les-server. In this case even the local node is not synced yet, we should keep the tcp
  connection for other protocols(e.g. eth protocol).

- Don't count "invalid message" for non-existing GetBlockHeadersMsg request

  In the eth syncing mechanism (full sync, fast sync, light sync), it will try to fetch
  some non-existent blocks or headers(to ensure we indeed download all the missing chain).
  In this case, it's possible that the les-server will receive the request for
  non-existent headers. So don't count it as the "invalid message" for scheduling
  dropping.

- Copy the announce object in the closure

  Before the les-server pushes the latest headers to all connected clients, it will create
  a closure and queue it in the underlying request scheduler. In some scenarios it's
  problematic. E.g, in private networks, the block can be mined very fast. So before the
  first closure is executed, we may already update the latest_announce object. So actually
  the "announce" object we want to send is replaced.

  The downsize is the client will receive two announces with the same td and then drop the
  server.

P2P Simulation Framework

- Don't double register the protocol services in p2p-simulation "Start".

  The protocols upon the devp2p are registered in the "New node stage". So don't reigster
  them again when starting a node in the p2p simulation framework

- Add one more new config field "ExternalSigner", in order to use clef service in the
  framework.

* common: remove ToHex and ToHexArray (#21610)

ToHex was deprecated a couple years ago. The last remaining use
was in ToHexArray, which itself only had a single call site.

This just moves ToHexArray near its only remaining call site and
implements it using hexutil.Encode. This changes the default behaviour
of ToHexArray and with it the behaviour of eth_getProof. Previously we
encoded an empty slice as 0, now the empty slice is encoded as 0x.

* core/state/snapshot: fix journal recovery from generating old journal (#21775)

* core/state/snapshot: print warning if failed to resolve journal

* core/state/snapshot: fix snapshot recovery

When we meet the snapshot journal consisted with:
- disk layer generator with new-format
- diff layer journal with old-format

The base layer should be returned without error.
The broken diff layer can be reconstructed later
but we definitely don't want to reconstruct the
huge diff layer.

* core: add tests

* cmd/devp2p, internal/utesting: implement TAP output (#21760)

TAP is a text format for test results. Parsers for it are available in many languages,
making it easy to consume. I want TAP output from our protocol tests because the
Hive wrapper around them needs to know about the test names and their individual
results and logs. It would also be possible to just write this info as JSON, but I don't
want to invent a new format.

This also improves the normal console output for tests (when running without --tap).
It now prints -- RUN lines before any output from the test, and indents the log output
by one space.

* cmd/devp2p/internal/ethtest: add correct chain files and improve test output (#21782)

This PR replaces the old test genesis.json and chain.rlp files in the testdata
directory for the eth protocol test suite, and also adds documentation for
running the eth test suite locally.

It also improves the test output text and adds more timeouts.

Co-authored-by: Felix Lange <fjl@twurst.com>

* core/types, rlp: optimize derivesha (#21728)

This PR contains a minor optimization in derivesha, by exposing the RLP
int-encoding and making use of it to write integers directly to a
buffer (an RLP integer is known to never require more than 9 bytes
total). rlp.AppendUint64 might be useful in other places too.

The code assumes, just as before, that the hasher (a trie) will copy the
key internally, which it does when doing keybytesToHex(key).

Co-authored-by: Felix Lange <fjl@twurst.com>

* build: stop verbose output to keep travis from overflowing

* consensus/ethash: fix the percentage progress report

* core/state/snapshot: update generator marker in sync with flushes

* trie, tests/fuzzers: implement a stacktrie fuzzer + stacktrie fixes (#21799)

* trie: fix error in stacktrie not committing small roots

* fuzzers: make trie-fuzzer use correct returnvalues

* trie: improved tests

* tests/fuzzers: fuzzer for stacktrie vs regular trie

* test/fuzzers: make stacktrie fuzzer use 32-byte keys

* trie: fix error in stacktrie with small nodes

* trie: add (skipped) testcase for stacktrie

* tests/fuzzers: address review comments for stacktrie fuzzer

* trie: fix docs in stacktrie

* travis: drop Go 1.13 builders as it's not supported any more

* build: stop building for Ubuntu Eoan, not supported any more

* p2p/simulations/adapters/exec: fix some issues (#21801)

- Remove the ws:// prefix from the status endpoint since
  the ws:// is already included in the stack.WSEndpoint().
- Don't register the services again in the node start.
  Registration is already done in the initialization stage.
- Expose admin namespace via websocket.
  This namespace is necessary for connecting the peers via websocket.
- Offer logging relevant options for exec adapter.
  It's really painful to mix all log output in the single console. So
  this PR offers two additional options for exec adapter in this case
  testers can config the log output(e.g. file output) and log level
  for each p2p node.

* scripts: create oss-fuzz script in go-ethereum (#21808)

* fuzzers: removed fuzzbuzz configuration (#21813)

We decided to move our fuzzing efforts to oss-fuzz since fuzzbuzz is still early access.

* build: add -dlgo flag in ci.go (#21824)

This new flag downloads a known version of Go and builds with it. This
is meant for environments where we can't easily upgrade the installed Go
version.

* .travis.yml: remove install step for PR test builders

We added this step originally to avoid re-building everything
for every test. go test has become much smarter in recent go
releases, so we no longer need to install anything here.

* consensus/ethash: use 64bit indexes for the DAG generation (#21793)

* Bit boundary fix for the DAG generation routine

* Fix unnecessary conversion warnings

Co-authored-by: Sergey Pavlov <spavlov@gmail.com>

* build: fix regressions with the -dlgo change (#21831)

This fixes cross-build and mobile framework failures.
It also disables the mac test builder because it was failing
all the time in hard to understand ways and we can't afford
it anymore under Travis CI's new pricing.

* .travis.yml: move test builders after install builders (#21833)

* params: release Geth v1.9.24 with Go 1.15.5 (#21842)

* params: begin v1.9.25 release cycle

* crypto/bn256: improve bn256 fuzzer (#21815)

* crypto/cloudflare: fix nil deref in random G1/G2 reading

* crypto/bn256: improve fuzzer

* crypto/bn256: fix some flaws in fuzzer

* crypto/bn256: better comments for u, P and Order (#21836)

* tests/fuzzers: improve the fuzzers (#21829)

* tests/fuzzers, common/bitutil: make fuzzers use correct returnvalues + remove output

* tests/fuzzers/stacktrie: fix duplicate-key insertion in stacktrie (false positive)

* tests/fuzzers/stacktrie: fix compilation error

* tests/fuzzers: linter nits

* core/vm, protocol_params: implement eip-2565 modexp repricing (#21607)

* core/vm, protocol_params: implement eip-2565 modexp repricing

* core/vm: fix review concerns

* core, all: split vm.Context into BlockContext and TxContext (#21672)

* all: core: split vm.Config into BlockConfig and TxConfig

* core: core/vm: reset EVM between tx in block instead of creating new

* core/vm: added docs

* accounts/abi: template: set events Raw field in Parse methods (#21807)

* common: fix documentation of Address.SetBytes (#21814)

* crypto/bn256: refine comments according to #19577, #21595, and #21836 (#21847)

* consensus/ethash: fix usage of *reflect.SliceHeader (#21372)

* consensus/ethash: only use *reflect.SliceHeader, not reflect.SliceHeader. See comment here: https://github.com/golang/go/issues/40397\#issuecomment-663748689

* consensus/ethash: pr feedback from @mdempsky, makes a copy of dest such that is not mutated

* consensus/ethash: remove noop assign

* consensus/ethash: apply same fix to another location

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* cmd/geth: remove retesteth

* crypto/secp256k1: add checking z sign in affineFromJacobian (#18419)

The z == 0 check is hit whenever we Add two points with the same x1/x2
coordinate. crypto/elliptic uses the same check in their affineFromJacobian
function. This change does not affect block processing or tx signature verification
in any way, because it does not use the Add or Double methods.

* cmd/geth: improve les test on windows (#21860)

* all: disable recording preimage of trie keys (#21402)

* cmd, core, eth, light, trie: disable recording preimage by default

* core, eth: fix unit tests

* core: fix import

* all: change to nopreimage

* cmd, core, eth, trie: use cache.preimages flag

* cmd: enable preimages for archive node

* cmd/utils, trie: simplify preimage tracking a bit

* core: fix linter

Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* metrics: fix the panic for reading empty cpu stats (#21864)

* node: support expressive origin rules in ws.origins (#21481)

* Only compare hostnames in ws.origins

Also using a helper function for ToLower consolidates all preparation steps in one function for more maintainable consistency.

Spaces => tabs

Remove a semicolon

Add space at start of comment

Remove parens around conditional

Handle case wehre parsed hostname is empty

When passing a single word like "localhost" the parsed hostname is an empty string. Handle this and the error-parsing case together as default, and the nonempty hostname case in the conditional.

Refactor with new originIsAllowed functions

Adds originIsAllowed() & ruleAllowsOrigin(); removes prepOriginForComparison

Remove blank line

Added tests for simple allowed-orign rule

which does not specify a protocol or port, just a hostname

Fix copy-paste: `:=` => `=`

Remove parens around conditional

Remove autoadded whitespace on blank lines

Compare scheme, hostname, and port with rule

if the rule specifies those portions.

Remove one autoadded trailing whitespace

Better handle case where only origin host is given

e.g. "localhost"

Remove parens around conditional

Refactor: attemptWebsocketConnectionFromOrigin DRY

Include return type on helper function

Provide srv obj in helper fn

Provide srv to helper fn

Remove stray underscore

Remove blank line

parent 93e666b4c1e7e49b8406dc83ed93f4a02ea49ac1
author wbt <wbt@users.noreply.github.com> 1598559718 -0400
committer Martin Holst Swende <martin@swende.se> 1605602257 +0100
gpgsig -----BEGIN PGP SIGNATURE-----

 iQFFBAABCAAvFiEEypmrtbNuJK1doP1AaDtDjAWl3fAFAl+zi9ARHG1hcnRpbkBz
 d2VuZGUuc2UACgkQaDtDjAWl3fDRiwgAoMtzU8dwRV7Q9xkCwWEx9Wz2f3n6jUr2
 VWBycDKGKwRkPPOER3oc9kzjGU/P1tFlK07PjfnAKZ9KWzxpDcJZwYM3xCBurG7A
 16y4YsQnzgPNONv3xIkdi3RZtDBIiPFFEmdZFFvZ/jKexfI6JIYPngCAoqdTIFb9
 On/aPvvVWQn1ExfmarsvvJ7kUDUG77tZipuacEH5FfFsfelBWOEYPe+I9ToUHskv
 +qO6rOkV1Ojk8eBc6o0R1PnApwCAlEhJs7aM/SEOg4B4ZJJneiFuEXBIG9+0yS2I
 NOicuDPLGucOB5nBsfIKI3USPeE+3jxdT8go2lN5Nrhm6MimoILDsQ==
 =sgUp
 -----END PGP SIGNATURE-----

Refactor: drop err var for more concise test lines

Add several tests for new WebSocket origin checks

Remove autoadded whitespace on blank lines

Restore TestWebsocketOrigins originally-named test

and rename the others to be helpers rather than full tests

Remove autoadded whitespace on blank line

Temporarily comment out new test sets

Uncomment test around origin rule with scheme

Remove tests without scheme on browser origin

per https://github.com/ethereum/go-ethereum/pull/21481/files#r479371498

Uncomment tests with port; remove some blank lines

Handle when browser does not specify scheme/port

Uncomment test for including scheme & port in rule

Add IP tests

* node: more tests + table-driven, ws origin changes

Co-authored-by: Martin Holst Swende <martin@swende.se>

* trie, rpc, cmd/geth: fix tests on 32-bit and windows + minor rpc fixes (#21871)

* trie: fix tests to work on 32-bit systems

* les: make test work on 32-bit platform

* cmd/geth: fix windows-issues on tests

* trie: improve balance

* cmd/geth: make account tests less verbose + less mem intense

* rpc: make debug-level log output less verbose

* cmd/geth: lint

* crypto/bn256: fix bn256Mul fuzzer to not hang on large input (#21872)

* crypto/bn256: fix bn256Mul fuzzer to not hang on large input

* Update crypto/bn256/bn256_fuzz.go

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

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

* p2p: avoid spinning loop on out-of-handles (#21878)

* p2p: avoid busy-loop on temporary errors

* p2p: address review concerns

* les/utils: protect against WeightedRandomSelect overflow (#21839)

Also fixes a bug in les/flowcontrol that caused the overflow.

* github: Add new style of issue-templates

closes #20024

* tests/fuzzers/bls1381: add bls fuzzer (#21796)

* added bls fuzzer

* crypto/bls12381: revert bls-changes, fixup fuzzer tests

* fuzzers: split bls fuzzing into 8 different units

* fuzzers/bls: remove (now stale) corpus

* crypto/bls12381: added blsfuzz corpus

* fuzzers/bls12381: fix the bls corpus

* fuzzers: fix oss-fuzz script

* tests/fuzzers: fixups on bls corpus

* test/fuzzers: remove leftover corpus

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

* cmd/faucet: improve handling of facebook post url (#21838)

Resolves #21532

Co-authored-by: roger <dengjun@huobi.com>

* les: fix GetProofsV2 bug (#21896)

* github: Remove vulnerability.md (#21894)

This type is automatically offered by github after changing to the new style and a security.md being present

* cmd/devp2p/internal/ethtest: add 'large announcement' tests (#21792)

* cmd/devp2p/internal/ethtest: added large announcement tests

* cmd/devp2p/internal/ethtest: added large announcement tests

* cmd/devp2p/internal/ethtest: refactored stuff a bit

* cmd/devp2p/internal/ethtest: added TestMaliciousStatus/Handshake

* cmd/devp2p/internal/ethtest: fixed rebasing issue

* happy linter, happy life

* cmd/devp2p/internal/ethtest: used readAndServe

* stuff

* cmd/devp2p/internal/ethtest: fixed test cases

* core/types: fixed typo (#21897)

* all: simplify nested complexity and if blocks ending with a return statement (#21854)

Changes:

    Simplify nested complexity
    If an if blocks ends with a return statement then remove the else nesting.

Most of the changes has also been reported in golint https://goreportcard.com/report/github.com/ethereum/go-ethereum#golint

* graphql: always return 400 if errors are present in the response (#21882)

* Make sure to return 400 when errors are present in the response

* graphql: use less memory in chainconfig for tests

Co-authored-by: Martin Holst Swende <martin@swende.se>

* all: remove redundant conversions and import names (#21903)

* p2p/discover: fix deadlock in discv5 message dispatch (#21858)

This fixes a deadlock that could occur when a response packet arrived
after a call had already received enough responses and was about to
signal completion to the dispatch loop.

Co-authored-by: Felix Lange <fjl@twurst.com>

* crypto: signing builds with signify/minisign (#21798)

* internal/build: implement signify's signing func
* Add signify to the ci utility
* fix output file format
* Add unit test for signify
* holiman's + travis' feedback
* internal/build: verify signify's output
* crypto: move signify to common dir
* use go-minisign to verify binaries
* more holiman feedback
* crypto, ci: support minisign output
* only accept one-line trusted comments
* configurable untrusted comments
* code cleanup in tests
* revert to use ed25519 from the stdlib
* bug: fix for empty untrusted comments
* write timestamp as comment if trusted comment isn't present
* rename line checker to commentHasManyLines
* crypto: added signify fuzzer (#6)
* crypto: added signify fuzzer
* stuff
* crypto: updated signify fuzzer to fuzz comments
* crypto: repro signify crashes
* rebased fuzzer on build-signify branch
* hide fuzzer behind gofuzz build flag
* extract key data inside a single function
* don't treat \r as a newline
* travis: fix signing command line
* do not use an external binary in tests
* crypto: move signify to crypto/signify
* travis: fix formatting issue
* ci: fix linter build after package move

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

* accounts, signer: fix Ledger Live account derivation path (clef) (#21757)

* signer/core/api: fix derivation of ledger live accounts

For ledger hardware wallets, change account iteration as follows:

- ledger legacy: m/44'/60'/0'/X; for 0<=X<5
- ledger live: m/44'/60'/0'/0/X; for 0<=X<5

- ledger legacy: m/44'/60'/0'/X; for 0<=X<10
- ledger live: m/44'/60'/X'/0/0; for 0<=X<10

Non-ledger derivation is unchanged and remains as:
- non-ledger: m/44'/60'/0'/0/X; for 0<=X<10

* signer/core/api: derive ten default paths for all hardware wallets, plus ten legacy and ten live paths for ledger wallets

* signer/core/api: as .../0'/0/0 already included by default paths, do not include it again with ledger live paths

* accounts, signer: implement path iterators for hd wallets

Co-authored-by: Martin Holst Swende <martin@swende.se>

* accounts/keystore: add missing function doc for SignText (#21914)

Co-authored-by: Pascal Dierich <pascal@pascaldierich.com>

* cmd/geth: make tests run quicker + use less memory and disk (#21919)

* cmd/devp2p/internal/ethtest: add transaction tests (#21857)

* 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.

* les: fix nodiscover option (#21906)

* params: update CHTs (#21941)

* eth: fix error in tracing if reexec is set (#21830)

* eth: fix error in tracing if reexec is set

* eth: change pointer embedding to value-embedding

* go.mod: update github.com/golang/snappy(#21934)

This updates the snappy library depency to include a fix for
a Go 1.16 incompatibility issue.

* cmd/devp2p: add node filter for snap + fix arg error (#21950)

* core/vm/runtime: remove duplicated line (#21956)


This line is duplicated, though it doesn't cause any issues.

* 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.

* 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>

* 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

* 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

* 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

* 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>

* 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>

* cmd/geth: add test to verify regexps in version check (#21962)

* 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.

* 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

* 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

* 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.

* les: introduce forkID (#21974)

* les: introduce forkID

* les: address comment

* build: upgrade to Go 1.15.6 (#21986)

* params: go-ethereum v1.9.25 stable

* update README.md

* update Makefile

* add mining node as bootnode

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Giuseppe Bertone <bertone.giuseppe@gmail.com>
Co-authored-by: gary rong <garyrong0905@gmail.com>
Co-authored-by: timcooijmans <timcooijmans@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Shude Li <islishude@gmail.com>
Co-authored-by: ucwong <ucwong@126.com>
Co-authored-by: libotony <liboliqi@gmail.com>
Co-authored-by: Fuyang Deng <dengfuyang@outlook.com>
Co-authored-by: Hanjiang Yu <delacroix.yu@gmail.com>
Co-authored-by: Osoro Bironga <fanosoro@gmail.com>
Co-authored-by: Osoro Bironga <osoro@doctaroo.com>
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
Co-authored-by: Dan Sosedoff <dan.sosedoff@gmail.com>
Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
Co-authored-by: Julian Koh <jk2698@cornell.edu>
Co-authored-by: Kirill Elagin <kirelagin@gmail.com>
Co-authored-by: Mason Fischer <mason@kissr.co>
Co-authored-by: Vinod Damle <vdamle@users.noreply.github.com>
Co-authored-by: sarath <sarath@melvault.com>
Co-authored-by: rene <41963722+renaynay@users.noreply.github.com>
Co-authored-by: Binacs <bin646891055@gmail.com>
Co-authored-by: aaronbuchwald <aaron.buchwald56@gmail.com>
Co-authored-by: mr_franklin <mr_franklin@126.com>
Co-authored-by: shigeyuki azuchi <azuchi@chaintope.com>
Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com>
Co-authored-by: meows <b5c6@protonmail.com>
Co-authored-by: hwanjo <34005989+hwanjo@users.noreply.github.com>
Co-authored-by: Kristofer Peterson <svenski123@users.noreply.github.com>
Co-authored-by: James Prestwich <10149425+prestwich@users.noreply.github.com>
Co-authored-by: Slava Karpenko <slavikus@gmail.com>
Co-authored-by: Sergey Pavlov <spavlov@gmail.com>
Co-authored-by: Nicolas Feignon <nfeignon@gmail.com>
Co-authored-by: Pascal Dierich <pascal@pascaldierich.com>
Co-authored-by: Sad Pencil <sadpencil@outlook.com>
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
Co-authored-by: Abd ar-Rahman Hamidi <bakhtiyor.h@gmail.com>
Co-authored-by: wbt <wbt@users.noreply.github.com>
Co-authored-by: ligi <ligi@ligi.de>
Co-authored-by: LieutenantRoger <dijsky_2015@hotmail.com>
Co-authored-by: roger <dengjun@huobi.com>
Co-authored-by: Alex Prut <1648497+alexprut@users.noreply.github.com>
Co-authored-by: Antoine Toulme <atoulme@users.noreply.github.com>
Co-authored-by: Nishant Das <nishdas93@gmail.com>
Co-authored-by: Pascal Dierich <pascal@merkleplant.xyz>
Co-authored-by: Chris Ziogas <ziogas_chr@hotmail.com>
Co-authored-by: Steve Ruckdashel <steven.ruckdashel@optum.com>
Co-authored-by: Li, Cheng <lob4tt@gmail.com>
baptiste-b-pegasys added a commit to Consensys/quorum that referenced this issue Sep 3, 2021
* params: begin v1.9.25 release cycle

* crypto/bn256: improve bn256 fuzzer (#21815)

* crypto/cloudflare: fix nil deref in random G1/G2 reading

* crypto/bn256: improve fuzzer

* crypto/bn256: fix some flaws in fuzzer

* crypto/bn256: better comments for u, P and Order (#21836)

* tests/fuzzers: improve the fuzzers (#21829)

* tests/fuzzers, common/bitutil: make fuzzers use correct returnvalues + remove output

* tests/fuzzers/stacktrie: fix duplicate-key insertion in stacktrie (false positive)

* tests/fuzzers/stacktrie: fix compilation error

* tests/fuzzers: linter nits

* core/vm, protocol_params: implement eip-2565 modexp repricing (#21607)

* core/vm, protocol_params: implement eip-2565 modexp repricing

* core/vm: fix review concerns

* core, all: split vm.Context into BlockContext and TxContext (#21672)

* all: core: split vm.Config into BlockConfig and TxConfig

* core: core/vm: reset EVM between tx in block instead of creating new

* core/vm: added docs

* accounts/abi: template: set events Raw field in Parse methods (#21807)

* common: fix documentation of Address.SetBytes (#21814)

* crypto/bn256: refine comments according to #19577, #21595, and #21836 (#21847)

* consensus/ethash: fix usage of *reflect.SliceHeader (#21372)

* consensus/ethash: only use *reflect.SliceHeader, not reflect.SliceHeader. See comment here: golang/go#40397

* consensus/ethash: pr feedback from @mdempsky, makes a copy of dest such that is not mutated

* consensus/ethash: remove noop assign

* consensus/ethash: apply same fix to another location

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* cmd/geth: remove retesteth

* crypto/secp256k1: add checking z sign in affineFromJacobian (#18419)

The z == 0 check is hit whenever we Add two points with the same x1/x2
coordinate. crypto/elliptic uses the same check in their affineFromJacobian
function. This change does not affect block processing or tx signature verification
in any way, because it does not use the Add or Double methods.

* cmd/geth: improve les test on windows (#21860)

* all: disable recording preimage of trie keys (#21402)

* cmd, core, eth, light, trie: disable recording preimage by default

* core, eth: fix unit tests

* core: fix import

* all: change to nopreimage

* cmd, core, eth, trie: use cache.preimages flag

* cmd: enable preimages for archive node

* cmd/utils, trie: simplify preimage tracking a bit

* core: fix linter

Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* metrics: fix the panic for reading empty cpu stats (#21864)

* node: support expressive origin rules in ws.origins (#21481)

* Only compare hostnames in ws.origins

Also using a helper function for ToLower consolidates all preparation steps in one function for more maintainable consistency.

Spaces => tabs

Remove a semicolon

Add space at start of comment

Remove parens around conditional

Handle case wehre parsed hostname is empty

When passing a single word like "localhost" the parsed hostname is an empty string. Handle this and the error-parsing case together as default, and the nonempty hostname case in the conditional.

Refactor with new originIsAllowed functions

Adds originIsAllowed() & ruleAllowsOrigin(); removes prepOriginForComparison

Remove blank line

Added tests for simple allowed-orign rule

which does not specify a protocol or port, just a hostname

Fix copy-paste: `:=` => `=`

Remove parens around conditional

Remove autoadded whitespace on blank lines

Compare scheme, hostname, and port with rule

if the rule specifies those portions.

Remove one autoadded trailing whitespace

Better handle case where only origin host is given

e.g. "localhost"

Remove parens around conditional

Refactor: attemptWebsocketConnectionFromOrigin DRY

Include return type on helper function

Provide srv obj in helper fn

Provide srv to helper fn

Remove stray underscore

Remove blank line

parent 93e666b4c1e7e49b8406dc83ed93f4a02ea49ac1
author wbt <wbt@users.noreply.github.com> 1598559718 -0400
committer Martin Holst Swende <martin@swende.se> 1605602257 +0100
gpgsig -----BEGIN PGP SIGNATURE-----

 iQFFBAABCAAvFiEEypmrtbNuJK1doP1AaDtDjAWl3fAFAl+zi9ARHG1hcnRpbkBz
 d2VuZGUuc2UACgkQaDtDjAWl3fDRiwgAoMtzU8dwRV7Q9xkCwWEx9Wz2f3n6jUr2
 VWBycDKGKwRkPPOER3oc9kzjGU/P1tFlK07PjfnAKZ9KWzxpDcJZwYM3xCBurG7A
 16y4YsQnzgPNONv3xIkdi3RZtDBIiPFFEmdZFFvZ/jKexfI6JIYPngCAoqdTIFb9
 On/aPvvVWQn1ExfmarsvvJ7kUDUG77tZipuacEH5FfFsfelBWOEYPe+I9ToUHskv
 +qO6rOkV1Ojk8eBc6o0R1PnApwCAlEhJs7aM/SEOg4B4ZJJneiFuEXBIG9+0yS2I
 NOicuDPLGucOB5nBsfIKI3USPeE+3jxdT8go2lN5Nrhm6MimoILDsQ==
 =sgUp
 -----END PGP SIGNATURE-----

Refactor: drop err var for more concise test lines

Add several tests for new WebSocket origin checks

Remove autoadded whitespace on blank lines

Restore TestWebsocketOrigins originally-named test

and rename the others to be helpers rather than full tests

Remove autoadded whitespace on blank line

Temporarily comment out new test sets

Uncomment test around origin rule with scheme

Remove tests without scheme on browser origin

per https://github.com/ethereum/go-ethereum/pull/21481/files#r479371498

Uncomment tests with port; remove some blank lines

Handle when browser does not specify scheme/port

Uncomment test for including scheme & port in rule

Add IP tests

* node: more tests + table-driven, ws origin changes

Co-authored-by: Martin Holst Swende <martin@swende.se>

* trie, rpc, cmd/geth: fix tests on 32-bit and windows + minor rpc fixes (#21871)

* trie: fix tests to work on 32-bit systems

* les: make test work on 32-bit platform

* cmd/geth: fix windows-issues on tests

* trie: improve balance

* cmd/geth: make account tests less verbose + less mem intense

* rpc: make debug-level log output less verbose

* cmd/geth: lint

* crypto/bn256: fix bn256Mul fuzzer to not hang on large input (#21872)

* crypto/bn256: fix bn256Mul fuzzer to not hang on large input

* Update crypto/bn256/bn256_fuzz.go

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

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

* p2p: avoid spinning loop on out-of-handles (#21878)

* p2p: avoid busy-loop on temporary errors

* p2p: address review concerns

* les/utils: protect against WeightedRandomSelect overflow (#21839)

Also fixes a bug in les/flowcontrol that caused the overflow.

* github: Add new style of issue-templates

closes #20024

* tests/fuzzers/bls1381: add bls fuzzer (#21796)

* added bls fuzzer

* crypto/bls12381: revert bls-changes, fixup fuzzer tests

* fuzzers: split bls fuzzing into 8 different units

* fuzzers/bls: remove (now stale) corpus

* crypto/bls12381: added blsfuzz corpus

* fuzzers/bls12381: fix the bls corpus

* fuzzers: fix oss-fuzz script

* tests/fuzzers: fixups on bls corpus

* test/fuzzers: remove leftover corpus

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

* cmd/faucet: improve handling of facebook post url (#21838)

Resolves #21532

Co-authored-by: roger <dengjun@huobi.com>

* les: fix GetProofsV2 bug (#21896)

* github: Remove vulnerability.md (#21894)

This type is automatically offered by github after changing to the new style and a security.md being present

* cmd/devp2p/internal/ethtest: add 'large announcement' tests (#21792)

* cmd/devp2p/internal/ethtest: added large announcement tests

* cmd/devp2p/internal/ethtest: added large announcement tests

* cmd/devp2p/internal/ethtest: refactored stuff a bit

* cmd/devp2p/internal/ethtest: added TestMaliciousStatus/Handshake

* cmd/devp2p/internal/ethtest: fixed rebasing issue

* happy linter, happy life

* cmd/devp2p/internal/ethtest: used readAndServe

* stuff

* cmd/devp2p/internal/ethtest: fixed test cases

* core/types: fixed typo (#21897)

* all: simplify nested complexity and if blocks ending with a return statement (#21854)

Changes:

    Simplify nested complexity
    If an if blocks ends with a return statement then remove the else nesting.

Most of the changes has also been reported in golint https://goreportcard.com/report/github.com/ethereum/go-ethereum#golint

* graphql: always return 400 if errors are present in the response (#21882)

* Make sure to return 400 when errors are present in the response

* graphql: use less memory in chainconfig for tests

Co-authored-by: Martin Holst Swende <martin@swende.se>

* all: remove redundant conversions and import names (#21903)

* p2p/discover: fix deadlock in discv5 message dispatch (#21858)

This fixes a deadlock that could occur when a response packet arrived
after a call had already received enough responses and was about to
signal completion to the dispatch loop.

Co-authored-by: Felix Lange <fjl@twurst.com>

* crypto: signing builds with signify/minisign (#21798)

* internal/build: implement signify's signing func
* Add signify to the ci utility
* fix output file format
* Add unit test for signify
* holiman's + travis' feedback
* internal/build: verify signify's output
* crypto: move signify to common dir
* use go-minisign to verify binaries
* more holiman feedback
* crypto, ci: support minisign output
* only accept one-line trusted comments
* configurable untrusted comments
* code cleanup in tests
* revert to use ed25519 from the stdlib
* bug: fix for empty untrusted comments
* write timestamp as comment if trusted comment isn't present
* rename line checker to commentHasManyLines
* crypto: added signify fuzzer (#6)
* crypto: added signify fuzzer
* stuff
* crypto: updated signify fuzzer to fuzz comments
* crypto: repro signify crashes
* rebased fuzzer on build-signify branch
* hide fuzzer behind gofuzz build flag
* extract key data inside a single function
* don't treat \r as a newline
* travis: fix signing command line
* do not use an external binary in tests
* crypto: move signify to crypto/signify
* travis: fix formatting issue
* ci: fix linter build after package move

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

* accounts, signer: fix Ledger Live account derivation path (clef) (#21757)

* signer/core/api: fix derivation of ledger live accounts

For ledger hardware wallets, change account iteration as follows:

- ledger legacy: m/44'/60'/0'/X; for 0<=X<5
- ledger live: m/44'/60'/0'/0/X; for 0<=X<5

- ledger legacy: m/44'/60'/0'/X; for 0<=X<10
- ledger live: m/44'/60'/X'/0/0; for 0<=X<10

Non-ledger derivation is unchanged and remains as:
- non-ledger: m/44'/60'/0'/0/X; for 0<=X<10

* signer/core/api: derive ten default paths for all hardware wallets, plus ten legacy and ten live paths for ledger wallets

* signer/core/api: as .../0'/0/0 already included by default paths, do not include it again with ledger live paths

* accounts, signer: implement path iterators for hd wallets

Co-authored-by: Martin Holst Swende <martin@swende.se>

* accounts/keystore: add missing function doc for SignText (#21914)

Co-authored-by: Pascal Dierich <pascal@pascaldierich.com>

* cmd/geth: make tests run quicker + use less memory and disk (#21919)

* cmd/devp2p/internal/ethtest: add transaction tests (#21857)

* 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.

* les: fix nodiscover option (#21906)

* params: update CHTs (#21941)

* eth: fix error in tracing if reexec is set (#21830)

* eth: fix error in tracing if reexec is set

* eth: change pointer embedding to value-embedding

* go.mod: update github.com/golang/snappy(#21934)

This updates the snappy library depency to include a fix for
a Go 1.16 incompatibility issue.

* cmd/devp2p: add node filter for snap + fix arg error (#21950)

* core/vm/runtime: remove duplicated line (#21956)


This line is duplicated, though it doesn't cause any issues.

* 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.

* 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>

* 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

* 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

* 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

* 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>

* 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>

* cmd/geth: add test to verify regexps in version check (#21962)

* 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.

* 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

* 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

* 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.

* les: introduce forkID (#21974)

* les: introduce forkID

* les: address comment

* build: upgrade to Go 1.15.6 (#21986)

* params: go-ethereum v1.9.25 stable

* fix: merge

* fix: review GoQ versions

* fix: GoQuorum signer

* fix: state processor, missing err formatting

* fix: restore tx GoQ modification

* fix: work with eip155 & psm tests

* fix: cmd geth tests

* fix: format (lint)

* fix: copy default value, don't erase it

* fix: cache config -> trie Config

* fix: unit test restored, check another error

* refactor: remove unused parameters

* fix: configure with default cache config

* fix: merge of master

* go 1.15.6

* fix: for review

* revert: unnecessary change

* fix: remove comment

* fix: review of variable name

* fix: use the ChainContext interface
in state_processor to be aligned with geth

* fix: null pointer

* fix: don't check nil pointer
but pass a non nil value

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Nicolas Feignon <nfeignon@gmail.com>
Co-authored-by: Pascal Dierich <pascal@pascaldierich.com>
Co-authored-by: Sad Pencil <sadpencil@outlook.com>
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Abd ar-Rahman Hamidi <bakhtiyor.h@gmail.com>
Co-authored-by: gary rong <garyrong0905@gmail.com>
Co-authored-by: wbt <wbt@users.noreply.github.com>
Co-authored-by: ligi <ligi@ligi.de>
Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
Co-authored-by: LieutenantRoger <dijsky_2015@hotmail.com>
Co-authored-by: roger <dengjun@huobi.com>
Co-authored-by: Alex Prut <1648497+alexprut@users.noreply.github.com>
Co-authored-by: Antoine Toulme <atoulme@users.noreply.github.com>
Co-authored-by: Nishant Das <nishdas93@gmail.com>
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
Co-authored-by: Kristofer Peterson <svenski123@users.noreply.github.com>
Co-authored-by: Pascal Dierich <pascal@merkleplant.xyz>
Co-authored-by: Chris Ziogas <ziogas_chr@hotmail.com>
Co-authored-by: Steve Ruckdashel <steven.ruckdashel@optum.com>
Co-authored-by: Li, Cheng <lob4tt@gmail.com>
Co-authored-by: Baptiste Boussemart <baptiste.boussemart@consensys.net>
Co-authored-by: baptiste-b-pegasys <85155432+baptiste-b-pegasys@users.noreply.github.com>
Co-authored-by: Ricardo Silva <1945557+ricardolyn@users.noreply.github.com>
danielporto pushed a commit to danielporto/quorum that referenced this issue Sep 7, 2021
* params: begin v1.9.25 release cycle

* crypto/bn256: improve bn256 fuzzer (#21815)

* crypto/cloudflare: fix nil deref in random G1/G2 reading

* crypto/bn256: improve fuzzer

* crypto/bn256: fix some flaws in fuzzer

* crypto/bn256: better comments for u, P and Order (#21836)

* tests/fuzzers: improve the fuzzers (#21829)

* tests/fuzzers, common/bitutil: make fuzzers use correct returnvalues + remove output

* tests/fuzzers/stacktrie: fix duplicate-key insertion in stacktrie (false positive)

* tests/fuzzers/stacktrie: fix compilation error

* tests/fuzzers: linter nits

* core/vm, protocol_params: implement eip-2565 modexp repricing (#21607)

* core/vm, protocol_params: implement eip-2565 modexp repricing

* core/vm: fix review concerns

* core, all: split vm.Context into BlockContext and TxContext (#21672)

* all: core: split vm.Config into BlockConfig and TxConfig

* core: core/vm: reset EVM between tx in block instead of creating new

* core/vm: added docs

* accounts/abi: template: set events Raw field in Parse methods (#21807)

* common: fix documentation of Address.SetBytes (#21814)

* crypto/bn256: refine comments according to #19577, #21595, and #21836 (#21847)

* consensus/ethash: fix usage of *reflect.SliceHeader (#21372)

* consensus/ethash: only use *reflect.SliceHeader, not reflect.SliceHeader. See comment here: golang/go#40397

* consensus/ethash: pr feedback from @mdempsky, makes a copy of dest such that is not mutated

* consensus/ethash: remove noop assign

* consensus/ethash: apply same fix to another location

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* cmd/geth: remove retesteth

* crypto/secp256k1: add checking z sign in affineFromJacobian (#18419)

The z == 0 check is hit whenever we Add two points with the same x1/x2
coordinate. crypto/elliptic uses the same check in their affineFromJacobian
function. This change does not affect block processing or tx signature verification
in any way, because it does not use the Add or Double methods.

* cmd/geth: improve les test on windows (#21860)

* all: disable recording preimage of trie keys (#21402)

* cmd, core, eth, light, trie: disable recording preimage by default

* core, eth: fix unit tests

* core: fix import

* all: change to nopreimage

* cmd, core, eth, trie: use cache.preimages flag

* cmd: enable preimages for archive node

* cmd/utils, trie: simplify preimage tracking a bit

* core: fix linter

Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* metrics: fix the panic for reading empty cpu stats (#21864)

* node: support expressive origin rules in ws.origins (#21481)

* Only compare hostnames in ws.origins

Also using a helper function for ToLower consolidates all preparation steps in one function for more maintainable consistency.

Spaces => tabs

Remove a semicolon

Add space at start of comment

Remove parens around conditional

Handle case wehre parsed hostname is empty

When passing a single word like "localhost" the parsed hostname is an empty string. Handle this and the error-parsing case together as default, and the nonempty hostname case in the conditional.

Refactor with new originIsAllowed functions

Adds originIsAllowed() & ruleAllowsOrigin(); removes prepOriginForComparison

Remove blank line

Added tests for simple allowed-orign rule

which does not specify a protocol or port, just a hostname

Fix copy-paste: `:=` => `=`

Remove parens around conditional

Remove autoadded whitespace on blank lines

Compare scheme, hostname, and port with rule

if the rule specifies those portions.

Remove one autoadded trailing whitespace

Better handle case where only origin host is given

e.g. "localhost"

Remove parens around conditional

Refactor: attemptWebsocketConnectionFromOrigin DRY

Include return type on helper function

Provide srv obj in helper fn

Provide srv to helper fn

Remove stray underscore

Remove blank line

parent 93e666b4c1e7e49b8406dc83ed93f4a02ea49ac1
author wbt <wbt@users.noreply.github.com> 1598559718 -0400
committer Martin Holst Swende <martin@swende.se> 1605602257 +0100
gpgsig -----BEGIN PGP SIGNATURE-----

 iQFFBAABCAAvFiEEypmrtbNuJK1doP1AaDtDjAWl3fAFAl+zi9ARHG1hcnRpbkBz
 d2VuZGUuc2UACgkQaDtDjAWl3fDRiwgAoMtzU8dwRV7Q9xkCwWEx9Wz2f3n6jUr2
 VWBycDKGKwRkPPOER3oc9kzjGU/P1tFlK07PjfnAKZ9KWzxpDcJZwYM3xCBurG7A
 16y4YsQnzgPNONv3xIkdi3RZtDBIiPFFEmdZFFvZ/jKexfI6JIYPngCAoqdTIFb9
 On/aPvvVWQn1ExfmarsvvJ7kUDUG77tZipuacEH5FfFsfelBWOEYPe+I9ToUHskv
 +qO6rOkV1Ojk8eBc6o0R1PnApwCAlEhJs7aM/SEOg4B4ZJJneiFuEXBIG9+0yS2I
 NOicuDPLGucOB5nBsfIKI3USPeE+3jxdT8go2lN5Nrhm6MimoILDsQ==
 =sgUp
 -----END PGP SIGNATURE-----

Refactor: drop err var for more concise test lines

Add several tests for new WebSocket origin checks

Remove autoadded whitespace on blank lines

Restore TestWebsocketOrigins originally-named test

and rename the others to be helpers rather than full tests

Remove autoadded whitespace on blank line

Temporarily comment out new test sets

Uncomment test around origin rule with scheme

Remove tests without scheme on browser origin

per https://github.com/ethereum/go-ethereum/pull/21481/files#r479371498

Uncomment tests with port; remove some blank lines

Handle when browser does not specify scheme/port

Uncomment test for including scheme & port in rule

Add IP tests

* node: more tests + table-driven, ws origin changes

Co-authored-by: Martin Holst Swende <martin@swende.se>

* trie, rpc, cmd/geth: fix tests on 32-bit and windows + minor rpc fixes (#21871)

* trie: fix tests to work on 32-bit systems

* les: make test work on 32-bit platform

* cmd/geth: fix windows-issues on tests

* trie: improve balance

* cmd/geth: make account tests less verbose + less mem intense

* rpc: make debug-level log output less verbose

* cmd/geth: lint

* crypto/bn256: fix bn256Mul fuzzer to not hang on large input (#21872)

* crypto/bn256: fix bn256Mul fuzzer to not hang on large input

* Update crypto/bn256/bn256_fuzz.go

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

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

* p2p: avoid spinning loop on out-of-handles (#21878)

* p2p: avoid busy-loop on temporary errors

* p2p: address review concerns

* les/utils: protect against WeightedRandomSelect overflow (#21839)

Also fixes a bug in les/flowcontrol that caused the overflow.

* github: Add new style of issue-templates

closes #20024

* tests/fuzzers/bls1381: add bls fuzzer (#21796)

* added bls fuzzer

* crypto/bls12381: revert bls-changes, fixup fuzzer tests

* fuzzers: split bls fuzzing into 8 different units

* fuzzers/bls: remove (now stale) corpus

* crypto/bls12381: added blsfuzz corpus

* fuzzers/bls12381: fix the bls corpus

* fuzzers: fix oss-fuzz script

* tests/fuzzers: fixups on bls corpus

* test/fuzzers: remove leftover corpus

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

* cmd/faucet: improve handling of facebook post url (#21838)

Resolves #21532

Co-authored-by: roger <dengjun@huobi.com>

* les: fix GetProofsV2 bug (#21896)

* github: Remove vulnerability.md (#21894)

This type is automatically offered by github after changing to the new style and a security.md being present

* cmd/devp2p/internal/ethtest: add 'large announcement' tests (#21792)

* cmd/devp2p/internal/ethtest: added large announcement tests

* cmd/devp2p/internal/ethtest: added large announcement tests

* cmd/devp2p/internal/ethtest: refactored stuff a bit

* cmd/devp2p/internal/ethtest: added TestMaliciousStatus/Handshake

* cmd/devp2p/internal/ethtest: fixed rebasing issue

* happy linter, happy life

* cmd/devp2p/internal/ethtest: used readAndServe

* stuff

* cmd/devp2p/internal/ethtest: fixed test cases

* core/types: fixed typo (#21897)

* all: simplify nested complexity and if blocks ending with a return statement (#21854)

Changes:

    Simplify nested complexity
    If an if blocks ends with a return statement then remove the else nesting.

Most of the changes has also been reported in golint https://goreportcard.com/report/github.com/ethereum/go-ethereum#golint

* graphql: always return 400 if errors are present in the response (#21882)

* Make sure to return 400 when errors are present in the response

* graphql: use less memory in chainconfig for tests

Co-authored-by: Martin Holst Swende <martin@swende.se>

* all: remove redundant conversions and import names (#21903)

* p2p/discover: fix deadlock in discv5 message dispatch (#21858)

This fixes a deadlock that could occur when a response packet arrived
after a call had already received enough responses and was about to
signal completion to the dispatch loop.

Co-authored-by: Felix Lange <fjl@twurst.com>

* crypto: signing builds with signify/minisign (#21798)

* internal/build: implement signify's signing func
* Add signify to the ci utility
* fix output file format
* Add unit test for signify
* holiman's + travis' feedback
* internal/build: verify signify's output
* crypto: move signify to common dir
* use go-minisign to verify binaries
* more holiman feedback
* crypto, ci: support minisign output
* only accept one-line trusted comments
* configurable untrusted comments
* code cleanup in tests
* revert to use ed25519 from the stdlib
* bug: fix for empty untrusted comments
* write timestamp as comment if trusted comment isn't present
* rename line checker to commentHasManyLines
* crypto: added signify fuzzer (Consensys#6)
* crypto: added signify fuzzer
* stuff
* crypto: updated signify fuzzer to fuzz comments
* crypto: repro signify crashes
* rebased fuzzer on build-signify branch
* hide fuzzer behind gofuzz build flag
* extract key data inside a single function
* don't treat \r as a newline
* travis: fix signing command line
* do not use an external binary in tests
* crypto: move signify to crypto/signify
* travis: fix formatting issue
* ci: fix linter build after package move

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

* accounts, signer: fix Ledger Live account derivation path (clef) (#21757)

* signer/core/api: fix derivation of ledger live accounts

For ledger hardware wallets, change account iteration as follows:

- ledger legacy: m/44'/60'/0'/X; for 0<=X<5
- ledger live: m/44'/60'/0'/0/X; for 0<=X<5

- ledger legacy: m/44'/60'/0'/X; for 0<=X<10
- ledger live: m/44'/60'/X'/0/0; for 0<=X<10

Non-ledger derivation is unchanged and remains as:
- non-ledger: m/44'/60'/0'/0/X; for 0<=X<10

* signer/core/api: derive ten default paths for all hardware wallets, plus ten legacy and ten live paths for ledger wallets

* signer/core/api: as .../0'/0/0 already included by default paths, do not include it again with ledger live paths

* accounts, signer: implement path iterators for hd wallets

Co-authored-by: Martin Holst Swende <martin@swende.se>

* accounts/keystore: add missing function doc for SignText (#21914)

Co-authored-by: Pascal Dierich <pascal@pascaldierich.com>

* cmd/geth: make tests run quicker + use less memory and disk (#21919)

* cmd/devp2p/internal/ethtest: add transaction tests (#21857)

* 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.

* les: fix nodiscover option (#21906)

* params: update CHTs (#21941)

* eth: fix error in tracing if reexec is set (#21830)

* eth: fix error in tracing if reexec is set

* eth: change pointer embedding to value-embedding

* go.mod: update github.com/golang/snappy(#21934)

This updates the snappy library depency to include a fix for
a Go 1.16 incompatibility issue.

* cmd/devp2p: add node filter for snap + fix arg error (#21950)

* core/vm/runtime: remove duplicated line (#21956)


This line is duplicated, though it doesn't cause any issues.

* 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.

* 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>

* 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

* 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

* 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

* 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>

* 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>

* cmd/geth: add test to verify regexps in version check (#21962)

* 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.

* 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

* 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

* 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.

* les: introduce forkID (#21974)

* les: introduce forkID

* les: address comment

* build: upgrade to Go 1.15.6 (#21986)

* params: go-ethereum v1.9.25 stable

* fix: merge

* fix: review GoQ versions

* fix: GoQuorum signer

* fix: state processor, missing err formatting

* fix: restore tx GoQ modification

* fix: work with eip155 & psm tests

* fix: cmd geth tests

* fix: format (lint)

* fix: copy default value, don't erase it

* fix: cache config -> trie Config

* fix: unit test restored, check another error

* refactor: remove unused parameters

* fix: configure with default cache config

* fix: merge of master

* go 1.15.6

* fix: for review

* revert: unnecessary change

* fix: remove comment

* fix: review of variable name

* fix: use the ChainContext interface
in state_processor to be aligned with geth

* fix: null pointer

* fix: don't check nil pointer
but pass a non nil value

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Nicolas Feignon <nfeignon@gmail.com>
Co-authored-by: Pascal Dierich <pascal@pascaldierich.com>
Co-authored-by: Sad Pencil <sadpencil@outlook.com>
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Abd ar-Rahman Hamidi <bakhtiyor.h@gmail.com>
Co-authored-by: gary rong <garyrong0905@gmail.com>
Co-authored-by: wbt <wbt@users.noreply.github.com>
Co-authored-by: ligi <ligi@ligi.de>
Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
Co-authored-by: LieutenantRoger <dijsky_2015@hotmail.com>
Co-authored-by: roger <dengjun@huobi.com>
Co-authored-by: Alex Prut <1648497+alexprut@users.noreply.github.com>
Co-authored-by: Antoine Toulme <atoulme@users.noreply.github.com>
Co-authored-by: Nishant Das <nishdas93@gmail.com>
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
Co-authored-by: Kristofer Peterson <svenski123@users.noreply.github.com>
Co-authored-by: Pascal Dierich <pascal@merkleplant.xyz>
Co-authored-by: Chris Ziogas <ziogas_chr@hotmail.com>
Co-authored-by: Steve Ruckdashel <steven.ruckdashel@optum.com>
Co-authored-by: Li, Cheng <lob4tt@gmail.com>
Co-authored-by: Baptiste Boussemart <baptiste.boussemart@consensys.net>
Co-authored-by: baptiste-b-pegasys <85155432+baptiste-b-pegasys@users.noreply.github.com>
Co-authored-by: Ricardo Silva <1945557+ricardolyn@users.noreply.github.com>
acoshift added a commit to reichain/rei that referenced this issue Feb 8, 2022
commit c50aaab3911681ac0174b24527627a4f3e22e1d6
Author: Antony Denyer <git@antonydenyer.co.uk>
Date:   Thu Jan 27 09:49:19 2022 +0000

    Bump version to v22.1.0

commit d258a138864999157cbcd7be4037b70d7cb772e5
Author: Quorum Bot <46820074+quorumbot@users.noreply.github.com>
Date:   Thu Jan 27 09:14:50 2022 +0000

    [Upgrade] Go-Ethereum release v1.10.0 (#1249)

    * 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.

    * consensus: refactor FinalizeAndAssemble to use Finalize (#21993)

    * 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>

    * 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.

    * 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>

    * 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>

    * cmd/geth: fixed parallelization flaw in account import test (#22002)

    * eth/protocols/eth: remove magic numbers in test (#21999)

    * eth, core: speed up some tests (#22000)

    * 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

    * cmd/faucet: sort requests by newest first (#22018)

    * 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

    * eth/downloader: fix typo in comment (#22019)

    * 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.

    * 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

    * 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.

    * 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>

    * tests/fuzzers: fix false positive in bitutil fuzzer (#22076)

    * cmd/geth: replace wiki links with new doc pages (#22071)

    * eth/filters: replace wiki links with new doc pages (#22070)

    * signer: docs - replace wiki links with new doc pages (#22069)

    * eth/downloader: remove unnecessary condition (#22052)

    * docs: replace wiki links with new doc pages in readme.md (#22065) (#22066)

    * core/rawdb, eth/protocols : Method name typo fix (#22026)

    * accounts/abi/bind: fix erroneous test (#22053)

    closes #22049

    * core/state/snapshot: gethring -> gathering typo (#22104)

    * cmd/geth: update copyright year (#22099)

    * .github: Replace wiki links with new doc pages (#22065) (#22068)

    * node: rename startNetworking to openEndpoints (#22105)

    * SECURITY.md: link to release page (#22067)

    Add links to go-ethereum's GitHub release page.

    Co-authored-by: Felix Lange <fjl@twurst.com>

    * cmd: support v1.1 Twitter API in faucet, fix puppeth

    * miner: avoid sleeping in miner (#22108)

    This PR removes a logic in the miner, which was originally intended to help temporary testnets based on ethash from "running off into the future". If the difficulty was low, and a few computers started mining several blocks per second, the ethash rules (which demand 1s delay between blocks) would push the blocktimes further and further away.
    The solution was to make the miner sleep while this happened.

    Nowadays, this problem is solved instead by PoA chains, and it's recommended to let testnets and devnets be based on clique instead. The existing logic is problematic, since it can cause stalls within the miner making it difficult for remote workers to submit work if the channel is blocked on a sleep.

    Credits to Saar Tochner for reporting this via the bug bounty

    * cmd/geth: usb is off by default (#21984)

    * graphql: use a decimal representation for gas limit and gas used (#21883)

    This changes the JSON encoding of blocks returned by the API
    to have decimal instead of hexadecimal numbers. The spec wants
    it this way.

    Co-authored-by: Martin Holst Swende <martin@swende.se>

    * cmd/geth: added --mainnet flag (#21932)

    * cmd/geth: added --mainnet flag

    * cmd/utils: set default genesis if --mainnet is specified

    * cmd/utils: addressed comments

    * common/compiler: fix parsing of solc output with solidity v.0.8.0 (#22092)

    Solidity 0.8.0 changes the way that output is marshalled. This patch allows to parse both
    the legacy format used previously and the new format.

    See also https://docs.soliditylang.org/en/breaking/080-breaking-changes.html#interface-changes

    * eth/downloader: enhanced test cases for downloader queue (#22114)

    * cmd/utils, eth/downloader: minor snap nitpicks

    * crypto: fix ineffectual assignments (#22124)

    * crypto/bls12381: fixed ineffectual assignment

    * crypto/signify: fix ineffectual assignment

    * graphql: return decimal for `estimateGas` and `cumulativeGas` queries  (#22126)

    * estimateGas, cumulativeGas
    * linted
    * add test for estimateGas

    * snapshot, trie: fixed typos, mostly in snapshot pkg (#22133)

    * cmd/faucet: fix websocket race regression after switching to gorilla

    * eth/protocols/snap: track reverts when peer rejects request (#22016)

    * eth/protocols/snap: reschedule missed deliveries

    * eth/protocols/snap: clarify log message

    * eth/protocols/snap: revert failures async and update runloop

    Co-authored-by: Péter Szilágyi <peterke@gmail.com>

    * eth/protocols/snap: speed up hash checks (#22023)

    * eth/protocols/snap: speed up hash checks

    * eth/protocols/snap: nit fix

    Co-authored-by: Péter Szilágyi <peterke@gmail.com>

    * cmd/faucet: switch Facebook auth over to mobile site

    * les: remove transaction propagation limits (#22125)

    * cmd/faucet: fix nonce-gap problem (#22145)

    * cmd/faucet: avoid encoding for each client

    * cmd/faucet: fix flaw in clearing of txs, avoid sending more than necessary

    * cmd/faucet: fix flaw in tx cropping

    * cmd/faucet: revert change to not always send tx info

    * cmd/faucet: review fixes

    * cmd/faucet: revert #22018, fix order in UI

    * cmd/faucet: fix lock error

    * cmd/faucet: revert json changes

    * squashme

    * ethclient: better test suite for ethclient package (#22127)

    This commit extends the ethclient test suite and increases code coverage of the ethclient
    package from ~15% to >55%. These tests act as early smoke tests to signal issues in the
    RPC-interface. E.g. if a functionality like eth_chainId or eth_call breaks, the test
    will break.

    * eth/downloader: fix race condition in tests (#22140)

    * downloader: fix race condition in tests

    * eth/downloader: fix race condition in tests

    * Revert "downloader: fix race condition in tests"

    This reverts commit 108033ebc6985de83791d375b6e6647a77d28d5a.

    * core: persist bad blocks (#21827)

    * core: persist bad blocks

    * core, eth, internal: address comments

    * core/rawdb: add badblocks to inspector

    * core, eth: update

    * internal: revert

    * core, eth: only save 10 bad blocks

    * core/rawdb: address comments

    * core/rawdb: fix

    * core: address comments

    * common/prque: pull in tests and benchmarks from upstream

    * eth: improve log message (#22146)

    * eth: fixed typos

    * eth: fixed log message

    * graphql: fix issue with unmarshalling int32 into `Long` type #22153

    * eth: return error from eth_chainID during sync before EIP-155 activates (#21686)

    This changes the chainID RPC method to return an error when EIP-155 is not yet
    active at the current block height. It used to simply return zero in this case, but
    that's confusing.

    * cmd/utils: avoid making console preloads absolute (#22109)

    Resolves https://github.com/etclabscore/core-geth/issues/273

    jsre.JSRE already handles establishing preload
    file paths relative to the 'assets' path (aka docroot),
    where it joins the assets dir and the file path if relative,
    or uses the file path only if absolute.

    The duplication of this logic by MakeConsolePreloads
    caused preloaded files to have paths which contained
    duplicate references to the assets dir path.

    Date: 2020-12-30 08:25:01-06:00
    Signed-off-by: meows <b5c6@protonmail.com>

    * go.mod: use github.com/holiman/bloomfilter/v2 (#22044)

    * deps: use improved bloom filter implementation

    * eth/handler, trie: use 4 keys for syncbloom + minor fixes

    * eth/protocols, trie: revert change on syncbloom method signature

    * cmd/utils: don't enumerate USB unless --usb is set (#22130)

    USB enumeration still occured. Make sure it will only occur if --usb is set.
    This also deprecates the 'NoUSB' config file option in favor of a new option 'USB'.

    * tests: update the reference tests (#22009)

    * graphql: fix spurious error in test (#22164)

    This solves an issue in graphql tests:

        graphql_test.go:38: could not create new node: datadir already used by another process

    * consensus/ethash: increase seal timeout for tests (#22162)

    It seems that the 2 second timeout is not enough for Travis CI:

       --- FAIL: TestTestMode (2.00s)
           ethash_test.go:53: sealing result timeout

    * graphql: fix spurious travis failure (#22166)

    The tests sometimes failed with certain go versions because
    the behavior of http.Server.Shutdown changed over time. A bug
    that was fixed in Go 1.15 could cause active connections on unrelated
    servers to close unexpectedly. This is fixed by avoiding use of the
    same port number in all tests.

    * cmd/faucet: update the embedded website asset

    * core/state/snapshot: add generation logs to storage too

    * les: don't drop sentTo for normal cases (#22048)

    * eth/protocols/eth: fix slice resize flaw (#22181)

    * les: remove useless protocol defines (#22115)

    This PR has two changes in the les protocol:

    - the auxRoot is not supported. See ethereum/devp2p#171 for more information
    - the empty response will be returned in GetHelperTrieProofsMsg request if the merkle
       proving is failed. note, for backward compatibility, the empty merkle proof as well as
       the request auxiliary data will still be returned in  les2/3 protocol no matter the proving
       is successful or not. the proving failure can happen e.g. request the proving for a
       non-included entry in helper trie (unstable header).

    * tests/fuzzers/abi: better test generation (#22158)

    * tests/fuzzers/abi: better test generation

    * tests/fuzzers/abi: fixed packing issue

    * oss-fuzz: enable abi fuzzer

    * cmd/geth: dump config for metrics (#22083)

    * cmd/geth: dump config

    * cmd/geth: dump config

    * cmd/geth: properly read config again

    * cmd/geth: override metrics if flags are set

    * cmd/geth: write metrics regardless if enabled

    * cmd/geth: renamed to metricsfromcliargs

    * metrics: add default configuration

    * core/state/snapshot: write snapshot generator in batch (#22163)

    * core/state/snapshot: write snapshot generator in batch

    * core: refactor the tests

    * core: update tests

    * core: update tests

    * cmd/geth: graceful shutdown if disk is full (#22103)

    Adding warnings of free disk space left and graceful shutdown when there is not enough space left.
    This also adds a flag datadir.minfreedisk which can be used to set the trigger for low disk space, and setting it to zero disables the check.

    Co-authored-by: Martin Holst Swende <martin@swende.se>
    Co-authored-by: Felix Lange <fjl@twurst.com>

    * eth, les: add new config field SyncFromCheckpoint (#22123)

    This PR introduces a new config field SyncFromCheckpoint for light client.

    In some special scenarios, it's required to start synchronization from some
    arbitrary checkpoint or even from the scratch. So this PR offers this
    flexibility to users so that the synchronization start point can be configured.

    There are two relevant configs: SyncFromCheckpoint and Checkpoint.

    - If the SyncFromCheckpoint is true, the light client will try to sync from the
      specified checkpoint.

    - If the Checkpoint is not configured, then the light client will sync from the
      scratch(from the latest header if the database is not empty)

    Additional notes: these two configs are not visible in the CLI flags but only
    accessable in the config file.

    Example Usage:

    [Eth]
    SyncFromCheckpoint = true

    [Eth.Checkpoint]
    SectionIndex = 100
    SectionHead = "0xabc"
    CHTRoot = "0xabc"
    BloomRoot = "0xabc"

    PS. Historical checkpoint can be retrieved from the synced full node or light
    client via les_getCheckpoint API.

    * oss-fuzz: fix abi fuzzer (#22199)

    * go.mod: upgrade golang-lru (#22134)

    * downloader: extract findAncestor search functions (#21744)

    This is a simple refactoring, extracting common ancestor
    negotiation logic to named function

    * core: implement background trie prefetcher

    Squashed from the following commits:

    core/state: lazily init snapshot storage map
    core/state: fix flawed meter on storage reads
    core/state: make statedb/stateobjects reuse a hasher
    core/blockchain, core/state: implement new trie prefetcher
    core: make trie prefetcher deliver tries to statedb
    core/state: refactor trie_prefetcher, export storage tries
    blockchain: re-enable the next-block-prefetcher
    state: remove panics in trie prefetcher
    core/state/trie_prefetcher: address some review concerns

    sq

    * core/state: convert prefetcher to concurrent per-trie loader

    * eth/filters: fix potential deadlock in filter timeout loop (#22178)

    This fixes #22131 and adds a test reproducing the issue.

    * event: add ResubscribeErr (#22191)

    This adds a way to get the error of the failing subscription
    for logging/debugging purposes.

    Co-authored-by: Felix Lange <fjl@twurst.com>

    * trie: fix range prover (#22210)

    Fixes a special case when the trie only has a single trie node and the range proof only contains a single element.

    * common/mclock: remove dependency on github.com/aristanetworks/goarista (#22211)

    It takes three lines of code to get to runtime.nanotime, no need to
    pull a dependency for that.

    * cmd, geth: CLI help fixes (#22220)

    * cmd, geth: Reflect command being optional - closes 22218

    * cmd, geth: Set current year to 2021

    * cmd, geth: CLI help fixes (#22220)

    * cmd, geth: Reflect command being optional - closes 22218

    * cmd, geth: Set current year to 2021

    * eth/protocols/snap: snap sync testing (#22179)

    * eth/protocols/snap: make timeout configurable

    * eth/protocols/snap: snap sync testing

    * eth/protocols/snap: test to trigger panic

    * eth/protocols/snap: fix race condition on timeouts

    * eth/protocols/snap: return error on cancelled sync

    * squashme: updates + test causing panic + properly serve accounts in order

    * eth/protocols/snap: revert failing storage response

    * eth/protocols/snap: revert on bad responses (storage, code)

    * eth/protocols/snap: fix account handling stall

    * eth/protocols/snap: fix remaining revertal-issues

    * eth/protocols/snap: timeouthandler for bytecode requests

    * eth/protocols/snap: debugging + fix log message

    * eth/protocols/snap: fix misspelliings in docs

    * eth/protocols/snap: fix race in bytecode handling

    * eth/protocols/snap: undo deduplication of storage roots

    * synctests: refactor + minify panic testcase

    * eth/protocols/snap: minor polishes

    * eth: minor polishes to make logs more useful

    * eth/protocols/snap: remove excessive logs from the test runs

    * eth/protocols/snap: stress tests with concurrency

    * eth/protocols/snap: further fixes to test cancel channel handling

    * eth/protocols/snap: extend test timeouts on CI

    Co-authored-by: Péter Szilágyi <peterke@gmail.com>

    * go.mod: update dependencies (#22216)

    This updates go module dependencies as discussed in #22050.

    * graphql: change receipt status to decimal instead of hex (#22187)

    This PR fixes the receipt status field to be decimal instead of a hex string,
    as called for by the spec.

    Co-authored-by: Martin Holst Swende <martin@swende.se>

    * go.mod: upgrade github.com/huin/goupnp (#22227)

    This updates the goupnp dependency, fixing huin/goupnp#33

    * snapshot: merge loops for better performance (#22160)

    * core: reset to genesis when middle block is missing (#22135)

    When a sethead/rewind finds that the targeted block is missing, it resets to genesis instead of crashing. Closes #22129

    * eth/tracers: move tracing APIs into eth/tracers (#22161)

    This moves the tracing RPC API implementation to package eth/tracers.
    By doing so, package eth no longer depends on tracing and the duktape JS engine.

    The change also enables tracing using the light client. All tracing methods work with the
    light client, but it's a lot slower compared to using a full node.

    * eth, p2p: reserve half peer slots for snap peers during snap sync (#22171)

    * eth, p2p: reserve half peer slots for snap peers during snap sync

    * eth: less logging

    * eth: rework the eth/snap peer reservation logic

    * eth: rework the eth/snap peer reservation logic (again)

    * tests/fuzzers/abi: fixed one-off panic with int.Min64 value (#22233)

    * tests/fuzzers/abi: fixed one-off panic with int.Min64 value

    * tests/fuzzers/abi: fixed one-off panic with int.Min64 value

    * internal/ethapi: print tx details when submitting (#22170)

    This adds more info about submitted transactions in log messages.

    Co-authored-by: Felix Lange <fjl@twurst.com>

    * core/state: fix panic in state dumping (#22225)

    * core: speed up header import (#21967)

    This PR implements the following modifications

    - Don't shortcut check if block is present, thus avoid disk lookup
    - Don't check hash ancestry in early-check (it's still done in parallel checker)
    - Don't check time.Now for every single header

    Charts and background info can be found here: https://github.com/holiman/headerimport/blob/main/README.md
    With these changes, writing 1M headers goes down to from 80s to 62s.

    * accounts/scwallet: use go-ethereum crypto instead of go-ecdh (#22212)

    * accounts/scwallet: use go-ethereum crypto instead of go-ecdh

    github.com/wsddn/go-ecdh is a wrapper package for ECDH functionality
    with any elliptic curve.

    Since 'generic' ECDH is not required in accounts/scwallet (the curve is
    always secp256k1), we can just use the standard library functionality
    and our own crypto libraries to perform ECDH and save a dependency.

    * Update accounts/scwallet/securechannel.go

    Co-authored-by: Guillaume Ballet <gballet@gmail.com>

    * Use the correct key

    Co-authored-by: Guillaume Ballet <gballet@gmail.com>

    * accounts/scwallet: update documentation (#22242)

    * les: switch to new discv5 (#21940)

    This PR enables running the new discv5 protocol in both LES client
    and server mode. In client mode it mixes discv5 and dnsdisc iterators
    (if both are enabled) and filters incoming ENRs for "les" tag and fork ID.
    The old p2p/discv5 package and all references to it are removed.

    Co-authored-by: Felix Lange <fjl@twurst.com>

    * rpc: deprecate Client.ShhSubscribe (#22239)

    It never worked, whisper uses polling.

    Co-authored-by: Felix Lange <fjl@twurst.com>

    * cmd,core,eth,params,tests: define yolov3 + enable EIP-2565 (#22213)

    Removes the yolov2 definition, adds yolov3, including EIP-2565. This PR also disables some of the erroneously generated blockchain and statetests, and adds the new genesis hash + alloc for yolov3.
    This PR disables the CLI switches for yolo, since it's not complete until we merge support for 2930.

    * les/utils: UDP rate limiter (#21930)

    * les/utils: Limiter

    * les/utils: dropped prior weight vs variable cost logic, using fixed weights

    * les/utils: always create node selector in addressGroup

    * les/utils: renamed request weight to request cost

    * les/utils: simplified and improved the DoS penalty mechanism

    * les/utils: minor fixes

    * les/utils: made selection weight calculation nicer

    * les/utils: fixed linter warning

    * les/utils: more precise and reliable probabilistic test

    * les/utils: fixed linter warning

    * cmd/clef: don't check file permissions on windows (#22251)

    Fixes #20123

    * eth/tracers: fix unigram tracer (#22248)

    * eth: check snap satelliteness, delegate drop to eth (#22235)

    * eth: check snap satelliteness, delegate drop to eth

    * eth: better handle eth/snap satellite relation, merge reg/unreg paths

    * cmd/geth, node: allow configuring JSON-RPC on custom path prefix (#22184)

    This change allows users to set a custom path prefix on which to mount the http-rpc
    or ws-rpc handlers via the new flags --http.rpcprefix and --ws.rpcprefix.

    Fixes #21826

    Co-authored-by: Felix Lange <fjl@twurst.com>

    * all: remove unneeded parentheses (#21921)

    * remove uneeded convertion type

    * remove redundant type in composite literal

    * omit explicit type where implicit

    * remove unused redundant parenthesis

    * remove redundant import alias duktape

    * trie : use trie.NewStackTrie instead of new(trie.Trie) (#22246)

    The PR makes use of the stacktrie, which is is more lenient on resource consumption, than the regular trie, in cases where we only need it for DeriveSha

    * core: reset txpool state on sethead (#22247)

    fixes an issue where local transactions that were included in the chain before a SetHead were rejected if resubmitted, since the txpool had not reset the state to the current (older) state.

    * fuzzers: added consensys/gurvy library to bn256 differential fuzzer (#21812)

    This pr adds consensys' gurvy bn256 variant into the code for differential fuzzing.

    * internal/ethapi: comment nitpick (#22270)

    * eth: move eth.Config to a common package (#22205)

    This moves the eth config definition into a separate package, eth/ethconfig.
    Packages eth and les can now import this common package instead of
    importing eth from les, reducing dependencies.

    Co-authored-by: Felix Lange <fjl@twurst.com>

    * internal/ethapi: fix typo in comment (#22271)

    * eth: don't wait for snap registration if we're not running snap (#22272)

    Prevents a situation where we (not running snap) connects with a peer running snap, and get stalled waiting for snap registration to succeed (which will never happen), which cause a waitgroup wait to halt shutdown

    * consensus: remove seal verification from the consensus engine interface (#22274)

    * cmd/utils: enable snapshots by default

    * metrics: fix cast omission in cpu_syscall.go (#22262)

    fixes an regression which caused build failure on certain platforms

    * params: just to make snapshots a bit more official

    * all: bloom-filter based pruning mechanism (#21724)

    * cmd, core, tests: initial state pruner

    core: fix db inspector

    cmd/geth: add verify-state

    cmd/geth: add verification tool

    core/rawdb: implement flatdb

    cmd, core: fix rebase

    core/state: use new contract code layout

    core/state/pruner: avoid deleting genesis state

    cmd/geth: add helper function

    core, cmd: fix extract genesis

    core: minor fixes

    contracts: remove useless

    core/state/snapshot: plugin stacktrie

    core: polish

    core/state/snapshot: iterate storage concurrently

    core/state/snapshot: fix iteration

    core: add comments

    core/state/snapshot: polish code

    core/state: polish

    core/state/snapshot: rebase

    core/rawdb: add comments

    core/rawdb: fix tests

    core/rawdb: improve tests

    core/state/snapshot: fix concurrent iteration

    core/state: run pruning during the recovery

    core, trie: implement martin's idea

    core, eth: delete flatdb and polish pruner

    trie: fix import

    core/state/pruner: add log

    core/state/pruner: fix issues

    core/state/pruner: don't read back

    core/state/pruner: fix contract code write

    core/state/pruner: check root node presence

    cmd, core: polish log

    core/state: use HEAD-127 as the target

    core/state/snapshot: improve tests

    cmd/geth: fix verification tool

    cmd/geth: use HEAD as the verification default target

    all: replace the bloomfilter with martin's fork

    cmd, core: polish code

    core, cmd: forcibly delete state root

    core/state/pruner: add hash64

    core/state/pruner: fix blacklist

    core/state: remove blacklist

    cmd, core: delete trie clean cache before pruning

    cmd, core: fix lint

    cmd, core: fix rebase

    core/state: fix the special case for clique networks

    core/state/snapshot: remove useless code

    core/state/pruner: capping the snapshot after pruning

    cmd, core, eth: fixes

    core/rawdb: update db inspector

    cmd/geth: polish code

    core/state/pruner: fsync bloom filter

    cmd, core: print warning log

    core/state/pruner: adjust the parameters for bloom filter

    cmd, core: create the bloom filter by size

    core: polish

    core/state/pruner: sanitize invalid bloomfilter size

    cmd: address comments

    cmd/geth: address comments

    cmd/geth: address comment

    core/state/pruner: address comments

    core/state/pruner: rename homedir to datadir

    cmd, core: address comments

    core/state/pruner: address comment

    core/state: address comments

    core, cmd, tests: address comments

    core: address comments

    core/state/pruner: release the iterator after each commit

    core/state/pruner: improve pruner

    cmd, core: adjust bloom paramters

    core/state/pruner: fix lint

    core/state/pruner: fix tests

    core: fix rebase

    core/state/pruner: remove atomic rename

    core/state/pruner: address comments

    all: run go mod tidy

    core/state/pruner: avoid false-positive for the middle state roots

    core/state/pruner: add checks for middle roots

    cmd/geth: replace crit with error

    * core/state/pruner: fix lint

    * core: drop legacy bloom filter

    * core/state/snapshot: improve pruner

    * core/state/snapshot: polish concurrent logs to report ETA vs. hashes

    * core/state/pruner: add progress report for pruning and compaction too

    * core: fix snapshot test API

    * core/state: fix some pruning logs

    * core/state/pruner: support recovering from bloom flush fail

    Co-authored-by: Péter Szilágyi <peterke@gmail.com>

    * core/state/pruner: fix compaction after pruning

    * core/state/pruner: fix compaction range error

    * internal/debug: add switch to format logs with json (#22207)

    adds a flag --log.json which if enabled makes the client format logs with JSON.

    * accounts/abi/bind: fixed unpacking error (#22230)

    There was a dormant error with structured inputs that failed unpacking.
    This commit fixes the error by switching casting to the better abi.ConvertType function.
    It also adds a test for calling a view function that returns a struct

    * cmd/utils, eth/ethconfig: unindex txs older than ~1 year

    * cmd/devp2p: fix documentation for eth-test (#22298)

    * core: fix temp memory blowup caused by defers holding on to state

    * les: enable les/4 and add tests (#22321)

    * cmd/utils: add workaround for FreeBSD statfs quirk (#22310)

    Make geth build on FreeBSD, fixes #22309.

    * cmd/geth: fix js unclean shutdown (#22302)

    * trie: fix bloom crash on fast sync restart

    * rpc: increase the number of subscriptions in storm test (#22316)

    * core/state/snapshot: ensure Cap retains a min number of layers

    * eth: fix snap sync cancellation

    * cmd/devp2p/internal/ethtest: use shared message types (#22315)

    This updates the eth protocol test suite to use the message type
    definitions of the 'production' protocol implementation in eth/protocols/eth.

    * eth/handler, broadcast: optimize tx broadcast mechanism (#22176)

    This PR optimizes the broadcast loop. Instead of iterating twice through a given set of transactions to weed out which peers have and which do not have a tx, to send/announce transactions, we do it only once.

    * core/state: copy the snap when copying the state (#22340)

    * core/state: copy the snap when copying the state

    * core/state: deep-copy snap stuff during state Copy

    * rlp: handle case of normal EOF in Stream.readFull (#22336)

    io.Reader may return n > 0 and io.EOF at the end of the input stream.
    readFull did not handle this correctly, looking only at the error. This fixes
    it to check for n == len(buf) as well.

    * node: always show websocket url in logs (#22307)

    * eth: implement eth66 (#22241)

    * eth/protocols/eth: split up the eth protocol handlers

    * eth/protocols/eth: define eth-66 protocol messages

    * eth/protocols/eth: poc implement getblockheaders on eth/66

    * eth/protocols/eth: implement remaining eth-66 handlers

    * eth/protocols: define handler map for eth 66

    * eth/downloader: use protocol constants from eth package

    * eth/protocols/eth: add ETH66 capability

    * eth/downloader: tests for eth66

    * eth/downloader: fix error in tests

    * eth/protocols/eth: use eth66 for outgoing requests

    * eth/protocols/eth: remove unused error type

    * eth/protocols/eth: define protocol length

    * eth/protocols/eth: fix pooled tx over eth66

    * protocols/eth/handlers: revert behavioural change which caused tests to fail

    * eth/downloader: fix failing test

    * eth/protocols/eth: add testcases + fix flaw with header requests

    * eth/protocols: change comments

    * eth/protocols/eth: review fixes + fixed flaw in RequestOneHeader

    * eth/protocols: documentation

    * eth/protocols/eth: review concerns about types

    * p2p/dnsdisc: fix hot-spin when all trees are empty (#22313)

    In the random sync algorithm used by the DNS node iterator, we first pick a random
    tree and then perform one sync action on that tree. This happens in a loop until any
    node is found. If no trees contain any nodes, the iterator will enter a hot loop spinning
    at 100% CPU.

    The fix is complicated. The iterator now checks if a meaningful sync action can
    be performed on any tree. If there is nothing to do, it waits for the next root record
    recheck time to arrive and then tries again.

    Fixes #22306

    * les: renamed lespay to vflux (#22347)

    * cmd/utils: disable caching preimages by default

    * travis, appveyor, build: bump Go to 1.16

    * les: fix balance expiration (#22343)

    * les/lespay/server: fix balance expiration and add test

    * les: move client balances to a new db

    * les: rename lespayDb to lesDb

    * tests/fuzzers/les: add fuzzer for les server handler (#22282)

    * les: refactored server handler

    * tests/fuzzers/les: add fuzzer for les server handler

    * tests, les: update les fuzzer

    tests: update les fuzzer

    tests/fuzzer/les: release resources

    tests/fuzzer/les: pre-initialize all resources

    * les: refactored server handler and fuzzer

    Co-authored-by: rjl493456442 <garyrong0905@gmail.com>

    * les: clean up server handler (#22357)

    * cmd/geth: add db commands stats, compact, put, get, delete (#22014)

    This PR introduces:

    - db.put to put a value into the database
    - db.get to read a value from the database
    - db.delete to delete a value from the database
    - db.stats to check compaction info from the database
    - db.compact to trigger a db compaction

    It also moves inspectdb to db.inspect.

    * internal/ethapi: reject non-replay-protected txs over RPC (#22339)

    This PR prevents users from submitting transactions without EIP-155 enabled. This behaviour can be overridden by specifying the flag --rpc.allow-unprotected-txs=true.

    * accounts/abi/bind: fix up Go mod files for Go 1.16

    * Dockerfile: bump to Go 1.16 base images

    * travis: bump Android NDK version

    * travis: bump builders to Bionic

    * travis: manually install Android since Travis is stale (#22373)

    * cmd/utils: remove deprecated command line flags (#22263)

    This removes support for all deprecated flags except --rpc*.

    * eth/protocols/snap: lower abortion and resumption logs to debug

    * cmd, eth, les: enable serving light clients when non-synced (#22250)

    This PR adds a more CLI flag, so that the les-server can serve light clients even the local node is not synced yet.

    This functionality is needed in some testing environments(e.g. hive). After launching the les server, no more blocks will be imported so the node is always marked as "non-synced".

    * les, light: improve txstatus retrieval (#22349)

    Transaction unindexing will be enabled by default as of 1.10, which causes tx status retrieval will be broken without this PR.

    This PR introduces a retry mechanism in TxStatus retrieval.

    * all: add support for EIP-2718, EIP-2930 transactions (#21502)

    This adds support for EIP-2718 typed transactions as well as EIP-2930
    access list transactions (tx type 1). These EIPs are scheduled for the
    Berlin fork.

    There very few changes to existing APIs in core/types, and several new APIs
    to deal with access list transactions. In particular, there are two new
    constructor functions for transactions: types.NewTx and types.SignNewTx.
    Since the canonical encoding of typed transactions is not RLP-compatible,
    Transaction now has new methods for encoding and decoding: MarshalBinary
    and UnmarshalBinary.

    The existing EIP-155 signer does not support the new transaction types.
    All code dealing with transaction signatures should be updated to use the
    newer EIP-2930 signer. To make this easier for future updates, we have
    added new constructor functions for types.Signer: types.LatestSigner and
    types.LatestSignerForChainID.

    This change also adds support for the YoloV3 testnet.

    Co-authored-by: Martin Holst Swende <martin@swende.se>
    Co-authored-by: Felix Lange <fjl@twurst.com>
    Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com>

    * cmd/devp2p: add eth66 test suite (#22363)

    Co-authored-by: Martin Holst Swende <martin@swende.se>

    * les: move server pool to les/vflux/client (#22377)

    * les: move serverPool to les/vflux/client

    * les: add metrics

    * les: moved ValueTracker inside ServerPool

    * les: protect against node registration before server pool is started

    * les/vflux/client: fixed tests

    * les: make peer registration safe

    * all: define Berlin hard fork spec

    * rpc: add separate size limit for websocket (#22385)

    This makes the WebSocket message size limit independent of the
    limit used for HTTP requests. The new limit for WebSocket messages
    is 15MB.

    * accounts/keystore: use github.com/google/uuid (#22217)

    This replaces the github.com/pborman/uuid dependency with
    github.com/google/uuid because the former is only a wrapper for
    the latter (since v1.0.0).

    Co-authored-by: Felix Lange <fjl@twurst.com>

    * core/state: fix eta calculation on pruning (#22386)

    * les: UDP pre-negotiation of available server capacity (#22183)

    This PR implements the first one of the "lespay" UDP queries which
    is already useful in itself: the capacity query. The server pool is making
    use of this query by doing a cheap UDP query to determine whether it is
    worth starting the more expensive TCP connection process.

    * core/rawdb: fix the transaction indexer (#22395)

    * cmd/geth: put allowUnsecureTx flag in RPC section (#22412)

    * params: update chts (#22418)

    * cmd/utils: fix txlookuplimit for archive node (#22419)

    * cmd/utils: fix exclusive check for archive node

    * cmd/utils: set the txlookuplimit to 0

    * core/forkid, params: unset Berlin fork number (#22413)

    * les: fix nodiscover option on the client side (#22422)

    * cmd: retire whisper flags (#22421)

    * cmd: retire whisper flags

    * cmd/geth: remove whisper configs

    * tests: update to latest tests (#22290)

    This updates the consensus tests to commit 31d6630 and
    adds support for access list transactions in the test runner.

    Co-authored-by: Martin Holst Swende <martin@swende.se>

    * params: release geth 1.10.0 stable

    * Update after the tracers factoring and solve some linting

    * fix all the linting issues

    * fix graphql test

    * fix wallet test

    * fix cmd package test

    * fix internal package test

    * fix internal package test

    * fix accounts and contracts package test

    * fix light package test

    * fix some unit tests and changes on the state_prefetcher.go

    * fix core unit test

    * fix unit test

    * faucet: do not replace normal url to mobile version

    * faucet: revert change

    * eth: added UT for transaction propagation

    * internal/eth: fixed merging side effect

    * accounts: copy signer

    * Added Quorum tag for the UT

    * fix: add some fixes and UT (#3)

    * faucet: revert change

    * eth: added UT for transaction propagation

    * internal/eth: fixed merging side effect

    * accounts: copy signer

    * Added Quorum tag for the UT

    * fix: eth/handler.go accept tx for raft consensus

    * fix: internal/ethapi add check for accessList if its nil

    * add eth66 protocol to consensus

    * fix: broadcaster

    * revert: logs

    * disable flakey facebook test

    * fix: eth/api_backend.go use the modified GetReceipts to get the private receipts for PSI

    * fix: eth/traces fix the tracer to ignore the tx that the party is not part of

    * fix: raft/snapshot remove the trimming of the peer ID

    * Accept chainId on permissioning endpoints

    * fix: force preimages for making complete dumps
    preimages is disabled by default by geth 1.10, but needed for contract extension

    * Specify chainId against permision contracts

    * Specify chainId with NewWalletTransactor

    * Remove chainId from NewWalletTransactor

    * Pass chainId through to NewWalletTransactor from config

    * fix lint

    * fix unit tests

    * fix lint

    * Upgrade protobuf to 1.5.1

    * remove commented code

    * added few error checks and some code cleaning

    * added few error checks and some code cleaning

    * fix conflict merge

    * fix linter

    * Prevent prune-state from being used when IsQuorum is enabled

    Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>

    * Remove date for deprecation notice, made more generic

    * fix: miner/worker.go mix-up when resolving conflicts about miner sleeping

    Co-authored-by: Martin Holst Swende <martin@swende.se>
    Co-authored-by: Mr-Leshiy <alex_pozhilenkov@adoriasoft.com>
    Co-authored-by: Nagy Salem <me@muhnagy.com>
    Co-authored-by: Connor Stein <connor.stein@mail.mcgill.ca>
    Co-authored-by: Shiming <codingmylife@gmail.com>
    Co-authored-by: ligi <ligi@ligi.de>
    Co-authored-by: Péter Szilágyi <peterke@gmail.com>
    Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
    Co-authored-by: Mr-Leshiy <leshiy12345678@gmail.com>
    Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
    Co-authored-by: ucwong <ucwong@126.com>
    Co-authored-by: Timo Tijhof <krinklemail@gmail.com>
    Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
    Co-authored-by: Guillaume Ballet <gballet@gmail.com>
    Co-authored-by: Suriyaa Sundararuban <isc.suriyaa@gmail.com>
    Co-authored-by: jk-jeongkyun <45347815+jeongkyun-oh@users.noreply.github.com>
    Co-authored-by: yumiel yoomee1313 <yumiel.ko@groundx.xyz>
    Co-authored-by: Melvin Junhee Woo <melvin.woo@groundx.xyz>
    Co-authored-by: Vie <yangchenzhong@gmail.com>
    Co-authored-by: rene <41963722+renaynay@users.noreply.github.com>
    Co-authored-by: Felix Lange <fjl@twurst.com>
    Co-authored-by: Antoine Toulme <atoulme@users.noreply.github.com>
    Co-authored-by: gary rong <garyrong0905@gmail.com>
    Co-authored-by: Chris Ziogas <ziogaschr@gmail.com>
    Co-authored-by: meowsbits <b5c6@protonmail.com>
    Co-authored-by: Dan DeGreef <dan.degreef@gmail.com>
    Co-authored-by: Alex Mazalov <mazalov@gmail.com>
    Co-authored-by: Łukasz Zimnoch <lukaszzimnoch1994@gmail.com>
    Co-authored-by: Alex Prut <1648497+alexprut@users.noreply.github.com>
    Co-authored-by: isdyaufh8o7cq <sebaskil@icloud.com>
    Co-authored-by: Or Neeman <oneeman@gmail.com>
    Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
    Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com>
    Co-authored-by: achraf <achraf.sellami@consensys.net>
    Co-authored-by: achraf17 <achrafsellami0@gmail.com>
    Co-authored-by: Baptiste Boussemart <baptiste.boussemart@consensys.net>
    Co-authored-by: Antony Denyer <git@antonydenyer.co.uk>
    Co-authored-by: baptiste-b-pegasys <85155432+baptiste-b-pegasys@users.noreply.github.com>
    Co-authored-by: Antony Denyer <email@antonydenyer.co.uk>

commit cd11c38e7bc0345a70ef85a8b085e7755bb0ee78
Author: Antony Denyer <email@antonydenyer.co.uk>
Date:   Mon Jan 24 10:39:07 2022 +0000

    bump version to 21.10.2 (#1310)

commit 393ed37d277098d89fca478eb5565c006949ba5a
Author: Satpal <28562234+SatpalSandhu61@users.noreply.github.com>
Date:   Mon Jan 24 10:35:17 2022 +0000

    Fix issue with inconsistent private state root when using MPS with PMT. (#1283)

    * Fix issue with inconsistent private state root when using MPS with PMT.

    * Extend debug.dumpBlock() to allow dump of private state when second parameter set to "private".

commit 559b9f8207cda6656a5ad465fb31679b9aa2a93b
Author: achraf17 <achraf.sellami@consensys.net>
Date:   Fri Jan 14 14:01:55 2022 +0400

    fix readme link for transaction lifecycle (#1309)

commit 111641ff8be49fc209cfdbfcd3aca91133780817
Author: Antony Denyer <email@antonydenyer.co.uk>
Date:   Thu Jan 13 16:03:56 2022 +0000

    readme fix links (#1307)

commit 595520d9d220cd0d350a9dab1b59294ea7eb3893
Author: Antony Denyer <email@antonydenyer.co.uk>
Date:   Thu Jan 13 15:42:24 2022 +0000

    Update readme to fix dead links (#1306)

    * Update readme to fix dead links

    Co-authored-by: achraf17 <achrafsellami0@gmail.com>

commit 729f58f57840e8c5eadf8d5620341393de0fd5a7
Author: Antony Denyer <email@antonydenyer.co.uk>
Date:   Thu Jan 13 08:56:11 2022 +0000

    Bump version to v21.10.1 (#1304)

commit 5c9f94d5f81a5608e051ffd6a06454dc527adcf1
Author: baptiste-b-pegasys <85155432+baptiste-b-pegasys@users.noreply.github.com>
Date:   Thu Jan 13 09:55:50 2022 +0100

    Fix errors when there is high load (#1302)

    * fix: concurrent modification on map

    * fix: seg fault
    write cache in same routine

    * revert modification

    Co-authored-by: Antony Denyer <email@antonydenyer.co.uk>

commit f45e6858f0ce4788ddbd8ee3e4a22f49b1345bdc
Author: Antony Denyer <email@antonydenyer.co.uk>
Date:   Wed Jan 12 12:35:27 2022 +0000

    Update packages to fix issues identified by cve db (#1303)

    CVE-2019-11254
    CVE-2020-27813

commit f6a2b20a7fb7dba7d10e49a72e4a6a9a47e9bf76
Author: Lucas Saldanha <lucas.saldanha@consensys.net>
Date:   Thu Jan 13 01:01:54 2022 +1300

    Merge pull request #1280 from lucassaldanha/qbft-logs

    Remove warn log when receiving pre-prepare msg for future block

commit aa9e5b879b883c569b7e7a91400e94270f0f0866
Merge: 07dd08ea6 8abac49bc
Author: Antony Denyer <email@antonydenyer.co.uk>
Date:   Wed Jan 12 11:52:32 2022 +0000

    Merge pull request #1289 from ConsenSys/github/template

    add contributing statement on issues

commit 8abac49bcad055c1a5df9ee9f21715c2eec1267c
Merge: 38440a65b 07dd08ea6
Author: Antony Denyer <email@antonydenyer.co.uk>
Date:   Wed Jan 12 09:51:50 2022 +0000

    Merge branch 'master' into github/template

commit 38440a65ba4bf01ea3f0ab2852fc6b2ef21501e8
Author: baptiste-b-pegasys <85155432+baptiste-b-pegasys@users.noreply.github.com>
Date:   Wed Jan 12 10:33:42 2022 +0100

    Update .github/CONTRIBUTING.md

commit 07dd08ea61076e107507aa2fe17503e2a86eb4f5
Author: baptiste-b-pegasys <85155432+baptiste-b-pegasys@users.noreply.github.com>
Date:   Tue Jan 11 15:29:39 2022 +0100

    fix: limit number of concurrent ATs running (#1276)

    limit number of concurrent ATs running and the size of the matrix

commit d755fa1babe8b73b65156d808e7023caf71dfbfa
Author: Baptiste Boussemart <baptiste.boussemart@consensys.net>
Date:   Tue Jan 4 14:49:57 2022 +0100

    add contributing statement on issues

commit 919800f019cc5d2b931b5cd81600640a8e7cd444
Author: Jitendra Bhurat <jbhurat@gmail.com>
Date:   Tue Nov 2 05:57:47 2021 -0400

    Added test to confirm that there is no deadlock when testQBFTBlock is set to 1 (#1272)

    Co-authored-by: Ricardo Silva <1945557+ricardolyn@users.noreply.github.com>

commit de5e8b25875295547f30a9419f47abd1fa115e0e
Merge: 3bb2ae67b ef940787d
Author: Antony Denyer <email@antonydenyer.co.uk>
Date:   Tue Nov 2 09:31:04 2021 +0000

    Merge pull request #1274 from antonydenyer/master

    Bump version to v21.10.0

commit ef940787de3fa14e7a7c0fca356ae95944882225
Merge: cf7fdc489 3bb2ae67b
Author: Antony Denyer <email@antonydenyer.co.uk>
Date:   Tue Nov 2 09:02:25 2021 +0000

    Merge branch 'master' into master

commit 3bb2ae67b4abde6419c0d1f2f0304c4a54386a51
Merge: 9b8739efc 6be279da7
Author: Antony Denyer <email@antonydenyer.co.uk>
Date:   Tue Nov 2 09:02:13 2021 +0000

    Merge pull request #1273 from chris-j-h/upstream-merge-fixes

    Upstream merge fixes

commit cf7fdc489f520ed2afaa5ea833073afee74a5903
Author: Antony Denyer <git@antonydenyer.co.uk>
Date:   Mon Nov 1 10:36:09 2021 +0000

    Bump version to v21.10.0

commit 6be279da746cc11a9550da03b5db72518cd7678b
Author: chris <chrishounsom@icloud.com>
Date:   Mon Nov 1 10:24:27 2021 +0000

    Add Quorum Privacy Precompile to ActivePrecompiles list
    This is currently only used for the experimental YoloV2 EIP 2929 (where all active precompiles for the current block height must be known) so not critical but worth fixing ahead of the concrete release that will be pulled in from a future upstream geth merge

    Also includes core/vm: fix Byzantium address list (#22603) (cherry picked from commit 44fe466999ce7f8b02de7e83de955f8847342309)

commit 9b8739efc933036b8956c6c2c236d3a5f30afaa4
Author: Satpal <28562234+SatpalSandhu61@users.noreply.github.com>
Date:   Thu Oct 7 14:28:00 2021 +0100

    Receipt unit test was not checking QuorumReceiptExtraData in PSReceipt (#1266)

commit 3d453a45fd0e69ed2e33c5cb51560bd2473c544b
Author: baptiste-b-pegasys <85155432+baptiste-b-pegasys@users.noreply.github.com>
Date:   Fri Oct 1 10:01:57 2021 +0200

    Revert "fix: private trie cache db with gc (#1235)" (#1262)

    Bug found in the MPS, want to package this feature for both dual state and MPS.

    This reverts commit 614b212d4f99565acde226dd7c74dfa7d559aee2.

commit 87648f6a39064efc5ba4fc775f32ff2af4531fa1
Author: Ricardo Silva <1945557+ricardolyn@users.noreply.github.com>
Date:   Thu Sep 30 17:01:56 2021 +0100

    Send transactions to all peers instead of a sub-set (#1261)

    * send transactions to all peers

    * add unit test

    * tidy up

    * fix lint issues

    * add wait for peers to be synced

    * Apply suggestions from code review

    Co-authored-by: baptiste-b-pegasys <85155432+baptiste-b-pegasys@users.noreply.github.com>

    * improve handling of peers registration and fix issues from suggestion.

    Co-authored-by: baptiste-b-pegasys <85155432+baptiste-b-pegasys@users.noreply.github.com>

commit 743e4a164b39d1186bbc27367b4cd2cfc4bb635c
Author: Vinod Damle <vdamle@users.noreply.github.com>
Date:   Thu Sep 30 09:31:07 2021 -0400

    IBFT: Ensure that Committed Seal is not zero value (#1118)

    * Ensure there is no zero addr Committed Seal

    When a commit message is processed, if the Proposal is missing due to
    some reason, we should not generate a Zero address Committed Seal. Such
    an incorrect seal causes `BAD BLOCK` failure with an `invalid signature`
    error during operations such as Block import

    * run gofmt

    * Remove stale comment

    * Add unit test

    * Revert "Remove stale comment"

    This reverts commit 279be718b6ee3926125fa2b0397ca75f9e90b972.

    * Move comment

    * Update test with error checking

    Co-authored-by: baptiste-b-pegasys <85155432+baptiste-b-pegasys@users.noreply.github.com>

    Co-authored-by: baptiste-b-pegasys <85155432+baptiste-b-pegasys@users.noreply.github.com>

commit b57775d045863adfe84764a3849713086bb6f378
Author: Loïc Vincent-Genod <37535451+VGLoic@users.noreply.github.com>
Date:   Thu Sep 30 10:57:20 2021 +0200

    replace crypto secp256k1 (#1260)

    * delete internal module

    * remove crypto/secp256k1 dependency

    * precise new repository in README

commit 155bcdb483e59b5e5930e5360998b8fcf3b54e0a
Author: baptiste-b-pegasys <85155432+baptiste-b-pegasys@users.noreply.github.com>
Date:   Wed Sep 22 11:04:22 2021 +0200

    typo: change whitelist to autorization list (#1257)

    * typo: change whitelist to autorization list

    * add unit test

    * fix: add log when using deprecated flag

commit 90307a783873eafa9406c7a2d3fb1c05258a84db
Author: Loïc Vincent-Genod <37535451+VGLoic@users.noreply.github.com>
Date:   Tue Sep 21 12:44:14 2021 +0200

    feat: add build sentinel job in the build workflow (#1256)

    Co-authored-by: Ricardo Silva <1945557+ricardolyn@users.noreply.github.com>

commit c6bce6491817dc790584804d84d6c750b750cf9e
Author: Nam Truong <nam.p.truong@outlook.com>
Date:   Tue Sep 14 14:32:52 2021 +0100

    Contract extension with mandatory recipients (#1252)

    * Add MandatoryRecipients data in SendRequest and SendSignedTxRequest to private TM

    * Update send and sendsignedtx method to include MandatoryRecipients, reject if PTM does not support correct version

    * Add new Tessera feature version - mandatoryRecipientsVersion

    * Add PrivacyFlagMandatoryRecipients and new feature to support MandatoryRecipients

    * Add mandatoryFor to PrivateTxArgs, validations and unit tests

    * Implement GetMandatory api call to Tessera

    * interface impl

    * update mock generation

    * update mock generation

    * Cater for mandatory recipients data when extending contract

    * api to retrieve privacymetadata - also include mandatory recipients for relevant flag type

    * unit tests

    * fix lint check

    * don't fetch mr when tx is standardprivate

    Co-authored-by: Krish Swaminathan <39480483+Krish1979@users.noreply.github.com>

commit 58ac9bae4eb2da01eb645391cf6827526b3f3aed
Author: Nam Truong <nam.p.truong@outlook.com>
Date:   Tue Sep 14 10:30:38 2021 +0100

    Fix private receipt of privacy marker transaction (#1253)

    * Add MandatoryRecipients data in SendRequest and SendSignedTxRequest to private TM

    * Update send and sendsignedtx method to include MandatoryRecipients, reject if PTM does not support correct version

    * Add new Tessera feature version - mandatoryRecipientsVersion

    * Add PrivacyFlagMandatoryRecipients and new feature to support MandatoryRecipients

    * Add mandatoryFor to PrivateTxArgs, validations and unit tests

    * fix return private receipt if transaction is a privacy marker transaction

commit c1add76e3effe97fd6c2eb2329bc0d63512b9f39
Author: baptiste-b-pegasys <85155432+baptiste-b-pegasys@users.noreply.github.com>
Date:   Wed Sep 8 10:25:24 2021 +0200

    upgradebot with git configured so git merge works (#1250)

    Co-authored-by: Ricardo Silva <1945557+ricardolyn@users.noreply.github.com>

commit 38999c7f221f77077864270d1948be0f8fc1ef04
Author: Nam Truong <nam.p.truong@outlook.com>
Date:   Tue Sep 7 16:23:34 2021 +0100

    Support mandatory recipients (#1243)

    * Add MandatoryRecipients data in SendRequest and SendSignedTxRequest to private TM

    * Update send and sendsignedtx method to include MandatoryRecipients, reject if PTM does not support correct version

    * Add new Tessera feature version - mandatoryRecipientsVersion

    * Add PrivacyFlagMandatoryRecipients and new feature to support MandatoryRecipients

    * Add mandatoryFor to PrivateTxArgs, validations and unit tests

    Co-authored-by: Krish Swaminathan <39480483+Krish1979@users.noreply.github.com>

commit 15fceadfd0c0173ecdaf21807e9bb6a1871d58df
Author: baptiste-b-pegasys <85155432+baptiste-b-pegasys@users.noreply.github.com>
Date:   Fri Sep 3 11:18:34 2021 +0200

    fix: flacky unit test (#1248)

    * fix: flacky unit test
    wait group outside the go routine
    retry loop for test that depends on non-triggered state

    * fix: review

    Co-authored-by: Ricardo Silva <1945557+ricardolyn@users.noreply.github.com>

commit df651519a53790676dbef401b5f24b1bc0b183da
Author: Quorum Bot <46820074+quorumbot@users.noreply.github.com>
Date:   Fri Sep 3 09:20:44 2021 +0100

    [Upgrade] Go-Ethereum release v1.9.25 (#1223)

    * params: begin v1.9.25 release cycle

    * crypto/bn256: improve bn256 fuzzer (#21815)

    * crypto/cloudflare: fix nil deref in random G1/G2 reading

    * crypto/bn256: improve fuzzer

    * crypto/bn256: fix some flaws in fuzzer

    * crypto/bn256: better comments for u, P and Order (#21836)

    * tests/fuzzers: improve the fuzzers (#21829)

    * tests/fuzzers, common/bitutil: make fuzzers use correct returnvalues + remove output

    * tests/fuzzers/stacktrie: fix duplicate-key insertion in stacktrie (false positive)

    * tests/fuzzers/stacktrie: fix compilation error

    * tests/fuzzers: linter nits

    * core/vm, protocol_params: implement eip-2565 modexp repricing (#21607)

    * core/vm, protocol_params: implement eip-2565 modexp repricing

    * core/vm: fix review concerns

    * core, all: split vm.Context into BlockContext and TxContext (#21672)

    * all: core: split vm.Config into BlockConfig and TxConfig

    * core: core/vm: reset EVM between tx in block instead of creating new

    * core/vm: added docs

    * accounts/abi: template: set events Raw field in Parse methods (#21807)

    * common: fix documentation of Address.SetBytes (#21814)

    * crypto/bn256: refine comments according to #19577, #21595, and #21836 (#21847)

    * consensus/ethash: fix usage of *reflect.SliceHeader (#21372)

    * consensus/ethash: only use *reflect.SliceHeader, not reflect.SliceHeader. See comment here: https://github.com/golang/go/issues/40397\#issuecomment-663748689

    * consensus/ethash: pr feedback from @mdempsky, makes a copy of dest such that is not mutated

    * consensus/ethash: remove noop assign

    * consensus/ethash: apply same fix to another location

    Co-authored-by: Péter Szilágyi <peterke@gmail.com>
    Co-authored-by: Martin Holst Swende <martin@swende.se>

    * cmd/geth: remove retesteth

    * crypto/secp256k1: add checking z sign in affineFromJacobian (#18419)

    The z == 0 check is hit whenever we Add two points with the same x1/x2
    coordinate. crypto/elliptic uses the same check in their affineFromJacobian
    function. This change does not affect block processing or tx signature verification
    in any way, because it does not use the Add or Double methods.

    * cmd/geth: improve les test on windows (#21860)

    * all: disable recording preimage of trie keys (#21402)

    * cmd, core, eth, light, trie: disable recording preimage by default

    * core, eth: fix unit tests

    * core: fix import

    * all: change to nopreimage

    * cmd, core, eth, trie: use cache.preimages flag

    * cmd: enable preimages for archive node

    * cmd/utils, trie: simplify preimage tracking a bit

    * core: fix linter

    Co-authored-by: Péter Szilágyi <peterke@gmail.com>

    * metrics: fix the panic for reading empty cpu stats (#21864)

    * node: support expressive origin rules in ws.origins (#21481)

    * Only compare hostnames in ws.origins

    Also using a helper function for ToLower consolidates all preparation steps in one function for more maintainable consistency.

    Spaces => tabs

    Remove a semicolon

    Add space at start of comment

    Remove parens around conditional

    Handle case wehre parsed hostname is empty

    When passing a single word like "localhost" the parsed hostname is an empty string. Handle this and the error-parsing case together as default, and the nonempty hostname case in the conditional.

    Refactor with new originIsAllowed functions

    Adds originIsAllowed() & ruleAllowsOrigin(); removes prepOriginForComparison

    Remove blank line

    Added tests for simple allowed-orign rule

    which does not specify a protocol or port, just a hostname

    Fix copy-paste: `:=` => `=`

    Remove parens around conditional

    Remove autoadded whitespace on blank lines

    Compare scheme, hostname, and port with rule

    if the rule specifies those portions.

    Remove one autoadded trailing whitespace

    Better handle case where only origin host is given

    e.g. "localhost"

    Remove parens around conditional

    Refactor: attemptWebsocketConnectionFromOrigin DRY

    Include return type on helper function

    Provide srv obj in helper fn

    Provide srv to helper fn

    Remove stray underscore

    Remove blank line

    parent 93e666b4c1e7e49b8406dc83ed93f4a02ea49ac1
    author wbt <wbt@users.noreply.github.com> 1598559718 -0400
    committer Martin Holst Swende <martin@swende.se> 1605602257 +0100
    gpgsig -----BEGIN PGP SIGNATURE-----

     iQFFBAABCAAvFiEEypmrtbNuJK1doP1AaDtDjAWl3fAFAl+zi9ARHG1hcnRpbkBz
     d2VuZGUuc2UACgkQaDtDjAWl3fDRiwgAoMtzU8dwRV7Q9xkCwWEx9Wz2f3n6jUr2
     VWBycDKGKwRkPPOER3oc9kzjGU/P1tFlK07PjfnAKZ9KWzxpDcJZwYM3xCBurG7A
     16y4YsQnzgPNONv3xIkdi3RZtDBIiPFFEmdZFFvZ/jKexfI6JIYPngCAoqdTIFb9
     On/aPvvVWQn1ExfmarsvvJ7kUDUG77tZipuacEH5FfFsfelBWOEYPe+I9ToUHskv
     +qO6rOkV1Ojk8eBc6o0R1PnApwCAlEhJs7aM/SEOg4B4ZJJneiFuEXBIG9+0yS2I
     NOicuDPLGucOB5nBsfIKI3USPeE+3jxdT8go2lN5Nrhm6MimoILDsQ==
     =sgUp
     -----END PGP SIGNATURE-----

    Refactor: drop err var for more concise test lines

    Add several tests for new WebSocket origin checks

    Remove autoadded whitespace on blank lines

    Restore TestWebsocketOrigins originally-named test

    and rename the others to be helpers rather than full tests

    Remove autoadded whitespace on blank line

    Temporarily comment out new test sets

    Uncomment test around origin rule with scheme

    Remove tests without scheme on browser origin

    per https://github.com/ethereum/go-ethereum/pull/21481/files#r479371498

    Uncomment tests with port; remove some blank lines

    Handle when browser does not specify scheme/port

    Uncomment test for including scheme & port in rule

    Add IP tests

    * node: more tests + table-driven, ws origin changes

    Co-authored-by: Martin Holst Swende <martin@swende.se>

    * trie, rpc, cmd/geth: fix tests on 32-bit and windows + minor rpc fixes (#21871)

    * trie: fix tests to work on 32-bit systems

    * les: make test work on 32-bit platform

    * cmd/geth: fix windows-issues on tests

    * trie: improve balance

    * cmd/geth: make account tests less verbose + less mem intense

    * rpc: make debug-level log output less verbose

    * cmd/geth: lint

    * crypto/bn256: fix bn256Mul fuzzer to not hang on large input (#21872)

    * crypto/bn256: fix bn256Mul fuzzer to not hang on large input

    * Update crypto/bn256/bn256_fuzz.go

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

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

    * p2p: avoid spinning loop on out-of-handles (#21878)

    * p2p: avoid busy-loop on temporary errors

    * p2p: address review concerns

    * les/utils: protect against WeightedRandomSelect overflow (#21839)

    Also fixes a bug in les/flowcontrol that caused the overflow.

    * github: Add new style of issue-templates

    closes #20024

    * tests/fuzzers/bls1381: add bls fuzzer (#21796)

    * added bls fuzzer

    * crypto/bls12381: revert bls-changes, fixup fuzzer tests

    * fuzzers: split bls fuzzing into 8 different units

    * fuzzers/bls: remove (now stale) corpus

    * crypto/bls12381: added blsfuzz corpus

    * fuzzers/bls12381: fix the bls corpus

    * fuzzers: fix oss-fuzz script

    * tests/fuzzers: fixups on bls corpus

    * test/fuzzers: remove leftover corpus

    Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

    * cmd/faucet: improve handling of facebook post url (#21838)

    Resolves #21532

    Co-authored-by: roger <dengjun@huobi.com>

    * les: fix GetProofsV2 bug (#21896)

    * github: Remove vulnerability.md (#21894)

    This type is automatically offered by github after changing to the new style and a security.md being present

    * cmd/devp2p/internal/ethtest: add 'large announcement' tests (#21792)

    * cmd/devp2p/internal/ethtest: added large announcement tests

    * cmd/devp2p/internal/ethtest: added large announcement tests

    * cmd/devp2p/internal/ethtest: refactored stuff a bit

    * cmd/devp2p/internal/ethtest: added TestMaliciousStatus/Handshake

    * cmd/devp2p/internal/ethtest: fixed rebasing issue

    * happy linter, happy life

    * cmd/devp2p/internal/ethtest: used readAndServe

    * stuff

    * cmd/devp2p/internal/ethtest: fixed test cases

    * core/types: fixed typo (#21897)

    * all: simplify nested complexity and if blocks ending with a return statement (#21854)

    Changes:

        Simplify nested complexity
        If an if blocks ends with a return statement then remove the else nesting.

    Most of the changes has also been reported in golint https://goreportcard.com/report/github.com/ethereum/go-ethereum#golint

    * graphql: always return 400 if errors are present in the response (#21882)

    * Make sure to return 400 when errors are present in the response

    * graphql: use less memory in chainconfig for tests

    Co-authored-by: Martin Holst Swende <martin@swende.se>

    * all: remove redundant conversions and import names (#21903)

    * p2p/discover: fix deadlock in discv5 message dispatch (#21858)

    This fixes a deadlock that could occur when a response packet arrived
    after a call had already rece…
@howardjohn
Copy link
Contributor

We see this fairly often in our fuzzing. Its not consistently reproducible but does show up in CI. I couldn't reproduce it within 30min with -race -d=checkptr locally. The stack trace is always the same:

goroutine 7 [running]:
runtime.throw({0x3a1a385?, 0x639cbc0?})
 runtime/panic.go:992 +0x71 fp=0x10c0000b3d48 sp=0x10c0000b3d18 pc=0x596bf1
runtime.panicCheck1(0x10c000d60b90?, {0x3a1a385, 0x12})
 runtime/panic.go:35 +0x87 fp=0x10c0000b3d68 sp=0x10c0000b3d48 pc=0x5944e7
runtime.goPanicIndex(0xde0, 0x3)
 runtime/panic.go:88 +0x34 fp=0x10c0000b3da8 sp=0x10c0000b3d68 pc=0x5945d4
runtime.sellock({0x10c0000b3f80, 0x3, 0x0?}, {0x10c0000b3f62, 0x10c0000b4670, 0x0?})
 runtime/select.go:37 +0x9d fp=0x10c0000b3dd8 sp=0x10c0000b3da8 pc=0x5a8afd
runtime.selectgo(0x10c0000b3f80, 0x10c0000b3f5c, 0x10c00019c480?, 0x0, 0x0?, 0x1)
 runtime/select.go:331 +0x7a9 fp=0x10c0000b3f18 sp=0x10c0000b3dd8 pc=0x5a94c9
go.opencensus.io/stats/view.(*worker).start(0x10c00019c480)
 go.opencensus.io@v0.23.0/stats/view/worker.go:276 +0xce fp=0x10c0000b3fc0 sp=0x10c0000b3f18 pc=0x150390e
go.opencensus.io/stats/view.init.0.func1()
 go.opencensus.io@v0.23.0/stats/view/worker.go:34 +0x3c fp=0x10c0000b3fe0 sp=0x10c0000b3fc0 pc=0x1502abc
runtime.goexit()
 runtime/asm_amd64.s:1571 +0x1 fp=0x10c0000b3fe8 sp=0x10c0000b3fe0 pc=0x5ca1c1
created by go.opencensus.io/stats/view.init.0
 go.opencensus.io@v0.23.0/stats/view/worker.go:34 +0x9a

Let me know if there is other info we could provide that is of use.

@mdempsky
Copy link
Member

@howardjohn Thanks. If we prepare a debug CL to add some extra diagnostics to help understand this issue, would you be able/willing to run it on your CI system for a bit to capture the output?

@AdamKorcz
Copy link

@howardjohn Thanks. If we prepare a debug CL to add some extra diagnostics to help understand this issue, would you be able/willing to run it on your CI system for a bit to capture the output?

This would be great to have in OSS-fuzz too. If you'd need help with integrating it, I would be happy to look into that.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Status: Triage Backlog
Development

No branches or pull requests

8 participants